@gem-sdk/components 2.1.25 → 2.1.27-staging.0

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/Accordion.js +1 -2
  2. package/dist/cjs/accordion/components/Accordion.liquid.js +1 -2
  3. package/dist/cjs/article/components/ArticleImage.js +2 -1
  4. package/dist/cjs/banner/components/hero-banner/index.liquid.js +4 -7
  5. package/dist/cjs/carousel/components/Carousel.liquid.js +3 -2
  6. package/dist/cjs/common/const.js +1 -1
  7. package/dist/cjs/helpers.js +4 -1
  8. package/dist/cjs/image/components/AdaptiveImage.liquid.js +6 -5
  9. package/dist/cjs/image/components/Image.js +22 -2
  10. package/dist/cjs/image/components/Image.liquid.js +6 -4
  11. package/dist/cjs/image/components/NextImage.liquid.js +4 -3
  12. package/dist/cjs/image/components/NoDataImage.js +133 -0
  13. package/dist/cjs/image-comparison/components/CompareImage.liquid.js +7 -3
  14. package/dist/cjs/index.js +4 -0
  15. package/dist/cjs/post-purchase/product/components/ProductOffer.js +5 -1
  16. package/dist/cjs/product/components/Product.liquid.js +3 -2
  17. package/dist/cjs/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js +6 -5
  18. package/dist/cjs/product/components/ProductImagesV2/liquid/ProductGalleryCarousel.liquid.js +2 -2
  19. package/dist/cjs/product/components/ProductImagesV2/liquid/ProductGalleryGrid.liquid.js +4 -4
  20. package/dist/cjs/product/components/ProductImagesV2/liquid/ProductImages.liquid.js +4 -4
  21. package/dist/cjs/product/components/ProductVariants/index.liquid.js +11 -18
  22. package/dist/cjs/product/components/ProductVariants/variants/Base.liquid.js +1 -0
  23. package/dist/cjs/product/components/ProductVariants/variants/Dropdown.liquid.js +26 -12
  24. package/dist/cjs/product/components/ProductVariants/variants/DropdownGroup.liquid.js +4 -37
  25. package/dist/cjs/product/components/ProductVariants/variants/combine/index.js +47 -0
  26. package/dist/cjs/product/setting/constant/bundle-layout/horizontalThree.js +1 -0
  27. package/dist/cjs/product/setting/constant/bundle-layout/horizontalTwo.js +1 -0
  28. package/dist/cjs/product/setting/constant/bundle-layout/verticalThree.js +1 -0
  29. package/dist/cjs/product/setting/constant/bundle-layout/verticalTwo.js +1 -0
  30. package/dist/cjs/stock-counter/components/StockCounter.liquid.js +12 -9
  31. package/dist/cjs/stock-counter/helpers.js +4 -1
  32. package/dist/cjs/tab/hooks/useTabInteraction.js +13 -9
  33. package/dist/cjs/text/components/Text.js +0 -1
  34. package/dist/cjs/video/components/HTML5Embed.js +2 -2
  35. package/dist/cjs/video/components/HTML5Embed.liquid.js +6 -3
  36. package/dist/cjs/video/components/LiteYouTubeEmbed.liquid.js +5 -3
  37. package/dist/esm/accordion/components/Accordion.js +1 -2
  38. package/dist/esm/accordion/components/Accordion.liquid.js +1 -2
  39. package/dist/esm/article/components/ArticleImage.js +2 -1
  40. package/dist/esm/banner/components/hero-banner/index.liquid.js +4 -7
  41. package/dist/esm/carousel/components/Carousel.liquid.js +3 -2
  42. package/dist/esm/common/const.js +1 -1
  43. package/dist/esm/helpers.js +4 -1
  44. package/dist/esm/image/components/AdaptiveImage.liquid.js +6 -5
  45. package/dist/esm/image/components/Image.js +23 -3
  46. package/dist/esm/image/components/Image.liquid.js +6 -4
  47. package/dist/esm/image/components/NextImage.liquid.js +4 -3
  48. package/dist/esm/image/components/NoDataImage.js +129 -0
  49. package/dist/esm/image-comparison/components/CompareImage.liquid.js +7 -3
  50. package/dist/esm/index.js +1 -0
  51. package/dist/esm/post-purchase/product/components/ProductOffer.js +5 -1
  52. package/dist/esm/product/components/Product.liquid.js +3 -2
  53. package/dist/esm/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js +6 -5
  54. package/dist/esm/product/components/ProductImagesV2/liquid/ProductGalleryCarousel.liquid.js +2 -2
  55. package/dist/esm/product/components/ProductImagesV2/liquid/ProductGalleryGrid.liquid.js +4 -4
  56. package/dist/esm/product/components/ProductImagesV2/liquid/ProductImages.liquid.js +4 -4
  57. package/dist/esm/product/components/ProductVariants/index.liquid.js +12 -19
  58. package/dist/esm/product/components/ProductVariants/variants/Base.liquid.js +1 -0
  59. package/dist/esm/product/components/ProductVariants/variants/Dropdown.liquid.js +26 -12
  60. package/dist/esm/product/components/ProductVariants/variants/DropdownGroup.liquid.js +4 -37
  61. package/dist/esm/product/components/ProductVariants/variants/combine/index.js +44 -0
  62. package/dist/esm/product/setting/constant/bundle-layout/horizontalThree.js +1 -0
  63. package/dist/esm/product/setting/constant/bundle-layout/horizontalTwo.js +1 -0
  64. package/dist/esm/product/setting/constant/bundle-layout/verticalThree.js +1 -0
  65. package/dist/esm/product/setting/constant/bundle-layout/verticalTwo.js +1 -0
  66. package/dist/esm/stock-counter/components/StockCounter.liquid.js +14 -11
  67. package/dist/esm/stock-counter/helpers.js +4 -1
  68. package/dist/esm/tab/hooks/useTabInteraction.js +14 -10
  69. package/dist/esm/text/components/Text.js +0 -1
  70. package/dist/esm/video/components/HTML5Embed.js +2 -2
  71. package/dist/esm/video/components/HTML5Embed.liquid.js +6 -3
  72. package/dist/esm/video/components/LiteYouTubeEmbed.liquid.js +5 -3
  73. package/dist/types/index.d.ts +30 -8
  74. package/package.json +3 -3
