@gem-sdk/components 2.0.0-staging.1106 → 2.0.0-staging.1107
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.
|
@@ -1,4 +1,4 @@
|
|
|
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:
|
|
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:c,rowStyles:n,formatVariantId:l,formatProductId:p,productStatus:u,preSelectedOptionIds:f,productHandle:g,advancedStyle:m}=helpers.getData(e),_=()=>core.template`
|
|
2
2
|
{%- liquid
|
|
3
3
|
if request.page_type == 'product'
|
|
4
4
|
if '${u}' == '${helpers.STATIC_PRODUCT_STATUS}'
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
endif
|
|
57
57
|
endif
|
|
58
58
|
-%}
|
|
59
|
-
|
|
59
|
+
`,v=()=>core.template`
|
|
60
60
|
{%- assign gpBkProduct = product -%}
|
|
61
61
|
${system.If(u==helpers.DYNAMIC_PRODUCT_STATUS,y(),_())}
|
|
62
|
-
|
|
62
|
+
`,$=()=>core.template`
|
|
63
63
|
{%- assign initVariantId = ${l} -%}
|
|
64
64
|
{%- assign product_form_id = 'product-form-' | append: "${a?.uid}" -%}
|
|
65
65
|
${l?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
`,S=()=>core.template`
|
|
74
74
|
<div class="gp-text-center">${helpers$1.getStaticLocale("Product","product_not_found")}</div>
|
|
75
75
|
`,I=()=>core.template`
|
|
76
|
-
${
|
|
76
|
+
${$()}
|
|
77
77
|
<gp-product
|
|
78
78
|
data-uid="${a?.uid}"
|
|
79
79
|
data-id="${a?.uid}"
|
|
80
80
|
style="${m}"
|
|
81
|
-
class="${
|
|
82
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${f}], "isSyncProduct": "${s}", "variantSelected": {{ variant | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
81
|
+
class="${d?.cssClass}"
|
|
82
|
+
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${f}], "isSyncProduct": "${s}", "variantSelected": {{ variant | json | escape }}, "inventory_policy": {{ variant.inventory_policy }}, "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:n,setting:c,children:t,rawChildren:
|
|
90
|
+
${Row_liquid.default({builderProps:{...a,uid:a?.uid,uidInteraction:`${a?.uid}-row`},style:i,styles:n,setting:c,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
|
-
${
|
|
96
|
+
${v()}
|
|
97
97
|
${system.LiquidIf("product != empty and product != null",I(),S())}
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import{template as t,RenderIf as e,isLocalEnv as
|
|
1
|
+
import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-sdk/core";import d from"../../../grid/components/row/Row.liquid.js";import{LiquidIf as o,If as a}from"@gem-sdk/system";import{getSettingPreloadData as n,getStaticLocale as s}from"../../../helpers.js";import{getData as c,DYNAMIC_PRODUCT_STATUS as p,STATIC_PRODUCT_STATUS as l,PRODUCT_ID_LATEST as u}from"./common/helpers.js";let Product=f=>{let{children:m,setting:g,style:y,builderProps:v,rawChildren:_,advanced:$}=f,{isSyncProduct:I}=g??{},{rowSetting:S,rowStyles:b,formatVariantId:j,formatProductId:h,productStatus:q,preSelectedOptionIds:V,productHandle:P,advancedStyle:k}=c(f),w=()=>t`
|
|
2
2
|
{%- liquid
|
|
3
3
|
if request.page_type == 'product'
|
|
4
4
|
if '${q}' == '${l}'
|
|
@@ -61,7 +61,7 @@ import{template as t,RenderIf as e,isLocalEnv as r,baseAssetURL as i}from"@gem-s
|
|
|
61
61
|
${a(q==p,E(),w())}
|
|
62
62
|
`,A=()=>t`
|
|
63
63
|
{%- assign initVariantId = ${j} -%}
|
|
64
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
64
|
+
{%- assign product_form_id = 'product-form-' | append: "${v?.uid}" -%}
|
|
65
65
|
${j?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
|
|
66
66
|
${j?"{%- assign productSelectedVariant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}"}
|
|
67
67
|
{%-if productSelectedVariant == empty or productSelectedVariant == null -%}
|
|
@@ -71,15 +71,15 @@ import{template as t,RenderIf as e,isLocalEnv as r,baseAssetURL as i}from"@gem-s
|
|
|
71
71
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
72
72
|
{%- endif -%}
|
|
73
73
|
`,B=()=>t`
|
|
74
|
-
<div class="gp-text-center">${
|
|
74
|
+
<div class="gp-text-center">${s("Product","product_not_found")}</div>
|
|
75
75
|
`,G=()=>t`
|
|
76
76
|
${A()}
|
|
77
77
|
<gp-product
|
|
78
|
-
data-uid="${
|
|
79
|
-
data-id="${
|
|
78
|
+
data-uid="${v?.uid}"
|
|
79
|
+
data-id="${v?.uid}"
|
|
80
80
|
style="${k}"
|
|
81
81
|
class="${$?.cssClass}"
|
|
82
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${V}], "isSyncProduct": "${I}", "variantSelected": {{ variant | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
82
|
+
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${V}], "isSyncProduct": "${I}", "variantSelected": {{ variant | json | escape }}, "inventory_policy": {{ variant.inventory_policy }}, "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,7 +87,7 @@ import{template as t,RenderIf as e,isLocalEnv as r,baseAssetURL as i}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
|
-
${d({builderProps:{...
|
|
90
|
+
${d({builderProps:{...v,uid:v?.uid,uidInteraction:`${v?.uid}-row`},style:y,styles:b,setting:S,children:m,rawChildren:_})}
|
|
91
91
|
{%- endform -%}
|
|
92
92
|
</product-form>
|
|
93
93
|
</gp-product>
|
|
@@ -95,5 +95,5 @@ import{template as t,RenderIf as e,isLocalEnv as r,baseAssetURL as i}from"@gem-s
|
|
|
95
95
|
`;return t`
|
|
96
96
|
${x()}
|
|
97
97
|
${o("product != empty and product != null",G(),B())}
|
|
98
|
-
${e(
|
|
98
|
+
${e(i,`<script ${n('class="gps-link" delay',"src")}="{{ 'gp-product-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${n('class="gps-link" delay',"src")}="${r}/assets-v2/gp-product-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
99
99
|
`};export{Product as default};
|