@riosst100/pwa-marketplace 3.3.1 → 3.3.3

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 (34) hide show
  1. package/package.json +1 -1
  2. package/src/componentOverrideMapping.js +1 -0
  3. package/src/components/AboutUs/aboutUs.css +111 -0
  4. package/src/components/AboutUs/aboutUs.js +6 -2
  5. package/src/components/AgeVerificationModal/ageVerificationModal.js +6 -4
  6. package/src/components/AgeVerificationModal/ageVerificationModal.module.css +23 -4
  7. package/src/components/LoadingRequest/index.js +1 -0
  8. package/src/components/LoadingRequest/loadingRequest.js +40 -0
  9. package/src/components/LoadingRequest/loadingRequest.module.css +150 -0
  10. package/src/components/PrivacyPolicy/index.js +1 -0
  11. package/src/components/PrivacyPolicy/privacyPolicy.css +125 -0
  12. package/src/components/PrivacyPolicy/privacyPolicy.js +13 -0
  13. package/src/components/SocialLogin/socialLogin.js +5 -55
  14. package/src/components/TermsOfUse/index.js +1 -0
  15. package/src/components/TermsOfUse/termsOfUse.css +113 -0
  16. package/src/components/TermsOfUse/termsOfUse.js +13 -0
  17. package/src/intercept.js +14 -0
  18. package/src/overwrites/peregrine/lib/Apollo/links/storeLink.js +34 -0
  19. package/src/overwrites/peregrine/lib/context/cart.js +13 -1
  20. package/src/overwrites/peregrine/lib/store/actions/cart/asyncActions.js +15 -3
  21. package/src/overwrites/peregrine/lib/talons/Adapter/useAdapter.js +7 -4
  22. package/src/overwrites/peregrine/lib/talons/SignIn/useSignIn.js +19 -1
  23. package/src/overwrites/peregrine/lib/util/makeUrl.js +132 -0
  24. package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +47 -43
  25. package/src/overwrites/venia-ui/lib/components/Footer/footer.js +2 -2
  26. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/productFAQ.js +82 -0
  27. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +47 -39
  28. package/src/overwrites/venia-ui/lib/components/SignIn/signIn.js +3 -1
  29. package/src/overwrites/venia-ui/lib/components/SignInPage/signInPage.js +27 -21
  30. package/src/overwrites/venia-ui/lib/components/StoreCodeRoute/storeCodeRoute.js +10 -43
  31. package/src/talons/ProductFAQ/productFaq.gql.js +39 -0
  32. package/src/talons/ProductFAQ/useProductFAQ.js +48 -0
  33. package/src/talons/RFQ/useRFQ.js +0 -2
  34. package/src/talons/SocialLogin/useSocialLogin.js +5 -0