@@ -14,6 +14,15 @@ const DropdownVariant = ({ variantGroup, blankText, swatchAutoWidth, swatchHeigh
14
14
  };
15
15
  const appendTypoClass = composeTypographyClassName(optionTypo, optionTypography);
16
16
  const appendTypoStyle = composeTypographyStyle(optionTypo, optionTypography);
17
+ const composeSelectOptionAttrs = `
18
+ option-data="{{option.name | escape}}"
19
+ option-value="{{value | escape}}"
20
+ data-gp-option-value-id="{{value.id}}"
21
+ data-gp-option-available="{{value.available}}"
22
+ value="{{value | escape}}"
23
+ class="option-value-wrapper"
24
+ key="{{value | escape}}"
25
+ `;
17
26
  return template /* liquid */ `
18
27
  <select
19
28
  aria-label={{option.name | escape}}
@@ -69,37 +78,42 @@ const DropdownVariant = ({ variantGroup, blankText, swatchAutoWidth, swatchHeigh
69
78
  -%}
70
79
  ${isSoldOutMark ? `{%- if option_disabled == true -%}
71
80
  {%- if value == selectedValue -%}
72
- <option disabled ${!hasPreSelected ? '' : 'selected'} option-data="{{option.name | escape}}"
81
+ <option disabled ${!hasPreSelected ? '' : 'selected'}
73
82
  option-position="{{option.position}}"
74
- option-value="{{value | escape}}" value="{{value | escape}}" class="option-value-wrapper" key="{{value | escape}}">
83
+ ${composeSelectOptionAttrs}>
75
84
  {{value}}
76
85
  </option>
77
86
  {% else %}
78
- <option disabled option-data="{{option.name | escape}}"
79
- option-value="{{value | escape}}" value="{{value | escape}}" class="option-value-wrapper" key="{{value | escape}}">
87
+ <option
88
+ disabled
89
+ ${composeSelectOptionAttrs}>
80
90
  {{value}}
81
91
  </option>
82
92
  {%- endif -%}
83
93
  {%- else -%}
84
94
  {%- if value == selectedValue -%}
85
- <option ${!hasPreSelected ? '' : 'selected'} option-data="{{option.name | escape}}"
86
- option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
95
+ <option ${!hasPreSelected ? '' : 'selected'}
96
+ option-position="{{option.position}}"
97
+ ${composeSelectOptionAttrs}>
87
98
  {{value}}
88
99
  </option>
89
100
  {% else %}
90
- <option option-data="{{option.name | escape}}"
91
- option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
101
+ <option
102
+ ${composeSelectOptionAttrs}
103
+ option-position="{{option.position}}">
92
104
  {{value}}
93
105
  </option>
94
106
  {%- endif -%}
95
107
  {%- endif -%}` : `{%- if value == selectedValue -%}
96
- <option ${!hasPreSelected ? '' : 'selected'} option-data="{{option.name | escape}}"
97
- option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
108
+ <option ${!hasPreSelected ? '' : 'selected'}
109
+ ${composeSelectOptionAttrs}
110
+ option-position="{{option.position}}">
98
111
  {{value}}
99
112
  </option>
100
113
  {% else %}
101
- <option option-data="{{option.name | escape}}"
102
- option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
114
+ <option
115
+ ${composeSelectOptionAttrs}
116
+ option-position="{{option.position}}">
103
117
  {{value}}
104
118
  </option>
105
119
  {%- endif -%}`}
@@ -1,7 +1,7 @@
1
1
  import { makeStyleResponsive, makeWidth, composeTypographyClassName, composeTypographyStyle, template, cls, handleConvertClassColor, getGlobalColorStateClass, getStyleShadowState, makeStyle, getGlobalColorStateStyle, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertBorderColor, composeRadius, getSingleColorVariable } from '@gem-sdk/core';
2
- import { getStaticLocale } from '../../../../helpers.js';
2
+ import { renderBlankOption, renderCombineVariants } from './combine/index.js';
3
3
 
4
- const DropdownVariant = ({ price, blankText, optionTypography, optionBgColor, optionTextColor, optionRounded, optionShadow, optionHasShadow, optionBorder, optionTransform, hasPreSelected, optionTypo, combineWidth, combineHeight, soldOutStyle })=>{
4
+ const DropdownVariant = ({ price: hasPrice, blankText, optionTypography, optionBgColor, optionTextColor, optionRounded, optionShadow, optionHasShadow, optionBorder, optionTransform, hasPreSelected, optionTypo, combineWidth, combineHeight, soldOutStyle })=>{
5
5
  const swatchWidthResponsive = makeStyleResponsive('w', makeWidth(combineWidth));
6
6
  const getCustomCSSActiveState = ()=>{
7
7
  return makeStyle({
@@ -23,7 +23,6 @@ const DropdownVariant = ({ price, blankText, optionTypography, optionBgColor, op
23
23
  option-data="{{option.name}}"
24
24
  option-type="{{optionType}}"
25
25
  class="${cls('gp-truncate gp-bg-auto gp-pl-4 gp-pr-6 gp-outline-none dropdown-option-item', handleConvertClassColor(optionBorder), appendTypoClass, getGlobalColorStateClass('text', optionTextColor), getGlobalColorStateClass('bg', optionBgColor), 'gp-outline-none', 'gp-shadow-none')}"
26
-
27
26
  style="${{
28
27
  ...getStyleShadowState(optionShadow, 'box-shadow', optionHasShadow),
29
28
  ...getCustomCSSActiveState(),
@@ -45,40 +44,8 @@ const DropdownVariant = ({ price, blankText, optionTypography, optionBgColor, op
45
44
  'background-position': 'right 16px center'
46
45
  }}"
47
46
  >
48
- ${!hasPreSelected ? `<option value="blank" selected>${blankText || getStaticLocale('ProductVariants', 'please_select')}</option>` : ''}
49
- ${`{%- for variantItem in variants -%}
50
- ${isSoldOutMark ? `{%- if variantItem.available == false -%}
51
- {%- if variantItem.id == variant.id -%}
52
- <option origin-price="{{variantItem.price}}" disabled ${!hasPreSelected ? '' : 'selected'} value="{{variantItem.id}}" key="{{variantItem.id}}">
53
- {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
54
- </option>
55
- {% else %}
56
- <option origin-price="{{variantItem.price}}" disabled value="{{variantItem.id}}" key="{{variantItem.id}}">
57
- {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
58
- </option>
59
- {%- endif -%}
60
- {%- else -%}
61
- {%- if variantItem.id == variant.id -%}
62
- <option origin-price="{{variantItem.price}}" ${!hasPreSelected ? '' : 'selected'} value="{{variantItem.id}}" key="{{variantItem.id}}">
63
- {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
64
- </option>
65
- {% else %}
66
- <option origin-price="{{variantItem.price}}" value="{{variantItem.id}}" key="{{variantItem.id}}">
67
- {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
68
- </option>
69
- {%- endif -%}
70
- {%- endif -%}` : `{%- if variantItem.id == variant.id -%}
71
- <option origin-price="{{variantItem.price}}" ${!hasPreSelected ? '' : 'selected'} value="{{variantItem.id}}" key="{{variantItem.id}}">
72
- {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
73
- </option>
74
- {% else %}
75
- <option origin-price="{{variantItem.price}}" value="{{variantItem.id}}" key="{{variantItem.id}}">
76
- {{variantItem.title}} ${price ? '- {{variantItem.price | money}}' : ''}
77
- </option>
78
- {%- endif -%}`}
79
-
80
- {%- endfor -%}
81
- `}
47
+ ${renderBlankOption(hasPreSelected, blankText)}
48
+ ${renderCombineVariants(isSoldOutMark, hasPreSelected, hasPrice)}
82
49
  </select>
83
50
  `;
84
51
  };
