@gem-sdk/components 11.2.1 → 11.2.3
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-title/ProductTitle.liquid.js +10 -3
- package/dist/cjs/product/components/product-variants/ProductVariants.liquid.js +4 -4
- package/dist/cjs/product/components/product-wrap/Product.liquid.js +25 -25
- package/dist/esm/product/components/product-title/ProductTitle.liquid.js +10 -3
- package/dist/esm/product/components/product-variants/ProductVariants.liquid.js +9 -9
- package/dist/esm/product/components/product-wrap/Product.liquid.js +26 -26
- package/package.json +1 -1
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../../helpers.js"),Text_liquid=require("../../../text/components/Text.liquid.js"),system=require("@gem-sdk/system"),helpers$1=require("./common/helpers.js");const ProductTitle=e=>{let{setting:t}=e,
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../../helpers.js"),Text_liquid=require("../../../text/components/Text.liquid.js"),system=require("@gem-sdk/system"),helpers$1=require("./common/helpers.js");const ProductTitle=e=>{let{setting:t,builderProps:r}=e,s=`<p>${helpers.getStaticLocale("ProductTitle","product_not_found")}</p>`,l=()=>Text_liquid.default(helpers$1.getTextProps(e)),i=system.createAttr({href:"{{ product.url }}",title:"{{ product.title }}"}),o=t?.linkProduct,c=system.createClass({"gp-product-title-link-wrapper":!0}),p=system.createStateOrContext({setting:{linkProduct:t?.linkProduct},uid:r?.uid}),u=()=>{let e=core.isLocalEnv?"{{ 'gp-product-title-v7-5.js' | asset_url }}":`${core.baseAssetURL}/assets-v2/gp-product-title-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`};return system.LiquidUnless("product",`${s}`,core.template`
|
|
2
|
+
<gp-product-title
|
|
3
|
+
gp-data='${core.dataStringify(p)}'
|
|
4
|
+
>
|
|
5
|
+
${system.If(o,core.template`<a ${i} class="${c}">
|
|
6
|
+
${l()}
|
|
7
|
+
</a>`,core.template`${l()}`)}
|
|
8
|
+
</gp-product-title>
|
|
9
|
+
${u()}
|
|
10
|
+
`)};exports.default=ProductTitle;
|
|
@@ -1,6 +1,6 @@
|
|
|
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]}})),w={...i,
|
|
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]}})),w={...i,variantPresets:S},L=e=>{let t={"'":"'",'"':"""},s=e;for(let i in t)e.indexOf(i)>=0&&(s=s.replaceAll(i,t[i]));return s},j=()=>i?.variantPresets?.map(e=>`${L(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
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,...w,swatchAutoWidth:q(),optionTypo:p,isRenderDefault:t}))}
|
|
3
|
-
${system.LiquidIf(e?'type == "dropdown"':"false",Dropdown_liquid.default({...s,...w,swatchAutoWidth:$(),optionTypo:p}))}`,D=i?.variantPresets?.map(e=>({name:L(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)),
|
|
3
|
+
${system.LiquidIf(e?'type == "dropdown"':"false",Dropdown_liquid.default({...s,...w,swatchAutoWidth:$(),optionTypo:p}))}`,D=i?.variantPresets?.map(e=>({name:L(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 = "${j()}" | split: '($1)' -%}`)}
|
|
5
5
|
${system.Liquid(`{% assign hiddenPresetOptions = "${O()}" | split: ',' %}`)}
|
|
6
6
|
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
${system.Liquid("{%- assign presetDetail = preset | split: '($2)' -%}")}
|
|
42
42
|
${system.LiquidIf("presetDetail[1] == 'dropdown' and presetDetail[0] == optionName",`${system.Liquid("{%- assign showVariantClass = '' -%}")} ${system.Liquid("{%- break -%}")}`)}
|
|
43
43
|
`)}
|
|
44
|
-
${system.If(u,Text_liquid.default(
|
|
44
|
+
${system.If(u,Text_liquid.default(E)," ")}
|
|
45
45
|
<div
|
|
46
46
|
variant-option-name="{{option.name | escape}}"
|
|
47
47
|
class="${b}"
|
|
48
|
-
style="${_function.getStyleOfObject(
|
|
48
|
+
style="${_function.getStyleOfObject(P)}"
|
|
49
49
|
>
|
|
50
50
|
${system.Liquid("{%- assign values = option.values -%}")}
|
|
51
51
|
${system.Liquid("{%- assign rootForloop = forloop.index0 -%}")}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Row_liquid=require("../../../grid/components/row/Row.liquid.js"),system=require("@gem-sdk/system"),helpers$1=require("../../../helpers.js"),helpers=require("./common/helpers.js");const Product=e=>{let{children:t,setting:r,style:i,builderProps:a,rawChildren:o,advanced:d}=e,{isSyncProduct:s}=r??{},{rowSetting:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Row_liquid=require("../../../grid/components/row/Row.liquid.js"),system=require("@gem-sdk/system"),helpers$1=require("../../../helpers.js"),helpers=require("./common/helpers.js");const Product=e=>{let{children:t,setting:r,style:i,builderProps:a,rawChildren:o,advanced:d}=e,{isSyncProduct:s,productSetting:n}=r??{},c=n?.hasPreSelected??!1,{rowSetting:l,rowStyles:p,formatVariantId:u,formatProductId:f,productStatus:g,preSelectedOptionIds:m,productHandle:_,advancedStyle:y}=helpers.getData(e),v=()=>core.template`
|
|
2
2
|
{%- liquid
|
|
3
3
|
if request.page_type == 'product'
|
|
4
|
-
if '${
|
|
5
|
-
if '${
|
|
4
|
+
if '${g}' == '${helpers.STATIC_PRODUCT_STATUS}'
|
|
5
|
+
if '${f}' == '${helpers.PRODUCT_ID_LATEST}'
|
|
6
6
|
paginate collections.all.products by 100000
|
|
7
7
|
assign product = collections.all.products | sort: 'created_at' | reverse | first
|
|
8
8
|
endpaginate
|
|
9
9
|
else
|
|
10
|
-
assign product = all_products['${
|
|
11
|
-
assign productId = '${
|
|
10
|
+
assign product = all_products['${_}']
|
|
11
|
+
assign productId = '${f}' | times: 1
|
|
12
12
|
if product == empty or product == null
|
|
13
13
|
paginate collections.all.products by 100000
|
|
14
14
|
for item in collections.all.products
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
endif
|
|
22
22
|
endif
|
|
23
23
|
else
|
|
24
|
-
if '${
|
|
24
|
+
if '${f}' == '${helpers.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
|
-
assign product = all_products['${
|
|
30
|
-
assign productId = '${
|
|
29
|
+
assign product = all_products['${_}']
|
|
30
|
+
assign productId = '${f}' | times: 1
|
|
31
31
|
if product == empty or product == null
|
|
32
32
|
paginate collections.all.products by 100000
|
|
33
33
|
for item in collections.all.products
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
endif
|
|
41
41
|
endif
|
|
42
42
|
-%}
|
|
43
|
-
|
|
43
|
+
`,$=()=>core.template`
|
|
44
44
|
{%- liquid
|
|
45
45
|
if request.page_type != 'product'
|
|
46
|
-
assign product = all_products['${
|
|
47
|
-
assign productId = '${
|
|
46
|
+
assign product = all_products['${_}']
|
|
47
|
+
assign productId = '${f}' | times: 1
|
|
48
48
|
if product == empty or product == null
|
|
49
49
|
paginate collections.all.products by 100000
|
|
50
50
|
for item in collections.all.products
|
|
@@ -56,30 +56,30 @@
|
|
|
56
56
|
endif
|
|
57
57
|
endif
|
|
58
58
|
-%}
|
|
59
|
-
`,
|
|
59
|
+
`,S=()=>core.template`
|
|
60
60
|
{%- assign gpBkProduct = product -%}
|
|
61
|
-
${system.If(
|
|
62
|
-
|
|
63
|
-
{%- assign initVariantId = ${
|
|
61
|
+
${system.If(g==helpers.DYNAMIC_PRODUCT_STATUS,$(),v())}
|
|
62
|
+
`,h=()=>core.template`
|
|
63
|
+
{%- assign initVariantId = ${u} -%}
|
|
64
64
|
{%- assign product_form_id = 'product-form-' | append: "${a?.uid}" -%}
|
|
65
|
-
${
|
|
66
|
-
${
|
|
65
|
+
${u?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
|
|
66
|
+
${u?"{%- assign productSelectedVariant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}"}
|
|
67
67
|
{%-if productSelectedVariant == empty or productSelectedVariant == null -%}
|
|
68
68
|
{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}
|
|
69
69
|
{%- endif -%}
|
|
70
70
|
{%-if variant == empty or variant == null -%}
|
|
71
71
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
72
72
|
{%- endif -%}
|
|
73
|
-
`,S=()=>core.template`
|
|
74
|
-
<div class="gp-text-center">${helpers$1.getStaticLocale("Product","product_not_found")}</div>
|
|
75
73
|
`,I=()=>core.template`
|
|
76
|
-
|
|
74
|
+
<div class="gp-text-center">${helpers$1.getStaticLocale("Product","product_not_found")}</div>
|
|
75
|
+
`,q=()=>core.template`
|
|
76
|
+
${h()}
|
|
77
77
|
<gp-product
|
|
78
78
|
data-uid="${a?.uid}"
|
|
79
79
|
data-id="${a?.uid}"
|
|
80
|
-
style="${
|
|
80
|
+
style="${y}"
|
|
81
81
|
class="${d?.cssClass}"
|
|
82
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${
|
|
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 }}" }'
|
|
83
83
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }}}'
|
|
84
84
|
>
|
|
85
85
|
<product-form class="product-form">
|
|
@@ -87,13 +87,13 @@
|
|
|
87
87
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
88
88
|
<input type="hidden" name="quantity" value="{{ quantity }}" />
|
|
89
89
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
90
|
-
${Row_liquid.default({builderProps:{...a,uid:a?.uid,uidInteraction:`${a?.uid}-row`},style:i,styles:
|
|
90
|
+
${Row_liquid.default({builderProps:{...a,uid:a?.uid,uidInteraction:`${a?.uid}-row`},style:i,styles:p,setting:l,children:t,rawChildren:o})}
|
|
91
91
|
{%- endform -%}
|
|
92
92
|
</product-form>
|
|
93
93
|
</gp-product>
|
|
94
94
|
{%- assign product = gpBkProduct -%}
|
|
95
95
|
`;return core.template`
|
|
96
|
-
${
|
|
97
|
-
${system.LiquidIf("product != empty and product != null",
|
|
96
|
+
${S()}
|
|
97
|
+
${system.LiquidIf("product != empty and product != null",q(),I())}
|
|
98
98
|
${core.RenderIf(core.isLocalEnv,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-product-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
99
99
|
`};exports.default=Product;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
import{template as t}from"@gem-sdk/core";import{getStaticLocale as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import{template as t,dataStringify as r,isLocalEnv as e,baseAssetURL as o}from"@gem-sdk/core";import{getStaticLocale as p,getSettingPreloadData as s}from"../../../helpers.js";import i from"../../../text/components/Text.liquid.js";import{createAttr as l,createClass as d,createStateOrContext as u,LiquidUnless as c,If as m}from"@gem-sdk/system";import{getTextProps as a}from"./common/helpers.js";let ProductTitle=n=>{let{setting:$,builderProps:f}=n,g=`<p>${p("ProductTitle","product_not_found")}</p>`,k=()=>i(a(n)),P=l({href:"{{ product.url }}",title:"{{ product.title }}"}),j=$?.linkProduct,S=d({"gp-product-title-link-wrapper":!0}),T=u({setting:{linkProduct:$?.linkProduct},uid:f?.uid}),h=()=>{let t=e?"{{ 'gp-product-title-v7-5.js' | asset_url }}":`${o}/assets-v2/gp-product-title-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${s('class="gps-link" delay',"src")}="${t}" defer="defer"></script>`};return c("product",`${g}`,t`
|
|
2
|
+
<gp-product-title
|
|
3
|
+
gp-data='${r(T)}'
|
|
4
|
+
>
|
|
5
|
+
${m(j,t`<a ${P} class="${S}">
|
|
6
|
+
${k()}
|
|
7
|
+
</a>`,t`${k()}`)}
|
|
8
|
+
</gp-product-title>
|
|
9
|
+
${h()}
|
|
10
|
+
`)};export{ProductTitle as default};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{template as e,isLocalEnv as t,baseAssetURL as
|
|
2
|
-
${f("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:
|
|
3
|
-
${_(t?'type == "dropdown"':"false",r({...T,...Z,swatchAutoWidth:Q(),optionTypo:k}))}`,
|
|
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 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:L}=T??{},{label:J,optionType:z,showAsSwatches:M,layout:U,hasPreSelected:W}=x??{},R=q?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:Y}=O??{},H="groupOption"===z,K=()=>{let e={};return i.forEach(t=>{let s=o(G,t);e[t]="auto"===s}),e},Q=()=>{let e={};return i.forEach(t=>{e[t]=C?.[t]==="fill"}),e},B=x?.variantPresets?d(x?.variantPresets,T):[],X=B?.map(e=>({...e,presets:{[e.optionType]:e.presets[e.optionType]}})),Z={...x,variantPresets: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
|
+
${f("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 -%}":"",...T,...Z,swatchAutoWidth:K(),optionTypo:k,isRenderDefault:s}))}
|
|
3
|
+
${_(t?'type == "dropdown"':"false",r({...T,...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(F)),er=c(h(I,I)),ep=S(E,"Liquid"),el=m(b(U,F)),ed=()=>e`
|
|
4
4
|
${v(`{%- assign presets = "${et()}" | split: '($1)' -%}`)}
|
|
5
|
-
${v(`{% assign hiddenPresetOptions = "${
|
|
5
|
+
${v(`{% assign hiddenPresetOptions = "${es()}" | 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 e,isLocalEnv as t,baseAssetURL as i,DEVICES as o,getResponsiv
|
|
|
33
33
|
<div
|
|
34
34
|
option-name="{{option.name | escape}}"
|
|
35
35
|
class="${el} ${_("hiddenPresetOptions contains option.name","gp-hidden")}"
|
|
36
|
-
style="${
|
|
36
|
+
style="${A(D(L))}${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 -%}")}
|
|
@@ -45,7 +45,7 @@ import{template as e,isLocalEnv as t,baseAssetURL as i,DEVICES as o,getResponsiv
|
|
|
45
45
|
<div
|
|
46
46
|
variant-option-name="{{option.name | escape}}"
|
|
47
47
|
class="${en}"
|
|
48
|
-
style="${
|
|
48
|
+
style="${A(er)}"
|
|
49
49
|
>
|
|
50
50
|
${v("{%- assign values = option.values -%}")}
|
|
51
51
|
${v("{%- assign rootForloop = forloop.index0 -%}")}
|
|
@@ -59,16 +59,16 @@ import{template as e,isLocalEnv as t,baseAssetURL as i,DEVICES as o,getResponsiv
|
|
|
59
59
|
{%- endif -%}
|
|
60
60
|
`)}
|
|
61
61
|
${$(!W,v("{%- assign selectedValue = null -%}"),"")}
|
|
62
|
-
${$(M,em(),
|
|
62
|
+
${$(M,em(),ei({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
|
|
63
63
|
</div>
|
|
64
64
|
</div>`)}
|
|
65
65
|
`,em=()=>e`
|
|
66
66
|
${_("shop.metafields.GEMPAGES.swatchesJSONFormat and shop.metafields.GEMPAGES.swatchesJSONFormat != blank",N(ea),V(ea))}
|
|
67
|
-
`,ec=m(w(F)),eu=
|
|
67
|
+
`,ec=m(w(F)),eu=P(E),ev=()=>`
|
|
68
68
|
<div className="${ec}">
|
|
69
69
|
${p(eu)}
|
|
70
70
|
</div>
|
|
71
|
-
`,ef=u(g({uid:Y,hasPreSelected:W,cssClass:q?.cssClass})),e_=c(y(E)),e$=m({"gp-flex gp-flex-col !gp-ml-0":!0}),eg=()=>{let e=t?"{{ 'gp-product-variant-v7-5.js' | asset_url }}":`${
|
|
71
|
+
`,ef=u(g({uid:Y,hasPreSelected:W,cssClass:q?.cssClass})),e_=c(y(E)),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`
|
|
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
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{template as t,RenderIf as e,isLocalEnv as
|
|
1
|
+
import{template as t,RenderIf as e,isLocalEnv as r,baseAssetURL as i}from"@gem-sdk/core";import a from"../../../grid/components/row/Row.liquid.js";import{LiquidIf as o,If as d}from"@gem-sdk/system";import{getSettingPreloadData as n,getStaticLocale as s}from"../../../helpers.js";import{getData as c,DYNAMIC_PRODUCT_STATUS as p,STATIC_PRODUCT_STATUS as l,PRODUCT_ID_LATEST as u}from"./common/helpers.js";let Product=f=>{let{children:m,setting:g,style:y,builderProps:v,rawChildren:_,advanced:$}=f,{isSyncProduct:S,productSetting:I}=g??{},b=I?.hasPreSelected??!1,{rowSetting:j,rowStyles:h,formatVariantId:q,formatProductId:P,productStatus:V,preSelectedOptionIds:k,productHandle:w,advancedStyle:E}=c(f),x=()=>t`
|
|
2
2
|
{%- liquid
|
|
3
3
|
if request.page_type == 'product'
|
|
4
|
-
if '${
|
|
5
|
-
if '${
|
|
4
|
+
if '${V}' == '${l}'
|
|
5
|
+
if '${P}' == '${u}'
|
|
6
6
|
paginate collections.all.products by 100000
|
|
7
7
|
assign product = collections.all.products | sort: 'created_at' | reverse | first
|
|
8
8
|
endpaginate
|
|
9
9
|
else
|
|
10
|
-
assign product = all_products['${
|
|
11
|
-
assign productId = '${
|
|
10
|
+
assign product = all_products['${w}']
|
|
11
|
+
assign productId = '${P}' | times: 1
|
|
12
12
|
if product == empty or product == null
|
|
13
13
|
paginate collections.all.products by 100000
|
|
14
14
|
for item in collections.all.products
|
|
@@ -21,13 +21,13 @@ import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-s
|
|
|
21
21
|
endif
|
|
22
22
|
endif
|
|
23
23
|
else
|
|
24
|
-
if '${
|
|
24
|
+
if '${P}' == '${u}'
|
|
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['${
|
|
30
|
-
assign productId = '${
|
|
29
|
+
assign product = all_products['${w}']
|
|
30
|
+
assign productId = '${P}' | times: 1
|
|
31
31
|
if product == empty or product == null
|
|
32
32
|
paginate collections.all.products by 100000
|
|
33
33
|
for item in collections.all.products
|
|
@@ -40,11 +40,11 @@ import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-s
|
|
|
40
40
|
endif
|
|
41
41
|
endif
|
|
42
42
|
-%}
|
|
43
|
-
`,
|
|
43
|
+
`,A=()=>t`
|
|
44
44
|
{%- liquid
|
|
45
45
|
if request.page_type != 'product'
|
|
46
|
-
assign product = all_products['${
|
|
47
|
-
assign productId = '${
|
|
46
|
+
assign product = all_products['${w}']
|
|
47
|
+
assign productId = '${P}' | times: 1
|
|
48
48
|
if product == empty or product == null
|
|
49
49
|
paginate collections.all.products by 100000
|
|
50
50
|
for item in collections.all.products
|
|
@@ -56,30 +56,30 @@ import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-s
|
|
|
56
56
|
endif
|
|
57
57
|
endif
|
|
58
58
|
-%}
|
|
59
|
-
`,
|
|
59
|
+
`,B=()=>t`
|
|
60
60
|
{%- assign gpBkProduct = product -%}
|
|
61
|
-
${d(
|
|
62
|
-
`,
|
|
63
|
-
{%- assign initVariantId = ${
|
|
61
|
+
${d(V==p,A(),x())}
|
|
62
|
+
`,G=()=>t`
|
|
63
|
+
{%- assign initVariantId = ${q} -%}
|
|
64
64
|
{%- assign product_form_id = 'product-form-' | append: "${v?.uid}" -%}
|
|
65
|
-
${
|
|
66
|
-
${
|
|
65
|
+
${q?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
|
|
66
|
+
${q?"{%- assign productSelectedVariant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}"}
|
|
67
67
|
{%-if productSelectedVariant == empty or productSelectedVariant == null -%}
|
|
68
68
|
{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}
|
|
69
69
|
{%- endif -%}
|
|
70
70
|
{%-if variant == empty or variant == null -%}
|
|
71
71
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
72
72
|
{%- endif -%}
|
|
73
|
-
`,
|
|
73
|
+
`,H=()=>t`
|
|
74
74
|
<div class="gp-text-center">${s("Product","product_not_found")}</div>
|
|
75
|
-
`,
|
|
76
|
-
${
|
|
75
|
+
`,O=()=>t`
|
|
76
|
+
${G()}
|
|
77
77
|
<gp-product
|
|
78
78
|
data-uid="${v?.uid}"
|
|
79
79
|
data-id="${v?.uid}"
|
|
80
|
-
style="${
|
|
80
|
+
style="${E}"
|
|
81
81
|
class="${$?.cssClass}"
|
|
82
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${
|
|
82
|
+
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${k}], "isSyncProduct": "${S}", "hasPreSelected": ${b}, "variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
83
83
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }}}'
|
|
84
84
|
>
|
|
85
85
|
<product-form class="product-form">
|
|
@@ -87,13 +87,13 @@ import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-s
|
|
|
87
87
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
88
88
|
<input type="hidden" name="quantity" value="{{ quantity }}" />
|
|
89
89
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
90
|
-
${
|
|
90
|
+
${a({builderProps:{...v,uid:v?.uid,uidInteraction:`${v?.uid}-row`},style:y,styles:h,setting:j,children:m,rawChildren:_})}
|
|
91
91
|
{%- endform -%}
|
|
92
92
|
</product-form>
|
|
93
93
|
</gp-product>
|
|
94
94
|
{%- assign product = gpBkProduct -%}
|
|
95
95
|
`;return t`
|
|
96
|
-
${
|
|
97
|
-
${
|
|
98
|
-
${e(
|
|
96
|
+
${B()}
|
|
97
|
+
${o("product != empty and product != null",O(),H())}
|
|
98
|
+
${e(r,`<script ${n('class="gps-link" delay',"src")}="{{ 'gp-product-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${n('class="gps-link" delay',"src")}="${i}/assets-v2/gp-product-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
99
99
|
`};export{Product as default};
|