@gem-sdk/components 2.0.0-dev.701 → 2.0.0-dev.703

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 (56) hide show
  1. package/dist/cjs/banner/components/common/common.js +16 -5
  2. package/dist/cjs/banner/components/common/getStyle.js +1 -1
  3. package/dist/cjs/banner/components/hooks/useHeroBanner.js +1 -1
  4. package/dist/cjs/banner/setting/uiV2.js +37 -0
  5. package/dist/cjs/helpers.js +4 -1
  6. package/dist/cjs/image/components/NextImage.liquid.js +2 -2
  7. package/dist/cjs/index.js +4 -0
  8. package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +2 -2
  9. package/dist/cjs/post-purchase/product/settings/product-image/uiV2.js +72 -2
  10. package/dist/cjs/product/components/ProductBadge/index.liquid.js +12 -3
  11. package/dist/cjs/product/components/ProductBadge/utils/generateLiquidContent.js +2 -2
  12. package/dist/cjs/product/components/ProductDescription/index.liquid.js +21 -4
  13. package/dist/cjs/product/components/ProductImagesV2/components/feature-gallery/FeatureImageWithGallery.liquid.js +6 -2
  14. package/dist/cjs/product/components/ProductList/ProductList.liquid.js +4 -8
  15. package/dist/cjs/product/setting/constant/bundle-layout/horizontalThree.js +1 -0
  16. package/dist/cjs/product/setting/constant/bundle-layout/horizontalTwo.js +1 -0
  17. package/dist/cjs/product/setting/constant/bundle-layout/verticalThree.js +1 -0
  18. package/dist/cjs/product/setting/constant/bundle-layout/verticalTwo.js +1 -0
  19. package/dist/cjs/product/setting/product-badge/configs/settings.js +5 -0
  20. package/dist/cjs/product/setting/product-description/configs/settings.js +5 -0
  21. package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/ProductFeatureImage.js +13 -11
  22. package/dist/cjs/stock-counter/components/StockCounter.js +0 -2
  23. package/dist/cjs/stock-counter/components/StockCounter.liquid.js +44 -3
  24. package/dist/cjs/stock-counter/components/common/getContent.js +19 -10
  25. package/dist/cjs/stock-counter/helpers.js +20 -3
  26. package/dist/cjs/stock-counter/index.js +0 -1
  27. package/dist/cjs/stock-counter/setting/configs/settingsV2.js +5 -0
  28. package/dist/esm/banner/components/common/common.js +17 -6
  29. package/dist/esm/banner/components/common/getStyle.js +1 -1
  30. package/dist/esm/banner/components/hooks/useHeroBanner.js +1 -1
  31. package/dist/esm/banner/setting/uiV2.js +37 -0
  32. package/dist/esm/helpers.js +4 -1
  33. package/dist/esm/image/components/NextImage.liquid.js +2 -2
  34. package/dist/esm/index.js +1 -0
  35. package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +2 -2
  36. package/dist/esm/post-purchase/product/settings/product-image/uiV2.js +72 -2
  37. package/dist/esm/product/components/ProductBadge/index.liquid.js +13 -4
  38. package/dist/esm/product/components/ProductBadge/utils/generateLiquidContent.js +2 -2
  39. package/dist/esm/product/components/ProductDescription/index.liquid.js +22 -5
  40. package/dist/esm/product/components/ProductImagesV2/components/feature-gallery/FeatureImageWithGallery.liquid.js +6 -2
  41. package/dist/esm/product/components/ProductList/ProductList.liquid.js +4 -8
  42. package/dist/esm/product/setting/constant/bundle-layout/horizontalThree.js +1 -0
  43. package/dist/esm/product/setting/constant/bundle-layout/horizontalTwo.js +1 -0
  44. package/dist/esm/product/setting/constant/bundle-layout/verticalThree.js +1 -0
  45. package/dist/esm/product/setting/constant/bundle-layout/verticalTwo.js +1 -0
  46. package/dist/esm/product/setting/product-badge/configs/settings.js +5 -0
  47. package/dist/esm/product/setting/product-description/configs/settings.js +5 -0
  48. package/dist/esm/product/setting/product-image-v2/configs/setting-v2/ProductFeatureImage.js +13 -11
  49. package/dist/esm/stock-counter/components/StockCounter.js +0 -2
  50. package/dist/esm/stock-counter/components/StockCounter.liquid.js +46 -5
  51. package/dist/esm/stock-counter/components/common/getContent.js +19 -11
  52. package/dist/esm/stock-counter/helpers.js +20 -4
  53. package/dist/esm/stock-counter/index.js +0 -1
  54. package/dist/esm/stock-counter/setting/configs/settingsV2.js +5 -0
  55. package/dist/types/index.d.ts +17 -5
  56. package/package.json +3 -3
