@gem-sdk/components 2.0.0-dev.260 → 2.0.0-dev.265

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 (112) hide show
  1. package/dist/cjs/banner/components/HeroBannerItem.liquid.js +3 -2
  2. package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +3 -2
  3. package/dist/cjs/grid/row/setting/configs/settings.js +9 -83
  4. package/dist/cjs/grid/section/setting/configs/settings.js +13 -75
  5. package/dist/cjs/icon/setting/configs/uiV2.js +1 -1
  6. package/dist/cjs/icon-list-hoz/setting/configs/settings.js +4 -17
  7. package/dist/cjs/line/setting/configs/settings.js +4 -4
  8. package/dist/cjs/post-purchase/advanced-list/setting/configs/uiV2.js +3 -15
  9. package/dist/cjs/post-purchase/line/setting/configs/settings.js +3 -1
  10. package/dist/cjs/post-purchase/line/setting/configs/uiV2.js +2 -1
  11. package/dist/cjs/post-purchase/link/components/PostPurchaseLink.js +23 -14
  12. package/dist/cjs/post-purchase/link/components/common/getClasses.js +7 -1
  13. package/dist/cjs/post-purchase/link/setting/configs/settings.js +21 -14
  14. package/dist/cjs/post-purchase/product/common/getClasses.js +45 -0
  15. package/dist/cjs/post-purchase/product/common/getStyles.js +43 -0
  16. package/dist/cjs/post-purchase/product/components/product-image/FeatureImage.js +32 -42
  17. package/dist/cjs/post-purchase/product/components/product-image/ImageListCarousel.js +6 -65
  18. package/dist/cjs/post-purchase/product/components/product-image/ImageListGrid.js +24 -68
  19. package/dist/cjs/post-purchase/product/components/product-image/ItemCarouselPostPurchase.js +42 -0
  20. package/dist/cjs/post-purchase/product/components/product-image/ItemGridPostPurchase.js +42 -0
  21. package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/Arrow.js +29 -0
  22. package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchase.js +35 -0
  23. package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchaseContext.js +22 -0
  24. package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +75 -0
  25. package/dist/cjs/post-purchase/product/components/product-image/index.js +41 -43
  26. package/dist/cjs/post-purchase/product/components/product-image/layouts/FeatureImageWithGalleryImage.js +22 -58
  27. package/dist/cjs/post-purchase/product/components/product-image/layouts/OnlyGalleryImage.js +19 -12
  28. package/dist/cjs/post-purchase/product/constants/index.js +36 -0
  29. package/dist/cjs/post-purchase/product/hooks/product-image/useCarousel.js +14 -0
  30. package/dist/cjs/post-purchase/product/hooks/product-image/useFeatureImagePostPurchase.js +32 -0
  31. package/dist/cjs/post-purchase/product/hooks/product-image/useListCarousel.js +43 -0
  32. package/dist/cjs/post-purchase/product/hooks/product-image/useNavigationCarouselPostPurchase.js +32 -0
  33. package/dist/cjs/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +60 -0
  34. package/dist/cjs/post-purchase/product/hooks/product-image/useSlideCarousel.js +35 -0
  35. package/dist/cjs/post-purchase/product/settings/product-description/settingV2.js +6 -9
  36. package/dist/cjs/post-purchase/product/settings/product-image/ProductFeatureImage.js +41 -0
  37. package/dist/cjs/post-purchase/product/settings/product-image/ProductGalleryImage.js +0 -118
  38. package/dist/cjs/post-purchase/product/settings/product-image/ProductImages.js +8 -79
  39. package/dist/cjs/post-purchase/product/settings/product-image/setting-v1.js +163 -0
  40. package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +375 -0
  41. package/dist/cjs/post-purchase/product/settings/product-image/uiV1.js +42 -0
  42. package/dist/cjs/post-purchase/product/settings/product-image/uiV2.js +235 -0
  43. package/dist/cjs/post-purchase/product/settings/product-price/uiV2.js +0 -3
  44. package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/settings.js +10 -6
  45. package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +2 -2
  46. package/dist/cjs/post-purchase/product/settings/product-quantity/configs/settings.js +3 -1
  47. package/dist/cjs/post-purchase/product/settings/product-title/settingV2.js +6 -9
  48. package/dist/cjs/post-purchase/text/settings/text/settingV2.js +0 -7
  49. package/dist/cjs/product/components/FileUpload/components/common/index.js +3 -2
  50. package/dist/cjs/product/setting/product/configs/presets.js +1 -1
  51. package/dist/cjs/product/setting/product/configs/settings.js +10 -75
  52. package/dist/cjs/setting.js +2 -1
  53. package/dist/cjs/text/setting/configs/settings.js +1 -1
  54. package/dist/esm/banner/components/HeroBannerItem.liquid.js +3 -2
  55. package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +3 -2
  56. package/dist/esm/grid/row/setting/configs/settings.js +9 -83
  57. package/dist/esm/grid/section/setting/configs/settings.js +13 -75
  58. package/dist/esm/icon/setting/configs/uiV2.js +1 -1
  59. package/dist/esm/icon-list-hoz/setting/configs/settings.js +4 -17
  60. package/dist/esm/line/setting/configs/settings.js +4 -4
  61. package/dist/esm/post-purchase/advanced-list/setting/configs/uiV2.js +3 -15
  62. package/dist/esm/post-purchase/line/setting/configs/settings.js +3 -1
  63. package/dist/esm/post-purchase/line/setting/configs/uiV2.js +2 -1
  64. package/dist/esm/post-purchase/link/components/PostPurchaseLink.js +25 -16
  65. package/dist/esm/post-purchase/link/components/common/getClasses.js +7 -2
  66. package/dist/esm/post-purchase/link/setting/configs/settings.js +21 -14
  67. package/dist/esm/post-purchase/product/common/getClasses.js +37 -1
  68. package/dist/esm/post-purchase/product/common/getStyles.js +39 -1
  69. package/dist/esm/post-purchase/product/components/product-image/FeatureImage.js +32 -42
  70. package/dist/esm/post-purchase/product/components/product-image/ImageListCarousel.js +7 -66
  71. package/dist/esm/post-purchase/product/components/product-image/ImageListGrid.js +24 -68
  72. package/dist/esm/post-purchase/product/components/product-image/ItemCarouselPostPurchase.js +40 -0
  73. package/dist/esm/post-purchase/product/components/product-image/ItemGridPostPurchase.js +40 -0
  74. package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/Arrow.js +27 -0
  75. package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchase.js +33 -0
  76. package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchaseContext.js +19 -0
  77. package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +73 -0
  78. package/dist/esm/post-purchase/product/components/product-image/index.js +42 -44
  79. package/dist/esm/post-purchase/product/components/product-image/layouts/FeatureImageWithGalleryImage.js +22 -58
  80. package/dist/esm/post-purchase/product/components/product-image/layouts/OnlyGalleryImage.js +19 -12
  81. package/dist/esm/post-purchase/product/constants/index.js +34 -0
  82. package/dist/esm/post-purchase/product/hooks/product-image/useCarousel.js +12 -0
  83. package/dist/esm/post-purchase/product/hooks/product-image/useFeatureImagePostPurchase.js +30 -0
  84. package/dist/esm/post-purchase/product/hooks/product-image/useListCarousel.js +41 -0
  85. package/dist/esm/post-purchase/product/hooks/product-image/useNavigationCarouselPostPurchase.js +30 -0
  86. package/dist/esm/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +58 -0
  87. package/dist/esm/post-purchase/product/hooks/product-image/useSlideCarousel.js +33 -0
  88. package/dist/esm/post-purchase/product/settings/product-description/settingV2.js +6 -9
  89. package/dist/esm/post-purchase/product/settings/product-image/ProductFeatureImage.js +41 -0
  90. package/dist/esm/post-purchase/product/settings/product-image/ProductGalleryImage.js +1 -118
  91. package/dist/esm/post-purchase/product/settings/product-image/ProductImages.js +8 -79
  92. package/dist/esm/post-purchase/product/settings/product-image/setting-v1.js +161 -0
  93. package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +373 -0
  94. package/dist/esm/post-purchase/product/settings/product-image/uiV1.js +40 -0
  95. package/dist/esm/post-purchase/product/settings/product-image/uiV2.js +233 -0
  96. package/dist/esm/post-purchase/product/settings/product-price/uiV2.js +0 -3
  97. package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/settings.js +10 -6
  98. package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +2 -2
  99. package/dist/esm/post-purchase/product/settings/product-quantity/configs/settings.js +3 -1
  100. package/dist/esm/post-purchase/product/settings/product-title/settingV2.js +6 -9
  101. package/dist/esm/post-purchase/text/settings/text/settingV2.js +0 -7
  102. package/dist/esm/product/components/FileUpload/components/common/index.js +3 -2
  103. package/dist/esm/product/setting/product/configs/presets.js +1 -1
  104. package/dist/esm/product/setting/product/configs/settings.js +10 -75
  105. package/dist/esm/setting.js +2 -1
  106. package/dist/esm/text/setting/configs/settings.js +1 -1
  107. package/dist/types/index.d.ts +12 -5
  108. package/package.json +4 -4
  109. package/dist/cjs/post-purchase/product/components/product-image/Arrow.js +0 -60
  110. package/dist/cjs/post-purchase/product/components/product-image/CarouselPostPurchase.js +0 -78
  111. package/dist/esm/post-purchase/product/components/product-image/Arrow.js +0 -58
  112. package/dist/esm/post-purchase/product/components/product-image/CarouselPostPurchase.js +0 -76
