@gem-sdk/components 12.0.0-dev.90 → 12.0.0-dev.92
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.
- package/dist/cjs/product/components/product-badge/utils/generateLiquidContent.js +3 -3
- package/dist/cjs/product/components/product-list/ProductListCarouselItem.liquid.js +1 -1
- package/dist/cjs/product/components/product-list/ProductListGridItem.liquid.js +1 -1
- package/dist/cjs/product/components/product-list-v3/ProductListCarouselItem.liquid.js +1 -1
- package/dist/cjs/product/components/product-list-v3/ProductListGridItem.liquid.js +1 -1
- package/dist/cjs/product/components/product-variants/ProductVariants.liquid.js +4 -4
- package/dist/cjs/product/components/product-variants/common/base/attrs.js +1 -1
- package/dist/cjs/product/components/product-wrap/Product.liquid.js +1 -1
- package/dist/esm/product/components/product-badge/utils/generateLiquidContent.js +1 -1
- package/dist/esm/product/components/product-list/ProductListCarouselItem.liquid.js +1 -1
- package/dist/esm/product/components/product-list/ProductListGridItem.liquid.js +4 -4
- package/dist/esm/product/components/product-list-v3/ProductListCarouselItem.liquid.js +1 -1
- package/dist/esm/product/components/product-list-v3/ProductListGridItem.liquid.js +4 -4
- package/dist/esm/product/components/product-variants/ProductVariants.liquid.js +8 -8
- package/dist/esm/product/components/product-variants/common/base/attrs.js +1 -1
- package/dist/esm/product/components/product-wrap/Product.liquid.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";const generateBadgeContent=(n,
|
|
2
|
-
{% assign content = ${
|
|
1
|
+
"use strict";const generateBadgeContent=(n,t)=>`
|
|
2
|
+
{% assign content = ${t?JSON.stringify(n):n} %}
|
|
3
3
|
|
|
4
4
|
{%if content.size > 0 %}
|
|
5
5
|
{% if variant.compare_at_price and variant.compare_at_price > 0 %}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
{% assign amountDiscountValue = amountDiscount | money_without_trailing_zeros %}
|
|
15
15
|
{% assign price = variant.price | divided_by: 100 %}
|
|
16
16
|
{% assign minPriceValue = product.variants | map: "price" | sort | first | money_without_trailing_zeros %}
|
|
17
|
-
{% assign inventoryQuantityValue = variant.inventory_quantity %}
|
|
17
|
+
{% assign inventoryQuantityValue = variant.inventory_quantity | default: 0 %}
|
|
18
18
|
|
|
19
19
|
{% assign percentDiscountKey = "{percent_discount}" %}
|
|
20
20
|
{% assign amountDiscountKey = "{amount_discount}" %}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),classes=require("./common/classes.js");const ProductListItem=t=>{let{pageContext:e,children:n}=t,{productItemClass:o,gpProductClass:a}=classes.getClass(t);return core.template`
|
|
2
2
|
<gp-product
|
|
3
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
4
4
|
class="${a}"
|
|
5
5
|
>
|
|
6
6
|
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }},"pageContext" : ${JSON.stringify(e)}}</script>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
`}).join("")}
|
|
5
5
|
`;return core.template`
|
|
6
6
|
<gp-product
|
|
7
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
7
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
8
8
|
class="${r}"
|
|
9
9
|
>
|
|
10
10
|
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }},"pageContext" : ${JSON.stringify(e)}}</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),classes=require("./common/classes.js");const ProductListItem=t=>{let{pageContext:e,children:n}=t,{productItemClass:o,gpProductClass:a}=classes.getClass(t);return core.template`
|
|
2
2
|
<gp-product
|
|
3
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 ,"inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 ,"inventoryQuantity": {{ variant.inventory_quantity | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
4
4
|
class="${a}"
|
|
5
5
|
>
|
|
6
6
|
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }},"pageContext" : ${JSON.stringify(e)}}</script>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
`}).join("")}
|
|
5
5
|
`;return core.template`
|
|
6
6
|
<gp-product
|
|
7
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 ,"inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
7
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 ,"inventoryQuantity": {{ variant.inventory_quantity | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
8
8
|
class="${r}"
|
|
9
9
|
>
|
|
10
10
|
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }},"pageContext" : ${JSON.stringify(e)}}</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Text_liquid=require("../../../text/components/Text.liquid.js"),index_liquid=require("./components/variants/index.liquid.js"),Dropdown_liquid=require("./components/dropdown-swatches/Dropdown.liquid.js"),DropdownGroup_liquid=require("./components/dropdown-group/DropdownGroup.liquid.js"),helpers=require("../../../helpers.js"),mappingVariantStyles=require("./utils/mappingVariantStyles.js"),system=require("@gem-sdk/system"),getAttr=require("./common/main/getAttr.js"),styles=require("./common/main/styles.js"),classes=require("./common/main/classes.js"),getData=require("./common/main/getData.js"),classes$1=require("./common/variants/classes.js"),_function=require("../../helpers/function.js"),styles$1=require("./common/variants/styles.js"),OptionVariantsNewFormat_liquid=require("./OptionVariantsNewFormat.liquid.js"),OptionVariantsOldFormat_liquid=require("./OptionVariantsOldFormat.liquid.js");const DEFAULT_ADVANCED_DISPLAY_SETTING={desktop:!0,tablet:!0,mobile:!0},ProductVariants=e=>{let{builderProps:t,styles:s,setting:i,advanced:a}=e,{align:o,swatchItemWidth:n,dropdownItemWidth:r,swatchSpacing:l,optionTypo:p,marginBottom:d}=s??{},{label:u,optionType:m,showAsSwatches:c,layout:y,hasPreSelected:v}=i??{},g=a?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:_}=t??{},f="groupOption"===m,q=()=>{let e={};return core.DEVICES.forEach(t=>{let s=core.getResponsiveValueByScreen(n,t);e[t]="auto"===s}),e},$=()=>{let e={};return core.DEVICES.forEach(t=>{e[t]=r?.[t]==="fill"}),e},h=i?.variantPresets?mappingVariantStyles.mappingVariantStyles(i?.variantPresets,s):[],S=h?.map(e=>({...e,presets:{[e.optionType]:e.presets[e.optionType]}})),j={...i,variantPresets:S},w=e=>{let t={"'":"'",'"':"""},s=e;for(let i in t)e.indexOf(i)>=0&&(s=s.replaceAll(i,t[i]));return s},L=()=>i?.variantPresets?.map(e=>`${w(e.optionName)}($2)${e.optionType}`).join("($1)"),O=()=>i?.variantPresets?.filter(e=>!!e?.hide)?.map(e=>e.optionName).join(","),V=({showDropdown:e,isRenderDefault:t,typeOfOption:i})=>core.template`
|
|
2
|
-
${system.LiquidFor("value in values",index_liquid.default({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:c,uid:_,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:v?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:i,activeClass:v?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...s,...j,swatchAutoWidth:q(),optionTypo:p,isRenderDefault:t}))}
|
|
2
|
+
${system.LiquidFor("value in values",index_liquid.default({id:"{{option.name | escape | handleize}}-{{value | escape | handleize}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:c,uid:_,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:v?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:i,activeClass:v?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...s,...j,swatchAutoWidth:q(),optionTypo:p,isRenderDefault:t}))}
|
|
3
3
|
${system.LiquidIf(e?'type == "dropdown"':"false",Dropdown_liquid.default({...s,...j,swatchAutoWidth:$(),optionTypo:p}))}`,D=i?.variantPresets?.map(e=>({name:w(e.optionName),type:e.optionType})).map(e=>`${e.name}($1)${e.type}`).join("($2)").toString(),A={renderVariantItem:V,variantPresetsLiquid:D??""},b=system.createClass(classes.getVariantOptionGroupClass(o)),P=system.createStyle(styles.getVariantOptionGroupStyle(l,l)),E=getData.getTextVariantTitleData(e,"Liquid"),x=system.createClass(classes$1.getWrapVariantOptionClass(y,o)),N=()=>core.template`
|
|
4
4
|
${system.Liquid(`{%- assign presets = "${L()}" | split: '($1)' -%}`)}
|
|
5
5
|
${system.Liquid(`{% assign hiddenPresetOptions = "${O()}" | split: ',' %}`)}
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
<div className="${I}">
|
|
69
69
|
${DropdownGroup_liquid.default(F)}
|
|
70
70
|
</div>
|
|
71
|
-
`,G=system.createAttr(getAttr.getAttrs({uid:_,hasPreSelected:v,cssClass:a?.cssClass})),k=system.createStyle(styles.getWrapperStyle(e)),
|
|
71
|
+
`,G=system.createAttr(getAttr.getAttrs({uid:_,hasPreSelected:v,cssClass:a?.cssClass})),k=system.createStyle(styles.getWrapperStyle(e)),z=system.createClass({"gp-flex gp-flex-col !gp-ml-0":!0}),W=()=>{let e=core.isLocalEnv?"{{ 'gp-product-variant-v7-5.js' | asset_url }}":`${core.baseAssetURL}/assets-v2/gp-product-variant-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`};return core.template`
|
|
72
72
|
${system.Liquid("{%- assign total_combinations = 1 -%}")}
|
|
73
73
|
${system.LiquidFor("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
|
|
74
74
|
<gp-product-variants ${G}>
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
${system.Liquid("{%- assign options = product.options_with_values -%}")}
|
|
95
95
|
${system.Liquid("{%- assign variants = product.variants -%}")}
|
|
96
96
|
${system.LiquidIf("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>",core.template`<div
|
|
97
|
-
class="${
|
|
97
|
+
class="${z}"
|
|
98
98
|
style="${k}"
|
|
99
99
|
>
|
|
100
100
|
${system.If(f,C(),N())}
|
|
101
101
|
</div>`)}
|
|
102
102
|
</gp-product-variants>
|
|
103
103
|
|
|
104
|
-
${
|
|
104
|
+
${W()}
|
|
105
105
|
`};exports.default=ProductVariants;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const getWrapperAttr=(
|
|
1
|
+
"use strict";const getWrapperAttr=(e,a)=>{let{typeOfOption:t,available:i,optionName:p,optionNameValue:o,isVariantOutStock:n}=e;return"Liquid"===a?{id:"value-wrapper-{{option.name | escape | strip | handleize}}-{{value | escape | strip | handleize}}","option-data":"{{option.name | escape}}","option-value":"{{value | escape}}","option-position":"{{option.position}}","data-gp-option-available":"{{value.available}}","option-type":`${t||"rectangle_list"}`,"data-disabled":"{%- if option_disabled == true -%} disabled {%- endif -%}","data-hidden":"true"}:{id:`value-wrapper-${p}-${o}`,"option-data":p||"","option-value":o||"","option-position":1,"data-gp-option-available":!!i,"option-type":`${t||"rectangle_list"}`,"data-disabled":!!n,"data-hidden":"true"}};exports.getWrapperAttr=getWrapperAttr;
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
data-id="${a?.uid}"
|
|
80
80
|
style="${y}"
|
|
81
81
|
class="${d?.cssClass}"
|
|
82
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${m}], "isSyncProduct": "${s}", "hasPreSelected": ${c}, "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 }}" }'
|
|
82
|
+
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${m}], "isSyncProduct": "${s}", "hasPreSelected": ${c}, "variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity | default: 0 }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
83
83
|
>
|
|
84
84
|
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }}}</script>
|
|
85
85
|
<product-form class="product-form">
|
|
@@ -14,7 +14,7 @@ let generateBadgeContent=(n,i)=>`
|
|
|
14
14
|
{% assign amountDiscountValue = amountDiscount | money_without_trailing_zeros %}
|
|
15
15
|
{% assign price = variant.price | divided_by: 100 %}
|
|
16
16
|
{% assign minPriceValue = product.variants | map: "price" | sort | first | money_without_trailing_zeros %}
|
|
17
|
-
{% assign inventoryQuantityValue = variant.inventory_quantity %}
|
|
17
|
+
{% assign inventoryQuantityValue = variant.inventory_quantity | default: 0 %}
|
|
18
18
|
|
|
19
19
|
{% assign percentDiscountKey = "{percent_discount}" %}
|
|
20
20
|
{% assign amountDiscountKey = "{amount_discount}" %}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{template as t}from"@gem-sdk/core";import{getClass as n}from"./common/classes.js";let ProductListItem=o=>{let{pageContext:e,children:a}=o,{productItemClass:r,gpProductClass:i}=n(o);return t`
|
|
2
2
|
<gp-product
|
|
3
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
4
4
|
class="${i}"
|
|
5
5
|
>
|
|
6
6
|
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }},"pageContext" : ${JSON.stringify(e)}}</script>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{template as t,RenderChildren as n}from"@gem-sdk/core";import{getClass as
|
|
2
|
-
${r?.map((o
|
|
3
|
-
${n({...
|
|
1
|
+
import{template as t,RenderChildren as n}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";let ProductListItem=o=>{let{pageContext:a,rawChildren:r}=o,{productItemClass:i,gpProductClass:c}=e(o),d=()=>t`
|
|
2
|
+
${r?.map((e,o)=>{if(e)return t`
|
|
3
|
+
${n({...e,index:o})}
|
|
4
4
|
`}).join("")}
|
|
5
5
|
`;return t`
|
|
6
6
|
<gp-product
|
|
7
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
7
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
8
8
|
class="${c}"
|
|
9
9
|
>
|
|
10
10
|
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }},"pageContext" : ${JSON.stringify(a)}}</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{template as t}from"@gem-sdk/core";import{getClass as n}from"./common/classes.js";let ProductListItem=o=>{let{pageContext:e,children:a}=o,{productItemClass:r,gpProductClass:i}=n(o);return t`
|
|
2
2
|
<gp-product
|
|
3
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 ,"inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 ,"inventoryQuantity": {{ variant.inventory_quantity | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
4
4
|
class="${i}"
|
|
5
5
|
>
|
|
6
6
|
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }},"pageContext" : ${JSON.stringify(e)}}</script>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{template as t,RenderChildren as n}from"@gem-sdk/core";import{getClass as
|
|
2
|
-
${r?.map((o
|
|
3
|
-
${n({...
|
|
1
|
+
import{template as t,RenderChildren as n}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";let ProductListItem=o=>{let{pageContext:a,rawChildren:r}=o,{productItemClass:i,gpProductClass:c}=e(o),d=()=>t`
|
|
2
|
+
${r?.map((e,o)=>{if(e)return t`
|
|
3
|
+
${n({...e,index:o})}
|
|
4
4
|
`}).join("")}
|
|
5
5
|
`;return t`
|
|
6
6
|
<gp-product
|
|
7
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 ,"inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
7
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 ,"inventoryQuantity": {{ variant.inventory_quantity | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
8
8
|
class="${c}"
|
|
9
9
|
>
|
|
10
10
|
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }},"pageContext" : ${JSON.stringify(a)}}</script>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{template as t,isLocalEnv as
|
|
2
|
-
${f("value in values",a({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:o,activeClass:W?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...T,...Z,swatchAutoWidth:K(),optionTypo:k,isRenderDefault:
|
|
3
|
-
${_(
|
|
4
|
-
${v(`{%- assign presets = "${
|
|
5
|
-
${v(`{% assign hiddenPresetOptions = "${
|
|
1
|
+
import{template as t,isLocalEnv as e,baseAssetURL as i,DEVICES as o,getResponsiveValueByScreen as s}from"@gem-sdk/core";import n from"../../../text/components/Text.liquid.js";import a 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 v,LiquidFor as f,LiquidIf as _,If 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 P}from"./common/main/getData.js";import{getWrapVariantOptionClass as b}from"./common/variants/classes.js";import{getStyleOfObject as A}from"../../helpers/function.js";import{getMarginBottomStyle as D}from"./common/variants/styles.js";import{renderOptionValuesNewFormatSwatches as N}from"./OptionVariantsNewFormat.liquid.js";import{renderOptionValuesOld as V}from"./OptionVariantsOldFormat.liquid.js";let DEFAULT_ADVANCED_DISPLAY_SETTING={desktop:!0,tablet:!0,mobile:!0},ProductVariants=E=>{let{builderProps:O,styles:T,setting:x,advanced:q}=E,{align:F,swatchItemWidth:G,dropdownItemWidth:C,swatchSpacing:I,optionTypo:k,marginBottom:z}=T??{},{label:L,optionType:J,showAsSwatches:M,layout:U,hasPreSelected:W}=x??{},R=q?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:Y}=O??{},H="groupOption"===J,K=()=>{let t={};return o.forEach(e=>{let i=s(G,e);t[e]="auto"===i}),t},Q=()=>{let t={};return o.forEach(e=>{t[e]=C?.[e]==="fill"}),t},B=x?.variantPresets?d(x?.variantPresets,T):[],X=B?.map(t=>({...t,presets:{[t.optionType]:t.presets[t.optionType]}})),Z={...x,variantPresets:X},tt=t=>{let e={"'":"'",'"':"""},i=t;for(let o in e)t.indexOf(o)>=0&&(i=i.replaceAll(o,e[o]));return i},te=()=>x?.variantPresets?.map(t=>`${tt(t.optionName)}($2)${t.optionType}`).join("($1)"),ti=()=>x?.variantPresets?.filter(t=>!!t?.hide)?.map(t=>t.optionName).join(","),to=({showDropdown:e,isRenderDefault:i,typeOfOption:o})=>t`
|
|
2
|
+
${f("value in values",a({id:"{{option.name | escape | handleize}}-{{value | escape | handleize}}",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:o,activeClass:W?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...T,...Z,swatchAutoWidth:K(),optionTypo:k,isRenderDefault:i}))}
|
|
3
|
+
${_(e?'type == "dropdown"':"false",r({...T,...Z,swatchAutoWidth:Q(),optionTypo:k}))}`,ts=x?.variantPresets?.map(t=>({name:tt(t.optionName),type:t.optionType})).map(t=>`${t.name}($1)${t.type}`).join("($2)").toString(),tn={renderVariantItem:to,variantPresetsLiquid:ts??""},ta=m(j(F)),tr=c(h(I,I)),tp=S(E,"Liquid"),tl=m(b(U,F)),td=()=>t`
|
|
4
|
+
${v(`{%- assign presets = "${te()}" | split: '($1)' -%}`)}
|
|
5
|
+
${v(`{% assign hiddenPresetOptions = "${ti()}" | split: ',' %}`)}
|
|
6
6
|
|
|
7
7
|
${v(`{% assign all_option_names = options | map: 'name' %}
|
|
8
8
|
{% assign filtered_options_string = '' %}
|
|
@@ -33,7 +33,7 @@ import{template as t,isLocalEnv as i,baseAssetURL as e,DEVICES as o,getResponsiv
|
|
|
33
33
|
<div
|
|
34
34
|
option-name="{{option.name | escape}}"
|
|
35
35
|
class="${tl} ${_("hiddenPresetOptions contains option.name","gp-hidden")}"
|
|
36
|
-
style="${A(D(
|
|
36
|
+
style="${A(D(z))}${v("{% if forloop.last or option.name == last_option_name %}--mb:0;--mb-mobile:0;--mb-tablet:0;{% endif %}")}"
|
|
37
37
|
>
|
|
38
38
|
${v("{%- assign showVariantClass = 'variant-display' -%}")}
|
|
39
39
|
${v("{%- assign optionName = option.name -%}")}
|
|
@@ -41,7 +41,7 @@ import{template as t,isLocalEnv as i,baseAssetURL as e,DEVICES as o,getResponsiv
|
|
|
41
41
|
${v("{%- assign presetDetail = preset | split: '($2)' -%}")}
|
|
42
42
|
${_("presetDetail[1] == 'dropdown' and presetDetail[0] == optionName",`${v("{%- assign showVariantClass = '' -%}")} ${v("{%- break -%}")}`)}
|
|
43
43
|
`)}
|
|
44
|
-
${$(
|
|
44
|
+
${$(L,n(tp)," ")}
|
|
45
45
|
<div
|
|
46
46
|
variant-option-name="{{option.name | escape}}"
|
|
47
47
|
class="${ta}"
|
|
@@ -68,7 +68,7 @@ import{template as t,isLocalEnv as i,baseAssetURL as e,DEVICES as o,getResponsiv
|
|
|
68
68
|
<div className="${tc}">
|
|
69
69
|
${p(tu)}
|
|
70
70
|
</div>
|
|
71
|
-
`,tf=u(g({uid:Y,hasPreSelected:W,cssClass:q?.cssClass})),t_=c(y(E)),t$=m({"gp-flex gp-flex-col !gp-ml-0":!0}),tg=()=>{let t=
|
|
71
|
+
`,tf=u(g({uid:Y,hasPreSelected:W,cssClass:q?.cssClass})),t_=c(y(E)),t$=m({"gp-flex gp-flex-col !gp-ml-0":!0}),tg=()=>{let t=e?"{{ 'gp-product-variant-v7-5.js' | asset_url }}":`${i}/assets-v2/gp-product-variant-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${l('class="gps-link" delay',"src")}="${t}" defer="defer"></script>`};return t`
|
|
72
72
|
${v("{%- assign total_combinations = 1 -%}")}
|
|
73
73
|
${f("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
|
|
74
74
|
<gp-product-variants ${tf}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let getWrapperAttr=(a,e)=>{let{typeOfOption:t,available:i,optionName:p,optionNameValue:o,isVariantOutStock:n}=a;return"Liquid"===e?{id:"value-wrapper-{{option.name | escape | strip}}-{{value | escape | strip}}","option-data":"{{option.name | escape}}","option-value":"{{value | escape}}","option-position":"{{option.position}}","data-gp-option-available":"{{value.available}}","option-type":`${t||"rectangle_list"}`,"data-disabled":"{%- if option_disabled == true -%} disabled {%- endif -%}","data-hidden":"true"}:{id:`value-wrapper-${p}-${o}`,"option-data":p||"","option-value":o||"","option-position":1,"data-gp-option-available":!!i,"option-type":`${t||"rectangle_list"}`,"data-disabled":!!n,"data-hidden":"true"}};export{getWrapperAttr};
|
|
1
|
+
let getWrapperAttr=(a,e)=>{let{typeOfOption:t,available:i,optionName:p,optionNameValue:o,isVariantOutStock:n}=a;return"Liquid"===e?{id:"value-wrapper-{{option.name | escape | strip | handleize}}-{{value | escape | strip | handleize}}","option-data":"{{option.name | escape}}","option-value":"{{value | escape}}","option-position":"{{option.position}}","data-gp-option-available":"{{value.available}}","option-type":`${t||"rectangle_list"}`,"data-disabled":"{%- if option_disabled == true -%} disabled {%- endif -%}","data-hidden":"true"}:{id:`value-wrapper-${p}-${o}`,"option-data":p||"","option-value":o||"","option-position":1,"data-gp-option-available":!!i,"option-type":`${t||"rectangle_list"}`,"data-disabled":!!n,"data-hidden":"true"}};export{getWrapperAttr};
|
|
@@ -79,7 +79,7 @@ import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-s
|
|
|
79
79
|
data-id="${v?.uid}"
|
|
80
80
|
style="${E}"
|
|
81
81
|
class="${$?.cssClass}"
|
|
82
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${k}], "isSyncProduct": "${S}", "hasPreSelected": ${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 }}" }'
|
|
82
|
+
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${k}], "isSyncProduct": "${S}", "hasPreSelected": ${I}, "variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity | default: 0 }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
83
83
|
>
|
|
84
84
|
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }}}</script>
|
|
85
85
|
<product-form class="product-form">
|