@gem-sdk/components 2.0.0-dev.288 → 2.0.0-dev.293
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/accordion/components/common/styles.js +1 -2
- package/dist/cjs/banner/components/HeroBannerItem.liquid.js +1 -1
- package/dist/cjs/carousel/components/Carousel.js +2 -3
- package/dist/cjs/carousel/components/CarouselItem.js +6 -2
- package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +1 -1
- package/dist/cjs/grid/row/commons/getAttr.js +3 -2
- package/dist/cjs/post-purchase/button/setting/configs/settings.js +10 -8
- package/dist/cjs/post-purchase/callout-banner/components/CalloutText.js +1 -2
- package/dist/cjs/post-purchase/callout-banner/components/common/getStyles.js +8 -0
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +3 -3
- package/dist/cjs/post-purchase/countdown-timer/settings/config/setting.js +2 -1
- package/dist/cjs/product/components/FileUpload/components/common/index.js +1 -1
- package/dist/cjs/product/components/Product.js +3 -3
- package/dist/cjs/product/components/Product.liquid.js +1 -1
- package/dist/cjs/product/components/ProductImagesV2/jsx/ProductImages.js +1 -5
- package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductFeatureVideo.js +36 -0
- package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageOnly.js +83 -51
- package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductGalleryCarousel.js +3 -1
- package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductGalleryGrid.js +3 -2
- package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductImagesLightBox.js +29 -11
- package/dist/cjs/product/setting/product-image-v2/ProductFeatureImage.js +0 -363
- package/dist/cjs/product/setting/product-image-v2/ProductGalleryImage.js +0 -493
- package/dist/cjs/product/setting/product-image-v2/ProductImages.js +1 -3
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +2 -5
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/index.js +4 -7
- package/dist/cjs/setting.js +2 -2
- package/dist/cjs/video/components/Video.js +1 -1
- package/dist/esm/accordion/components/common/styles.js +1 -2
- package/dist/esm/banner/components/HeroBannerItem.liquid.js +1 -1
- package/dist/esm/carousel/components/Carousel.js +2 -3
- package/dist/esm/carousel/components/CarouselItem.js +6 -2
- package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +1 -1
- package/dist/esm/grid/row/commons/getAttr.js +3 -2
- package/dist/esm/post-purchase/button/setting/configs/settings.js +10 -8
- package/dist/esm/post-purchase/callout-banner/components/CalloutText.js +2 -3
- package/dist/esm/post-purchase/callout-banner/components/common/getStyles.js +8 -1
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +3 -3
- package/dist/esm/post-purchase/countdown-timer/settings/config/setting.js +2 -1
- package/dist/esm/product/components/FileUpload/components/common/index.js +1 -1
- package/dist/esm/product/components/Product.js +3 -3
- package/dist/esm/product/components/Product.liquid.js +1 -1
- package/dist/esm/product/components/ProductImagesV2/jsx/ProductImages.js +1 -5
- package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductFeatureVideo.js +32 -0
- package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageOnly.js +84 -52
- package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductGalleryCarousel.js +3 -1
- package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductGalleryGrid.js +3 -2
- package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductImagesLightBox.js +31 -13
- package/dist/esm/product/setting/product-image-v2/ProductFeatureImage.js +1 -361
- package/dist/esm/product/setting/product-image-v2/ProductGalleryImage.js +1 -492
- package/dist/esm/product/setting/product-image-v2/ProductImages.js +1 -3
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +2 -5
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/index.js +4 -7
- package/dist/esm/setting.js +2 -2
- package/dist/esm/video/components/Video.js +2 -2
- package/dist/types/index.d.ts +2 -0
- package/package.json +2 -2
- package/dist/cjs/product/setting/product-image-v2/configs/settings.js +0 -327
- package/dist/esm/product/setting/product-image-v2/configs/settings.js +0 -325
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createAttr } from '@gem-sdk/system';
|
|
2
2
|
|
|
3
3
|
const getAttr = (props)=>{
|
|
4
|
-
const { builderProps, setting } = props;
|
|
4
|
+
const { builderProps, setting, customAttrs } = props;
|
|
5
5
|
const rowAttr = createAttr({
|
|
6
6
|
'data-id': builderProps?.uidInteraction ?? builderProps?.uid ?? '',
|
|
7
|
-
id: builderProps?.uid ?? ''
|
|
7
|
+
id: builderProps?.uid ?? '',
|
|
8
|
+
...customAttrs
|
|
8
9
|
});
|
|
9
10
|
const sectionAttr = createAttr({
|
|
10
11
|
'data-same-height-display-contents': !!setting?.allowSameHeight
|
|
@@ -20,25 +20,27 @@ const DeclineButtonSettings = [
|
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
id: 'buttonType',
|
|
23
|
+
type: 'layout-selector',
|
|
23
24
|
label: 'Style',
|
|
24
|
-
|
|
25
|
-
iconViewBox: '0 0 120 72',
|
|
25
|
+
iconViewBox: '0 0 80 48',
|
|
26
26
|
enableItemBackground: true,
|
|
27
27
|
itemPerRow: 2,
|
|
28
28
|
itemSpacing: 'large',
|
|
29
|
+
default: 'secondary',
|
|
29
30
|
options: [
|
|
30
31
|
{
|
|
31
|
-
label: '
|
|
32
|
+
label: 'Outline',
|
|
32
33
|
value: 'secondary',
|
|
33
|
-
type: 'post-purchase-button'
|
|
34
|
+
type: 'post-purchase-button',
|
|
35
|
+
iconName: 'gp-secondary-button'
|
|
34
36
|
},
|
|
35
37
|
{
|
|
36
|
-
label: 'link',
|
|
38
|
+
label: 'Text link',
|
|
37
39
|
value: 'link',
|
|
38
|
-
type: 'post-purchase-button'
|
|
40
|
+
type: 'post-purchase-button',
|
|
41
|
+
iconName: 'gp-link-button'
|
|
39
42
|
}
|
|
40
|
-
]
|
|
41
|
-
default: 'secondary'
|
|
43
|
+
]
|
|
42
44
|
}
|
|
43
45
|
]
|
|
44
46
|
},
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { makeStyleResponsive } from '@gem-sdk/core';
|
|
4
3
|
import Text from '../../text/components/Text.js';
|
|
5
4
|
import { createClass, createStyle, createAttr } from '@gem-sdk/system';
|
|
6
5
|
import { getCalloutTextWrapperClasses } from './common/getClasses.js';
|
|
7
|
-
import { getCalloutTextStyle, getTextStyles } from './common/getStyles.js';
|
|
6
|
+
import { makeStyleResponsiveWidth, getCalloutTextStyle, getTextStyles } from './common/getStyles.js';
|
|
8
7
|
|
|
9
8
|
const CalloutText = ({ setting = {}, styles = {}, style, builderAttrs, builderProps, children })=>{
|
|
10
9
|
const { width, align } = styles;
|
|
@@ -16,7 +15,7 @@ const CalloutText = ({ setting = {}, styles = {}, style, builderAttrs, builderPr
|
|
|
16
15
|
})
|
|
17
16
|
});
|
|
18
17
|
const containerStyle = createStyle({
|
|
19
|
-
...
|
|
18
|
+
...makeStyleResponsiveWidth(width)
|
|
20
19
|
});
|
|
21
20
|
const textStyles = {
|
|
22
21
|
...getTextStyles(styles)
|
|
@@ -29,6 +29,13 @@ var CalloutBorderColorEnum;
|
|
|
29
29
|
CalloutBorderColorEnum["critical"] = '#facccc';
|
|
30
30
|
CalloutBorderColorEnum["none"] = '#D9D9D9';
|
|
31
31
|
})(CalloutBorderColorEnum || (CalloutBorderColorEnum = {}));
|
|
32
|
+
const makeStyleResponsiveWidth = (value, unit)=>{
|
|
33
|
+
return {
|
|
34
|
+
[`--w`]: unit ? `${value?.desktop}${unit}` : value?.desktop === 'default' ? '1200px' : value?.desktop,
|
|
35
|
+
[`--w-tablet`]: unit ? `${value?.tablet}${unit}` : value?.tablet === 'default' ? '1200px' : value?.tablet,
|
|
36
|
+
[`--w-mobile`]: unit ? `${value?.mobile}${unit}` : value?.mobile === 'default' ? '1200px' : value?.mobile
|
|
37
|
+
};
|
|
38
|
+
};
|
|
32
39
|
const getCalloutBoxContainerStyles = (styles)=>{
|
|
33
40
|
return filterTruthyStyles({
|
|
34
41
|
backgroundColor: styles?.backgroundColor ? CalloutBgColorEnum[styles?.backgroundColor] : '#FAFAFA',
|
|
@@ -36,4 +43,4 @@ const getCalloutBoxContainerStyles = (styles)=>{
|
|
|
36
43
|
});
|
|
37
44
|
};
|
|
38
45
|
|
|
39
|
-
export { getCalloutBoxContainerStyles, getCalloutTextStyle, getTextStyles };
|
|
46
|
+
export { getCalloutBoxContainerStyles, getCalloutTextStyle, getTextStyles, makeStyleResponsiveWidth };
|
|
@@ -92,13 +92,13 @@ const CalloutTextSettings = [
|
|
|
92
92
|
hideUnit: false,
|
|
93
93
|
devices: {
|
|
94
94
|
desktop: {
|
|
95
|
-
default: '
|
|
95
|
+
default: 'default'
|
|
96
96
|
},
|
|
97
97
|
tablet: {
|
|
98
|
-
default: '
|
|
98
|
+
default: 'default'
|
|
99
99
|
},
|
|
100
100
|
mobile: {
|
|
101
|
-
default: '
|
|
101
|
+
default: 'default'
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
displayOptions: [
|
|
@@ -24,6 +24,7 @@ import '../../../../../post-purchase/product/components/product-variant/componen
|
|
|
24
24
|
import '../../../Product.js';
|
|
25
25
|
import '../../../../../notification/components/Notifications.js';
|
|
26
26
|
import '../../../../../notification/components/Notice.js';
|
|
27
|
+
import '../../../../../video/components/Video.js';
|
|
27
28
|
import '../../../ProductQuickView/index.js';
|
|
28
29
|
import '../../../constants/product-bundle.js';
|
|
29
30
|
import '../../../ProductList.js';
|
|
@@ -33,7 +34,6 @@ import '../../../ProductBadge/constants.js';
|
|
|
33
34
|
import '../../../ProductBadge/utils/shape.js';
|
|
34
35
|
import '../../../ProductBadge/types.js';
|
|
35
36
|
import '../../../../../textarea/Textarea.js';
|
|
36
|
-
import '../../../../../video/components/Video.js';
|
|
37
37
|
import '../../../../../third-party/components/JudgemeReviews.js';
|
|
38
38
|
import '../../../../../third-party/components/LooxReviews.js';
|
|
39
39
|
import '../../../../../third-party/components/Klaviyo.js';
|
|
@@ -98,9 +98,9 @@ const LocalProduct = ({ children, productSetting, quantity, readOnly, rowSetting
|
|
|
98
98
|
style: style,
|
|
99
99
|
setting: rowSetting,
|
|
100
100
|
styles: rowStyles,
|
|
101
|
-
|
|
102
|
-
'data-product-id': product?.baseID?.replace('gid://shopify/Product/', '')
|
|
103
|
-
} :
|
|
101
|
+
customAttrs: mode === 'edit' ? {
|
|
102
|
+
'data-product-id': product?.baseID?.replace('gid://shopify/Product/', '') ?? ''
|
|
103
|
+
} : undefined,
|
|
104
104
|
children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
|
|
105
105
|
})
|
|
106
106
|
}, `uid-${product.id}-${initialVariantId ?? ''}`)
|
|
@@ -98,7 +98,7 @@ const Product = ({ children, setting, styles, style, builderProps, rawChildren,
|
|
|
98
98
|
{%- endif -%}
|
|
99
99
|
<gp-product data-uid="${builderProps?.uid}" data-id="${builderProps?.uid}" style="${{
|
|
100
100
|
...advancedStyle
|
|
101
|
-
}}" class="${advanced?.cssClass}" gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${preSelectedOptionIds}], "isSyncProduct": "${isSyncProduct}", "variantSelected": {{ variant | json | escape }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
101
|
+
}}" class="${advanced?.cssClass}" gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${preSelectedOptionIds}], "isSyncProduct": "${isSyncProduct}", "variantSelected": {{ variant | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
102
102
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }}}'>
|
|
103
103
|
<product-form class="product-form">
|
|
104
104
|
{%- form 'product', product, id: product_form_id, class: 'form contents', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
@@ -6,7 +6,6 @@ import { useMemo, useState, useEffect, Children, isValidElement } from 'react';
|
|
|
6
6
|
import FeatureImageWithGallery from './layouts/FeatureImageWithGallery.js';
|
|
7
7
|
import OnlyFeatureImage from './layouts/OnlyFeatureImage.js';
|
|
8
8
|
import ProductImagesLightBox from './components/ProductImagesLightBox.js';
|
|
9
|
-
import { isFeatureMedia } from '../common/productFeaturedImage.js';
|
|
10
9
|
import NoDataState from '../../../../common/components/NoDataState.js';
|
|
11
10
|
import { getProductImagesClassName } from '../composables/getProductImagesClassName.js';
|
|
12
11
|
import { getBorderActiveCss } from '../common/getBorderActiveCss.js';
|
|
@@ -87,10 +86,7 @@ const ProductImagesV2 = (props)=>{
|
|
|
87
86
|
currentVariant?.media
|
|
88
87
|
]);
|
|
89
88
|
const gallery = useMemo(()=>{
|
|
90
|
-
const images = getProductGallery(product)
|
|
91
|
-
if (item) item.src = isFeatureMedia(item.contentType) ? item?.previewImage : item.src;
|
|
92
|
-
return item;
|
|
93
|
-
});
|
|
89
|
+
const images = getProductGallery(product);
|
|
94
90
|
if (!images?.length) return [
|
|
95
91
|
{
|
|
96
92
|
id: product?.featuredImage?.id || 'noImageError',
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
|
+
import 'next/link';
|
|
4
|
+
import '@gem-sdk/core';
|
|
5
|
+
import Video from '../../../../../video/components/Video.js';
|
|
6
|
+
|
|
7
|
+
const ProductFeatureVideo = (props)=>{
|
|
8
|
+
const { url, aspectRatio } = props;
|
|
9
|
+
const videoType = useMemo(()=>{
|
|
10
|
+
if (url.includes('youtu.be')) return 'youtube';
|
|
11
|
+
if (url.includes('vimeo')) return 'vimeo';
|
|
12
|
+
return 'html5';
|
|
13
|
+
}, [
|
|
14
|
+
url
|
|
15
|
+
]);
|
|
16
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
17
|
+
children: /*#__PURE__*/ jsx(Video, {
|
|
18
|
+
setting: {
|
|
19
|
+
type: videoType,
|
|
20
|
+
html5Url: url,
|
|
21
|
+
youtubeUrl: url,
|
|
22
|
+
vimeoUrl: url,
|
|
23
|
+
preload: true,
|
|
24
|
+
controls: true,
|
|
25
|
+
aspectRatio
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var ProductFeatureVideo$1 = /*#__PURE__*/ memo(ProductFeatureVideo);
|
|
31
|
+
|
|
32
|
+
export { ProductFeatureVideo$1 as default };
|
package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageOnly.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { useProduct, useCurrentDevice, useShopStore, getResponsiveValueByScreen, cls, makeStyle } from '@gem-sdk/core';
|
|
3
|
+
import { useProduct, useCurrentDevice, useShopStore, useEditorMode, getResponsiveValueByScreen, cls, makeStyle } from '@gem-sdk/core';
|
|
4
4
|
import { memo, useMemo } from 'react';
|
|
5
5
|
import NextImage from '../../../../../image/components/NextImage.js';
|
|
6
6
|
import MediaIcon from './MediaIcon.js';
|
|
7
7
|
import { isFeatureMedia, getZoomImageClass, getZoomLenClass } from '../../common/productFeaturedImage.js';
|
|
8
|
+
import ProductFeatureVideo from './ProductFeatureVideo.js';
|
|
8
9
|
|
|
9
10
|
const defaultImage = {
|
|
10
11
|
src: 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif',
|
|
@@ -18,14 +19,28 @@ const ProductFeaturedImageOnly = ({ image, imageShowWhenHover, setting, aspectRa
|
|
|
18
19
|
const product = useProduct();
|
|
19
20
|
const currentDevice = useCurrentDevice();
|
|
20
21
|
const storefrontUrl = useShopStore((state)=>state.storefrontUrl);
|
|
22
|
+
const mode = useEditorMode();
|
|
23
|
+
const isClickEffect = useMemo(()=>getResponsiveValueByScreen(setting.ftClickOpenLightBox, currentDevice) !== 'none', [
|
|
24
|
+
currentDevice,
|
|
25
|
+
setting.ftClickOpenLightBox
|
|
26
|
+
]);
|
|
27
|
+
const isRenderVideo = useMemo(()=>mode !== 'edit' && [
|
|
28
|
+
'VIDEO',
|
|
29
|
+
'EXTERNAL_VIDEO'
|
|
30
|
+
].includes(image?.contentType || '') && !isClickEffect, [
|
|
31
|
+
mode,
|
|
32
|
+
image?.contentType,
|
|
33
|
+
isClickEffect
|
|
34
|
+
]);
|
|
21
35
|
const renderImage = useMemo(()=>{
|
|
22
36
|
if (!image) return defaultImage;
|
|
23
37
|
return {
|
|
24
38
|
...image,
|
|
25
|
-
src: isFeatureMedia(image?.contentType) ? image?.previewImage : image.src
|
|
39
|
+
src: isRenderVideo ? image.src : isFeatureMedia(image?.contentType) ? image?.previewImage : image.src
|
|
26
40
|
};
|
|
27
41
|
}, [
|
|
28
|
-
image
|
|
42
|
+
image,
|
|
43
|
+
isRenderVideo
|
|
29
44
|
]);
|
|
30
45
|
const shopifyProductLink = useMemo(()=>{
|
|
31
46
|
if (!storefrontUrl) return `#`;
|
|
@@ -53,56 +68,73 @@ const ProductFeaturedImageOnly = ({ image, imageShowWhenHover, setting, aspectRa
|
|
|
53
68
|
currentDevice,
|
|
54
69
|
setting.ftActionEnable
|
|
55
70
|
]);
|
|
71
|
+
const isRenderHoverImage = useMemo(()=>enableHoverAction && setting?.hoverEffect !== 'none' && !isFeatureMedia(renderImage?.contentType), [
|
|
72
|
+
enableHoverAction,
|
|
73
|
+
renderImage?.contentType,
|
|
74
|
+
setting?.hoverEffect
|
|
75
|
+
]);
|
|
76
|
+
const isZoomImage = useMemo(()=>enableHoverAction && setting?.hoverEffect == 'zoom' && setting?.zoomType == 'glasses' && !isFeatureMedia(renderImage?.contentType), [
|
|
77
|
+
enableHoverAction,
|
|
78
|
+
renderImage?.contentType,
|
|
79
|
+
setting?.hoverEffect,
|
|
80
|
+
setting?.zoomType
|
|
81
|
+
]);
|
|
56
82
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
57
|
-
children: handleProductLink(/*#__PURE__*/
|
|
58
|
-
children:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
83
|
+
children: handleProductLink(/*#__PURE__*/ jsx(Fragment, {
|
|
84
|
+
children: isRenderVideo ? /*#__PURE__*/ jsx(ProductFeatureVideo, {
|
|
85
|
+
type: renderImage?.contentType,
|
|
86
|
+
url: renderImage.src ?? '',
|
|
87
|
+
aspectRatio: aspectRatio
|
|
88
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
89
|
+
children: [
|
|
90
|
+
/*#__PURE__*/ jsx(NextImage, {
|
|
91
|
+
draggable: "false",
|
|
92
|
+
src: renderImage.src,
|
|
93
|
+
width: renderImage?.width,
|
|
94
|
+
height: renderImage?.height,
|
|
95
|
+
alt: renderImage?.alt,
|
|
96
|
+
setting: {
|
|
97
|
+
aspectRatio: aspectRatio,
|
|
98
|
+
layout: setting?.ftLayout
|
|
99
|
+
},
|
|
100
|
+
priority: setting?.preload,
|
|
101
|
+
className: "featured-image-only",
|
|
102
|
+
style: {
|
|
103
|
+
width: '100%',
|
|
104
|
+
height: '100%',
|
|
105
|
+
cursor: 'pointer'
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
/*#__PURE__*/ jsx(MediaIcon, {
|
|
109
|
+
contentType: renderImage?.contentType ?? ''
|
|
110
|
+
}),
|
|
111
|
+
isRenderHoverImage && /*#__PURE__*/ jsx(NextImage, {
|
|
112
|
+
draggable: "false",
|
|
113
|
+
src: setting?.hoverEffect === 'other' ? imageShowWhenHover?.src : renderImage.src,
|
|
114
|
+
width: setting?.hoverEffect === 'other' ? imageShowWhenHover?.width : renderImage.width,
|
|
115
|
+
height: setting?.hoverEffect === 'other' ? imageShowWhenHover?.height : renderImage.height,
|
|
116
|
+
alt: setting?.hoverEffect === 'other' ? imageShowWhenHover?.alt : renderImage.alt,
|
|
117
|
+
setting: {
|
|
118
|
+
layout: setting.ftLayout,
|
|
119
|
+
aspectRatio: aspectRatio
|
|
120
|
+
},
|
|
121
|
+
style: {
|
|
122
|
+
width: '100%',
|
|
123
|
+
height: '100%'
|
|
124
|
+
},
|
|
125
|
+
className: cls('hover-image featured-image-only !gp-max-w-none', getZoomImageClass()),
|
|
126
|
+
priority: setting?.preload
|
|
127
|
+
}),
|
|
128
|
+
isZoomImage && /*#__PURE__*/ jsx("div", {
|
|
129
|
+
className: cls(getZoomLenClass(), 'room-len'),
|
|
130
|
+
style: {
|
|
131
|
+
...makeStyle({
|
|
132
|
+
bgi: `url("${renderImage?.src}")`
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
})
|
|
106
138
|
}))
|
|
107
139
|
});
|
|
108
140
|
};
|
package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductGalleryCarousel.js
CHANGED
|
@@ -14,6 +14,7 @@ import { useFilterImagesByVariant } from '../hooks/useFilterImagesByVariant.js';
|
|
|
14
14
|
import { getProductImagesClassName } from '../../composables/getProductImagesClassName.js';
|
|
15
15
|
import { getProductImagesStyles } from '../../composables/getProductImagesStyles.js';
|
|
16
16
|
import { getProductImagesAttr } from '../../composables/getProductImagesAttr.js';
|
|
17
|
+
import { isFeatureMedia } from '../../common/productFeaturedImage.js';
|
|
17
18
|
|
|
18
19
|
const ProductGalleryCarousel = ({ builderPropUID, productImages, onHandleClick, activeIndexFormFeatureImage, onClickFeatureArrow, builderPropsClass, arrow, priorityFeatureImage, ...setting })=>{
|
|
19
20
|
const currentDevice = useCurrentDevice();
|
|
@@ -147,6 +148,7 @@ const ProductGalleryCarousel = ({ builderPropUID, productImages, onHandleClick,
|
|
|
147
148
|
disableMarginAuto: true,
|
|
148
149
|
children: filteredProductImages?.map((image, index)=>{
|
|
149
150
|
const canActive = index === moveToIdx;
|
|
151
|
+
const imageSrc = isFeatureMedia(image.contentType) ? image.previewImage : image.src;
|
|
150
152
|
return /*#__PURE__*/ jsxs(CarouselItem, {
|
|
151
153
|
contentType: "productImage",
|
|
152
154
|
className: galleryItemClasses(`gem-slider-item-${builderPropUID} ${canActive && isEnableBorderActive ? 'gem-slider-item-active' : ''}`),
|
|
@@ -159,7 +161,7 @@ const ProductGalleryCarousel = ({ builderPropUID, productImages, onHandleClick,
|
|
|
159
161
|
children: [
|
|
160
162
|
/*#__PURE__*/ jsx(NextImage, {
|
|
161
163
|
draggable: "false",
|
|
162
|
-
src:
|
|
164
|
+
src: imageSrc,
|
|
163
165
|
width: image?.width,
|
|
164
166
|
height: image?.height,
|
|
165
167
|
alt: image?.alt,
|
|
@@ -119,6 +119,7 @@ const ProductGalleryGrid = ({ builderPropUID, productImages, onHandleClick, acti
|
|
|
119
119
|
children: [
|
|
120
120
|
filteredProductImages?.map((image, index)=>{
|
|
121
121
|
const canActive = index === imageActiveIndex;
|
|
122
|
+
const imageSrc = isFeatureMedia(image.contentType) ? image.previewImage : image.src;
|
|
122
123
|
return(// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
123
124
|
/*#__PURE__*/ jsxs("div", {
|
|
124
125
|
"aria-hidden": true,
|
|
@@ -135,7 +136,7 @@ const ProductGalleryGrid = ({ builderPropUID, productImages, onHandleClick, acti
|
|
|
135
136
|
"data-border": canActive && !!setting?.borderActive && setting?.activeEffectEnable ? 'active' : 'deactive',
|
|
136
137
|
children: [
|
|
137
138
|
/*#__PURE__*/ jsx(NextImage, {
|
|
138
|
-
src:
|
|
139
|
+
src: imageSrc,
|
|
139
140
|
width: image?.width,
|
|
140
141
|
height: image?.height,
|
|
141
142
|
alt: image?.alt,
|
|
@@ -152,7 +153,7 @@ const ProductGalleryGrid = ({ builderPropUID, productImages, onHandleClick, acti
|
|
|
152
153
|
contentType: image?.contentType || ''
|
|
153
154
|
}),
|
|
154
155
|
setting?.galleryHoverEffect !== 'none' && !isFeatureMedia(image?.contentType) && /*#__PURE__*/ jsx(NextImage, {
|
|
155
|
-
src:
|
|
156
|
+
src: imageSrc,
|
|
156
157
|
width: image?.width,
|
|
157
158
|
height: image?.height,
|
|
158
159
|
alt: image?.alt,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useFeaturedImageGlobal, cls } from '@gem-sdk/core';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useFeaturedImageGlobal, useEditorMode, cls } from '@gem-sdk/core';
|
|
4
4
|
import Carousel from '../../../../../carousel/components/Carousel.js';
|
|
5
5
|
import CarouselItem from '../../../../../carousel/components/CarouselItem.js';
|
|
6
6
|
import NextImage from '../../../../../image/components/NextImage.js';
|
|
@@ -8,6 +8,8 @@ import '../../../../../modal/components/confirm.js';
|
|
|
8
8
|
import Modal from '../../../../../modal/components/Modal.js';
|
|
9
9
|
import { useMemo } from 'react';
|
|
10
10
|
import { isFeatureMedia } from '../../common/productFeaturedImage.js';
|
|
11
|
+
import ProductFeatureVideo from './ProductFeatureVideo.js';
|
|
12
|
+
import MediaIcon from './MediaIcon.js';
|
|
11
13
|
|
|
12
14
|
const ProductImagesLightBox = ({ builderPropUID, productImages, open, imageRatio, onHandleClose })=>{
|
|
13
15
|
const featuredImageGlobal = useFeaturedImageGlobal();
|
|
@@ -28,6 +30,11 @@ const ProductImagesLightBox = ({ builderPropUID, productImages, open, imageRatio
|
|
|
28
30
|
mobile: false,
|
|
29
31
|
tablet: false
|
|
30
32
|
};
|
|
33
|
+
const mode = useEditorMode();
|
|
34
|
+
const isRenderVideo = (image)=>mode !== 'edit' && [
|
|
35
|
+
'VIDEO',
|
|
36
|
+
'EXTERNAL_VIDEO'
|
|
37
|
+
].includes(image?.contentType || '');
|
|
31
38
|
return /*#__PURE__*/ jsx(Modal, {
|
|
32
39
|
setting: {
|
|
33
40
|
open: open
|
|
@@ -103,17 +110,28 @@ const ProductImagesLightBox = ({ builderPropUID, productImages, open, imageRatio
|
|
|
103
110
|
fullHeight: true,
|
|
104
111
|
children: productImages?.map((image)=>/*#__PURE__*/ jsx(CarouselItem, {
|
|
105
112
|
className: `gem-slider-item gem-slider-item-${builderPropUID} gp-flex gp-items-center gp-justify-center gp-px-4`,
|
|
106
|
-
children: /*#__PURE__*/
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
children: !isRenderVideo(image) ? /*#__PURE__*/ jsxs(Fragment, {
|
|
114
|
+
children: [
|
|
115
|
+
/*#__PURE__*/ jsx(NextImage, {
|
|
116
|
+
src: isFeatureMedia(image?.contentType) ? image?.previewImage : image?.src,
|
|
117
|
+
width: image?.width,
|
|
118
|
+
height: image?.height,
|
|
119
|
+
alt: image?.alt,
|
|
120
|
+
"content-type": image?.contentType,
|
|
121
|
+
setting: {
|
|
122
|
+
aspectRatio: imageRatio
|
|
123
|
+
},
|
|
124
|
+
className: cls('gp-h-full gp-w-full gp-object-contain')
|
|
125
|
+
}, image?.id),
|
|
126
|
+
/*#__PURE__*/ jsx(MediaIcon, {
|
|
127
|
+
contentType: image?.contentType ?? ''
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
}) : /*#__PURE__*/ jsx(ProductFeatureVideo, {
|
|
131
|
+
type: image?.contentType,
|
|
132
|
+
url: image.src ?? '',
|
|
133
|
+
aspectRatio: imageRatio
|
|
134
|
+
})
|
|
117
135
|
}, image?.id))
|
|
118
136
|
})
|
|
119
137
|
});
|