forked from woocommerce/google-listings-and-ads
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tax-rate.js
108 lines (103 loc) · 3.15 KB
/
tax-rate.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import { createInterpolateElement } from '@wordpress/element';
/**
* Internal dependencies
*/
import { useAdaptiveFormContext } from '.~/components/adaptive-form';
import Section from '.~/wcdl/section';
import RadioHelperText from '.~/wcdl/radio-helper-text';
import AppRadioContentControl from '.~/components/app-radio-content-control';
import AppDocumentationLink from '.~/components/app-documentation-link';
import VerticalGapLayout from '.~/components/vertical-gap-layout';
/**
* @fires gla_documentation_link_click with `{ context: 'setup-mc-tax-rate', link_id: 'tax-rate-read-more', href: 'https://support.google.com/merchants/answer/160162' }`
* @fires gla_documentation_link_click with `{ context: 'setup-mc-tax-rate', link_id: 'tax-rate-manual', href: 'https://www.google.com/retail/solutions/merchant-center/' }`
*/
const TaxRate = () => {
const {
getInputProps,
adapter: { renderRequestedValidation },
} = useAdaptiveFormContext();
return (
<Section
title={ __(
'Tax rate (required for U.S. only)',
'google-listings-and-ads'
) }
description={
<div>
<p>
{ __(
'This tax rate will be shown to potential customers, together with the cost of your product.',
'google-listings-and-ads'
) }
</p>
<p>
<AppDocumentationLink
context="setup-mc-tax-rate"
linkId="tax-rate-read-more"
href="https://support.google.com/merchants/answer/160162"
>
{ __( 'Read more', 'google-listings-and-ads' ) }
</AppDocumentationLink>
</p>
</div>
}
>
<Section.Card>
<Section.Card.Body>
<VerticalGapLayout size="large">
<AppRadioContentControl
{ ...getInputProps( 'tax_rate' ) }
label={ __(
'My store uses destination-based tax rates.',
'google-listings-and-ads'
) }
value="destination"
collapsible
>
<RadioHelperText>
{ __(
'Google’s estimated tax rates will automatically be applied to my product listings.',
'google-listings-and-ads'
) }
</RadioHelperText>
</AppRadioContentControl>
<AppRadioContentControl
{ ...getInputProps( 'tax_rate' ) }
label={ __(
'My store does not use destination-based tax rates.',
'google-listings-and-ads'
) }
value="manual"
collapsible
>
<RadioHelperText>
{ createInterpolateElement(
__(
'I’ll set my tax rates up manually in <link>Google Merchant Center</link>. I understand that if I don’t set this up, my products will be disapproved.',
'google-listings-and-ads'
),
{
link: (
<AppDocumentationLink
context="setup-mc-tax-rate"
linkId="tax-rate-manual"
href="https://www.google.com/retail/solutions/merchant-center/"
/>
),
}
) }
</RadioHelperText>
</AppRadioContentControl>
</VerticalGapLayout>
{ renderRequestedValidation( 'tax_rate' ) }
</Section.Card.Body>
</Section.Card>
</Section>
);
};
export default TaxRate;