@gem-sdk/components 2.1.27-staging.5 → 2.1.28

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 (64) hide show
  1. package/dist/cjs/article/components/ArticleImage.js +1 -2
  2. package/dist/cjs/banner/components/hero-banner/index.liquid.js +7 -4
  3. package/dist/cjs/carousel/components/Carousel.liquid.js +2 -3
  4. package/dist/cjs/common/const.js +1 -1
  5. package/dist/cjs/helpers.js +4 -26
  6. package/dist/cjs/image/components/AdaptiveImage.liquid.js +5 -6
  7. package/dist/cjs/image/components/Image.js +2 -22
  8. package/dist/cjs/image/components/Image.liquid.js +4 -6
  9. package/dist/cjs/image/components/NextImage.liquid.js +3 -4
  10. package/dist/cjs/image-comparison/components/CompareImage.liquid.js +3 -7
  11. package/dist/cjs/index.js +0 -2
  12. package/dist/cjs/product/components/Product.liquid.js +2 -3
  13. package/dist/cjs/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js +5 -6
  14. package/dist/cjs/product/components/ProductImagesV2/liquid/ProductGalleryCarousel.liquid.js +2 -2
  15. package/dist/cjs/product/components/ProductImagesV2/liquid/ProductGalleryGrid.liquid.js +4 -4
  16. package/dist/cjs/product/components/ProductImagesV2/liquid/ProductImages.liquid.js +4 -4
  17. package/dist/cjs/product/components/ProductVariants/index.liquid.js +18 -11
  18. package/dist/cjs/product/components/ProductVariants/variants/Base.liquid.js +0 -1
  19. package/dist/cjs/product/components/ProductVariants/variants/Dropdown.liquid.js +12 -26
  20. package/dist/cjs/product/components/ProductVariants/variants/DropdownGroup.liquid.js +37 -4
  21. package/dist/cjs/tab/hooks/useTabInteraction.js +9 -13
  22. package/dist/cjs/text/components/Text.js +2 -2
  23. package/dist/cjs/text/components/Text.liquid.js +2 -2
  24. package/dist/cjs/third-party/components/RechargeSubscriptions.liquid.js +1 -1
  25. package/dist/cjs/third-party/setting/RechargeSubscriptions.js +2 -5
  26. package/dist/cjs/video/components/HTML5Embed.js +2 -2
  27. package/dist/cjs/video/components/HTML5Embed.liquid.js +3 -6
  28. package/dist/cjs/video/components/LiteYouTubeEmbed.liquid.js +3 -5
  29. package/dist/esm/article/components/ArticleImage.js +1 -2
  30. package/dist/esm/banner/components/hero-banner/index.liquid.js +7 -4
  31. package/dist/esm/carousel/components/Carousel.liquid.js +2 -3
  32. package/dist/esm/common/const.js +1 -1
  33. package/dist/esm/helpers.js +5 -25
  34. package/dist/esm/image/components/AdaptiveImage.liquid.js +5 -6
  35. package/dist/esm/image/components/Image.js +3 -23
  36. package/dist/esm/image/components/Image.liquid.js +4 -6
  37. package/dist/esm/image/components/NextImage.liquid.js +3 -4
  38. package/dist/esm/image-comparison/components/CompareImage.liquid.js +3 -7
  39. package/dist/esm/index.js +1 -1
  40. package/dist/esm/product/components/Product.liquid.js +2 -3
  41. package/dist/esm/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js +5 -6
  42. package/dist/esm/product/components/ProductImagesV2/liquid/ProductGalleryCarousel.liquid.js +2 -2
  43. package/dist/esm/product/components/ProductImagesV2/liquid/ProductGalleryGrid.liquid.js +4 -4
  44. package/dist/esm/product/components/ProductImagesV2/liquid/ProductImages.liquid.js +4 -4
  45. package/dist/esm/product/components/ProductVariants/index.liquid.js +19 -12
  46. package/dist/esm/product/components/ProductVariants/variants/Base.liquid.js +0 -1
  47. package/dist/esm/product/components/ProductVariants/variants/Dropdown.liquid.js +12 -26
  48. package/dist/esm/product/components/ProductVariants/variants/DropdownGroup.liquid.js +37 -4
  49. package/dist/esm/tab/hooks/useTabInteraction.js +10 -14
  50. package/dist/esm/text/components/Text.js +2 -2
  51. package/dist/esm/text/components/Text.liquid.js +2 -2
  52. package/dist/esm/third-party/components/RechargeSubscriptions.liquid.js +1 -1
  53. package/dist/esm/third-party/setting/RechargeSubscriptions.js +2 -5
  54. package/dist/esm/video/components/HTML5Embed.js +2 -2
  55. package/dist/esm/video/components/HTML5Embed.liquid.js +3 -6
  56. package/dist/esm/video/components/LiteYouTubeEmbed.liquid.js +3 -5
  57. package/dist/types/index.d.ts +8 -27
  58. package/package.json +3 -3
  59. package/dist/cjs/image/components/NoDataImage.js +0 -133
  60. package/dist/cjs/product/components/ProductVariants/variants/combine/index.js +0 -47
  61. package/dist/cjs/text/components/common.js +0 -14
  62. package/dist/esm/image/components/NoDataImage.js +0 -129
  63. package/dist/esm/product/components/ProductVariants/variants/combine/index.js +0 -44
  64. package/dist/esm/text/components/common.js +0 -12
