@riosst100/pwa-marketplace 1.4.0 → 1.4.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 (37) hide show
  1. package/package.json +1 -1
  2. package/src/componentOverrideMapping.js +3 -1
  3. package/src/components/BrandSlider/brandSlider.js +91 -0
  4. package/src/components/BrandSlider/index.js +1 -0
  5. package/src/components/BrandSlider/item.js +43 -0
  6. package/src/components/CollectibleGameSets/collectibleGameSets.js +52 -0
  7. package/src/components/CollectibleGameSets/index.js +1 -0
  8. package/src/components/CollectibleGameSetsPage/collectibleGameSetsPage.js +10 -0
  9. package/src/components/CollectibleGameSetsPage/index.js +1 -0
  10. package/src/components/Divider/index.js +11 -0
  11. package/src/components/SellerDetail/sellerDetail.js +1 -1
  12. package/src/components/SellerReviewItem/sellerReviewItem.js +51 -51
  13. package/src/intercept.js +7 -0
  14. package/src/overwrites/peregrine/lib/talons/MegaMenu/megaMenu.gql.js +24 -0
  15. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +5 -0
  16. package/src/overwrites/venia-ui/lib/components/Button/button.js +100 -0
  17. package/src/overwrites/venia-ui/lib/components/Button/button.module.css +128 -0
  18. package/src/overwrites/venia-ui/lib/components/Button/index.js +1 -0
  19. package/src/overwrites/venia-ui/lib/components/MegaMenu/customSubmenuColumn.js +55 -0
  20. package/src/overwrites/venia-ui/lib/components/MegaMenu/customSubmenuColumn.module.css +29 -0
  21. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +6 -3
  22. package/src/overwrites/venia-ui/lib/components/MegaMenu/shopByColumn.js +1 -1
  23. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +3 -20
  24. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +2 -1
  25. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +62 -14
  26. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.module.css +5 -0
  27. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/productReview.js +55 -0
  28. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +238 -46
  29. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.module.css +1 -5
  30. package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.js +23 -4
  31. package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.module.css +3 -7
  32. package/src/overwrites/venia-ui/lib/components/RichText/index.js +1 -0
  33. package/src/overwrites/venia-ui/lib/components/RichText/richText.js +21 -0
  34. package/src/overwrites/venia-ui/lib/components/RichText/richText.module.css +19 -0
  35. package/src/talons/CollectibleGameSets/collectibleGameSets.gql.js +27 -0
  36. package/src/talons/CollectibleGameSets/useCollectibleGameSets.js +65 -0
  37. package/src/theme/vars.js +2 -0
@@ -9,16 +9,23 @@ import { useProductFullDetail } from '@magento/peregrine/lib/talons/ProductFullD
9
9
  import { isProductConfigurable } from '@magento/peregrine/lib/util/isProductConfigurable';
10
10
 
11
11
  import { useStyle } from '@magento/venia-ui/lib/classify';
12
- import Breadcrumbs from '../Breadcrumbs';
12
+ import Breadcrumbs from '@magento/venia-ui/lib/components/Breadcrumbs';
13
13
  import Button from '@magento/venia-ui/lib/components/Button';
14
- import Carousel from '../ProductImageCarousel';
14
+ import Carousel from '@magento/venia-ui/lib/components/ProductImageCarousel';
15
15
  import FormError from '@magento/venia-ui/lib/components/FormError';
16
+ import RichContent from '@magento/venia-ui/lib/components/RichContent/richContent';
16
17
  import QuantityStepper from '../QuantityStepper';
17
- import RichContent from '../RichContent/richContent';
18
+ // import RichContent from '../RichContent/richContent';
18
19
  import { ProductOptionsShimmer } from '@magento/venia-ui/lib/components/ProductOptions';
19
20
  import CustomAttributes from './CustomAttributes';
20
21
  import defaultClasses from './productFullDetail.module.css';
21
22
  import cn from 'classnames';
