@gem-sdk/components 2.0.0-dev.261 → 2.0.0-dev.266
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/post-purchase/text/settings/text/uiV2.js +2 -2
- 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/post-purchase/text/settings/text/uiV2.js +2 -2
- 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
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
3
|
import ImageListGrid from '../ImageListGrid.js';
|
|
5
4
|
import ImageListCarousel from '../ImageListCarousel.js';
|
|
6
|
-
import {
|
|
5
|
+
import { createClass } from '@gem-sdk/system';
|
|
6
|
+
import { useProductImagePostPurchase } from '../../../hooks/product-image/useProductImagePostPurchase.js';
|
|
7
|
+
import { getOnlyFeatureLayoutClass } from '../../../common/getClasses.js';
|
|
8
|
+
import '@gem-sdk/core';
|
|
7
9
|
|
|
8
10
|
const OnlyGalleryImage = (productImageProps)=>{
|
|
9
|
-
const { setting, styles, gallery
|
|
11
|
+
const { setting, styles, gallery } = productImageProps;
|
|
10
12
|
const settings = {
|
|
11
13
|
...setting,
|
|
12
14
|
...styles
|
|
13
15
|
};
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
settings.displayType
|
|
20
|
-
]);
|
|
16
|
+
const { isImageListCarousel } = useProductImagePostPurchase({
|
|
17
|
+
imageList: gallery,
|
|
18
|
+
setting
|
|
19
|
+
});
|
|
20
|
+
const classes = createClass(getOnlyFeatureLayoutClass());
|
|
21
21
|
return /*#__PURE__*/ jsx("div", {
|
|
22
|
-
className:
|
|
22
|
+
className: classes,
|
|
23
23
|
children: isImageListCarousel ? /*#__PURE__*/ jsx(ImageListCarousel, {
|
|
24
24
|
...productImageProps,
|
|
25
|
-
productImages: gallery
|
|
25
|
+
productImages: gallery,
|
|
26
|
+
aspectRatio: settings?.ilAspectRatio,
|
|
27
|
+
objectFit: settings.ilObjectFit,
|
|
28
|
+
spacing: settings.ilSpacing,
|
|
29
|
+
navigation: settings?.ilNavigation,
|
|
30
|
+
vertical: settings?.layoutType === 'bottom-center' ? false : true,
|
|
31
|
+
border: settings?.ilBorder,
|
|
32
|
+
itemPerSlide: settings?.ilItemPerSlide
|
|
26
33
|
}) : /*#__PURE__*/ jsx(ImageListGrid, {
|
|
27
34
|
...productImageProps,
|
|
28
35
|
productImages: gallery
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const NEXT_AND_PREV_URLS = {
|
|
2
|
+
PREVIOUS: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a2eb5093-0203-4973-8ade-183d5bdefdce.svg',
|
|
3
|
+
NEXT: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a5ac0286-5941-4bd7-a21d-72a6c017aeea.svg',
|
|
4
|
+
NEXT_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a3d1f159-001d-4301-bead-214606caf995.svg',
|
|
5
|
+
PREVIOUS_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-33e3810b-a94c-40a1-a48b-4eba39013f15.svg',
|
|
6
|
+
VERTICAL_PREVIOUS: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-4e4e886a-5aa1-4bb3-ab48-aa7752fd5eba.svg',
|
|
7
|
+
VERTICAL_NEXT: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-a3c3d74c-2cde-49e5-9854-8079f5239013.svg',
|
|
8
|
+
VERTICAL_NEXT_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-6c7f10a8-a205-43bd-b39c-aab044bb3771.svg',
|
|
9
|
+
VERTICAL_PREVIOUS_DISABLED: 'https://cdn.shopify.com/s/files/1/0789/8018/6418/files/472169286689883168-010c3c2a-fcc3-4b09-84a2-734d924ad49b.svg'
|
|
10
|
+
};
|
|
11
|
+
const BUTTON_URL_MAP_POST_PURCHASE = {
|
|
12
|
+
next: {
|
|
13
|
+
vertical: {
|
|
14
|
+
disabled: NEXT_AND_PREV_URLS.VERTICAL_NEXT_DISABLED,
|
|
15
|
+
enabled: NEXT_AND_PREV_URLS.VERTICAL_NEXT
|
|
16
|
+
},
|
|
17
|
+
horizontal: {
|
|
18
|
+
disabled: NEXT_AND_PREV_URLS.NEXT_DISABLED,
|
|
19
|
+
enabled: NEXT_AND_PREV_URLS.NEXT
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
prev: {
|
|
23
|
+
vertical: {
|
|
24
|
+
disabled: NEXT_AND_PREV_URLS.VERTICAL_PREVIOUS_DISABLED,
|
|
25
|
+
enabled: NEXT_AND_PREV_URLS.VERTICAL_PREVIOUS
|
|
26
|
+
},
|
|
27
|
+
horizontal: {
|
|
28
|
+
disabled: NEXT_AND_PREV_URLS.PREVIOUS_DISABLED,
|
|
29
|
+
enabled: NEXT_AND_PREV_URLS.PREVIOUS
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { BUTTON_URL_MAP_POST_PURCHASE };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CarouselPostPurchaseContext } from '../../components/product-image/carousel-post-purchase/CarouselPostPurchaseContext.js';
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
|
|
4
|
+
const useCarousel = ()=>{
|
|
5
|
+
const context = useContext(CarouselPostPurchaseContext);
|
|
6
|
+
if (context === undefined) {
|
|
7
|
+
throw new Error('useCarousel must be used within a CarouselProvider');
|
|
8
|
+
}
|
|
9
|
+
return context;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { useCarousel };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useCurrentVariant, useFeaturedImageGlobal, useProductStore } from '@gem-sdk/core';
|
|
2
|
+
import { useMemo, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
const useFeatureImagePostPurchase = (props)=>{
|
|
5
|
+
const { gallery } = props;
|
|
6
|
+
const currentVariant = useCurrentVariant();
|
|
7
|
+
const featuredImageGlobal = useFeaturedImageGlobal();
|
|
8
|
+
const setProductFeaturedImage = useProductStore((store)=>store.setProductFeaturedImage);
|
|
9
|
+
const idxActive = useMemo(()=>{
|
|
10
|
+
if (!featuredImageGlobal) return 0;
|
|
11
|
+
const index = gallery.findIndex((el)=>el.id === featuredImageGlobal.id);
|
|
12
|
+
return index !== -1 ? index : 0;
|
|
13
|
+
}, [
|
|
14
|
+
featuredImageGlobal,
|
|
15
|
+
gallery
|
|
16
|
+
]);
|
|
17
|
+
useEffect(()=>{
|
|
18
|
+
if (currentVariant?.media && currentVariant.media.contentType === 'IMAGE') {
|
|
19
|
+
setProductFeaturedImage(currentVariant.media);
|
|
20
|
+
}
|
|
21
|
+
}, [
|
|
22
|
+
currentVariant,
|
|
23
|
+
setProductFeaturedImage
|
|
24
|
+
]);
|
|
25
|
+
return {
|
|
26
|
+
idxActive
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { useFeatureImagePostPurchase };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { useCarousel } from './useCarousel.js';
|
|
3
|
+
|
|
4
|
+
const useListCarousel = (props)=>{
|
|
5
|
+
const { productImages, itemPerRow } = props;
|
|
6
|
+
const { moveToIdx } = useCarousel();
|
|
7
|
+
const list = useCallback(()=>{
|
|
8
|
+
const temp = [
|
|
9
|
+
...productImages
|
|
10
|
+
];
|
|
11
|
+
return temp?.splice(moveToIdx, itemPerRow);
|
|
12
|
+
}, [
|
|
13
|
+
productImages,
|
|
14
|
+
itemPerRow,
|
|
15
|
+
moveToIdx
|
|
16
|
+
]);
|
|
17
|
+
const listRender = useMemo(()=>{
|
|
18
|
+
const listItem = list();
|
|
19
|
+
if (listItem.length < itemPerRow) {
|
|
20
|
+
const temp = [
|
|
21
|
+
...productImages
|
|
22
|
+
];
|
|
23
|
+
Array.from({
|
|
24
|
+
length: itemPerRow - listItem.length
|
|
25
|
+
}).forEach(()=>{
|
|
26
|
+
temp.push({});
|
|
27
|
+
});
|
|
28
|
+
return temp;
|
|
29
|
+
}
|
|
30
|
+
return listItem;
|
|
31
|
+
}, [
|
|
32
|
+
list,
|
|
33
|
+
itemPerRow,
|
|
34
|
+
productImages
|
|
35
|
+
]);
|
|
36
|
+
return {
|
|
37
|
+
listRender
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { useListCarousel };
|
package/dist/esm/post-purchase/product/hooks/product-image/useNavigationCarouselPostPurchase.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { BUTTON_URL_MAP_POST_PURCHASE } from '../../constants/index.js';
|
|
3
|
+
import { useCarousel } from './useCarousel.js';
|
|
4
|
+
|
|
5
|
+
const useNavigationCarouselPostPurchase = (props)=>{
|
|
6
|
+
const { moveToIdx, maxIdx, setMoveToIdx } = useCarousel();
|
|
7
|
+
const { type, vertical } = props;
|
|
8
|
+
const disabled = type == 'next' ? moveToIdx >= maxIdx : moveToIdx === 0;
|
|
9
|
+
const imgSrc = useMemo(()=>{
|
|
10
|
+
return BUTTON_URL_MAP_POST_PURCHASE[type][vertical ? 'vertical' : 'horizontal'][disabled ? 'disabled' : 'enabled'];
|
|
11
|
+
}, [
|
|
12
|
+
type,
|
|
13
|
+
vertical,
|
|
14
|
+
disabled
|
|
15
|
+
]);
|
|
16
|
+
const handleClick = ()=>{
|
|
17
|
+
if (type === 'next') {
|
|
18
|
+
setMoveToIdx(moveToIdx + 1);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
setMoveToIdx(moveToIdx - 1);
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
imgSrc,
|
|
25
|
+
handleClick,
|
|
26
|
+
disabled
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { useNavigationCarouselPostPurchase };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { postPurchaseSpacing } from '../../../utils/helper.js';
|
|
3
|
+
|
|
4
|
+
const useProductImagePostPurchase = (props)=>{
|
|
5
|
+
const { imageList, setting } = props;
|
|
6
|
+
const { layoutType = 'bottom-center', spacingVertical, spacingHoz, ratioLayoutLeft, ratioLayoutRight, displayType } = setting || {};
|
|
7
|
+
const isShowGalleryImages = useMemo(()=>{
|
|
8
|
+
return imageList.length > 1;
|
|
9
|
+
}, [
|
|
10
|
+
imageList.length
|
|
11
|
+
]);
|
|
12
|
+
const itemGap = useMemo(()=>{
|
|
13
|
+
if (layoutType === 'bottom-center') return postPurchaseSpacing[spacingVertical || 'none'];
|
|
14
|
+
return spacingHoz;
|
|
15
|
+
}, [
|
|
16
|
+
layoutType,
|
|
17
|
+
spacingHoz,
|
|
18
|
+
spacingVertical
|
|
19
|
+
]);
|
|
20
|
+
const gridLayout = useMemo(()=>{
|
|
21
|
+
const DEFAULT_RESULT = {
|
|
22
|
+
'--gtc': 'minmax(0, 12fr)'
|
|
23
|
+
};
|
|
24
|
+
if (!isShowGalleryImages) return DEFAULT_RESULT;
|
|
25
|
+
const ratioLayout = layoutType === 'left' ? ratioLayoutLeft : ratioLayoutRight;
|
|
26
|
+
const isHorizontalLayout = [
|
|
27
|
+
'left',
|
|
28
|
+
'right'
|
|
29
|
+
].includes(layoutType);
|
|
30
|
+
if (!isHorizontalLayout || !ratioLayout) return DEFAULT_RESULT;
|
|
31
|
+
return {
|
|
32
|
+
'--gtc': `minmax(0, ${ratioLayout[0]}fr) minmax(0, ${ratioLayout[1]}fr)`,
|
|
33
|
+
'--gtr': 'fit-content(0)'
|
|
34
|
+
};
|
|
35
|
+
}, [
|
|
36
|
+
isShowGalleryImages,
|
|
37
|
+
layoutType,
|
|
38
|
+
ratioLayoutLeft,
|
|
39
|
+
ratioLayoutRight
|
|
40
|
+
]);
|
|
41
|
+
const isImageListCarousel = useMemo(()=>{
|
|
42
|
+
return layoutType !== 'two-col' && ([
|
|
43
|
+
'left',
|
|
44
|
+
'right'
|
|
45
|
+
].includes(layoutType) || displayType === 'slider');
|
|
46
|
+
}, [
|
|
47
|
+
layoutType,
|
|
48
|
+
displayType
|
|
49
|
+
]);
|
|
50
|
+
return {
|
|
51
|
+
itemGap,
|
|
52
|
+
gridLayout,
|
|
53
|
+
isShowGalleryImages,
|
|
54
|
+
isImageListCarousel
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { useProductImagePostPurchase };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
const useSlideCarousel = (props)=>{
|
|
4
|
+
const { layoutType, ilNumberPerRow, ftDisplayType, ftItemPerSlide } = props;
|
|
5
|
+
const itemSlideGrid = useMemo(()=>{
|
|
6
|
+
const itemPerRowDefault = 5;
|
|
7
|
+
let itemPerRow = itemPerRowDefault;
|
|
8
|
+
switch(layoutType){
|
|
9
|
+
case 'bottom-center':
|
|
10
|
+
itemPerRow = ilNumberPerRow || itemPerRowDefault;
|
|
11
|
+
break;
|
|
12
|
+
case 'two-col':
|
|
13
|
+
itemPerRow = 2;
|
|
14
|
+
break;
|
|
15
|
+
case 'one-col':
|
|
16
|
+
itemPerRow = 1;
|
|
17
|
+
break;
|
|
18
|
+
default:
|
|
19
|
+
itemPerRow = itemPerRowDefault;
|
|
20
|
+
}
|
|
21
|
+
return itemPerRow;
|
|
22
|
+
}, [
|
|
23
|
+
ilNumberPerRow,
|
|
24
|
+
layoutType
|
|
25
|
+
]);
|
|
26
|
+
const itemSlideList = ftDisplayType === 'slider' && layoutType !== 'only-feature' ? ftItemPerSlide : 1;
|
|
27
|
+
return {
|
|
28
|
+
itemSlideGrid,
|
|
29
|
+
itemSlideList
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { useSlideCarousel };
|
|
@@ -40,25 +40,22 @@ const settingV2 = [
|
|
|
40
40
|
label: 'Left',
|
|
41
41
|
value: 'left',
|
|
42
42
|
type: 'text',
|
|
43
|
-
tooltip: 'Align left'
|
|
43
|
+
tooltip: 'Align left',
|
|
44
|
+
iconName: 'polaris-text-align-left'
|
|
44
45
|
},
|
|
45
46
|
{
|
|
46
47
|
label: 'Center',
|
|
47
48
|
value: 'center',
|
|
48
49
|
type: 'text',
|
|
49
|
-
tooltip: 'Align center'
|
|
50
|
+
tooltip: 'Align center',
|
|
51
|
+
iconName: 'polaris-text-align-center'
|
|
50
52
|
},
|
|
51
53
|
{
|
|
52
54
|
label: 'Right',
|
|
53
55
|
value: 'right',
|
|
54
56
|
type: 'text',
|
|
55
|
-
tooltip: 'Align right'
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
label: 'Justify',
|
|
59
|
-
value: 'justify',
|
|
60
|
-
type: 'text',
|
|
61
|
-
tooltip: 'Align justify'
|
|
57
|
+
tooltip: 'Align right',
|
|
58
|
+
iconName: 'polaris-text-align-right'
|
|
62
59
|
}
|
|
63
60
|
],
|
|
64
61
|
default: 'left'
|
|
@@ -1,4 +1,45 @@
|
|
|
1
|
+
import { postPurchaseSpacing } from '../../../utils/constants.js';
|
|
2
|
+
|
|
1
3
|
const productFeatureImageStyle = [
|
|
4
|
+
{
|
|
5
|
+
type: 'select',
|
|
6
|
+
label: 'Spacing',
|
|
7
|
+
id: 'ftSpacing',
|
|
8
|
+
options: postPurchaseSpacing,
|
|
9
|
+
default: 'xtight'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: 'ftNavigation',
|
|
13
|
+
label: 'Border',
|
|
14
|
+
type: 'segment',
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
label: 'Yes',
|
|
18
|
+
value: 'display'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: 'No',
|
|
22
|
+
value: 'none'
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
default: 'none'
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'ftBorder',
|
|
29
|
+
label: 'Border',
|
|
30
|
+
type: 'segment',
|
|
31
|
+
options: [
|
|
32
|
+
{
|
|
33
|
+
label: 'Yes',
|
|
34
|
+
value: 'display'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: 'No',
|
|
38
|
+
value: 'none'
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
default: 'none'
|
|
42
|
+
},
|
|
2
43
|
{
|
|
3
44
|
id: 'ftAspectRatio',
|
|
4
45
|
type: 'select',
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { postPurchaseSpacing } from '../../../utils/constants.js';
|
|
2
|
-
|
|
3
1
|
const productGalleryImageSetting = [
|
|
4
2
|
{
|
|
5
3
|
id: 'displayType',
|
|
@@ -19,121 +17,6 @@ const productGalleryImageSetting = [
|
|
|
19
17
|
default: 'slider'
|
|
20
18
|
}
|
|
21
19
|
];
|
|
22
|
-
const productGalleryImageStyle = [
|
|
23
|
-
{
|
|
24
|
-
id: 'ilAspectRatio',
|
|
25
|
-
type: 'select',
|
|
26
|
-
default: '1',
|
|
27
|
-
options: [
|
|
28
|
-
{
|
|
29
|
-
label: 'Original',
|
|
30
|
-
value: 'auto'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
label: 'Square',
|
|
34
|
-
value: '1'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: 'Vertical',
|
|
38
|
-
value: '3/4'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
label: 'Horizontal',
|
|
42
|
-
value: '4/3'
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: 'ilObjectFit',
|
|
48
|
-
type: 'layout-segment',
|
|
49
|
-
iconViewBox: '0 0 66 48',
|
|
50
|
-
enableItemBackground: true,
|
|
51
|
-
enableTooltip: true,
|
|
52
|
-
label: 'Image scale',
|
|
53
|
-
options: [
|
|
54
|
-
{
|
|
55
|
-
label: 'Fill image',
|
|
56
|
-
value: 'cover',
|
|
57
|
-
type: 'image'
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
label: 'Fit image',
|
|
61
|
-
value: 'contain',
|
|
62
|
-
type: 'image'
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
default: 'cover'
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
id: 'ilBorder',
|
|
69
|
-
label: 'Active border',
|
|
70
|
-
type: 'segment',
|
|
71
|
-
default: 'display',
|
|
72
|
-
options: [
|
|
73
|
-
{
|
|
74
|
-
label: 'none',
|
|
75
|
-
value: 'none',
|
|
76
|
-
icon: `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
77
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.34315 4.34315C7.46734 1.21895 12.5327 1.21895 15.6569 4.34315C18.781 7.46734 18.781 12.5327 15.6569 15.6569C12.5327 18.781 7.46734 18.781 4.34315 15.6569C1.21895 12.5327 1.21895 7.46734 4.34315 4.34315ZM14.4281 4.7638C11.7339 2.4803 7.69308 2.60946 5.15127 5.15127C2.60946 7.69308 2.4803 11.7339 4.7638 14.4281L14.4281 4.7638ZM5.57193 15.2362C8.26608 17.5197 12.3069 17.3905 14.8487 14.8487C17.3905 12.3069 17.5197 8.26608 15.2362 5.57193L5.57193 15.2362Z" fill="currentColor"/>
|
|
78
|
-
</svg>
|
|
79
|
-
|
|
80
|
-
`
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
label: 'display',
|
|
84
|
-
value: 'display',
|
|
85
|
-
icon: `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
86
|
-
<path d="M1.10547 9C1.10547 8.72386 1.32933 8.5 1.60547 8.5H18.1064C18.3826 8.5 18.6064 8.72386 18.6064 9V11C18.6064 11.2761 18.3826 11.5 18.1064 11.5H1.60547C1.32933 11.5 1.10547 11.2761 1.10547 11V9Z" fill="currentColor"/>
|
|
87
|
-
</svg>
|
|
88
|
-
|
|
89
|
-
`
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
id: 'ilNavigation',
|
|
95
|
-
label: 'Navigation',
|
|
96
|
-
type: 'layout-segment',
|
|
97
|
-
iconViewBox: '0 0 78 48',
|
|
98
|
-
enableItemBackground: true,
|
|
99
|
-
enableTooltip: true,
|
|
100
|
-
default: 'display',
|
|
101
|
-
options: [
|
|
102
|
-
{
|
|
103
|
-
label: 'No navigation',
|
|
104
|
-
value: 'none',
|
|
105
|
-
type: 'slide-control',
|
|
106
|
-
isTextIcon: true
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
label: 'Display inside navigation',
|
|
110
|
-
value: 'display',
|
|
111
|
-
type: 'slide-control'
|
|
112
|
-
}
|
|
113
|
-
]
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
type: 'select',
|
|
117
|
-
label: 'Spacing',
|
|
118
|
-
id: 'ilSpacing',
|
|
119
|
-
options: postPurchaseSpacing,
|
|
120
|
-
default: 'xtight'
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: 'ilItemPerSlide',
|
|
124
|
-
type: 'input:number',
|
|
125
|
-
min: 1,
|
|
126
|
-
hide: true,
|
|
127
|
-
default: 5
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
id: 'ilNumberPerRow',
|
|
131
|
-
type: 'input:number',
|
|
132
|
-
label: 'Item per row',
|
|
133
|
-
hide: true,
|
|
134
|
-
default: 5
|
|
135
|
-
}
|
|
136
|
-
];
|
|
137
20
|
const productGalleryImageUI = [
|
|
138
21
|
{
|
|
139
22
|
type: 'control',
|
|
@@ -216,4 +99,4 @@ const productGalleryImageUI = [
|
|
|
216
99
|
}
|
|
217
100
|
];
|
|
218
101
|
|
|
219
|
-
export { productGalleryImageSetting,
|
|
102
|
+
export { productGalleryImageSetting, productGalleryImageUI };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { SettingUIV2 } from './uiV2.js';
|
|
2
|
+
import { SettingUIV1 } from './uiV1.js';
|
|
3
|
+
import { SettingV1 } from './setting-v1.js';
|
|
4
|
+
import { SettingV2 } from './setting-v2.js';
|
|
4
5
|
|
|
5
6
|
const config = {
|
|
6
7
|
tag: 'PostPurchaseProductImages',
|
|
@@ -10,82 +11,10 @@ const config = {
|
|
|
10
11
|
<path d="M13.3337 14.6666C13.3337 16.1333 12.1337 17.3333 10.667 17.3333C9.20033 17.3333 8.00033 16.1333 8.00033 14.6666C8.00033 13.2 9.20033 12 10.667 12C12.1337 12 13.3337 13.2 13.3337 14.6666ZM27.3741 14.8404C26.9836 14.4499 26.3504 14.4499 25.9599 14.8404L16.667 24.1333L14.0346 21.6062C13.6442 21.2314 13.0267 21.2352 12.6409 21.6145L5.33366 28.8V9.33329H34.667V22.1333L27.3741 14.8404ZM34.667 30.6666H23.2003L18.5337 26L26.667 17.8666L34.667 25.8666V30.6666ZM7.33366 30.6666L13.467 24.6666L19.467 30.6666H7.33366ZM3.66699 6.66663C3.11471 6.66663 2.66699 7.11434 2.66699 7.66663V31.4666V32.3333C2.66699 32.8856 3.11471 33.3333 3.66699 33.3333H25.867H36.3337C36.8859 33.3333 37.3337 32.8856 37.3337 32.3333V30.6666V28.5333V24.8V7.66662C37.3337 7.11434 36.8859 6.66663 36.3337 6.66663H3.66699Z" fill="currentColor"/>
|
|
11
12
|
</svg>
|
|
12
13
|
`,
|
|
13
|
-
settings:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
...productLayoutSettings,
|
|
18
|
-
...productGalleryImageSetting
|
|
19
|
-
]
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: 'style',
|
|
23
|
-
controls: [
|
|
24
|
-
...productFeatureImageStyle,
|
|
25
|
-
...productGalleryImageStyle,
|
|
26
|
-
{
|
|
27
|
-
id: 'align',
|
|
28
|
-
label: 'Alignment',
|
|
29
|
-
type: 'segment',
|
|
30
|
-
options: [
|
|
31
|
-
{
|
|
32
|
-
label: 'Left',
|
|
33
|
-
value: 'left',
|
|
34
|
-
type: 'align',
|
|
35
|
-
tooltip: 'Align left'
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
label: 'Center',
|
|
39
|
-
value: 'center',
|
|
40
|
-
type: 'align',
|
|
41
|
-
tooltip: 'Align center'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: 'Right',
|
|
45
|
-
value: 'right',
|
|
46
|
-
type: 'align',
|
|
47
|
-
tooltip: 'Align right'
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
default: 'left'
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
ui: [
|
|
56
|
-
{
|
|
57
|
-
type: 'group',
|
|
58
|
-
label: {
|
|
59
|
-
en: 'Layout'
|
|
60
|
-
},
|
|
61
|
-
controls: productLayoutUI
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
type: 'group',
|
|
65
|
-
label: {
|
|
66
|
-
en: 'Featured image'
|
|
67
|
-
},
|
|
68
|
-
condition: "layoutType !== 'one-col' && layoutType !== 'two-col'",
|
|
69
|
-
controls: productFeatureImageUI
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
type: 'group',
|
|
73
|
-
label: {
|
|
74
|
-
en: 'Image list'
|
|
75
|
-
},
|
|
76
|
-
condition: "layoutType !== 'only-feature'",
|
|
77
|
-
controls: productGalleryImageUI
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
type: 'control',
|
|
81
|
-
setting: {
|
|
82
|
-
id: 'align'
|
|
83
|
-
},
|
|
84
|
-
label: {
|
|
85
|
-
en: 'Align'
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
],
|
|
14
|
+
settings: SettingV1,
|
|
15
|
+
settingsV2: SettingV2,
|
|
16
|
+
ui: SettingUIV1,
|
|
17
|
+
uiV2: SettingUIV2,
|
|
89
18
|
editorConfigs: {
|
|
90
19
|
placeholder: {
|
|
91
20
|
flowTag: [
|