@gem-sdk/components 8.0.0-dev.24 → 8.0.0-staging.10

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 (52) 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/hooks/useAddToCart.js +1 -1
  16. package/dist/cjs/product/components/product-discount-tag/hooks/useGpDiscountTag.js +1 -1
  17. package/dist/cjs/product/components/product-list-v3/ProductList.js +1 -1
  18. package/dist/cjs/product/components/product-price/hooks/useGpPrice.js +1 -1
  19. package/dist/cjs/product/components/product-variants/ProductVariants.liquid.js +77 -25
  20. package/dist/cjs/product/components/product-variants/common/base/styles.js +1 -1
  21. package/dist/cjs/product/components/product-variants/components/color/color.liquid.js +3 -3
  22. package/dist/cjs/product/helpers/product-bundle.js +1 -1
  23. package/dist/esm/carousel-v3/components/swiper/Swiper.js +1 -1
  24. package/dist/esm/countdown-timer/common/helpers.js +1 -1
  25. package/dist/esm/countdown-timer/hooks/useCountDownTimer.js +1 -1
  26. package/dist/esm/countdown-timer/hooks/useTimeLeft.js +1 -1
  27. package/dist/esm/countdown-timer/settings/Countdown.js +1 -1
  28. package/dist/esm/countdown-timer/settings/configs/setting.js +1 -1
  29. package/dist/esm/countdown-timer/settings/configs/ui-v2.js +1 -1
  30. package/dist/esm/post-purchase/product/components/ProductPrice.js +1 -1
  31. package/dist/esm/post-purchase/product/constants/ProductOfferPlaceholder.js +1 -1
  32. package/dist/esm/post-purchase/product/hooks/useGetMoneyLines.js +1 -1
  33. package/dist/esm/product/components/product-badge/ProductBadge.liquid.js +21 -21
  34. package/dist/esm/product/components/product-badge/common/styles.js +1 -1
  35. package/dist/esm/product/components/product-badge/utils/common.js +1 -1
  36. package/dist/esm/product/components/product-badge/utils/renderBadgeLiquid.js +4 -3
  37. package/dist/esm/product/components/product-button/hooks/useAddToCart.js +1 -1
  38. package/dist/esm/product/components/product-discount-tag/hooks/useGpDiscountTag.js +1 -1
  39. package/dist/esm/product/components/product-list-v3/ProductList.js +1 -1
  40. package/dist/esm/product/components/product-price/hooks/useGpPrice.js +1 -1
  41. package/dist/esm/product/components/product-variants/ProductVariants.liquid.js +90 -38
  42. package/dist/esm/product/components/product-variants/common/base/styles.js +1 -1
  43. package/dist/esm/product/components/product-variants/components/color/color.liquid.js +3 -3
  44. package/dist/esm/product/helpers/product-bundle.js +1 -1
  45. package/dist/types/index.d.ts +0 -1
  46. package/package.json +4 -4
  47. package/dist/cjs/product/components/product-variants/OptionVariantsNewFormat.liquid.js +0 -41
  48. package/dist/cjs/product/components/product-variants/OptionVariantsOldFormat.liquid.js +0 -66
  49. package/dist/cjs/product/components/product-variants/common/const.js +0 -1
  50. package/dist/esm/product/components/product-variants/OptionVariantsNewFormat.liquid.js +0 -41
  51. package/dist/esm/product/components/product-variants/OptionVariantsOldFormat.liquid.js +0 -66
  52. package/dist/esm/product/components/product-variants/common/const.js +0 -1