23
+ import Tabs from '@riosst100/pwa-marketplace/src/components/commons/Tabs';
24
+ import ProductReviews from './components/productReview';
25
+ import RichText from '@magento/venia-ui/lib/components/RichText';
26
+ import { Star1, Verify, Sms, Message, Shop } from 'iconsax-react';
27
+ import { Link } from "react-router-dom";
28
+ import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
22
29
 
23
30
  const WishlistButton = React.lazy(() => import('@magento/venia-ui/lib/components/Wishlist/AddToListButton'));
24
31
  const Options = React.lazy(() => import('@magento/venia-ui/lib/components/ProductOptions'));
@@ -200,6 +207,9 @@ const ProductFullDetail = props => {
200
207
  })
201
208
  : ''
202
209
  }
210
+ classes={{
211
+ content: 'normal-case font-normal text-base'
212
+ }}
203
213
  priority="high"
204
214
  type="submit"
205
215
  >
@@ -221,7 +231,10 @@ const ProductFullDetail = props => {
221
231
  );
222
232
 
223
233
  const shortDescription = productDetails.shortDescription ? (
224
- <RichContent html={productDetails.shortDescription.html} />
234
+ <RichText
235
+ rootClassName="px-0"
236
+ content={productDetails.shortDescription.html}
237
+ />
225
238
  ) : null;
226
239
 