@@ -0,0 +1,113 @@
1
+ .root {
2
+ /* Theme color variables mapped from tcg-theme-preset.js */
3
+ --tcg-color-text: #1B1B1B; /* textColor.colorDefault */
4
+ --tcg-color-link: #3d84ff; /* brand.base */
5
+ --tcg-color-link-hover: #f76b1c; /* brand.dark */
6
+ --tcg-color-border: #E6E9EA; /* gray.100 */
7
+ --tcg-color-table-head-bg: #F8F8F8; /* gray.50 */
8
+ --tcg-color-muted: #999999; /* gray.200 */
9
+
10
+ max-width: 1300px;
11
+ margin: 0 auto;
12
+ padding: 0 1rem;
13
+ color: var(--tcg-color-text);
14
+ }
15
+ @media (min-width: 768px) {
16
+ .root { padding: 0; }
17
+ }
18
+
19
+ /* Ensure CMS-injected wrapper classes are styled */
20
+ :global(.row-content){
21
+ max-width: 1300px;
22
+ width: 100%;
23
+ margin: 0 auto;
24
+ }
25
+
26
+ .root h1,
27
+ .root h2,
28
+ .root h3 {
29
+ margin: 1.25rem 0 0.75rem;
30
+ font-weight: 600;
31
+ }
32
+
33
+ .root p {
34
+ margin: 0.75rem 0;
35
+ line-height: 1.7;
36
+ color: var(--tcg-color-text);
37
+ }
38
+
39
+ .root ul,
40
+ .root ol {
41
+ margin: 0.75rem 0 0.75rem 1.25rem;
42
+ padding-left: 1.25rem;
43
+ }
44
+ .root ul { list-style: disc; }
45
+ .root ol { list-style: decimal; }
46
+ .root li { margin: 0.375rem 0; }
47
+
48
+ .root a {
49
+ color: var(--tcg-color-link);
50
+ text-decoration: underline;
51
+ text-underline-offset: 2px;
52
+ }
53
+ .root a:hover {
54
+ color: var(--tcg-color-link-hover);
55
+ }
56
+
57
+ .root img {
58
+ max-width: 100%;
59
+ height: auto;
60
+ }
61
+
62
+ /* Headings scale */
63
+ .root h1 {
64
+ text-align: center;
65
+ font-size: 1.5rem;
66
+ line-height: 1.3;
67
+ margin: 1.5rem 0 0.75rem;
68
+ }
69
+ @media (min-width: 768px) {
70
+ .root h1 { font-size: 1.75rem; }
71
+ }
72
+
73
+ .root h2 {
74
+ font-size: 1.125rem;
75
+ margin: 1.25rem 0 0.5rem;
76
+ }
77
+ @media (min-width: 768px) {
78
+ .root h2 { font-size: 1.25rem; }
79
+ }
80
+
81
+ .root h3 {
82
+ font-size: 1rem;
83
+ margin: 1rem 0 0.5rem;
84
+ }
85
+
86
+ .root hr {
87
+ border: 0;
88
+ border-top: 1px solid var(--tcg-color-border);
89
+ margin: 2rem 0;
90
+ }
91
+
92
+ .root table {
93
+ width: 100%;
94
+ border-collapse: collapse;
95
+ margin: 1rem 0;
96
+ }
97
+ .root th,
98
+ .root td {
99
+ border: 1px solid var(--tcg-color-border);
100
+ padding: 0.5rem 0.75rem;
101
+ text-align: left;
102
+ }
103
+ .root thead th {
104
+ background: var(--tcg-color-table-head-bg);
105
+ font-weight: 600;
106
+ }
107
+
108
+ .root blockquote {
109
+ border-left: 3px solid var(--tcg-color-border);
110
+ padding-left: 1rem;
111
+ color: var(--tcg-color-muted);
112
+ margin: 1rem 0;
113
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import CMSPage from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/RootComponents/CMS/cms';
3
+ import classes from './termsOfUse.css';
4
+
5
+ const TermsOfUse = () => {
6
+ return (
7
+ <div className={classes.root}>
8
+ <CMSPage identifier="terms-of-use" />
9
+ </div>
10
+ );
11
+ }
12
+
13
+ export default TermsOfUse;
package/src/intercept.js CHANGED
@@ -101,6 +101,20 @@ module.exports = targets => {
101
101
  path: require.resolve("./components/AboutUs/index.js"),
102
102
  authed: false,
103
103
  },
104
+ {
105
+ exact: true,
106
+ name: "PrivacyPolicy",
107
+ pattern: "/privacy-policy",
108
+ path: require.resolve("./components/PrivacyPolicy/index.js"),
109
+ authed: false,
110
+ },
111
+ {
112
+ exact: true,
113
+ name: "TermsOfUse",
114
+ pattern: "/terms-of-use",
115
+ path: require.resolve("./components/TermsOfUse/index.js"),
116
+ authed: false,
117
+ },
104
118
  {
105
119
  exact: true,
106
120
  name: "HelpCenterQuestionDetail",
@@ -0,0 +1,34 @@
1
+ import { setContext } from '@apollo/client/link/context';
2
+ import { BrowserPersistence } from '@magento/peregrine/lib/util';
3
+
4
+ const storage = new BrowserPersistence();
5
+
6
+ export default function createStoreLink() {
7
+ return setContext((_, { headers }) => {
8
+ const websiteCodes = [];
9
+
10
+ AVAILABLE_WEBSITES.forEach(store => {
11
+ websiteCodes.push(store.website_code);
12
+ });
13
+
14
+ const { location } = globalThis;
15
+ const match = location && location.pathname.split("/")[1];
16
+ const websiteCodeInUrl = websiteCodes.find((str) => str === match);
17
+
18
+ let prefix = websiteCodeInUrl ? websiteCodeInUrl + '_' : '';
19
+
20
+ const storeCurrency = storage.getItem(prefix + 'store_view_currency') || null;
21
+ const storeCode = storage.getItem(prefix + 'store_view_code') || STORE_VIEW_CODE;
22
+
23
+ // return the headers to the context so httpLink can read them
24
+ return {
25
+ headers: {
26
+ ...headers,
27
+ store: storeCode,
28
+ ...(storeCurrency && {
29
+ 'Content-Currency': storeCurrency
30
+ })
31
+ }
32
+ };
33
+ });
34
+ }
@@ -66,10 +66,22 @@ const CartContextProvider = props => {
66
66
  const [removeSplitCart] = useMutation(REMOVE_SPLIT_CART_MUTATION);
67
67
  const fetchCartDetails = useAwaitQuery(CART_DETAILS_QUERY);
68
68
 
69
+ const websiteCodes = [];
70
+
71
+ AVAILABLE_WEBSITES.forEach(store => {
72
+ websiteCodes.push(store.website_code);
73
+ });
74
+
75
+ const { location } = globalThis;
76
+ const match = location && location.pathname.split("/")[1];
77
+ const websiteCodeInUrl = websiteCodes.find((str) => str === match);
78
+
79
+ let prefix = websiteCodeInUrl ? websiteCodeInUrl + '_' : '';
80
+
69
81
  // Storage listener to force a state update if cartId changes from another browser tab.
70
82
  const storageListener = useCallback(() => {
71
83
  const storage = new BrowserPersistence();
72
- const currentCartId = storage.getItem('cartId');
84
+ const currentCartId = storage.getItem(prefix + 'cartId');
73
85
  const { cartId } = cartState;
74
86
  if (cartId && currentCartId && cartId !== currentCartId) {
75
87
  globalThis.location && globalThis.location.reload();
@@ -475,6 +475,18 @@ export const getCartDetails = payload => {
475
475
  };
476
476
  };
477
477
 
478
+ const websiteCodes = [];
479
+
480
+ AVAILABLE_WEBSITES.forEach(store => {
481
+ websiteCodes.push(store.website_code);
482
+ });
483
+
484
+ const { location } = globalThis;
485
+ const match = location && location.pathname.split("/")[1];
486
+ const websiteCodeInUrl = websiteCodes.find((str) => str === match);
487
+
488
+ const prefix = websiteCodeInUrl ? websiteCodeInUrl + '_' : '';
489
+
478
490
  export const removeCart = () =>
479
491
  async function thunk(dispatch) {
480
492
  // Clear the cartId from local storage.
@@ -507,15 +519,15 @@ export async function clearSellerCartId() {
507
519
  }
508
520
 
509
521
  export async function retrieveCartId() {
510
- return storage.getItem('cartId');
522
+ return storage.getItem(prefix + 'cartId');
511
523
  }
512
524
 
513
525
  export async function saveCartId(id) {
514
- return storage.setItem('cartId', id);
526
+ return storage.setItem(prefix + 'cartId', id);
515
527
  }
516
528
 
517
529
  export async function clearCartId() {
518
- return storage.removeItem('cartId');
530
+ return storage.removeItem(prefix + 'cartId');
519
531
  }
520
532
 
521
533
  async function retrieveImageCache() {
@@ -32,9 +32,11 @@ export const useAdapter = props => {
32
32
  const match = location && location.pathname.split("/")[1];
33
33
  let websiteCodeInUrl = websiteCodes.find((str) => str === match);
34
34
 
35
+ let prefix = websiteCodeInUrl ? websiteCodeInUrl + '_' : '';
36
+
35
37
  let isBaseWebsite = false;
36
38
 
37
- let websiteCode = storage.getItem('website_code');
39
+ let websiteCode = storage.getItem(prefix + 'website_code');
38
40
 
39
41
  if (!websiteCodeInUrl) {
40
42
  isBaseWebsite = true;
@@ -86,7 +88,7 @@ export const useAdapter = props => {
86
88
 
87
89
  const clearCacheData = useCallback(
88
90
  async (client, cacheType) => {
89
- const storeCode = storage.getItem('store_view_code') || 'default';
91
+ const storeCode = storage.getItem(prefix + 'store_view_code') || 'default';
90
92
 
91
93
  // Clear current store
92
94
  if (cacheType === 'cart') {
@@ -135,11 +137,11 @@ export const useAdapter = props => {
135
137
  }
136
138
  }
137
139
  },
138
- [apolloLink, createApolloClient, createCachePersistor]
140
+ [apolloLink, prefix, createApolloClient, createCachePersistor]
139
141
  );
140
142
 
141
143
  const apolloClient = useMemo(() => {
142
- const storeCode = storage.getItem('store_view_code') || 'default';
144
+ const storeCode = storage.getItem(prefix + 'store_view_code') || 'default';
143
145
  const client = createApolloClient(preInstantiatedCache, apolloLink);
144
146
  const persistor = isServer
145
147
  ? null
@@ -154,6 +156,7 @@ export const useAdapter = props => {
154
156
  apiBase,
155
157
  apolloLink,
156
158
  clearCacheData,
159
+ prefix,
157
160
  createApolloClient,
158
161
  createCachePersistor
159
162
  ]);
@@ -12,6 +12,8 @@ import DEFAULT_OPERATIONS from '@magento/peregrine/lib/talons/SignIn/signIn.gql'
12
12
  import { useEventingContext } from '@magento/peregrine/lib/context/eventing';
13
13
  import { BrowserPersistence } from '@magento/peregrine/lib/util';
14
14
 
15
+ import { useToasts } from '@magento/peregrine/lib/Toasts';
16
+
15
17
  const storage = new BrowserPersistence();
16
18
 
17
19
  export const useSignIn = props => {
@@ -20,7 +22,8 @@ export const useSignIn = props => {
20
22
  getCartDetailsQuery,
21
23
  setDefaultUsername,
22
24
  showCreateAccount,
23
- showForgotPassword
25
+ showForgotPassword,
26
+ setIsLoading
24
27
  } = props;
25
28
 
26
29
  const operations = mergeOperations(DEFAULT_OPERATIONS, props.operations);
@@ -67,11 +70,14 @@ export const useSignIn = props => {
67
70
  const fetchUserDetails = useAwaitQuery(getCustomerQuery);
68
71
  const fetchCartDetails = useAwaitQuery(getCartDetailsQuery);
69
72
 
73
+ const [, { addToast }] = useToasts();
74
+
70
75
  const formApiRef = useRef(null);
71
76
  const setFormApi = useCallback(api => (formApiRef.current = api), []);
72
77
 
73
78
  const handleSubmit = useCallback(
74
79
  async ({ email, password }) => {
80
+ setIsLoading(true)
75
81
  setIsSigningIn(true);
76
82
  // handleTriggerClick();
77
83
  try {
@@ -135,6 +141,17 @@ export const useSignIn = props => {
135
141
  });
136
142
 
137
143
  getCartDetails({ fetchCartId, fetchCartDetails });
144
+
145
+ addToast({
146
+ type: 'success',
147
+ message: formatMessage({
148
+ id: 'signIn.signInSuccessToast',
149
+ defaultMessage: "You have successfully signed in."
150
+ }),
151
+ timeout: 5000
152
+ });
153
+
154
+ setIsLoading(false);
138
155
  } catch (error) {
139
156
  if (process.env.NODE_ENV !== 'production') {
140
157
  console.error(error);
@@ -157,6 +174,7 @@ export const useSignIn = props => {
157
174
  fetchUserDetails,
158
175
  getCartDetails,
159
176
  fetchCartDetails,
177
+ setIsLoading,
160
178
  dispatch,
161
179
  handleTriggerClick
162
180
  ]
@@ -0,0 +1,132 @@
1
+ import { BrowserPersistence } from '@magento/peregrine/lib/util';
2
+
3
+ const storage = new BrowserPersistence();
4
+
5
+ // If the root template supplies the backend URL at runtime, use it directly
6
+ const { documentElement: htmlElement } = globalThis.document || {};
7
+ const { imageOptimizingOrigin } = htmlElement ? htmlElement.dataset : {};
8
+ const alreadyOptimized = imageOptimizingOrigin === 'backend';
9
+
10
+ const websiteCodes = [];
11
+
12
+ AVAILABLE_WEBSITES.forEach(store => {
13
+ websiteCodes.push(store.website_code);
14
+ });
15
+
16
+ const { location } = globalThis;
17
+ const match = location && location.pathname.split("/")[1];
18
+ const websiteCodeInUrl = websiteCodes.find((str) => str === match);
19
+
20
+ let prefix = websiteCodeInUrl ? websiteCodeInUrl + '_' : '';
21
+
22
+ // Protect against potential falsy values for `mediaBackend`.
23
+ const storeCode = storage.getItem(prefix + 'store_view_code') || STORE_VIEW_CODE;
24
+ const storeSecureBaseMediaUrl = {};
25
+
26
+ // Fallback to global secure_base_media_url set at build time
27
+ AVAILABLE_STORE_VIEWS.forEach(store => {
28
+ storeSecureBaseMediaUrl[store.store_code] = store.secure_base_media_url;
29
+ });
30
+
31
+ let mediaBackend =
32
+ storage.getItem(prefix + 'store_view_secure_base_media_url') ||
33
+ storeSecureBaseMediaUrl[storeCode];
34
+ if (!mediaBackend) {
35
+ console.warn('A media backend URL should be defined in your config.');
36
+ mediaBackend = 'https://backend.test/media/';
37
+ }
38
+
39
+ // Tests if a URL begins with `http:` or `https:` or `data:`
40
+ const absoluteUrl = /^(data|http|https)?:/i;
41
+
42
+ // Simple path joiner that guarantees one and only one slash between segments
43
+ const joinUrls = (base, url) =>
44
+ (base.endsWith('/') ? base.slice(0, -1) : base) +
45
+ '/' +
46
+ (url.startsWith('/') ? url.slice(1) : url);
47
+
48
+ const mediaBases = new Map()
49
+ .set('image-product', 'catalog/product/')
50
+ .set('image-category', 'catalog/category/')
51
+ .set('image-swatch', 'attribute/swatch/');
52
+
53
+ const getFileType = url => {
54
+ const fileName = url.pathname.split('/').reverse()[0];
55
+ const fileType = fileName.split('.').reverse()[0];
56
+
57
+ return fileType;
58
+ };
59
+
60
+ /**
61
+ * Creates an "optimized" url for a provided relative url based on
62
+ * requested media type and width. Any image URLs (whose type begins with
63
+ * "image-" will also be optimized.)
64
+ *
65
+ * If a `type` is provided the `path` will be joined with the associated media
66
+ * base.
67
+ * - `catalog/product/path/to/img.jpg`
68
+ *
69
+ * If a `width` is provided, "resize parameters" are added to the URL for
70
+ * middlewares (either onboard or backend) to return using the desired width
71
+ * and original media url.
72
+ * - `catalog/product/path/to/img.jpg?width=500&auto=webp&format=pjpg
73
+ *
74
+ * If only `path` is provided it is returned unaltered.
75
+ *
76
+ * @param {string} path - absolute or relative url to resource.
77
+ * @param {Object} props - properties describing desired optimizations
78
+ * @param {string} props.type - "image-product" or "image-category"
79
+ * @param {number} props.width - the desired resize width of the image
80
+ * @param {number} props.height - the desired resize height of the image
81
+ * @param {number} props.quality - the desired quality of the image
82
+ * @param {bool} props.crop - should the image be cropped
83
+ * @param {string} props.fit - how should the image be fit with the dimensions: bounds, cover, crop
84
+ */
85
+ const makeOptimizedUrl = (path, { type, ...opts } = {}) => {
86
+ // Immediate return if there's no image optimization to attempt
87
+ if (!type || !type.startsWith('image-')) {
88
+ return path;
89
+ }
90
+
91
+ const { origin } = globalThis.location || {};
92
+ const isAbsolute = absoluteUrl.test(path);
93
+ const magentoBackendURL = process.env.MAGENTO_BACKEND_URL;
94
+ let baseURL = new URL(path, mediaBackend);
95
+
96
+ // If URL is relative and has a supported type, prepend media base onto path
97
+ if (!isAbsolute && mediaBases.has(type)) {
98
+ const mediaBase = mediaBases.get(type);
99
+ if (!baseURL.pathname.includes(mediaBase)) {
100
+ baseURL = new URL(joinUrls(mediaBase, path), mediaBackend);
101
+ }
102
+ }
103
+
104
+ if (baseURL.href.startsWith(magentoBackendURL) && !alreadyOptimized) {
105
+ // Replace URL base so optimization middleware can handle request
106
+ baseURL = new URL(baseURL.href.slice(magentoBackendURL.length), origin);
107
+ }
108
+
109
+ // Append image optimization parameters
110
+ const params = new URLSearchParams(baseURL.search);
111
+ params.set('auto', 'webp'); // Use the webp format if available
112
+
113
+ const imageFileType = getFileType(baseURL);
114
+ if (imageFileType === 'png') {
115
+ params.set('format', 'png'); // use png if webp is not available
116
+ } else {
117
+ params.set('format', 'pjpg'); // Use progressive JPG if webp is not available
118
+ }
119
+
120
+ Object.entries(opts).forEach(([key, value]) => {
121
+ if (value !== undefined && value !== null) {
122
+ params.set(key, value);
123
+ }
124
+ });
125
+ baseURL.search = params.toString();
126
+ if (baseURL.origin === origin) {
127
+ return baseURL.href.slice(baseURL.origin.length);
128
+ }
129
+ return baseURL.href;
130
+ };
131
+
132
+ export default makeOptimizedUrl;
@@ -106,63 +106,67 @@ const Adapter = props => {
106
106
  // await removeCart();
107
107
 
108
108
  // klo enabled jd redirect tros
109
- storage.removeItem('cartId');
110
-
111
- storage.setItem('store_view_code', storeCodeInUrl);
112
- storage.setItem('website_code', websiteCodeInUrl);
113
- storage.setItem(
114
- 'store_view_currency',
115
- storeCurrencies[storeCodeInUrl]
116
- );
117
- storage.setItem(
118
- 'store_view_secure_base_media_url',
119
- storeSecureBaseMediaUrl[storeCodeInUrl]
120
- );
109
+ // storage.removeItem('cartId');
110
+
111
+ // storage.setItem('store_view_code', storeCodeInUrl);
112
+ // storage.setItem('website_code', websiteCodeInUrl);
113
+ // storage.setItem(
114
+ // 'store_view_currency',
115
+ // storeCurrencies[storeCodeInUrl]
116
+ // );
117
+ // storage.setItem(
118
+ // 'store_view_secure_base_media_url',
119
+ // storeSecureBaseMediaUrl[storeCodeInUrl]
120
+ // );
121
121
 
122
122
  // We're required to reload the page as the basename doesn't
123
123
  // change entirely without a full page reload.
124
124
  // history.go(0);
125
125
  }
126
126
 
127
- console.log('currentWebsiteCode',currentWebsiteCode)
128
-
129
- if (!websiteCodeInUrl && getWebsiteByUserIp) {
130
- setVerifyUserIp(false);
131
-
132
- const search = location.search;
133
-
134
- const query = new URLSearchParams(search);
135
- const isAccessBaseWebsite = query.get('access_base_website') || (
136
- storage.getItem('access_base_website') || null
137
- );
127
+ // console.log('currentWebsiteCode',currentWebsiteCode)
138
128
 
139
- // const websiteCode = getWebsiteByUserIp.countryCode && !isAccessBaseWebsite ? getWebsiteByUserIp.countryCode.toLowerCase() : process.env.WEBSITE_CODE;
129
+ if (!websiteCodeInUrl) {
140
130
  const websiteCode = process.env.WEBSITE_CODE;
131
+ // if (websiteCode != storage.getItem('website_code')) {
132
+ setVerifyUserIp(false);
133
+
134
+ const search = location.search;
135
+
136
+ const query = new URLSearchParams(search);
137
+ const isAccessBaseWebsite = query.get('access_base_website') || (
138
+ storage.getItem('access_base_website') || null
139
+ );
141
140
 
142
- if (websiteCodes.find((str) => str === websiteCode)) {
143
- routerProps.basename = websiteCode != process.env.WEBSITE_CODE && !isAccessBaseWebsite ? '/'+websiteCode : '/';
141
+ // const websiteCode = getWebsiteByUserIp.countryCode && !isAccessBaseWebsite ? getWebsiteByUserIp.countryCode.toLowerCase() : process.env.WEBSITE_CODE;
144
142
 
145
- setNewRouterProps(routerProps);
143
+ if (websiteCodes.find((str) => str === websiteCode)) {
144
+ routerProps.basename = websiteCode != process.env.WEBSITE_CODE && !isAccessBaseWebsite ? '/'+websiteCode : '/';
146
145
 
147
- if (isAccessBaseWebsite) {
148
- storage.setItem('access_base_website', 1);
149
- }
146
+ setNewRouterProps(routerProps);
150
147
 
151
- let storeCodeInUrl = websiteStores[websiteCode];
148
+ if (isAccessBaseWebsite) {
149
+ storage.setItem('access_base_website', 1);
150
+ }
152
151
 
153
- storage.removeItem('cartId');
152
+ let storeCodeInUrl = websiteStores[websiteCode];
154
153
 
155
- storage.setItem('store_view_code', storeCodeInUrl);
156
- storage.setItem('website_code', websiteCode);
157
- storage.setItem(
158
- 'store_view_currency',
159
- storeCurrencies[storeCodeInUrl]
160
- );
161
- storage.setItem(
162
- 'store_view_secure_base_media_url',
163
- storeSecureBaseMediaUrl[storeCodeInUrl]
164
- );
165
- }
154
+ if (websiteCode != storage.getItem('website_code')) {
155
+ storage.removeItem('cartId');
156
+ }
157
+
158
+ storage.setItem('store_view_code', storeCodeInUrl);
159
+ storage.setItem('website_code', websiteCode);
160
+ storage.setItem(
161
+ 'store_view_currency',
162
+ storeCurrencies[storeCodeInUrl]
163
+ );
164
+ storage.setItem(
165
+ 'store_view_secure_base_media_url',
166
+ storeSecureBaseMediaUrl[storeCodeInUrl]
167
+ );
168
+ }
169
+ // }
166
170
  }
167
171
  }, [websiteCodeInUrl, currentWebsiteCode]);
168
172
 
@@ -130,7 +130,7 @@ const Footer = props => {
130
130
  <p className="text-colorDefault">{copyrightText || null}</p>
131
131
  <ul className="flex flex-row gap-x-2.5">
132
132
  <li data-cy="Footer-terms" className={classes.terms}>
133
- <Link to="/" className="text-colorDefault underline">
133
+ <Link to="/terms-of-use" className="text-colorDefault underline">
134
134
  <FormattedMessage
135
135
  id={'footer.termsText'}
136
136
  defaultMessage={'Terms of Use'}
@@ -139,7 +139,7 @@ const Footer = props => {
139
139
  </li>
140
140
  <Divider className="w-[1px] !h-[20px]" />
141
141
  <li data-cy="Footer-privacy" className={classes.privacy}>
142
- <Link to="/" className="text-colorDefault underline">
142
+ <Link to="/privacy-policy" className="text-colorDefault underline">
143
143
  <FormattedMessage
144
144
  id={'footer.privacyText'}
145
145
  defaultMessage={'Privacy Policy'}