-
Notifications
You must be signed in to change notification settings - Fork 21
/
index.js
94 lines (89 loc) · 2.6 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { createInterpolateElement } from '@wordpress/element';
/**
* Internal dependencies
*/
import AppModal from '~/components/app-modal';
import AppButton from '~/components/app-button';
import WarningIcon from '~/components/warning-icon';
import './index.scss';
/**
* Clicking on the "Yes, I want a new account" button in the warning modal for creating a new Google Merchant Center account.
*
* @event gla_mc_account_warning_modal_confirm_button_click
*/
/**
* @param {Object} props React props.
* @param { { name: string, domain:string } } props.existingAccount Account name and domain
* @param {Function} [props.onContinue] Callback function when confirming the modal
* @param {Function} [props.onRequestClose] Callback function when closing the modal
*
* @fires gla_mc_account_warning_modal_confirm_button_click
*/
const WarningModal = ( {
existingAccount,
onContinue = () => {},
onRequestClose = () => {},
} ) => {
const handleCreateAccountClick = () => {
onContinue();
};
return (
<AppModal
className="gla-mc-warning-modal"
title={ __(
'Create Google Merchant Center Account',
'google-listings-and-ads'
) }
buttons={ [
<AppButton
key="confirm"
isSecondary
eventName="gla_mc_account_warning_modal_confirm_button_click"
onClick={ handleCreateAccountClick }
>
{ __(
'Yes, I want a new account',
'google-listings-and-ads'
) }
</AppButton>,
<AppButton key="cancel" isPrimary onClick={ onRequestClose }>
{ __( 'Cancel', 'google-listings-and-ads' ) }
</AppButton>,
] }
onRequestClose={ onRequestClose }
>
<p className="gla-mc-warning-modal__warning-text">
<WarningIcon />
<span>
{ __(
'Are you sure you want to create a new Google Merchant Center account?',
'google-listings-and-ads'
) }
</span>
</p>
<p>
{ createInterpolateElement(
__(
'You already have another verified account, <storename />, which is connected to this store’s URL, <storeurl />.',
'google-listings-and-ads'
),
{
storename: <strong>{ existingAccount.name }</strong>,
storeurl: <strong>{ existingAccount.domain }</strong>,
}
) }
</p>
<p>
{ __(
'If you create a new Google Merchant Center account, you will have to reclaim this store’s URL with the new account. This will cause any existing product listings or ads to stop running, and the other verified account will lose its claim.',
'google-listings-and-ads'
) }
</p>
</AppModal>
);
};
export default WarningModal;