227
240
  const pageBuilderAttributes = customAttributesDetails.pagebuilder.length ? (
@@ -237,6 +250,94 @@ const ProductFullDetail = props => {
237
250
  const review_count = 0;
238
251
  const rating_value = 0;
239
252
 
253
+ const tokopedia_logo = './tokopedia_logo.png';
254
+
255
+ const contentContainerClass = 'content-container max-w-[1040px] p-2.5 m-auto relative mt-[34px]'
256
+ const ProductDescription = () => (
257
+ <div className={cn(contentContainerClass)}>
258
+ {/* <span
259
+ data-cy="ProductFullDetail-descriptionTitle"
260
+ className={classes.descriptionTitle}
261
+ >
262
+ <FormattedMessage
263
+ id={'productFullDetail.description'}
264
+ defaultMessage={'Description'}
265
+ />
266
+ </span> */}
267
+ {/* <RichContent html={productDetails.description} /> */}
268
+ <RichText
269
+ rootClassName="px-0"
270
+ content={productDetails.description}
271
+ />
272
+ </div>
273
+ );
274
+
275
+ const ProductMoreInfo = () => (
276
+ <>
277
+ <div className={cn(contentContainerClass)}>
278
+ <span
279
+ data-cy="ProductFullDetail-detailsTitle"
280
+ className={classes.detailsTitle}
281
+ >
282
+ <FormattedMessage
283
+ id={'productFullDetail.details'}
284
+ defaultMessage={'Details'}
285
+ />
286
+ </span>
287
+ <CustomAttributes
288
+ customAttributes={customAttributesDetails.list}
289
+ />
290
+ </div>
291
+ {pageBuilderAttributes}
292
+ </>
293
+ );
294
+
295
+ const ProductTNC = () => (
296
+ <div className={cn(contentContainerClass)}>
297
+ <p>
298
+ Terms and Conditions
299
+ </p>
300
+ </div>
301
+ )
302
+
303
+ const ProductFAQ = () => (
304
+ <div className={cn(contentContainerClass)}>
305
+ <p>
306
+ Frequently Ask Question
307
+ </p>
308
+ </div>
309
+ )
310
+
311
+
312
+ const dataTabs =
313
+ [
314
+ {
315
+ id: 'product-detail',
316
+ title: 'Details',
317
+ content: <ProductDescription />
318
+ },
319
+ {
320
+ id: 'product-more-info',
321
+ title: 'More Info',
322
+ content: <ProductMoreInfo />
323
+ },
324
+ {
325
+ id: 'product-tnc',
326
+ title: 'Terms & Conditions',
327
+ content: <ProductTNC />
328
+ },
329
+ {
330
+ id: 'product-faq',
331
+ title: 'FAQ',
332
+ content: <ProductFAQ />
333
+ },
334
+ {
335
+ id: 'product-reviews',
336
+ title: 'Reviews',
337
+ content: <ProductReviews className={cn(contentContainerClass)} />
338
+ }
339
+ ];
340
+
240
341
  return (
241
342
  <Fragment>
242
343
  {breadcrumbs}
@@ -247,11 +348,17 @@ const ProductFullDetail = props => {
247
348
  >
248
349
  <section className={classes.leftContainer}>
249
350
  <Carousel images={mediaGalleryEntries} />
351
+ <div className='product_group-actions'>
352
+ <Suspense fallback={null}>
353
+ <WishlistButton {...wishlistButtonProps} />
354
+ </Suspense>
355
+ </div>
250
356
  </section>
251
357
  <section className={classes.rightContainer}>
252
358
  <div
253
359
  className={cn(
254
- classes.title
360
+ classes.title,
361
+ 'mb-[30px]',
255
362
  )}
256
363
  >
257
364
  <h1
@@ -265,8 +372,11 @@ const ProductFullDetail = props => {
265
372
  {productDetails.name}
266
373
  </h1>
267
374
  <div className='product_review-container flex items-center gap-x-2'>
268
- <div className='product_rating leading-[14px]'>
269
- <span className='text-gray-200 text-base'>
375
+ <div className='product_rating leading-[14px] flex items-center gap-x-[5px]'>
376
+ <span className="w-3.5 h-3.5 relative">
377
+ <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
378
+ </span>
379
+ <span className='text-gray-200 text-sm'>
270
380
  {rating_value}
271
381
  </span>
272
382
  </div>
@@ -278,26 +388,41 @@ const ProductFullDetail = props => {
278
388
  </div>
279
389
  <div
280
390
  className={cn(
281
- 'product_short_description'
391
+ 'product_short_description',
392
+ 'mb-[30px]',
282
393
  )}
283
394
  >
284
395
  {shortDescription}
285
396
  </div>
397
+ <div className='product_brand-container mb-[30px] leading-[18px]'>
398
+ <div className='text-sm'>
399
+ Brand : <span className='text-blue-700'><Link to="">Bandai Namco</Link></span>
400
+ </div>
401
+ </div>
402
+ <Divider />
286
403
  <div
287
404
  className={cn(
288
- 'product_price_container'
405
+ 'product_price_container',
406
+ 'py-[30px]'
289
407
  )}
290
408
  >
291
409
  <p
292
410
  data-cy="ProductFullDetail-productPrice"
293
- className={classes.productPrice}
411
+ className={cn(
412
+ classes.productPrice,
413
+ 'text-[32px] font-semibold leading-[32px] mb-[15px]',
414
+ )}
294
415
  >
295
416
  <Price
296
417
  currencyCode={productDetails.price.currency}
297
418
  value={productDetails.price.value}
298
419
  />
299
420
  </p>
421
+ <small className='shipping-calculation-notes text-gray-200 text-xs'>
422
+ Shipping method is calculated on checkout
423
+ </small>
300
424
  </div>
425
+ <Divider />
301
426
  <FormError
302
427
  classes={{
303
428
  root: classes.formErrors
@@ -305,8 +430,8 @@ const ProductFullDetail = props => {
305
430
  errors={errors.get('form') || []}
306
431
  />
307
432
  <section className={classes.options}>{options}</section>
308
- <section className={classes.quantity}>
309
- <span
433
+ <section className={cn(classes.quantity, 'py-[30px] !border-none')}>
434
+ {/* <span
310
435
  data-cy="ProductFullDetail-quantityTitle"
311
436
  className={classes.quantityTitle}
312
437
  >
@@ -314,48 +439,115 @@ const ProductFullDetail = props => {
314
439
  id={'global.quantity'}
315
440
  defaultMessage={'Quantity'}
316
441
  />
317
- </span>
442
+ </span> */}
318
443
  <QuantityStepper
319
- classes={{ root: classes.quantityRoot }}
320
444
  min={1}
321
445
  message={errors.get('quantity')}
322
446
  />
447
+
448
+ <div className='product_shipping-information mb-[30px] leading-[18px] mt-[25px]'>
449
+ <div className='text-xs'>
450
+ Shiping From <span className='font-semibold'>Singapore</span>
451
+ </div>
452
+ <div className='text-xs'>
453
+ Shiping To <span className='font-semibold'>Yishun</span>
454
+ </div>
455
+ <div className='text-xs'>
456
+ Shiping Method <span className='font-semibold'>Store Pick Up | Meet Up</span>
457
+ </div>
458
+ </div>
459
+
460
+ <div className='product_actions-wrapper'>
461
+ {cartActionContent}
462
+ </div>
323
463
  </section>
324
- <section className={classes.actions}>
325
- {cartActionContent}
326
- <Suspense fallback={null}>
327
- <WishlistButton {...wishlistButtonProps} />
328
- </Suspense>
464
+ <Divider />
465
+ <section className='product_from-other-platform py-[30px]'>
466
+ <div className='text-sm flex mb-5'>
467
+ Also available in
468
+ </div>
469
+ <div className='platform-container flex gap-x-2.5'>
470
+ <Link
471
+ className='platform_logo-wrapper rounded-md px-5 py-2.5 border border-gray-100 flex items-center'
472
+ to=""
473
+ >
474
+ <img
475
+ alt="tokopedia"
476
+ width={60}
477
+ height={30}
478
+ src={'https://upload.wikimedia.org/wikipedia/commons/a/a7/Tokopedia.svg'}
479
+ />
480
+ </Link>
481
+ <Link
482
+ className='platform_logo-wrapper rounded-md px-5 py-2.5 border border-gray-100 flex items-center'
483
+ to=""
484
+ >
485
+ <img
486
+ alt="shopee"
487
+ width={60}
488
+ height={30}
489
+ src={'https://upload.wikimedia.org/wikipedia/commons/f/fe/Shopee.svg'}
490
+ />
491
+ </Link>
492
+ </div>
329
493
  </section>
494
+ <Divider />
495
+ <section className='seller-information py-[30px]'>
496
+ <div className='flex xs_flex-col md_flex-row xs_items-center md_items-start items-start gap-[15px] relative'>
497
+ <div className='flex flex-row justify-between relative w-full'>
498
+ <div className='flex flex-col xs_items-center md_items-start gap-[6px] relative'>
499
+ <div className="gap-x-[10px] gap-y-1 flex xs_flex-col md_flex-row xs_items-center md_items-start relative">
500
+ <div className="text-sm">
501
+ Good Smile
502
+ </div>
503
+ <div className="flex items-center relative">
504
+ <Verify variant='Bold' color='#4E31DB' size={20} />
505
+ </div>
506
+ </div>
507
+ <div class="relative w-fit font-normal text-[#999999] text-[12px] tracking-[0] leading-[14px] whitespace-nowrap">
508
+ Jurong West
509
+ </div>
510
+ </div>
511
+ <div className='flex flex-wrap items-start gap-4 relative'>
512
+ <button class="flex items-center justify-center gap-[5px] py-1 px-5 relative bg-white rounded-[30px] border border-solid border-[#6243fa]">
513
+ <div class="flex items-center justify-center gap-[10px] relative">
514
+ <Sms color="#6243FA" size={14} variant="Outline" className='stroke-[#6243FA]' />
515
+ <div class="relative xs_hidden lg_flex w-fit font-medium text-[#6243fa] text-[14px] tracking-[0] leading-[20px] whitespace-nowrap">
516
+ Message
517
+ </div>
518
+ </div>
519
+ </button>
520
+ <button class="flex items-center justify-center gap-[5px] py-1 px-5 relative bg-[#280135] rounded-[30px] border border-solid border-[#280135]">
521
+ <div class="flex items-center justify-center gap-[10px] relative">
522
+ <Message color='#FFFFFF' size={14} variant="Outline" className='stroke-[#FFFFFF]' />
523
+ <div class="relative xs_hidden lg_flex w-fit font-medium text-[#fff] text-[14px] tracking-[0] leading-[20px] whitespace-nowrap">
524
+ Chat With Seller
525
+ </div>
526
+ </div>
527
+ </button>
528
+ <button class="flex items-center justify-center gap-[5px] py-1 px-5 relative bg-white rounded-[30px] border border-solid border-[#6243fa]">
529
+ <div class="flex items-center justify-center gap-[10px] relative">
530
+ <Shop color="#6243FA" size={14} variant="Outline" className='stroke-[#6243FA]' />
531
+ <div class="relative xs_hidden lg_flex w-fit font-medium text-[#6243fa] text-[14px] tracking-[0] leading-[20px] whitespace-nowrap">
532
+ Visit Store
533
+ </div>
534
+ </div>
535
+ </button>
536
+ </div>
537
+ </div>
538
+ </div>
539
+ </section>
540
+ <Divider />
330
541
  </section>
331
- <section className={classes.description}>
332
- <span
333
- data-cy="ProductFullDetail-descriptionTitle"
334
- className={classes.descriptionTitle}
335
- >
336
- <FormattedMessage
337
- id={'productFullDetail.description'}
338
- defaultMessage={'Description'}
339
- />
340
- </span>
341
- <RichContent html={productDetails.description} />
342
- </section>
343
- <section className={classes.details}>
344
- <span
345
- data-cy="ProductFullDetail-detailsTitle"
346
- className={classes.detailsTitle}
347
- >
348
- <FormattedMessage
349
- id={'productFullDetail.details'}
350
- defaultMessage={'Details'}
351
- />
352
- </span>
353
- <CustomAttributes
354
- customAttributes={customAttributesDetails.list}
355
- />
356
- </section>
357
- {pageBuilderAttributes}
358
542
  </Form>
543
+ <section className='section_product-details-container my-8'>
544
+ <Tabs
545
+ data={dataTabs}
546
+ tabContentWrapperClassName='!p-0'
547
+ hasContent
548
+ tabWrapperClassName='xl_gap-x-[60px] justify-center'
549
+ />
550
+ </section>
359
551
  </Fragment>
360
552
  );
361
553
  };
@@ -2,7 +2,7 @@
2
2
  composes: lg_grid from global;
3
3
  composes: lg_grid-flow-row from global;
4
4
  composes: lg_items-start from global;
5
- composes: gap-x-5 from global;
5
+ composes: gap-x-10 from global;
6
6
  }
7
7
 
8
8
  @media (min-width: 1024px) {
@@ -25,10 +25,6 @@
25
25
  composes: border-r-0 from global;
26
26
  composes: border-b from global;
27
27
  composes: border-l-0 from global;
28
- composes: my-0 from global;
29
- composes: mx-sm from global;
30
- composes: px-0 from global;
31
- composes: py-xs from global;
32
28
  }
33
29
 
34
30
  .sectionTitle {
@@ -8,6 +8,7 @@ import Icon from '@magento/venia-ui/lib/components/Icon';
8
8
  import TextInput from '../TextInput';
9
9
  import { Message } from '@magento/venia-ui/lib/components/Field';
10
10
  import defaultClasses from './quantityStepper.module.css';
11
+ import cn from 'classnames';
11
12
 
12
13
  const QuantityStepper = props => {
13
14
  const { initialValue, itemId, label, min, onChange, message } = props;
@@ -34,7 +35,13 @@ const QuantityStepper = props => {
34
35
 
35
36
  return (
36
37
  <Fragment>
37
- <div className={classes.root}>
38
+ <div
39
+ className={cn(
40
+ classes.root,
41
+ 'flex w-fit border border-gray-100 rounded-md',
42
+ ''
43
+ )}
44
+ >
38
45
  <label className={classes.label} htmlFor={itemId}>
39
46
  {label}
40
47
  </label>
@@ -43,7 +50,10 @@ const QuantityStepper = props => {
43
50
  id: 'quantity.buttonDecrement',
44
51
  defaultMessage: 'Decrease Quantity'
45
52
  })}
46
- className={classes.button_decrement}
53
+ className={cn(
54
+ classes.button_decrement,
55
+ '!h-full min-w-[40px] min-h-[40px]'
56
+ )}
47
57
  disabled={isDecrementDisabled}
48
58
  onClick={handleDecrement}
49
59
  type="button"
@@ -57,7 +67,13 @@ const QuantityStepper = props => {
57
67
  defaultMessage: 'Item Quantity'
58
68
  })}
59
69
  data-cy="QuantityStepper-input"
60
- classes={{ input: classes.input }}
70
+ classes={{
71
+ input: cn(
72
+ classes.input,
73
+ '!border max-w-[60px] focus_shadow-none focus_outline-[1px]',
74
+ '!border-t-0 !border-b-0 !rounded-none !border-gray-100'
75
+ )
76
+ }}
61
77
  field="quantity"
62
78
  id={itemId}
63
79
  inputMode="numeric"
@@ -71,7 +87,10 @@ const QuantityStepper = props => {
71
87
  id: 'quantity.buttonIncrement',
72
88
  defaultMessage: 'Increase Quantity'
73
89
  })}
74
- className={classes.button_increment}
90
+ className={cn(
91
+ classes.button_increment,
92
+ '!h-full min-w-[40px] min-h-[40px]'
93
+ )}
75
94
  disabled={isIncrementDisabled}
76
95
  onClick={handleIncrement}
77
96
  type="button"
@@ -1,12 +1,12 @@
1
1
  .root {
2
- --stroke: var(--venia-global-color-gray-600);
2
+ /* --stroke: var(--venia-global-color-gray-600);
3
3
 
4
4
  composes: gap-x-2xs from global;
5
5
  composes: grid from global;
6
6
  composes: items-center from global;
7
7
  composes: justify-items-center from global;
8
8
  composes: text-center from global;
9
- grid-template-columns: 1fr 4rem 1fr;
9
+ grid-template-columns: 1fr 4rem 1fr; */
10
10
  }
11
11
 
12
12
  .wrap {
@@ -29,9 +29,6 @@
29
29
 
30
30
  .button {
31
31
  composes: bg-white from global;
32
- composes: border-2 from global;
33
- composes: border-solid from global;
34
- composes: border-button from global;
35
32
  composes: h-[2rem] from global;
36
33
  composes: inline-flex from global;
37
34
  composes: items-center from global;
@@ -73,6 +70,5 @@
73
70
 
74
71
  .input {
75
72
  composes: input from '../TextInput/textInput.module.css';
76
-
77
73
  composes: text-center from global;
78
- }
74
+ }
@@ -0,0 +1 @@
1
+ export { default } from './richText';
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+
3
+ import { useStyle } from '@magento/venia-ui/lib/classify';
4
+ import defaultClasses from './richText.module.css';
5
+ import cn from 'classnames';
6
+
7
+ const toHTML = str => ({ __html: str });
8
+
9
+ const RichText = (props) => {
10
+ const { content, rootClassName } = props;
11
+ const classes = useStyle(defaultClasses, props.classes);
12
+
13
+ return (
14
+ <div
15
+ className={cn(classes.root, rootClassName)}
16
+ dangerouslySetInnerHTML={toHTML(content)}
17
+ />
18
+ );
19
+ };
20
+
21
+ export default RichText;
@@ -0,0 +1,19 @@
1
+ .root {
2
+ composes: leading-tight from global;
3
+ composes: px-2xs from global;
4
+ composes: py-0 from global;
5
+ composes: text-sm from global;
6
+ }
7
+
8
+ /* TODO @TW: cannot compose */
9
+ .root p {
10
+ margin: 0 0 1rem;
11
+ }
12
+
13
+ /* TODO @TW: cannot compose */
14
+ .root ul {
15
+ /* composes: list-disc from global; */
16
+ list-style-type: disc;
17
+ margin: 0 0 1rem;
18
+ padding-left: 2.5rem;
19
+ }
@@ -0,0 +1,27 @@
1
+ import { gql } from '@apollo/client';
2
+
3
+ export const GET_STORE_CONFIG_DATA = gql`
4
+ query getStoreConfigData {
5
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
6
+ storeConfig {
7
+ store_code
8
+ product_url_suffix
9
+ }
10
+ }
11
+ `;
12
+
13
+ export const GET_COLLECTIBLE_GAME_QUERY = gql`
14
+ query getCollectibleGameSets($categoryUrlKey: String!) {
15
+ collectibleGameSets(categoryUrlKey: $categoryUrlKey) {
16
+ card_set
17
+ card_game
18
+ card_set_abbreviation
19
+ card_release_year
20
+ }
21
+ }
22
+ `;
23
+
24
+ export default {
25
+ getStoreConfigData: GET_STORE_CONFIG_DATA,
26
+ getCollectibleGameQuery: GET_COLLECTIBLE_GAME_QUERY
27
+ };
@@ -0,0 +1,65 @@
1
+ import { useQuery } from '@apollo/client';
2
+ import { useEffect, useMemo } from 'react';
3
+ import { useLocation } from 'react-router-dom';
4
+ import { useAppContext } from '@magento/peregrine/lib/context/app';
5
+
6
+ import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
7
+ import DEFAULT_OPERATIONS from './collectibleGameSets.gql';
8
+
9
+ export const useCollectibleGameSets = props => {
10
+
11
+ const operations = mergeOperations(DEFAULT_OPERATIONS, null);
12
+ const { getStoreConfigData, getCollectibleGameQuery } = operations;
13
+ const { pathname } = useLocation();
14
+ const [
15
+ ,
16
+ {
17
+ actions: { setPageLoading }
18
+ }
19
+ ] = useAppContext();
20
+
21
+ const { data: storeConfigData } = useQuery(getStoreConfigData, {
22
+ fetchPolicy: 'cache-and-network',
23
+ nextFetchPolicy: 'cache-first'
24
+ });
25
+
26
+ const slug = pathname.split('/').pop();
27
+ const productUrlSuffix = storeConfigData?.storeConfig?.product_url_suffix;
28
+ const categoryUrlKey = productUrlSuffix ? slug.replace(productUrlSuffix, '') : slug;
29
+
30
+ const { error, loading, data } = useQuery(getCollectibleGameQuery, {
31
+ fetchPolicy: 'cache-and-network',
32
+ nextFetchPolicy: 'cache-first',
33
+ skip: !storeConfigData,
34
+ variables: {
35
+ categoryUrlKey
36
+ }
37
+ });
38
+
39
+ const isBackgroundLoading = !!data && loading;
40
+
41
+ const collectibleGameSets = useMemo(() => {
42
+ if (!data) {
43
+ return null;
44
+ }
45
+
46
+ const collectibleGameSets = data.collectibleGameSets;
47
+
48
+ if (!collectibleGameSets) {
49
+ return null;
50
+ }
51
+
52
+ return collectibleGameSets;
53
+ }, [data, categoryUrlKey]);
54
+
55
+ // Update the page indicator if the GraphQL query is in flight.
56
+ useEffect(() => {
57
+ setPageLoading(isBackgroundLoading);
58
+ }, [isBackgroundLoading, setPageLoading]);
59
+
60
+ return {
61
+ error,
62
+ loading,
63
+ collectibleGameSets
64
+ };
65
+ };
package/src/theme/vars.js CHANGED
@@ -6,6 +6,7 @@ export const orange = '#F7C317';
6
6
  export const gray100 = '#B9AEC5';
7
7
  export const gray600 = '#1BA387';
8
8
  export const gray700 = '#999999';
9
+ export const primary900 = "#292D32";
9
10
 
10
11
  export default {
11
12
  textPrimary,
@@ -16,4 +17,5 @@ export default {
16
17
  gray100,
17
18
  gray600,
18
19
  gray700,
20
+ primary900,
19
21
  }