@@ -1,10 +1,8 @@
1
- import{template as e,isLocalEnv as t,baseAssetURL as s,DEVICES as i,getResponsiveValueByScreen as o}from"@gem-sdk/core";import a from"../../../text/components/Text.liquid.js";import n from"./components/variants/index.liquid.js";import r from"./components/dropdown-swatches/Dropdown.liquid.js";import p from"./components/dropdown-group/DropdownGroup.liquid.js";import{getSettingPreloadData as l}from"../../../helpers.js";import{mappingVariantStyles as d}from"./utils/mappingVariantStyles.js";import{createClass as m,createStyle as c,createAttr as u,Liquid as f,LiquidIf as v,If as $,LiquidFor as _}from"@gem-sdk/system";import{getAttrs as g}from"./common/main/getAttr.js";import{getVariantOptionGroupStyle as h,getWrapperStyle as y}from"./common/main/styles.js";import{getVariantOptionGroupClass as j,getWrapDropdownClass as w}from"./common/main/classes.js";import{getTextVariantTitleData as S,getDropdownGroupData as A}from"./common/main/getData.js";import{getWrapVariantOptionClass as P}from"./common/variants/classes.js";import{getStyleOfObject as D}from"../../helpers/function.js";import{getMarginBottomStyle as V}from"./common/variants/styles.js";import{renderOptionValuesNewFormatSwatches as b}from"./OptionVariantsNewFormat.liquid.js";import{renderOptionValuesOld as E}from"./OptionVariantsOldFormat.liquid.js";let DEFAULT_ADVANCED_DISPLAY_SETTING={desktop:!0,tablet:!0,mobile:!0},ProductVariants=N=>{let{builderProps:T,styles:O,setting:x,advanced:q}=N,{align:G,swatchItemWidth:C,dropdownItemWidth:F,swatchSpacing:I,optionTypo:k,marginBottom:L}=O??{},{label:J,optionType:z,showAsSwatches:M,layout:U,hasPreSelected:W}=x??{},R=q?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:Y}=T??{},H="groupOption"===z,K=()=>{let e={};return i.forEach(t=>{let s=o(C,t);e[t]="auto"===s}),e},Q=()=>{let e={};return i.forEach(t=>{e[t]=F?.[t]==="fill"}),e},B=x?.variantPresets?d(x?.variantPresets,O):[],X=B?.map(e=>({...e,presets:{[e.optionType]:e.presets[e.optionType]}})),Z={...x,variantPresetsOptionType:X},ee=e=>{let t={"'":"'",'"':"""},s=e;for(let i in t)e.indexOf(i)>=0&&(s=s.replaceAll(i,t[i]));return s},et=()=>x?.variantPresets?.map(e=>`${ee(e.optionName)}($2)${e.optionType}`).join("($1)"),es=()=>x?.variantPresets?.filter(e=>!!e?.hide)?.map(e=>e.optionName).join(","),ei=({showDropdown:t,isRenderDefault:s,typeOfOption:i})=>e`
2
- ${_("value in values",n({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:M,uid:Y,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:W?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:i,activeClass:W?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...O,...Z,swatchAutoWidth:K(),optionTypo:k,isRenderDefault:s}))}
3
- ${v(t?'type == "dropdown"':"false",r({...O,...Z,swatchAutoWidth:Q(),optionTypo:k}))}`,eo=x?.variantPresets?.map(e=>({name:ee(e.optionName),type:e.optionType})).map(e=>`${e.name}($1)${e.type}`).join("($2)").toString(),ea={renderVariantItem:ei,variantPresetsLiquid:eo??""},en=m(j(G)),er=c(h(I,I)),ep=S(N,"Liquid"),el=m(P(U,G)),ed=()=>e`
4
- ${f(`{%- assign presets = "${et()}" | split: '($1)' -%}`)}
5
- ${f(`{% assign hiddenPresetOptions = "${es()}" | split: ',' %}`)}
1
+ import{composeMemo as e,template as t,DEVICES as s,getResponsiveValueByScreen as i,isLocalEnv as a,baseAssetURL as o}from"@gem-sdk/core";import n from"../../../text/components/Text.liquid.js";import r from"./components/variants/index.liquid.js";import p from"./components/dropdown-swatches/Dropdown.liquid.js";import l from"./components/dropdown-group/DropdownGroup.liquid.js";import{getSettingPreloadData as d}from"../../../helpers.js";import{mappingVariantStyles as m}from"./utils/mappingVariantStyles.js";import{createClass as c,createStyle as u,createStateOrContext as g,createAttr as $,Liquid as v,LiquidIf as f,If as y,LiquidFor as _}from"@gem-sdk/system";import{getAttrs as h}from"./common/main/getAttr.js";import{getVariantOptionGroupStyle as S,getWrapperStyle as V}from"./common/main/styles.js";import{getVariantOptionGroupClass as j,getWrapDropdownClass as I}from"./common/main/classes.js";import{getTextVariantTitleData as A,getDropdownGroupData as w}from"./common/main/getData.js";import{getWrapVariantOptionClass as b}from"./common/variants/classes.js";import{getStyleOfObject as P}from"../../helpers/function.js";import{getMarginBottomStyle as T}from"./common/variants/styles.js";let DEFAULT_ADVANCED_DISPLAY_SETTING={desktop:!0,tablet:!0,mobile:!0},ProductVariants=N=>{let{builderProps:D,styles:x,setting:E,advanced:O}=N,{align:U,swatchItemWidth:C,dropdownItemWidth:K,swatchSpacing:q,optionTypo:k,marginBottom:F}=x??{},{label:G,optionType:J,showAsSwatches:L,layout:R,hasPreSelected:W}=E??{},z=O?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:H}=D??{},M="groupOption"===J,Q=()=>{let e={};return s.forEach(t=>{let s=i(C,t);e[t]="auto"===s}),e},Y=()=>{let e={};return s.forEach(t=>{e[t]=K?.[t]==="fill"}),e},B=e(()=>{let e=m(E?.variantPresets,x);return{...E,variantPresets:e}},[E?.variantPresets,x]),X=e=>{let t={"'":"'",'"':"""},s=e;for(let i in t)e.indexOf(i)>=0&&(s=s.replaceAll(i,t[i]));return s},Z=()=>E?.variantPresets?.map(e=>`${X(e.optionName)}($2)${e.optionType}`).join("($1)"),ee=()=>E?.variantPresets?.filter(e=>!!e?.hide)?.map(e=>e.optionName).join(","),et=c(j(U)),es=u(S(q,q)),ei=A(N,"Liquid"),ea=c(b(R,U)),eo=()=>t`
2
+ ${v(`{%- assign presets = "${Z()}" | split: '($1)' -%}`)}
3
+ ${v(`{% assign hiddenPresetOptions = "${ee()}" | split: ',' %}`)}
6
4
 
7
- ${f(`{% assign all_option_names = options | map: 'name' %}
5
+ ${v(`{% assign all_option_names = options | map: 'name' %}
8
6
  {% assign filtered_options_string = '' %}
9
7
  {% assign delimiter = '||' %}
10
8
 
@@ -27,29 +25,29 @@ import{template as e,isLocalEnv as t,baseAssetURL as s,DEVICES as i,getResponsiv
27
25
 
28
26
  {% assign filtered_options_array = filtered_options_string | split: delimiter %}`)}