@@ -1,21 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var helpers$1 = require('../../../helpers.js');
4
3
  var _const = require('../../const.js');
5
- var helpers = require('../../helpers.js');
6
4
 
7
- const getLiquidTextContent = (setting, styles)=>{
8
- const { template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage } = setting ?? {};
9
- const { textColor } = styles ?? {};
10
- const mainColor = textColor || 'brand';
5
+ const getLiquidTextContent = (data)=>{
6
+ const { templateStringDisplay, outOfStockMessageDisplay, continueSellingDisplay, unlimitedQuantityMessageDisplay } = data ?? {};
11
7
  return `{% if inventory_management == null and inventory_quantity <= 0 %}
12
- ${helpers.transformHighlighTag(unlimitedQuantityMessage ?? helpers$1.getStaticLocale('StockCounter', 'let_buy_now'), mainColor)}
8
+ ${unlimitedQuantityMessageDisplay}
13
9
  {% elsif available == false %}
14
- ${helpers.transformHighlighTag(outOfStockMessage || '', mainColor)}
10
+ ${outOfStockMessageDisplay}
15
11
  {% elsif available and inventory_policy == '${_const.CONTINUE_SELLING_WHEN_OUT_OF_STOCK.toLowerCase()}' and inventory_quantity <= 0 %}
16
- ${helpers.transformHighlighTag(continueSelling || '', mainColor)}
12
+ ${continueSellingDisplay}
17
13
  {% else %}
18
- ${helpers.transformHighlighTag(helpers.transformNumberTag(templateString || '', mainColor, `{{ inventory_quantity }}`), mainColor)}
14
+ ${templateStringDisplay}
19
15
  {% endif %}`;
20
16
  };
21
17
  const getLiquidInitData = (setting, styles)=>{
@@ -68,6 +64,19 @@ const getLiquidInitData = (setting, styles)=>{
68
64
  }
69
65
  {% endcapture %}`;
70
66
  };
67
+ const getTextDisplayData = (data, styles)=>{
68
+ const { templateStringDisplay, outOfStockMessageDisplay, continueSellingDisplay, unlimitedQuantityMessageDisplay } = data ?? {};
69
+ const { textColor } = styles ?? {};
70
+ const mainColor = textColor || 'brand';
71
+ return `
72
+ <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}" >
73
+ <div id="template">${templateStringDisplay}</div>
74
+ <div id="out-of-stock-message">${outOfStockMessageDisplay}</div>
75
+ <div id="continue-selling">${continueSellingDisplay}</div>
76
+ <div id="unlimited-quantity-message">${unlimitedQuantityMessageDisplay}</div>
77
+ </div>`;
78
+ };
71
79
 
72
80
  exports.getLiquidInitData = getLiquidInitData;
73
81
  exports.getLiquidTextContent = getLiquidTextContent;
82
+ exports.getTextDisplayData = getTextDisplayData;
@@ -28,13 +28,30 @@ const transformNumberTag = (template, stringColor, quantityLeft)=>{
28
28
  let quantityTag = '';
29
29
  // Is hex color
30
30
  if (stringColor.includes('#')) {
31
- quantityTag = `<span style='--c: ${stringColor}'>$quantity$</span>`;
31
+ quantityTag = `<span style='--c: ${stringColor}'><$quantity$></span>`;
32
32
  } else {
33
33
  // Is global style color
34
- quantityTag = `<span class='gp-text-g-${stringColor}'>$quantity$</span>`;
34
+ quantityTag = `<span class='gp-text-g-${stringColor}'><$quantity$></span>`;
35
35
  }
36
- return template.replaceAll(_const.DEFAULT_QUANTITY_TEMPLATE, quantityTag.replace('$quantity$', quantityLeft.toString()));
36
+ if (quantityLeft) {
37
+ quantityTag = quantityTag.replace('<$quantity$>', quantityLeft.toString());
38
+ }
39
+ return template.replaceAll(_const.DEFAULT_QUANTITY_TEMPLATE, quantityTag);
40
+ };
41
+ const convertSizeToWidth = (typographyVar)=>{
42
+ const widthObject = {};
43
+ if (typographyVar['--size']) {
44
+ widthObject['--w'] = typographyVar['--size'];
45
+ }
46
+ if (typographyVar['--size-tablet']) {
47
+ widthObject['--w-tablet'] = typographyVar['--size-tablet'];
48
+ }
49
+ if (typographyVar['--size-mobile']) {
50
+ widthObject['--w-mobile'] = typographyVar['--size-mobile'];
51
+ }
52
+ return widthObject;
37
53
  };
38
54
 
55
+ exports.convertSizeToWidth = convertSizeToWidth;
39
56
  exports.transformHighlighTag = transformHighlighTag;
40
57
  exports.transformNumberTag = transformNumberTag;
@@ -4,7 +4,6 @@ var StockCounter$1 = require('./setting/StockCounter.js');
4
4
  require('react/jsx-runtime');
5
5
  require('react');
6
6
  require('@gem-sdk/core');
7
- require('next/link');
8
7
  require('@gem-sdk/system');
9
8
 
10
9
  const stockCounterSetting = {
@@ -142,6 +142,11 @@ const StockCounterSettingsV2 = [
142
142
  type: 'textarea',
143
143
  autoHeight: true,
144
144
  default: 'Hurry! LET BUY NOW'
145
+ },
146
+ {
147
+ id: 'translate',
148
+ type: 'input',
149
+ default: 'template,outOfStockMessage,continueSelling,unlimitedQuantityMessage'
145
150
  }
146
151
  ]
147
152
  },
@@ -1,8 +1,8 @@
1
- import { getResponsiveValueByScreen, getAspectRatioGlobalSize, makeStyleResponsive, getValueByDevice, cls } from '@gem-sdk/core';
1
+ import { getResponsiveValueByScreen, getAspectRatioGlobalSize, makeStyleResponsive, DEVICES, getValueByDevice, cls } from '@gem-sdk/core';
2
2
  import { getImageSrc } from '../../../image/helpers/getSrcSet.js';
3
3
  import { HREF_TO_SALES_PAGE } from '../../../constant.js';
4
+ import { createBlurDataURL } from '../../../image/components/common/helpers.js';
4
5
 
5
- const imagePlaceholder = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
6
6
  const getContentPosition = (layout, contentPosition1Col, contentPosition2Col)=>{
7
7
  let result = {};
8
8
  const devices = [
@@ -58,13 +58,24 @@ const getBgImage = (background)=>{
58
58
  };
59
59
  return bgImage;
60
60
  };
61
+ const imagePlaceholder = (background)=>{
62
+ const srcSet = getBgImage(background);
63
+ return {
64
+ desktop: createBlurDataURL(srcSet?.desktop?.width ?? 0, srcSet?.desktop?.height ?? 0),
65
+ tablet: createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0),
66
+ mobile: createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0)
67
+ };
68
+ };
61
69
  const getBackgroundImageHeroBanner = (background, enableLazyImage = false, isNotLiquid = false)=>{
62
70
  const srcSet = getBgImage(background);
63
- return makeStyleResponsive('bgi', {
64
- desktop: `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop', isNotLiquid) : imagePlaceholder}')`,
65
- tablet: `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet', isNotLiquid) : imagePlaceholder}')`,
66
- mobile: `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile', isNotLiquid) : imagePlaceholder}')`
71
+ let result = {};
72
+ DEVICES.forEach((device)=>{
73
+ result = {
74
+ ...result,
75
+ [device]: `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, device), device, isNotLiquid) : imagePlaceholder(background)}')`
76
+ };
67
77
  });
