@riosst100/pwa-marketplace 1.2.5 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/.github/workflows/dependabot.yml +28 -28
  2. package/package.json +18 -18
  3. package/src/Utilities/graphQL.js +76 -76
  4. package/src/componentOverrideMapping.js +17 -17
  5. package/src/components/BecomeSeller/becomeSeller.js +335 -335
  6. package/src/components/BecomeSeller/becomeSeller.module.css +46 -46
  7. package/src/components/BecomeSellerLink/becomeSellerLink.js +52 -52
  8. package/src/components/BecomeSellerLink/becomeSellerLink.module.css +12 -12
  9. package/src/components/BecomeSellerPage/becomeSellerPage.js +45 -45
  10. package/src/components/BecomeSellerPage/becomeSellerPage.module.css +21 -21
  11. package/src/components/Filter/index.js +53 -53
  12. package/src/components/Header/becomeSellerLink.js +28 -28
  13. package/src/components/Header/becomeSellerLink.module.css +12 -12
  14. package/src/components/Header/websiteSwitcher.js +109 -109
  15. package/src/components/Pagination/index.js +49 -49
  16. package/src/components/PhoneTextInput/phoneTextInput.module.css +21 -21
  17. package/src/components/ProductItem/index.js +50 -50
  18. package/src/components/Search/index.js +16 -16
  19. package/src/components/Seller/index.js +1 -1
  20. package/src/components/Seller/seller.js +249 -250
  21. package/src/components/SellerAccountPage/sellerAccountPage.js +110 -110
  22. package/src/components/SellerAccountPage/sellerAccountPage.module.css +55 -55
  23. package/src/components/SellerCountry/sellerCountry.gql.js +11 -11
  24. package/src/components/SellerInformation/index.js +1 -1
  25. package/src/components/SellerInformation/sellerInformation.js +90 -118
  26. package/src/components/SellerLocation/index.js +1 -1
  27. package/src/components/SellerLocation/sellerLocation.js +19 -23
  28. package/src/components/SellerLocation/sellerLocationItem.js +27 -25
  29. package/src/components/SellerPage/sellerPage.js +9 -9
  30. package/src/components/SellerProducts/sellerProducts.js +47 -67
  31. package/src/components/SellerReview/index.js +1 -1
  32. package/src/components/SellerReview/sellerReview.js +143 -143
  33. package/src/components/SellerReviewItem/sellerReviewItem.js +60 -60
  34. package/src/components/SellerVerification/sellerVerification.js +198 -198
  35. package/src/components/SellerVerification/sellerVerification.module.css +47 -47
  36. package/src/components/SellerVerificationPage/sellerVerificationPage.js +43 -43
  37. package/src/components/SellerVerificationPage/sellerVerificationPage.module.css +21 -21
  38. package/src/components/SortBy/index.js +24 -24
  39. package/src/components/WebsiteSwitcher/websiteSwitcher.js +109 -109
  40. package/src/components/commons/Slider/index.js +13 -13
  41. package/src/components/commons/Tabs/index.js +64 -64
  42. package/src/index.js +6 -6
  43. package/src/intercept.js +113 -113
  44. package/src/moduleOverrideWebpackPlugin.js +70 -70
  45. package/src/overwrites/peregrine/lib/store/actions/user/asyncActions.js +96 -96
  46. package/src/overwrites/peregrine/lib/talons/AccountMenu/useAccountMenuItems.js +74 -74
  47. package/src/overwrites/peregrine/lib/talons/Adapter/useAdapter.js +208 -208
  48. package/src/overwrites/peregrine/lib/talons/Header/storeSwitcher.gql.js +45 -45
  49. package/src/overwrites/peregrine/lib/talons/Header/useStoreSwitcher.js +204 -204
  50. package/src/overwrites/peregrine/lib/talons/Region/useRegion.js +102 -102
  51. package/src/overwrites/peregrine/lib/talons/SignIn/signIn.gql.js +56 -56
  52. package/src/overwrites/peregrine/lib/talons/SignIn/useSignIn.js +226 -226
  53. package/src/overwrites/peregrine/lib/util/deriveErrorMessage.js +34 -34
  54. package/src/overwrites/pwa-buildpack/lib/queries/getAvailableStoresConfigData.graphql +11 -11
  55. package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +112 -112
  56. package/src/overwrites/venia-ui/lib/components/Header/header.js +130 -130
  57. package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.js +105 -105
  58. package/src/overwrites/venia-ui/lib/components/Header/switcherItem.js +47 -47
  59. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/MegaMenu.spec.js +91 -91
  60. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/MegaMenuItem.spec.js +123 -123
  61. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/Submenu.spec.js +61 -61
  62. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/SubmenuColumn.spec.js +50 -50
  63. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenu.spec.js.snap +114 -114
  64. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenuItem.spec.js.snap +71 -71
  65. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/Submenu.spec.js.snap +59 -59
  66. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/SubmenuColumn.spec.js.snap +34 -34
  67. package/src/overwrites/venia-ui/lib/components/MegaMenu/index.js +1 -1
  68. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenu.js +90 -90
  69. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenu.module.css +12 -12
  70. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +156 -156
  71. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.module.css +30 -30
  72. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +89 -89
  73. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +42 -42
  74. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +99 -99
  75. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.module.css +28 -28
  76. package/src/overwrites/venia-ui/lib/components/SearchBar/__stories__/searchBar.js +11 -11
  77. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/searchField.spec.js.snap +72 -72
  78. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedCategories.spec.js.snap +30 -30
  79. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedProduct.spec.js.snap +69 -69
  80. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedProducts.spec.js.snap +7 -7
  81. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestions.spec.js.snap +12 -12
  82. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/autocomplete.spec.js +52 -52
  83. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/searchBar.spec.js +82 -82
  84. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/searchField.spec.js +87 -87
  85. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedCategories.spec.js +45 -45
  86. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedProduct.spec.js +43 -43
  87. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedProducts.spec.js +45 -45
  88. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestions.spec.js +110 -110
  89. package/src/overwrites/venia-ui/lib/components/SearchBar/autocomplete.js +172 -172
  90. package/src/overwrites/venia-ui/lib/components/SearchBar/autocomplete.module.css +62 -62
  91. package/src/overwrites/venia-ui/lib/components/SearchBar/index.js +1 -1
  92. package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.js +74 -74
  93. package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.module.css +49 -49
  94. package/src/overwrites/venia-ui/lib/components/SearchBar/searchField.js +40 -40
  95. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategories.js +48 -48
  96. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategories.module.css +13 -13
  97. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategory.js +49 -49
  98. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProduct.js +97 -97
  99. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProduct.module.css +24 -24
  100. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProducts.js +43 -43
  101. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProducts.module.css +13 -13
  102. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestions.js +75 -75
  103. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestions.module.css +6 -6
  104. package/src/overwrites/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js +75 -75
  105. package/src/overwrites/venia-ui/lib/targets/venia-ui-intercept.js +70 -70
  106. package/src/queries/getAvailableWebsitesConfigData.graphql +14 -14
  107. package/src/queries/index.js +30 -30
  108. package/src/talons/BecomeSeller/becomeSeller.gql.js +45 -45
  109. package/src/talons/BecomeSeller/useBecomeSeller.js +145 -145
  110. package/src/talons/BecomeSellerLink/useBecomeSellerLink.js +11 -11
  111. package/src/talons/BecomeSellerPage/useBecomeSellerPage.js +76 -76
  112. package/src/talons/Header/useBecomeSellerLink.js +13 -13
  113. package/src/talons/Header/useWebsiteSwitcher.js +218 -218
  114. package/src/talons/Seller/seller.gql.js +139 -204
  115. package/src/talons/Seller/useSeller.js +66 -71
  116. package/src/talons/SellerAccountPage/useSellerAccountPage.js +174 -174
  117. package/src/talons/SellerCountry/useSellerCountry.js +25 -25
  118. package/src/talons/WebsiteByIp/getWebsiteByIp.gql.js +13 -13
  119. package/src/talons/WebsiteByIp/useWebsiteByIp.js +34 -34
  120. package/src/talons/WebsiteSwitcher/useWebsiteSwitcher.js +218 -218
  121. package/src/theme/vars.js +6 -6
  122. package/src/util/mapSeller.js +7 -7
  123. package/src/components/OperatingHours/index.js +0 -1
  124. package/src/components/OperatingHours/operatingHours.js +0 -32
  125. package/src/components/Seller/sellerAddressCard.js +0 -48
  126. package/src/components/SellerDetail/index.js +0 -1
  127. package/src/components/SellerDetail/sellerDetail.js +0 -158
  128. package/src/components/SellerPage/core.js +0 -10
  129. package/src/talons/SellerProducts/useSellerProducts.js +0 -129
