@gem-sdk/components 2.0.0-dev.289 → 2.0.0-dev.294

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.
Files changed (74) hide show
  1. package/dist/cjs/accordion/components/common/styles.js +1 -2
  2. package/dist/cjs/banner/components/HeroBannerItem.liquid.js +1 -1
  3. package/dist/cjs/carousel/components/Carousel.js +2 -3
  4. package/dist/cjs/carousel/components/CarouselItem.js +6 -2
  5. package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +1 -1
  6. package/dist/cjs/grid/row/commons/getAttr.js +3 -2
  7. package/dist/cjs/image/components/AdaptiveImage.js +1 -1
  8. package/dist/cjs/image/components/AdaptiveImage.liquid.js +4 -4
  9. package/dist/cjs/image/components/Image.js +1 -5
  10. package/dist/cjs/image/components/common/styles.js +2 -2
  11. package/dist/cjs/image/components/helpers/getNextImageLiquidAttrs.js +6 -24
  12. package/dist/cjs/image/components/helpers/getNextImageReactAttrs.js +3 -3
  13. package/dist/cjs/post-purchase/button/setting/configs/settings.js +10 -8
  14. package/dist/cjs/post-purchase/callout-banner/components/CalloutText.js +1 -2
  15. package/dist/cjs/post-purchase/callout-banner/components/common/getStyles.js +8 -0
  16. package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +3 -3
  17. package/dist/cjs/post-purchase/countdown-timer/settings/config/setting.js +2 -1
  18. package/dist/cjs/product/components/FileUpload/components/common/index.js +1 -1
  19. package/dist/cjs/product/components/Product.js +3 -3
  20. package/dist/cjs/product/components/ProductImagesV2/jsx/ProductImages.js +1 -5
  21. package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductFeatureVideo.js +36 -0
  22. package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageOnly.js +83 -51
  23. package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductGalleryCarousel.js +3 -1
  24. package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductGalleryGrid.js +3 -2
  25. package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductImagesLightBox.js +29 -11
  26. package/dist/cjs/product/setting/product/configs/uiV2.js +2 -2
  27. package/dist/cjs/product/setting/product-image-v2/ProductFeatureImage.js +0 -363
  28. package/dist/cjs/product/setting/product-image-v2/ProductGalleryImage.js +0 -493
  29. package/dist/cjs/product/setting/product-image-v2/ProductImages.js +1 -3
  30. package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +2 -5
  31. package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/index.js +4 -7
  32. package/dist/cjs/setting.js +2 -2
  33. package/dist/cjs/third-party/components/RechargeSubscriptions.liquid.js +1 -1
  34. package/dist/cjs/third-party/setting/RechargeSubscriptions.js +5 -2
  35. package/dist/cjs/video/components/Video.js +1 -1
  36. package/dist/esm/accordion/components/common/styles.js +1 -2
  37. package/dist/esm/banner/components/HeroBannerItem.liquid.js +1 -1
  38. package/dist/esm/carousel/components/Carousel.js +2 -3
  39. package/dist/esm/carousel/components/CarouselItem.js +6 -2
  40. package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +1 -1
  41. package/dist/esm/grid/row/commons/getAttr.js +3 -2
  42. package/dist/esm/image/components/AdaptiveImage.js +2 -2
  43. package/dist/esm/image/components/AdaptiveImage.liquid.js +4 -4
  44. package/dist/esm/image/components/Image.js +2 -6
  45. package/dist/esm/image/components/common/styles.js +2 -2
  46. package/dist/esm/image/components/helpers/getNextImageLiquidAttrs.js +6 -24
  47. package/dist/esm/image/components/helpers/getNextImageReactAttrs.js +3 -3
  48. package/dist/esm/post-purchase/button/setting/configs/settings.js +10 -8
  49. package/dist/esm/post-purchase/callout-banner/components/CalloutText.js +2 -3
  50. package/dist/esm/post-purchase/callout-banner/components/common/getStyles.js +8 -1
  51. package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +3 -3
  52. package/dist/esm/post-purchase/countdown-timer/settings/config/setting.js +2 -1
  53. package/dist/esm/product/components/FileUpload/components/common/index.js +1 -1
  54. package/dist/esm/product/components/Product.js +3 -3
  55. package/dist/esm/product/components/ProductImagesV2/jsx/ProductImages.js +1 -5
  56. package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductFeatureVideo.js +32 -0
  57. package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageOnly.js +84 -52
  58. package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductGalleryCarousel.js +3 -1
  59. package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductGalleryGrid.js +3 -2
  60. package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductImagesLightBox.js +31 -13
  61. package/dist/esm/product/setting/product/configs/uiV2.js +2 -2
  62. package/dist/esm/product/setting/product-image-v2/ProductFeatureImage.js +1 -361
  63. package/dist/esm/product/setting/product-image-v2/ProductGalleryImage.js +1 -492
  64. package/dist/esm/product/setting/product-image-v2/ProductImages.js +1 -3
  65. package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductGalleryImage.js +2 -5
  66. package/dist/esm/product/setting/product-image-v2/configs/setting-v2/index.js +4 -7
  67. package/dist/esm/setting.js +2 -2
  68. package/dist/esm/third-party/components/RechargeSubscriptions.liquid.js +1 -1
  69. package/dist/esm/third-party/setting/RechargeSubscriptions.js +5 -2
  70. package/dist/esm/video/components/Video.js +2 -2
  71. package/dist/types/index.d.ts +2 -0
  72. package/package.json +2 -2
  73. package/dist/cjs/product/setting/product-image-v2/configs/settings.js +0 -327
  74. package/dist/esm/product/setting/product-image-v2/configs/settings.js +0 -325