@@ -18,15 +18,6 @@ const DropdownVariant = ({ variantGroup, blankText, swatchAutoWidth, swatchHeigh
18
18
  };
19
19
  const appendTypoClass = core.composeTypographyClassName(optionTypo, optionTypography);
20
20
  const appendTypoStyle = core.composeTypographyStyle(optionTypo, optionTypography);
21
- const composeSelectOptionAttrs = `
22
- option-data="{{option.name | escape}}"
23
- option-value="{{value | escape}}"
24
- data-gp-option-value-id="{{value.id}}"
25
- data-gp-option-available="{{value.available}}"
26
- value="{{value | escape}}"
27
- class="option-value-wrapper"
28
- key="{{value | escape}}"
29
- `;
30
21
  return core.template /* liquid */ `
31
22
  <select
32
23
  aria-label={{option.name | escape}}
@@ -82,42 +73,37 @@ const DropdownVariant = ({ variantGroup, blankText, swatchAutoWidth, swatchHeigh
82
73
  -%}
83
74
  ${isSoldOutMark ? `{%- if option_disabled == true -%}
84
75
  {%- if value == selectedValue -%}
85
- <option disabled ${!hasPreSelected ? '' : 'selected'}
76
+ <option disabled ${!hasPreSelected ? '' : 'selected'} option-data="{{option.name | escape}}"
86
77
  option-position="{{option.position}}"
87
- ${composeSelectOptionAttrs}>
78
+ option-value="{{value | escape}}" value="{{value | escape}}" class="option-value-wrapper" key="{{value | escape}}">
88
79
  {{value}}
89
80
  </option>
90
81
  {% else %}
91
- <option
92
- disabled
93
- ${composeSelectOptionAttrs}>
82
+ <option disabled option-data="{{option.name | escape}}"
83
+ option-value="{{value | escape}}" value="{{value | escape}}" class="option-value-wrapper" key="{{value | escape}}">
94
84
  {{value}}
95
85
  </option>
96
86
  {%- endif -%}
97
87
  {%- else -%}
98
88
  {%- if value == selectedValue -%}
99
- <option ${!hasPreSelected ? '' : 'selected'}
100
- option-position="{{option.position}}"
101
- ${composeSelectOptionAttrs}>
89
+ <option ${!hasPreSelected ? '' : 'selected'} option-data="{{option.name | escape}}"
90
+ option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
102
91
  {{value}}
103
92
  </option>
104
93
  {% else %}
105
- <option
106
- ${composeSelectOptionAttrs}
107
- option-position="{{option.position}}">
94
+ <option option-data="{{option.name | escape}}"
95
+ option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
108
96
  {{value}}
109
97
  </option>
110
98
  {%- endif -%}
111
99
  {%- endif -%}` : `{%- if value == selectedValue -%}
112
- <option ${!hasPreSelected ? '' : 'selected'}
113
- ${composeSelectOptionAttrs}
114
- option-position="{{option.position}}">
100
+ <option ${!hasPreSelected ? '' : 'selected'} option-data="{{option.name | escape}}"
101
+ option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
115
102
  {{value}}
116
103
  </option>
117
104
  {% else %}
118
- <option
119
- ${composeSelectOptionAttrs}
120
- option-position="{{option.position}}">
105
+ <option option-data="{{option.name | escape}}"
106
+ option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
121
107
  {{value}}
122
108
  </option>
123
109
  {%- endif -%}`}
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@gem-sdk/core');
6
- var index = require('./combine/index.js');
6
+ var helpers = require('../../../../helpers.js');
7
7
 
8
- const DropdownVariant = ({ price: hasPrice, blankText, optionTypography, optionBgColor, optionTextColor, optionRounded, optionShadow, optionHasShadow, optionBorder, optionTransform, hasPreSelected, optionTypo, combineWidth, combineHeight, soldOutStyle })=>{
8
+ const DropdownVariant = ({ price, blankText, optionTypography, optionBgColor, optionTextColor, optionRounded, optionShadow, optionHasShadow, optionBorder, optionTransform, hasPreSelected, optionTypo, combineWidth, combineHeight, soldOutStyle })=>{
9
9
  const swatchWidthResponsive = core.makeStyleResponsive('w', core.makeWidth(combineWidth));
10
10
  const getCustomCSSActiveState = ()=>{
11
11
  return core.makeStyle({
@@ -27,6 +27,7 @@ const DropdownVariant = ({ price: hasPrice, blankText, optionTypography, optionB
27
27
  option-data="{{option.name}}"
28
28
  option-type="{{optionType}}"
29
29
  class="${core.cls('gp-truncate gp-bg-auto gp-pl-4 gp-pr-6 gp-outline-none dropdown-option-item', core.handleConvertClassColor(optionBorder), appendTypoClass, core.getGlobalColorStateClass('text', optionTextColor), core.getGlobalColorStateClass('bg', optionBgColor), 'gp-outline-none', 'gp-shadow-none')}"
30
+
30
31
  style="${{
31
32
  ...core.getStyleShadowState(optionShadow, 'box-shadow', optionHasShadow),
32
33
  ...getCustomCSSActiveState(),
@@ -48,8 +49,40 @@ const DropdownVariant = ({ price: hasPrice, blankText, optionTypography, optionB
48
49
  'background-position': 'right 16px center'
49
50
  }}"
50
51
  >
51
- ${index.renderBlankOption(hasPreSelected, blankText)}
52
- ${index.renderCombineVariants(isSoldOutMark, hasPreSelected, hasPrice)}
52
+ ${!hasPreSelected ? `<option value="blank" selected>${blankText || helpers.getStaticLocale('ProductVariants', 'please_select')}</option>` : ''}
53
+ ${`{%- for variantItem in variants -%}
54
+ ${isSoldOutMark ? `{%- if variantItem.available == false -%}
55
+ {%- if variantItem.id == variant.id -%}
56
+ <option origin-price="{{variantItem.price}}" disabled ${!hasPreSelected ? '' : 'selected'} value="{{variantItem.id}}" key="{{variantItem.id}}">
57
+ {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
58
+ </option>
59
+ {% else %}
60
+ <option origin-price="{{variantItem.price}}" disabled value="{{variantItem.id}}" key="{{variantItem.id}}">
61
+ {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
62
+ </option>
63
+ {%- endif -%}
64
+ {%- else -%}
65
+ {%- if variantItem.id == variant.id -%}
66
+ <option origin-price="{{variantItem.price}}" ${!hasPreSelected ? '' : 'selected'} value="{{variantItem.id}}" key="{{variantItem.id}}">
67
+ {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
68
+ </option>
69
+ {% else %}
70
+ <option origin-price="{{variantItem.price}}" value="{{variantItem.id}}" key="{{variantItem.id}}">
71
+ {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
72
+ </option>
73
+ {%- endif -%}
74
+ {%- endif -%}` : `{%- if variantItem.id == variant.id -%}
75
+ <option origin-price="{{variantItem.price}}" ${!hasPreSelected ? '' : 'selected'} value="{{variantItem.id}}" key="{{variantItem.id}}">
76
+ {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
77
+ </option>
78
+ {% else %}
79
+ <option origin-price="{{variantItem.price}}" value="{{variantItem.id}}" key="{{variantItem.id}}">
80
+ {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
81
+ </option>
82
+ {%- endif -%}`}
83
+
84
+ {%- endfor -%}
85
+ `}
53
86
  </select>
54
87
  `;
55
88
  };
