@gem-sdk/components 23.0.0-staging.6 → 23.0.0-staging.8
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/post-purchase/product/components/ProductPrice.js +1 -1
- package/dist/cjs/post-purchase/product/components/ProductQuantity.js +1 -1
- package/dist/cjs/post-purchase/product/hooks/useHandleQuantity.js +1 -1
- package/dist/cjs/post-purchase/product/settings/product-quantity/configs/settings.js +1 -1
- package/dist/cjs/post-purchase/product/settings/product-quantity/configs/ui-v2.js +1 -1
- package/dist/cjs/product/components/product-list/ProductListCarouselItem.liquid.js +4 -4
- package/dist/cjs/product/components/product-list/ProductListGridItem.liquid.js +4 -4
- package/dist/cjs/product/components/product-list-v3/ProductListCarouselItem.liquid.js +2 -3
- package/dist/cjs/product/components/product-list-v3/ProductListGridItem.liquid.js +4 -4
- package/dist/cjs/product/components/product-wrap/Product.liquid.js +13 -13
- package/dist/esm/post-purchase/product/components/ProductPrice.js +1 -1
- package/dist/esm/post-purchase/product/components/ProductQuantity.js +1 -1
- package/dist/esm/post-purchase/product/hooks/useHandleQuantity.js +1 -1
- package/dist/esm/post-purchase/product/settings/product-quantity/configs/settings.js +1 -1
- package/dist/esm/post-purchase/product/settings/product-quantity/configs/ui-v2.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 +1 -1
- package/dist/esm/product/components/product-list-v3/ProductListCarouselItem.liquid.js +6 -7
- package/dist/esm/product/components/product-list-v3/ProductListGridItem.liquid.js +1 -1
- package/dist/esm/product/components/product-wrap/Product.liquid.js +7 -7
- package/dist/types/index.d.ts +3 -2
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@gem-sdk/core"),i=require("../helpers/product-price-breakdown/getPrice.js"),s=require("../hooks/useSubscriptionSellingType.js"),o=require("../../../common/components/TooltipHover.js"),t=require("../hooks/useDynamicProduct.js"),l=require("../../text/components/Text.js"),n=require("react");exports.default=({styles:u,style:
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@gem-sdk/core"),i=require("../helpers/product-price-breakdown/getPrice.js"),s=require("../hooks/useSubscriptionSellingType.js"),o=require("../../../common/components/TooltipHover.js"),t=require("../hooks/useDynamicProduct.js"),l=require("../../text/components/Text.js"),n=require("react");exports.default=({styles:u,style:a,builderAttrs:p,builderProps:c,children:d,setting:g})=>{let f=r.useCurrentVariant(),m=r.useProduct(),{isOneTime:h}=s.useSubscriptionSellingType(),y=r.useProductStore(e=>e.selectedSellingPlan),P=r.convertDecimalToNumber(f?.price)??0,x=r.convertDecimalToNumber(f?.salePrice)??0,b=r.useProductOfferDiscount(),j=parseFloat(r.shopifyPriceRounding(b,2)),{isDynamicProduct:N}=t.useDynamicProduct(),{t:S}=r.useI18nStore(),{isEditMode:M}=r.useRenderMode(),{quantity:D,hasUpdatePrice:F}=r.useQuantity(),{priceType:R,source:q}=g??{},v=n.useMemo(()=>F&&D||1,[D,F]),T="compare"===R,k="offer"===R,O="price"===q,w="compare-price"===q,G=f?.sellingPlanGroups,I=m?.sellingPlanGroups,J=n.useMemo(()=>{if(!y||h)return null;let e=f?.sellingPlanGroups??m?.sellingPlanGroups??[];for(let r of e)if(r?.sellingPlans){for(let e of r.sellingPlans)if(e?.baseID===y)return e}return null},[JSON.stringify(G),JSON.stringify(I),y,h]),$=JSON.stringify(J?.pricingPolicies),_=J?.baseID,C=n.useMemo(()=>!J||P<=0||h?0:i.calculateSellingPlanDiscount({variantPrice:P,pricingPolicies:J.pricingPolicies}),[$,P,h]),H=n.useMemo(()=>{let e=k&&!h&&y&&_;if(e){let e=parseFloat(r.shopifyPriceRounding(P-C,2)),i=parseFloat(r.shopifyPriceRounding(e-j,2));return i>0?i:0}let i=parseFloat(r.shopifyPriceRounding(P-j,2));return i>0?i:0},[k,h,y,_,P,C,j]),Q=n.useMemo(()=>T?O?P:x:k?H:P,[T,O,k,P,x,H]),V=n.useMemo(()=>{if(!k)return Q*v;let e=y&&!h&&_?parseFloat(r.shopifyPriceRounding(P-C,2)):P,i=parseFloat(r.shopifyPriceRounding(e*v,2)),s=parseFloat(r.shopifyPriceRounding(b*v,2));return Math.max(0,parseFloat(r.shopifyPriceRounding(i-s,2)))},[k,Q,v,P,b,C,y,_,h]),z=r.useFormatMoney(parseFloat(r.shopifyPriceRounding(Number(V)||0,2)),!1),A=m?.baseID?.replace("gid://shopify/Product/",""),B=n.useMemo(()=>T&&(!j&&x<P||w&&!x||O&&P<=0),[T,j,P,x,w,O]);return(!Q&&!k||B)&&M?e.jsx(o.default,{enable:!0,text:S("Not be displayed when published"),width:"205px",position:"bottom",className:"gp-arrow-left-offset-10",children:e.jsx("div",{className:"gp-h-[28px] gp-px-1.5 gp-py-1 gp-flex gp-border gp-border-light-200 gp-items-center gp-justify-center gp-rounded-lg",style:{borderStyle:"dashed",strokeDasharray:"2,2"},children:e.jsx("span",{className:"gp-text-dark-400 gp-text-[12px] gp-leading-5",children:S("No compare price")})})}):B&&!M?null:e.jsxs("div",{...p,className:r.cls(c?.uid),style:{...a},id:`shopify-text-element-${c?.uid}`,"data-product-id":A,children:[e.jsx(l.default,{styles:u,setting:{text:N?"$???":z},className:r.cls({"gp-money":k,"gp-product-compare-price":T,"gp-line-through":T&&u?.lineThrough})}),d]})};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),t=require("../helpers/product-quantity/getClasses.js"),a=require("../helpers/product-quantity/getStyles.js"),r=require("../hooks/useHandleQuantity.js"),l=require("@gem-sdk/system");exports.default=({setting:
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),t=require("../helpers/product-quantity/getClasses.js"),a=require("../helpers/product-quantity/getStyles.js"),r=require("../hooks/useHandleQuantity.js"),l=require("@gem-sdk/system"),u=require("react");exports.default=({setting:i={},styles:n={}})=>{let{inputWidth:c,align:p}=n,{updatePrice:d=!1}=i,{quantity:o,setQuantity:C,setUpdatePrice:m}=s.useQuantity(),{value:y,onBlurInput:g,onChangeInput:j}=r.useHandleQuantity(o,C,i),h=s.useCurrentVariantInStock(),q=l.createClass(t.getWrapperClasses(p)),x=l.createClass(t.getContainerClasses()),f=l.createClass(t.getWrapperInputClasses()),v=l.createClass(t.getLabelClasses()),b=l.createClass(t.getInputClasses()),N=l.createStyle({...a.getWrapperStyles(c)});return u.useEffect(()=>(m(d),()=>m(!1)),[d,m]),e.jsx("div",{className:q,children:e.jsx("div",{className:x,style:{...N},children:e.jsxs("div",{className:f,children:[e.jsx("label",{htmlFor:"input",className:v,children:i.title||"Quantity"}),e.jsx("input",{disabled:!h,autoComplete:"off",name:"Select Option",className:b,type:"number",value:y,min:1,step:1,onBlur:g,onChange:j})]})})})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var t=require("@gem-sdk/core"),e=require("react");exports.useHandleQuantity=(u,r,n)=>{let a=t.useIsSyncProduct(),l=t.useProduct(),i=n?.defaultQtyValue??1,[s,d]=e.useState(""),c=e.useCallback(t=>{let e=t.detail,n=l?.id;a&&e&&n==e.productId&&u!=e.quantity&&r(e.quantity)},[a,l?.id,u,r]);e.useEffect(()=>(window.addEventListener("set-product-quantity",c),()=>{window.removeEventListener("set-product-quantity",c)}),[c]);let o=t=>{let e=Number(t);return""!==t&&Number.isFinite(e)?Math.trunc(e):null};return e.useEffect(()=>{r(parseFloat(`${i}`)),d(`${i}`)},[r,i]),e.useEffect(()=>{d(`${u}`)},[u]),{value:s,onBlurInput:t=>{let e=o(t.target.value),u=null===e||e<1?1:e;r(u),d(`${u}`)},onChangeInput:t=>{let e=o(t.target.value);null!==e&&(d(e.toString()),e>=1&&r(e))}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.ProductQuantitySettings=[{id:"setting",controls:[{id:"title",label:"Label title",type:"input",placeholder:"Add...",default:"Quantity",fallbackValue:"Quantity",clearButton:!1},{id:"defaultQtyValue",label:"Text",type:"input:stepper",min:1,default:1,disableDecimal:!0}]},{id:"style",controls:[{id:"dimensions",type:"group",label:"Dimensions",controls:[{id:"fullWidth",label:"Full Width",type:"toggle",devices:{desktop:{default:!1}}},{id:"inputWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,devices:{desktop:{default:"100%"}},displayOptions:[{label:"Full",value:"100%",showValue:!0}]}]},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"start",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"end",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],default:"start"}]}];
|
|
1
|
+
"use strict";exports.ProductQuantitySettings=[{id:"setting",controls:[{id:"title",label:"Label title",type:"input",placeholder:"Add...",default:"Quantity",fallbackValue:"Quantity",clearButton:!1},{id:"defaultQtyValue",label:"Text",type:"input:stepper",min:1,default:1,disableDecimal:!0},{id:"updatePrice",label:"Update price",type:"toggle",default:!0}]},{id:"style",controls:[{id:"dimensions",type:"group",label:"Dimensions",controls:[{id:"fullWidth",label:"Full Width",type:"toggle",devices:{desktop:{default:!1}}},{id:"inputWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,devices:{desktop:{default:"100%"}},displayOptions:[{label:"Full",value:"100%",showValue:!0}]}]},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"start",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"end",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],default:"start"}]}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.SettingUIV2=[{label:"Size",controls:[{type:"control",label:"Width",setting:{id:"inputWidth"},layout:"horizontal"}]},{label:"Display options",controls:[{label:"Default quantity",setting:{id:"defaultQtyValue"},layout:"horizontal"},{type:"combo",label:"Label title",iconName:"polaris-text-block",getValueFromSettingID:"title",disableClearMessage:"This label title is needed for customers <br> to adjust the product's quantity",controls:[{label:"Content",setting:{id:"title"},layout:"vertical",options:{clearButton:!1}}]}]},{controls:[{type:"control",label:"Align",setting:{id:"align"},conditionEnable:'!(parseInt(inputWidth) >= 100 && inputWidth?.includes("%"))',options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Horizontal alignment is disabled when the width is set to 100% or greater"},layout:"horizontal"}]}];
|
|
1
|
+
"use strict";exports.SettingUIV2=[{label:"Size",controls:[{type:"control",label:"Width",setting:{id:"inputWidth"},layout:"horizontal"}]},{label:"Display options",controls:[{label:"Default quantity",setting:{id:"defaultQtyValue"},layout:"horizontal"},{label:"Update price",setting:{id:"updatePrice"}},{type:"combo",label:"Label title",iconName:"polaris-text-block",getValueFromSettingID:"title",disableClearMessage:"This label title is needed for customers <br> to adjust the product's quantity",controls:[{label:"Content",setting:{id:"title"},layout:"vertical",options:{clearButton:!1}}]}]},{controls:[{type:"control",label:"Align",setting:{id:"align"},conditionEnable:'!(parseInt(inputWidth) >= 100 && inputWidth?.includes("%"))',options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Horizontal alignment is disabled when the width is set to 100% or greater"},layout:"horizontal"}]}];
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./common/classes.js"),e=require("@gem-sdk/core");exports.default=n=>{let{pageContext:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./common/classes.js"),e=require("@gem-sdk/core");exports.default=n=>{let{pageContext:a,children:o}=n,{productItemClass:r,gpProductClass:i}=t.getClass(n);return e.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 | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "hasOnlyDefaultVariant": {{ product.has_only_default_variant }}, "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
|
-
<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(
|
|
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(a)}}</script>
|
|
7
7
|
{%- form 'product', product, id: product_form_id, class: 'form contents ${r}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
8
8
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
9
9
|
<input type="hidden" min="1" name="quantity" value="{{ quantity }}" />
|
|
10
10
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
11
|
-
${
|
|
11
|
+
${o}
|
|
12
12
|
{%- endform -%}
|
|
13
13
|
</gp-product>
|
|
14
14
|
`};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@gem-sdk/core"),e=require("./common/classes.js");exports.default=n=>{let{pageContext:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@gem-sdk/core"),e=require("./common/classes.js");exports.default=n=>{let{pageContext:a,rawChildren:o}=n,{productItemClass:r,gpProductClass:i}=e.getClass(n);return t.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 | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "hasOnlyDefaultVariant": {{ product.has_only_default_variant }}, "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
|
-
<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(
|
|
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(a)}}</script>
|
|
7
7
|
{%- form 'product', product, id: product_form_id, class: 'form contents ${r}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
8
8
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
9
9
|
<input type="hidden" min="1" name="quantity" value="{{ quantity }}" />
|
|
10
10
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
11
11
|
${t.template`
|
|
12
|
-
${
|
|
12
|
+
${o?.map((e,n)=>{if(e)return t.template`
|
|
13
13
|
${t.RenderChildren({...e,index:n})}
|
|
14
14
|
`}).join("")}
|
|
15
15
|
`}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./common/classes.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./common/classes.js"),e=require("@gem-sdk/core");exports.default=n=>{let{pageContext:a,children:o}=n,{productItemClass:r,gpProductClass:i}=t.getClass(n);return e.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 | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
4
|
-
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 }}, "hasOnlyDefaultVariant": {{ product.has_only_default_variant }}, "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 }}"}'
|
|
5
4
|
class="${i}"
|
|
6
5
|
>
|
|
7
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(a)}}</script>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@gem-sdk/core"),e=require("./common/classes.js");exports.default=n=>{let{pageContext:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@gem-sdk/core"),e=require("./common/classes.js");exports.default=n=>{let{pageContext:a,rawChildren:o}=n,{productItemClass:r,gpProductClass:i}=e.getClass(n);return t.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 | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "hasOnlyDefaultVariant": {{ product.has_only_default_variant }}, "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
|
-
<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(
|
|
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(a)}}</script>
|
|
7
7
|
{%- form 'product', product, id: product_form_id, class: 'form contents ${r}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
8
8
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
9
9
|
<input type="hidden" min="1" name="quantity" value="{{ quantity }}" />
|
|
10
10
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
11
11
|
${t.template`
|
|
12
|
-
${
|
|
12
|
+
${o?.map((e,n)=>{if(e)return t.template`
|
|
13
13
|
${t.RenderChildren({...e,index:n})}
|
|
14
14
|
`}).join("")}
|
|
15
15
|
`}
|
|
@@ -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"),
|
|
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=d=>{let{children:n,setting:o,style:s,builderProps:c,rawChildren:l,advanced:p}=d,{isSyncProduct:u,productSetting:f}=o??{},g=f?.hasPreSelected??!1,{rowSetting:m,rowStyles:_,formatVariantId:y,formatProductId:v,productStatus:$,preSelectedOptionIds:S,productHandle:I,advancedStyle:P}=t.getData(d);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 = '${v}' | 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 '${v}' == '${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 = '${v}' | 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 '${v}' == '${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 = '${v}' | 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
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
-%}
|
|
62
62
|
`)}
|
|
63
63
|
`}
|
|
64
|
-
${
|
|
64
|
+
${r.LiquidIf("product != empty and product != null",e.template`
|
|
65
65
|
${e.template`
|
|
66
|
-
{%- assign initVariantId = ${
|
|
66
|
+
{%- assign initVariantId = ${y} -%}
|
|
67
67
|
{%- assign product_form_id = 'product-form-' | append: "${c?.uid}" -%}
|
|
68
|
-
${
|
|
69
|
-
${
|
|
68
|
+
${y?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
|
|
69
|
+
${y?"{%- 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 -%}
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
data-id="${c?.uid}"
|
|
83
83
|
style="${P}"
|
|
84
84
|
class="${p?.cssClass}"
|
|
85
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${S}], "isSyncProduct": "${u}", "hasPreSelected": ${g}, "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 }}" }'
|
|
85
|
+
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
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
88
|
<product-form class="product-form">
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
91
91
|
<input type="hidden" name="quantity" value="{{ quantity }}" />
|
|
92
92
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
93
|
-
${
|
|
93
|
+
${a.default({builderProps:{...c,uid:c?.uid,uidInteraction:`${c?.uid}-row`},style:s,styles:_,setting:m,children:n,rawChildren:l})}
|
|
94
94
|
{%- endform -%}
|
|
95
95
|
</product-form>
|
|
96
96
|
</gp-product>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useCurrentVariant as t,useProduct as
|
|
2
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useCurrentVariant as t,useProduct as o,useProductStore as i,convertDecimalToNumber as l,useProductOfferDiscount as s,shopifyPriceRounding as p,useI18nStore as a,useRenderMode as n,useQuantity as c,useFormatMoney as g,cls as m}from"@gem-sdk/core";import{calculateSellingPlanDiscount as d}from"../helpers/product-price-breakdown/getPrice.js";import{useSubscriptionSellingType as u}from"../hooks/useSubscriptionSellingType.js";import f from"../../../common/components/TooltipHover.js";import{useDynamicProduct as h}from"../hooks/useDynamicProduct.js";import P from"../../text/components/Text.js";import{useMemo as y}from"react";let x=({styles:x,style:b,builderAttrs:N,builderProps:F,children:j,setting:S})=>{let k=t(),D=o(),{isOneTime:v}=u(),w=i(e=>e.selectedSellingPlan),G=l(k?.price)??0,T=l(k?.salePrice)??0,I=s(),J=parseFloat(p(I,2)),{isDynamicProduct:O}=h(),{t:$}=a(),{isEditMode:H}=n(),{quantity:M,hasUpdatePrice:q}=c(),{priceType:z,source:A}=S??{},B=y(()=>q&&M||1,[M,q]),C="compare"===z,E="offer"===z,K="price"===A,L="compare-price"===A,Q=k?.sellingPlanGroups,R=D?.sellingPlanGroups,U=y(()=>{if(!w||v)return null;let e=k?.sellingPlanGroups??D?.sellingPlanGroups??[];for(let r of e)if(r?.sellingPlans){for(let e of r.sellingPlans)if(e?.baseID===w)return e}return null},[JSON.stringify(Q),JSON.stringify(R),w,v]),V=JSON.stringify(U?.pricingPolicies),W=U?.baseID,X=y(()=>!U||G<=0||v?0:d({variantPrice:G,pricingPolicies:U.pricingPolicies}),[V,G,v]),Y=y(()=>{let e=E&&!v&&w&&W;if(e){let e=parseFloat(p(G-X,2)),r=parseFloat(p(e-J,2));return r>0?r:0}let r=parseFloat(p(G-J,2));return r>0?r:0},[E,v,w,W,G,X,J]),Z=y(()=>C?K?G:T:E?Y:G,[C,K,E,G,T,Y]),_=y(()=>{if(!E)return Z*B;let e=w&&!v&&W?parseFloat(p(G-X,2)):G,r=parseFloat(p(e*B,2)),t=parseFloat(p(I*B,2));return Math.max(0,parseFloat(p(r-t,2)))},[E,Z,B,G,I,X,w,W,v]),ee=g(parseFloat(p(Number(_)||0,2)),!1),er=D?.baseID?.replace("gid://shopify/Product/",""),et=y(()=>C&&(!J&&T<G||L&&!T||K&&G<=0),[C,J,G,T,L,K]);return(!Z&&!E||et)&&H?e(f,{enable:!0,text:$("Not be displayed when published"),width:"205px",position:"bottom",className:"gp-arrow-left-offset-10",children:e("div",{className:"gp-h-[28px] gp-px-1.5 gp-py-1 gp-flex gp-border gp-border-light-200 gp-items-center gp-justify-center gp-rounded-lg",style:{borderStyle:"dashed",strokeDasharray:"2,2"},children:e("span",{className:"gp-text-dark-400 gp-text-[12px] gp-leading-5",children:$("No compare price")})})}):et&&!H?null:r("div",{...N,className:m(F?.uid),style:{...b},id:`shopify-text-element-${F?.uid}`,"data-product-id":er,children:[e(P,{styles:x,setting:{text:O?"$???":ee},className:m({"gp-money":E,"gp-product-compare-price":C,"gp-line-through":C&&x?.lineThrough})}),j]})};export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useQuantity as r,useCurrentVariantInStock as s}from"@gem-sdk/core";import{getWrapperClasses as
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useQuantity as r,useCurrentVariantInStock as s}from"@gem-sdk/core";import{getWrapperClasses as o,getContainerClasses as a,getWrapperInputClasses as m,getLabelClasses as l,getInputClasses as i}from"../helpers/product-quantity/getClasses.js";import{getWrapperStyles as n}from"../helpers/product-quantity/getStyles.js";import{useHandleQuantity as u}from"../hooks/useHandleQuantity.js";import{createClass as p,createStyle as c}from"@gem-sdk/system";import{useEffect as d}from"react";let f=({setting:f={},styles:h={}})=>{let{inputWidth:y,align:g}=h,{updatePrice:N=!1}=f,{quantity:j,setQuantity:v,setUpdatePrice:b}=r(),{value:k,onBlurInput:C,onChangeInput:P}=u(j,v,f),Q=s(),q=p(o(g)),x=p(a()),S=p(m()),B=p(l()),F=p(i()),H=c({...n(y)});return d(()=>(b(N),()=>b(!1)),[N,b]),e("div",{className:q,children:e("div",{className:x,style:{...H},children:t("div",{className:S,children:[e("label",{htmlFor:"input",className:B,children:f.title||"Quantity"}),e("input",{disabled:!Q,autoComplete:"off",name:"Select Option",className:F,type:"number",value:k,min:1,step:1,onBlur:C,onChange:P})]})})})};export{f as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useIsSyncProduct as t,useProduct as e}from"@gem-sdk/core";import{useState as
|
|
1
|
+
import{useIsSyncProduct as t,useProduct as e}from"@gem-sdk/core";import{useState as n,useCallback as r,useEffect as u}from"react";let l=(l,a,i)=>{let o=t(),d=e(),p=i?.defaultQtyValue??1,[m,s]=n(""),c=r(t=>{let e=t.detail,n=d?.id;o&&e&&n==e.productId&&l!=e.quantity&&a(e.quantity)},[o,d?.id,l,a]);u(()=>(window.addEventListener("set-product-quantity",c),()=>{window.removeEventListener("set-product-quantity",c)}),[c]);let y=t=>{let e=Number(t);return""!==t&&Number.isFinite(e)?Math.trunc(e):null};return u(()=>{a(parseFloat(`${p}`)),s(`${p}`)},[a,p]),u(()=>{s(`${l}`)},[l]),{value:m,onBlurInput:t=>{let e=y(t.target.value),n=null===e||e<1?1:e;a(n),s(`${n}`)},onChangeInput:t=>{let e=y(t.target.value);null!==e&&(s(e.toString()),e>=1&&a(e))}}};export{l as useHandleQuantity};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let
|
|
1
|
+
let e=[{id:"setting",controls:[{id:"title",label:"Label title",type:"input",placeholder:"Add...",default:"Quantity",fallbackValue:"Quantity",clearButton:!1},{id:"defaultQtyValue",label:"Text",type:"input:stepper",min:1,default:1,disableDecimal:!0},{id:"updatePrice",label:"Update price",type:"toggle",default:!0}]},{id:"style",controls:[{id:"dimensions",type:"group",label:"Dimensions",controls:[{id:"fullWidth",label:"Full Width",type:"toggle",devices:{desktop:{default:!1}}},{id:"inputWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,devices:{desktop:{default:"100%"}},displayOptions:[{label:"Full",value:"100%",showValue:!0}]}]},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"start",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"end",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],default:"start"}]}];export{e as ProductQuantitySettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let t=[{label:"Size",controls:[{type:"control",label:"Width",setting:{id:"inputWidth"},layout:"horizontal"}]},{label:"Display options",controls:[{label:"Default quantity",setting:{id:"defaultQtyValue"},layout:"horizontal"},{type:"combo",label:"Label title",iconName:"polaris-text-block",getValueFromSettingID:"title",disableClearMessage:"This label title is needed for customers <br> to adjust the product's quantity",controls:[{label:"Content",setting:{id:"title"},layout:"vertical",options:{clearButton:!1}}]}]},{controls:[{type:"control",label:"Align",setting:{id:"align"},conditionEnable:'!(parseInt(inputWidth) >= 100 && inputWidth?.includes("%"))',options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Horizontal alignment is disabled when the width is set to 100% or greater"},layout:"horizontal"}]}];export{t as SettingUIV2};
|
|
1
|
+
let t=[{label:"Size",controls:[{type:"control",label:"Width",setting:{id:"inputWidth"},layout:"horizontal"}]},{label:"Display options",controls:[{label:"Default quantity",setting:{id:"defaultQtyValue"},layout:"horizontal"},{label:"Update price",setting:{id:"updatePrice"}},{type:"combo",label:"Label title",iconName:"polaris-text-block",getValueFromSettingID:"title",disableClearMessage:"This label title is needed for customers <br> to adjust the product's quantity",controls:[{label:"Content",setting:{id:"title"},layout:"vertical",options:{clearButton:!1}}]}]},{controls:[{type:"control",label:"Align",setting:{id:"align"},conditionEnable:'!(parseInt(inputWidth) >= 100 && inputWidth?.includes("%"))',options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Horizontal alignment is disabled when the width is set to 100% or greater"},layout:"horizontal"}]}];export{t as SettingUIV2};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{getClass as t}from"./common/classes.js";import{template as n}from"@gem-sdk/core";let o=o=>{let{pageContext:e,children:a}=o,{productItemClass:r,gpProductClass:i}=t(o);return n`
|
|
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 | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "hasOnlyDefaultVariant": {{ product.has_only_default_variant }}, "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,6 +1,6 @@
|
|
|
1
1
|
import{template as t,RenderChildren as n}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";let o=o=>{let{pageContext:a,rawChildren:r}=o,{productItemClass:i,gpProductClass:c}=e(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 | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "hasOnlyDefaultVariant": {{ product.has_only_default_variant }}, "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="${c}"
|
|
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(a)}}</script>
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import{getClass as t}from"./common/classes.js";import{template as n}from"@gem-sdk/core";let
|
|
1
|
+
import{getClass as t}from"./common/classes.js";import{template as n}from"@gem-sdk/core";let o=o=>{let{pageContext:e,children:a}=o,{productItemClass:r,gpProductClass:i}=t(o);return n`
|
|
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 | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
4
|
-
|
|
5
|
-
class="${r}"
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "hasOnlyDefaultVariant": {{ product.has_only_default_variant }}, "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
|
+
class="${i}"
|
|
6
5
|
>
|
|
7
|
-
<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(
|
|
8
|
-
{%- form 'product', product, id: product_form_id, class: 'form contents ${
|
|
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>
|
|
7
|
+
{%- form 'product', product, id: product_form_id, class: 'form contents ${r}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
9
8
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
10
9
|
<input type="hidden" min="1" name="quantity" value="{{ quantity }}" />
|
|
11
10
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
12
11
|
${a}
|
|
13
12
|
{%- endform -%}
|
|
14
13
|
</gp-product>
|
|
15
|
-
`};export{
|
|
14
|
+
`};export{o as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{template as t,RenderChildren as n}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";let o=o=>{let{pageContext:a,rawChildren:r}=o,{productItemClass:i,gpProductClass:c}=e(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 | default: 0 }}, "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "hasOnlyDefaultVariant": {{ product.has_only_default_variant }}, "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="${c}"
|
|
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(a)}}</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{getData as t,DYNAMIC_PRODUCT_STATUS as e,STATIC_PRODUCT_STATUS as i,PRODUCT_ID_LATEST as r}from"./common/helpers.js";import{RenderIf as
|
|
1
|
+
import{getData as t,DYNAMIC_PRODUCT_STATUS as e,STATIC_PRODUCT_STATUS as i,PRODUCT_ID_LATEST as r}from"./common/helpers.js";import{RenderIf as a,isLocalEnv as o,baseAssetURL as d,template as n}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:m,setting:g,style:y,builderProps:_,rawChildren:v,advanced:$}=f,{isSyncProduct:S,productSetting:h}=g??{},j=h?.hasPreSelected??!1,{rowSetting:I,rowStyles:b,formatVariantId:P,formatProductId:q,productStatus:V,preSelectedOptionIds:k,productHandle:w,advancedStyle:E}=t(f);return n`
|
|
2
2
|
${n`
|
|
3
3
|
{%- assign gpBkProduct = product -%}
|
|
4
4
|
${u(V==e,n`
|
|
@@ -64,7 +64,7 @@ import{getData as t,DYNAMIC_PRODUCT_STATUS as e,STATIC_PRODUCT_STATUS as i,PRODU
|
|
|
64
64
|
${p("product != empty and product != null",n`
|
|
65
65
|
${n`
|
|
66
66
|
{%- assign initVariantId = ${P} -%}
|
|
67
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
67
|
+
{%- assign product_form_id = 'product-form-' | append: "${_?.uid}" -%}
|
|
68
68
|
${P?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
|
|
69
69
|
${P?"{%- assign productSelectedVariant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}"}
|
|
70
70
|
{%-if productSelectedVariant == empty or productSelectedVariant == null -%}
|
|
@@ -78,11 +78,11 @@ import{getData as t,DYNAMIC_PRODUCT_STATUS as e,STATIC_PRODUCT_STATUS as i,PRODU
|
|
|
78
78
|
{% endunless %}
|
|
79
79
|
`}
|
|
80
80
|
<gp-product
|
|
81
|
-
data-uid="${
|
|
82
|
-
data-id="${
|
|
81
|
+
data-uid="${_?.uid}"
|
|
82
|
+
data-id="${_?.uid}"
|
|
83
83
|
style="${E}"
|
|
84
84
|
class="${$?.cssClass}"
|
|
85
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${k}], "isSyncProduct": "${S}", "hasPreSelected": ${j}, "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 }}" }'
|
|
85
|
+
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${k}], "isSyncProduct": "${S}", "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
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
88
|
<product-form class="product-form">
|
|
@@ -90,7 +90,7 @@ import{getData as t,DYNAMIC_PRODUCT_STATUS as e,STATIC_PRODUCT_STATUS as i,PRODU
|
|
|
90
90
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
91
91
|
<input type="hidden" name="quantity" value="{{ quantity }}" />
|
|
92
92
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
93
|
-
${l({builderProps:{...
|
|
93
|
+
${l({builderProps:{..._,uid:_?.uid,uidInteraction:`${_?.uid}-row`},style:y,styles:b,setting:I,children:m,rawChildren:v})}
|
|
94
94
|
{%- endform -%}
|
|
95
95
|
</product-form>
|
|
96
96
|
</gp-product>
|
|
@@ -98,5 +98,5 @@ import{getData as t,DYNAMIC_PRODUCT_STATUS as e,STATIC_PRODUCT_STATUS as i,PRODU
|
|
|
98
98
|
`,n`
|
|
99
99
|
<div class="gp-text-center">${c("Product","product_not_found")}</div>
|
|
100
100
|
`)}
|
|
101
|
-
${o
|
|
101
|
+
${a(o,`<script ${s('class="gps-link" delay',"src")}="{{ 'gp-product-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${s('class="gps-link" delay',"src")}="${d}/assets-v2/gp-product-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
102
102
|
`};export{f as default};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3332,6 +3332,7 @@ declare const PostPurchaseProductPriceBreakdown: React.FC<PostPurchaseProductPri
|
|
|
3332
3332
|
type PostPurchaseProductQuantitySettingProps = {
|
|
3333
3333
|
title?: string;
|
|
3334
3334
|
defaultQtyValue?: number;
|
|
3335
|
+
updatePrice?: boolean;
|
|
3335
3336
|
};
|
|
3336
3337
|
type PostPurchaseProductQuantityStyleProps = {
|
|
3337
3338
|
fullWidth?: ObjectDevices<boolean>;
|
|
@@ -3508,13 +3509,13 @@ type PostPurchaseProductPriceProps = BasePropsWrap<PostPurchaseProductPriceSetti
|
|
|
3508
3509
|
children?: ReactNode;
|
|
3509
3510
|
};
|
|
3510
3511
|
|
|
3511
|
-
declare const PostPurchaseProductQuantity: React.FC<PostPurchaseProductQuantityProps>;
|
|
3512
|
+
declare const PostPurchaseProductQuantity: React$1.FC<PostPurchaseProductQuantityProps>;
|
|
3512
3513
|
|
|
3513
3514
|
declare const PostPurchaseProductImages: (props: PostPurchaseProductImagesProps) => React.JSX.Element;
|
|
3514
3515
|
|
|
3515
3516
|
declare const PostPurchaseProductTitle: React.FC<PostPurchaseProductTitleProps>;
|
|
3516
3517
|
|
|
3517
|
-
declare const PostPurchaseProductPrice: React.FC<PostPurchaseProductPriceProps>;
|
|
3518
|
+
declare const PostPurchaseProductPrice: React$1.FC<PostPurchaseProductPriceProps>;
|
|
3518
3519
|
|
|
3519
3520
|
declare const PostPurchaseAcceptButton: (props: PostPurchaseButtonProps) => React.JSX.Element;
|
|
3520
3521
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "23.0.0-staging.
|
|
3
|
+
"version": "23.0.0-staging.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"relationship": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/element-relationship/index.js",
|
|
22
22
|
"test": "jest -c ./../../helpers/jest.config.ts",
|
|
23
23
|
"test:watch": "jest -c ./../../helpers/jest.config.ts --watch",
|
|
24
|
-
"type-check": "
|
|
24
|
+
"type-check": "tsc --noEmit",
|
|
25
25
|
"update-img-src-3rd": "node ./scripts/update-img-src-3rd.js",
|
|
26
26
|
"watch": "rollup -c ./scripts/rollup.config.mjs -w"
|
|
27
27
|
},
|