@riosst100/pwa-marketplace 3.2.9 → 3.3.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.
Files changed (29) hide show
  1. package/package.json +1 -1
  2. package/src/components/AgeVerification/ageVerification.js +121 -0
  3. package/src/components/AgeVerification/index.js +1 -2
  4. package/src/components/AgeVerificationModal/ageVerificationModal.js +83 -0
  5. package/src/components/{AgeVerification → AgeVerificationModal}/ageVerificationModal.module.css +77 -10
  6. package/src/components/AgeVerificationModal/index.js +2 -0
  7. package/src/components/LiveChat/MessagesModal.js +3 -3
  8. package/src/components/Messages/messages.js +90 -117
  9. package/src/components/Messages/messages.module.css +15 -0
  10. package/src/components/RFQ/modalRfq.js +90 -18
  11. package/src/components/RFQPage/quoteDetail.js +47 -30
  12. package/src/components/ShowMore/showMore.js +8 -5
  13. package/src/intercept.js +9 -0
  14. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategory.js +0 -4
  15. package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +2 -0
  16. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +1 -1
  17. package/src/overwrites/venia-ui/lib/RootComponents/Product/product.js +2 -0
  18. package/src/overwrites/venia-ui/lib/components/Adapter/adapter.js +0 -23
  19. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +9 -4
  20. package/src/talons/AgeVerification/ageVerification.gql.js +31 -0
  21. package/src/talons/AgeVerification/useAgeVerification.js +126 -0
  22. package/src/talons/MessagesPage/messagesPage.gql.js +4 -0
  23. package/src/talons/RFQ/rfq.gql.js +8 -0
  24. package/src/talons/RFQ/useRFQ.js +31 -6
  25. package/src/talons/Seller/useSeller.js +4 -1
  26. package/src/components/AgeVerification/ageVerificationModal.js +0 -163
  27. package/src/components/AgeVerification/sellerCoupon.js +0 -119
  28. package/src/components/AgeVerification/sellerCouponCheckout.js +0 -164
  29. /package/src/components/{AgeVerification → AgeVerificationModal}/ageVerificationModal.shimmer.js +0 -0
@@ -30,15 +30,42 @@ const RFQModalForm = (props) => {
30
30
 
31
31
  // Upload File with remove capability
32
32
  const [uploadedFiles, setUploadedFiles] = useState([]);
33
+ // Calculate safe raw-size limit to keep base64 payload under 2MB
34
+ const GRAPHQL_BASE64_LIMIT = 2 * 1024 * 1024;
35
+ const SAFE_RAW_LIMIT = Math.floor((GRAPHQL_BASE64_LIMIT * 3) / 4) - 8 * 1024;
36
+ const estimateBase64Size = size => Math.ceil((4 * size) / 3);
37
+
33
38
  const onDrop = useCallback((accepted) => {
34
- setUploadedFiles(prev => [...prev, ...accepted]);
35
- }, []);
39
+ const safe = [];
40
+ const rejected = [];
41
+ accepted.forEach(f => {
42
+ const est = estimateBase64Size(f.size || 0);
43
+ if (est <= GRAPHQL_BASE64_LIMIT) {
44
+ safe.push(f);
45
+ } else {
46
+ rejected.push({ name: f.name || f.path, size: f.size });
47
+ }
48
+ });
49
+ if (safe.length) {
50
+ setUploadedFiles(prev => [...prev, ...safe]);
51
+ }
52
+ if (rejected.length) {
53
+ addToast({
54
+ type: 'error',
55
+ message: formatMessage({
56
+ id: 'productFullDetail.rfqFileTooLarge',
57
+ defaultMessage: 'One or more files are too large. Max ~1.5MB each.'
58
+ }),
59
+ timeout: 4000
60
+ });
61
+ }
62
+ }, [addToast, formatMessage]);
36
63
 
37
64
  const {
38
65
  getRootProps,
39
66
  getInputProps,
40
67
  isDragActive
41
- } = useDropzone({ onDrop });
68
+ } = useDropzone({ onDrop, maxSize: SAFE_RAW_LIMIT, multiple: true });
42
69
 