@@ -4,18 +4,19 @@ var core = require('@gem-sdk/core');
4
4
  var React = require('react');
5
5
 
6
6
  const useTabInteraction = ({ activeKey, setActiveKey, activeTab, refContainer, componentUid })=>{
7
- const { trigger, onListener, interactionListenerLoaded, saveToElementInteractionData, findElementIncludingSelf } = core.useInteraction();
7
+ const [previousTab, setPreviousTab] = React.useState(activeKey || 1);
8
+ const { trigger, onListener, interactionListenerLoaded } = core.useInteraction();
8
9
  const mode = core.useEditorMode();
9
10
  const changeOpenTabInteraction = (params)=>{
10
- const { data, isRollback, element, key } = params || {};
11
- if (data === undefined && isRollback) return;
12
- const newData = Number(data) + 1;
11
+ const { data, isRollback } = params || {};
12
+ if (data === undefined && isRollback === undefined) return;
13
13
  if (isRollback) {
14
- setActiveKey(newData);
14
+ setActiveKey(previousTab);
15
+ setPreviousTab(activeTab);
15
16
  return;
16
17
  }
17
- saveToElementInteractionData(element, key, String(activeKey));
18
- setActiveKey(newData);
18
+ setPreviousTab(activeTab);
19
+ setActiveKey(data + 1);
19
20
  };
20
21
  const dispatchEventTabActive = (index)=>{
21
22
  trigger({
@@ -36,16 +37,11 @@ const useTabInteraction = ({ activeKey, setActiveKey, activeTab, refContainer, c
36
37
  dispatchEventTabActive(activeTab - 1);
37
38
  });
38
39
  const selector = `[data-id="${componentUid}"]`;
39
- const element = findElementIncludingSelf(document, selector);
40
40
  const removeListener = onListener({
41
41
  event: 'gp:change-open-tab',
42
42
  selector
43
43
  }, (params)=>{
44
- changeOpenTabInteraction({
45
- ...params,
46
- element,
47
- key: params?.uniqueStorageKey
48
- });
44
+ changeOpenTabInteraction(params);
49
45
  });
50
46
  return ()=>{
51
47
  removeListener?.();
@@ -5,11 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var core = require('@gem-sdk/core');
7
7
  var React = require('react');
8
- var common = require('./common.js');
9
8
 
10
9
  const Text = /*#__PURE__*/ React.forwardRef(({ styles, builderAttrs, style, setting, advanced, builderProps, className, children, ...props }, ref)=>{
11
10
  const { text, htmlTag: Element = 'div', options, tagWidth, excludeFlex } = setting ?? {};
12
11
  const composeGlobalSize = core.makeGlobalSize(setting?.globalSize);
12
+ console.log('Text: ', text);
13
13
  const mode = core.useEditorMode();
14
14
  const getPlaceHolderWhenContentNone = ()=>{
15
15
  let classList = '';
@@ -90,7 +90,7 @@ const Text = /*#__PURE__*/ React.forwardRef(({ styles, builderAttrs, style, sett
90
90
  overflow: 'hidden'
91
91
  },
92
92
  dangerouslySetInnerHTML: {
93
- __html: common.getDisplayText(text?.toString() ?? '<p><br></p>')
93
+ __html: styles?.typo?.attrs?.transform === 'capitalize' ? text?.toString().toLocaleLowerCase() : text?.toString() || '<p><br></p>'
94
94
  }
95
95
  })
96
96
  }),
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@gem-sdk/core');
6
6
  var helpers = require('../../helpers.js');
7
- var common = require('./common.js');
8
7
 
9
8
  const Text = ({ styles, builderAttrs, style, setting, advanced, builderProps, className, isText, pageContext, elementAttrs, ...props })=>{
10
9
  const { text, htmlTag: Element = 'div', tagWidth, excludeFlex, isForceValue } = setting ?? {};
@@ -32,6 +31,7 @@ const Text = ({ styles, builderAttrs, style, setting, advanced, builderProps, cl
32
31
  uid: builderProps?.uid,
33
32
  settingId: setting?.translate,
34
33
  pageContext,
34
+ isCapitalize: styles?.typo?.attrs?.transform === 'capitalize',
35
35
  translate: setting.translate,
36
36
  isReplaceLocationOrigin: isViewliveHeadingOrTextComponent
37
37
  });
@@ -39,7 +39,7 @@ const Text = ({ styles, builderAttrs, style, setting, advanced, builderProps, cl
39
39
  displayText = renderText;
40
40
  }
41
41
  } else {
42
- displayText = common.getDisplayText(renderText ?? '');
42
+ displayText = styles?.typo?.attrs?.transform === 'capitalize' ? renderText?.toString().toLocaleLowerCase() : renderText;
43
43
  }
44
44
  return core.template`
45
45
  {% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}
@@ -6,7 +6,7 @@ var thirdParty = require('../helpers/thirdParty.js');
6
6
 
7
7
  const RechargeSubscriptions = ({ setting, advanced })=>{
8
8
  const { align, appBlockId } = setting ?? {};
9
- return thirdParty.getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''} !gp-block`);
9
+ return thirdParty.getLiquidForAppBlock(appBlockId, align, advanced?.cssClass);
10
10
  };
11
11
 
12
12
  exports.default = RechargeSubscriptions;
@@ -54,11 +54,8 @@ const config = {
54
54
  options: [
55
55
  {
56
56
  label: 'Subscription Widget',
57
- value: 'subscription-widget'
58
- },
59
- {
60
- label: 'Subscription Widget 2.0',
61
- value: 'subscription-widget-v2'
57
+ value: 'subscription-widget',
58
+ maxOption: 1
62
59
  }
63
60
  ],
64
61
  default: 'subscription-widget'
@@ -51,14 +51,14 @@ const HTML5Embed = (props)=>{
51
51
  }),
52
52
  props.thumbnail && showThumbnail && /*#__PURE__*/ jsxRuntime.jsxs("div", {
53
53
  role: "presentation",
54
- className: "gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full",
54
+ className: "gp-absolute gp-top-0 gp-left-0 gp-w-full",
55
55
  onClick: playVideoAndTurnOffThumbnail,
56
56
  style: props.style,
57
57
  children: [
58
58
  /*#__PURE__*/ jsxRuntime.jsx("img", {
59
59
  id: "video-thumbnail",
60
60
  src: props.thumbnail,
61
- className: "gp-w-full gp-h-full gp-object-contain gp-thumbnail-video",
61
+ className: "gp-w-full gp-h-full gp-object-cover gp-thumbnail-video",
62
62
  alt: "Video Thumbnail"
63
63
  }),
64
64
  /*#__PURE__*/ jsxRuntime.jsx("button", {
@@ -7,7 +7,6 @@ var NextImage_liquid = require('../../image/components/NextImage.liquid.js');
7
7
  var helpers = require('../../helpers.js');
8
8
 
9
9
  const HTML5Embed = (props)=>{
10
- const { enableLazyLoadImage, pageContext } = props;
11
10
  const videoId = `gp-video-${props.uid}`;
12
11
  const preloadThumbnail = props.autoplay && props.thumbnail;
13
12
  const offLazyVideo = !props.lazy && props.isVideoComponent;
@@ -24,9 +23,7 @@ const HTML5Embed = (props)=>{
24
23
  '--op': 0,
25
24
  '--z': -1,
26
25
  display: 'none'
27
- },
28
- enableLazyLoadImage,
29
- pageContext
26
+ }
30
27
  })}
31
28
  ${core.RenderIf(props.autoplay, `<script>
32
29
  document.addEventListener("DOMContentLoaded", (event) => {
@@ -75,14 +72,14 @@ const HTML5Embed = (props)=>{
75
72
  </video>
76
73
  <div
77
74
  style="${props.style}"
78
- class="${core.cls('gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full gp-thumbnail-video', {
75
+ class="${core.cls('gp-absolute gp-top-0 gp-left-0 gp-w-full gp-thumbnail-video', {
79
76
  'gp-hidden': !props.thumbnail || props.autoplay
80
77
  })}"
81
78
  >
82
79
  <img
83
80
  id="video-thumbnail"
84
81
  src="${props.thumbnail ?? ''}"
85
- class="gp-w-full gp-h-full gp-object-contain"
82
+ class="gp-w-full gp-h-full gp-object-cover"
86
83
  alt="Video Thumbnail"
87
84
  ></img>
88
85
  <button
@@ -7,7 +7,7 @@ var NextImage_liquid = require('../../image/components/NextImage.liquid.js');
7
7
  var helpers = require('../../helpers.js');
8
8
 
9
9
  const LiteYouTubeEmbed = (props)=>{
10
- const { style, lazy, preload, enableLazyLoadImage, pageContext } = props;
10
+ const { style, lazy, preload } = props;
11
11
  const videoUid = `gp-video-${props.uid}`;
12
12
  const videoId = encodeURIComponent(props.id);
13
13
  const videoTitle = props.title;
@@ -42,7 +42,7 @@ const LiteYouTubeEmbed = (props)=>{
42
42
  data-title="${videoTitle}"
43
43
  style="${{
44
44
  ...core.makeStyleResponsive('bgi', {
45
- desktop: preload || !enableLazyLoadImage ? `url('${posterUrl}')` : `url('${imagePlaceholder}')`
45
+ desktop: preload ? `url('${posterUrl}')` : `url('${imagePlaceholder}')`
46
46
  }),
47
47
  ...style
48
48
  }}"
@@ -52,9 +52,7 @@ const LiteYouTubeEmbed = (props)=>{
52
52
  src: posterUrl,
53
53
  alt: 'Poster',
54
54
  className: `gp-invisible gp-w-full gp-h-full gp_lazyforbg`,
55
- isDisableAspectStyle: true,
56
- enableLazyLoadImage,
57
- pageContext
55
+ isDisableAspectStyle: true
58
56
  })}
59
57
  <button
60
58
  type="button"
@@ -25,8 +25,7 @@ const ArticleImage = ({ className, setting = {}, styles = {}, advanced, builderP
25
25
  setting: {
26
26
  ...setting,
27
27
  alt: image.alt,
28
- image,
29
- disableNoDataState: true
28
+ image
30
29
  },
31
30
  styles: styles,
32
31
  advanced: advanced
@@ -10,7 +10,7 @@ import NextImage from '../../../image/components/NextImage.liquid.js';
10
10
  import { getImageSrc, DEVICES } from '../../../image/helpers/getSrcSet.js';
11
11
  import { createBlurDataURL } from '../../../image/components/helpers.js';
12
12
 
13
- const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, children, rawChildren, advanced, enableLazyLoadImage = true })=>{
13
+ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, children, rawChildren, advanced, enableLazyloadImage = true })=>{
14
14
  const { link, layout, verticalAlign, order, alignBanner, alt, title } = setting ?? {};
15
15
  const { background, overlayEnable, overlayColor, overlayOpacity, verticalGutter, contentWidth, hoverEffect, hoverEffectDuration, hoverEffectScale, cornerBg, borderBg, hasActiveShadow, shadowBg, sizeSetting, contentPadding } = styles ?? {};
16
16
  const enableParallax = setting?.enableParallax || false;
@@ -39,6 +39,9 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
39
39
  } else if (data.videoType === 'html5') {
40
40
  delete data.video;
41
41
  }
42
+ if (data.type !== 'image') {
43
+ delete data.image;
44
+ }
42
45
  }
43
46
  return background;
44
47
  };
@@ -127,7 +130,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
127
130
  tablet: createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0),
128
131
  mobile: createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0)
129
132
  };
130
- const enableLazyLoad = !setting?.preload && enableLazyLoadImage;
133
+ const enableLazyLoad = !setting?.preload && enableLazyloadImage;
131
134
  const renderInnerHeroBanner = ()=>{
132
135
  return template /* liquid */ `
133
136
  <div
@@ -177,7 +180,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
177
180
  alt,
178
181
  title,
179
182
  imagePlaceholder,
180
- enableLazyLoadImage
183
+ enableLazyloadImage
181
184
  })}
182
185
  <div class="${cls('gp-absolute gp-w-full gp-h-full')}">
183
186
  <div
@@ -220,7 +223,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
220
223
  alt: `lazy image ${device}`,
221
224
  className: `gp-absolute gp-top-0 gp-invisible gp-w-full gp_lazyload gp-h-full gp_lazyforbg ${device === 'tablet' ? 'gp_lazybg_tl' : ''} ${device === 'mobile' ? 'gp_lazybg_mb' : ''}`,
222
225
  isDisableAspectStyle: true,
223
- enableLazyLoadImage
226
+ enableLazyloadImage
224
227
  }));
225
228
  }).join('') : ''}
