@gem-sdk/components 8.0.0-dev.25 → 8.0.0-staging.9

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 (58) hide show
  1. package/dist/cjs/carousel-v3/components/swiper/Swiper.js +1 -1
  2. package/dist/cjs/countdown-timer/common/helpers.js +1 -1
  3. package/dist/cjs/countdown-timer/hooks/useCountDownTimer.js +1 -1
  4. package/dist/cjs/countdown-timer/hooks/useTimeLeft.js +1 -1
  5. package/dist/cjs/countdown-timer/settings/Countdown.js +1 -1
  6. package/dist/cjs/countdown-timer/settings/configs/setting.js +1 -1
  7. package/dist/cjs/countdown-timer/settings/configs/ui-v2.js +1 -1
  8. package/dist/cjs/post-purchase/product/components/ProductPrice.js +1 -1
  9. package/dist/cjs/post-purchase/product/constants/ProductOfferPlaceholder.js +1 -1
  10. package/dist/cjs/post-purchase/product/hooks/useGetMoneyLines.js +1 -1
  11. package/dist/cjs/product/components/product-badge/ProductBadge.liquid.js +10 -10
  12. package/dist/cjs/product/components/product-badge/common/styles.js +1 -1
  13. package/dist/cjs/product/components/product-badge/utils/common.js +1 -1
  14. package/dist/cjs/product/components/product-badge/utils/renderBadgeLiquid.js +4 -3
  15. package/dist/cjs/product/components/product-button/ProductButton.liquid.js +4 -6
  16. package/dist/cjs/product/components/product-button/hooks/useAddToCart.js +1 -1
  17. package/dist/cjs/product/components/product-discount-tag/hooks/useGpDiscountTag.js +1 -1
  18. package/dist/cjs/product/components/product-images-v3/components/feature-gallery/FeatureImageWithGallery.liquid.js +5 -5
  19. package/dist/cjs/product/components/product-list-v3/ProductList.js +1 -1
  20. package/dist/cjs/product/components/product-price/hooks/useGpPrice.js +1 -1
  21. package/dist/cjs/product/components/product-variants/ProductVariants.liquid.js +77 -27
  22. package/dist/cjs/product/components/product-variants/common/base/styles.js +1 -1
  23. package/dist/cjs/product/components/product-variants/components/color/color.liquid.js +3 -3
  24. package/dist/cjs/product/components/product-wrap/Product.liquid.js +12 -10
  25. package/dist/cjs/product/helpers/product-bundle.js +1 -1
  26. package/dist/esm/carousel-v3/components/swiper/Swiper.js +1 -1
  27. package/dist/esm/countdown-timer/common/helpers.js +1 -1
  28. package/dist/esm/countdown-timer/hooks/useCountDownTimer.js +1 -1
  29. package/dist/esm/countdown-timer/hooks/useTimeLeft.js +1 -1
  30. package/dist/esm/countdown-timer/settings/Countdown.js +1 -1
  31. package/dist/esm/countdown-timer/settings/configs/setting.js +1 -1
  32. package/dist/esm/countdown-timer/settings/configs/ui-v2.js +1 -1
  33. package/dist/esm/post-purchase/product/components/ProductPrice.js +1 -1
  34. package/dist/esm/post-purchase/product/constants/ProductOfferPlaceholder.js +1 -1
  35. package/dist/esm/post-purchase/product/hooks/useGetMoneyLines.js +1 -1
  36. package/dist/esm/product/components/product-badge/ProductBadge.liquid.js +21 -21
  37. package/dist/esm/product/components/product-badge/common/styles.js +1 -1
  38. package/dist/esm/product/components/product-badge/utils/common.js +1 -1
  39. package/dist/esm/product/components/product-badge/utils/renderBadgeLiquid.js +4 -3
  40. package/dist/esm/product/components/product-button/ProductButton.liquid.js +9 -11
  41. package/dist/esm/product/components/product-button/hooks/useAddToCart.js +1 -1
  42. package/dist/esm/product/components/product-discount-tag/hooks/useGpDiscountTag.js +1 -1
  43. package/dist/esm/product/components/product-images-v3/components/feature-gallery/FeatureImageWithGallery.liquid.js +18 -18
  44. package/dist/esm/product/components/product-list-v3/ProductList.js +1 -1
  45. package/dist/esm/product/components/product-price/hooks/useGpPrice.js +1 -1
  46. package/dist/esm/product/components/product-variants/ProductVariants.liquid.js +82 -32
  47. package/dist/esm/product/components/product-variants/common/base/styles.js +1 -1
  48. package/dist/esm/product/components/product-variants/components/color/color.liquid.js +3 -3
  49. package/dist/esm/product/components/product-wrap/Product.liquid.js +33 -31
  50. package/dist/esm/product/helpers/product-bundle.js +1 -1
  51. package/dist/types/index.d.ts +0 -1
  52. package/package.json +4 -4
  53. package/dist/cjs/product/components/product-variants/OptionVariantsNewFormat.liquid.js +0 -41
  54. package/dist/cjs/product/components/product-variants/OptionVariantsOldFormat.liquid.js +0 -66
  55. package/dist/cjs/product/components/product-variants/common/const.js +0 -1
  56. package/dist/esm/product/components/product-variants/OptionVariantsNewFormat.liquid.js +0 -41
  57. package/dist/esm/product/components/product-variants/OptionVariantsOldFormat.liquid.js +0 -66
  58. package/dist/esm/product/components/product-variants/common/const.js +0 -1
