@riosst100/pwa-marketplace 1.1.9 → 1.2.1

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/i18n/id_ID.json CHANGED
@@ -451,7 +451,7 @@
451
451
  "validation.invalidRegions": "Country \"{value}\" does not contain any available regions.",
452
452
  "validation.isEqualToField": "{value} must match.",
453
453
  "validation.isNotEqualToField": "{value} must be different",
454
- "validation.isRequired": "Is required.",
454
+ "validation.isRequired": "This is required field.",
455
455
  "validation.mustBeChecked": "Must be checked.",
456
456
  "validation.validatePassword": "A password must contain at least 3 of the following: lowercase, uppercase, digits, special characters.",
457
457
  "wishlist.name": "Wish List",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "1.1.9",
4
+ "version": "1.2.1",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -24,7 +24,6 @@ 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 PhoneInput from '@riosst100/pwa-marketplace/src/components/PhoneInput';
28
27
 
29
28
  const BecomeSeller = props => {
30
29
  const talonProps = useBecomeSeller({
@@ -274,7 +273,7 @@ const BecomeSeller = props => {
274
273
  defaultMessage: 'Contact Number'
275
274
  })}
276
275
  >
277
- <PhoneInput
276
+ <TextInput
278
277
  id="contactNumber"
279
278
  field="seller.contact_number"
280
279
  validate={isRequired}
@@ -7,6 +7,10 @@ import { shape, string } from 'prop-types';
7
7
  import { useIntl } from 'react-intl';
8
8
  import { useBecomeSellerLink } from '@riosst100/pwa-marketplace/src/talons/BecomeSellerLink/useBecomeSellerLink';
9
9
 
10
+ import { BrowserPersistence } from '@magento/peregrine/lib/util';
11
+
12
+ const storage = new BrowserPersistence();
13
+
10
14
  const BecomeSellerLink = props => {
11
15
  const classes = useStyle(defaultClasses, props.classes);
12
16
  const { formatMessage } = useIntl();
@@ -15,9 +19,12 @@ const BecomeSellerLink = props => {
15
19
  isSeller
16
20
  } = useBecomeSellerLink(props);
17
21
 
22
+ const websiteCountry = storage.getItem('website_code') && storage.getItem('website_code') != "base" ? '/' + storage.getItem('website_code') : '';
23
+ const sellerDashboardUrl = process.env.MAGENTO_BACKEND_URL ? process.env.MAGENTO_BACKEND_URL + websiteCountry : '';
24
+
18
25
  return isSeller ? (
19
26
  <div className={classes.root} data-cy="BecomeSellerLink-root">
20
- <a href={process.env.MAGENTO_BACKEND_URL + "/lofmarketplace/seller/login"}>
27
+ <a href={sellerDashboardUrl + "/lofmarketplace/seller/login"}>
21
28
  {formatMessage({
22
29
  id: 'sellerDashboard.title',
23
30
  defaultMessage: 'Seller Dashboard'
@@ -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 './phoneInput.module.css';
8
- import {PhoneInput as ReactPhoneInput} from 'react-phone-number-input'
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 PhoneInput = props => {
11
+ const PhoneTextInput = props => {
11
12
  const {
12
13
  after,
13
14
  before,
@@ -15,33 +16,42 @@ const PhoneInput = props => {
15
16
  regionError,
16
17
  field,
17
18
  message,
19
+ countryCodeField = "country",
18
20
  ...rest
19
21
  } = props;
20
22
  const fieldState = useFieldState(field);
23
+ const { value: phoneValue } = fieldState;
21
24
  const classes = useStyle(defaultClasses, propClasses);
22
25
  var inputClass =
23
26
  fieldState.error || regionError ? classes.input_error : classes.input;
27
+
28
+ const handleChange = (value) => {
29
+ fieldState.value = value;
30
+ }
24
31
 
25
- const [value, setValue] = useState('');
32
+ const countryFieldState = useFieldState(countryCodeField);
33
+ const { value: country } = countryFieldState;
26
34
 
27
35
  return (
28
36
  <Fragment>
29
37
  <FieldIcons after={after} before={before}>
30
- <ReactPhoneInput
38
+ <PhoneInput
31
39
  international
32
40
  countryCallingCodeEditable={false}
33
- defaultCountry="ID"
34
- value={value}
35
- onChange={setValue}/>
41
+ defaultCountry={country}
42
+ name={field}
43
+ value={phoneValue}
44
+ onChange={handleChange}
45
+ />
36
46
  </FieldIcons>
37
47
  <Message fieldState={fieldState}>{message}</Message>
38
48
  </Fragment>
39
49
  );
40
50
  };
41
51
 
42
- export default PhoneInput;
52
+ export default PhoneTextInput;
43
53
 
44
- PhoneInput.propTypes = {
54
+ PhoneTextInput.propTypes = {
45
55
  after: node,
46
56
  before: node,
47
57
  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
 
@@ -119,8 +119,6 @@ export const useSignIn = props => {
119
119
  fetchPolicy: 'cache-only'
120
120
  });
121
121
 
122
- console.log(data.customer)
123
-
124
122
  if (data.customer.is_seller) {
125
123
  storage.setItem('is_seller', true);
126
124
  }
@@ -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 &&
@@ -13,7 +13,6 @@ export const useWebsiteByIp = websiteCodeInUrl => {
13
13
  setWebsiteByUserIpData(data)
14
14
  }
15
15
  }).catch((error) => {
16
- console.log(error);
17
16
  });
18
17
  };
19
18
 
@@ -1 +0,0 @@
1
- export { default } from './phoneInput';