226
229
  </div></div>
@@ -9,7 +9,7 @@ const DEVICES = [
9
9
  'tablet',
10
10
  'desktop'
11
11
  ];
12
- const Carousel = ({ builderAttrs, builderProps, style, styles, moveToIdx, rootId, rootAttr, rootClass, wrapperClass, rootStyles, children, rawChildren, isHiddenArrowWhenDisabled = true, advanced, disableMarginAuto, conditionAppendJs, ftShapeProductImage, ...props })=>{
12
+ const Carousel = ({ builderAttrs, builderProps, style, styles, moveToIdx, rootId, rootAttr, rootClass, wrapperClass, rootStyles, children, rawChildren, isHiddenArrowWhenDisabled = true, advanced, disableMarginAuto, conditionAppendJs, ...props })=>{
13
13
  const setting = mappingNavigationCarousel(props.setting);
14
14
  const styleHeight = makeStyleResponsive('h', getHeightByShapeGlobalSize(styles?.sizeSetting));
15
15
  const styleWidth = makeStyleWithDefault('w', getWidthByShapeGlobalSize(styles?.sizeSetting, true), {
@@ -108,8 +108,7 @@ const Carousel = ({ builderAttrs, builderProps, style, styles, moveToIdx, rootId
108
108
  setting,
109
109
  styles,
110
110
  moveToIdx,
111
- isHiddenArrowWhenDisabled,
112
- ftShapeProductImage
111
+ isHiddenArrowWhenDisabled
113
112
  }).replaceAll("'", '&#039;')}' style="${{
114
113
  ...makeStyleResponsive('jc', styles?.align),
115
114
  ...rootStyles
@@ -1,5 +1,5 @@
1
1
  const ELEMENT_Z_INDEX = {
2
- STICKY: 1000,
2
+ STICKY: 100000,
3
3
  DIALOG: 100001,
4
4
  CART_DRAWER: 100002,
5
5
  CART_DRAWER_CONFIRM_MODAL: 100003
@@ -32,7 +32,7 @@ const isHexTransparent = (hex)=>{
32
32
  return Boolean(a);
33
33
  };
34
34
  const youtubeShortsRegex = /^(?:https?:\/\/)?(?:www\.)?youtube\.com\/shorts\/([^"&?/\s]{11})$/i;
35
- const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, defaultVal = '', translate, isReplaceLocationOrigin, isReplaceInventoryQuantity })=>{
35
+ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate, isReplaceLocationOrigin, isReplaceInventoryQuantity })=>{
36
36
  const hasLiquidInValue = new RegExp(/\{\{.*?\}\}|\{%.*?%\}/).test(val?.toString() ?? '');
37
37
  const translateLimit = pageContext?.isTranslateWithLocale ? 1000 : 5000;
38
38
  if (!translate || !val?.toString().trim() || val.toString().length > translateLimit || hasLiquidInValue || pageContext?.isPreviewing) return val ?? defaultVal;
@@ -47,6 +47,9 @@ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, d
47
47
  if (isReplaceInventoryQuantity) {
48
48
  locale += ` | replace: '<$quantity$>', inventory_quantity | replace: '&lt;$quantity$&gt;', inventory_quantity`;
49
49
  }
50
+ if (isCapitalize) {
51
+ locale = `${locale} | downcase`;
52
+ }
50
53
  if (isLiquid) return locale;
51
54
  return `{{ ${locale} }}`;
52
55
  };
@@ -121,28 +124,5 @@ const replaceLinkData = (text, isTranslate)=>{
121
124
  }
122
125
  return text;
123
126
  };
124
- const getAllHrefFromString = (htmlString)=>{
125
- if (!htmlString) return [];
126
- const regex = /href="([^"]*)"/g;
127
- const hrefs = [];
128
- let match;
129
- while((match = regex.exec(htmlString)) !== null){
130
- match[1] && hrefs.push(match[1]);
131
- }
132
- return hrefs;
133
- };
134
- const replaceAllHrefFromString = (htmlString, hrefs)=>{
135
- if (!htmlString) return '';
136
- const regex = /href="([^"]*)"/g;
137
- let match;
138
- let i = 0;
139
- while((match = regex.exec(htmlString)) !== null){
140
- if (match[1]) {
141
- htmlString = htmlString.replace(match[1], hrefs[i] ?? '');
142
- i++;
143
- }
144
- }
145
- return htmlString;
146
- };
147
127
 