43
70
  const handleRemoveFile = useCallback((index) => {
44
71
  setUploadedFiles(prev => prev.filter((_, i) => i !== index));
@@ -59,8 +86,60 @@ const RFQModalForm = (props) => {
59
86
  </div>
60
87
  ));
61
88
 
89
+ // Helper: convert File to base64 string (without data URL prefix)
90
+ const toBase64 = useCallback(
91
+ file =>
92
+ new Promise((resolve, reject) => {
93
+ try {
94
+ const reader = new FileReader();
95
+ reader.onload = () => {
96
+ const result = reader.result;
97
+ // reader.result is a Data URL: "data:<mime>;base64,<payload>"
98
+ const base64 = typeof result === 'string' && result.includes(',')
99
+ ? result.split(',')[1]
100
+ : '';
101
+ resolve(base64);
102
+ };
103
+ reader.onerror = reject;
104
+ reader.readAsDataURL(file);
105
+ } catch (e) {
106
+ reject(e);
107
+ }
108
+ }),
109
+ []
110
+ );
111
+
62
112
  const handleSubmit = useCallback(async values => {
63
- console.log('[RFQ] submit values', values);
113
+ // console.log('[RFQ] submit values', values);
114
+ // Prepare base64 conversions if any files were uploaded
115
+ let filesPayload = undefined;
116
+ if (uploadedFiles && uploadedFiles.length) {
117
+ // Hard guard: abort if any file would exceed limit after base64 encoding
118
+ const oversize = uploadedFiles.find(f => estimateBase64Size(f.size || 0) > GRAPHQL_BASE64_LIMIT);
119
+ if (oversize) {
120
+ addToast({
121
+ type: 'error',
122
+ message: formatMessage({
123
+ id: 'productFullDetail.rfqFileTooLargeSubmit',
124
+ defaultMessage: 'A selected file is too large (limit ~1.5MB).'
125
+ }),
126
+ timeout: 4000
127
+ });
128
+ return;
129
+ }
130
+ try {
131
+ const base64List = await Promise.all(
132
+ uploadedFiles.map(file => toBase64(file))
133
+ );
134
+ filesPayload = uploadedFiles.map((file, i) => ({
135
+ file_name: (file && (file.name || file.path)) || '',
136
+ file_type: (file && file.type) ? file.type : 'application/octet-stream',
137
+ base64: base64List[i] || ''
138
+ }));
139
+ } catch (e) {
140
+ console.error('[RFQ] file base64 conversion failed', e);
141
+ }
142
+ }
64
143
  const input = {
65
144
  product_id: productId,
66
145
  quantity: values.quote_qty ? Number(values.quote_qty) : undefined,
@@ -70,24 +149,16 @@ const RFQModalForm = (props) => {
70
149
  ? Number(values.quote_price_per_unit)
71
150
  : undefined,
72
151
  date_need_quote: startDate ? startDate.toISOString() : undefined,
73
- files: uploadedFiles.length
74
- ? uploadedFiles.map(file => ({
75
- file_name: (file && (file.name || file.path)) || '',
76
- // Browsers do not expose real file system paths; use name as a stable placeholder
77
- file_path: (file && (file.path || file.name)) || '',
78
- // Ensure a valid MIME string; default if missing
79
- file_type: (file && file.type) ? file.type : 'application/octet-stream'
80
- }))
81
- : undefined
152
+ files: filesPayload
82
153
  };
83
154
 
84
- console.log('[RFQ] input payload', input);
155
+ // console.log('[RFQ] input payload', input);
85
156
 
86
157
  Object.keys(input).forEach(key => input[key] === undefined && delete input[key]);
87
158
 
88
159
  try {
89
160
  const result = await handleCreateQuickRfq(input);
90
- console.log('[RFQ] mutation result', result);
161
+ // console.log('[RFQ] mutation result', result);
91
162
  addToast({
92
163
  type: 'success',
93
164
  message: formatMessage({
@@ -108,7 +179,7 @@ const RFQModalForm = (props) => {
108
179
  timeout: 4000
109
180
  });
110
181
  }
111
- }, [uploadedFiles, addToast, formatMessage, handleCreateQuickRfq, setOpen, startDate]);
182
+ }, [uploadedFiles, addToast, formatMessage, handleCreateQuickRfq, setOpen, startDate, toBase64]);
112
183
 
113
184
  return (
114
185
  <>
@@ -271,6 +342,7 @@ const RFQModalForm = (props) => {
271
342
  color="#f76b1c"
272
343
  />
273
344
  <div className='mt-2 text-blue-600'>Drop files or click here to upload</div>
345
+ <div className='mt-1 text-gray-500 text-xs'>Max size per file ~1.5MB (transport limit 2MB)</div>
274
346
  </div>
275
347
  {files && files.length > 0 && (
276
348
  <div className="wfp--dropzone__file-list mt-4">
@@ -288,7 +360,7 @@ const RFQModalForm = (props) => {
288
360
  }}
289
361
  type="button"
290
362
  onClick={() => {
291
- console.log('[RFQ] Cancel clicked, closing modal');
363
+ // console.log('[RFQ] Cancel clicked, closing modal');
292
364
  setOpen(false);
293
365
  }}
294
366
  >
@@ -307,7 +379,7 @@ const RFQModalForm = (props) => {
307
379
  }}
308
380
  type="button"
309
381
  onPress={() => {
310
- console.log('[RFQ] Submit pressed, calling formApi.submitForm()');
382
+ // console.log('[RFQ] Submit pressed, calling formApi.submitForm()');
311
383
  formApi.submitForm();
312
384
  }}
313
385
  disabled={createState?.loading}
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
2
2
  import { useIntl } from 'react-intl';
3
3
  import { StoreTitle } from '@magento/venia-ui/lib/components/Head';
4
4
  import Image from '@magento/venia-ui/lib/components/Image';
5
- import { Link, useParams, useLocation } from 'react-router-dom';
5
+ import { useParams, useLocation, useHistory } from 'react-router-dom';
6
6
  import Button from '@magento/venia-ui/lib/components/Button';
7
7
  import ChatContent from '../LiveChat/chatContent';
8
8
  import cn from 'classnames';
@@ -10,16 +10,51 @@ import { Send } from 'iconsax-react';
10
10
  import Price from '@magento/venia-ui/lib/components/Price';
11
11
  import { useRFQ } from '@riosst100/pwa-marketplace/src/talons/RFQ/useRFQ';
12
12
  import LoadingIndicator from '@magento/venia-ui/lib/components/LoadingIndicator';
13
+ import { useToasts } from '@magento/peregrine/lib';
14
+ import { useCartContext } from '@magento/peregrine/lib/context/cart';
15
+ import {
16
+ useApolloClient
17
+ } from '@apollo/client';
13
18
 
14
19
  const quoteDetail = () => {
20
+ const history = useHistory();
21
+
15
22
  const { formatMessage } = useIntl();
16
23
  const { urlKey } = useParams();
17
24
  const location = useLocation();
18
25
  const locationRfq = location && location.state && location.state.rfq ? location.state.rfq : null;
19
- const { loadRfqDetail, rfqDetailState, handleSendRfqMessage, startDetailPolling, stopDetailPolling, handleConvertQuickrfqToCart } = useRFQ();
26
+ const { fetchCartId, addToCartResponseData, isAddProductLoading, errorAddingProductToCart, loadRfqDetail, rfqDetailState, handleSendRfqMessage, startDetailPolling, stopDetailPolling, handleConvertQuickrfqToCart } = useRFQ();
27
+
28
+ const apolloClient = useApolloClient();
29
+ const [{ cartId }, { createCart, removeCart }] = useCartContext();
30
+
31
+ useEffect(async() => {
32
+ if (
33
+ addToCartResponseData
34
+ && !isAddProductLoading
35
+ && !errorAddingProductToCart
36
+ ) {
37
+ try {
38
+ await removeCart();
39
+ await apolloClient.clearCacheData(apolloClient, 'cart');
40
+
41
+ // masked_cart_id
42
+ await createCart({ fetchCartId });
43
+
44
+ history.push('/checkout');
45
+ } catch (cleanupErr) {
46
+ // eslint-disable-next-line no-console
47
+ console.log(cleanupErr);
48
+ }
49
+
50
+
51
+ }
52
+ }, [history, fetchCartId, apolloClient, removeCart, createCart, addToCartResponseData, errorAddingProductToCart, isAddProductLoading]);
53
+
20
54
  const [messageText, setMessageText] = useState('');
21
55
  const [isSending, setIsSending] = useState(false);
22
56
  const [sendError, setSendError] = useState(null);
57
+
23
58
  const detailData = rfqDetailState && rfqDetailState.data ? rfqDetailState.data.quickrfqDetail : null;
24
59
  const detailLoading = rfqDetailState ? rfqDetailState.loading : false;
25
60
  const detailError = rfqDetailState ? rfqDetailState.error : null;
@@ -27,10 +62,9 @@ const quoteDetail = () => {
27
62
  id: 'Quotes.pageTitleTextQuoteDetail',
28
63
  defaultMessage: 'Quote Detail'
29
64
  });
30
-
31
- // prefer image from info_buy_request if available; otherwise use placeholder
32
- const urlImage = 'https://pwa-tcgcollective.local:8255/media/catalog/product/s/-/s-l1600_6__1.jpg?auto=webp&format=pjpg&width=495&height=618.75&fit=cover';
33
-
65
+
66
+ const placeholderImage = 'https://pwa-tcgcollective.local:8255/media/catalog/product/s/-/s-l1600_6__1.jpg?auto=webp&format=pjpg&width=495&height=618.75&fit=cover';
67
+
34
68
  useEffect(() => {
35
69
  if (!locationRfq) {
36
70
  const fromParam = urlKey ? parseInt(urlKey, 10) : NaN;
@@ -311,8 +345,8 @@ const quoteDetail = () => {
311
345
  <div className='relative flex w-full md_w-6/12 justify-center flex-col mb-10 md_mb-0'>
312
346
  <Image
313
347
  alt='product image'
314
- className="relative max-w-[300px]"
315
- src={urlImage}
348
+ className="relative max-w-[200px]"
349
+ src={rfq && rfq.image_url ? rfq.image_url : placeholderImage}
316
350
  classes={{
317
351
  root: ' relative self-center mb-5'
318
352
  }}
@@ -334,32 +368,15 @@ const quoteDetail = () => {
334
368
  classes={{
335
369
  content: 'capitalize text-[16px] font-medium'
336
370
  }}
337
- disabled={isConverting || !quickrfqIdValue || isNaN(quickrfqIdValue)}
371
+ // disabled={isConverting || !quickrfqIdValue || isNaN(quickrfqIdValue) || status === 'Done'}
338
372
  aria-busy={isConverting}
339
- onPress={async () => {
340
- const qid = quickrfqIdValue;
341
- if (!qid || isNaN(qid)) return;
342
- try {
343
- setConvertError(null);
344
- setConvertSuccess(null);
345
- setIsConverting(true);
346
- const res = await handleConvertQuickrfqToCart(qid);
347
- const payload = res && res.data && res.data.convertQuickrfqToCart ? res.data.convertQuickrfqToCart : null;
348
- if (payload && payload.status) {
349
- setConvertSuccess(payload.message || 'Converted to cart.');
350
- } else {
351
- setConvertError('Failed to convert quote to cart.');
352
- }
353
- } catch (e) {
354
- setConvertError('Failed to convert quote to cart.');
355
- } finally {
356
- setIsConverting(false);
357
- }
358
- }}
373
+ onClick={handleConvertQuickrfqToCart}
359
374
  >
360
375
  {isConverting
361
376
  ? formatMessage({ id: 'Quotes.converting', defaultMessage: 'Add To Cart…' })
362
- : formatMessage({ id: 'Quotes.addToCart', defaultMessage: 'Add To Cart' })}
377
+ : status === 'Done'
378
+ ? formatMessage({ id: 'Quotes.completed', defaultMessage: 'Completed' })
379
+ : formatMessage({ id: 'Quotes.addToCart', defaultMessage: 'Add To Cart' })}
363
380
  </Button>
364
381
  {convertError ? (
365
382
  <div className='text-red-600 text-[12px] mt-2 text-center'>{convertError}</div>
@@ -82,25 +82,28 @@ const ShowMore = props => {
82
82
  if (shopby == 'sc_brands') {
83
83
  additionalFilter = '&shopby=release&active_tab=brand';
84
84
  }
85
-
85
+
86
86
  const setRelases = newAvailableGroups && newAvailableGroups.length && newAvailableGroups.map((group, index) => {
87
87
  const optionsResult = [];
88
88
 
89
89
  if (active === 'all' || active === group) {
90
90
  dataResult[group] && dataResult[group].length && dataResult[group].map((option, index) => {
91
91
  const { count, label, value } = option;
92
+
93
+ const attrCodeParam = attributeData.attribute_code + '[filter]';
94
+ const attrValParam = label + ',' + value;
92
95
 
93
- const filter = attributeData.attribute_code + '[filter]=' + label + ',' + value;
94
- const params = filterSearch ? filterSearch + '&' + filter + additionalFilter : '?' + filter + additionalFilter;
96
+ const params = new URLSearchParams();
97
+ params.set(attrCodeParam, attrValParam);
95
98
 
96
99
  const categoryUrl = resourceUrl(
97
- `/${category?.url_path}${categoryUrlSuffix || ''}${params}`
100
+ `/${category?.url_path}${categoryUrlSuffix || ''}${'?' + params.toString()}`
98
101
  );
99
102
 
100
103
  optionsResult.push(<li key={index} className='list-none'>
101
104
  <Link to={categoryUrl} className="hover_bg-darkblue-900 hover_text-white w-full block text-[14px] py-[2px] px-0">
102
105
  {label}
103
- {/* <span className='text-[12px]'>({count})</span> */}
106
+ {/* <span className='text-[12px]'>({count})</span> */}
104
107
  </Link>
105
108
  </li>)
106
109
  });
package/src/intercept.js CHANGED
@@ -185,6 +185,7 @@ module.exports = targets => {
185
185
  pattern: "/favorite-seller",
186
186
  path: require.resolve("./components/FavoriteSellerPage/index.js"),
187
187
  authed: true,
188
+ redirectTo: "/sign-in"
188
189
  },
189
190
  {
190
191
  exact: true,
@@ -192,6 +193,7 @@ module.exports = targets => {
192
193
  pattern: "/quotes",
193
194
  path: require.resolve("./components/RFQPage/index.js"),
194
195
  authed: true,
196
+ redirectTo: "/sign-in"
195
197
  },
196
198
  {
197
199
  exact: true,
@@ -199,6 +201,7 @@ module.exports = targets => {
199
201
  pattern: "/quotes/:urlKey",
200
202
  path: require.resolve("./components/RFQPage/quoteDetailPage.js"),
201
203
  authed: true,
204
+ redirectTo: "/sign-in"
202
205
  },
203
206
  {
204
207
  exact: true,
@@ -206,6 +209,7 @@ module.exports = targets => {
206
209
  pattern: "/return",
207
210
  path: require.resolve("./components/RMAPage/index.js"),
208
211
  authed: true,
212
+ redirectTo: "/sign-in"
209
213
  },
210
214
  {
211
215
  exact: true,
@@ -213,6 +217,7 @@ module.exports = targets => {
213
217
  pattern: "/return/select",
214
218
  path: require.resolve("./components/RMAPage/RMASelectPage.js"),
215
219
  authed: true,
220
+ redirectTo: "/sign-in"
216
221
  },
217
222
  {
218
223
  exact: true,
@@ -220,6 +225,7 @@ module.exports = targets => {
220
225
  pattern: "/return/view/:urlKey",
221
226
  path: require.resolve("./components/RMAPage/RMADetailPage.js"),
222
227
  authed: true,
228
+ redirectTo: "/sign-in"
223
229
  },
224
230
  {
225
231
  exact: true,
@@ -227,6 +233,7 @@ module.exports = targets => {
227
233
  pattern: "/return/create/:urlKey",
228
234
  path: require.resolve("./components/RMAPage/RMACreatePage.js"),
229
235
  authed: true,
236
+ redirectTo: "/sign-in"
230
237
  },
231
238
  {
232
239
  exact: true,
@@ -234,6 +241,7 @@ module.exports = targets => {
234
241
  pattern: "/order-history/view/:urlKey",
235
242
  path: require.resolve("./components/OrderDetail/orderDetailPage.js"),
236
243
  authed: true,
244
+ redirectTo: "/sign-in"
237
245
  },
238
246
  {
239
247
  exact: true,
@@ -241,6 +249,7 @@ module.exports = targets => {
241
249
  pattern: "/messages",
242
250
  path: require.resolve("./components/MessagesPage/index.js"),
243
251
  authed: true,
252
+ redirectTo: "/sign-in"
244
253
  }
245
254
  ];
246
255
 
@@ -107,10 +107,6 @@ export const useCategory = props => {
107
107
  loading: introspectionLoading
108
108
  } = useQuery(getFilterInputsQuery);
109
109
 
110
- // console.log(introspectionCalled)
111
- // console.log(introspectionLoading)
112
- // console.log(introspectionData)
113
-
114
110
  // Create a type map we can reference later to ensure we pass valid args
115
111
  // to the graphql query.
116
112
  // For example: { category_id: 'FilterEqualTypeInput', price: 'FilterRangeTypeInput' }
@@ -21,6 +21,7 @@ import TrainsSets from '@riosst100/pwa-marketplace/src/components/TrainsSets/tra
21
21
  import SetsData from '@riosst100/pwa-marketplace/src/components/SetsData/setsData';
22
22
  import FilterContent from '@riosst100/pwa-marketplace/src/components/FilterContent/filterContent';
23
23
  import ShowMore from '@riosst100/pwa-marketplace/src/components/ShowMore/showMore';
24
+ import AgeVerification from '@riosst100/pwa-marketplace/src/components/AgeVerification'
24
25
 
25
26
  const MESSAGES = new Map().set(
26
27
  'NOT_FOUND',
@@ -205,6 +206,7 @@ const Category = props => {
205
206
  return (
206
207
  <Fragment>
207
208
  <Meta name="description" content={metaDescription} />
209
+ <AgeVerification pageType="CATEGORY" />
208
210
  {categoryContent}
209
211
  </Fragment>
210
212
  );
@@ -1,4 +1,4 @@
1
- import React, { Fragment, Suspense, useMemo, useRef, useState } from 'react';
1
+ import React, { Fragment, useEffect, Suspense, useMemo, useRef, useState } from 'react';
2
2
  import { FormattedMessage } from 'react-intl';
3
3
  import { array, number, shape, string } from 'prop-types';
4
4
 
@@ -8,6 +8,7 @@ import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
8
8
  import ProductFullDetail from '@magento/venia-ui/lib/components/ProductFullDetail';
9
9
  import mapProduct from '@magento/venia-ui/lib/util/mapProduct';
10
10
  import ProductShimmer from '@magento/venia-ui/lib/RootComponents/Product/product.shimmer';
11
+ import AgeVerification from '@riosst100/pwa-marketplace/src/components/AgeVerification'
11
12
 
12
13
  /*
13
14
  * As of this writing, there is no single Product query type in the M2.3 schema.
@@ -46,6 +47,7 @@ const Product = props => {
46
47
  <Fragment>
47
48
  <StoreTitle>{product.name}</StoreTitle>
48
49
  <Meta name="description" content={product.meta_description} />
50
+ <AgeVerification pageType="PRODUCT" product={product} />
49
51
  <ProductFullDetail product={product} />
50
52
  </Fragment>
51
53
  );
@@ -31,29 +31,6 @@ const Adapter = props => {
31
31
  return null;
32
32
  }
33
33
 
34
- // console.log('isMaintenance',isMaintenance)
35
-
36
- // useEffect(() => {
37
- // const fetchData = async () => {
38
- // axios.get(apiBase).then((response) => {
39
- // // setIsMaintenance(false)
40
- // }).catch((error) => {
41
- // const status = error.response.status;
42
- // if (status != 200) {
43
- // console.log('status',status)
44
- // return <MaintenancePage />;
45
- // // setIsMaintenance(true)
46
- // }
47
- // });
48
- // };
49
-
50
- // fetchData();
51
-
52
-
53
- // if (isMaintenance) {
54
- // return <MaintenancePage />;
55
- // }
56
-
57
34
  const websiteCodes = [];
58
35
  const websiteStores = useMemo(() => ({}), []);
59
36
  const storeCurrencies = useMemo(() => ({}), []);
@@ -41,13 +41,13 @@ import ProductLabel from '@riosst100/pwa-marketplace/src/components/ProductLabel
41
41
  import RFQ from '@riosst100/pwa-marketplace/src/components/RFQ';
42
42
  import LinkToOtherStores from '@riosst100/pwa-marketplace/src/components/LinkToOtherStores';
43
43
  import Collapsible from '@riosst100/pwa-marketplace/src/components/commons/Collapsible';
44
- import { useLocation } from 'react-router-dom';
45
44
  import Icon from '@magento/venia-ui/lib/components/Icon';
46
45
  import { ShoppingCart } from 'react-feather';
47
46
  import MessagesModal from '@riosst100/pwa-marketplace/src/components/LiveChat/MessagesModal';
48
47
  import SellerOperations from '@riosst100/pwa-marketplace/src/talons/Seller/seller.gql';
49
48
 
50
- import AgeVerificationModal from '@riosst100/pwa-marketplace/src/components/AgeVerification/ageVerificationModal';
49
+ import { useLocation, useHistory } from 'react-router-dom';
50
+ import AgeVerification from '@riosst100/pwa-marketplace/src/components/AgeVerification'
51
51
 
52
52
  import { totalListings, lowestPrice } from '@riosst100/pwa-marketplace/src/components/CrossSeller/crossSellerBuy';
53
53
 
@@ -87,6 +87,8 @@ const ProductDetailsCollapsible = (props) => {
87
87
  const ProductFullDetail = props => {
88
88
  const { product } = props;
89
89
 
90
+ const history = useHistory();
91
+
90
92
  const { search } = useLocation();
91
93
 
92
94
  const params = new URLSearchParams(search);
@@ -174,7 +176,10 @@ const ProductFullDetail = props => {
174
176
  message: formatMessage({ id: 'messages.messageSent', defaultMessage: 'Message sent successfully.' }),
175
177
  timeout: 3000
176
178
  });
177
- await refetchMessages({ fetchPolicy: 'network-only' });
179
+ if (result) {
180
+ var messageId = result?.data?.customerSendMessage.message_id;
181
+ history.push('/messages?id=' + messageId);
182
+ }
178
183
  return result?.data?.customerSendMessage;
179
184
  };
180
185
 
@@ -812,7 +817,7 @@ const ProductFullDetail = props => {
812
817
  <Fragment>
813
818
  {breadcrumbs}
814
819
  {productPreviewMessages}
815
- {/* <AgeVerificationModal /> */}
820
+ <AgeVerification />
816
821
  <Form
817
822
  className={classes.root}
818
823
  data-cy="ProductFullDetail-root"
@@ -0,0 +1,31 @@
1
+ import { gql } from '@apollo/client';
2
+
3
+ export const GET_AGE_VERIFICATION_CONFIG_QUERY = gql`
4
+ query GetAgeVerificationConfig(
5
+ $attributeCode: String
6
+ $attributeOption: String
7
+ ) {
8
+ getAgeVerificationConfig(
9
+ attribute_code: $attributeCode
10
+ attribute_option: $attributeOption
11
+ ) {
12
+ status
13
+ minimum_age
14
+ }
15
+ }
16
+ `;
17
+
18
+ export const GET_CATALOG_CONFIG_DATA_QUERY = gql`
19
+ query getStoreConfigData {
20
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
21
+ storeConfig {
22
+ store_code
23
+ marketplace_menu_topfilters_attributes
24
+ }
25
+ }
26
+ `;
27
+
28
+ export default {
29
+ getAgeVerificationConfigQuery: GET_AGE_VERIFICATION_CONFIG_QUERY,
30
+ getMenuTopFiltersAttributesConfigDataQuery: GET_CATALOG_CONFIG_DATA_QUERY
31
+ };