@@ -31,10 +31,10 @@ import '../../post-purchase/product/components/product-variant/components/varian
31
31
  import '../../product/components/Product.js';
32
32
  import '../../notification/components/Notifications.js';
33
33
  import '../../notification/components/Notice.js';
34
+ import '../../video/components/Video.js';
34
35
  import '../../product/components/ProductQuickView/index.js';
35
36
  import '../../product/components/ProductList.js';
36
37
  import '../../textarea/Textarea.js';
37
- import '../../video/components/Video.js';
38
38
  import '../../third-party/components/JudgemeReviews.js';
39
39
  import '../../third-party/components/LooxReviews.js';
40
40
  import '../../third-party/components/Klaviyo.js';
@@ -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
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import { IMAGE_PLACEHOLDER } from './common/constants.js';
4
- import { createAttr, createStyle, createClass } from '@gem-sdk/system';
4
+ import { createAttr, createStyleReact, createStyle, createClass } from '@gem-sdk/system';
5
5
  import { getLoadingAdaptiveImageAttrs } from './common/attributes.js';
6
6
  import { getAdaptiveImageClasses } from './common/classes.js';
7
7
  import { getAdaptiveImageData } from './common/data.js';
@@ -15,7 +15,7 @@ const AdaptiveImage = (props)=>{
15
15
  srcDesktop,
16
16
  enableLazyLoadImage: enableLazyloadImage
17
17
  }));