148
- export { getAllHrefFromString, getDynamicSourceLocales, getInsertLinkData, getSettingPreloadData, getStaticLocale, isHexTransparent, isTransparentColor, isTransparentRGBA, replaceAllHrefFromString, replaceLinkData, youtubeShortsRegex };
128
+ export { getDynamicSourceLocales, getInsertLinkData, getSettingPreloadData, getStaticLocale, isHexTransparent, isTransparentColor, isTransparentRGBA, replaceLinkData, youtubeShortsRegex };
@@ -2,7 +2,7 @@ import { template, cls, RenderIf, makeStyleResponsive } from '@gem-sdk/core';
2
2
  import { getImageSrc } from '../helpers/getSrcSet.js';
3
3
  import { createBlurDataURL } from './helpers.js';
4
4
 
5
- const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className, pictureClass, style, imagePlaceholder, enableLazyLoadImage = true, pageContext, ...props })=>{
5
+ const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className, pictureClass, style, imagePlaceholder, enableLazyloadImage = true, ...props })=>{
6
6
  const fallBackImage = 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif';
7
7
  const srcDesktop = getImageSrc(srcSet?.desktop, 'desktop') || fallBackImage;
8
8
  const srcTablet = (getImageSrc(srcSet?.tablet, 'tablet') ?? getImageSrc(srcSet?.desktop, 'tablet')) || fallBackImage;
@@ -27,17 +27,16 @@ const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className,
27
27
  }}"
