@gem-sdk/components 2.0.0-dev.622 → 2.0.0-dev.623
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/builder.js +12 -6
- package/dist/cjs/index.js +34 -32
- package/dist/cjs/index.liquid.js +16 -10
- package/dist/cjs/next.js +3 -1
- package/dist/cjs/product/components/ProductImagesV3/common/common.js +360 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getAttr.js +192 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getBorderActiveCss.js +26 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getClasses.js +94 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getStyle.js +303 -0
- package/dist/cjs/product/components/ProductImagesV3/common/hoverAction.js +95 -0
- package/dist/cjs/product/components/ProductImagesV3/common/productFeaturedImage.js +59 -0
- package/dist/cjs/product/components/ProductImagesV3/common/productGallery.js +266 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/MediaIcon.js +63 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +36 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +109 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +139 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +100 -0
- package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +77 -0
- package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +300 -0
- package/dist/cjs/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +44 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +83 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +182 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +30 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +239 -0
- package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +28 -0
- package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +144 -0
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesAttr.js +14 -0
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesClassName.js +54 -0
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesStyles.js +53 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +55 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +41 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +134 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +203 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +87 -0
- package/dist/cjs/product/components/ProductImagesV3/index.js +291 -0
- package/dist/cjs/product/components/ProductImagesV3/index.liquid.js +153 -0
- package/dist/cjs/product/index.js +6 -4
- package/dist/cjs/product/next.js +4 -0
- package/dist/cjs/product/setting/product-image-v3/ProductFeatureImage.js +252 -0
- package/dist/cjs/product/setting/product-image-v3/ProductGalleryImage.js +251 -0
- package/dist/cjs/product/setting/product-image-v3/ProductImages.js +74 -0
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +388 -0
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +518 -0
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/index.js +336 -0
- package/dist/cjs/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +118 -0
- package/dist/cjs/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +119 -0
- package/dist/cjs/product/setting/product-image-v3/configs/uiV1.js +237 -0
- package/dist/cjs/product/setting/product-image-v3/configs/uiV2.js +491 -0
- package/dist/cjs/setting.js +97 -95
- package/dist/cjs/swiper-carousel/arrow/Arrow.js +52 -0
- package/dist/cjs/swiper-carousel/arrow/Arrow.liquid.js +46 -0
- package/dist/cjs/swiper-carousel/arrow/common/common.js +119 -0
- package/dist/cjs/swiper-carousel/arrow/common/getClass.js +50 -0
- package/dist/cjs/swiper-carousel/arrow/common/getStyle.js +84 -0
- package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.js +34 -0
- package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.liquid.js +38 -0
- package/dist/cjs/swiper-carousel/carousel-item/common/getClass.js +29 -0
- package/dist/cjs/swiper-carousel/carousel-item/common/getStyle.js +79 -0
- package/dist/cjs/swiper-carousel/carousel-item/hook/useCarouseItem.js +22 -0
- package/dist/cjs/swiper-carousel/components/common/carousel.js +98 -0
- package/dist/cjs/swiper-carousel/components/const/index.js +5 -0
- package/dist/cjs/swiper-carousel/components/hooks/useTrackPreviewPause.js +34 -0
- package/dist/cjs/swiper-carousel/components/plugins/AnimationPlugin.js +42 -0
- package/dist/cjs/swiper-carousel/components/plugins/AutoPlayPlugin.js +105 -0
- package/dist/cjs/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +15 -0
- package/dist/cjs/swiper-carousel/components/plugins/MutationPlugin.js +45 -0
- package/dist/cjs/swiper-carousel/dots/Dots.js +51 -0
- package/dist/cjs/swiper-carousel/dots/Dots.liquid.js +26 -0
- package/dist/cjs/swiper-carousel/dots/common/common.js +28 -0
- package/dist/cjs/swiper-carousel/dots/common/getClass.js +40 -0
- package/dist/cjs/swiper-carousel/dots/common/getStyle.js +33 -0
- package/dist/cjs/swiper-carousel/dots/hook/useDotsSetting.js +21 -0
- package/dist/cjs/swiper-carousel/index.js +17 -0
- package/dist/cjs/swiper-carousel/next.js +22 -0
- package/dist/cjs/swiper-carousel/root/Swiper.js +128 -0
- package/dist/cjs/swiper-carousel/root/Swiper.liquid.js +104 -0
- package/dist/cjs/swiper-carousel/root/common/getAttr.js +25 -0
- package/dist/cjs/swiper-carousel/root/common/getClass.js +135 -0
- package/dist/cjs/swiper-carousel/root/common/getData.js +56 -0
- package/dist/cjs/swiper-carousel/root/common/getStyle.js +64 -0
- package/dist/cjs/swiper-carousel/root/hook/useCarousel.js +482 -0
- package/dist/cjs/swiper-carousel/setting/Swiper.js +42 -0
- package/dist/cjs/swiper-carousel/setting/SwiperItem.js +40 -0
- package/dist/cjs/swiper-carousel/setting/configs/presets.js +87 -0
- package/dist/cjs/swiper-carousel/setting/configs/settingV2.js +819 -0
- package/dist/cjs/swiper-carousel/setting/configs/uiV2.js +718 -0
- package/dist/esm/builder.js +6 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.liquid.js +3 -0
- package/dist/esm/next.js +3 -1
- package/dist/esm/product/components/ProductImagesV3/common/common.js +344 -0
- package/dist/esm/product/components/ProductImagesV3/common/getAttr.js +189 -0
- package/dist/esm/product/components/ProductImagesV3/common/getBorderActiveCss.js +24 -0
- package/dist/esm/product/components/ProductImagesV3/common/getClasses.js +83 -0
- package/dist/esm/product/components/ProductImagesV3/common/getStyle.js +292 -0
- package/dist/esm/product/components/ProductImagesV3/common/hoverAction.js +92 -0
- package/dist/esm/product/components/ProductImagesV3/common/productFeaturedImage.js +53 -0
- package/dist/esm/product/components/ProductImagesV3/common/productGallery.js +251 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/MediaIcon.js +59 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +32 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +105 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +135 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +96 -0
- package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +73 -0
- package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +296 -0
- package/dist/esm/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +40 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +79 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +178 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +26 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +235 -0
- package/dist/esm/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +24 -0
- package/dist/esm/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +140 -0
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesAttr.js +12 -0
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesClassName.js +52 -0
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesStyles.js +51 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +53 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +39 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +132 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +201 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +85 -0
- package/dist/esm/product/components/ProductImagesV3/index.js +287 -0
- package/dist/esm/product/components/ProductImagesV3/index.liquid.js +149 -0
- package/dist/esm/product/index.js +26 -24
- package/dist/esm/product/next.js +4 -0
- package/dist/esm/product/setting/product-image-v3/ProductFeatureImage.js +248 -0
- package/dist/esm/product/setting/product-image-v3/ProductGalleryImage.js +248 -0
- package/dist/esm/product/setting/product-image-v3/ProductImages.js +70 -0
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +384 -0
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +515 -0
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/index.js +334 -0
- package/dist/esm/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +116 -0
- package/dist/esm/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +117 -0
- package/dist/esm/product/setting/product-image-v3/configs/uiV1.js +235 -0
- package/dist/esm/product/setting/product-image-v3/configs/uiV2.js +489 -0
- package/dist/esm/setting.js +2 -0
- package/dist/esm/swiper-carousel/arrow/Arrow.js +48 -0
- package/dist/esm/swiper-carousel/arrow/Arrow.liquid.js +42 -0
- package/dist/esm/swiper-carousel/arrow/common/common.js +111 -0
- package/dist/esm/swiper-carousel/arrow/common/getClass.js +48 -0
- package/dist/esm/swiper-carousel/arrow/common/getStyle.js +82 -0
- package/dist/esm/swiper-carousel/carousel-item/SwiperItem.js +30 -0
- package/dist/esm/swiper-carousel/carousel-item/SwiperItem.liquid.js +34 -0
- package/dist/esm/swiper-carousel/carousel-item/common/getClass.js +27 -0
- package/dist/esm/swiper-carousel/carousel-item/common/getStyle.js +77 -0
- package/dist/esm/swiper-carousel/carousel-item/hook/useCarouseItem.js +20 -0
- package/dist/esm/swiper-carousel/components/common/carousel.js +93 -0
- package/dist/esm/swiper-carousel/components/const/index.js +3 -0
- package/dist/esm/swiper-carousel/components/hooks/useTrackPreviewPause.js +30 -0
- package/dist/esm/swiper-carousel/components/plugins/AnimationPlugin.js +35 -0
- package/dist/esm/swiper-carousel/components/plugins/AutoPlayPlugin.js +103 -0
- package/dist/esm/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +13 -0
- package/dist/esm/swiper-carousel/components/plugins/MutationPlugin.js +43 -0
- package/dist/esm/swiper-carousel/dots/Dots.js +47 -0
- package/dist/esm/swiper-carousel/dots/Dots.liquid.js +22 -0
- package/dist/esm/swiper-carousel/dots/common/common.js +26 -0
- package/dist/esm/swiper-carousel/dots/common/getClass.js +38 -0
- package/dist/esm/swiper-carousel/dots/common/getStyle.js +31 -0
- package/dist/esm/swiper-carousel/dots/hook/useDotsSetting.js +19 -0
- package/dist/esm/swiper-carousel/index.js +15 -0
- package/dist/esm/swiper-carousel/next.js +18 -0
- package/dist/esm/swiper-carousel/root/Swiper.js +124 -0
- package/dist/esm/swiper-carousel/root/Swiper.liquid.js +100 -0
- package/dist/esm/swiper-carousel/root/common/getAttr.js +23 -0
- package/dist/esm/swiper-carousel/root/common/getClass.js +133 -0
- package/dist/esm/swiper-carousel/root/common/getData.js +54 -0
- package/dist/esm/swiper-carousel/root/common/getStyle.js +62 -0
- package/dist/esm/swiper-carousel/root/hook/useCarousel.js +480 -0
- package/dist/esm/swiper-carousel/setting/Swiper.js +38 -0
- package/dist/esm/swiper-carousel/setting/SwiperItem.js +36 -0
- package/dist/esm/swiper-carousel/setting/configs/presets.js +85 -0
- package/dist/esm/swiper-carousel/setting/configs/settingV2.js +815 -0
- package/dist/esm/swiper-carousel/setting/configs/uiV2.js +713 -0
- package/dist/types/index.d.ts +551 -116
- package/package.json +2 -2
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var getSrcSet = require('../../../../image/helpers/getSrcSet.js');
|
|
6
|
+
var common = require('../common/common.js');
|
|
7
|
+
var productFeaturedImage = require('../common/productFeaturedImage.js');
|
|
8
|
+
var useFilterImagesByVariant = require('./useFilterImagesByVariant.js');
|
|
9
|
+
|
|
10
|
+
const useProductFeaturedImageCarousel = (props)=>{
|
|
11
|
+
const { productImages, imgRef, onHandleClick, onClickArrow, onHandleLoaded, onHandleUpdateActiveIndex, builderPropUID, builderPropsClass, children, parentUid, ...setting } = props;
|
|
12
|
+
const featuredImageGlobal = core.useFeaturedImageGlobal();
|
|
13
|
+
const currentDevice = core.useCurrentDevice();
|
|
14
|
+
const carouselRef = React.createRef();
|
|
15
|
+
const { onListener, ref } = core.useInteraction();
|
|
16
|
+
let delayTimeout;
|
|
17
|
+
const mode = core.useEditorMode();
|
|
18
|
+
const { filteredProductImages } = useFilterImagesByVariant.useFilterImagesByVariant({
|
|
19
|
+
productImages,
|
|
20
|
+
displayByVariant: setting?.displayByVariant,
|
|
21
|
+
variantSelect: setting?.variantSelect
|
|
22
|
+
});
|
|
23
|
+
const imageActiveIndex = React.useMemo(()=>{
|
|
24
|
+
const index = filteredProductImages?.findIndex((item)=>item.id === featuredImageGlobal?.id);
|
|
25
|
+
return index;
|
|
26
|
+
}, [
|
|
27
|
+
filteredProductImages,
|
|
28
|
+
featuredImageGlobal
|
|
29
|
+
]);
|
|
30
|
+
const isRenderFeatureCarousel = React.useMemo(()=>productFeaturedImage.checkRenderFeaturedCarousel(setting), [
|
|
31
|
+
setting
|
|
32
|
+
]);
|
|
33
|
+
const imageActive = React.useMemo(()=>{
|
|
34
|
+
if (filteredProductImages?.length) return featuredImageGlobal || filteredProductImages?.[0];
|
|
35
|
+
}, [
|
|
36
|
+
filteredProductImages,
|
|
37
|
+
featuredImageGlobal
|
|
38
|
+
]);
|
|
39
|
+
const enableOpenLightBox = React.useMemo(()=>{
|
|
40
|
+
return core.getResponsiveValueByScreen(setting.ftClickOpenLightBox, currentDevice) === 'popup';
|
|
41
|
+
}, [
|
|
42
|
+
setting.ftClickOpenLightBox,
|
|
43
|
+
currentDevice
|
|
44
|
+
]);
|
|
45
|
+
const indexHover = React.useMemo(()=>{
|
|
46
|
+
if (!setting?.otherImage) {
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
if (filteredProductImages && setting.otherImage >= filteredProductImages.length - 1) {
|
|
50
|
+
return filteredProductImages.length - 1;
|
|
51
|
+
}
|
|
52
|
+
if (filteredProductImages && setting.otherImage === -1) {
|
|
53
|
+
return filteredProductImages.length - 1;
|
|
54
|
+
}
|
|
55
|
+
return setting.otherImage;
|
|
56
|
+
}, [
|
|
57
|
+
setting?.otherImage,
|
|
58
|
+
filteredProductImages
|
|
59
|
+
]);
|
|
60
|
+
const imageShowWhenHover = React.useMemo(()=>{
|
|
61
|
+
return setting?.hoverEffect === 'other' ? filteredProductImages?.[indexHover] : filteredProductImages?.find((item)=>item.id === featuredImageGlobal?.id) || filteredProductImages?.[0];
|
|
62
|
+
}, [
|
|
63
|
+
featuredImageGlobal?.id,
|
|
64
|
+
indexHover,
|
|
65
|
+
filteredProductImages,
|
|
66
|
+
setting?.hoverEffect
|
|
67
|
+
]);
|
|
68
|
+
const genRandomKey = function() {
|
|
69
|
+
return Math.random().toString(36).substr(2, 5);
|
|
70
|
+
};
|
|
71
|
+
const emitUpdateActiveIndex = (index)=>{
|
|
72
|
+
delayTimeout && clearTimeout(delayTimeout);
|
|
73
|
+
delayTimeout = setTimeout(()=>onHandleUpdateActiveIndex && onHandleUpdateActiveIndex(index), 500);
|
|
74
|
+
};
|
|
75
|
+
const getDefaultAspectRatio = (image)=>{
|
|
76
|
+
let result = '1/1';
|
|
77
|
+
let ratio = 0;
|
|
78
|
+
if (image) {
|
|
79
|
+
if (image.width && image.height) {
|
|
80
|
+
result = `${image.width}/${image.height}`;
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
filteredProductImages?.forEach((item)=>{
|
|
84
|
+
if (item.width && item.height) {
|
|
85
|
+
const r = item.height / item.width;
|
|
86
|
+
if (r > ratio) {
|
|
87
|
+
ratio = r;
|
|
88
|
+
result = `${item.width}/${item.height}`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
};
|
|
95
|
+
const getAspectRatioFinal = (image)=>{
|
|
96
|
+
const result = common.getAspectRatio(setting.ftShape);
|
|
97
|
+
const defaultRatio = getDefaultAspectRatio(image);
|
|
98
|
+
return {
|
|
99
|
+
desktop: result.desktop ?? defaultRatio,
|
|
100
|
+
tablet: result.tablet ?? defaultRatio,
|
|
101
|
+
mobile: result.mobile ?? defaultRatio
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const handleSetSrc = React.useCallback(()=>{
|
|
105
|
+
getSrcSet.handleSetSrcForFeatureProductImage({
|
|
106
|
+
builderPropUID,
|
|
107
|
+
ftShape: setting.ftShape,
|
|
108
|
+
qualityType: setting.qualityType,
|
|
109
|
+
qualityPercent: setting.qualityPercent
|
|
110
|
+
});
|
|
111
|
+
}, [
|
|
112
|
+
setting.ftShape,
|
|
113
|
+
setting.qualityPercent,
|
|
114
|
+
setting.qualityType,
|
|
115
|
+
builderPropUID
|
|
116
|
+
]);
|
|
117
|
+
const onListenerInteraction = ()=>{
|
|
118
|
+
const eventName = 'gp:change-image-step';
|
|
119
|
+
const selector = `[data-id="${builderPropUID}"]`;
|
|
120
|
+
onListener({
|
|
121
|
+
event: eventName,
|
|
122
|
+
selector
|
|
123
|
+
}, (params)=>{
|
|
124
|
+
const element = (ref.current || document).querySelector(selector);
|
|
125
|
+
const { data, isRollback, uniqueStorageKey } = params || {};
|
|
126
|
+
carouselRef?.current?.moveToSlideInteraction({
|
|
127
|
+
element,
|
|
128
|
+
data,
|
|
129
|
+
isRollback,
|
|
130
|
+
key: uniqueStorageKey
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
onListener({
|
|
134
|
+
event: 'gp:change-next-slide',
|
|
135
|
+
selector
|
|
136
|
+
}, (params)=>{
|
|
137
|
+
const element = (ref.current || document).querySelector(selector);
|
|
138
|
+
const { data, isRollback, uniqueStorageKey } = params || {};
|
|
139
|
+
carouselRef?.current?.nextSlideInteraction({
|
|
140
|
+
element,
|
|
141
|
+
data,
|
|
142
|
+
isRollback,
|
|
143
|
+
key: uniqueStorageKey
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
onListener({
|
|
147
|
+
event: 'gp:change-previous-slide',
|
|
148
|
+
selector
|
|
149
|
+
}, (params)=>{
|
|
150
|
+
const element = (ref.current || document).querySelector(selector);
|
|
151
|
+
const { data, isRollback, uniqueStorageKey } = params || {};
|
|
152
|
+
carouselRef?.current?.previousSlideInteraction({
|
|
153
|
+
element,
|
|
154
|
+
data,
|
|
155
|
+
isRollback,
|
|
156
|
+
key: uniqueStorageKey
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
React.useEffect(()=>{
|
|
161
|
+
if (mode === 'edit') return;
|
|
162
|
+
const $featuredImage = document?.querySelector(`.gem-slider-item-${builderPropUID} .featured-image-only`);
|
|
163
|
+
if (!$featuredImage) return;
|
|
164
|
+
handleSetSrc();
|
|
165
|
+
const observer = new ResizeObserver(()=>{
|
|
166
|
+
handleSetSrc();
|
|
167
|
+
});
|
|
168
|
+
observer?.observe($featuredImage, {});
|
|
169
|
+
return ()=>{
|
|
170
|
+
observer?.disconnect();
|
|
171
|
+
};
|
|
172
|
+
}, [
|
|
173
|
+
handleSetSrc,
|
|
174
|
+
builderPropUID,
|
|
175
|
+
mode
|
|
176
|
+
]);
|
|
177
|
+
React.useEffect(()=>{
|
|
178
|
+
onListenerInteraction();
|
|
179
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
180
|
+
}, []);
|
|
181
|
+
React.useEffect(()=>{
|
|
182
|
+
if (!isRenderFeatureCarousel) {
|
|
183
|
+
onHandleLoaded && onHandleLoaded(true, 0);
|
|
184
|
+
}
|
|
185
|
+
}, [
|
|
186
|
+
isRenderFeatureCarousel,
|
|
187
|
+
onHandleLoaded
|
|
188
|
+
]);
|
|
189
|
+
return {
|
|
190
|
+
ref,
|
|
191
|
+
imageActive,
|
|
192
|
+
imageActiveIndex,
|
|
193
|
+
imageShowWhenHover,
|
|
194
|
+
enableOpenLightBox,
|
|
195
|
+
filteredProductImages,
|
|
196
|
+
isRenderFeatureCarousel,
|
|
197
|
+
genRandomKey,
|
|
198
|
+
getAspectRatioFinal,
|
|
199
|
+
emitUpdateActiveIndex
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
exports.useProductFeaturedImageCarousel = useProductFeaturedImageCarousel;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var getSrcSet = require('../../../../image/helpers/getSrcSet.js');
|
|
6
|
+
var productGallery = require('../common/productGallery.js');
|
|
7
|
+
var useFilterImagesByVariant = require('./useFilterImagesByVariant.js');
|
|
8
|
+
|
|
9
|
+
const useProductGalleryGrid = (props)=>{
|
|
10
|
+
const { builderPropUID, productImages, activeIndexFormFeatureImage, children, isHiddenInteraction, ...setting } = props;
|
|
11
|
+
const currentDevice = core.useCurrentDevice();
|
|
12
|
+
const featuredImageGlobal = core.useFeaturedImageGlobal();
|
|
13
|
+
const [imageActiveIndex, setImageActiveIndex] = React.useState(0);
|
|
14
|
+
const mode = core.useEditorMode();
|
|
15
|
+
const { filteredProductImages } = useFilterImagesByVariant.useFilterImagesByVariant({
|
|
16
|
+
productImages,
|
|
17
|
+
displayByVariant: setting?.displayByVariant,
|
|
18
|
+
variantSelect: setting?.variantSelect
|
|
19
|
+
});
|
|
20
|
+
const shapeByLayout = productGallery.getShapeByLayout({
|
|
21
|
+
shape: setting.shape,
|
|
22
|
+
shapeForBottom: setting.shapeForBottom,
|
|
23
|
+
shapeFor1Col: setting.shapeFor1Col,
|
|
24
|
+
shapeFor2Col: setting.shapeFor2Col,
|
|
25
|
+
shapeForFtOnly: setting.shapeForFtOnly,
|
|
26
|
+
shapeForInsideBottom: setting.shapeForInsideBottom,
|
|
27
|
+
shapeForInside: setting.shapeForInside
|
|
28
|
+
}, setting.position);
|
|
29
|
+
const enableOpenLightBox = core.getResponsiveValueByScreen(setting.clickOpenLightBox, currentDevice);
|
|
30
|
+
const isDisplayByWidth = productGallery.checkDisplayGalleryByWidth({
|
|
31
|
+
shapeByLayout
|
|
32
|
+
});
|
|
33
|
+
const isDisplay = core.getResponsiveValueByScreen(isDisplayByWidth, currentDevice);
|
|
34
|
+
const isEnableBorderActive = setting?.borderActive?.border !== 'none';
|
|
35
|
+
const handleSetSrc = React.useCallback(()=>{
|
|
36
|
+
getSrcSet.handleSetSrcForProductImageList({
|
|
37
|
+
builderPropUID,
|
|
38
|
+
shapeByLayout,
|
|
39
|
+
qualityType: setting.qualityType,
|
|
40
|
+
qualityPercent: setting.qualityPercent
|
|
41
|
+
});
|
|
42
|
+
}, [
|
|
43
|
+
shapeByLayout,
|
|
44
|
+
setting.qualityPercent,
|
|
45
|
+
setting.qualityType,
|
|
46
|
+
builderPropUID
|
|
47
|
+
]);
|
|
48
|
+
React.useEffect(()=>{
|
|
49
|
+
setImageActiveIndex(activeIndexFormFeatureImage || 0);
|
|
50
|
+
}, [
|
|
51
|
+
activeIndexFormFeatureImage
|
|
52
|
+
]);
|
|
53
|
+
React.useEffect(()=>{
|
|
54
|
+
const index = filteredProductImages?.findIndex((item)=>item.id === featuredImageGlobal?.id);
|
|
55
|
+
setImageActiveIndex(index && index > 0 ? index : 0);
|
|
56
|
+
}, [
|
|
57
|
+
featuredImageGlobal,
|
|
58
|
+
filteredProductImages
|
|
59
|
+
]);
|
|
60
|
+
React.useEffect(()=>{
|
|
61
|
+
if (mode === 'edit') return;
|
|
62
|
+
const $galleryImageGrid = document?.querySelector('.grid-gallery');
|
|
63
|
+
if (!$galleryImageGrid) return;
|
|
64
|
+
handleSetSrc();
|
|
65
|
+
const observer = new ResizeObserver(()=>{
|
|
66
|
+
handleSetSrc();
|
|
67
|
+
});
|
|
68
|
+
observer?.observe($galleryImageGrid, {});
|
|
69
|
+
return ()=>{
|
|
70
|
+
observer?.disconnect();
|
|
71
|
+
};
|
|
72
|
+
}, [
|
|
73
|
+
handleSetSrc,
|
|
74
|
+
builderPropUID,
|
|
75
|
+
mode
|
|
76
|
+
]);
|
|
77
|
+
return {
|
|
78
|
+
isDisplay,
|
|
79
|
+
shapeByLayout,
|
|
80
|
+
imageActiveIndex,
|
|
81
|
+
enableOpenLightBox,
|
|
82
|
+
isEnableBorderActive,
|
|
83
|
+
filteredProductImages
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
exports.useProductGalleryGrid = useProductGalleryGrid;
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var common = require('./common/common.js');
|
|
8
|
+
var core = require('@gem-sdk/core');
|
|
9
|
+
var React = require('react');
|
|
10
|
+
var FeatureImageWithGallery = require('./components/feature-gallery/FeatureImageWithGallery.js');
|
|
11
|
+
var OnlyFeatureImage = require('./components/feature-only/OnlyFeatureImage.js');
|
|
12
|
+
var ProductImagesLightBox = require('./components/lightbox/ProductImagesLightBox.js');
|
|
13
|
+
var NoDataState = require('../../../common/components/NoDataState.js');
|
|
14
|
+
var getProductImagesClassName = require('./composables/getProductImagesClassName.js');
|
|
15
|
+
var getBorderActiveCss = require('./common/getBorderActiveCss.js');
|
|
16
|
+
var GalleryGrid = require('./components/gallery-grid/GalleryGrid.js');
|
|
17
|
+
|
|
18
|
+
const getProductGallery = (product)=>{
|
|
19
|
+
return product?.medias?.edges.map((img)=>{
|
|
20
|
+
return img?.node;
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const LAYOUT_FEATURE_IMAGE_GALLERY = [
|
|
24
|
+
'bottom-left',
|
|
25
|
+
'bottom-center',
|
|
26
|
+
'left',
|
|
27
|
+
'right',
|
|
28
|
+
'inside-left',
|
|
29
|
+
'inside-right',
|
|
30
|
+
'inside-bottom'
|
|
31
|
+
];
|
|
32
|
+
const ProductImagesV3 = (props)=>{
|
|
33
|
+
const productImageProps = React.useMemo(()=>{
|
|
34
|
+
return common.setDefaultWhenUndefineSetting(props);
|
|
35
|
+
}, [
|
|
36
|
+
props
|
|
37
|
+
]);
|
|
38
|
+
const { redirectProductShopifyLink } = core.useProductShopifyEditLink();
|
|
39
|
+
const { setting, styles, builderProps, builderAttrs, style, children } = productImageProps;
|
|
40
|
+
const product = core.useProduct();
|
|
41
|
+
const currentDevice = core.useCurrentDevice();
|
|
42
|
+
const currentVariant = core.useCurrentVariant();
|
|
43
|
+
const { isChangeSelectedOption } = core.useSelectedOption();
|
|
44
|
+
const mode = core.useEditorMode();
|
|
45
|
+
const setProductFeaturedImage = core.useProductStore((s)=>s.setProductFeaturedImage);
|
|
46
|
+
// State
|
|
47
|
+
const [openLightBox, setOpenLightBox] = React.useState(false);
|
|
48
|
+
const getFirstVideo = (product)=>{
|
|
49
|
+
return product?.medias?.edges.find((item)=>[
|
|
50
|
+
'VIDEO',
|
|
51
|
+
'EXTERNAL_VIDEO'
|
|
52
|
+
].includes(item?.node?.contentType ?? ''))?.node;
|
|
53
|
+
};
|
|
54
|
+
const getFirstImage = (product)=>{
|
|
55
|
+
return product?.featuredImage;
|
|
56
|
+
};
|
|
57
|
+
const getFirst3DModal = (product)=>{
|
|
58
|
+
return product?.medias?.edges.find((item)=>item?.node?.contentType === 'MODEL_3D')?.node;
|
|
59
|
+
};
|
|
60
|
+
const isFirstActiveFeatureImage = React.useMemo(()=>setting?.typeDisplay === 'all-images' && !isChangeSelectedOption, [
|
|
61
|
+
isChangeSelectedOption,
|
|
62
|
+
setting?.typeDisplay
|
|
63
|
+
]);
|
|
64
|
+
const priorityFeatureImage = React.useMemo(()=>{
|
|
65
|
+
if (isFirstActiveFeatureImage) {
|
|
66
|
+
let priorityItem;
|
|
67
|
+
switch(setting?.preDisplay){
|
|
68
|
+
case '1st-images':
|
|
69
|
+
priorityItem = getFirstImage(product);
|
|
70
|
+
break;
|
|
71
|
+
case '1st-3d-mode':
|
|
72
|
+
priorityItem = getFirst3DModal(product);
|
|
73
|
+
break;
|
|
74
|
+
case '1st-video':
|
|
75
|
+
priorityItem = getFirstVideo(product);
|
|
76
|
+
break;
|
|
77
|
+
case '1st-available-variant':
|
|
78
|
+
priorityItem = currentVariant?.media;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
setProductFeaturedImage(priorityItem);
|
|
82
|
+
return priorityItem;
|
|
83
|
+
}
|
|
84
|
+
}, [
|
|
85
|
+
isFirstActiveFeatureImage,
|
|
86
|
+
setting?.preDisplay,
|
|
87
|
+
setProductFeaturedImage,
|
|
88
|
+
product,
|
|
89
|
+
currentVariant?.media
|
|
90
|
+
]);
|
|
91
|
+
const gallery = React.useMemo(()=>{
|
|
92
|
+
const images = getProductGallery(product);
|
|
93
|
+
if (!images?.length) return [
|
|
94
|
+
{
|
|
95
|
+
id: product?.featuredImage?.id || 'noImageError',
|
|
96
|
+
src: product?.featuredImage?.src || 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif',
|
|
97
|
+
width: product?.featuredImage?.width || 480,
|
|
98
|
+
height: product?.featuredImage?.height || 480
|
|
99
|
+
}
|
|
100
|
+
];
|
|
101
|
+
return images;
|
|
102
|
+
}, [
|
|
103
|
+
product
|
|
104
|
+
]);
|
|
105
|
+
const galleryIndex = React.useMemo(()=>{
|
|
106
|
+
return gallery.reduce((curr, value, index)=>{
|
|
107
|
+
if (value) {
|
|
108
|
+
return {
|
|
109
|
+
...curr,
|
|
110
|
+
[value.id]: index
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return curr;
|
|
114
|
+
}, {});
|
|
115
|
+
}, [
|
|
116
|
+
gallery
|
|
117
|
+
]);
|
|
118
|
+
const layout = React.useMemo(()=>{
|
|
119
|
+
return core.getResponsiveValueByScreen(styles?.position, currentDevice);
|
|
120
|
+
}, [
|
|
121
|
+
currentDevice,
|
|
122
|
+
styles?.position
|
|
123
|
+
]);
|
|
124
|
+
const handleGalleryClick = (imageID, enableOpenLightBox)=>{
|
|
125
|
+
handleClickSwitchImage(imageID);
|
|
126
|
+
enableOpenLightBox && handleOpenLightBox();
|
|
127
|
+
};
|
|
128
|
+
const handleOpenLightBox = ()=>{
|
|
129
|
+
setOpenLightBox(true);
|
|
130
|
+
};
|
|
131
|
+
const handleClickSwitchImage = (imageID)=>{
|
|
132
|
+
if (!imageID) return;
|
|
133
|
+
const index = galleryIndex[imageID];
|
|
134
|
+
if (index !== undefined) {
|
|
135
|
+
const fImage = gallery[index];
|
|
136
|
+
if (fImage) {
|
|
137
|
+
setProductFeaturedImage(fImage);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
React.useEffect(()=>{
|
|
142
|
+
if (currentVariant && !isFirstActiveFeatureImage) {
|
|
143
|
+
const index = galleryIndex[currentVariant?.mediaId];
|
|
144
|
+
if (index !== undefined) {
|
|
145
|
+
const fImage = gallery[index] ?? product?.featuredImage;
|
|
146
|
+
if (fImage) {
|
|
147
|
+
setProductFeaturedImage(fImage);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}, [
|
|
152
|
+
currentVariant,
|
|
153
|
+
galleryIndex,
|
|
154
|
+
gallery,
|
|
155
|
+
product?.featuredImage,
|
|
156
|
+
setProductFeaturedImage,
|
|
157
|
+
isFirstActiveFeatureImage
|
|
158
|
+
]);
|
|
159
|
+
const isRenderLightBox = React.useMemo(()=>{
|
|
160
|
+
const isRender = core.getResponsiveValueByScreen(setting?.ftClickOpenLightBox, currentDevice) === 'popup' || core.getResponsiveValueByScreen(setting?.clickOpenLightBox, currentDevice);
|
|
161
|
+
if (!isRender && mode === 'edit') {
|
|
162
|
+
window?.parent?.postMessage?.(JSON.stringify({
|
|
163
|
+
type: 'active-modal',
|
|
164
|
+
value: open
|
|
165
|
+
}), '*');
|
|
166
|
+
}
|
|
167
|
+
return isRender;
|
|
168
|
+
}, [
|
|
169
|
+
setting?.ftClickOpenLightBox,
|
|
170
|
+
setting?.clickOpenLightBox,
|
|
171
|
+
currentDevice,
|
|
172
|
+
mode
|
|
173
|
+
]);
|
|
174
|
+
const renderProductBadge = ()=>{
|
|
175
|
+
return gallery.length > 0 ? React.Children.map(core.filterToolbarPreview(children), (child)=>{
|
|
176
|
+
if (/*#__PURE__*/ React.isValidElement(child)) {
|
|
177
|
+
return /*#__PURE__*/ jsxRuntime.jsx(child.type, {
|
|
178
|
+
...child.props,
|
|
179
|
+
isInsideProductImage: true,
|
|
180
|
+
navigationPosition: setting?.ftNavigationPosition,
|
|
181
|
+
imageData: {
|
|
182
|
+
imageShape: styles?.ftShape,
|
|
183
|
+
imageAlign: styles?.align,
|
|
184
|
+
imageLayout: styles?.position
|
|
185
|
+
},
|
|
186
|
+
dotData: {
|
|
187
|
+
dotSize: setting?.ftDotSize,
|
|
188
|
+
dotGapToCarousel: setting?.ftDotGapToCarousel,
|
|
189
|
+
dotStyle: setting?.ftDotStyle
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return null;
|
|
194
|
+
}) : null;
|
|
195
|
+
};
|
|
196
|
+
const svg = `
|
|
197
|
+
<svg viewBox="0 0 452 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
198
|
+
<path d="M0 7.99999C0 3.58171 3.58172 0 8 0H444C448.418 0 452 3.58172 452 8V392C452 396.418 448.418 400 444 400H8C3.58173 400 0 396.418 0 392V7.99999Z" fill="#F9F9F9"/>
|
|
199
|
+
<path d="M208.148 348.801C239.683 348.75 265.245 347.272 265.242 345.499C265.239 343.726 239.673 342.33 208.138 342.381C176.603 342.432 151.041 343.91 151.044 345.683C151.047 347.456 176.614 348.851 208.148 348.801Z" fill="#E6E6E6"/>
|
|
200
|
+
<path d="M225.946 320.879C225.946 320.879 169.954 292.883 177.953 214.227C185.952 135.571 183.286 143.57 183.286 143.57C183.286 143.57 196.617 99.5762 220.614 83.5784C220.614 83.5784 163.289 24.9199 117.962 131.572C117.962 131.572 105.963 195.563 115.295 238.224C124.627 280.884 145.958 315.546 145.958 315.546C145.958 315.546 165.955 335.543 188.618 335.543C211.282 335.543 225.946 320.879 225.946 320.879Z" fill="#CCCCCC"/>
|
|
201
|
+
<path d="M318.6 273.553C318.6 273.553 286.605 358.875 186.619 342.877C86.6325 326.879 113.295 153.57 113.295 153.57C113.295 153.57 102.123 282.854 160.581 320.874C176.779 331.409 197.935 331.504 213.408 319.93C223.66 312.261 232.445 298.883 231.279 275.553L318.6 273.553Z" fill="#E6E6E6"/>
|
|
202
|
+
<path d="M315.483 111.223C315.483 111.223 269.94 28.9197 171.287 56.9158C110.135 82.9705 111.274 150.057 111.274 150.057C103.9 261.289 183.264 259.493 201.95 140.904C205.231 120.082 198.617 108.242 198.617 108.242C198.617 108.242 189.285 136.238 160.622 142.237C131.915 148.246 127.007 138.688 127.96 124.24C127.97 124.095 127.979 123.952 127.989 123.809C128.775 112.106 133.316 100.968 140.937 92.0518C157.37 72.918 193.19 44.9769 231.279 103.576L233.945 110.169C233.945 110.169 281.036 122.87 315.483 111.223Z" fill="#E6E6E6"/>
|
|
203
|
+
<path d="M241.931 108.909C235.042 108.916 228.438 111.656 223.567 116.528C218.696 121.399 215.956 128.003 215.948 134.892V257.167C215.956 264.339 218.809 271.214 223.88 276.286C228.951 281.357 235.827 284.21 242.999 284.218H307.331C315.974 284.208 324.26 280.77 330.371 274.659C336.483 268.547 339.921 260.261 339.931 251.618V141.762C339.921 133.052 336.456 124.701 330.297 118.542C324.138 112.383 315.787 108.918 307.077 108.909L241.931 108.909Z" fill="#ADADAD"/>
|
|
204
|
+
<path d="M253.087 114.24C249.426 114.244 245.916 115.7 243.327 118.289C240.738 120.878 239.282 124.388 239.278 128.049V265.741C239.282 269.402 240.738 272.912 243.327 275.501C245.916 278.09 249.426 279.546 253.087 279.55H314.265C321.6 279.542 328.631 276.624 333.818 271.438C339.004 266.251 341.922 259.219 341.93 251.885V138.614C341.923 132.152 339.353 125.956 334.783 121.387C330.214 116.817 324.018 114.247 317.556 114.24H253.087Z" fill="#D2D2D2"/>
|
|
205
|
+
<path opacity="0.1" d="M250.832 115.006C249.11 116.287 247.711 117.953 246.747 119.87C245.782 121.788 245.279 123.904 245.277 126.05V263.742C245.281 267.403 246.737 270.913 249.326 273.502C251.915 276.091 255.425 277.547 259.086 277.551H320.264C322.585 277.542 324.895 277.24 327.14 276.651C323.01 278.99 318.344 280.218 313.598 280.217H252.421C248.759 280.213 245.249 278.757 242.66 276.168C240.072 273.579 238.615 270.069 238.611 266.408V128.716C238.616 125.331 239.863 122.065 242.116 119.538C244.368 117.011 247.469 115.399 250.832 115.006Z" fill="black"/>
|
|
206
|
+
<path d="M220.614 180.899C227.977 180.899 233.945 173.439 233.945 164.235C233.945 155.032 227.977 147.571 220.614 147.571C213.251 147.571 207.282 155.032 207.282 164.235C207.282 173.439 213.251 180.899 220.614 180.899Z" fill="#D6D6D6"/>
|
|
207
|
+
<path opacity="0.2" d="M229.946 164.235C229.946 156.173 225.366 149.45 219.281 147.905C220.152 147.684 221.048 147.571 221.947 147.571C229.31 147.571 235.278 155.032 235.278 164.235C235.278 173.439 229.31 180.9 221.947 180.9C221.048 180.899 220.152 180.787 219.281 180.565C225.366 179.021 229.946 172.297 229.946 164.235Z" fill="black"/>
|
|
208
|
+
<path d="M217.948 206.895V241.556C217.948 242.794 218.439 243.981 219.314 244.856C220.189 245.731 221.376 246.222 222.614 246.222C223.851 246.222 225.038 245.731 225.913 244.856C226.788 243.981 227.28 242.794 227.28 241.556V206.895C227.28 205.657 226.788 204.47 225.913 203.595C225.038 202.72 223.851 202.229 222.614 202.229C221.376 202.229 220.189 202.72 219.314 203.595C218.439 204.47 217.948 205.657 217.948 206.895Z" fill="#D6D6D6"/>
|
|
209
|
+
<path opacity="0.2" d="M225.28 241.556V206.895C225.276 205.893 224.95 204.92 224.35 204.119C223.749 203.317 222.907 202.731 221.947 202.446C222.378 202.308 222.828 202.235 223.28 202.229C224.517 202.23 225.703 202.722 226.578 203.597C227.453 204.472 227.945 205.657 227.946 206.895V241.556C227.945 242.793 227.453 243.979 226.578 244.854C225.703 245.729 224.517 246.221 223.28 246.222C222.828 246.216 222.378 246.143 221.947 246.005C222.907 245.72 223.749 245.134 224.35 244.332C224.95 243.531 225.276 242.558 225.28 241.556Z" fill="black"/>
|
|
210
|
+
<path d="M151.29 278.218C154.972 278.218 157.956 275.234 157.956 271.552C157.956 267.871 154.972 264.887 151.29 264.887C147.609 264.887 144.624 267.871 144.624 271.552C144.624 275.234 147.609 278.218 151.29 278.218Z" fill="white"/>
|
|
211
|
+
<path opacity="0.3" d="M155.29 271.552C155.289 270.016 154.759 268.527 153.787 267.337C152.815 266.147 151.462 265.329 149.957 265.021C150.925 264.824 151.926 264.844 152.885 265.081C153.845 265.317 154.74 265.765 155.505 266.39C156.27 267.015 156.887 267.802 157.311 268.695C157.735 269.588 157.954 270.564 157.954 271.552C157.954 272.541 157.735 273.517 157.311 274.41C156.887 275.302 156.27 276.09 155.505 276.715C154.74 277.34 153.845 277.787 152.885 278.024C151.926 278.261 150.925 278.281 149.957 278.084C151.462 277.776 152.815 276.958 153.787 275.768C154.759 274.578 155.289 273.089 155.29 271.552Z" fill="black"/>
|
|
212
|
+
<path d="M148.284 251.766C151.966 251.766 154.95 248.782 154.95 245.1C154.95 241.419 151.966 238.435 148.284 238.435C144.603 238.435 141.618 241.419 141.618 245.1C141.618 248.782 144.603 251.766 148.284 251.766Z" fill="white"/>
|
|
213
|
+
<path opacity="0.3" d="M152.284 245.1C152.283 243.564 151.753 242.075 150.781 240.885C149.809 239.694 148.456 238.876 146.951 238.569C147.919 238.371 148.92 238.392 149.879 238.629C150.839 238.865 151.734 239.312 152.499 239.938C153.264 240.563 153.881 241.35 154.305 242.243C154.729 243.136 154.948 244.112 154.948 245.1C154.948 246.089 154.729 247.065 154.305 247.957C153.881 248.85 153.264 249.638 152.499 250.263C151.734 250.888 150.839 251.335 149.879 251.572C148.92 251.809 147.919 251.829 146.951 251.632C148.456 251.324 149.809 250.506 150.781 249.316C151.753 248.126 152.283 246.637 152.284 245.1Z" fill="black"/>
|
|
214
|
+
<path d="M155.29 130.239C158.971 130.239 161.955 127.254 161.955 123.573C161.955 119.892 158.971 116.907 155.29 116.907C151.608 116.907 148.624 119.892 148.624 123.573C148.624 127.254 151.608 130.239 155.29 130.239Z" fill="white"/>
|
|
215
|
+
<path opacity="0.3" d="M159.289 123.573C159.289 122.037 158.758 120.547 157.786 119.357C156.815 118.167 155.462 117.349 153.956 117.042C154.925 116.844 155.925 116.865 156.885 117.101C157.844 117.338 158.739 117.785 159.504 118.41C160.27 119.035 160.887 119.823 161.31 120.716C161.734 121.609 161.954 122.585 161.954 123.573C161.954 124.561 161.734 125.537 161.31 126.43C160.887 127.323 160.27 128.111 159.504 128.736C158.739 129.361 157.844 129.808 156.885 130.045C155.925 130.281 154.925 130.302 153.956 130.104C155.462 129.797 156.815 128.979 157.786 127.789C158.758 126.599 159.289 125.109 159.289 123.573Z" fill="black"/>
|
|
216
|
+
<path opacity="0.2" d="M293.196 217.389C300.559 217.389 306.528 209.928 306.528 200.724C306.528 191.521 300.559 184.06 293.196 184.06C285.833 184.06 279.865 191.521 279.865 200.724C279.865 209.928 285.833 217.389 293.196 217.389Z" fill="white"/>
|
|
217
|
+
<path opacity="0.2" d="M293.196 231.862C306.954 231.862 318.106 217.921 318.106 200.724C318.106 183.527 306.954 169.586 293.196 169.586C279.439 169.586 268.286 183.527 268.286 200.724C268.286 217.921 279.439 231.862 293.196 231.862Z" fill="white"/>
|
|
218
|
+
<path opacity="0.2" d="M293.196 247.637C313.923 247.637 330.726 226.634 330.726 200.725C330.726 174.816 313.923 153.812 293.196 153.812C272.469 153.812 255.666 174.816 255.666 200.725C255.666 226.634 272.469 247.637 293.196 247.637Z" fill="white"/>
|
|
219
|
+
</svg>
|
|
220
|
+
`;
|
|
221
|
+
const noDataChildren = /*#__PURE__*/ jsxRuntime.jsx(NoDataState.default, {
|
|
222
|
+
elementType: "secondary",
|
|
223
|
+
description: "Catch your customer's attention with attracted media.",
|
|
224
|
+
descriptionActions: [
|
|
225
|
+
{
|
|
226
|
+
text: 'Add image',
|
|
227
|
+
callback: redirectProductShopifyLink
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
text: 'sync data',
|
|
231
|
+
callback: 'syncProduct'
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
additionalMedia: svg
|
|
235
|
+
});
|
|
236
|
+
const { wrapperClasses } = getProductImagesClassName.getProductImagesClassName(props);
|
|
237
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
238
|
+
...builderAttrs,
|
|
239
|
+
className: wrapperClasses,
|
|
240
|
+
style: style,
|
|
241
|
+
children: [
|
|
242
|
+
/*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
243
|
+
dangerouslySetInnerHTML: {
|
|
244
|
+
__html: getBorderActiveCss.getBorderActiveCss({
|
|
245
|
+
settings: {
|
|
246
|
+
...setting,
|
|
247
|
+
...styles
|
|
248
|
+
},
|
|
249
|
+
uid: builderProps?.uid,
|
|
250
|
+
type: 'React'
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
}),
|
|
254
|
+
LAYOUT_FEATURE_IMAGE_GALLERY.includes(layout) && /*#__PURE__*/ jsxRuntime.jsx(FeatureImageWithGallery.default, {
|
|
255
|
+
...productImageProps,
|
|
256
|
+
gallery: gallery,
|
|
257
|
+
priorityFeatureImage: priorityFeatureImage,
|
|
258
|
+
onHandleClickImage: (imageID, enableOpenLightBox)=>handleGalleryClick(imageID || '', enableOpenLightBox),
|
|
259
|
+
noDataChildren: noDataChildren,
|
|
260
|
+
children: renderProductBadge()
|
|
261
|
+
}),
|
|
262
|
+
layout === 'only-feature' && /*#__PURE__*/ jsxRuntime.jsx(OnlyFeatureImage.default, {
|
|
263
|
+
gallery: gallery,
|
|
264
|
+
...productImageProps,
|
|
265
|
+
onHandleClickImage: (imageID, enableOpenLightBox)=>handleGalleryClick(imageID || '', enableOpenLightBox),
|
|
266
|
+
noDataChildren: noDataChildren,
|
|
267
|
+
children: renderProductBadge()
|
|
268
|
+
}),
|
|
269
|
+
[
|
|
270
|
+
'one-col',
|
|
271
|
+
'two-col'
|
|
272
|
+
].includes(layout) && /*#__PURE__*/ jsxRuntime.jsx(GalleryGrid.default, {
|
|
273
|
+
gallery: gallery,
|
|
274
|
+
...productImageProps,
|
|
275
|
+
onHandleClickImage: (imageID, enableOpenLightBox)=>handleGalleryClick(imageID || '', enableOpenLightBox),
|
|
276
|
+
noDataChildren: noDataChildren,
|
|
277
|
+
children: renderProductBadge()
|
|
278
|
+
}),
|
|
279
|
+
isRenderLightBox && /*#__PURE__*/ jsxRuntime.jsx(ProductImagesLightBox.default, {
|
|
280
|
+
productImages: gallery,
|
|
281
|
+
builderPropUID: builderProps?.uid,
|
|
282
|
+
open: openLightBox,
|
|
283
|
+
onHandleClose: ()=>setOpenLightBox(false),
|
|
284
|
+
imageRatio: common.getAspectRatio(styles?.ftShape)
|
|
285
|
+
}),
|
|
286
|
+
core.filterToolbarPreview(children, true)
|
|
287
|
+
]
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
exports.default = ProductImagesV3;
|