@riosst100/pwa-marketplace 1.0.4 → 1.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "1.0.4",
4
+ "version": "1.0.5",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -285,6 +285,7 @@ const BecomeSeller = props => {
285
285
  <Checkbox
286
286
  field="become_seller_agreement"
287
287
  id="becomeSellerAgreement"
288
+ validate={isRequired}
288
289
  label={formatMessage({
289
290
  id: 'becomeSeller.becomeSellerAgreementText',
290
291
  defaultMessage: 'I agree the Terms and Condition (Terms and Conditions)'
@@ -40,30 +40,6 @@ const SellerAccountPage = props => {
40
40
  const customerName = `${customer.firstname} ${customer.lastname}`;
41
41
  const passwordValue = 'Same as current';
42
42
 
43
- sellerAccountDetails = (
44
- <Fragment>
45
- <div className={classes.accountDetails}>
46
- <span className={classes.nameLabel}>
47
- <FormattedMessage
48
- id={'global.sellerAccountDetailsText'}
49
- defaultMessage={'Seller Account Details'}
50
- />
51
- </span>
52
- <div className={classes.lineItemsContainer}>
53
- <span className={classes.nameLabel}>
54
- <FormattedMessage
55
- id={'global.status'}
56
- defaultMessage={'Status'}
57
- />
58
- </span>
59
- <span className={classes.nameValue}>
60
- Not Verified
61
- </span>
62
- </div>
63
- </div>
64
- </Fragment>
65
- );
66
-
67
43
  sellerLoginAccount = (
68
44
  <Fragment>
69
45
  <div className={classes.accountDetails}>
@@ -116,8 +92,6 @@ const SellerAccountPage = props => {
116
92
  defaultMessage: 'Seller Account'
117
93
  })}
118
94
  </StoreTitle>
119
- {sellerAccountDetails}
120
- <br />
121
95
  {sellerLoginAccount}
122
96
  </div>
123
97
  )
@@ -1,4 +1,7 @@
1
- import { useCallback } from 'react';
1
+ import { useCallback, useEffect } from 'react';
2
+ import { BrowserPersistence } from '@magento/peregrine/lib/util';
3
+
4
+ const storage = new BrowserPersistence();
2
5
 
3
6
  /**
4
7
  * @param {Object} props
@@ -14,12 +17,7 @@ export const useAccountMenuItems = props => {
14
17
  onSignOut();
15
18
  }, [onSignOut]);
16
19
 
17
- const MENU_ITEMS = [
18
- {
19
- name: 'Seller Account Information',
20
- id: 'accountMenu.sellerAccountInfoLink',
21
- url: '/seller-account'
22
- },
20
+ let MENU_ITEMS = [
23
21
  {
24
22
  name: 'Order History',
25
23
  id: 'accountMenu.orderHistoryLink',
@@ -57,6 +55,17 @@ export const useAccountMenuItems = props => {
57
55
  url: '/account-information'
58
56
  }
59
57
  ];
58
+
59
+ if (storage && storage.getItem('is_seller')) {
60
+ MENU_ITEMS = [
61
+ ...MENU_ITEMS,
62
+ {
63
+ name: 'Seller Account Information',
64
+ id: 'accountMenu.sellerAccountInfoLink',
65
+ url: '/seller-account'
66
+ }
67
+ ];
68
+ }
60
69
 
61
70
  return {
62
71
  handleSignOut,
@@ -90,6 +90,8 @@ export const useSignIn = props => {
90
90
  const token = signInResponse.data.generateCustomerToken.token;
91
91
  await setToken(token);
92
92
 
93
+ await getUserDetails({ fetchUserDetails });
94
+
93
95
  // Clear all cart/customer data from cache and redux.
94
96
  await apolloClient.clearCacheData(apolloClient, 'cart');
95
97
  await apolloClient.clearCacheData(apolloClient, 'customer');
@@ -111,7 +113,7 @@ export const useSignIn = props => {
111
113
 
112
114
  // Ensure old stores are updated with any new data.
113
115
 
114
- await getUserDetails({ fetchUserDetails });
116
+
115
117
 
116
118
  const { data } = await fetchUserDetails({
117
119
  fetchPolicy: 'cache-only'