@riosst100/pwa-marketplace 2.9.3 → 2.9.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.
Files changed (37) hide show
  1. package/i18n/en_US.json +1 -0
  2. package/i18n/id_ID.json +1 -0
  3. package/package.json +1 -1
  4. package/src/componentOverrideMapping.js +2 -1
  5. package/src/components/ConfirmEmailPage/confirmEmail.js +76 -0
  6. package/src/components/ConfirmEmailPage/confirmEmail.module.css +71 -0
  7. package/src/components/ConfirmEmailPage/index.js +1 -0
  8. package/src/components/FavoriteSellerPage/favoriteSeller.js +0 -1
  9. package/src/components/FavoriteSellerPage/item.js +0 -2
  10. package/src/components/OrderDetail/components/itemsOrdered.js +94 -82
  11. package/src/components/OrderDetail/orderDetail.js +102 -86
  12. package/src/components/SubCategory/subCategory.js +1 -1
  13. package/src/components/VerifyEmailPage/verifyEmail.js +33 -10
  14. package/src/intercept.js +8 -1
  15. package/src/overwrites/peregrine/lib/talons/CartPage/PriceSummary/usePriceSummary.js +2 -2
  16. package/src/overwrites/peregrine/lib/talons/CheckoutPage/useCheckoutPage.js +43 -2
  17. package/src/overwrites/peregrine/lib/talons/FilterSidebar/useFilterSidebar.js +4 -1
  18. package/src/overwrites/peregrine/lib/talons/OrderHistoryPage/orderHistoryPage.gql.js +116 -0
  19. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +7 -0
  20. package/src/overwrites/venia-ui/lib/components/AccountInformationPage/DeleteAccount.js +5 -37
  21. package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +3 -1
  22. package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.js +53 -58
  23. package/src/overwrites/venia-ui/lib/components/CheckoutPage/OrderConfirmationPage/orderConfirmationPage.js +68 -39
  24. package/src/overwrites/venia-ui/lib/components/CheckoutPage/checkoutPage.js +1 -1
  25. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderHistoryPage.js +10 -2
  26. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderRow.js +91 -78
  27. package/src/overwrites/venia-ui/lib/components/OrderHistoryPage/orderRow.module.css +3 -3
  28. package/src/overwrites/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js +1 -1
  29. package/src/talons/AccountInformationPage/deleteAccount.gql.js +23 -0
  30. package/src/talons/AccountInformationPage/useDeleteAccount.js +98 -0
  31. package/src/talons/ConfirmEmailPage/confirmEmailPage.gql.js +20 -0
  32. package/src/talons/ConfirmEmailPage/useConfirmEmailPage.js +78 -0
  33. package/src/talons/OrderHistoryPage/useOrderHistoryPage.js +115 -0
  34. package/src/talons/ShopBy/useShopBy.js +12 -2
  35. package/src/talons/VerifyEmailPage/useVerifyEmailPage.js +73 -0
  36. package/src/talons/VerifyEmailPage/verifyEmailPage.gql.js +36 -0
  37. package/src/talons/WebsiteSwitcher/useWebsiteSwitcher.js +13 -2