78
+ return makeStyleResponsive('bgi', result);
68
79
  };
69
80
  const getAttachmentDevice = (background)=>{
70
81
  let result = {};
@@ -98,7 +98,7 @@ const getBackgroundStyle = (styles, enableParallax, transform)=>{
98
98
  }),
99
99
  ...getGradientBgrStyleByDevice(background, bgiEnableByDevice(background)),
100
100
  '--duration': `${hoverEffectDuration ?? 0}s`,
101
- '--scale': hoverEffectScale ?? 1,
101
+ '--scale': `${hoverEffectScale || 100}%`,
102
102
  ...makeStyleResponsive('pos', getAttachmentDevice(background)),
103
103
  transform,
104
104
  transition: 'transform 300ms cubic-bezier(0,0,0,1)'
@@ -25,7 +25,7 @@ const useHeroBanner = (styles, setting, currentDevice)=>{
25
25
  const enableParallax = Number(setting?.speedParallax || 0) > 0 && backgroundResponsive[currentDevice]?.type === 'image' || false;
26
26
  const onMouseEnterParallax = ()=>{
27
27
  if (hoverEffect && enableParallax) {
28
- setTransform(`${transform} scale(${hoverEffectScale})`);
28
+ setTransform(`${transform} scale(${hoverEffectScale || 100}%)`);
29
29
  }
30
30
  };
31
31
  const onMouseLeaveParallax = ()=>{
@@ -118,6 +118,43 @@ const SettingUIV2 = [
118
118
  controlType: 'setting',
119
119
  removeDevice: true
120
120
  }
121
+ },
122
+ {
123
+ condition: '!background.image.src',
124
+ source: [
125
+ 'background'
126
+ ],
127
+ action: {
128
+ controlId: 'sizeSetting',
129
+ newValue: {
130
+ shapeLinked: false,
131
+ hiddenShape: true
132
+ },
133
+ valueIfNull: {
134
+ width: '100%',
135
+ height: 'fit-content',
136
+ hiddenShape: true
137
+ },
138
+ groupType: 'style',
139
+ controlType: 'size-setting'
140
+ }
141
+ },
142
+ {
143
+ condition: '!!background.image.src',
144
+ source: [
145
+ 'background'
146
+ ],
147
+ action: {
148
+ controlId: 'sizeSetting',
149
+ newValue: {
150
+ hiddenShape: false
151
+ },
152
+ valueIfNull: {
153
+ hiddenShape: false
154
+ },
155
+ groupType: 'style',
156
+ controlType: 'size-setting'
157
+ }
121
158
  }
122
159
  ],
