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