28
28
  />
29
29
  `, template`
30
- ${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${enableLazyLoadImage ? imagePlaceholder?.['mobile'] ?? createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.height ?? 0) : srcMobile}" />` : ''}
31
- ${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${enableLazyLoadImage ? imagePlaceholder?.['tablet'] ?? createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.height ?? 0) : srcTablet}" />` : ''}
30
+ ${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${enableLazyloadImage ? imagePlaceholder?.['mobile'] ?? createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.height ?? 0) : srcMobile}" />` : ''}
31
+ ${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${enableLazyloadImage ? imagePlaceholder?.['tablet'] ?? createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.height ?? 0) : srcTablet}" />` : ''}
32
32
  <img
33
33
  ${{
34
34
  ...props
35
35
  }}
36
36
  class="${cls(className, {
37
- gp_lazyload: enableLazyLoadImage,
38
- gp_force_load: pageContext?.isOptimizePlan
37
+ gp_lazyload: enableLazyloadImage
39
38
  })}"
40
- src="${enableLazyLoadImage ? imagePlaceholder?.['desktop'] ?? createBlurDataURL(srcSet?.desktop?.width ?? 0, srcSet?.desktop?.height ?? 0) : srcDesktop}"
39
+ src="${enableLazyloadImage ? imagePlaceholder?.['desktop'] ?? createBlurDataURL(srcSet?.desktop?.width ?? 0, srcSet?.desktop?.height ?? 0) : srcDesktop}"
41
40
  data-src="${srcDesktop}"
