@gem-sdk/components 23.0.0-dev.16 → 23.0.0-dev.17
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-variants/ProductVariants.liquid.js +5 -6
- package/dist/cjs/product/components/product-wrap/Product.liquid.js +16 -15
- package/dist/esm/product/components/product-variants/ProductVariants.liquid.js +12 -13
- package/dist/esm/product/components/product-wrap/Product.liquid.js +23 -22
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("@gem-sdk/system"),i=require("./common/main/classes.js"),s=require("./OptionVariantsNewFormat.liquid.js"),a=require("./common/main/getData.js"),o=require("./components/dropdown-group/DropdownGroup.liquid.js"),n=require("./common/main/styles.js"),r=require("./components/dropdown-swatches/Dropdown.liquid.js"),p=require("./OptionVariantsOldFormat.liquid.js"),l=require("./common/variants/classes.js"),d=require("./utils/mappingVariantStyles.js"),u=require("./common/const.js"),
|
|
2
|
-
${t.LiquidFor("value in values",
|
|
3
|
-
${t.LiquidIf(i?'type == "dropdown"':"false",r.default({...h,...W,swatchAutoWidth:F(),optionTypo:b}))}`,R=j?.variantPresets?.map(e=>({name:z(e.optionName),type:e.optionType})).map(e=>`${e.name}($1)${e.type}`).join("($2)").toString(),J={renderVariantItem:M,variantPresetsLiquid:R??""},U=t.createClass(i.getVariantOptionGroupClass(L)),B=t.createStyle(n.getVariantOptionGroupStyle(V,V)),H=a.getTextVariantTitleData(q,"Liquid"),K=t.createClass(l.getWrapVariantOptionClass(x,L)),Q=t.createClass(i.getWrapDropdownClass(L)),Y=a.getDropdownGroupData(q),X=t.createAttr(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("@gem-sdk/system"),i=require("./common/main/classes.js"),s=require("./OptionVariantsNewFormat.liquid.js"),a=require("./common/main/getData.js"),o=require("./components/dropdown-group/DropdownGroup.liquid.js"),n=require("./common/main/styles.js"),r=require("./components/dropdown-swatches/Dropdown.liquid.js"),p=require("./OptionVariantsOldFormat.liquid.js"),l=require("./common/variants/classes.js"),d=require("./utils/mappingVariantStyles.js"),u=require("./common/const.js"),m=require("./common/variants/styles.js"),c=require("./components/variants/index.liquid.js"),v=require("../../helpers/function.js"),f=require("../../../helpers.js"),g=require("../../../text/components/Text.liquid.js"),$=require("./common/main/getAttr.js");const _={desktop:!0,tablet:!0,mobile:!0};exports.default=q=>{let{builderProps:y,styles:h,setting:j,advanced:S}=q,{align:L,swatchItemWidth:O,dropdownItemWidth:w,swatchSpacing:V,optionTypo:b,marginBottom:P}=h??{},{label:D,optionType:I,showAsSwatches:N,layout:x,hasPreSelected:C}=j??{},E=S?.d??_,{uid:T}=y??{},A=()=>{let t={};return e.DEVICES.forEach(i=>{let s=e.getResponsiveValueByScreen(O,i);t[i]="auto"===s}),t},F=()=>{let t={};return e.DEVICES.forEach(e=>{t[e]=w?.[e]==="fill"}),t},G=j?.variantPresets?d.mappingVariantStyles(j?.variantPresets,h):[],k=G?.map(e=>(e.presets={[e.optionType]:e.presets[e.optionType]},e)),W={...j,variantPresets:k},z=e=>{let t={"'":"'",'"':"""},i=e;for(let s in t)e.indexOf(s)>=0&&(i=i.replaceAll(s,t[s]));return i},M=({showDropdown:i,isRenderDefault:s,typeOfOption:a})=>e.template`
|
|
2
|
+
${t.LiquidFor("value in values",c.default({id:"{{option.name | escape | handleize}}-{{value | escape | handleize}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:N,uid:T,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:C?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:a,activeClass:C?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...h,...W,swatchAutoWidth:A(),optionTypo:b,isRenderDefault:s}))}
|
|
3
|
+
${t.LiquidIf(i?'type == "dropdown"':"false",r.default({...h,...W,swatchAutoWidth:F(),optionTypo:b}))}`,R=j?.variantPresets?.map(e=>({name:z(e.optionName),type:e.optionType})).map(e=>`${e.name}($1)${e.type}`).join("($2)").toString(),J={renderVariantItem:M,variantPresetsLiquid:R??""},U=t.createClass(i.getVariantOptionGroupClass(L)),B=t.createStyle(n.getVariantOptionGroupStyle(V,V)),H=a.getTextVariantTitleData(q,"Liquid"),K=t.createClass(l.getWrapVariantOptionClass(x,L)),Q=t.createClass(i.getWrapDropdownClass(L)),Y=a.getDropdownGroupData(q),X=t.createAttr($.getAttrs({uid:T,hasPreSelected:C,cssClass:S?.cssClass})),Z=t.createStyle(n.getWrapperStyle(q)),ee=t.createClass({"gp-flex gp-flex-col !gp-ml-0":!0});return e.template`
|
|
4
4
|
${t.Liquid("{%- assign total_combinations = 1 -%}")}
|
|
5
5
|
${t.LiquidFor("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
|
|
6
6
|
<gp-product-variants ${X}>
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"productUrl": {{product.url | json }},
|
|
19
19
|
"productHandle": {{product.handle | json }},
|
|
20
20
|
"displayState": ${JSON.stringify(E)},
|
|
21
|
-
"totalVariantCombinations": {{total_combinations}}
|
|
22
|
-
"firstAvailableVariant": {{product.selected_or_first_available_variant | json }}
|
|
21
|
+
"totalVariantCombinations": {{total_combinations}}
|
|
23
22
|
}
|
|
24
23
|
</script>
|
|
25
24
|
<div class="gp-hidden" style="--hvr-shadow: none; --hvr-shadow-tablet: none; --hvr-shadow-mobile: none"></div>
|
|
@@ -66,7 +65,7 @@
|
|
|
66
65
|
<div
|
|
67
66
|
option-name="{{option.name | escape}}"
|
|
68
67
|
class="${K} ${t.LiquidIf("hiddenPresetOptions contains option.name","gp-hidden")}"
|
|
69
|
-
style="${v.getStyleOfObject(
|
|
68
|
+
style="${v.getStyleOfObject(m.getMarginBottomStyle(P))}${u.PRODUCT_VARIANT_OPTION_MINW_STYLE}${t.Liquid("{% if forloop.last or option.name == last_option_name %}--mb:0;--mb-mobile:0;--mb-tablet:0;{% endif %}")}"
|
|
70
69
|
>
|
|
71
70
|
${t.Liquid("{%- assign showVariantClass = 'variant-display' -%}")}
|
|
72
71
|
${t.Liquid("{%- assign optionName = option.name -%}")}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./common/helpers.js"),e=require("@gem-sdk/core"),i=require("../../../helpers.js"),a=require("../../../grid/components/row/Row.liquid.js"),r=require("@gem-sdk/system");exports.default=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./common/helpers.js"),e=require("@gem-sdk/core"),i=require("../../../helpers.js"),a=require("../../../grid/components/row/Row.liquid.js"),r=require("@gem-sdk/system");exports.default=n=>{let{children:o,setting:s,style:d,builderProps:l,rawChildren:c,advanced:p}=n,{isSyncProduct:u,productSetting:f}=s??{},g=f?.hasPreSelected??!1,{rowSetting:v,rowStyles:_,formatVariantId:m,formatProductId:y,productStatus:$,preSelectedOptionIds:S,productHandle:I,advancedStyle:b}=t.getData(n);return e.template`
|
|
2
2
|
${e.template`
|
|
3
3
|
{%- assign gpBkProduct = product -%}
|
|
4
4
|
${r.If($==t.DYNAMIC_PRODUCT_STATUS,e.template`
|
|
5
5
|
{%- liquid
|
|
6
6
|
if request.page_type != 'product'
|
|
7
7
|
assign product = all_products['${I}']
|
|
8
|
-
assign productId = '${
|
|
8
|
+
assign productId = '${y}' | times: 1
|
|
9
9
|
if product == empty or product == null
|
|
10
10
|
paginate collections.all.products by 100000
|
|
11
11
|
for item in collections.all.products
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
{%- liquid
|
|
22
22
|
if request.page_type == 'product'
|
|
23
23
|
if '${$}' == '${t.STATIC_PRODUCT_STATUS}'
|
|
24
|
-
if '${
|
|
24
|
+
if '${y}' == '${t.PRODUCT_ID_LATEST}'
|
|
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
29
|
assign product = all_products['${I}']
|
|
30
|
-
assign productId = '${
|
|
30
|
+
assign productId = '${y}' | 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,13 +40,13 @@
|
|
|
40
40
|
endif
|
|
41
41
|
endif
|
|
42
42
|
else
|
|
43
|
-
if '${
|
|
43
|
+
if '${y}' == '${t.PRODUCT_ID_LATEST}'
|
|
44
44
|
paginate collections.all.products by 100000
|
|
45
45
|
assign product = collections.all.products | sort: 'created_at'| reverse | first
|
|
46
46
|
endpaginate
|
|
47
47
|
else
|
|
48
48
|
assign product = all_products['${I}']
|
|
49
|
-
assign productId = '${
|
|
49
|
+
assign productId = '${y}' | times: 1
|
|
50
50
|
if product == empty or product == null
|
|
51
51
|
paginate collections.all.products by 100000
|
|
52
52
|
for item in collections.all.products
|
|
@@ -63,34 +63,35 @@
|
|
|
63
63
|
`}
|
|
64
64
|
${r.LiquidIf("product != empty and product != null",e.template`
|
|
65
65
|
${e.template`
|
|
66
|
-
{%- assign initVariantId = ${
|
|
67
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
68
|
-
${
|
|
69
|
-
${
|
|
66
|
+
{%- assign initVariantId = ${m} -%}
|
|
67
|
+
{%- assign product_form_id = 'product-form-' | append: "${l?.uid}" -%}
|
|
68
|
+
${m?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
|
|
69
|
+
${m?"{%- assign productSelectedVariant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}"}
|
|
70
70
|
{%-if productSelectedVariant == empty or productSelectedVariant == null -%}
|
|
71
71
|
{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}
|
|
72
72
|
{%- endif -%}
|
|
73
73
|
{%-if variant == empty or variant == null -%}
|
|
74
74
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
75
75
|
{%- endif -%}
|
|
76
|
+
{%- assign gpFirstAvailableVariant = product.selected_or_first_available_variant -%}
|
|
76
77
|
{% unless isSettingSameHeightProductList %}
|
|
77
78
|
{%- assign isSettingSameHeightProductList = false -%}
|
|
78
79
|
{% endunless %}
|
|
79
80
|
`}
|
|
80
81
|
<gp-product
|
|
81
|
-
data-uid="${
|
|
82
|
-
data-id="${
|
|
83
|
-
style="${
|
|
82
|
+
data-uid="${l?.uid}"
|
|
83
|
+
data-id="${l?.uid}"
|
|
84
|
+
style="${b}"
|
|
84
85
|
class="${p?.cssClass}"
|
|
85
86
|
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${S}], "isSyncProduct": "${u}", "hasPreSelected": ${g}, "hasOnlyDefaultVariant": {{ product.has_only_default_variant }}, "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 }}" }'
|
|
86
87
|
>
|
|
87
|
-
<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>
|
|
88
|
+
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "productOptions": {{ product.options | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }}, "firstAvailableVariant": {{ gpFirstAvailableVariant | json }} , "variantIds":{{product.variants | map: 'id' | json}}, "firstAvailableVariantInventory": {"inventoryQuantity": {{ gpFirstAvailableVariant.inventory_quantity | default: 0 }}, "inventory_policy": {{ gpFirstAvailableVariant.inventory_policy | json }}}}</script>
|
|
88
89
|
<product-form class="product-form">
|
|
89
90
|
{%- form 'product', product, id: product_form_id, class: 'form contents', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
90
91
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
91
92
|
<input type="hidden" name="quantity" value="{{ quantity }}" />
|
|
92
93
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
93
|
-
${a.default({builderProps:{...
|
|
94
|
+
${a.default({builderProps:{...l,uid:l?.uid,uidInteraction:`${l?.uid}-row`},style:d,styles:_,setting:v,children:o,rawChildren:c})}
|
|
94
95
|
{%- endform -%}
|
|
95
96
|
</product-form>
|
|
96
97
|
</gp-product>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{template as t,baseAssetURL as
|
|
2
|
-
${l("value in values",O({id:"{{option.name | escape | handleize}}-{{value | escape | handleize}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:R,uid:U,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:K?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:e,activeClass:K?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...
|
|
3
|
-
${d(
|
|
1
|
+
import{template as t,baseAssetURL as o,isLocalEnv as i,DEVICES as e,getResponsiveValueByScreen as s}from"@gem-sdk/core";import{createClass as n,createStyle as a,createAttr as r,Liquid as p,LiquidFor as l,LiquidIf as d,If as m}from"@gem-sdk/system";import{getVariantOptionGroupClass as c,getWrapDropdownClass as u}from"./common/main/classes.js";import{renderOptionValuesNewFormatSwatches as f}from"./OptionVariantsNewFormat.liquid.js";import{getTextVariantTitleData as v,getDropdownGroupData as $}from"./common/main/getData.js";import g from"./components/dropdown-group/DropdownGroup.liquid.js";import{getVariantOptionGroupStyle as _,getWrapperStyle as h}from"./common/main/styles.js";import y from"./components/dropdown-swatches/Dropdown.liquid.js";import{renderOptionValuesOld as j}from"./OptionVariantsOldFormat.liquid.js";import{getWrapVariantOptionClass as w}from"./common/variants/classes.js";import{mappingVariantStyles as S}from"./utils/mappingVariantStyles.js";import{PRODUCT_VARIANT_OPTION_MINW_STYLE as b}from"./common/const.js";import{getMarginBottomStyle as P}from"./common/variants/styles.js";import O from"./components/variants/index.liquid.js";import{getStyleOfObject as x}from"../../helpers/function.js";import{getSettingPreloadData as N}from"../../../helpers.js";import V from"../../../text/components/Text.liquid.js";import{getAttrs as q}from"./common/main/getAttr.js";let D={desktop:!0,tablet:!0,mobile:!0},E=E=>{let{builderProps:T,styles:A,setting:k,advanced:F}=E,{align:G,swatchItemWidth:z,dropdownItemWidth:C,swatchSpacing:J,optionTypo:I,marginBottom:M}=A??{},{label:W,optionType:L,showAsSwatches:R,layout:H,hasPreSelected:K}=k??{},Q=F?.d??D,{uid:U}=T??{},B=()=>{let t={};return e.forEach(o=>{let i=s(z,o);t[o]="auto"===i}),t},X=()=>{let t={};return e.forEach(o=>{t[o]=C?.[o]==="fill"}),t},Y=k?.variantPresets?S(k?.variantPresets,A):[],Z=Y?.map(t=>(t.presets={[t.optionType]:t.presets[t.optionType]},t)),tt={...k,variantPresets:Z},to=t=>{let o={"'":"'",'"':"""},i=t;for(let e in o)t.indexOf(e)>=0&&(i=i.replaceAll(e,o[e]));return i},ti=({showDropdown:o,isRenderDefault:i,typeOfOption:e})=>t`
|
|
2
|
+
${l("value in values",O({id:"{{option.name | escape | handleize}}-{{value | escape | handleize}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:R,uid:U,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:K?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:e,activeClass:K?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...A,...tt,swatchAutoWidth:B(),optionTypo:I,isRenderDefault:i}))}
|
|
3
|
+
${d(o?'type == "dropdown"':"false",y({...A,...tt,swatchAutoWidth:X(),optionTypo:I}))}`,te=k?.variantPresets?.map(t=>({name:to(t.optionName),type:t.optionType})).map(t=>`${t.name}($1)${t.type}`).join("($2)").toString(),ts={renderVariantItem:ti,variantPresetsLiquid:te??""},tn=n(c(G)),ta=a(_(J,J)),tr=v(E,"Liquid"),tp=n(w(H,G)),tl=n(u(G)),td=$(E),tm=r(q({uid:U,hasPreSelected:K,cssClass:F?.cssClass})),tc=a(h(E)),tu=n({"gp-flex gp-flex-col !gp-ml-0":!0});return t`
|
|
4
4
|
${p("{%- assign total_combinations = 1 -%}")}
|
|
5
5
|
${l("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
|
|
6
6
|
<gp-product-variants ${tm}>
|
|
7
7
|
<script gp-data type="application/json">
|
|
8
8
|
{
|
|
9
9
|
"setting":${JSON.stringify(tt)},
|
|
10
|
-
"styles":${JSON.stringify(
|
|
10
|
+
"styles":${JSON.stringify(A)},
|
|
11
11
|
"variants":{{product.variants | json}},
|
|
12
12
|
"optionsWithValues": {{product.options_with_values | json}},
|
|
13
13
|
"variantSelected": {{ variant | json }},
|
|
@@ -18,8 +18,7 @@ import{template as t,baseAssetURL as i,isLocalEnv as o,DEVICES as e,getResponsiv
|
|
|
18
18
|
"productUrl": {{product.url | json }},
|
|
19
19
|
"productHandle": {{product.handle | json }},
|
|
20
20
|
"displayState": ${JSON.stringify(Q)},
|
|
21
|
-
"totalVariantCombinations": {{total_combinations}}
|
|
22
|
-
"firstAvailableVariant": {{product.selected_or_first_available_variant | json }}
|
|
21
|
+
"totalVariantCombinations": {{total_combinations}}
|
|
23
22
|
}
|
|
24
23
|
</script>
|
|
25
24
|
<div class="gp-hidden" style="--hvr-shadow: none; --hvr-shadow-tablet: none; --hvr-shadow-mobile: none"></div>
|
|
@@ -34,7 +33,7 @@ import{template as t,baseAssetURL as i,isLocalEnv as o,DEVICES as e,getResponsiv
|
|
|
34
33
|
${g(td)}
|
|
35
34
|
</div>
|
|
36
35
|
`,t`
|
|
37
|
-
${p(`{%- assign presets = "${k?.variantPresets?.map(t=>`${
|
|
36
|
+
${p(`{%- assign presets = "${k?.variantPresets?.map(t=>`${to(t.optionName)}($2)${t.optionType}`).join("($1)")}" | split: '($1)' -%}`)}
|
|
38
37
|
${p(`{% assign hiddenPresetOptions = "${k?.variantPresets?.filter(t=>!!t?.hide)?.map(t=>t.optionName).join(",")}" | split: ',' %}`)}
|
|
39
38
|
|
|
40
39
|
${p(`{% assign all_option_names = options | map: 'name' %}
|
|
@@ -66,7 +65,7 @@ import{template as t,baseAssetURL as i,isLocalEnv as o,DEVICES as e,getResponsiv
|
|
|
66
65
|
<div
|
|
67
66
|
option-name="{{option.name | escape}}"
|
|
68
67
|
class="${tp} ${d("hiddenPresetOptions contains option.name","gp-hidden")}"
|
|
69
|
-
style="${x(P(M))}${
|
|
68
|
+
style="${x(P(M))}${b}${p("{% if forloop.last or option.name == last_option_name %}--mb:0;--mb-mobile:0;--mb-tablet:0;{% endif %}")}"
|
|
70
69
|
>
|
|
71
70
|
${p("{%- assign showVariantClass = 'variant-display' -%}")}
|
|
72
71
|
${p("{%- assign optionName = option.name -%}")}
|
|
@@ -74,7 +73,7 @@ import{template as t,baseAssetURL as i,isLocalEnv as o,DEVICES as e,getResponsiv
|
|
|
74
73
|
${p("{%- assign presetDetail = preset | split: '($2)' -%}")}
|
|
75
74
|
${d("presetDetail[1] == 'dropdown' and presetDetail[0] == optionName",`${p("{%- assign showVariantClass = '' -%}")} ${p("{%- break -%}")}`)}
|
|
76
75
|
`)}
|
|
77
|
-
${m(W,
|
|
76
|
+
${m(W,V(tr)," ")}
|
|
78
77
|
<div
|
|
79
78
|
variant-option-name="{{option.name | escape}}"
|
|
80
79
|
class="${tn}"
|
|
@@ -93,13 +92,13 @@ import{template as t,baseAssetURL as i,isLocalEnv as o,DEVICES as e,getResponsiv
|
|
|
93
92
|
`)}
|
|
94
93
|
${m(!K,p("{%- assign selectedValue = null -%}"),"")}
|
|
95
94
|
${m(R,t`
|
|
96
|
-
${d("shop.metafields.GEMPAGES.swatchesJSONFormat and shop.metafields.GEMPAGES.swatchesJSONFormat != blank",
|
|
97
|
-
`,
|
|
95
|
+
${d("shop.metafields.GEMPAGES.swatchesJSONFormat and shop.metafields.GEMPAGES.swatchesJSONFormat != blank",f(ts),j(ts))}
|
|
96
|
+
`,ti({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
|
|
98
97
|
</div>
|
|
99
98
|
</div>`)}
|
|
100
99
|
`)}
|
|
101
100
|
</div>`)}
|
|
102
101
|
</gp-product-variants>
|
|
103
102
|
|
|
104
|
-
${(()=>{let t=
|
|
105
|
-
`};export{
|
|
103
|
+
${(()=>{let t=i?"{{ '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 ${N('class="gps-link" delay',"src")}="${t}" defer="defer"></script>`})()}
|
|
104
|
+
`};export{E as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{getData as t,DYNAMIC_PRODUCT_STATUS as
|
|
2
|
-
${
|
|
1
|
+
import{getData as t,DYNAMIC_PRODUCT_STATUS as i,STATIC_PRODUCT_STATUS as e,PRODUCT_ID_LATEST as r}from"./common/helpers.js";import{RenderIf as a,isLocalEnv as n,baseAssetURL as o,template as d}from"@gem-sdk/core";import{getSettingPreloadData as s,getStaticLocale as c}from"../../../helpers.js";import l from"../../../grid/components/row/Row.liquid.js";import{LiquidIf as p,If as u}from"@gem-sdk/system";let f=f=>{let{children:g,setting:m,style:v,builderProps:y,rawChildren:_,advanced:$}=f,{isSyncProduct:b,productSetting:S}=m??{},j=S?.hasPreSelected??!1,{rowSetting:h,rowStyles:I,formatVariantId:V,formatProductId:q,productStatus:P,preSelectedOptionIds:A,productHandle:k,advancedStyle:w}=t(f);return d`
|
|
2
|
+
${d`
|
|
3
3
|
{%- assign gpBkProduct = product -%}
|
|
4
|
-
${u(
|
|
4
|
+
${u(P==i,d`
|
|
5
5
|
{%- liquid
|
|
6
6
|
if request.page_type != 'product'
|
|
7
|
-
assign product = all_products['${
|
|
7
|
+
assign product = all_products['${k}']
|
|
8
8
|
assign productId = '${q}' | times: 1
|
|
9
9
|
if product == empty or product == null
|
|
10
10
|
paginate collections.all.products by 100000
|
|
@@ -17,16 +17,16 @@ import{getData as t,DYNAMIC_PRODUCT_STATUS as e,STATIC_PRODUCT_STATUS as i,PRODU
|
|
|
17
17
|
endif
|
|
18
18
|
endif
|
|
19
19
|
-%}
|
|
20
|
-
`,
|
|
20
|
+
`,d`
|
|
21
21
|
{%- liquid
|
|
22
22
|
if request.page_type == 'product'
|
|
23
|
-
if '${
|
|
23
|
+
if '${P}' == '${e}'
|
|
24
24
|
if '${q}' == '${r}'
|
|
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['${
|
|
29
|
+
assign product = all_products['${k}']
|
|
30
30
|
assign productId = '${q}' | times: 1
|
|
31
31
|
if product == empty or product == null
|
|
32
32
|
paginate collections.all.products by 100000
|
|
@@ -45,7 +45,7 @@ import{getData as t,DYNAMIC_PRODUCT_STATUS as e,STATIC_PRODUCT_STATUS as i,PRODU
|
|
|
45
45
|
assign product = collections.all.products | sort: 'created_at'| reverse | first
|
|
46
46
|
endpaginate
|
|
47
47
|
else
|
|
48
|
-
assign product = all_products['${
|
|
48
|
+
assign product = all_products['${k}']
|
|
49
49
|
assign productId = '${q}' | times: 1
|
|
50
50
|
if product == empty or product == null
|
|
51
51
|
paginate collections.all.products by 100000
|
|
@@ -61,42 +61,43 @@ import{getData as t,DYNAMIC_PRODUCT_STATUS as e,STATIC_PRODUCT_STATUS as i,PRODU
|
|
|
61
61
|
-%}
|
|
62
62
|
`)}
|
|
63
63
|
`}
|
|
64
|
-
${p("product != empty and product != null",
|
|
65
|
-
${
|
|
66
|
-
{%- assign initVariantId = ${
|
|
67
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
68
|
-
${
|
|
69
|
-
${
|
|
64
|
+
${p("product != empty and product != null",d`
|
|
65
|
+
${d`
|
|
66
|
+
{%- assign initVariantId = ${V} -%}
|
|
67
|
+
{%- assign product_form_id = 'product-form-' | append: "${y?.uid}" -%}
|
|
68
|
+
${V?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
|
|
69
|
+
${V?"{%- assign productSelectedVariant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}"}
|
|
70
70
|
{%-if productSelectedVariant == empty or productSelectedVariant == null -%}
|
|
71
71
|
{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}
|
|
72
72
|
{%- endif -%}
|
|
73
73
|
{%-if variant == empty or variant == null -%}
|
|
74
74
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
75
75
|
{%- endif -%}
|
|
76
|
+
{%- assign gpFirstAvailableVariant = product.selected_or_first_available_variant -%}
|
|
76
77
|
{% unless isSettingSameHeightProductList %}
|
|
77
78
|
{%- assign isSettingSameHeightProductList = false -%}
|
|
78
79
|
{% endunless %}
|
|
79
80
|
`}
|
|
80
81
|
<gp-product
|
|
81
|
-
data-uid="${
|
|
82
|
-
data-id="${
|
|
83
|
-
style="${
|
|
82
|
+
data-uid="${y?.uid}"
|
|
83
|
+
data-id="${y?.uid}"
|
|
84
|
+
style="${w}"
|
|
84
85
|
class="${$?.cssClass}"
|
|
85
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${
|
|
86
|
+
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${A}], "isSyncProduct": "${b}", "hasPreSelected": ${j}, "hasOnlyDefaultVariant": {{ product.has_only_default_variant }}, "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 }}" }'
|
|
86
87
|
>
|
|
87
|
-
<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>
|
|
88
|
+
<script gp-data type="application/json">{"variantSelected": {{ variant | json }}, "quantity": 1, "productUrl":{{ product.url | json }}, "productHandle":{{ product.handle | json }}, "productOptions": {{ product.options | json }}, "collectionUrl": {{ collection.url | json }}, "collectionHandle": {{ collection.handle | json }}, "firstAvailableVariant": {{ gpFirstAvailableVariant | json }} , "variantIds":{{product.variants | map: 'id' | json}}, "firstAvailableVariantInventory": {"inventoryQuantity": {{ gpFirstAvailableVariant.inventory_quantity | default: 0 }}, "inventory_policy": {{ gpFirstAvailableVariant.inventory_policy | json }}}}</script>
|
|
88
89
|
<product-form class="product-form">
|
|
89
90
|
{%- form 'product', product, id: product_form_id, class: 'form contents', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
90
91
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
91
92
|
<input type="hidden" name="quantity" value="{{ quantity }}" />
|
|
92
93
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
93
|
-
${l({builderProps:{...
|
|
94
|
+
${l({builderProps:{...y,uid:y?.uid,uidInteraction:`${y?.uid}-row`},style:v,styles:I,setting:h,children:g,rawChildren:_})}
|
|
94
95
|
{%- endform -%}
|
|
95
96
|
</product-form>
|
|
96
97
|
</gp-product>
|
|
97
98
|
{%- assign product = gpBkProduct -%}
|
|
98
|
-
`,
|
|
99
|
+
`,d`
|
|
99
100
|
<div class="gp-text-center">${c("Product","product_not_found")}</div>
|
|
100
101
|
`)}
|
|
101
|
-
${a(
|
|
102
|
+
${a(n,`<script ${s('class="gps-link" delay',"src")}="{{ 'gp-product-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${s('class="gps-link" delay',"src")}="${o}/assets-v2/gp-product-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
102
103
|
`};export{f as default};
|