123
160
  options: {
@@ -37,7 +37,7 @@ const isHexTransparent = (hex)=>{
37
37
  return Boolean(a);
38
38
  };
39
39
  const youtubeShortsRegex = /^(?:https?:\/\/)?(?:www\.)?youtube\.com\/shorts\/([^"&?/\s]{11})$/i;
40
- const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate, isReplaceLocationOrigin, isReplaceMaxSize })=>{
40
+ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate, isReplaceLocationOrigin, isReplaceMaxSize, isReplaceInventoryQuantity })=>{
41
41
  const hasLiquidInValue = new RegExp(/\{\{.*?\}\}|\{%.*?%\}/).test(val?.toString() ?? '');
42
42
  const translateLimit = pageContext?.isTranslateWithLocale ? 1000 : 5000;
43
43
  if (!translate || !val?.toString().trim() || val.toString().length > translateLimit || hasLiquidInValue || pageContext?.isPreviewing) return val ?? defaultVal;
@@ -52,6 +52,9 @@ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, i
52
52
  if (isReplaceMaxSize) {
53
53
  locale += ` | replace: '$max_size', '10MB'`;
54
54
  }
55
+ if (isReplaceInventoryQuantity) {
56
+ locale += ` | replace: '<$quantity$>', inventory_quantity | replace: '&lt;$quantity$&gt;', inventory_quantity`;
57
+ }
55
58
  if (isCapitalize) {
56
59
  locale = `${locale} | downcase`;
57
60
  }
@@ -5,8 +5,8 @@ import { getNextImageStyles } from './common/styles.js';
5
5
  import { getNextImageLiquidAttrs } from './helpers/getNextImageLiquidAttrs.js';
6
6
 
7
7
  const NextImage = (props)=>{
8
- const { style, setting, priority, className, pageContext, width, height, isNotLazyload, isDisableObjectFit, isDisableAspectStyle, enableLazyLoadImage = true } = props;
9
- const hasLazyLoad = !isNotLazyload && enableLazyLoadImage && !priority;
8
+ const { style, setting, priority, className, pageContext, width, height, customLazyload, isDisableObjectFit, isDisableAspectStyle, enableLazyLoadImage = true } = props;
9
+ const hasLazyLoad = !customLazyload && enableLazyLoadImage && !priority;
10
10
  const nextImageStyles = createStyle({
11
11
  ...style,
12
12
  ...getNextImageStyles({
package/dist/esm/index.js CHANGED
@@ -320,3 +320,4 @@ export { default as StockCounter } from './stock-counter/components/StockCounter
320
320
  export { default as ThirdPartySlot } from './third-party-slot/components/ThirdPartySlot.js';
321
321
  export { default as ShopPayInstallments } from './shop-pay-installment/components/ShopPayInstallments.js';
322
322
  export { default as Sticky } from './sticky/components/Sticky.js';
323
+ export { convertSizeToWidth, transformHighlighTag, transformNumberTag } from './stock-counter/helpers.js';
@@ -133,13 +133,13 @@ const SettingV2 = [
133
133
  },
134
134
  {
135
135
  id: 'ftEnabled',
136
- type: 'toggle:layout-post-purchase',
136
+ type: 'toggle',
137
137
  label: 'Feature image',
138
138
  default: true
139
139
  },
140
140
  {
141
141
  id: 'ilEnabled',
142
- type: 'toggle:layout-post-purchase',
142
+ type: 'toggle',
143
143
  label: 'Image list',
144
144
  default: true
145
145
  }
@@ -55,7 +55,42 @@ const SettingUIV2 = [
55
55
  fullWidth: true,
56
56
  tooltipPosition: 'right'
57
57
  },
58
- conditionEnable: 'ilEnabled == true'
58
+ conditionEnable: 'ilEnabled == true',
59
+ controlChangeTrigger: {
60
+ settings: [
61
+ {
62
+ condition: `ftEnabled === false && ilEnabled === true`,
63
+ source: [
64
+ 'ilEnabled',
65
+ 'ftEnabled',
66
+ 'layoutType'
67
+ ],
68
+ action: {
69
+ controlId: 'layoutType',
70
+ groupType: 'setting',
71
+ controlType: 'setting',
72
+ newValue: 'two-col'
73
+ }
74
+ },
75
+ {
76
+ condition: `ftEnabled === true && ilEnabled === true`,
77
+ source: [
78
+ 'ilEnabled',
79
+ 'ftEnabled',
80
+ 'layoutType'
81
+ ],
82
+ action: {
83
+ controlId: 'layoutType',
84
+ groupType: 'setting',
85
+ controlType: 'setting',
86
+ newValue: 'left'
87
+ }
88
+ }
89
+ ],
90
+ options: {
91
+ noRecordHistory: true
92
+ }
93
+ }
59
94
  },
60
95
  {
61
96
  setting: {
@@ -101,7 +136,42 @@ const SettingUIV2 = [
101
136
  fullWidth: true,
102
137
  tooltipPosition: 'right'
103
138
  },
104
- conditionEnable: 'ftEnabled == true'
139
+ conditionEnable: 'ftEnabled == true',
140
+ controlChangeTrigger: {
141
+ settings: [
142
+ {
143
+ condition: `ilEnabled === false && ftEnabled === true`,
144
+ source: [
145
+ 'ilEnabled',
146
+ 'ftEnabled',
147
+ 'layoutType'
148
+ ],
149
+ action: {
150
+ controlId: 'layoutType',
151
+ groupType: 'setting',
152
+ controlType: 'setting',
153
+ newValue: 'only-feature'
154
+ }
155
+ },
156
+ {
157
+ condition: `ilEnabled === true && ftEnabled === true`,
158
+ source: [
159
+ 'ilEnabled',
160
+ 'ftEnabled',
161
+ 'layoutType'
162
+ ],
163
+ action: {
164
+ controlId: 'layoutType',
165
+ groupType: 'setting',
166
+ controlType: 'setting',
167
+ newValue: 'left'
168
+ }
169
+ }
170
+ ],
171
+ options: {
172
+ noRecordHistory: true
173
+ }
174
+ }
105
175
  },
106
176
  {
107
177
  label: {
@@ -1,5 +1,5 @@
1
1
  import { template, dataStringify, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
- import { getSettingPreloadData } from '../../../helpers.js';
2
+ import { getDynamicSourceLocales, getSettingPreloadData } from '../../../helpers.js';
3
3
  import { checkDiscountContentProductBadge } from './utils/common.js';
4
4
  import { generateBadgeContent } from './utils/generateLiquidContent.js';
5
5
  import { renderBadgeInFirstTime } from './utils/renderBadgeLiquid.js';
@@ -10,7 +10,7 @@ import { getSubWrapperAttrs, getContainerAttrs, getTextContentAttrs, getImageAtt
10
10
  import { IS_LIQUID } from './constants.js';
11
11
 
12
12
  const ProductBadge = (props)=>{
13
- const { styles, setting } = props;
13
+ const { styles, setting, builderProps, pageContext } = props;
14
14
  const isTextBadge = setting?.shape !== 'image';
15
15
  const isDiscountContent = checkDiscountContentProductBadge(setting?.displayContent);
16
16
  const containerStyle = createStyle({
@@ -74,7 +74,6 @@ const ProductBadge = (props)=>{
74
74
  })
75
75
  });
76
76
  const createDataState = createStateOrContext({
77
- displayContent: setting?.displayContent,
78
77
  minPrice: `{{ minPriceValue | replace: '"', '\\"' | escape }}`,
79
78
  variantIDs: '{{ product.variants | map: "id" | json | escape }}',
80
79
  variantInventoryQuantities: '{{ product.variants | map: "inventory_quantity" | json | escape }}',
@@ -87,9 +86,18 @@ const ProductBadge = (props)=>{
87
86
  productTags: '{{ product.tags | join: "," }}',
88
87
  isTextBadge
89
88
  });
89
+ const { displayContent, translate } = setting ?? {};
90
+ const displayContentVal = getDynamicSourceLocales({
91
+ val: displayContent?.trim(),
92
+ uid: builderProps?.uid,
93
+ settingId: 'displayContent',
94
+ isLiquid: true,
95
+ pageContext,
96
+ translate
97
+ });
90
98
  return template`
91
99
  {% if product %}
92
- ${generateBadgeContent(setting?.displayContent)}
100
+ ${generateBadgeContent(displayContentVal, pageContext?.isPreviewing)}
93
101
  ${renderBadgeInFirstTime(setting?.displayTrigger, isDiscountContent, isTextBadge)}
94
102
  <gp-product-badge
95
103
  ${{
@@ -98,6 +106,7 @@ const ProductBadge = (props)=>{
98
106
  gp-data='${dataStringify(createDataState)}'
99
107
  class="containerClass"
100
108
  style="${containerStyle}"
109
+ data-display-content="${pageContext?.isPreviewing ? displayContentVal : `{{${displayContentVal}}}`}"
101
110
  >
102
111
  <div class="${wrapperClass}">
103
112
  <div
@@ -1,6 +1,6 @@
1
- const generateBadgeContent = (content)=>{
1
+ const generateBadgeContent = (content, isPreviewing)=>{
2
2
  return `
3
- {% assign content = "${content?.trim()}" %}
3
+ {% assign content = ${isPreviewing ? JSON.stringify(content) : content} %}
4
4
 
5
5
  {%if content.size > 0 %}
6
6
  {% if variant.compare_at_price and variant.compare_at_price > 0 %}
@@ -1,13 +1,13 @@
1
1
  import { makeStyleResponsive, makeLineClamp, template, dataStringify, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
- import { getSettingPreloadData } from '../../../helpers.js';
2
+ import { getDynamicSourceLocales, getSettingPreloadData } from '../../../helpers.js';
3
3
  import { createClass, createStyle, createAttr, createStateOrContext, LiquidIf, Liquid, LiquidUnless, If } from '@gem-sdk/system';
4
4
  import { getClasses, getButtonClasses, getClassPreBuilt } from './common/getClasses.js';
5
5
  import { getTextStyle, getButtonStyle, getStaticCss } from './common/getStyle.js';
6
6
  import { ICON_SVG } from './common/const.js';
7
7
 
8
8
  const ProductDescription = (props)=>{
9
- const { setting, advanced, builderProps } = props;
10
- const { htmlTag } = setting ?? {};
9
+ const { setting, advanced, builderProps, pageContext } = props;
10
+ const { htmlTag, translate, viewMoreText, viewLessText } = setting ?? {};
11
11
  const Tag = htmlTag === 'html' ? 'div' : 'p';
12
12
  const gpDescriptionClasses = createClass({
13
13
  'gp-product-description': true,
@@ -58,11 +58,28 @@ const ProductDescription = (props)=>{
58
58
  },
59
59
  textStyle
60
60
  });
61
+ const viewMoreTextDisplay = getDynamicSourceLocales({
62
+ val: viewMoreText,
63
+ uid: builderProps?.uid,
64
+ settingId: 'viewMoreText',
65
+ pageContext,
66
+ translate
67
+ });
68
+ const viewLessTextDisplay = getDynamicSourceLocales({
69
+ val: viewLessText,
70
+ uid: builderProps?.uid,
71
+ settingId: 'viewLessText',
72
+ pageContext,
73
+ translate
74
+ });
61
75
  return LiquidIf(noDescriptionHtml, '', Liquid(template`
62
76
  <gp-product-description-v2
63
77
  ${attr}
64
78
  class="${gpDescriptionClasses}"
65
- gp-data='${dataStringify(stateData).replaceAll("'", '&#039;')}'>
79
+ gp-data='${dataStringify(stateData).replaceAll("'", '&#039;')}'
80
+ data-view-more-text="${viewMoreTextDisplay}"
81
+ data-view-less-text="${viewLessTextDisplay}"
82
+ >
66
83
  <style>${textDescriptionCss}</style>
67
84
  <div class="${classPreBuilt}" ></div>
68
85
  ${LiquidUnless('product', `<p>Product not found</p>`, template`<${Tag} ${textAttr} class="${textClasses}" style="${textStyle}">
@@ -70,7 +87,7 @@ const ProductDescription = (props)=>{
70
87
  </${Tag}>
71
88
  ${LiquidUnless(noDescriptionHtml, template`<button type="button" class="${buttonClasses}" style="${buttonStyle}">
72
89
  <span class="${showMoreTextClasses}">
73
- ${If(false, setting?.viewLessText || '', setting?.viewMoreText)}
90
+ ${If(false, viewLessTextDisplay?.toString(), viewMoreTextDisplay?.toString())}
74
91
  </span>
75
92
  ${If(setting?.enableViewMoreIcon, template`<span class="${showMoreIconClasses}">${ICON_SVG}</span>`, ' ')}
76
93
  </button>`)}`)}
@@ -89,8 +89,12 @@ const FeatureImageWithGallery = ({ builderPropUID, children, enableLazyLoadImage
89
89
  const renderFeaturedImageOnly = (className, hasHoverEffect)=>{
90
90
  return template`
91
91
  {% assign src = featureMedia.src %}
92
- ${If(hasHoverEffect && setting.hoverEffect == 'other', `{% assign otherImage = product.media[${setting.otherImage}] %}
93
- {% assign src = otherImage.src %}
92
+ ${If(hasHoverEffect && setting.hoverEffect == 'other', `{% assign media_length = product.media | size %}
93
+ {% assign other_image_index = ${setting.otherImage} | plus: 0 %}
94
+ {% if other_image_index >= media_length %}
95
+ {% assign other_image_index = media_length | minus: 1 %}
96
+ {% endif %}
97
+ {% assign otherImage = product.media[other_image_index] %}
94
98
  ${LiquidIf(`otherImage.media_type != 'image'`, `{% assign src = otherImage.preview_image.src %}`)}
95
99
  `)}
96
100
  ${NextImage({
@@ -32,6 +32,7 @@ const ProductList = (props)=>{
32
32
  endif
33
33
  assign arrayRelatedExclude = relatedExclude | split: ","
34
34
  assign idSelectedList = ''
35
+ assign relatedListProduct = null
35
36
  for collection in collections
36
37
  assign collectionId = collection.id
37
38
  assign isInCollection = false
@@ -46,20 +47,15 @@ const ProductList = (props)=>{
46
47
  break
47
48
  else
48
49
  assign idSelectedList = idSelectedList | append: "," | append: product.id
50
+ assign productSelected = product | sort
51
+ assign relatedListProduct = relatedListProduct | concat: productSelected
49
52
  endif
50
53
  endfor
51
54
  endif
52
55
  endunless
53
56
  endfor
54
57
  endfor
55
- for item in allProductsPaginated
56
- assign handle = item.handle
57
- assign productF = item | sort
58
- if idSelectedList contains item.id
59
- assign products = products | concat: productF
60
- endif
61
- endfor
62
- assign products = products | uniq
58
+ assign products = relatedListProduct | uniq
63
59
  when 'vendor'
64
60
  assign vendorAssignProduct = assignProduct.vendor
65
61
  assign productFilter = allProductsPaginated | where: 'vendor', vendorAssignProduct
@@ -58,6 +58,7 @@ const horizontalThree = [
58
58
  settings: {
59
59
  contentType: 'text',
60
60
  displayContent: 'SALE {percent_discount}',
61
+ translate: 'displayContent',
61
62
  displayTrigger: [
62
63
  {
63
64
  conditionType: 'exact_or_above',
@@ -57,6 +57,7 @@ const horizontalTwo = [
57
57
  settings: {
58
58
  contentType: 'text',
59
59
  displayContent: 'SALE {percent_discount}',
60
+ translate: 'displayContent',
60
61
  displayTrigger: [
61
62
  {
62
63
  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',
@@ -132,6 +132,11 @@ const ProductBadgeSettings = [
132
132
  message: `{inventory_quantity} Only work with product enable “Track inventory”`,
133
133
  closable: true
134
134
  },
135
+ {
136
+ id: 'translate',
137
+ type: 'input',
138
+ default: 'displayContent'
139
+ },
135
140
  {
136
141
  id: 'contentType',
137
142
  label: 'Shape',
@@ -61,6 +61,11 @@ const ProductDescriptionSettings = [
61
61
  default: 'Show less',
62
62
  hide: true
63
63
  },
64
+ {
65
+ id: 'translate',
66
+ type: 'input',
67
+ default: 'viewMoreText,viewLessText'
68
+ },
64
69
  {
65
70
  id: 'enableViewMoreIcon',
66
71
  label: 'Enable Icon',
@@ -66,27 +66,29 @@ const productFeatureImageSetting = [
66
66
  {
67
67
  id: 'otherImage',
68
68
  label: 'Other image',
69
- type: 'select',
70
- options: [
71
- {
72
- title: 'Image 1',
73
- value: 0
74
- },
69
+ type: 'dropdown:input',
70
+ isNumber: true,
71
+ isIndexValue: true,
72
+ displayOptions: [
75
73
  {
76
- title: 'Image 2',
74
+ label: 'Image 1',
77
75
  value: 1
78
76
  },
79
77
  {
80
- title: 'Image 3',
78
+ label: 'Image 2',
81
79
  value: 2
82
80
  },
83
81
  {
84
- title: 'Image 4',
82
+ label: 'Image 3',
85
83
  value: 3
86
84
  },
87
85
  {
88
- title: 'Last image',
89
- value: -1
86
+ label: 'Image 4',
87
+ value: 4
88
+ },
89
+ {
90
+ label: 'Last image',
91
+ value: 'Last image'
90
92
  }
91
93
  ],
92
94
  default: 0
@@ -5,8 +5,6 @@ import { useStockCounterInteraction } from '../hooks/useStockCounterInteraction.
5
5
  import { getInlineCss } from './common/getInlineCss.js';
6
6
  import { getProgressBarClasses, getContainerClasses, getWrapperIconClasses, getIconClasses, getTextClasses, getWrapperClasses } from './common/getClasses.js';
7
7
  import { getProgressBarStyles, getContainerStyles, getWrapperStyles, getIconStyles, getTextStyles } from './common/getStyles.js';
8
- import 'next/link';
9
- import '@gem-sdk/core';
10
8
  import { getWrapperAttrs, getIconAttrs } from './common/getAttrs.js';
11
9
  import { createClass, createStyle, createAttr } from '@gem-sdk/system';
12
10
  import { useStockCounter } from './hook/useStockCounter.js';