@gem-sdk/components 2.0.0-dev.261 → 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.
- package/dist/cjs/banner/components/HeroBannerItem.liquid.js +3 -2
- package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +3 -2
- package/dist/cjs/grid/row/setting/configs/settings.js +9 -83
- package/dist/cjs/grid/section/setting/configs/settings.js +13 -75
- package/dist/cjs/icon-list-hoz/setting/configs/settings.js +4 -17
- package/dist/cjs/post-purchase/advanced-list/setting/configs/uiV2.js +3 -15
- package/dist/cjs/post-purchase/line/setting/configs/settings.js +3 -1
- package/dist/cjs/post-purchase/line/setting/configs/uiV2.js +2 -1
- package/dist/cjs/post-purchase/link/components/PostPurchaseLink.js +23 -14
- package/dist/cjs/post-purchase/link/components/common/getClasses.js +7 -1
- package/dist/cjs/post-purchase/link/setting/configs/settings.js +21 -14
- package/dist/cjs/post-purchase/product/common/getClasses.js +45 -0
- package/dist/cjs/post-purchase/product/common/getStyles.js +43 -0
- package/dist/cjs/post-purchase/product/components/product-image/FeatureImage.js +32 -42
- package/dist/cjs/post-purchase/product/components/product-image/ImageListCarousel.js +6 -65
- package/dist/cjs/post-purchase/product/components/product-image/ImageListGrid.js +24 -68
- package/dist/cjs/post-purchase/product/components/product-image/ItemCarouselPostPurchase.js +42 -0
- package/dist/cjs/post-purchase/product/components/product-image/ItemGridPostPurchase.js +42 -0
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/Arrow.js +29 -0
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchase.js +35 -0
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchaseContext.js +22 -0
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +75 -0
- package/dist/cjs/post-purchase/product/components/product-image/index.js +41 -43
- package/dist/cjs/post-purchase/product/components/product-image/layouts/FeatureImageWithGalleryImage.js +22 -58
- package/dist/cjs/post-purchase/product/components/product-image/layouts/OnlyGalleryImage.js +19 -12
- package/dist/cjs/post-purchase/product/constants/index.js +36 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useCarousel.js +14 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useFeatureImagePostPurchase.js +32 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useListCarousel.js +43 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useNavigationCarouselPostPurchase.js +32 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +60 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useSlideCarousel.js +35 -0
- package/dist/cjs/post-purchase/product/settings/product-description/settingV2.js +6 -9
- package/dist/cjs/post-purchase/product/settings/product-image/ProductFeatureImage.js +41 -0
- package/dist/cjs/post-purchase/product/settings/product-image/ProductGalleryImage.js +0 -118
- package/dist/cjs/post-purchase/product/settings/product-image/ProductImages.js +8 -79
- package/dist/cjs/post-purchase/product/settings/product-image/setting-v1.js +163 -0
- package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +375 -0
- package/dist/cjs/post-purchase/product/settings/product-image/uiV1.js +42 -0
- package/dist/cjs/post-purchase/product/settings/product-image/uiV2.js +235 -0
- package/dist/cjs/post-purchase/product/settings/product-price/uiV2.js +0 -3
- package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/settings.js +10 -6
- package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +2 -2
- package/dist/cjs/post-purchase/product/settings/product-quantity/configs/settings.js +3 -1
- package/dist/cjs/post-purchase/product/settings/product-title/settingV2.js +6 -9
- package/dist/cjs/post-purchase/text/settings/text/settingV2.js +0 -7
- package/dist/cjs/product/components/FileUpload/components/common/index.js +3 -2
- package/dist/cjs/product/setting/product/configs/presets.js +1 -1
- package/dist/cjs/product/setting/product/configs/settings.js +4 -20
- package/dist/cjs/setting.js +2 -1
- package/dist/esm/banner/components/HeroBannerItem.liquid.js +3 -2
- package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +3 -2
- package/dist/esm/grid/row/setting/configs/settings.js +9 -83
- package/dist/esm/grid/section/setting/configs/settings.js +13 -75
- package/dist/esm/icon-list-hoz/setting/configs/settings.js +4 -17
- package/dist/esm/post-purchase/advanced-list/setting/configs/uiV2.js +3 -15
- package/dist/esm/post-purchase/line/setting/configs/settings.js +3 -1
- package/dist/esm/post-purchase/line/setting/configs/uiV2.js +2 -1
- package/dist/esm/post-purchase/link/components/PostPurchaseLink.js +25 -16
- package/dist/esm/post-purchase/link/components/common/getClasses.js +7 -2
- package/dist/esm/post-purchase/link/setting/configs/settings.js +21 -14
- package/dist/esm/post-purchase/product/common/getClasses.js +37 -1
- package/dist/esm/post-purchase/product/common/getStyles.js +39 -1
- package/dist/esm/post-purchase/product/components/product-image/FeatureImage.js +32 -42
- package/dist/esm/post-purchase/product/components/product-image/ImageListCarousel.js +7 -66
- package/dist/esm/post-purchase/product/components/product-image/ImageListGrid.js +24 -68
- package/dist/esm/post-purchase/product/components/product-image/ItemCarouselPostPurchase.js +40 -0
- package/dist/esm/post-purchase/product/components/product-image/ItemGridPostPurchase.js +40 -0
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/Arrow.js +27 -0
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchase.js +33 -0
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchaseContext.js +19 -0
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +73 -0
- package/dist/esm/post-purchase/product/components/product-image/index.js +42 -44
- package/dist/esm/post-purchase/product/components/product-image/layouts/FeatureImageWithGalleryImage.js +22 -58
- package/dist/esm/post-purchase/product/components/product-image/layouts/OnlyGalleryImage.js +19 -12
- package/dist/esm/post-purchase/product/constants/index.js +34 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useCarousel.js +12 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useFeatureImagePostPurchase.js +30 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useListCarousel.js +41 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useNavigationCarouselPostPurchase.js +30 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +58 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useSlideCarousel.js +33 -0
- package/dist/esm/post-purchase/product/settings/product-description/settingV2.js +6 -9
- package/dist/esm/post-purchase/product/settings/product-image/ProductFeatureImage.js +41 -0
- package/dist/esm/post-purchase/product/settings/product-image/ProductGalleryImage.js +1 -118
- package/dist/esm/post-purchase/product/settings/product-image/ProductImages.js +8 -79
- package/dist/esm/post-purchase/product/settings/product-image/setting-v1.js +161 -0
- package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +373 -0
- package/dist/esm/post-purchase/product/settings/product-image/uiV1.js +40 -0
- package/dist/esm/post-purchase/product/settings/product-image/uiV2.js +233 -0
- package/dist/esm/post-purchase/product/settings/product-price/uiV2.js +0 -3
- package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/settings.js +10 -6
- package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +2 -2
- package/dist/esm/post-purchase/product/settings/product-quantity/configs/settings.js +3 -1
- package/dist/esm/post-purchase/product/settings/product-title/settingV2.js +6 -9
- package/dist/esm/post-purchase/text/settings/text/settingV2.js +0 -7
- package/dist/esm/product/components/FileUpload/components/common/index.js +3 -2
- package/dist/esm/product/setting/product/configs/presets.js +1 -1
- package/dist/esm/product/setting/product/configs/settings.js +4 -20
- package/dist/esm/setting.js +2 -1
- package/dist/types/index.d.ts +12 -5
- package/package.json +4 -4
- package/dist/cjs/post-purchase/product/components/product-image/Arrow.js +0 -60
- package/dist/cjs/post-purchase/product/components/product-image/CarouselPostPurchase.js +0 -78
- package/dist/esm/post-purchase/product/components/product-image/Arrow.js +0 -58
- package/dist/esm/post-purchase/product/components/product-image/CarouselPostPurchase.js +0 -76
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var helper = require('../../../../utils/helper.js');
|
|
7
|
+
var getClasses = require('../../../common/getClasses.js');
|
|
8
|
+
var getStyles = require('../../../common/getStyles.js');
|
|
9
|
+
var system = require('@gem-sdk/system');
|
|
10
|
+
var Arrow = require('./Arrow.js');
|
|
11
|
+
var CarouselPostPurchase = require('./CarouselPostPurchase.js');
|
|
12
|
+
var useCarousel = require('../../../hooks/product-image/useCarousel.js');
|
|
13
|
+
|
|
14
|
+
// ImageListCarousel.tsx
|
|
15
|
+
|
|
16
|
+
const CarouselWrapperPostPurchase = ({ styles, setting, productImages, objectFit = 'cover', aspectRatio, itemPerSlide = 1, spacing, navigation = 'none', vertical = false, border = 'none', idxActive })=>{
|
|
17
|
+
const settings = {
|
|
18
|
+
...styles,
|
|
19
|
+
...setting
|
|
20
|
+
};
|
|
21
|
+
const { layoutType } = settings || {};
|
|
22
|
+
const { setMoveToIdx, setMaxIdx } = useCarousel.useCarousel();
|
|
23
|
+
const itemGap = helper.postPurchaseSpacing[spacing || 'none'] ?? '0px';
|
|
24
|
+
const isHiddenIcon = layoutType === 'one-col' ? true : false;
|
|
25
|
+
const classes = system.createClass(getClasses.getImageListClass());
|
|
26
|
+
const style = system.createStyle(getStyles.getImageListStyle({
|
|
27
|
+
gap: itemGap,
|
|
28
|
+
vertical
|
|
29
|
+
}));
|
|
30
|
+
React.useEffect(()=>{
|
|
31
|
+
const newMaxIdx = productImages.length - Number(itemPerSlide || 0);
|
|
32
|
+
setMaxIdx(newMaxIdx);
|
|
33
|
+
}, [
|
|
34
|
+
productImages.length,
|
|
35
|
+
itemPerSlide,
|
|
36
|
+
setMaxIdx
|
|
37
|
+
]);
|
|
38
|
+
React.useEffect(()=>{
|
|
39
|
+
if (!idxActive) return;
|
|
40
|
+
if (itemPerSlide === 1) setMoveToIdx(idxActive);
|
|
41
|
+
}, [
|
|
42
|
+
idxActive,
|
|
43
|
+
itemPerSlide,
|
|
44
|
+
setMoveToIdx
|
|
45
|
+
]);
|
|
46
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
47
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
48
|
+
className: classes,
|
|
49
|
+
style: style,
|
|
50
|
+
children: [
|
|
51
|
+
/*#__PURE__*/ jsxRuntime.jsx(Arrow.ArrowPostPurchase, {
|
|
52
|
+
type: "prev",
|
|
53
|
+
navigation: navigation,
|
|
54
|
+
vertical: vertical,
|
|
55
|
+
hidden: isHiddenIcon
|
|
56
|
+
}),
|
|
57
|
+
/*#__PURE__*/ jsxRuntime.jsx(CarouselPostPurchase.CarouselPostPurchase, {
|
|
58
|
+
productImages: productImages,
|
|
59
|
+
itemPerRow: itemPerSlide,
|
|
60
|
+
border: border,
|
|
61
|
+
aspectRatio: aspectRatio,
|
|
62
|
+
objectFit: objectFit
|
|
63
|
+
}),
|
|
64
|
+
/*#__PURE__*/ jsxRuntime.jsx(Arrow.ArrowPostPurchase, {
|
|
65
|
+
type: "next",
|
|
66
|
+
navigation: navigation,
|
|
67
|
+
vertical: vertical,
|
|
68
|
+
hidden: isHiddenIcon
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
exports.CarouselWrapperPostPurchase = CarouselWrapperPostPurchase;
|
|
@@ -7,18 +7,18 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var core = require('@gem-sdk/core');
|
|
9
9
|
var FeatureImageWithGalleryImage = require('./layouts/FeatureImageWithGalleryImage.js');
|
|
10
|
-
var index = require('../../helpers/index.js');
|
|
11
10
|
var FeatureImage = require('./FeatureImage.js');
|
|
12
11
|
var OnlyGalleryImage = require('./layouts/OnlyGalleryImage.js');
|
|
12
|
+
var system = require('@gem-sdk/system');
|
|
13
|
+
var getClasses = require('../../common/getClasses.js');
|
|
13
14
|
|
|
14
15
|
const PostPurchaseProductImages = (props)=>{
|
|
15
|
-
const { setting, styles, builderProps, builderAttrs, style, children
|
|
16
|
+
const { setting, styles, builderProps, builderAttrs, style, children } = props;
|
|
16
17
|
const settings = {
|
|
17
18
|
...setting,
|
|
18
19
|
...styles
|
|
19
20
|
};
|
|
20
|
-
const { layoutType } = settings;
|
|
21
|
-
const extraClass = advanced?.cssClass;
|
|
21
|
+
const { layoutType = 'bottom-center' } = settings;
|
|
22
22
|
const product = core.useProduct();
|
|
23
23
|
const getProductGallery = (product)=>{
|
|
24
24
|
return product?.medias?.edges.filter((item)=>![
|
|
@@ -54,48 +54,46 @@ const PostPurchaseProductImages = (props)=>{
|
|
|
54
54
|
}, [
|
|
55
55
|
product
|
|
56
56
|
]);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
const renderLayout = ()=>{
|
|
58
|
+
if ([
|
|
59
|
+
'bottom-center',
|
|
60
|
+
'left',
|
|
61
|
+
'right'
|
|
62
|
+
].includes(layoutType)) return /*#__PURE__*/ jsxRuntime.jsx(FeatureImageWithGalleryImage.default, {
|
|
63
|
+
gallery: gallery,
|
|
64
|
+
builderProps: builderProps,
|
|
65
|
+
setting: setting,
|
|
66
|
+
styles: styles
|
|
67
|
+
});
|
|
68
|
+
if ([
|
|
69
|
+
'one-col',
|
|
70
|
+
'two-col'
|
|
71
|
+
].includes(layoutType)) return /*#__PURE__*/ jsxRuntime.jsx(OnlyGalleryImage.default, {
|
|
72
|
+
gallery: gallery,
|
|
73
|
+
builderProps: builderProps,
|
|
74
|
+
setting: setting,
|
|
75
|
+
styles: styles
|
|
76
|
+
});
|
|
77
|
+
return /*#__PURE__*/ jsxRuntime.jsx(FeatureImage.default, {
|
|
78
|
+
gallery: gallery,
|
|
79
|
+
styles: styles,
|
|
80
|
+
setting: setting
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
const alignClass = system.createClass(getClasses.getProductImageClass({
|
|
84
|
+
align: settings?.align
|
|
85
|
+
}));
|
|
86
|
+
const containerStyle = system.createStyle({
|
|
87
|
+
...style
|
|
88
|
+
});
|
|
72
89
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
73
90
|
...builderAttrs,
|
|
74
|
-
className:
|
|
75
|
-
style:
|
|
76
|
-
...style
|
|
77
|
-
},
|
|
91
|
+
className: alignClass,
|
|
92
|
+
style: containerStyle,
|
|
78
93
|
children: [
|
|
79
|
-
/*#__PURE__*/ jsxRuntime.
|
|
80
|
-
className:
|
|
81
|
-
children:
|
|
82
|
-
isShowFeatureImageWithGallery && /*#__PURE__*/ jsxRuntime.jsx(FeatureImageWithGalleryImage.default, {
|
|
83
|
-
gallery: gallery,
|
|
84
|
-
builderProps: builderProps,
|
|
85
|
-
setting: setting,
|
|
86
|
-
styles: styles
|
|
87
|
-
}),
|
|
88
|
-
isShowOnlyFeatureImage && /*#__PURE__*/ jsxRuntime.jsx(FeatureImage.default, {
|
|
89
|
-
styles: styles,
|
|
90
|
-
setting: setting
|
|
91
|
-
}),
|
|
92
|
-
isShowOnlyGalleryImage && /*#__PURE__*/ jsxRuntime.jsx(OnlyGalleryImage.default, {
|
|
93
|
-
gallery: gallery,
|
|
94
|
-
builderProps: builderProps,
|
|
95
|
-
setting: setting,
|
|
96
|
-
styles: styles
|
|
97
|
-
})
|
|
98
|
-
]
|
|
94
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
95
|
+
className: alignClass,
|
|
96
|
+
children: renderLayout()
|
|
99
97
|
}),
|
|
100
98
|
children
|
|
101
99
|
]
|
|
@@ -4,76 +4,40 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var core = require('@gem-sdk/core');
|
|
9
|
-
var helper = require('../../../../utils/helper.js');
|
|
10
7
|
var FeatureImage = require('../FeatureImage.js');
|
|
11
8
|
var OnlyGalleryImage = require('./OnlyGalleryImage.js');
|
|
9
|
+
var system = require('@gem-sdk/system');
|
|
10
|
+
var getClasses = require('../../../common/getClasses.js');
|
|
11
|
+
var getStyles = require('../../../common/getStyles.js');
|
|
12
|
+
var useProductImagePostPurchase = require('../../../hooks/product-image/useProductImagePostPurchase.js');
|
|
12
13
|
|
|
13
14
|
const FeatureImageWithGalleryImage = (productImageProps)=>{
|
|
14
|
-
const { setting, styles,
|
|
15
|
+
const { setting, styles, gallery } = productImageProps;
|
|
15
16
|
const settings = {
|
|
16
17
|
...setting,
|
|
17
18
|
...styles
|
|
18
19
|
};
|
|
19
|
-
const { layoutType } = settings;
|
|
20
|
-
const isShowGalleryImages =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
if (isShowGalleryImages) {
|
|
30
|
-
const ratioLayout = layoutType === 'left' ? settings.ratioLayoutLeft : settings.ratioLayoutRight;
|
|
31
|
-
const isHorizontalLayout = [
|
|
32
|
-
'left',
|
|
33
|
-
'right'
|
|
34
|
-
].includes(layoutType || '');
|
|
35
|
-
if (isHorizontalLayout && ratioLayout) {
|
|
36
|
-
result = {
|
|
37
|
-
...result,
|
|
38
|
-
'--gtc': `minmax(0, ${ratioLayout[0]}fr) minmax(0, ${ratioLayout[1]}fr)`
|
|
39
|
-
};
|
|
40
|
-
Object.assign(result, {
|
|
41
|
-
'--gtr': 'fit-content(0)'
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return result;
|
|
46
|
-
}, [
|
|
47
|
-
isShowGalleryImages,
|
|
48
|
-
layoutType,
|
|
49
|
-
settings.ratioLayoutLeft,
|
|
50
|
-
settings.ratioLayoutRight
|
|
51
|
-
]);
|
|
52
|
-
const itemGap = React.useMemo(()=>{
|
|
53
|
-
if (layoutType === 'bottom-center') {
|
|
54
|
-
return helper.postPurchaseSpacing[settings?.spacingVertical || 'none'];
|
|
55
|
-
}
|
|
56
|
-
return settings?.spacingHoz;
|
|
57
|
-
}, [
|
|
20
|
+
const { layoutType = 'bottom-center' } = settings;
|
|
21
|
+
const { itemGap, gridLayout, isShowGalleryImages } = useProductImagePostPurchase.useProductImagePostPurchase({
|
|
22
|
+
imageList: gallery,
|
|
23
|
+
setting
|
|
24
|
+
});
|
|
25
|
+
const containerStyle = system.createStyle(getStyles.getProductImageLayoutStyle({
|
|
26
|
+
gap: itemGap
|
|
27
|
+
}, gridLayout));
|
|
28
|
+
const style = system.createStyle(getStyles.getAlignStyle({
|
|
58
29
|
layoutType,
|
|
59
|
-
settings?.
|
|
60
|
-
|
|
61
|
-
|
|
30
|
+
align: settings?.align
|
|
31
|
+
}));
|
|
32
|
+
const classes = system.createClass(getClasses.getFeatureImageClass());
|
|
33
|
+
const containerClasses = system.createClass(getClasses.getProductImageLayoutClass());
|
|
62
34
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
63
|
-
className:
|
|
64
|
-
style:
|
|
65
|
-
...gridLayout,
|
|
66
|
-
...core.makeStyle({
|
|
67
|
-
gg: itemGap
|
|
68
|
-
})
|
|
69
|
-
},
|
|
35
|
+
className: containerClasses,
|
|
36
|
+
style: containerStyle,
|
|
70
37
|
children: [
|
|
71
38
|
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
72
|
-
className:
|
|
73
|
-
style:
|
|
74
|
-
'--o': layoutType === 'left' ? `1` : '0',
|
|
75
|
-
'--jc': styles?.align === 'left' ? 'flex-start' : styles?.align === 'right' ? 'flex-end' : 'center'
|
|
76
|
-
},
|
|
39
|
+
className: classes,
|
|
40
|
+
style: style,
|
|
77
41
|
children: /*#__PURE__*/ jsxRuntime.jsx(FeatureImage.default, {
|
|
78
42
|
...productImageProps
|
|
79
43
|
})
|
|
@@ -4,29 +4,36 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var React = require('react');
|
|
8
7
|
var ImageListGrid = require('../ImageListGrid.js');
|
|
9
8
|
var ImageListCarousel = require('../ImageListCarousel.js');
|
|
10
|
-
var
|
|
9
|
+
var system = require('@gem-sdk/system');
|
|
10
|
+
var useProductImagePostPurchase = require('../../../hooks/product-image/useProductImagePostPurchase.js');
|
|
11
|
+
var getClasses = require('../../../common/getClasses.js');
|
|
12
|
+
require('@gem-sdk/core');
|
|
11
13
|
|
|
12
14
|
const OnlyGalleryImage = (productImageProps)=>{
|
|
13
|
-
const { setting, styles, gallery
|
|
15
|
+
const { setting, styles, gallery } = productImageProps;
|
|
14
16
|
const settings = {
|
|
15
17
|
...setting,
|
|
16
18
|
...styles
|
|
17
19
|
};
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
settings.displayType
|
|
24
|
-
]);
|
|
20
|
+
const { isImageListCarousel } = useProductImagePostPurchase.useProductImagePostPurchase({
|
|
21
|
+
imageList: gallery,
|
|
22
|
+
setting
|
|
23
|
+
});
|
|
24
|
+
const classes = system.createClass(getClasses.getOnlyFeatureLayoutClass());
|
|
25
25
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
26
|
-
className:
|
|
26
|
+
className: classes,
|
|
27
27
|
children: isImageListCarousel ? /*#__PURE__*/ jsxRuntime.jsx(ImageListCarousel.default, {
|
|
28
28
|
...productImageProps,
|
|
29
|
-
productImages: gallery
|
|
29
|
+
productImages: gallery,
|
|
30
|
+
aspectRatio: settings?.ilAspectRatio,
|
|
31
|
+
objectFit: settings.ilObjectFit,
|
|
32
|
+
spacing: settings.ilSpacing,
|
|
33
|
+
navigation: settings?.ilNavigation,
|
|
34
|
+
vertical: settings?.layoutType === 'bottom-center' ? false : true,
|
|
35
|
+
border: settings?.ilBorder,
|
|
36
|
+
itemPerSlide: settings?.ilItemPerSlide
|
|
30
37
|
}) : /*#__PURE__*/ jsxRuntime.jsx(ImageListGrid.default, {
|
|
31
38
|
...productImageProps,
|
|
32
39
|
productImages: gallery
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const NEXT_AND_PREV_URLS = {
|
|
4
|
+
PREVIOUS: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a2eb5093-0203-4973-8ade-183d5bdefdce.svg',
|
|
5
|
+
NEXT: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a5ac0286-5941-4bd7-a21d-72a6c017aeea.svg',
|
|
6
|
+
NEXT_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a3d1f159-001d-4301-bead-214606caf995.svg',
|
|
7
|
+
PREVIOUS_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-33e3810b-a94c-40a1-a48b-4eba39013f15.svg',
|
|
8
|
+
VERTICAL_PREVIOUS: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-4e4e886a-5aa1-4bb3-ab48-aa7752fd5eba.svg',
|
|
9
|
+
VERTICAL_NEXT: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a3c3d74c-2cde-49e5-9854-8079f5239013.svg',
|
|
10
|
+
VERTICAL_NEXT_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-6c7f10a8-a205-43bd-b39c-aab044bb3771.svg',
|
|
11
|
+
VERTICAL_PREVIOUS_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-010c3c2a-fcc3-4b09-84a2-734d924ad49b.svg'
|
|
12
|
+
};
|
|
13
|
+
const BUTTON_URL_MAP_POST_PURCHASE = {
|
|
14
|
+
next: {
|
|
15
|
+
vertical: {
|
|
16
|
+
disabled: NEXT_AND_PREV_URLS.VERTICAL_NEXT_DISABLED,
|
|
17
|
+
enabled: NEXT_AND_PREV_URLS.VERTICAL_NEXT
|
|
18
|
+
},
|
|
19
|
+
horizontal: {
|
|
20
|
+
disabled: NEXT_AND_PREV_URLS.NEXT_DISABLED,
|
|
21
|
+
enabled: NEXT_AND_PREV_URLS.NEXT
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
prev: {
|
|
25
|
+
vertical: {
|
|
26
|
+
disabled: NEXT_AND_PREV_URLS.VERTICAL_PREVIOUS_DISABLED,
|
|
27
|
+
enabled: NEXT_AND_PREV_URLS.VERTICAL_PREVIOUS
|
|
28
|
+
},
|
|
29
|
+
horizontal: {
|
|
30
|
+
disabled: NEXT_AND_PREV_URLS.PREVIOUS_DISABLED,
|
|
31
|
+
enabled: NEXT_AND_PREV_URLS.PREVIOUS
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.BUTTON_URL_MAP_POST_PURCHASE = BUTTON_URL_MAP_POST_PURCHASE;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var CarouselPostPurchaseContext = require('../../components/product-image/carousel-post-purchase/CarouselPostPurchaseContext.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const useCarousel = ()=>{
|
|
7
|
+
const context = React.useContext(CarouselPostPurchaseContext.CarouselPostPurchaseContext);
|
|
8
|
+
if (context === undefined) {
|
|
9
|
+
throw new Error('useCarousel must be used within a CarouselProvider');
|
|
10
|
+
}
|
|
11
|
+
return context;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.useCarousel = useCarousel;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const useFeatureImagePostPurchase = (props)=>{
|
|
7
|
+
const { gallery } = props;
|
|
8
|
+
const currentVariant = core.useCurrentVariant();
|
|
9
|
+
const featuredImageGlobal = core.useFeaturedImageGlobal();
|
|
10
|
+
const setProductFeaturedImage = core.useProductStore((store)=>store.setProductFeaturedImage);
|
|
11
|
+
const idxActive = React.useMemo(()=>{
|
|
12
|
+
if (!featuredImageGlobal) return 0;
|
|
13
|
+
const index = gallery.findIndex((el)=>el.id === featuredImageGlobal.id);
|
|
14
|
+
return index !== -1 ? index : 0;
|
|
15
|
+
}, [
|
|
16
|
+
featuredImageGlobal,
|
|
17
|
+
gallery
|
|
18
|
+
]);
|
|
19
|
+
React.useEffect(()=>{
|
|
20
|
+
if (currentVariant?.media && currentVariant.media.contentType === 'IMAGE') {
|
|
21
|
+
setProductFeaturedImage(currentVariant.media);
|
|
22
|
+
}
|
|
23
|
+
}, [
|
|
24
|
+
currentVariant,
|
|
25
|
+
setProductFeaturedImage
|
|
26
|
+
]);
|
|
27
|
+
return {
|
|
28
|
+
idxActive
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.useFeatureImagePostPurchase = useFeatureImagePostPurchase;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var useCarousel = require('./useCarousel.js');
|
|
5
|
+
|
|
6
|
+
const useListCarousel = (props)=>{
|
|
7
|
+
const { productImages, itemPerRow } = props;
|
|
8
|
+
const { moveToIdx } = useCarousel.useCarousel();
|
|
9
|
+
const list = React.useCallback(()=>{
|
|
10
|
+
const temp = [
|
|
11
|
+
...productImages
|
|
12
|
+
];
|
|
13
|
+
return temp?.splice(moveToIdx, itemPerRow);
|
|
14
|
+
}, [
|
|
15
|
+
productImages,
|
|
16
|
+
itemPerRow,
|
|
17
|
+
moveToIdx
|
|
18
|
+
]);
|
|
19
|
+
const listRender = React.useMemo(()=>{
|
|
20
|
+
const listItem = list();
|
|
21
|
+
if (listItem.length < itemPerRow) {
|
|
22
|
+
const temp = [
|
|
23
|
+
...productImages
|
|
24
|
+
];
|
|
25
|
+
Array.from({
|
|
26
|
+
length: itemPerRow - listItem.length
|
|
27
|
+
}).forEach(()=>{
|
|
28
|
+
temp.push({});
|
|
29
|
+
});
|
|
30
|
+
return temp;
|
|
31
|
+
}
|
|
32
|
+
return listItem;
|
|
33
|
+
}, [
|
|
34
|
+
list,
|
|
35
|
+
itemPerRow,
|
|
36
|
+
productImages
|
|
37
|
+
]);
|
|
38
|
+
return {
|
|
39
|
+
listRender
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.useListCarousel = useListCarousel;
|
package/dist/cjs/post-purchase/product/hooks/product-image/useNavigationCarouselPostPurchase.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var index = require('../../constants/index.js');
|
|
5
|
+
var useCarousel = require('./useCarousel.js');
|
|
6
|
+
|
|
7
|
+
const useNavigationCarouselPostPurchase = (props)=>{
|
|
8
|
+
const { moveToIdx, maxIdx, setMoveToIdx } = useCarousel.useCarousel();
|
|
9
|
+
const { type, vertical } = props;
|
|
10
|
+
const disabled = type == 'next' ? moveToIdx >= maxIdx : moveToIdx === 0;
|
|
11
|
+
const imgSrc = React.useMemo(()=>{
|
|
12
|
+
return index.BUTTON_URL_MAP_POST_PURCHASE[type][vertical ? 'vertical' : 'horizontal'][disabled ? 'disabled' : 'enabled'];
|
|
13
|
+
}, [
|
|
14
|
+
type,
|
|
15
|
+
vertical,
|
|
16
|
+
disabled
|
|
17
|
+
]);
|
|
18
|
+
const handleClick = ()=>{
|
|
19
|
+
if (type === 'next') {
|
|
20
|
+
setMoveToIdx(moveToIdx + 1);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
setMoveToIdx(moveToIdx - 1);
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
imgSrc,
|
|
27
|
+
handleClick,
|
|
28
|
+
disabled
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.useNavigationCarouselPostPurchase = useNavigationCarouselPostPurchase;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var helper = require('../../../utils/helper.js');
|
|
5
|
+
|
|
6
|
+
const useProductImagePostPurchase = (props)=>{
|
|
7
|
+
const { imageList, setting } = props;
|
|
8
|
+
const { layoutType = 'bottom-center', spacingVertical, spacingHoz, ratioLayoutLeft, ratioLayoutRight, displayType } = setting || {};
|
|
9
|
+
const isShowGalleryImages = React.useMemo(()=>{
|
|
10
|
+
return imageList.length > 1;
|
|
11
|
+
}, [
|
|
12
|
+
imageList.length
|
|
13
|
+
]);
|
|
14
|
+
const itemGap = React.useMemo(()=>{
|
|
15
|
+
if (layoutType === 'bottom-center') return helper.postPurchaseSpacing[spacingVertical || 'none'];
|
|
16
|
+
return spacingHoz;
|
|
17
|
+
}, [
|
|
18
|
+
layoutType,
|
|
19
|
+
spacingHoz,
|
|
20
|
+
spacingVertical
|
|
21
|
+
]);
|
|
22
|
+
const gridLayout = React.useMemo(()=>{
|
|
23
|
+
const DEFAULT_RESULT = {
|
|
24
|
+
'--gtc': 'minmax(0, 12fr)'
|
|
25
|
+
};
|
|
26
|
+
if (!isShowGalleryImages) return DEFAULT_RESULT;
|
|
27
|
+
const ratioLayout = layoutType === 'left' ? ratioLayoutLeft : ratioLayoutRight;
|
|
28
|
+
const isHorizontalLayout = [
|
|
29
|
+
'left',
|
|
30
|
+
'right'
|
|
31
|
+
].includes(layoutType);
|
|
32
|
+
if (!isHorizontalLayout || !ratioLayout) return DEFAULT_RESULT;
|
|
33
|
+
return {
|
|
34
|
+
'--gtc': `minmax(0, ${ratioLayout[0]}fr) minmax(0, ${ratioLayout[1]}fr)`,
|
|
35
|
+
'--gtr': 'fit-content(0)'
|
|
36
|
+
};
|
|
37
|
+
}, [
|
|
38
|
+
isShowGalleryImages,
|
|
39
|
+
layoutType,
|
|
40
|
+
ratioLayoutLeft,
|
|
41
|
+
ratioLayoutRight
|
|
42
|
+
]);
|
|
43
|
+
const isImageListCarousel = React.useMemo(()=>{
|
|
44
|
+
return layoutType !== 'two-col' && ([
|
|
45
|
+
'left',
|
|
46
|
+
'right'
|
|
47
|
+
].includes(layoutType) || displayType === 'slider');
|
|
48
|
+
}, [
|
|
49
|
+
layoutType,
|
|
50
|
+
displayType
|
|
51
|
+
]);
|
|
52
|
+
return {
|
|
53
|
+
itemGap,
|
|
54
|
+
gridLayout,
|
|
55
|
+
isShowGalleryImages,
|
|
56
|
+
isImageListCarousel
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.useProductImagePostPurchase = useProductImagePostPurchase;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
const useSlideCarousel = (props)=>{
|
|
6
|
+
const { layoutType, ilNumberPerRow, ftDisplayType, ftItemPerSlide } = props;
|
|
7
|
+
const itemSlideGrid = React.useMemo(()=>{
|
|
8
|
+
const itemPerRowDefault = 5;
|
|
9
|
+
let itemPerRow = itemPerRowDefault;
|
|
10
|
+
switch(layoutType){
|
|
11
|
+
case 'bottom-center':
|
|
12
|
+
itemPerRow = ilNumberPerRow || itemPerRowDefault;
|
|
13
|
+
break;
|
|
14
|
+
case 'two-col':
|
|
15
|
+
itemPerRow = 2;
|
|
16
|
+
break;
|
|
17
|
+
case 'one-col':
|
|
18
|
+
itemPerRow = 1;
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
itemPerRow = itemPerRowDefault;
|
|
22
|
+
}
|
|
23
|
+
return itemPerRow;
|
|
24
|
+
}, [
|
|
25
|
+
ilNumberPerRow,
|
|
26
|
+
layoutType
|
|
27
|
+
]);
|
|
28
|
+
const itemSlideList = ftDisplayType === 'slider' && layoutType !== 'only-feature' ? ftItemPerSlide : 1;
|
|
29
|
+
return {
|
|
30
|
+
itemSlideGrid,
|
|
31
|
+
itemSlideList
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.useSlideCarousel = useSlideCarousel;
|
|
@@ -42,25 +42,22 @@ const settingV2 = [
|
|
|
42
42
|
label: 'Left',
|
|
43
43
|
value: 'left',
|
|
44
44
|
type: 'text',
|
|
45
|
-
tooltip: 'Align left'
|
|
45
|
+
tooltip: 'Align left',
|
|
46
|
+
iconName: 'polaris-text-align-left'
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
label: 'Center',
|
|
49
50
|
value: 'center',
|
|
50
51
|
type: 'text',
|
|
51
|
-
tooltip: 'Align center'
|
|
52
|
+
tooltip: 'Align center',
|
|
53
|
+
iconName: 'polaris-text-align-center'
|
|
52
54
|
},
|
|
53
55
|
{
|
|
54
56
|
label: 'Right',
|
|
55
57
|
value: 'right',
|
|
56
58
|
type: 'text',
|
|
57
|
-
tooltip: 'Align right'
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
label: 'Justify',
|
|
61
|
-
value: 'justify',
|
|
62
|
-
type: 'text',
|
|
63
|
-
tooltip: 'Align justify'
|
|
59
|
+
tooltip: 'Align right',
|
|
60
|
+
iconName: 'polaris-text-align-right'
|
|
64
61
|
}
|
|
65
62
|
],
|
|
66
63
|
default: 'left'
|
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var constants = require('../../../utils/constants.js');
|
|
4
|
+
|
|
3
5
|
const productFeatureImageStyle = [
|
|
6
|
+
{
|
|
7
|
+
type: 'select',
|
|
8
|
+
label: 'Spacing',
|
|
9
|
+
id: 'ftSpacing',
|
|
10
|
+
options: constants.postPurchaseSpacing,
|
|
11
|
+
default: 'xtight'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
id: 'ftNavigation',
|
|
15
|
+
label: 'Border',
|
|
16
|
+
type: 'segment',
|
|
17
|
+
options: [
|
|
18
|
+
{
|
|
19
|
+
label: 'Yes',
|
|
20
|
+
value: 'display'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: 'No',
|
|
24
|
+
value: 'none'
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
default: 'none'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'ftBorder',
|
|
31
|
+
label: 'Border',
|
|
32
|
+
type: 'segment',
|
|
33
|
+
options: [
|
|
34
|
+
{
|
|
35
|
+
label: 'Yes',
|
|
36
|
+
value: 'display'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'No',
|
|
40
|
+
value: 'none'
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
default: 'none'
|
|
44
|
+
},
|
|
4
45
|
{
|
|
5
46
|
id: 'ftAspectRatio',
|
|
6
47
|
type: 'select',
|