29
27
 
30
- ${f("{% assign last_option_name = filtered_options_array | last %}")}
28
+ ${v("{% assign last_option_name = filtered_options_array | last %}")}
31
29
 
32
30
  ${_("option in options",`
33
31
  <div
34
32
  option-name="{{option.name | escape}}"
35
- class="${el} ${v("hiddenPresetOptions contains option.name","gp-hidden")}"
36
- style="${D(V(L))}${f("{% if forloop.last or option.name == last_option_name %}--mb:0;--mb-mobile:0;--mb-tablet:0;{% endif %}")}"
33
+ class="${ea} ${f("hiddenPresetOptions contains option.name","gp-hidden")}"
34
+ style="${P(T(F))}${v("{% if forloop.last or option.name == last_option_name %}--mb:0;--mb-mobile:0;--mb-tablet:0;{% endif %}")}"
37
35
  >
38
- ${f("{%- assign showVariantClass = 'variant-display' -%}")}
39
- ${f("{%- assign optionName = option.name -%}")}
36
+ ${v("{%- assign showVariantClass = 'variant-display' -%}")}
37
+ ${v("{%- assign optionName = option.name -%}")}
40
38
  ${_("preset in presets",`
41
- ${f("{%- assign presetDetail = preset | split: '($2)' -%}")}
42
- ${v("presetDetail[1] == 'dropdown' and presetDetail[0] == optionName",`${f("{%- assign showVariantClass = '' -%}")} ${f("{%- break -%}")}`)}
39
+ ${v("{%- assign presetDetail = preset | split: '($2)' -%}")}
40
+ ${f("presetDetail[1] == 'dropdown' and presetDetail[0] == optionName",`${v("{%- assign showVariantClass = '' -%}")} ${v("{%- break -%}")}`)}
43
41
  `)}
44
- ${$(J,a(ep)," ")}
42
+ ${y(G,n(ei)," ")}
45
43
  <div
46
44
  variant-option-name="{{option.name | escape}}"
47
- class="${en}"
48
- style="${D(er)}"
45
+ class="${et}"
46
+ style="${P(es)}"
49
47
  >
50
- ${f("{%- assign values = option.values -%}")}
51
- ${f("{%- assign rootForloop = forloop.index0 -%}")}
52
- ${f(`
48
+ ${v("{%- assign values = option.values -%}")}
49
+ ${v("{%- assign rootForloop = forloop.index0 -%}")}
50
+ ${v(`
53
51
  {%- if option.position == 1 -%}
54
52
  {%- assign selectedValue = variant.option1 -%}
55
53
  {%- elsif option.position == 2 -%}
@@ -58,22 +56,76 @@ import{template as e,isLocalEnv as t,baseAssetURL as s,DEVICES as i,getResponsiv
58
56
  {%- assign selectedValue = variant.option3 -%}
59
57
  {%- endif -%}
60
58
  `)}
61
- ${$(!W,f("{%- assign selectedValue = null -%}"),"")}
62
- ${$(M,em(),ei({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
59
+ ${y(!W,v("{%- assign selectedValue = null -%}"),"")}
60
+ ${y(L,er(),ep())}
63
61
  </div>
64
62
  </div>`)}
65
- `,em=()=>e`
66
- ${v("shop.metafields.GEMPAGES.swatches and shop.metafields.GEMPAGES.swatchesJSONFormat != blank",b(ea),E(ea))}
67
- `,ec=m(w(G)),eu=A(N),ef=()=>`
68
- <div className="${ec}">
69
- ${p(eu)}
63
+ `,en=E?.variantPresets?.map(e=>({name:X(e.optionName),type:e.optionType})).map(e=>`${e.name}($1)${e.type}`).join("($2)").toString(),er=()=>t`
64
+ ${v("{%- assign optionRendered = false -%}")}
65
+ ${v("{%- assign swatches = shop.metafields.GEMPAGES.swatches -%}")}
66
+ ${v("{%- assign swatchesItems = swatches | split: '($1)' -%}")}
67
+
68
+ ${_("swatchesItem in swatchesItems",`
69
+ ${v('{%- assign colorArraysString = "" -%}')}
70
+ ${v('{%- assign labelsString = "" -%}')}
71
+ ${v('{%- assign imageUrlsString = "" -%}')}
72
+ ${v("{%- assign attrItems = swatchesItem | split: '($3)' -%}")}
73
+
74
+ ${_("attrItem in attrItems",`${v("{%- assign attrs = attrItem | split: '($2)' -%}")}
75
+ ${v("{%- assign optionKey = attrs[0] -%}")}
76
+ ${v("{%- assign optionValue = attrs[1] -%}")}
77
+ ${v(`
78
+ {% if optionKey == 'optionTitle' %}
79
+ {% assign optionTitle = optionValue %}
80
+ {% elsif optionKey == 'optionType' %}
81
+ {% assign optionType = optionValue %}
82
+ {% endif %}
83
+ `)}
84
+
85
+ ${f("optionKey == 'optionValues'",`${v("{%- assign opValueItems = optionValue | split: '($4)' -%}")}
86
+ ${_("opValueItem in opValueItems",`${v("{%- assign opValueItemAttrs = opValueItem | split: '($6)' -%}")}
87
+ ${_("opValueItemAttr in opValueItemAttrs",`${v("{%- assign attrs = opValueItemAttr | split: '($5)' -%}")}
88
+ ${v("{%- assign opValueItemKey = attrs[0] -%}")}
89
+ ${v("{%- assign opValueItemValue = attrs[1] -%}")}
90
+
91
+ ${f("opValueItemKey == 'label'",`${v("{%- assign labelsString = labelsString | append: opValueItemValue -%}")}${v('{%- assign labelsString = labelsString | append: "($8)" -%}')}`)}
92
+
93
+ ${f("opValueItemKey == 'colors'",`${v("{%- assign colorArraysString = colorArraysString | append: opValueItemValue -%}")}${v('{%- assign colorArraysString = colorArraysString | append: "($8)" -%}')}`)}
94
+
95
+ ${f("opValueItemKey == 'imageUrl'",`${v("{%- assign imageUrlsString = imageUrlsString | append: opValueItemValue -%}")}${v('{%- assign imageUrlsString = imageUrlsString | append: "($8)" -%}')}`)}`)}`)}`)}
96
+ `)}
97
+
98
+ ${v("{%- assign labels = labelsString | split: '($8)' -%}")}
99
+ ${v("{%- assign colorStrings = colorArraysString | split: '($8)' -%}")}
100
+ ${v("{%- assign imageUrls = imageUrlsString | split: '($8)' -%}")}
101
+
102
+ ${f("optionTitle == option.name",`
103
+ ${v(`{%- assign variantPresetString = "${en}" -%}`)}
104
+ ${v('{%- assign optionName = option.name | replace: "\'", "&apos;" | replace: \'"\', "&quot;" -%}')}
105
+ ${v("{%- assign items = variantPresetString | split:'($2)' -%}")}
106
+ ${v("{%- assign type = 'dropdown' -%}")}
107
+ ${_("item in items",`
108
+ ${v("{%- assign itemPreset = item | split:'($1)' -%}")}
109
+ ${f("itemPreset[0] == optionName",v("{%- assign type = itemPreset[1] -%}"))}
110
+ ${f('itemPreset[0] == "base"',v("{%- assign type = itemPreset[1] -%}"))}
111
+ `)}
112
+ ${v("{%- assign optionRendered = true -%}")}
113
+ ${_("value in values",r({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:L,uid:H,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:W?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",optionType:"optionType",activeClass:W?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...x,...B,swatchAutoWidth:Q(),optionTypo:k}))}
114
+ ${f("type == 'dropdown'",p({...x,...B,swatchAutoWidth:Y(),optionTypo:k}))}
115
+ `)}
116
+ `)}
117
+
118
+ ${f("optionRendered == false",ep())}
119
+ `,ep=()=>_("value in values",r({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:L,uid:H,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:W?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:"optionType",activeClass:W?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...x,...B,swatchAutoWidth:Q(),optionTypo:k,isRenderDefault:!0})),el=c(I(U)),ed=w(N),em=()=>`
120
+ <div className="${el}">
121
+ ${l(ed)}
70
122
  </div>
71
- `,ev=u(g({uid:Y,hasPreSelected:W,cssClass:q?.cssClass})),e$=c(y(N)),e_=m({"gp-flex gp-flex-col !gp-ml-0":!0}),eg=()=>{let e=t?"{{ 'gp-product-variant-v7-5.js' | asset_url }}":`${s}/assets-v2/gp-product-variant-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${l('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`};return e`
123
+ `;g({setting:B,styles:JSON.stringify(x),variants:"{{ product.variants | json | escape }}",optionsWithValues:"{{ product.options_with_values | json | escape }}",variantSelected:"{{ variant | json | escape }}",variantInventoryQuantity:"{{ product.variants | map: 'inventory_quantity' | json | escape }}",variantInventoryPolicy:"{{ product.variants | map: 'inventory_policy' | json | escape }}",moneyFormat:"{{ shop.money_format | json | escape }}",productId:"{{ product.id | json | escape }}",productUrl:"{{ product.url | json | escape }}",productHandle:"{{ product.handle | json | escape }}",displayState:`${JSON.stringify(z)}`,totalVariantCombinations:"{{ total_combinations }}",firstAvailableVariant:"{{ product.selected_or_first_available_variant | json | escape }}"});let ec=$(h({uid:H,hasPreSelected:W,cssClass:O?.cssClass})),eu=u(V(N)),eg=c({"gp-flex gp-flex-col !gp-ml-0":!0}),e$=()=>{let e=a?"{{ 'gp-product-variant-v7-5.js' | asset_url }}":`${o}/assets-v2/gp-product-variant-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${d('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`};return t`
72
124
  <gp-product-variants
73
- ${ev}
125
+ ${ec}
74
126
  gp-data='{
75
- "setting":${JSON.stringify(Z)?.replaceAll("'","&#039;")},
76
- "styles":${JSON.stringify(O)},
127
+ "setting":${JSON.stringify(B)?.replaceAll("'","&#039;")},
128
+ "styles":${JSON.stringify(x)},
77
129
  "variants":{{product.variants | json | escape}},
78
130
  "optionsWithValues": {{product.options_with_values | json | escape}},
79
131
  "variantSelected": {{ variant | json | escape }},
@@ -83,21 +135,21 @@ import{template as e,isLocalEnv as t,baseAssetURL as s,DEVICES as i,getResponsiv
83
135
  "productId": {{product.id | json | escape}},
84
136
  "productUrl": {{product.url | json | escape}},
85
137
  "productHandle": {{product.handle | json | escape}},
86
- "displayState": ${JSON.stringify(R)},
138
+ "displayState": ${JSON.stringify(z)},
87
139
  "totalVariantCombinations": {{total_combinations}},
88
140
  "firstAvailableVariant": {{product.selected_or_first_available_variant | json | escape}}
89
141
  }
90
142
  '>
91
143
  <div class="gp-hidden" style="--hvr-shadow: none; --hvr-shadow-tablet: none; --hvr-shadow-mobile: none"></div>
92
- ${f("{%- assign options = product.options_with_values -%}")}
93
- ${f("{%- assign variants = product.variants -%}")}
94
- ${v("options.size == 0 or options.size == 1 and variants.size == 1 and variants[0].title == 'Default Title' and variants[0].option1 == 'Default Title'","<div></div>",e`<div
95
- class="${e_}"
96
- style="${e$}"
144
+ ${v("{%- assign options = product.options_with_values -%}")}
145
+ ${v("{%- assign variants = product.variants -%}")}
146
+ ${f("options.size == 0 or options.size == 1 and variants.size == 1 and variants[0].title == 'Default Title' and variants[0].option1 == 'Default Title'","<div></div>",t`<div
147
+ class="${eg}"
148
+ style="${eu}"
97
149
  >
98
- ${$(H,ef(),ed())}
150
+ ${y(M,em(),eo())}
99
151
  </div>`)}
100
152
  </gp-product-variants>
101
153
 
102
- ${eg()}
154
+ ${e$()}
103
155
  `};export{ProductVariants as default};
@@ -1 +1 @@
1
- import{composeTypographyStyle as e,getRadiusStyleActiveState as t,getStyleShadow as o,makeStyle as r,getSingleColorVariable as l,composeRadius as i,getGlobalColorStateStyle as p,handleConvertBorderStyle as a,handleConvertBorderWidth as n,handleConvertBorderColor as d,makeStyleResponsive as h}from"@gem-sdk/core";import{filterTruthyObject as c}from"../../../../../helpers.js";let getColorStyleWidth=e=>{let t=e?.height||"32px",o=e?.width||{desktop:t},r=Object.fromEntries(Object.entries(o).map(([e,o])=>{let r=o&&"undefined"!==o&&"auto"!==o?o:t;return[e,r]}));return h("minw",r)},getWrapperStyleActive=i=>{let{preset:p,optionTypography:a,optionTypo:n,typeOfOption:d}=i,h=p?.optionBgColor,s=p?.optionTextColor,g=p?.optionBorder,b=p?.optionHasShadow,m=p?.optionShadow,u=p?.optionRounded,w="color"===d,x="image"===d||"image_shopify"===d,y=e(n,a),S=e=>{let t=h?.active??h?.normal,o=g?.active??g?.normal;return r({bg:e&&l(t),bs:o?.border,bw:o?.width,bc:l(o?.color)})},v=m?.active??m?.normal,C=b?.active??b?.normal,f=s?.active??s?.normal;return c({...S(!w),...t(u),...o({value:v,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:C},!0),...y,...!w&&!x&&r({c:l(f)}),...w&&getColorStyleWidth(p),...r({h:p?.height})})},getWrapperStyleNormalAndHover=e=>{let{preset:t,optionTransform:l,optionTypography:h,optionTypo:s,typeOfOption:g}=e,b=t?.optionBgColor,m=t?.optionTextColor,u=t?.optionBorder,w=t?.optionHasShadow,x=t?.optionShadow,y=t?.optionRounded,S="color"===g,v="image"===g||"image_shopify"===g,C=["normal","hover"].reduce((e,t)=>({...e,...o({value:x?.[t],state:t,styleAppliedFor:"box-shadow",isEnableShadow:w?.[t]})}),{});return c({...i(y),...C,...!S&&p("bg",b),...!S&&a(u),...!S&&n(u),...!S&&d(u),...!S&&!v&&r({c:l}),...!S&&!v&&p("c",m),...typoStyleNotIn(s,h,["--c"]),...S&&getColorStyleWidth(t),...r({h:t?.height})})};function typoStyleNotIn(t,o,r){let l=e(t,o);return r&&0!==r.length?Object.fromEntries(Object.entries(l).filter(([e])=>!r.includes(e))):l}let getWrapperTextStyle=e=>{let{preset:o,typeOfOption:r,checked:l}=e,p=o?.optionBorder,h=o?.optionRounded,s="color"===r,g=()=>{let e="16px",t={"--pl":"0px","--pr":"0px","--pl-tablet":"0px","--pr-tablet":"0px","--pl-mobile":"0px","--pr-mobile":"0px","--pt":"0px","--pb":"0px"};return o?.width?.desktop?.toLowerCase()!=="auto"&&o?.width?.desktop||(t["--pl"]=e,t["--pr"]=e),o?.width?.tablet?.toLowerCase()!=="auto"&&o?.width?.tablet||(t["--pl-tablet"]=e,t["--pr-tablet"]=e),o?.width?.mobile?.toLowerCase()!=="auto"&&o?.width?.mobile||(t["--pl-mobile"]=e,t["--pr-mobile"]=e),(o?.height?.toLowerCase()==="auto"||o?.height)&&(t["--pt"]="8px",t["--pb"]="8px"),t},b={...h,active:{...h?.active||{},radiusType:"custom"}},m=l?t(b):i(h),u=!l&&s?{...a(p),...n(p),...d(p)}:{};return c({...!s&&g(),...s&&m,...u})},getColorStyle=({optionBorder:e,optionRounded:t,isActive:o,color:r})=>{let l=()=>r?r?.startsWith("linear-gradient")?{backgroundImage:r}:{backgroundColor:r}:{},p=t=>t?{"--bs":"none"}:a(e),h=o=>({"--d":"flex","--jc":"center"," --ai":"center","--w":"100%","--h":"100%","--of":"hidden","--hvr-c":"unset",...p(o),...n(e),...d(e),...i(t),...l()});return h(!!o)},getTextStyle=({optionTypo:t,optionTypography:o})=>{let r=e(t,o);return delete r["--c"],c({...r})};export{getColorStyle,getTextStyle,getWrapperStyleActive,getWrapperStyleNormalAndHover,getWrapperTextStyle};
1
+ import{composeTypographyStyle as e,getRadiusStyleActiveState as t,getStyleShadow as o,makeStyle as r,getSingleColorVariable as l,composeRadius as i,getGlobalColorStateStyle as p,handleConvertBorderStyle as a,handleConvertBorderWidth as n,handleConvertBorderColor as d,makeStyleResponsive as h}from"@gem-sdk/core";import{filterTruthyObject as c}from"../../../../../helpers.js";let getColorStyleWidth=e=>{let t=e?.height||"32px",o=e?.width||{desktop:t},r=Object.fromEntries(Object.entries(o).map(([e,o])=>{let r=o&&"undefined"!==o&&"auto"!==o?o:t;return[e,r]}));return h("minw",r)},getWrapperStyleActive=i=>{let{preset:p,optionTypography:a,optionTypo:n,typeOfOption:d}=i,h=p?.optionBgColor,g=p?.optionTextColor,s=p?.optionBorder,b=p?.optionHasShadow,m=p?.optionShadow,u=p?.optionRounded,w="color"===d,x="image"===d||"image_shopify"===d,y=e(n,a),S=e=>{let t=h?.active??h?.normal,o=s?.active??s?.normal;return r({bg:e&&l(t),bs:o?.border,bw:o?.width,bc:l(o?.color)})},v=m?.active??m?.normal,C=b?.active??b?.normal,f=g?.active??g?.normal;return c({...S(!w),...t(u),...o({value:v,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:C},!0),...y,...!w&&!x&&r({c:l(f)}),...w&&getColorStyleWidth(p),...r({h:p?.height})})},getWrapperStyleNormalAndHover=e=>{let{preset:t,optionTransform:l,optionTypography:h,optionTypo:g,typeOfOption:s}=e,b=t?.optionBgColor,m=t?.optionTextColor,u=t?.optionBorder,w=t?.optionHasShadow,x=t?.optionShadow,y=t?.optionRounded,S="color"===s,v="image"===s||"image_shopify"===s,C=["normal","hover"].reduce((e,t)=>({...e,...o({value:x?.[t],state:t,styleAppliedFor:"box-shadow",isEnableShadow:w?.[t]})}),{});return c({...i(y),...C,...!S&&p("bg",b),...!S&&a(u),...!S&&n(u),...!S&&d(u),...!S&&!v&&r({c:l}),...!S&&!v&&p("c",m),...typoStyleNotIn(g,h,["--c"]),...S&&getColorStyleWidth(t),...r({h:t?.height})})};function typoStyleNotIn(t,o,r){let l=e(t,o);return r&&0!==r.length?Object.fromEntries(Object.entries(l).filter(([e])=>!r.includes(e))):l}let getWrapperTextStyle=e=>{let{preset:o,typeOfOption:r,checked:l}=e,p=o?.optionBorder,h=o?.optionRounded,g="color"===r,s=()=>{let e="16px",t={"--pl":"0px","--pr":"0px","--pl-tablet":"0px","--pr-tablet":"0px","--pl-mobile":"0px","--pr-mobile":"0px","--pt":"0px","--pb":"0px"};return o?.width?.desktop?.toLowerCase()!=="auto"&&o?.width?.desktop||(t["--pl"]=e,t["--pr"]=e),o?.width?.tablet?.toLowerCase()!=="auto"&&o?.width?.tablet||(t["--pl-tablet"]=e,t["--pr-tablet"]=e),o?.width?.mobile?.toLowerCase()!=="auto"&&o?.width?.mobile||(t["--pl-mobile"]=e,t["--pr-mobile"]=e),(o?.height?.toLowerCase()==="auto"||o?.height)&&(t["--pt"]="8px",t["--pb"]="8px"),t},b={...h,active:{...h?.active||{},radiusType:"custom"}},m=l?t(b):i(h),u=!l&&g?{...a(p),...n(p),...d(p)}:{};return c({...!g&&s(),...g&&m,...u})},getColorStyle=({optionBorder:e,optionRounded:t,isActive:o,color:r})=>{let l=()=>r?r?.startsWith("linear-gradient")?{backgroundImage:r}:{backgroundColor:r}:{},p=t=>t?{"--bs":"none"}:a(e),h=o=>({"--d":"flex","--jc":"center"," --ai":"center","--w":"100%","--h":"100%","--of":"hidden",...p(o),...n(e),...d(e),...i(t),...l()});return h(!!o)},getTextStyle=({optionTypo:t,optionTypography:o})=>{let r=e(t,o);return delete r["--c"],c({...r})};export{getColorStyle,getTextStyle,getWrapperStyleActive,getWrapperStyleNormalAndHover,getWrapperTextStyle};
@@ -1,4 +1,4 @@
1
- import{template as o}from"@gem-sdk/core";import r from"../base/base.liquid.js";import{optionRoundedColorDefault as l}from"../../utils/mappingVariantStyles.js";import{OPTION_VALUES_DELIMITER as i}from"../../common/const.js";let ColorVariant=({isVariantOutStock:s,swatchValue:n,...t})=>o`
1
+ import{template as o}from"@gem-sdk/core";import l from"../base/base.liquid.js";import{optionRoundedColorDefault as r}from"../../utils/mappingVariantStyles.js";let ColorVariant=({isVariantOutStock:i,swatchValue:s,...n})=>o`
2
2
  {% assign colorsString = null %}
3
3
  {% assign colors = null %}
4
4
  {% for label in labels %}
@@ -7,7 +7,7 @@ import{template as o}from"@gem-sdk/core";import r from"../base/base.liquid.js";i
7
7
  {% endif %}
8
8
  {% endfor %}
9
9
  {% if colorsString != null %}
10
- {% assign colors = colorsString | split: '${i}' %}
10
+ {% assign colors = colorsString | split: '($7)' %}
11
11
  {% endif %}
12
- ${r({...t,typeOfOption:"color",optionRounded:l})}
12
+ ${l({...n,typeOfOption:"color",optionRounded:r})}
13
13
  `;export{ColorVariant 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.24",
3
+ "version": "8.0.0-staging.10",
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.22",
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};