@gem-sdk/components 2.1.17 → 2.1.19
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.
|
@@ -42,7 +42,6 @@ const ProductImagesV2 = (productImageProps)=>{
|
|
|
42
42
|
const extraClass = advanced?.cssClass;
|
|
43
43
|
// State
|
|
44
44
|
const [openLightBox, setOpenLightBox] = React.useState(false);
|
|
45
|
-
const [hasVariantAvailable, setHasVariantAvailable] = React.useState(true);
|
|
46
45
|
const getFirstVideo = (product)=>{
|
|
47
46
|
return product?.medias?.edges.find((item)=>[
|
|
48
47
|
'VIDEO',
|
|
@@ -57,24 +56,19 @@ const ProductImagesV2 = (productImageProps)=>{
|
|
|
57
56
|
};
|
|
58
57
|
const priorityFeatureImage = React.useMemo(()=>{
|
|
59
58
|
if (setting?.typeDisplay === 'all-images') {
|
|
60
|
-
setHasVariantAvailable(true);
|
|
61
59
|
let priorityItem;
|
|
62
60
|
switch(setting?.preDisplay){
|
|
63
61
|
case '1st-images':
|
|
64
62
|
priorityItem = getFirstImage(product);
|
|
65
|
-
setHasVariantAvailable(false);
|
|
66
63
|
break;
|
|
67
64
|
case '1st-3d-mode':
|
|
68
65
|
priorityItem = getFirst3DModal(product);
|
|
69
|
-
setHasVariantAvailable(false);
|
|
70
66
|
break;
|
|
71
67
|
case '1st-video':
|
|
72
68
|
priorityItem = getFirstVideo(product);
|
|
73
|
-
setHasVariantAvailable(false);
|
|
74
69
|
break;
|
|
75
70
|
case '1st-available-variant':
|
|
76
71
|
priorityItem = currentVariant?.media;
|
|
77
|
-
setHasVariantAvailable(false);
|
|
78
72
|
break;
|
|
79
73
|
}
|
|
80
74
|
setProductFeaturedImage(priorityItem);
|
|
@@ -141,7 +135,7 @@ const ProductImagesV2 = (productImageProps)=>{
|
|
|
141
135
|
}
|
|
142
136
|
};
|
|
143
137
|
React.useEffect(()=>{
|
|
144
|
-
if (currentVariant
|
|
138
|
+
if (currentVariant) {
|
|
145
139
|
const index = galleryIndex[currentVariant?.mediaId];
|
|
146
140
|
if (index !== undefined) {
|
|
147
141
|
const fImage = gallery[index] ?? product?.featuredImage;
|
|
@@ -155,8 +149,7 @@ const ProductImagesV2 = (productImageProps)=>{
|
|
|
155
149
|
galleryIndex,
|
|
156
150
|
gallery,
|
|
157
151
|
product?.featuredImage,
|
|
158
|
-
setProductFeaturedImage
|
|
159
|
-
hasVariantAvailable
|
|
152
|
+
setProductFeaturedImage
|
|
160
153
|
]);
|
|
161
154
|
const isRenderLightBox = React.useMemo(()=>{
|
|
162
155
|
const isRender = core.getResponsiveValueByScreen(setting?.ftClickOpenLightBox, currentDevice) === 'popup' || core.getResponsiveValueByScreen(setting?.clickOpenLightBox, currentDevice);
|
|
@@ -38,7 +38,6 @@ const ProductImagesV2 = (productImageProps)=>{
|
|
|
38
38
|
const extraClass = advanced?.cssClass;
|
|
39
39
|
// State
|
|
40
40
|
const [openLightBox, setOpenLightBox] = useState(false);
|
|
41
|
-
const [hasVariantAvailable, setHasVariantAvailable] = useState(true);
|
|
42
41
|
const getFirstVideo = (product)=>{
|
|
43
42
|
return product?.medias?.edges.find((item)=>[
|
|
44
43
|
'VIDEO',
|
|
@@ -53,24 +52,19 @@ const ProductImagesV2 = (productImageProps)=>{
|
|
|
53
52
|
};
|
|
54
53
|
const priorityFeatureImage = useMemo(()=>{
|
|
55
54
|
if (setting?.typeDisplay === 'all-images') {
|
|
56
|
-
setHasVariantAvailable(true);
|
|
57
55
|
let priorityItem;
|
|
58
56
|
switch(setting?.preDisplay){
|
|
59
57
|
case '1st-images':
|
|
60
58
|
priorityItem = getFirstImage(product);
|
|
61
|
-
setHasVariantAvailable(false);
|
|
62
59
|
break;
|
|
63
60
|
case '1st-3d-mode':
|
|
64
61
|
priorityItem = getFirst3DModal(product);
|
|
65
|
-
setHasVariantAvailable(false);
|
|
66
62
|
break;
|
|
67
63
|
case '1st-video':
|
|
68
64
|
priorityItem = getFirstVideo(product);
|
|
69
|
-
setHasVariantAvailable(false);
|
|
70
65
|
break;
|
|
71
66
|
case '1st-available-variant':
|
|
72
67
|
priorityItem = currentVariant?.media;
|
|
73
|
-
setHasVariantAvailable(false);
|
|
74
68
|
break;
|
|
75
69
|
}
|
|
76
70
|
setProductFeaturedImage(priorityItem);
|
|
@@ -137,7 +131,7 @@ const ProductImagesV2 = (productImageProps)=>{
|
|
|
137
131
|
}
|
|
138
132
|
};
|
|
139
133
|
useEffect(()=>{
|
|
140
|
-
if (currentVariant
|
|
134
|
+
if (currentVariant) {
|
|
141
135
|
const index = galleryIndex[currentVariant?.mediaId];
|
|
142
136
|
if (index !== undefined) {
|
|
143
137
|
const fImage = gallery[index] ?? product?.featuredImage;
|
|
@@ -151,8 +145,7 @@ const ProductImagesV2 = (productImageProps)=>{
|
|
|
151
145
|
galleryIndex,
|
|
152
146
|
gallery,
|
|
153
147
|
product?.featuredImage,
|
|
154
|
-
setProductFeaturedImage
|
|
155
|
-
hasVariantAvailable
|
|
148
|
+
setProductFeaturedImage
|
|
156
149
|
]);
|
|
157
150
|
const isRenderLightBox = useMemo(()=>{
|
|
158
151
|
const isRender = getResponsiveValueByScreen(setting?.ftClickOpenLightBox, currentDevice) === 'popup' || getResponsiveValueByScreen(setting?.clickOpenLightBox, currentDevice);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.19",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"format": "prettier --write \"./src/**/*.{ts,tsx}\""
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@gem-sdk/core": "2.1.
|
|
24
|
+
"@gem-sdk/core": "2.1.18",
|
|
25
25
|
"@gem-sdk/styles": "2.1.0",
|
|
26
26
|
"@types/react-transition-group": "^4.4.5"
|
|
27
27
|
},
|