42
41
  width="100%"
43
42
  alt="${alt}"
@@ -1,16 +1,13 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useCurrentDevice, makeStyleResponsive, getWidthByShapeGlobalSize, makeWidth, getHeightByShapeGlobalSize, cls, getStyleShadowState, handleConvertClassColor, getBorderStyle, getBorderRadiusStyle, getStyleShadow, getAspectRatioGlobalSize, getGlobalColorStateClass, getGlobalColorStateStyle, makeStyleState, getCornerCSSFromGlobal } from '@gem-sdk/core';
2
+ import { makeStyleResponsive, getWidthByShapeGlobalSize, makeWidth, getHeightByShapeGlobalSize, cls, getStyleShadowState, handleConvertClassColor, getBorderStyle, getBorderRadiusStyle, getStyleShadow, getAspectRatioGlobalSize, getGlobalColorStateClass, getGlobalColorStateStyle, makeStyleState, getCornerCSSFromGlobal } from '@gem-sdk/core';
3
3
  import Link from '../../link/components/Link.js';
4
4
  import AdaptiveImage from './AdaptiveImage.js';
5
5
  import NextImage from './NextImage.js';
6
6
  import { composeAspectRatio } from './helpers.js';
7
- import NoDataImage from './NoDataImage.js';
8
- import { useMemo } from 'react';
9
7
 
10
8
  const Image = ({ styles, className, setting, builderAttrs, builderProps, style, children, onClick, onLoad })=>{
11
9
  const { image, imageLink, srcSet, isNotLazyload } = setting ?? {};
12
10
  const { customAspectRadio } = styles ?? {};
13
- const currentDevice = useCurrentDevice();
14
11
  const { shape } = styles ?? {};
15
12
  const WrapLink = imageLink?.link ? Link : 'div';
16
13
  const opacity = {
@@ -55,18 +52,6 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
55
52
  custom: customAspectRadio
56
53
  })
57
54
  };
