@riosst100/pwa-marketplace 1.1.9 → 1.2.0
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.
- package/package.json +1 -1
- package/src/components/BecomeSeller/becomeSeller.js +14 -2
- package/src/components/PhoneTextInput/index.js +1 -0
- package/src/components/{PhoneInput/phoneInput.js → PhoneTextInput/phoneTextInput.js} +12 -7
- package/src/components/SellerCountry/sellerCountry.js +6 -0
- package/src/overwrites/peregrine/lib/talons/SignIn/useSignIn.js +0 -2
- package/src/talons/Header/useWebsiteSwitcher.js +0 -1
- package/src/talons/WebsiteByIp/useWebsiteByIp.js +0 -1
- package/src/components/PhoneInput/index.js +0 -1
- /package/src/components/{PhoneInput/phoneInput.module.css → PhoneTextInput/phoneTextInput.module.css} +0 -0
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@ import Region from '@magento/venia-ui/lib/components/Region';
|
|
|
24
24
|
import Postcode from '@magento/venia-ui/lib/components/Postcode';
|
|
25
25
|
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
26
26
|
import { Link } from 'react-router-dom';
|
|
27
|
-
import
|
|
27
|
+
import PhoneTextInput from '@riosst100/pwa-marketplace/src/components/PhoneTextInput';
|
|
28
28
|
|
|
29
29
|
const BecomeSeller = props => {
|
|
30
30
|
const talonProps = useBecomeSeller({
|
|
@@ -274,9 +274,10 @@ const BecomeSeller = props => {
|
|
|
274
274
|
defaultMessage: 'Contact Number'
|
|
275
275
|
})}
|
|
276
276
|
>
|
|
277
|
-
<
|
|
277
|
+
<PhoneTextInput
|
|
278
278
|
id="contactNumber"
|
|
279
279
|
field="seller.contact_number"
|
|
280
|
+
countryCodeField="seller.country_id"
|
|
280
281
|
validate={isRequired}
|
|
281
282
|
/>
|
|
282
283
|
</Field>
|
|
@@ -312,6 +313,17 @@ const BecomeSeller = props => {
|
|
|
312
313
|
) : '';
|
|
313
314
|
};
|
|
314
315
|
|
|
316
|
+
BecomeSeller.defaultProps = {
|
|
317
|
+
seller: {
|
|
318
|
+
country: {
|
|
319
|
+
code: DEFAULT_COUNTRY_CODE
|
|
320
|
+
},
|
|
321
|
+
region: {
|
|
322
|
+
id: null
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
315
327
|
BecomeSeller.propTypes = {
|
|
316
328
|
classes: shape({
|
|
317
329
|
actions: string,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './phoneTextInput';
|
|
@@ -4,10 +4,11 @@ import useFieldState from '@magento/peregrine/lib/hooks/hook-wrappers/useInforme
|
|
|
4
4
|
|
|
5
5
|
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
6
|
import { FieldIcons, Message } from '@magento/venia-ui/lib/components/Field';
|
|
7
|
-
import defaultClasses from './
|
|
8
|
-
import
|
|
7
|
+
import defaultClasses from './phoneTextInput.module.css';
|
|
8
|
+
import PhoneInput from 'react-phone-number-input'
|
|
9
|
+
import 'react-phone-number-input/style.css'
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
+
const PhoneTextInput = props => {
|
|
11
12
|
const {
|
|
12
13
|
after,
|
|
13
14
|
before,
|
|
@@ -15,6 +16,7 @@ const PhoneInput = props => {
|
|
|
15
16
|
regionError,
|
|
16
17
|
field,
|
|
17
18
|
message,
|
|
19
|
+
countryCodeField,
|
|
18
20
|
...rest
|
|
19
21
|
} = props;
|
|
20
22
|
const fieldState = useFieldState(field);
|
|
@@ -24,13 +26,16 @@ const PhoneInput = props => {
|
|
|
24
26
|
|
|
25
27
|
const [value, setValue] = useState('');
|
|
26
28
|
|
|
29
|
+
const countryFieldState = useFieldState(countryCodeField);
|
|
30
|
+
const { value: country } = countryFieldState;
|
|
31
|
+
|
|
27
32
|
return (
|
|
28
33
|
<Fragment>
|
|
29
34
|
<FieldIcons after={after} before={before}>
|
|
30
|
-
<
|
|
35
|
+
<PhoneInput
|
|
31
36
|
international
|
|
32
37
|
countryCallingCodeEditable={false}
|
|
33
|
-
defaultCountry=
|
|
38
|
+
defaultCountry={country}
|
|
34
39
|
value={value}
|
|
35
40
|
onChange={setValue}/>
|
|
36
41
|
</FieldIcons>
|
|
@@ -39,9 +44,9 @@ const PhoneInput = props => {
|
|
|
39
44
|
);
|
|
40
45
|
};
|
|
41
46
|
|
|
42
|
-
export default
|
|
47
|
+
export default PhoneTextInput;
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
PhoneTextInput.propTypes = {
|
|
45
50
|
after: node,
|
|
46
51
|
before: node,
|
|
47
52
|
classes: shape({
|
|
@@ -8,6 +8,9 @@ import Field from '@magento/venia-ui/lib/components/Field';
|
|
|
8
8
|
import Select from '@magento/venia-ui/lib/components/Select';
|
|
9
9
|
import defaultClasses from './sellerCountry.module.css';
|
|
10
10
|
import { GET_SELLER_COUNTRIES_QUERY } from './sellerCountry.gql';
|
|
11
|
+
import { BrowserPersistence } from '@magento/peregrine/lib/util';
|
|
12
|
+
|
|
13
|
+
const storage = new BrowserPersistence();
|
|
11
14
|
|
|
12
15
|
const SellerCountry = props => {
|
|
13
16
|
const talonProps = useSellerCountry({
|
|
@@ -26,11 +29,14 @@ const SellerCountry = props => {
|
|
|
26
29
|
const { formatMessage } = useIntl();
|
|
27
30
|
|
|
28
31
|
const classes = useStyle(defaultClasses, propClasses);
|
|
32
|
+
const websiteCode = storage.getItem('website_code') || null;
|
|
33
|
+
const currentWebsiteCountry = websiteCode && websiteCode != "base" ? websiteCode.toUpperCase() : DEFAULT_COUNTRY_CODE;
|
|
29
34
|
const selectProps = {
|
|
30
35
|
classes,
|
|
31
36
|
disabled: loading,
|
|
32
37
|
field,
|
|
33
38
|
items: countries,
|
|
39
|
+
initialValue: currentWebsiteCountry,
|
|
34
40
|
...inputProps
|
|
35
41
|
};
|
|
36
42
|
|
|
@@ -108,7 +108,6 @@ export const useWebsiteSwitcher = (props = {}) => {
|
|
|
108
108
|
|
|
109
109
|
// availableStores => mapped options or empty map if undefined.
|
|
110
110
|
const availableStores = useMemo(() => {
|
|
111
|
-
console.log(availableStoresData)
|
|
112
111
|
return (
|
|
113
112
|
(storeConfigData &&
|
|
114
113
|
availableStoresData &&
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './phoneInput';
|
|
File without changes
|