@@ -1373,7 +1373,7 @@ type FeatureImageSliderSetting = {
1373
1373
  ftDotGapToCarousel?: ObjectDevices<number>;
1374
1374
  };
1375
1375
  type FeatureImageSliderStyles = {};
1376
- type FeatureImageSetting$1 = {
1376
+ type FeatureImageSetting$2 = {
1377
1377
  ftClickOpenLightBox?: ObjectDevices<'none' | 'popup' | 'product-link'>;
1378
1378
  ftClickOpenNewTab?: boolean;
1379
1379
  hoverEffect?: 'zoom' | 'other' | 'none';
@@ -1431,7 +1431,7 @@ type GallerySetting$1 = {
1431
1431
  activeEffectEnable?: boolean;
1432
1432
  actionEnable?: ObjectDevices<boolean>;
1433
1433
  } & GallerySliderSetting$1;
1434
- type ProductImagesSetting$2 = GallerySetting$1 & FeatureImageSetting$1 & SelectDisplaySetting & {
1434
+ type ProductImagesSetting$2 = GallerySetting$1 & FeatureImageSetting$2 & SelectDisplaySetting & {
1435
1435
  qualityType?: ObjectDevices<QualityType>;
1436
1436
  qualityPercent?: ObjectDevices<number>;
1437
1437
  displayByVariant?: boolean;
@@ -1848,7 +1848,7 @@ type FeatureImageStyles = {
1848
1848
  width: string;
1849
1849
  }>;
1850
1850
  };
1851
- type FeatureImageSetting = {
1851
+ type FeatureImageSetting$1 = {
1852
1852
  featureImageVisible?: ObjectDevices<boolean>;
1853
1853
  clickEffect?: string;
1854
1854
  hoverEffect?: 'zoom' | 'other' | 'none';
@@ -1894,7 +1894,7 @@ type GallerySetting = {
1894
1894
  type?: ObjectDevices<string>;
1895
1895
  numberPerRow?: ObjectDevices<number>;
1896
1896
  } & GallerySliderSetting;
1897
- type ProductImagesSetting$1 = GallerySetting & FeatureImageSetting;
1897
+ type ProductImagesSetting$1 = GallerySetting & FeatureImageSetting$1;
1898
1898
  type ProductImagesStyles$1 = GalleryStyles & FeatureImageStyles;
1899
1899
  type ProductImagesProps = BasePropsWrap<ProductImagesSetting$1, ProductImagesStyles$1, Pick<NonNullable<ImageProps['styles']>, 'layout' | 'aspectRatio' | 'roundedImg' | 'customAspectRadio' | 'opacity'>> & {
1900
1900
  className?: string;
@@ -4841,6 +4841,13 @@ type FeatureImagStyle = {
4841
4841
  ftAspectRatio?: string;
4842
4842
  ftWidth?: ObjectDevices<string>;
4843
4843
  ftObjectFit?: ObjectFit;
4844
+ ftBorder: 'none' | 'display';
4845
+ ftNavigation: 'none' | 'display';
4846
+ ftSpacing: Spacing;
4847
+ };
4848
+ type FeatureImageSetting = {
4849
+ ftDisplayType: 'slider' | 'grid';
4850
+ ftItemPerSlide: number;
4844
4851
  };
4845
4852
  type ImageListSetting = {
4846
4853
  displayType: 'slider' | 'grid';
@@ -4862,7 +4869,7 @@ type ProductImageLayoutSettings = {
4862
4869
  ratioLayoutRight?: number[];
4863
4870
  };
4864
4871
  type ProductImagesLayout = 'bottom-center' | 'left' | 'right' | 'only-feature' | 'one-col' | 'two-col';
4865
- type ProductImagesSetting = ImageListSetting & ProductImageLayoutSettings;
4872
+ type ProductImagesSetting = ImageListSetting & ProductImageLayoutSettings & FeatureImageSetting;
4866
4873
  type ProductImagesStyles = ImageListStyle & FeatureImagStyle & {
4867
4874
  align?: 'left' | 'right' | 'center';
4868
4875
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.260",
3
+ "version": "2.0.0-dev.265",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -22,9 +22,9 @@
22
22
  "relationship": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/get-control-relationship.js && node ./scripts/get-element-relationship.js"
23
23
  },
24
24
  "devDependencies": {
25
- "@gem-sdk/core": "2.0.0-dev.257",
26
- "@gem-sdk/styles": "2.0.0-dev.234",
27
- "@gem-sdk/system": "2.0.0-dev.234",
25
+ "@gem-sdk/core": "2.0.0-dev.264",
26
+ "@gem-sdk/styles": "2.0.0-dev.263",
27
+ "@gem-sdk/system": "2.0.0-dev.263",
28
28
  "@types/react-transition-group": "^4.4.5"
29
29
  },
30
30
  "dependencies": {
@@ -1,60 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var React = require('react');
6
-
7
- const NEXT_AND_PREV_URLS = {
8
- PREVIOUS: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a2eb5093-0203-4973-8ade-183d5bdefdce.svg',
9
- NEXT: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a5ac0286-5941-4bd7-a21d-72a6c017aeea.svg',
10
- NEXT_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a3d1f159-001d-4301-bead-214606caf995.svg',
11
- PREVIOUS_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-33e3810b-a94c-40a1-a48b-4eba39013f15.svg',
12
- VERTICAL_PREVIOUS: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-4e4e886a-5aa1-4bb3-ab48-aa7752fd5eba.svg',
13
- VERTICAL_NEXT: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a3c3d74c-2cde-49e5-9854-8079f5239013.svg',
14
- VERTICAL_NEXT_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-6c7f10a8-a205-43bd-b39c-aab044bb3771.svg',
15
- VERTICAL_PREVIOUS_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-010c3c2a-fcc3-4b09-84a2-734d924ad49b.svg'
16
- };
17
- const ArrowPostPurchase = (props)=>{
18
- const { moveToIdx, setMoveToIdx, type, navigation, maxIdx, vertical, layoutType } = props;
19
- const disabled = type == 'next' ? moveToIdx >= maxIdx : moveToIdx === 0;
20
- const imgSrc = React.useMemo(()=>{
21
- let temp = '';
22
- if (type === 'next') {
23
- if (vertical) {
24
- if (disabled) temp = NEXT_AND_PREV_URLS.VERTICAL_NEXT_DISABLED;
25
- else temp = NEXT_AND_PREV_URLS.VERTICAL_NEXT;
26
- } else {
27
- if (disabled) temp = NEXT_AND_PREV_URLS.NEXT_DISABLED;
28
- else temp = NEXT_AND_PREV_URLS.NEXT;
29
- }
30
- } else {
31
- if (vertical) {
32
- if (disabled) temp = NEXT_AND_PREV_URLS.VERTICAL_PREVIOUS_DISABLED;
33
- else temp = NEXT_AND_PREV_URLS.VERTICAL_PREVIOUS;
34
- } else {
35
- if (disabled) temp = NEXT_AND_PREV_URLS.PREVIOUS_DISABLED;
36
- else temp = NEXT_AND_PREV_URLS.PREVIOUS;
37
- }
38
- }
39
- return temp;
40
- }, [
41
- type,
42
- vertical,
43
- disabled
44
- ]);
45
- if (navigation === 'none' || layoutType === 'one-col') return null;
46
- return /*#__PURE__*/ jsxRuntime.jsx("button", {
47
- className: `gp-w-[24px] gp-h-[24px] gp-shrink-0 gp-flex gp-items-center gp-justify-center`,
48
- disabled: disabled,
49
- onClick: ()=>{
50
- if (type === 'next') setMoveToIdx(moveToIdx + 1);
51
- else setMoveToIdx(moveToIdx - 1);
52
- },
53
- children: /*#__PURE__*/ jsxRuntime.jsx("img", {
54
- src: imgSrc,
55
- alt: `gp-arrow-${type}`
56
- })
57
- });
58
- };
59
-
60
- exports.ArrowPostPurchase = ArrowPostPurchase;
@@ -1,78 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var core = require('@gem-sdk/core');
6
- var Image = require('../../../image/components/Image.js');
7
- var React = require('react');
8
-
9
- const CarouselPostPurchase = (props)=>{
10
- const { productImages, moveToIdx, itemPerRow, ilBorder, ilAspectRatio, ilObjectFit } = props;
11
- const featuredImageGlobal = core.useFeaturedImageGlobal();
12
- const setProductFeaturedImage = core.useProductStore((s)=>s.setProductFeaturedImage);
13
- const list = React.useCallback(()=>{
14
- const temp = [
15
- ...productImages
16
- ];
17
- return temp?.splice(moveToIdx, itemPerRow);
18
- }, [
19
- productImages,
20
- itemPerRow,
21
- moveToIdx
22
- ]);
23
- const listRender = React.useMemo(()=>{
24
- const listItem = list();
25
- if (listItem.length < itemPerRow) {
26
- const temp = [
27
- ...productImages
28
- ];
29
- Array.from({
30
- length: itemPerRow - listItem.length
31
- }).forEach(()=>{
32
- temp.push(null);
33
- });
34
- return temp;
35
- }
36
- return listItem;
37
- }, [
38
- list,
39
- itemPerRow,
40
- productImages
41
- ]);
42
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
43
- children: listRender?.map((image, index)=>{
44
- if (!image) {
45
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
46
- className: "gp-w-full"
47
- }, index);
48
- }
49
- const source = {
50
- src: image.src || 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif',
51
- alt: ''
52
- };
53
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
54
- "aria-hidden": "true",
55
- className: `gp-w-full gp-border ${image?.id === featuredImageGlobal?.id && ilBorder !== 'none' ? '!gp-border-[#d9d9d9]' : 'gp-border-transparent'}`,
56
- onClick: ()=>{
57
- setProductFeaturedImage(image);
58
- },
59
- children: /*#__PURE__*/ jsxRuntime.jsx(Image.default, {
60
- setting: {
61
- srcSet: {
62
- desktop: source,
63
- mobile: source,
64
- tablet: source
65
- }
66
- },
67
- styles: {
68
- aspectRatio: ilAspectRatio,
69
- objectFit: ilObjectFit,
70
- enableBorder: 'none'
71
- }
72
- }, image?.src)
73
- }, image.id);
74
- })
75
- });
76
- };
77
-
78
- exports.CarouselPostPurchase = CarouselPostPurchase;
@@ -1,58 +0,0 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { useMemo } from 'react';
4
-
5
- const NEXT_AND_PREV_URLS = {
6
- PREVIOUS: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a2eb5093-0203-4973-8ade-183d5bdefdce.svg',
7
- NEXT: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a5ac0286-5941-4bd7-a21d-72a6c017aeea.svg',
8
- NEXT_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a3d1f159-001d-4301-bead-214606caf995.svg',
9
- PREVIOUS_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-33e3810b-a94c-40a1-a48b-4eba39013f15.svg',
10
- VERTICAL_PREVIOUS: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-4e4e886a-5aa1-4bb3-ab48-aa7752fd5eba.svg',
11
- VERTICAL_NEXT: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a3c3d74c-2cde-49e5-9854-8079f5239013.svg',
12
- VERTICAL_NEXT_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-6c7f10a8-a205-43bd-b39c-aab044bb3771.svg',
13
- VERTICAL_PREVIOUS_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-010c3c2a-fcc3-4b09-84a2-734d924ad49b.svg'
14
- };
15
- const ArrowPostPurchase = (props)=>{
16
- const { moveToIdx, setMoveToIdx, type, navigation, maxIdx, vertical, layoutType } = props;
17
- const disabled = type == 'next' ? moveToIdx >= maxIdx : moveToIdx === 0;
18
- const imgSrc = useMemo(()=>{
19
- let temp = '';
20
- if (type === 'next') {
21
- if (vertical) {
22
- if (disabled) temp = NEXT_AND_PREV_URLS.VERTICAL_NEXT_DISABLED;
23
- else temp = NEXT_AND_PREV_URLS.VERTICAL_NEXT;
24
- } else {
25
- if (disabled) temp = NEXT_AND_PREV_URLS.NEXT_DISABLED;
26
- else temp = NEXT_AND_PREV_URLS.NEXT;
27
- }
28
- } else {
29
- if (vertical) {
30
- if (disabled) temp = NEXT_AND_PREV_URLS.VERTICAL_PREVIOUS_DISABLED;
31
- else temp = NEXT_AND_PREV_URLS.VERTICAL_PREVIOUS;
32
- } else {
33
- if (disabled) temp = NEXT_AND_PREV_URLS.PREVIOUS_DISABLED;
34
- else temp = NEXT_AND_PREV_URLS.PREVIOUS;
35
- }
36
- }
37
- return temp;
38
- }, [
39
- type,
40
- vertical,
41
- disabled
42
- ]);
43
- if (navigation === 'none' || layoutType === 'one-col') return null;
44
- return /*#__PURE__*/ jsx("button", {
45
- className: `gp-w-[24px] gp-h-[24px] gp-shrink-0 gp-flex gp-items-center gp-justify-center`,
46
- disabled: disabled,
47
- onClick: ()=>{
48
- if (type === 'next') setMoveToIdx(moveToIdx + 1);
49
- else setMoveToIdx(moveToIdx - 1);
50
- },
51
- children: /*#__PURE__*/ jsx("img", {
52
- src: imgSrc,
53
- alt: `gp-arrow-${type}`
54
- })
55
- });
56
- };
57
-
58
- export { ArrowPostPurchase };
@@ -1,76 +0,0 @@
1
- 'use client';
2
- import { jsx, Fragment } from 'react/jsx-runtime';
3
- import { useFeaturedImageGlobal, useProductStore } from '@gem-sdk/core';
4
- import PostPurchaseImage from '../../../image/components/Image.js';
5
- import { useCallback, useMemo } from 'react';
6
-
7
- const CarouselPostPurchase = (props)=>{
8
- const { productImages, moveToIdx, itemPerRow, ilBorder, ilAspectRatio, ilObjectFit } = props;
9
- const featuredImageGlobal = useFeaturedImageGlobal();
10
- const setProductFeaturedImage = useProductStore((s)=>s.setProductFeaturedImage);
11
- const list = useCallback(()=>{
12
- const temp = [
13
- ...productImages
14
- ];
15
- return temp?.splice(moveToIdx, itemPerRow);
16
- }, [
17
- productImages,
18
- itemPerRow,
19
- moveToIdx
20
- ]);
21
- const listRender = useMemo(()=>{
22
- const listItem = list();
23
- if (listItem.length < itemPerRow) {
24
- const temp = [
25
- ...productImages
26
- ];
27
- Array.from({
28
- length: itemPerRow - listItem.length
29
- }).forEach(()=>{
30
- temp.push(null);
31
- });
32
- return temp;
33
- }
34
- return listItem;
35
- }, [
36
- list,
37
- itemPerRow,
38
- productImages
39
- ]);
40
- return /*#__PURE__*/ jsx(Fragment, {
41
- children: listRender?.map((image, index)=>{
42
- if (!image) {
43
- return /*#__PURE__*/ jsx("div", {
44
- className: "gp-w-full"
45
- }, index);
46
- }
47
- const source = {
48
- src: image.src || 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif',
49
- alt: ''
50
- };
51
- return /*#__PURE__*/ jsx("div", {
52
- "aria-hidden": "true",
53
- className: `gp-w-full gp-border ${image?.id === featuredImageGlobal?.id && ilBorder !== 'none' ? '!gp-border-[#d9d9d9]' : 'gp-border-transparent'}`,
54
- onClick: ()=>{
55
- setProductFeaturedImage(image);
56
- },
57
- children: /*#__PURE__*/ jsx(PostPurchaseImage, {
58
- setting: {
59
- srcSet: {
60
- desktop: source,
61
- mobile: source,
62
- tablet: source
63
- }
64
- },
65
- styles: {
66
- aspectRatio: ilAspectRatio,
67
- objectFit: ilObjectFit,
68
- enableBorder: 'none'
69
- }
70
- }, image?.src)
71
- }, image.id);
72
- })
73
- });
74
- };
75
-
76
- export { CarouselPostPurchase };