@@ -0,0 +1,44 @@
1
+ import { getStaticLocale } from '../../../../../helpers.js';
2
+
3
+ const renderCombineVariants = (isSoldOutMark, hasPreSelected, enablePrice)=>{
4
+ const hasPrice = enablePrice ? '- {{variantItem.price | money}}' : '';
5
+ const optionAttrs = 'origin-price="{{variantItem.price}}" value="{{variantItem.id}}" key="{{variantItem.id}}"';
6
+ return `${`{%- for variantItem in variants -%}
7
+ ${isSoldOutMark ? `{%- if variantItem.available == false -%}
8
+ {%- if variantItem.id == variant.id -%}
9
+ <option origin-price="{{variantItem.price}}" disabled ${hasPreSelected ? 'selected' : ''} value="{{variantItem.id}}" key="{{variantItem.id}}">
10
+ {{variantItem.title}} ${hasPrice} : ''}
11
+ </option>
12
+ {% else %}
13
+ <option ${optionAttrs} disabled>
14
+ {{variantItem.title}} ${hasPrice}
15
+ </option>
16
+ {%- endif -%}
17
+ {%- else -%}
18
+ {%- if variantItem.id == variant.id -%}
19
+ <option origin-price="{{variantItem.price}}" ${hasPreSelected ? 'selected' : ''} value="{{variantItem.id}}" key="{{variantItem.id}}">
20
+ {{variantItem.title}} ${hasPrice}
21
+ </option>
22
+ {% else %}
23
+ <option ${optionAttrs}>
24
+ {{variantItem.title}} ${hasPrice}
25
+ </option>
26
+ {%- endif -%}
27
+ {%- endif -%}` : `{%- if variantItem.id == variant.id -%}
28
+ <option origin-price="{{variantItem.price}}" ${hasPreSelected ? 'selected' : ''} value="{{variantItem.id}}" key="{{variantItem.id}}">
29
+ {{variantItem.title}} ${hasPrice}
30
+ </option>
31
+ {% else %}
32
+ <option ${optionAttrs}>
33
+ {{variantItem.title}} ${hasPrice}
34
+ </option>
35
+ {%- endif -%}`}
36
+
37
+ {%- endfor -%}
38
+ `}`;
39
+ };
40
+ const renderBlankOption = (hasPreSelected, blankText)=>{
41
+ return !hasPreSelected ? `<option value="blank" selected>${blankText || getStaticLocale('ProductVariants', 'please_select')}</option>` : '';
42
+ };
43
+
44
+ export { renderBlankOption, renderCombineVariants };
@@ -61,6 +61,7 @@ const horizontalThree = [
61
61
  "settings": {
62
62
  "contentType": "text",
63
63
  "displayContent": "SALE {percent_discount}",
64
+ "translate": "displayContent",
64
65
  "displayTrigger": [
65
66
  {
66
67
  "conditionType": "exact_or_above",
@@ -60,6 +60,7 @@ const horizontalTwo = [
60
60
  "settings": {
61
61
  "contentType": "text",
62
62
  "displayContent": "SALE {percent_discount}",
63
+ "translate": "displayContent",
63
64
  "displayTrigger": [
64
65
  {
65
66
  "conditionType": "exact_or_above",
@@ -198,6 +198,7 @@ const verticalThree = [
198
198
  "settings": {
199
199
  "contentType": "text",
200
200
  "displayContent": "SALE {percent_discount}",
201
+ "translate": "displayContent",
201
202
  "displayTrigger": [
202
203
  {
203
204
  "conditionType": "exact_or_above",
@@ -198,6 +198,7 @@ const verticalTwo = [
198
198
  "settings": {
199
199
  "contentType": "text",
200
200
  "displayContent": "SALE {percent_discount}",
201
+ "translate": "displayContent",
201
202
  "displayTrigger": [
202
203
  {
203
204
  "conditionType": "exact_or_above",
@@ -1,7 +1,7 @@
1
1
  import { composeMemo, composeTypographyV2, composeTypography, genVariable, getShortName, composeTypographyClassName, composeTypographyStyle, template, makeStyleResponsive, makeWidth, makeStyle, getSingleColorVariable, RenderIf, cls, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
2
  import { CONTINUE_SELLING_WHEN_OUT_OF_STOCK } from '../const.js';
3
- import { convertSizeToWidth, transformHighlighTag, transformNumberTag } from '../helpers.js';
4
- import { getDynamicSourceLocales, getSettingPreloadData, getStaticLocale } from '../../helpers.js';
3
+ import { convertSizeToWidth } from '../helpers.js';
4
+ import { getDynamicSourceLocales, getSettingPreloadData } from '../../helpers.js';
5
5
 
6
6
  const StockCounter = ({ setting, styles, style, advanced, builderProps, pageContext })=>{
7
7
  const { fullWidth, width, alignment, typography, typo, color, iconColor, textColor, displayProgressBar, progressBarHeight, roundedBorder, effect } = styles ?? {};
@@ -37,7 +37,8 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps, pageCont
37
37
  uid: builderProps?.uid,
38
38
  settingId: 'template',
39
39
  pageContext,
40
- translate
40
+ translate,
41
+ isReplaceInventoryQuantity: true
41
42
  });
42
43
  const outOfStockMessageDisplay = getDynamicSourceLocales({
43
44
  val: outOfStockMessage,
@@ -100,10 +101,6 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps, pageCont
100
101
  data-id="${builderProps?.uid}"
101
102
  data-visible="{{ should_display }}"
102
103
  data-policy='{{ variant_policy_list }}'
103
- data-template="${templateStringDisplay}"
104
- data-out-of-stock-message="${outOfStockMessageDisplay}"
105
- data-continue-selling="${continueSellingDisplay}"
106
- data-unlimited-quantity-message="${unlimitedQuantityMessageDisplay}"
107
104
  gp-setting='${JSON.stringify({
108
105
  displayByDefault,
109
106
  displayProgressBar,
@@ -143,19 +140,25 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps, pageCont
143
140
  >
144
141
  ${icon}</div>
145
142
  `)}
143
+ <div class="gp-hidden gp-text-white gp-py-1 gp-px-2 gp-mr-1 gp-inline-block gp-my-[1px] gp-text-g-${mainColor} gp-bg-g-${mainColor}" >
144
+ <div id="template">{{ section.settings.gg9aeXbilgC_template | replace: '$quantity$', inventory_quantity }}</div>
145
+ <div id="out-of-stock-message">{{ section.settings.gg9aeXbilgC_outOfStockMessage }}</div>
146
+ <div id="continue-selling">{{ section.settings.gg9aeXbilgC_continueSelling }}</div>
147
+ <div id="unlimited-quantity-message">{{ section.settings.gg9aeXbilgC_unlimitedQuantityMessage }}</div>
148
+ </div>
146
149
  <p
147
150
  data-slot-type="message"
148
151
  class="${appendTypoClass} gp-stock-counter-mark"
149
152
  style="${appendTypoStyle}"
150
153
  >
151
154
  {% if inventory_management == null and inventory_quantity <= 0 %}
152
- ${transformHighlighTag(unlimitedQuantityMessageDisplay ?? getStaticLocale('StockCounter', 'let_buy_now'), mainColor)}
155
+ ${unlimitedQuantityMessageDisplay}
153
156
  {% elsif available == false %}
154
- ${transformHighlighTag(outOfStockMessageDisplay || '', mainColor)}
157
+ ${outOfStockMessageDisplay}
155
158
  {% elsif available and inventory_policy == '${CONTINUE_SELLING_WHEN_OUT_OF_STOCK.toLowerCase()}' and inventory_quantity <= 0 %}
156
- ${transformHighlighTag(continueSellingDisplay || '', mainColor)}
159
+ ${continueSellingDisplay}
157
160
  {% else %}
158
- ${transformHighlighTag(transformNumberTag(templateStringDisplay || '', mainColor, `{{ inventory_quantity }}`), mainColor)}
161
+ ${templateStringDisplay}
159
162
  {% endif %}
160
163
  </p>
161
164
  </div>
@@ -31,7 +31,10 @@ const transformNumberTag = (template, stringColor, quantityLeft)=>{
31
31
  // Is global style color
32
32
  quantityTag = `<span class='gp-text-g-${stringColor}'>$quantity$</span>`;
33
33
  }
34
- return template.replaceAll(DEFAULT_QUANTITY_TEMPLATE, quantityTag.replace('$quantity$', quantityLeft.toString()));
34
+ if (quantityLeft) {
35
+ quantityTag = quantityTag.replace('$quantity$', quantityLeft.toString());
36
+ }
37
+ return template.replaceAll(DEFAULT_QUANTITY_TEMPLATE, quantityTag);
35
38
  };
36
39
  const convertSizeToWidth = (typographyVar)=>{
37
40
  const widthObject = {};
@@ -1,20 +1,19 @@
1
1
  import { useInteraction, useEditorMode } from '@gem-sdk/core';
2
- import { useState, useEffect } from 'react';
2
+ import { useEffect } from 'react';
3
3
 
4
4
  const useTabInteraction = ({ activeKey, setActiveKey, activeTab, refContainer, componentUid })=>{
5
- const [previousTab, setPreviousTab] = useState(activeKey || 1);
6
- const { trigger, onListener, interactionListenerLoaded } = useInteraction();
5
+ const { trigger, onListener, interactionListenerLoaded, saveToElementInteractionData, findElementIncludingSelf } = useInteraction();
7
6
  const mode = useEditorMode();
8
7
  const changeOpenTabInteraction = (params)=>{
9
- const { data, isRollback } = params || {};
10
- if (data === undefined && isRollback === undefined) return;
8
+ const { data, isRollback, element, key } = params || {};
9
+ if (data === undefined && isRollback) return;
10
+ const newData = Number(data) + 1;
11
11
  if (isRollback) {
12
- setActiveKey(previousTab);
13
- setPreviousTab(activeTab);
12
+ setActiveKey(newData);
14
13
  return;
15
14
  }
16
- setPreviousTab(activeTab);
17
- setActiveKey(data + 1);
15
+ saveToElementInteractionData(element, key, String(activeKey));
16
+ setActiveKey(newData);
18
17
  };
19
18
  const dispatchEventTabActive = (index)=>{
20
19
  trigger({
@@ -35,11 +34,16 @@ const useTabInteraction = ({ activeKey, setActiveKey, activeTab, refContainer, c
35
34
  dispatchEventTabActive(activeTab - 1);
36
35
  });
37
36
  const selector = `[data-id="${componentUid}"]`;
37
+ const element = findElementIncludingSelf(document, selector);
38
38
  const removeListener = onListener({
39
39
  event: 'gp:change-open-tab',
40
40
  selector
41
41
  }, (params)=>{
42
- changeOpenTabInteraction(params);
42
+ changeOpenTabInteraction({
43
+ ...params,
44
+ element,
45
+ key: params?.uniqueStorageKey
46
+ });
43
47
  });
44
48
  return ()=>{
45
49
  removeListener?.();
@@ -5,7 +5,6 @@ import { forwardRef, useMemo } from 'react';
5
5
  const Text = /*#__PURE__*/ forwardRef(({ styles, builderAttrs, style, setting, advanced, builderProps, className, children, ...props }, ref)=>{
6
6
  const { text, htmlTag: Element = 'div', options, tagWidth, excludeFlex } = setting ?? {};
7
7
  const composeGlobalSize = makeGlobalSize(setting?.globalSize);
8
- console.log('Text: ', text);
9
8
  const mode = useEditorMode();
10
9
  const getPlaceHolderWhenContentNone = ()=>{
11
10
  let classList = '';
@@ -47,14 +47,14 @@ const HTML5Embed = (props)=>{
47
47
  }),
48
48
  props.thumbnail && showThumbnail && /*#__PURE__*/ jsxs("div", {
49
49
  role: "presentation",
50
- className: "gp-absolute gp-top-0 gp-left-0 gp-w-full",
50
+ className: "gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full",
51
51
  onClick: playVideoAndTurnOffThumbnail,
52
52
  style: props.style,
53
53
  children: [
54
54
  /*#__PURE__*/ jsx("img", {
55
55
  id: "video-thumbnail",
56
56
  src: props.thumbnail,
57
- className: "gp-w-full gp-h-full gp-object-cover gp-thumbnail-video",
57
+ className: "gp-w-full gp-h-full gp-object-contain gp-thumbnail-video",
58
58
  alt: "Video Thumbnail"
59
59
  }),
60
60
  /*#__PURE__*/ jsx("button", {
@@ -3,6 +3,7 @@ import NextImage from '../../image/components/NextImage.liquid.js';
3
3
  import { getSettingPreloadData } from '../../helpers.js';
4
4
 
5
5
  const HTML5Embed = (props)=>{
6
+ const { enableLazyLoadImage, pageContext } = props;
6
7
  const videoId = `gp-video-${props.uid}`;
7
8
  const preloadThumbnail = props.autoplay && props.thumbnail;
8
9
  const offLazyVideo = !props.lazy && props.isVideoComponent;
@@ -19,7 +20,9 @@ const HTML5Embed = (props)=>{
19
20
  '--op': 0,
20
21
  '--z': -1,
21
22
  display: 'none'
22
- }
23
+ },
24
+ enableLazyLoadImage,
25
+ pageContext
23
26
  })}
24
27
  ${RenderIf(props.autoplay, `<script>
25
28
  document.addEventListener("DOMContentLoaded", (event) => {
@@ -68,14 +71,14 @@ const HTML5Embed = (props)=>{
68
71
  </video>
69
72
  <div
70
73
  style="${props.style}"
71
- class="${cls('gp-absolute gp-top-0 gp-left-0 gp-w-full gp-thumbnail-video', {
74
+ class="${cls('gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full gp-thumbnail-video', {
72
75
  'gp-hidden': !props.thumbnail || props.autoplay
73
76
  })}"
74
77
  >
75
78
  <img
76
79
  id="video-thumbnail"
77
80
  src="${props.thumbnail ?? ''}"
78
- class="gp-w-full gp-h-full gp-object-cover"
81
+ class="gp-w-full gp-h-full gp-object-contain"
79
82
  alt="Video Thumbnail"
80
83
  ></img>
81
84
  <button
@@ -3,7 +3,7 @@ import NextImage from '../../image/components/NextImage.liquid.js';
3
3
  import { getSettingPreloadData } from '../../helpers.js';
4
4
 
5
5
  const LiteYouTubeEmbed = (props)=>{
6
- const { style, lazy, preload } = props;
6
+ const { style, lazy, preload, enableLazyLoadImage, pageContext } = props;
7
7
  const videoUid = `gp-video-${props.uid}`;
8
8
  const videoId = encodeURIComponent(props.id);
9
9
  const videoTitle = props.title;
@@ -38,7 +38,7 @@ const LiteYouTubeEmbed = (props)=>{
38
38
  data-title="${videoTitle}"
39
39
  style="${{
40
40
  ...makeStyleResponsive('bgi', {
41
- desktop: preload ? `url('${posterUrl}')` : `url('${imagePlaceholder}')`
41
+ desktop: preload || !enableLazyLoadImage ? `url('${posterUrl}')` : `url('${imagePlaceholder}')`
42
42
  }),
43
43
  ...style
44
44
  }}"
@@ -48,7 +48,9 @@ const LiteYouTubeEmbed = (props)=>{
48
48
  src: posterUrl,
49
49
  alt: 'Poster',
50
50
  className: `gp-invisible gp-w-full gp-h-full gp_lazyforbg`,
51
- isDisableAspectStyle: true
51
+ isDisableAspectStyle: true,
52
+ enableLazyLoadImage,
53
+ pageContext
52
54
  })}
53
55
  <button
54
56
  type="button"