@@ -1,14 +1,14 @@
1
- import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-sdk/core";import o from"../../../grid/components/row/Row.liquid.js";import{LiquidIf as a,If as d}from"@gem-sdk/system";import{getSettingPreloadData as n,getStaticLocale as s}from"../../../helpers.js";import{getData as c,DYNAMIC_PRODUCT_STATUS as p,STATIC_PRODUCT_STATUS as l,PRODUCT_ID_LATEST as u}from"./common/helpers.js";let Product=f=>{let{children:m,setting:g,style:y,builderProps:v,rawChildren:_,advanced:$}=f,{isSyncProduct:I}=g??{},{rowSetting:S,rowStyles:b,formatVariantId:j,formatProductId:h,productStatus:q,preSelectedOptionIds:V,productHandle:P,advancedStyle:k}=c(f),w=()=>t`
1
+ import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as o}from"@gem-sdk/core";import r from"../../../grid/components/row/Row.liquid.js";import{LiquidIf as a,If as n,Liquid as d,LiquidFor as s}from"@gem-sdk/system";import{getSettingPreloadData as c,getStaticLocale as p}from"../../../helpers.js";import{getData as l,DYNAMIC_PRODUCT_STATUS as u,STATIC_PRODUCT_STATUS as f,PRODUCT_ID_LATEST as m}from"./common/helpers.js";let Product=g=>{let{children:_,setting:v,style:y,builderProps:$,rawChildren:b,advanced:I}=g,{isSyncProduct:S}=v??{},{rowSetting:j,rowStyles:h,formatVariantId:q,formatProductId:V,productStatus:P,preSelectedOptionIds:k,productHandle:w,advancedStyle:E}=l(g),x=()=>t`
2
2
  {%- liquid
3
3
  if request.page_type == 'product'
4
- if '${q}' == '${l}'
5
- if '${h}' == '${u}'
4
+ if '${P}' == '${f}'
5
+ if '${V}' == '${m}'
6
6
  paginate collections.all.products by 100000
7
7
  assign product = collections.all.products | sort: 'created_at' | reverse | first
8
8
  endpaginate
9
9
  else
10
- assign product = all_products['${P}']
11
- assign productId = '${h}' | times: 1
10
+ assign product = all_products['${w}']
11
+ assign productId = '${V}' | times: 1
12
12
  if product == empty or product == null
13
13
  paginate collections.all.products by 100000
14
14
  for item in collections.all.products
@@ -21,13 +21,13 @@ import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-s
21
21
  endif
22
22
  endif
23
23
  else
24
- if '${h}' == '${u}'
24
+ if '${V}' == '${m}'
25
25
  paginate collections.all.products by 100000
26
26
  assign product = collections.all.products | sort: 'created_at'| reverse | first
27
27
  endpaginate
28
28
  else
29
- assign product = all_products['${P}']
30
- assign productId = '${h}' | times: 1
29
+ assign product = all_products['${w}']
30
+ assign productId = '${V}' | times: 1
31
31
  if product == empty or product == null
32
32
  paginate collections.all.products by 100000
33
33
  for item in collections.all.products
@@ -40,11 +40,11 @@ import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-s
40
40
  endif
41
41
  endif
42
42
  -%}
43
- `,E=()=>t`
43
+ `,A=()=>t`
44
44
  {%- liquid
45
45
  if request.page_type != 'product'
46
- assign product = all_products['${P}']
47
- assign productId = '${h}' | times: 1
46
+ assign product = all_products['${w}']
47
+ assign productId = '${V}' | times: 1
48
48
  if product == empty or product == null
49
49
  paginate collections.all.products by 100000
50
50
  for item in collections.all.products
@@ -56,30 +56,32 @@ import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-s
56
56
  endif
57
57
  endif
58
58
  -%}
59
- `,x=()=>t`
59
+ `,B=()=>t`
60
60
  {%- assign gpBkProduct = product -%}
61
- ${d(q==p,E(),w())}
62
- `,A=()=>t`
63
- {%- assign initVariantId = ${j} -%}
64
- {%- assign product_form_id = 'product-form-' | append: "${v?.uid}" -%}
65
- ${j?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
66
- ${j?"{%- assign productSelectedVariant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}"}
61
+ ${n(P==u,A(),x())}
62
+ `,G=()=>t`
63
+ ${d("{%- assign total_combinations = 1 -%}")}
64
+ ${s("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
65
+ {%- assign initVariantId = ${q} -%}
66
+ {%- assign product_form_id = 'product-form-' | append: "${$?.uid}" -%}
67
+ ${q?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
68
+ ${q?"{%- assign productSelectedVariant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}"}
67
69
  {%-if productSelectedVariant == empty or productSelectedVariant == null -%}
68
70
  {%- assign productSelectedVariant = product.selected_or_first_available_variant -%}
69
71
  {%- endif -%}
70
72
  {%-if variant == empty or variant == null -%}
71
73
  {%- assign variant = product.selected_or_first_available_variant -%}
72
74
  {%- endif -%}
73
- `,B=()=>t`
74
- <div class="gp-text-center">${s("Product","product_not_found")}</div>
75
- `,G=()=>t`
76
- ${A()}
75
+ `,H=()=>t`
76
+ <div class="gp-text-center">${p("Product","product_not_found")}</div>
77
+ `,O=()=>t`
78
+ ${G()}
77
79
  <gp-product
78
- data-uid="${v?.uid}"
79
- data-id="${v?.uid}"
80
- style="${k}"
81
- class="${$?.cssClass}"
82
- gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${V}], "isSyncProduct": "${I}", "variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
80
+ data-uid="${$?.uid}"
81
+ data-id="${$?.uid}"
82
+ style="${E}"
83
+ class="${I?.cssClass}"
84
+ gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${k}], "isSyncProduct": "${S}", "variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
83
85
  gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }}}'
84
86
  >
85
87
  <product-form class="product-form">
@@ -87,13 +89,13 @@ import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-s
87
89
  <input type="hidden" name="id" value="{{ variant.id }}" />
88
90
  <input type="hidden" name="quantity" value="{{ quantity }}" />
89
91
  <button type="submit" onclick="return false;" style="display:none;"></button>
90
- ${o({builderProps:{...v,uid:v?.uid,uidInteraction:`${v?.uid}-row`},style:y,styles:b,setting:S,children:m,rawChildren:_})}
92
+ ${r({builderProps:{...$,uid:$?.uid,uidInteraction:`${$?.uid}-row`},style:y,styles:h,setting:j,children:_,rawChildren:b})}
91
93
  {%- endform -%}
92
94
  </product-form>
93
95
  </gp-product>
94
96
  {%- assign product = gpBkProduct -%}
95
97
  `;return t`
96
- ${x()}
97
- ${a("product != empty and product != null",G(),B())}
98
- ${e(i,`<script ${n('class="gps-link" delay',"src")}="{{ 'gp-product-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${n('class="gps-link" delay',"src")}="${r}/assets-v2/gp-product-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
98
+ ${B()}
99
+ ${a("product != empty and product != null",O(),H())}
100
+ ${e(i,`<script ${c('class="gps-link" delay',"src")}="{{ 'gp-product-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${c('class="gps-link" delay',"src")}="${o}/assets-v2/gp-product-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
99
101
  `};export{Product as default};
@@ -1 +1 @@
1
- import{convertDecimalToNumber as t,formatMoney as e}from"@gem-sdk/core";import{DiscountType as n}from"../components/constants/product-bundle.js";let noDiscount=t=>({discountPercentAmount:0,discountAmount:e("0",t)}),applyBundleDiscountAmount=o=>{let{currentVariant:u,bundleItem:c,options:r}=o;if(!r?.useProductCompareAtPrice&&c?.discountType===n.NoDiscount||!c||!u?.price)return noDiscount(r?.moneyFormat||"${{amount}}");let i=t(u?.price)??0,a=t(u?.salePrice)??i,m=Number(c?.quantity),s=calculateBundleFixedDiscount(i,c),d=discountPercentAmount(s,m*i),l=i*m-s,p=a*m;return a<=i&&s<=0?noDiscount(r?.moneyFormat||"${{amount}}"):{discountPercentAmount:r?.useProductCompareAtPrice?calculateDiffPercentPrice(l,p):d,discountAmount:r?.useProductCompareAtPrice?calculateDiffFixedPrice(l,p,r?.moneyFormat):e(s.toString(),r?.moneyFormat)}},calculateDiffPercentPrice=(t,e)=>{let n=(e-t)/e*100;return Math.round(n)},calculateDiffFixedPrice=(t,n,o)=>e((n-t).toString(),o),calculateBundleFixedDiscount=(t,e)=>{let o=parseInt(e?.discountValue);return e?.discountType===n.Percentage?t*e.quantity*o/100:e?.discountType===n.FixedAmount?o:0},discountPercentAmount=(t,e)=>Math.round(t/e*100);export{applyBundleDiscountAmount};
1
+ import{formatMoney as t}from"@gem-sdk/core";import{DiscountType as e}from"../components/constants/product-bundle.js";let noDiscount=e=>({discountPercentAmount:0,discountAmount:t("0",e)}),applyBundleDiscountAmount=n=>{let{currentVariant:o,bundleItem:u,options:c}=n;if(!c?.useProductCompareAtPrice&&u?.discountType===e.NoDiscount||!u||!o?.price)return noDiscount(c?.moneyFormat||"${{amount}}");let r=Number(o?.price),i=Number(o?.salePrice)||r,a=Number(u?.quantity),m=calculateBundleFixedDiscount(r,u),s=discountPercentAmount(m,a*r),d=r*a-m,l=i*a;return i<=r&&m<=0?noDiscount(c?.moneyFormat||"${{amount}}"):{discountPercentAmount:c?.useProductCompareAtPrice?calculateDiffPercentPrice(d,l):s,discountAmount:c?.useProductCompareAtPrice?calculateDiffFixedPrice(d,l,c?.moneyFormat):t(m.toString(),c?.moneyFormat)}},calculateDiffPercentPrice=(t,e)=>{let n=(e-t)/e*100;return Math.round(n)},calculateDiffFixedPrice=(e,n,o)=>t((n-e).toString(),o),calculateBundleFixedDiscount=(t,n)=>{let o=parseInt(n?.discountValue);return n?.discountType===e.Percentage?t*n.quantity*o/100:n?.discountType===e.FixedAmount?o:0},discountPercentAmount=(t,e)=>Math.round(t/e*100);export{applyBundleDiscountAmount};
@@ -1374,7 +1374,6 @@ type CountdownSettingProps = {
1374
1374
  enableHour?: boolean;
1375
1375
  enableMinute?: boolean;
1376
1376
  enableSecond?: boolean;
1377
- localTime?: boolean;
1378
1377
  dayLabel?: string;
1379
1378
  hourLabel?: string;
1380
1379
  minuteLabel?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "8.0.0-dev.25",
3
+ "version": "8.0.0-staging.9",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,9 +26,9 @@
26
26
  "scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "8.0.0-dev.25",
30
- "@gem-sdk/styles": "7.0.1-dev.6",
31
- "@gem-sdk/system": "7.0.1-dev.6",
29
+ "@gem-sdk/core": "8.0.0-staging.8",
30
+ "@gem-sdk/styles": "7.0.1-staging.0",
31
+ "@gem-sdk/system": "7.0.1-staging.0",
32
32
  "@types/react-transition-group": "^4.4.12",
33
33
  "tsup": "^8.5.0",
34
34
  "postcss-import": "^16.1.1",
@@ -1,41 +0,0 @@
1
- "use strict";var core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),_const=require("./common/const.js");const renderOptionValuesNewFormatSwatches=e=>{let{renderVariantItem:s,variantPresetsLiquid:i}=e;return core.template`
2
- ${system.Liquid("{%- assign optionRendered = false -%}")}
3
- ${system.Liquid("{%- assign swatches = shop.metafields.GEMPAGES.swatchesJSONFormat.value -%}")}
4
-
5
- ${system.Liquid(`{% for swatch in swatches %}
6
- {%- assign optionTitle = swatch.optionTitle -%}
7
- {%- assign optionType = swatch.optionType -%}
8
- {%- assign labelsString = "" -%}
9
- {%- assign colorArraysString = "" -%}
10
- {%- assign imageUrlsString = "" -%}
11
-
12
- {% for optionValue in swatch.optionValues %}
13
- {%- assign labelsString = labelsString | append: optionValue.label | append: '${_const.OPTION_VALUES_DELIMITER}' -%}
14
- {%- assign colorsJoined = optionValue.colors | join: '${_const.OPTION_VALUES_DELIMITER}' -%}
15
- {%- assign colorArraysString = colorArraysString | append: colorsJoined | append: '${_const.OPTION_VALUES_DELIMITER}' -%}
16
- {%- assign imageUrlsString = imageUrlsString | append: optionValue.imageUrl | append: '${_const.OPTION_VALUES_DELIMITER}' -%}
17
- {% endfor %}
18
-
19
- {%- assign labels = labelsString | split: '${_const.OPTION_VALUES_DELIMITER}' | slice: 0, labelsString.size -%}
20
- {%- assign colorStrings = colorArraysString | split: '${_const.OPTION_VALUES_DELIMITER}' | slice: 0, colorArraysString.size -%}
21
- {%- assign imageUrls = imageUrlsString | split: '${_const.OPTION_VALUES_DELIMITER}' | slice: 0, imageUrlsString.size -%}
22
-
23
- {% if optionTitle == option.name %}
24
- {%- assign variantPresetString = "${i}" -%}
25
- {%- assign optionName = option.name | replace: "'", "'" | replace: '"', '"' -%}
26
- {%- assign items = variantPresetString | split: '($2)' -%}
27
- {%- assign type = 'dropdown' -%}
28
-
29
- {% for item in items %}
30
- {%- assign itemPreset = item | split: '($1)' -%}
31
- {% if itemPreset[0] == optionName %}{%- assign type = itemPreset[1] -%}{% endif %}
32
- {% if itemPreset[0] == 'base' %}{%- assign type = itemPreset[1] -%}{% endif %}
33
- {% endfor %}
34
- {%- assign optionRendered = true -%}
35
-
36
- ${s({showDropdown:!0})}
37
- {% endif %}
38
- {% endfor %}`)}
39
-
40
- ${system.LiquidIf("optionRendered == false",s({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
41
- `};exports.renderOptionValuesNewFormatSwatches=renderOptionValuesNewFormatSwatches;
@@ -1,66 +0,0 @@
1
- "use strict";var system=require("@gem-sdk/system"),core=require("@gem-sdk/core");const renderOptionValuesOld=s=>{let{renderVariantItem:e,variantPresetsLiquid:i}=s;return core.template`
2
- ${system.Liquid("{%- assign optionRendered = false -%}")}
3
- ${system.Liquid("{%- assign swatches = shop.metafields.GEMPAGES.swatches -%}")}
4
- ${system.Liquid("{%- assign swatchesItems = swatches | split: '($1)' -%}")}
5
-
6
- ${system.LiquidFor("swatchesItem in swatchesItems",`
7
- ${system.Liquid('{%- assign colorArraysString = "" -%}')}
8
- ${system.Liquid('{%- assign labelsString = "" -%}')}
9
- ${system.Liquid('{%- assign imageUrlsString = "" -%}')}
10
- ${system.Liquid("{%- assign attrItems = swatchesItem | split: '($3)' -%}")}
11
-
12
- ${system.LiquidFor("attrItem in attrItems",`
13
- ${system.Liquid("{%- assign attrs = attrItem | split: '($2)' -%}")}
14
- ${system.Liquid("{%- assign optionKey = attrs[0] -%}")}
15
- ${system.Liquid("{%- assign optionValue = attrs[1] -%}")}
16
- ${system.Liquid(`
17
- {% if optionKey == 'optionTitle' %}
18
- {% assign optionTitle = optionValue %}
19
- {% elsif optionKey == 'optionType' %}
20
- {% assign optionType = optionValue %}
21
- {% endif %}
22
- `)}
23
-
24
- ${system.LiquidIf('optionKey == "optionValues"',`
25
- ${system.Liquid("{%- assign opValueItems = optionValue | split: '($4)' -%}")}
26
- ${system.LiquidFor("opValueItem in opValueItems",`
27
- ${system.Liquid("{%- assign opValueItemAttrs = opValueItem | split: '($6)' -%}")}
28
- ${system.LiquidFor("opValueItemAttr in opValueItemAttrs",`
29
- ${system.Liquid("{%- assign attrs = opValueItemAttr | split: '($5)' -%}")}
30
- ${system.Liquid("{%- assign opValueItemKey = attrs[0] -%}")}
31
- ${system.Liquid("{%- assign opValueItemValue = attrs[1] -%}")}
32
-
33
- ${system.LiquidIf('opValueItemKey == "label"',`${system.Liquid("{%- assign labelsString = labelsString | append: opValueItemValue -%}")}
34
- ${system.Liquid('{%- assign labelsString = labelsString | append: "($8)" -%}')}`)}
35
-
36
- ${system.LiquidIf('opValueItemKey == "colors"',`${system.Liquid("{%- assign colorArraysString = colorArraysString | append: opValueItemValue -%}")}
37
- ${system.Liquid('{%- assign colorArraysString = colorArraysString | append: "($8)" -%}')}`)}
38
-
39
- ${system.LiquidIf('opValueItemKey == "imageUrl"',`${system.Liquid("{%- assign imageUrlsString = imageUrlsString | append: opValueItemValue -%}")}
40
- ${system.Liquid('{%- assign imageUrlsString = imageUrlsString | append: "($8)" -%}')}`)}
41
- `)}
42
- `)}
43
- `)}
44
- `)}
45
-
46
- ${system.Liquid("{%- assign labels = labelsString | split: '($8)' -%}")}
47
- ${system.Liquid("{%- assign colorStrings = colorArraysString | split: '($8)' -%}")}
48
- ${system.Liquid("{%- assign imageUrls = imageUrlsString | split: '($8)' -%}")}
49
-
50
- ${system.LiquidIf("optionTitle == option.name",`
51
- ${system.Liquid(`{%- assign variantPresetString = "${i}" -%}`)}
52
- ${system.Liquid('{%- assign optionName = option.name | replace: "\'", "&apos;" | replace: \'"\', "&quot;" -%}')}
53
- ${system.Liquid("{%- assign items = variantPresetString | split:'($2)' -%}")}
54
- ${system.Liquid("{%- assign type = 'dropdown' -%}")}
55
- ${system.LiquidFor("item in items",`
56
- ${system.Liquid("{%- assign itemPreset = item | split:'($1)' -%}")}
57
- ${system.LiquidIf("itemPreset[0] == optionName",system.Liquid("{%- assign type = itemPreset[1] -%}"))}
58
- ${system.LiquidIf('itemPreset[0] == "base"',system.Liquid("{%- assign type = itemPreset[1] -%}"))}
59
- `)}
60
- ${system.Liquid("{%- assign optionRendered = true -%}")}
61
- ${e({showDropdown:!0})}
62
- `)}
63
- `)}
64
-
65
- ${system.LiquidIf("optionRendered == false",e({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
66
- `};exports.renderOptionValuesOld=renderOptionValuesOld;
@@ -1 +0,0 @@
1
- "use strict";const OPTION_VALUES_DELIMITER="|||";exports.OPTION_VALUES_DELIMITER="|||";
@@ -1,41 +0,0 @@
1
- import{template as e}from"@gem-sdk/core";import{Liquid as s,LiquidIf as i}from"@gem-sdk/system";import{OPTION_VALUES_DELIMITER as n}from"./common/const.js";let renderOptionValuesNewFormatSwatches=t=>{let{renderVariantItem:o,variantPresetsLiquid:r}=t;return e`
2
- ${s("{%- assign optionRendered = false -%}")}
3
- ${s("{%- assign swatches = shop.metafields.GEMPAGES.swatchesJSONFormat.value -%}")}
4
-
5
- ${s(`{% for swatch in swatches %}
6
- {%- assign optionTitle = swatch.optionTitle -%}
7
- {%- assign optionType = swatch.optionType -%}
8
- {%- assign labelsString = "" -%}
9
- {%- assign colorArraysString = "" -%}
10
- {%- assign imageUrlsString = "" -%}
11
-
12
- {% for optionValue in swatch.optionValues %}
13
- {%- assign labelsString = labelsString | append: optionValue.label | append: '${n}' -%}
14
- {%- assign colorsJoined = optionValue.colors | join: '${n}' -%}
15
- {%- assign colorArraysString = colorArraysString | append: colorsJoined | append: '${n}' -%}
16
- {%- assign imageUrlsString = imageUrlsString | append: optionValue.imageUrl | append: '${n}' -%}
17
- {% endfor %}
18
-
19
- {%- assign labels = labelsString | split: '${n}' | slice: 0, labelsString.size -%}
20
- {%- assign colorStrings = colorArraysString | split: '${n}' | slice: 0, colorArraysString.size -%}
21
- {%- assign imageUrls = imageUrlsString | split: '${n}' | slice: 0, imageUrlsString.size -%}
22
-
23
- {% if optionTitle == option.name %}
24
- {%- assign variantPresetString = "${r}" -%}
25
- {%- assign optionName = option.name | replace: "'", "'" | replace: '"', '"' -%}
26
- {%- assign items = variantPresetString | split: '($2)' -%}
27
- {%- assign type = 'dropdown' -%}
28
-
29
- {% for item in items %}
30
- {%- assign itemPreset = item | split: '($1)' -%}
31
- {% if itemPreset[0] == optionName %}{%- assign type = itemPreset[1] -%}{% endif %}
32
- {% if itemPreset[0] == 'base' %}{%- assign type = itemPreset[1] -%}{% endif %}
33
- {% endfor %}
34
- {%- assign optionRendered = true -%}
35
-
36
- ${o({showDropdown:!0})}
37
- {% endif %}
38
- {% endfor %}`)}
39
-
40
- ${i("optionRendered == false",o({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
41
- `};export{renderOptionValuesNewFormatSwatches};
@@ -1,66 +0,0 @@
1
- import{Liquid as e,LiquidFor as s,LiquidIf as t}from"@gem-sdk/system";import{template as i}from"@gem-sdk/core";let renderOptionValuesOld=a=>{let{renderVariantItem:n,variantPresetsLiquid:o}=a;return i`
2
- ${e("{%- assign optionRendered = false -%}")}
3
- ${e("{%- assign swatches = shop.metafields.GEMPAGES.swatches -%}")}
4
- ${e("{%- assign swatchesItems = swatches | split: '($1)' -%}")}
5
-
6
- ${s("swatchesItem in swatchesItems",`
7
- ${e('{%- assign colorArraysString = "" -%}')}
8
- ${e('{%- assign labelsString = "" -%}')}
9
- ${e('{%- assign imageUrlsString = "" -%}')}
10
- ${e("{%- assign attrItems = swatchesItem | split: '($3)' -%}")}
11
-
12
- ${s("attrItem in attrItems",`
13
- ${e("{%- assign attrs = attrItem | split: '($2)' -%}")}
14
- ${e("{%- assign optionKey = attrs[0] -%}")}
15
- ${e("{%- assign optionValue = attrs[1] -%}")}
16
- ${e(`
17
- {% if optionKey == 'optionTitle' %}
18
- {% assign optionTitle = optionValue %}
19
- {% elsif optionKey == 'optionType' %}
20
- {% assign optionType = optionValue %}
21
- {% endif %}
22
- `)}
23
-
24
- ${t('optionKey == "optionValues"',`
25
- ${e("{%- assign opValueItems = optionValue | split: '($4)' -%}")}
26
- ${s("opValueItem in opValueItems",`
27
- ${e("{%- assign opValueItemAttrs = opValueItem | split: '($6)' -%}")}
28
- ${s("opValueItemAttr in opValueItemAttrs",`
29
- ${e("{%- assign attrs = opValueItemAttr | split: '($5)' -%}")}
30
- ${e("{%- assign opValueItemKey = attrs[0] -%}")}
31
- ${e("{%- assign opValueItemValue = attrs[1] -%}")}
32
-
33
- ${t('opValueItemKey == "label"',`${e("{%- assign labelsString = labelsString | append: opValueItemValue -%}")}
34
- ${e('{%- assign labelsString = labelsString | append: "($8)" -%}')}`)}
35
-
36
- ${t('opValueItemKey == "colors"',`${e("{%- assign colorArraysString = colorArraysString | append: opValueItemValue -%}")}
37
- ${e('{%- assign colorArraysString = colorArraysString | append: "($8)" -%}')}`)}
38
-
39
- ${t('opValueItemKey == "imageUrl"',`${e("{%- assign imageUrlsString = imageUrlsString | append: opValueItemValue -%}")}
40
- ${e('{%- assign imageUrlsString = imageUrlsString | append: "($8)" -%}')}`)}
41
- `)}
42
- `)}
43
- `)}
44
- `)}
45
-
46
- ${e("{%- assign labels = labelsString | split: '($8)' -%}")}
47
- ${e("{%- assign colorStrings = colorArraysString | split: '($8)' -%}")}
48
- ${e("{%- assign imageUrls = imageUrlsString | split: '($8)' -%}")}
49
-
50
- ${t("optionTitle == option.name",`
51
- ${e(`{%- assign variantPresetString = "${o}" -%}`)}
52
- ${e('{%- assign optionName = option.name | replace: "\'", "&apos;" | replace: \'"\', "&quot;" -%}')}
53
- ${e("{%- assign items = variantPresetString | split:'($2)' -%}")}
54
- ${e("{%- assign type = 'dropdown' -%}")}
55
- ${s("item in items",`
56
- ${e("{%- assign itemPreset = item | split:'($1)' -%}")}
57
- ${t("itemPreset[0] == optionName",e("{%- assign type = itemPreset[1] -%}"))}
58
- ${t('itemPreset[0] == "base"',e("{%- assign type = itemPreset[1] -%}"))}
59
- `)}
60
- ${e("{%- assign optionRendered = true -%}")}
61
- ${n({showDropdown:!0})}
62
- `)}
63
- `)}
64
-
65
- ${t("optionRendered == false",n({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
66
- `};export{renderOptionValuesOld};
@@ -1 +0,0 @@
1
- let OPTION_VALUES_DELIMITER="|||";export{OPTION_VALUES_DELIMITER};