58
- const isShowNoDataState = useMemo(()=>{
59
- if (setting?.disableNoDataState) return false;
60
- if (currentDevice === 'mobile') return !setting?.srcSet?.mobile?.src && !setting?.srcSet?.tablet?.src && !setting?.srcSet?.desktop?.src;
61
- if (currentDevice === 'tablet') return !setting?.srcSet?.tablet?.src && !setting?.srcSet?.desktop?.src;
62
- return !setting?.srcSet?.desktop?.src;
63
- }, [
64
- currentDevice,
65
- setting?.disableNoDataState,
66
- setting?.srcSet?.desktop?.src,
67
- setting?.srcSet?.mobile?.src,
68
- setting?.srcSet?.tablet?.src
69
- ]);
70
55
  return /*#__PURE__*/ jsxs("div", {
71
56
  ...builderAttrs,
72
57
  "data-id": builderProps?.uid,
@@ -94,15 +79,10 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
94
79
  ...makeStyleResponsive('jc', styles?.align)
95
80
  },
96
81
  children: [
97
- isShowNoDataState ? /*#__PURE__*/ jsx(NoDataImage, {
98
- style: {
99
- ...imageWidth,
100
- ...imageHeight
101
- }
102
- }) : setting?.isAdaptive ? /*#__PURE__*/ jsx(AdaptiveImage, {
82
+ setting?.isAdaptive ? /*#__PURE__*/ jsx(AdaptiveImage, {
103
83
  srcSet: setting.srcSet,
104
84
  pictureClass: "gp-contents",
105
- className: cls(className, 'gp-inline-block gp-w-full gp-max-w-full', handleConvertClassColor(styles?.borderImg)),
85
+ className: cls(className, 'gp-w-full gp-max-w-full', handleConvertClassColor(styles?.borderImg)),
106
86
  alt: setting.alt,
107
87
  style: {
108
88
  ...imageWidth,
@@ -3,7 +3,7 @@ import AdaptiveImage from './AdaptiveImage.liquid.js';
3
3
  import NextImage from './NextImage.liquid.js';
4
4
  import { getInsertLinkData } from '../../helpers.js';
5
5
 
6
- const Image = ({ styles, className, setting, builderAttrs, builderProps, style, advanced, enableLazyLoadImage = true, pageContext })=>{
6
+ const Image = ({ styles, className, setting, builderAttrs, builderProps, style, advanced, enableLazyloadImage = true })=>{
7
7
  const { imageLink, isNotLazyload } = setting ?? {};
8
8
  const { shape } = styles ?? {};
9
9
  const { Wrap: WrapLink, urlData } = getInsertLinkData('div', imageLink);
@@ -30,7 +30,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
30
30
  }}
31
31
  data-id="${builderProps?.uid}"
32
32
  role="presentation"
33
- class="${cls('gp-group/image', builderProps?.uid, advanced?.cssClass, `force-publish-${new Date().getTime()}`)}"
33
+ class="${cls('gp-group/image', builderProps?.uid, advanced?.cssClass)}"
34
34
  style="${{
35
35
  ...style,
36
36
  ...makeStyleResponsive('ta', styles?.align)
@@ -72,8 +72,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
72
72
  aspectRatio: getAspectRatioGlobalSize(styles?.shape),
73
73
  layout: styles?.objectFit,
74
74
  priority: setting?.priority,
75
- enableLazyLoadImage,
76
- pageContext
75
+ enableLazyloadImage
77
76
  }) : NextImage({
78
77
  ...setting?.image,
79
78
  priority: setting?.priority,
@@ -102,8 +101,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
102
101
  layout: styles?.objectFit
103
102
  },
104
103
  isNotLazyload,
105
- enableLazyLoadImage,
106
- pageContext
104
+ enableLazyloadImage
107
105
  })}
108
106
  </${WrapLink}>
109
107
  </div>`;
@@ -3,7 +3,7 @@ import { getNewBackupFileKey, getImageSrc, getSrcSet } from '../helpers/getSrcSe
3
3
  import { DEVICES } from '../../product/components/ProductVariants/index.js';
4
4
  import { createBlurDataURL } from './helpers.js';
5
5
 
6
- const NextImage = ({ setting, src = 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f08-f6665179f02f/-/format/auto/-/quality/lighter/placeholder-1.png', srcIsLiquidCode, alt = 'Alt image', width = 2237, height = 1678, backupFileKey, backupFilePath, storage, style, priority, vw, className, base64, baseSrc, isDisableAspectStyle, isDisableObjectFit, customAttrs, customLazyload, isNotLazyload, enableLazyLoadImage = true, pageContext, srcset, sizes, ...props })=>{
6
+ const NextImage = ({ setting, src = 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f08-f6665179f02f/-/format/auto/-/quality/lighter/placeholder-1.png', srcIsLiquidCode, alt = 'Alt image', width = 2237, height = 1678, backupFileKey, backupFilePath, storage, style, priority, vw, className, base64, baseSrc, isDisableAspectStyle, isDisableObjectFit, customAttrs, customLazyload, isNotLazyload, enableLazyloadImage = true, srcset, sizes, ...props })=>{
7
7
  const { aspectRatio, layout, qualityPercent, qualityType } = setting ?? {};
8
8
  const newBackupFilekey = backupFileKey ? getNewBackupFileKey(backupFileKey ?? '', src) : '';
9
9
  const srcImage = srcIsLiquidCode ? baseSrc : getImageSrc({
@@ -93,13 +93,12 @@ const NextImage = ({ setting, src = 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f0
93
93
  ${customAttrs}
94
94
  draggable="false"
95
95
  class="${cls(className, {
96
- gp_lazyload: !customLazyload && enableLazyLoadImage,
97
- gp_force_load: pageContext?.isOptimizePlan
96
+ gp_lazyload: !customLazyload && enableLazyloadImage
98
97
  })}"
99
98
  ${{
100
99
  'data-src': srcImage,
101
100
  'data-srcset': srcSetImg,
102
- src: enableLazyLoadImage ? imagePlaceholder : srcImage,
101
+ src: enableLazyloadImage ? imagePlaceholder : srcImage,
103
102
  width,
104
103
  height,
105
104
  alt,