@@ -0,0 +1,73 @@
1
+
2
+ import { useCallback, useEffect } from 'react';
3
+ import { useIntl } from 'react-intl';
4
+ import { useMutation } from '@apollo/client';
5
+ import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
6
+ import DEFAULT_OPERATIONS from './verifyEmailPage.gql';
7
+ import { useHistory } from 'react-router-dom';
8
+ import { useToasts } from '@magento/peregrine';
9
+
10
+ export const useVerifyEmailPage = (props = {}) => {
11
+ const { formatMessage } = useIntl();
12
+
13
+ const { email } = props;
14
+
15
+ const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
16
+
17
+ const history = useHistory();
18
+
19
+ const [, { addToast }] = useToasts();
20
+
21
+ const {
22
+ resendEmailConfirmationMutation
23
+ } = operations;
24
+
25
+ const [resendEmailConfirmation, { called: called, data: data, error: error, loading: loading}] = useMutation(
26
+ resendEmailConfirmationMutation,
27
+ {
28
+ fetchPolicy: 'no-cache'
29
+ }
30
+ );
31
+
32
+ const handleResendEmail = useCallback(() => {
33
+ resendEmailConfirmation({
34
+ variables: {
35
+ email
36
+ }
37
+ });
38
+ }, [
39
+ resendEmailConfirmation,
40
+ email
41
+ ]);
42
+
43
+ const shouldShowLoadingIndicator = called && loading;
44
+
45
+ useEffect(() => {
46
+ if (data && !loading) {
47
+ if (data.resendCustomerConfirmation.success) {
48
+ addToast({
49
+ type: 'success',
50
+ message: formatMessage({
51
+ id: 'emailConfirmation.resendConfirmEmailSuccess',
52
+ defaultMessage: data.resendCustomerConfirmation.message
53
+ }),
54
+ timeout: 10000
55
+ });
56
+
57
+ // history.go(0)
58
+ }
59
+ }
60
+ }, [
61
+ data,
62
+ loading,
63
+ addToast
64
+ ]);
65
+
66
+ return {
67
+ loading,
68
+ error,
69
+ data,
70
+ handleResendEmail,
71
+ shouldShowLoadingIndicator
72
+ };
73
+ }
@@ -0,0 +1,36 @@
1
+ import { gql } from '@apollo/client';
2
+
3
+ export const RESEND_EMAIL_CONFIRMATION = gql`
4
+ mutation ResendEmailConfirmation(
5
+ $email: String!
6
+ ) {
7
+ resendCustomerConfirmation(
8
+ email: $email
9
+ ) {
10
+ success
11
+ message
12
+ }
13
+ }
14
+ `;
15
+
16
+ export const CONFIRM_EMAIL = gql`
17
+ mutation ConfirmEmail(
18
+ $id: String!
19
+ $key: String!
20
+ ) {
21
+ confirmCustomerEmail(
22
+ input: {
23
+ id: $id
24
+ key: $key
25
+ }
26
+ ) {
27
+ success
28
+ message
29
+ }
30
+ }
31
+ `;
32
+
33
+ export default {
34
+ resendEmailConfirmationMutation: RESEND_EMAIL_CONFIRMATION,
35
+ confirmCustomerEmailMutation: CONFIRM_EMAIL
36
+ };
@@ -1,4 +1,4 @@
1
- import { useQuery } from '@apollo/client';
1
+ import { useApolloClient, useQuery } from '@apollo/client';
2
2
  import { useCallback, useMemo } from 'react';
3
3
  import { useLocation } from 'react-router-dom';
4
4
  import { useDropdown } from '@magento/peregrine/lib/hooks/useDropdown';
@@ -6,6 +6,7 @@ import { useAwaitQuery } from '@magento/peregrine/lib/hooks/useAwaitQuery';
6
6
  import { BrowserPersistence } from '@magento/peregrine/lib/util';
7
7
  import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
8
8
  import DEFAULT_OPERATIONS from './websiteSwitcher.gql';
9
+ import { useCartContext } from '@magento/peregrine/lib/context/cart';
9
10
 
10
11
  const storage = new BrowserPersistence();
11
12
 
@@ -161,6 +162,13 @@ export const useWebsiteSwitcher = (props = {}) => {
161
162
  [pathname, fetchRouteData, internalRoutes]
162
163
  );
163
164
 
165
+ const apolloClient = useApolloClient();
166
+
167
+ const [
168
+ { cartId },
169
+ { createCart, removeCart, getCartDetails }
170
+ ] = useCartContext();
171
+
164
172
  const handleSwitchWebsite = useCallback(
165
173
  // Change store view code and currency to be used in Apollo link request headers
166
174
  async (storeCode, websiteCode) => {
@@ -190,13 +198,16 @@ export const useWebsiteSwitcher = (props = {}) => {
190
198
 
191
199
  const newPath = pathName ? `/${pathName}${newSearchParams}` : (accessBaseWebsite ? `/${pathName}${accessBaseWebsite}` : '');
192
200
 
201
+ await apolloClient.clearCacheData(apolloClient, 'cart');
202
+ await removeCart();
203
+
193
204
  if (newWebsiteCode) {
194
205
  globalThis.location.assign(`/${newWebsiteCode}${newPath || ''}`);
195
206
  } else {
196
207
  globalThis.location.assign(`${newPath || ''}`);
197
208
  }
198
209
  },
199
- [availableStores, getPathname, searchParams]
210
+ [availableStores, getPathname, searchParams, apolloClient, removeCart]
200
211
  );
201
212
 
202
213
  const handleTriggerClick = useCallback(() => {