@@ -1,335 +1,335 @@
1
- import React from 'react';
2
- import { FormattedMessage, useIntl } from 'react-intl';
3
- import { Form } from 'informed';
4
- import { func, shape, string, bool } from 'prop-types';
5
- import { useBecomeSeller } from '@riosst100/pwa-marketplace/src/talons/BecomeSeller/useBecomeSeller';
6
-
7
- import { useStyle } from '@magento/venia-ui/lib/classify';
8
- import combine from '@magento/venia-ui/lib/util/combineValidators';
9
- import {
10
- hasLengthAtLeast,
11
- isRequired,
12
- validatePassword
13
- } from '@magento/venia-ui/lib/util/formValidators';
14
- import Button from '@magento/venia-ui/lib/components/Button';
15
- import Checkbox from '@magento/venia-ui/lib/components/Checkbox';
16
- import Field from '@magento/venia-ui/lib/components/Field';
17
- import Select from '@magento/venia-ui/lib/components/Select';
18
- import TextInput from '@magento/venia-ui/lib/components/TextInput';
19
- import defaultClasses from './becomeSeller.module.css';
20
- import FormError from '@magento/venia-ui/lib/components/FormError';
21
- import GoogleRecaptcha from '@magento/venia-ui/lib/components/GoogleReCaptcha';
22
- import SellerCountry from '@riosst100/pwa-marketplace/src/components/SellerCountry';
23
- import Region from '@magento/venia-ui/lib/components/Region';
24
- import Postcode from '@magento/venia-ui/lib/components/Postcode';
25
- import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
26
- import { Link } from 'react-router-dom';
27
-
28
- const BecomeSeller = props => {
29
- const talonProps = useBecomeSeller({
30
- initialValues: props.initialValues,
31
- onSubmit: props.onSubmit,
32
- onCancel: props.onCancel
33
- });
34
-
35
- const {
36
- errors,
37
- handleSubmit,
38
- handleChange,
39
- sellerType,
40
- handleEnterKeyPress,
41
- isDisabled,
42
- initialValues,
43
- recaptchaWidgetProps,
44
- isSeller
45
- } = talonProps;
46
- const { formatMessage } = useIntl();
47
- const classes = useStyle(defaultClasses, props.classes);
48
-
49
- const submitButton = (
50
- <Button
51
- className={classes.submitButton}
52
- disabled={isDisabled}
53
- type="submit"
54
- priority="high"
55
- onKeyDown={handleEnterKeyPress}
56
- data-cy="BecomeSeller-submitButton"
57
- >
58
- <FormattedMessage
59
- id={'becomeSeller.becomeSellerText'}
60
- defaultMessage={'Become a Seller'}
61
- />
62
- </Button>
63
- );
64
-
65
- const sellerTypeOptions = [
66
- {
67
- value: "individual",
68
- label: "Individual"
69
- },
70
- {
71
- value: "company",
72
- label: "Company"
73
- }
74
- ];
75
-
76
- if (isSeller) {
77
- return '';
78
- }
79
-
80
- return !isSeller ? (
81
- <Form
82
- data-cy="BecomeSeller-form"
83
- className={classes.root}
84
- initialValues={initialValues}
85
- onSubmit={handleSubmit}
86
- onChange={handleChange}
87
- >
88
- <h2 data-cy="BecomeSeller-title" className={classes.title}>
89
- <FormattedMessage
90
- id={'becomeSeller.becomeSellerText'}
91
- defaultMessage={'Become a Seller'}
92
- />
93
- </h2>
94
- <FormError errors={Array.from(errors.values())} />
95
- <Field
96
- id="sellerType"
97
- label={formatMessage({
98
- id: 'becomeSeller.sellerTypeText',
99
- defaultMessage: 'Seller Type'
100
- })}
101
- >
102
- <Select
103
- field="seller.seller_type"
104
- id={classes.root}
105
- items={sellerTypeOptions}
106
- />
107
- </Field>
108
- {sellerType == "company" && (
109
- <>
110
- <Field
111
- id="companyName"
112
- label={formatMessage({
113
- id: 'becomeSeller.companyNameText',
114
- defaultMessage: 'Company Name'
115
- })}
116
- >
117
- <TextInput
118
- id="companyName"
119
- field="seller.company_name"
120
- validate={isRequired}
121
- validateOnBlur
122
- mask={value => value && value.trim()}
123
- maskOnBlur={true}
124
- data-cy="seller-companyname"
125
- aria-label={formatMessage({
126
- id: 'global.companyNameRequired',
127
- defaultMessage: 'Company Name Required'
128
- })}
129
- />
130
- </Field>
131
- <Field
132
- id="companyRegistrationNumber"
133
- label={formatMessage({
134
- id: 'becomeSeller.companyRegistrationNumberText',
135
- defaultMessage: 'Company Registration Number'
136
- })}
137
- >
138
- <TextInput
139
- id="companyRegistrationNumber"
140
- field="seller.company_registration_number"
141
- validate={isRequired}
142
- validateOnBlur
143
- mask={value => value && value.trim()}
144
- maskOnBlur={true}
145
- data-cy="seller-registrationnumber"
146
- aria-label={formatMessage({
147
- id: 'global.registration_numberRequired',
148
- defaultMessage: 'Company Registration Number Required'
149
- })}
150
- />
151
- </Field>
152
- </>
153
- )}
154
- <Field
155
- id="sellerProfileName"
156
- label={formatMessage({
157
- id: 'becomeSeller.sellerProfileNameText',
158
- defaultMessage: 'Store Name'
159
- })}
160
- >
161
- <TextInput
162
- id="sellerProfileName"
163
- field="seller.seller_profile_name"
164
- validate={isRequired}
165
- validateOnBlur
166
- mask={value => value && value.trim()}
167
- maskOnBlur={true}
168
- data-cy="seller-profilename"
169
- aria-label={formatMessage({
170
- id: 'global.sellerProfileNameRequired',
171
- defaultMessage: 'Store Name is required.'
172
- })}
173
- />
174
- </Field>
175
- <Field
176
- id="storeURL"
177
- label={formatMessage({
178
- id: 'becomeSeller.storeURLText',
179
- defaultMessage: 'Store URL'
180
- })}
181
- >
182
- <TextInput
183
- id="storeUrl"
184
- field="seller.store_url"
185
- validate={isRequired}
186
- validateOnBlur
187
- mask={value => value && value.trim()}
188
- maskOnBlur={true}
189
- data-cy="seller-storeurl"
190
- aria-label={formatMessage({
191
- id: 'global.storeUrlRequired',
192
- defaultMessage: 'Store URL is required.'
193
- })}
194
- />
195
- </Field>
196
- <SellerCountry
197
- field="seller.country_id"
198
- validate={isRequired}
199
- />
200
- <Field
201
- id="addressLine1"
202
- label={formatMessage({
203
- id: 'becomeSeller.addressLine1Text',
204
- defaultMessage: 'Address Line 1'
205
- })}
206
- >
207
- <TextInput
208
- id="addressLine1"
209
- field="seller.address_line_1"
210
- validate={isRequired}
211
- validateOnBlur
212
- mask={value => value && value.trim()}
213
- maskOnBlur={true}
214
- data-cy="seller-addressline1"
215
- aria-label={formatMessage({
216
- id: 'global.addressLine1Required',
217
- defaultMessage: 'Address Line 1 is required'
218
- })}
219
- />
220
- </Field>
221
- <Field
222
- id="addressLine2"
223
- label={formatMessage({
224
- id: 'becomeSeller.addressLine2Text',
225
- defaultMessage: 'Address Line 2'
226
- })} optional={true}
227
- >
228
- <TextInput
229
- id="addressLine2"
230
- field="seller.address_line_2"
231
- validateOnBlur
232
- mask={value => value && value.trim()}
233
- maskOnBlur={true}
234
- data-cy="seller-addressline2"
235
- />
236
- </Field>
237
- <Field
238
- id="city"
239
- label={formatMessage({
240
- id: 'global.city',
241
- defaultMessage: 'City'
242
- })}
243
- >
244
- <TextInput
245
- id="city"
246
- field="seller.city"
247
- validate={isRequired}
248
- />
249
- </Field>
250
- <Region
251
- fieldInput="seller.region"
252
- fieldSelect="seller.region_id"
253
- label={formatMessage({
254
- id: 'global.region',
255
- defaultMessage: 'State / Province'
256
- })}
257
- translationId="global.region"
258
- countryCodeField="seller.country_id"
259
- validate={isRequired}
260
- />
261
- <Postcode
262
- validate={isRequired}
263
- fieldInput="seller.postcode"
264
- label={formatMessage({
265
- id: 'global.postcode',
266
- defaultMessage: 'Postal Code'
267
- })}
268
- />
269
- <Field
270
- id="contactNumber"
271
- label={formatMessage({
272
- id: 'global.contactNumber',
273
- defaultMessage: 'Contact Number'
274
- })}
275
- >
276
- <TextInput
277
- id="contactNumber"
278
- field="seller.contact_number"
279
- validate={isRequired}
280
- />
281
- </Field>
282
- <div className={classes.subscribe}>
283
- <Checkbox
284
- field="become_seller_agreement"
285
- id="becomeSellerAgreement"
286
- validate={isRequired}
287
- label={(
288
- <>
289
- {formatMessage({
290
- id: 'becomeSeller.becomeSellerAgreementText',
291
- defaultMessage: 'I agree the Terms and Condition'
292
- })} <span>
293
- (<a href={'/seller-term-conditions'}>
294
- <u>
295
- {formatMessage({
296
- id: 'becomeSellerPage.termConditions',
297
- defaultMessage: 'Terms and Conditions'
298
- })}
299
- </u>
300
- </a>)
301
- </span>
302
- </>
303
- )}
304
- />
305
- </div>
306
- <GoogleRecaptcha {...recaptchaWidgetProps} />
307
- <div className={classes.actions}>
308
- {submitButton}
309
- </div>
310
- </Form>
311
- ) : '';
312
- };
313
-
314
- BecomeSeller.propTypes = {
315
- classes: shape({
316
- actions: string,
317
- lead: string,
318
- root: string,
319
- subscribe: string
320
- }),
321
- initialValues: shape({
322
- sellerProfileName: string,
323
- companyName: string
324
- }),
325
- isCancelButtonHidden: bool,
326
- onSubmit: func,
327
- onCancel: func
328
- };
329
-
330
- BecomeSeller.defaultProps = {
331
- onCancel: () => {},
332
- isCancelButtonHidden: true
333
- };
334
-
335
- export default BecomeSeller;
1
+ import React from 'react';
2
+ import { FormattedMessage, useIntl } from 'react-intl';
3
+ import { Form } from 'informed';
4
+ import { func, shape, string, bool } from 'prop-types';
5
+ import { useBecomeSeller } from '@riosst100/pwa-marketplace/src/talons/BecomeSeller/useBecomeSeller';
6
+
7
+ import { useStyle } from '@magento/venia-ui/lib/classify';
8
+ import combine from '@magento/venia-ui/lib/util/combineValidators';
9
+ import {
10
+ hasLengthAtLeast,
11
+ isRequired,
12
+ validatePassword
13
+ } from '@magento/venia-ui/lib/util/formValidators';
14
+ import Button from '@magento/venia-ui/lib/components/Button';
15
+ import Checkbox from '@magento/venia-ui/lib/components/Checkbox';
16
+ import Field from '@magento/venia-ui/lib/components/Field';
17
+ import Select from '@magento/venia-ui/lib/components/Select';
18
+ import TextInput from '@magento/venia-ui/lib/components/TextInput';
19
+ import defaultClasses from './becomeSeller.module.css';
20
+ import FormError from '@magento/venia-ui/lib/components/FormError';
21
+ import GoogleRecaptcha from '@magento/venia-ui/lib/components/GoogleReCaptcha';
22
+ import SellerCountry from '@riosst100/pwa-marketplace/src/components/SellerCountry';
23
+ import Region from '@magento/venia-ui/lib/components/Region';
24
+ import Postcode from '@magento/venia-ui/lib/components/Postcode';
25
+ import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
26
+ import { Link } from 'react-router-dom';
27
+
28
+ const BecomeSeller = props => {
29
+ const talonProps = useBecomeSeller({
30
+ initialValues: props.initialValues,
31
+ onSubmit: props.onSubmit,
32
+ onCancel: props.onCancel
33
+ });
34
+
35
+ const {
36
+ errors,
37
+ handleSubmit,
38
+ handleChange,
39
+ sellerType,
40
+ handleEnterKeyPress,
41
+ isDisabled,
42
+ initialValues,
43
+ recaptchaWidgetProps,
44
+ isSeller
45
+ } = talonProps;
46
+ const { formatMessage } = useIntl();
47
+ const classes = useStyle(defaultClasses, props.classes);
48
+
49
+ const submitButton = (
50
+ <Button
51
+ className={classes.submitButton}
52
+ disabled={isDisabled}
53
+ type="submit"
54
+ priority="high"
55
+ onKeyDown={handleEnterKeyPress}
56
+ data-cy="BecomeSeller-submitButton"
57
+ >
58
+ <FormattedMessage
59
+ id={'becomeSeller.becomeSellerText'}
60
+ defaultMessage={'Become a Seller'}
61
+ />
62
+ </Button>
63
+ );
64
+
65
+ const sellerTypeOptions = [
66
+ {
67
+ value: "individual",
68
+ label: "Individual"
69
+ },
70
+ {
71
+ value: "company",
72
+ label: "Company"
73
+ }
74
+ ];
75
+
76
+ if (isSeller) {
77
+ return '';
78
+ }
79
+
80
+ return !isSeller ? (
81
+ <Form
82
+ data-cy="BecomeSeller-form"
83
+ className={classes.root}
84
+ initialValues={initialValues}
85
+ onSubmit={handleSubmit}
86
+ onChange={handleChange}
87
+ >
88
+ <h2 data-cy="BecomeSeller-title" className={classes.title}>
89
+ <FormattedMessage
90
+ id={'becomeSeller.becomeSellerText'}
91
+ defaultMessage={'Become a Seller'}
92
+ />
93
+ </h2>
94
+ <FormError errors={Array.from(errors.values())} />
95
+ <Field
96
+ id="sellerType"
97
+ label={formatMessage({
98
+ id: 'becomeSeller.sellerTypeText',
99
+ defaultMessage: 'Seller Type'
100
+ })}
101
+ >
102
+ <Select
103
+ field="seller.seller_type"
104
+ id={classes.root}
105
+ items={sellerTypeOptions}
106
+ />
107
+ </Field>
108
+ {sellerType == "company" && (
109
+ <>
110
+ <Field
111
+ id="companyName"
112
+ label={formatMessage({
113
+ id: 'becomeSeller.companyNameText',
114
+ defaultMessage: 'Company Name'
115
+ })}
116
+ >
117
+ <TextInput
118
+ id="companyName"
119
+ field="seller.company_name"
120
+ validate={isRequired}
121
+ validateOnBlur
122
+ mask={value => value && value.trim()}
123
+ maskOnBlur={true}
124
+ data-cy="seller-companyname"
125
+ aria-label={formatMessage({
126
+ id: 'global.companyNameRequired',
127
+ defaultMessage: 'Company Name Required'
128
+ })}
129
+ />
130
+ </Field>
131
+ <Field
132
+ id="companyRegistrationNumber"
133
+ label={formatMessage({
134
+ id: 'becomeSeller.companyRegistrationNumberText',
135
+ defaultMessage: 'Company Registration Number'
136
+ })}
137
+ >
138
+ <TextInput
139
+ id="companyRegistrationNumber"
140
+ field="seller.company_registration_number"
141
+ validate={isRequired}
142
+ validateOnBlur
143
+ mask={value => value && value.trim()}
144
+ maskOnBlur={true}
145
+ data-cy="seller-registrationnumber"
146
+ aria-label={formatMessage({
147
+ id: 'global.registration_numberRequired',
148
+ defaultMessage: 'Company Registration Number Required'
149
+ })}
150
+ />
151
+ </Field>
152
+ </>
153
+ )}
154
+ <Field
155
+ id="sellerProfileName"
156
+ label={formatMessage({
157
+ id: 'becomeSeller.sellerProfileNameText',
158
+ defaultMessage: 'Store Name'
159
+ })}
160
+ >
161
+ <TextInput
162
+ id="sellerProfileName"
163
+ field="seller.seller_profile_name"
164
+ validate={isRequired}
165
+ validateOnBlur
166
+ mask={value => value && value.trim()}
167
+ maskOnBlur={true}
168
+ data-cy="seller-profilename"
169
+ aria-label={formatMessage({
170
+ id: 'global.sellerProfileNameRequired',
171
+ defaultMessage: 'Store Name is required.'
172
+ })}
173
+ />
174
+ </Field>
175
+ <Field
176
+ id="storeURL"
177
+ label={formatMessage({
178
+ id: 'becomeSeller.storeURLText',
179
+ defaultMessage: 'Store URL'
180
+ })}
181
+ >
182
+ <TextInput
183
+ id="storeUrl"
184
+ field="seller.store_url"
185
+ validate={isRequired}
186
+ validateOnBlur
187
+ mask={value => value && value.trim()}
188
+ maskOnBlur={true}
189
+ data-cy="seller-storeurl"
190
+ aria-label={formatMessage({
191
+ id: 'global.storeUrlRequired',
192
+ defaultMessage: 'Store URL is required.'
193
+ })}
194
+ />
195
+ </Field>
196
+ <SellerCountry
197
+ field="seller.country_id"
198
+ validate={isRequired}
199
+ />
200
+ <Field
201
+ id="addressLine1"
202
+ label={formatMessage({
203
+ id: 'becomeSeller.addressLine1Text',
204
+ defaultMessage: 'Address Line 1'
205
+ })}
206
+ >
207
+ <TextInput
208
+ id="addressLine1"
209
+ field="seller.address_line_1"
210
+ validate={isRequired}
211
+ validateOnBlur
212
+ mask={value => value && value.trim()}
213
+ maskOnBlur={true}
214
+ data-cy="seller-addressline1"
215
+ aria-label={formatMessage({
216
+ id: 'global.addressLine1Required',
217
+ defaultMessage: 'Address Line 1 is required'
218
+ })}
219
+ />
220
+ </Field>
221
+ <Field
222
+ id="addressLine2"
223
+ label={formatMessage({
224
+ id: 'becomeSeller.addressLine2Text',
225
+ defaultMessage: 'Address Line 2'
226
+ })} optional={true}
227
+ >
228
+ <TextInput
229
+ id="addressLine2"
230
+ field="seller.address_line_2"
231
+ validateOnBlur
232
+ mask={value => value && value.trim()}
233
+ maskOnBlur={true}
234
+ data-cy="seller-addressline2"
235
+ />
236
+ </Field>
237
+ <Field
238
+ id="city"
239
+ label={formatMessage({
240
+ id: 'global.city',
241
+ defaultMessage: 'City'
242
+ })}
243
+ >
244
+ <TextInput
245
+ id="city"
246
+ field="seller.city"
247
+ validate={isRequired}
248
+ />
249
+ </Field>
250
+ <Region
251
+ fieldInput="seller.region"
252
+ fieldSelect="seller.region_id"
253
+ label={formatMessage({
254
+ id: 'global.region',
255
+ defaultMessage: 'State / Province'
256
+ })}
257
+ translationId="global.region"
258
+ countryCodeField="seller.country_id"
259
+ validate={isRequired}
260
+ />
261
+ <Postcode
262
+ validate={isRequired}
263
+ fieldInput="seller.postcode"
264
+ label={formatMessage({
265
+ id: 'global.postcode',
266
+ defaultMessage: 'Postal Code'
267
+ })}
268
+ />
269
+ <Field
270
+ id="contactNumber"
271
+ label={formatMessage({
272
+ id: 'global.contactNumber',
273
+ defaultMessage: 'Contact Number'
274
+ })}
275
+ >
276
+ <TextInput
277
+ id="contactNumber"
278
+ field="seller.contact_number"
279
+ validate={isRequired}
280
+ />
281
+ </Field>
282
+ <div className={classes.subscribe}>
283
+ <Checkbox
284
+ field="become_seller_agreement"
285
+ id="becomeSellerAgreement"
286
+ validate={isRequired}
287
+ label={(
288
+ <>
289
+ {formatMessage({
290
+ id: 'becomeSeller.becomeSellerAgreementText',
291
+ defaultMessage: 'I agree the Terms and Condition'
292
+ })} <span>
293
+ (<a href={'/seller-term-conditions'}>
294
+ <u>
295
+ {formatMessage({
296
+ id: 'becomeSellerPage.termConditions',
297
+ defaultMessage: 'Terms and Conditions'
298
+ })}
299
+ </u>
300
+ </a>)
301
+ </span>
302
+ </>
303
+ )}
304
+ />
305
+ </div>
306
+ <GoogleRecaptcha {...recaptchaWidgetProps} />
307
+ <div className={classes.actions}>
308
+ {submitButton}
309
+ </div>
310
+ </Form>
311
+ ) : '';
312
+ };
313
+
314
+ BecomeSeller.propTypes = {
315
+ classes: shape({
316
+ actions: string,
317
+ lead: string,
318
+ root: string,
319
+ subscribe: string
320
+ }),
321
+ initialValues: shape({
322
+ sellerProfileName: string,
323
+ companyName: string
324
+ }),
325
+ isCancelButtonHidden: bool,
326
+ onSubmit: func,
327
+ onCancel: func
328
+ };
329
+
330
+ BecomeSeller.defaultProps = {
331
+ onCancel: () => {},
332
+ isCancelButtonHidden: true
333
+ };
334
+
335
+ export default BecomeSeller;