18
- const pictureStyle = createStyle({
18
+ const pictureStyle = createStyleReact({
19
19
  ...getAdaptivePictureStyles()
20
20
  });
21
21
  const adaptiveImageStyles = createStyle({
@@ -35,13 +35,13 @@ const AdaptiveImage = (props)=>{
35
35
  })
36
36
  });
37
37
  const renderSource = ()=>{
38
- return `
39
- ${srcMobile ? `<source media="(max-width: 767px)" srcset="${enableLazyLoadImage ? IMAGE_PLACEHOLDER : srcMobile}" />` : ``}
40
- ${srcTablet ? `<source media="(max-width: 1024px)" srcset="${enableLazyLoadImage ? IMAGE_PLACEHOLDER : srcTablet}" />` : ``}
38
+ return template`
39
+ ${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${enableLazyLoadImage ? IMAGE_PLACEHOLDER : srcMobile}" />` : ``}
40
+ ${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${enableLazyLoadImage ? IMAGE_PLACEHOLDER : srcTablet}" />` : ``}
41
41
  `;
42
42
  };
43
43
  const renderImage = ()=>{
44
- return `
44
+ return template`
45
45
  <img
46
46
  ${{
47
47
  ...restProps
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
- import { createStyle, createClass, createAttr, If } from '@gem-sdk/system';
3
+ import { createStyleReact, createStyle, createClass, createAttr, If } from '@gem-sdk/system';
4
4
  import AdaptiveImage from './AdaptiveImage.js';
5
5
  import NextImage from './NextImage.js';
6
6
  import NoDataImage from './NoDataImage.js';
@@ -18,11 +18,7 @@ const Image = ({ style, styles, setting, children, advanced, className, builderA
18
18
  setting: imageLink,
19
19
  enableImageLink
20
20
  });
21
- console.log('image', {
22
- setting,
23
- styles
24
- });
25
- const wrapperStyles = createStyle(getWrapperStyles(styles));
21
+ const wrapperStyles = createStyleReact(getWrapperStyles(styles));
26
22
  const noDataImageStyles = createStyle(getNoDataImageStyles(styles));
27
23
  const imageStyles = createStyle(getImageStyles(styles, builderProps));
28
24
  const containerStyles = createStyle(getContainerStyles(style, styles));
@@ -9,7 +9,7 @@ const getContainerStyles = (style, styles)=>{
9
9
  };
10
10
  const getWrapperStyles = (styles)=>{
11
11
  return {
12
- borderRadius: 'inherit',
12
+ 'border-radius': 'inherit',
13
13
  overflow: 'hidden',
14
14
  ...makeStyleResponsive('jc', styles?.align)
15
15
  };
@@ -60,7 +60,7 @@ const getAdaptiveImageStyles = ({ layout, aspectRatio, borderRadius })=>{
60
60
  };
61
61
  const getAdaptivePictureStyles = ()=>{
62
62
  return {
63
- borderRadius: 'inherit'
63
+ 'border-radius': 'inherit'
64
64
  };
65
65
  };
66
66
  const getNoDataImageStyles = (styles)=>{
@@ -6,6 +6,7 @@ const getNextImageLiquidAttrs = (props)=>{
6
6
  const { srcset, setting, storage, baseSrc, priority, customAttrs, width = 2237, height = 1678, isNotLazyload, backupFileKey, backupFilePath, srcIsLiquidCode, enableLazyLoadImage, alt = NEXT_IMAGE_CONFIG.DEFAULT_ALT, src = NEXT_IMAGE_CONFIG.DEFAULT_SRC, sizes = NEXT_IMAGE_CONFIG.DEFAULT_SIZES } = props;
7
7
  const hasLazyLoad = !isNotLazyload && enableLazyLoadImage && !priority;
8
8
  const getLoadingAttrs = ()=>{
9
+ const { qualityPercent, qualityType } = setting ?? {};
9
10
  const newBackupFileKey = backupFileKey ? getNewBackupFileKey(backupFileKey ?? '', src) : '';
10
11
  const srcImage = srcIsLiquidCode ? baseSrc : getImageSrc({
11
12
  src,
@@ -35,43 +36,24 @@ const getNextImageLiquidAttrs = (props)=>{
35
36
  srcset: srcset || ''
36
37
  };
37
38
  return {
39
+ 'data-sizes': 'auto',
40
+ 'quality-type': JSON.stringify(qualityType) || '{}',
41
+ 'quality-percent': JSON.stringify(qualityPercent) || '{}',
38
42
  ...hasLazyLoad ? lazyLoadAttrs : priorityLoadAttrs
39
43
  };
40
44
  };
41
45
  const getBaseAttrs = ()=>{
42
- const { qualityPercent, qualityType } = setting ?? {};
43
46
  return {
44
47
  alt,
45
48
  width,
46
49
  height,
47
- draggable: 'false',
48
- 'data-sizes': 'auto',
49
- 'quality-type': JSON.stringify(qualityType) || '{}',
50
- 'quality-percent': JSON.stringify(qualityPercent) || '{}'
50
+ draggable: 'false'
51
51
  };
52
52
  };
53
- const getFilteredAttrs = ()=>{
54
- const ignoreAttrs = [
55
- 'src',
56
- 'srcset',
57
- 'width',
58
- 'height',
59
- 'alt',
60
- 'base-src'
61
- ];
62
- const filteredAttrs = {};
63
- Object.entries(props).forEach(([key, value])=>{
64
- if (!ignoreAttrs.includes(key) && (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')) {
65
- filteredAttrs[key] = value;
66
- }
67
- });
68
- return filteredAttrs;
69
- };
70
53
  return createAttr({
71
54
  ...customAttrs,
72
55
  ...getBaseAttrs(),
73
- ...getLoadingAttrs(),
74
- ...getFilteredAttrs()
56
+ ...getLoadingAttrs()
75
57
  });
76
58
  };
77
59
 
@@ -2,7 +2,7 @@ import { createAttr } from '@gem-sdk/system';
2
2
  import { NEXT_IMAGE_CONFIG, IMAGE_PLACEHOLDER } from '../common/constants.js';
3
3
 
4
4
  const getNextImageReactAttrs = (props)=>{
5
- const { width = NEXT_IMAGE_CONFIG.DEFAULT_WIDTH_PROPS, height = NEXT_IMAGE_CONFIG.DEFAULT_HEIGHT_PROPS, priority, isNotLazyload, enableLazyLoadImage, base64 = IMAGE_PLACEHOLDER, alt = NEXT_IMAGE_CONFIG.DEFAULT_ALT, src = NEXT_IMAGE_CONFIG.DEFAULT_SRC } = props;
5
+ const { width = NEXT_IMAGE_CONFIG.DEFAULT_WIDTH_PROPS, height = NEXT_IMAGE_CONFIG.DEFAULT_HEIGHT_PROPS, quality, priority, isNotLazyload, enableLazyLoadImage, base64 = IMAGE_PLACEHOLDER, alt = NEXT_IMAGE_CONFIG.DEFAULT_ALT, src = NEXT_IMAGE_CONFIG.DEFAULT_SRC } = props;
6
6
  const hasLazyLoad = !isNotLazyload && enableLazyLoadImage && !priority;
7
7
  const getLoadingAttrs = ()=>{
8
8
  const lazyLoadAttrs = {
@@ -24,12 +24,12 @@ const getNextImageReactAttrs = (props)=>{
24
24
  src,
25
25
  alt,
26
26
  width,
27
- height
27
+ height,
28
+ quality
28
29
  });
29
30
  const baseAttrs = getBaseAttrs();
30
31
  const loadingAttrs = createAttr(getLoadingAttrs());
31
32
  return {
32
- ...props,
33
33
  ...baseAttrs,
34
34
  ...loadingAttrs
35
35
  };
@@ -20,25 +20,27 @@ const DeclineButtonSettings = [
20
20
  },
21
21
  {
22
22
  id: 'buttonType',
23
+ type: 'layout-selector',
23
24
  label: 'Style',
24
- type: 'layout-segment',
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: 'Button',
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
- ...makeStyleResponsive('w', width)
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: '100%'
95
+ default: 'default'
96
96
  },
97
97
  tablet: {
98
- default: '100%'
98
+ default: 'default'
99
99
  },
100
100
  mobile: {
101
- default: '100%'
101
+ default: 'default'
102
102
  }
103
103
  },
104
104
  displayOptions: [
@@ -23,7 +23,8 @@ const CountdownTimerSettings = [
23
23
  ],
24
24
  min: 1,
25
25
  isNumber: true,
26
- showDefaultUnit: false,
26
+ showDefaultUnit: true,
27
+ disableDecimal: true,
27
28
  default: '30',
28
29
  fallbackValue: 30
29
30
  }
@@ -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
- ...mode === 'edit' ? {
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 ?? ''}`)
@@ -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)?.map((item)=>{
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 };
@@ -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__*/ jsxs(Fragment, {
58
- children: [
59
- /*#__PURE__*/ jsx(NextImage, {
60
- draggable: "false",
61
- src: renderImage.src,
62
- width: renderImage?.width,
63
- height: renderImage?.height,
64
- alt: renderImage?.alt,
65
- setting: {
66
- aspectRatio: aspectRatio,
67
- layout: setting?.ftLayout
68
- },
69
- priority: setting?.preload,
70
- className: "featured-image-only",
71
- style: {
72
- width: '100%',
73
- height: '100%',
74
- cursor: 'pointer'
75
- }
76
- }),
77
- /*#__PURE__*/ jsx(MediaIcon, {
78
- contentType: renderImage?.contentType ?? ''
79
- }),
80
- enableHoverAction && setting?.hoverEffect !== 'none' && !isFeatureMedia(renderImage?.contentType) && /*#__PURE__*/ jsx(NextImage, {
81
- draggable: "false",
82
- src: setting?.hoverEffect === 'other' ? imageShowWhenHover?.src : renderImage.src,
83
- width: setting?.hoverEffect === 'other' ? imageShowWhenHover?.width : renderImage.width,
84
- height: setting?.hoverEffect === 'other' ? imageShowWhenHover?.height : renderImage.height,
85
- alt: setting?.hoverEffect === 'other' ? imageShowWhenHover?.alt : renderImage.alt,
86
- setting: {
87
- layout: setting.ftLayout,
88
- aspectRatio: aspectRatio
89
- },
90
- style: {
91
- width: '100%',
92
- height: '100%'
93
- },
94
- className: cls('hover-image featured-image-only !gp-max-w-none', getZoomImageClass()),
95
- priority: setting?.preload
96
- }),
97
- enableHoverAction && setting?.hoverEffect == 'zoom' && setting?.zoomType == 'glasses' && !isFeatureMedia(renderImage?.contentType) && /*#__PURE__*/ jsx("div", {
98
- className: cls(getZoomLenClass(), 'room-len'),
99
- style: {
100
- ...makeStyle({
101
- bgi: `url("${renderImage?.src}")`
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
  };
@@ -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: image.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: image.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: image?.src,
156
+ src: imageSrc,
156
157
  width: image?.width,
157
158
  height: image?.height,
158
159
  alt: image?.alt,