@gem-sdk/components 8.0.0-dev.21 → 8.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/carousel-v3/components/swiper/Swiper.js +1 -1
- package/dist/cjs/countdown-timer/common/helpers.js +1 -1
- package/dist/cjs/countdown-timer/hooks/useTimeLeft.js +1 -1
- package/dist/cjs/post-purchase/product/components/ProductPrice.js +1 -1
- package/dist/cjs/post-purchase/product/constants/ProductOfferPlaceholder.js +1 -1
- package/dist/cjs/post-purchase/product/hooks/useGetMoneyLines.js +1 -1
- package/dist/cjs/product/components/product-badge/ProductBadge.liquid.js +10 -10
- package/dist/cjs/product/components/product-badge/common/styles.js +1 -1
- package/dist/cjs/product/components/product-badge/utils/common.js +1 -1
- package/dist/cjs/product/components/product-badge/utils/renderBadgeLiquid.js +4 -3
- package/dist/cjs/product/components/product-button/hooks/useAddToCart.js +1 -1
- package/dist/cjs/product/components/product-discount-tag/hooks/useGpDiscountTag.js +1 -1
- package/dist/cjs/product/components/product-images-v3/components/feature-gallery/FeatureImageWithGallery.liquid.js +5 -5
- package/dist/cjs/product/components/product-list-v3/ProductList.js +1 -1
- package/dist/cjs/product/components/product-price/hooks/useGpPrice.js +1 -1
- package/dist/cjs/product/components/product-variants/ProductVariants.liquid.js +77 -25
- package/dist/cjs/product/components/product-variants/common/base/styles.js +1 -1
- package/dist/cjs/product/components/product-variants/components/color/color.liquid.js +3 -3
- package/dist/cjs/product/helpers/product-bundle.js +1 -1
- package/dist/cjs/third-party/settings/BonLoyaltyRewardsReferrals/index.js +1 -1
- package/dist/esm/carousel-v3/components/swiper/Swiper.js +1 -1
- package/dist/esm/countdown-timer/common/helpers.js +1 -1
- package/dist/esm/countdown-timer/hooks/useTimeLeft.js +1 -1
- package/dist/esm/post-purchase/product/components/ProductPrice.js +1 -1
- package/dist/esm/post-purchase/product/constants/ProductOfferPlaceholder.js +1 -1
- package/dist/esm/post-purchase/product/hooks/useGetMoneyLines.js +1 -1
- package/dist/esm/product/components/product-badge/ProductBadge.liquid.js +21 -21
- package/dist/esm/product/components/product-badge/common/styles.js +1 -1
- package/dist/esm/product/components/product-badge/utils/common.js +1 -1
- package/dist/esm/product/components/product-badge/utils/renderBadgeLiquid.js +4 -3
- package/dist/esm/product/components/product-button/hooks/useAddToCart.js +1 -1
- package/dist/esm/product/components/product-discount-tag/hooks/useGpDiscountTag.js +1 -1
- package/dist/esm/product/components/product-images-v3/components/feature-gallery/FeatureImageWithGallery.liquid.js +18 -18
- package/dist/esm/product/components/product-list-v3/ProductList.js +1 -1
- package/dist/esm/product/components/product-price/hooks/useGpPrice.js +1 -1
- package/dist/esm/product/components/product-variants/ProductVariants.liquid.js +90 -38
- package/dist/esm/product/components/product-variants/common/base/styles.js +1 -1
- package/dist/esm/product/components/product-variants/components/color/color.liquid.js +3 -3
- package/dist/esm/product/helpers/product-bundle.js +1 -1
- package/dist/esm/third-party/settings/BonLoyaltyRewardsReferrals/index.js +1 -1
- package/package.json +4 -4
- package/dist/cjs/product/components/product-variants/OptionVariantsNewFormat.liquid.js +0 -41
- package/dist/cjs/product/components/product-variants/OptionVariantsOldFormat.liquid.js +0 -66
- package/dist/cjs/product/components/product-variants/common/const.js +0 -1
- package/dist/esm/product/components/product-variants/OptionVariantsNewFormat.liquid.js +0 -41
- package/dist/esm/product/components/product-variants/OptionVariantsOldFormat.liquid.js +0 -66
- package/dist/esm/product/components/product-variants/common/const.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var jsxRuntime=require("react/jsx-runtime"),React=require("react"),styles=require("./common/styles.js");function Swiper(e){let t=React.useRef(null),{children:r,totalSlides:s,onSwiperReset:i,onSwiperReady:n,sliderClass:c,sliderOrder:u,thumbsSwiper:a,...p}=e,[l,
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime"),React=require("react"),styles=require("./common/styles.js");function Swiper(e){let t=React.useRef(null),{children:r,totalSlides:s,onSwiperReset:i,onSwiperReady:n,sliderClass:c,sliderOrder:u,thumbsSwiper:a,...p}=e,[l,o]=React.useState(!1),w=React.useMemo(()=>a?{"thumbs-swiper":a}:{},[a]),f=styles.getStyleSwiperContainer(),d="object"==typeof e.autoplay&&null!==e.autoplay?e.autoplay.pauseOnMouseEnter:void 0,y=()=>{t.current?.swiper&&t.current.swiper.wrapperEl.style.setProperty("width",`${t.current.swiper.width}px`)};return React.useEffect(()=>{let e=async()=>{let e=await import("@gem-sdk/swiper/element/bundle");e.register(),o(!0)};e()},[]),React.useEffect(()=>{l&&(Object.assign(t.current,p),t.current.initialize(),n?.(t.current.swiper),y())},[l]),React.useEffect(()=>{t.current?.swiper&&(t.current.swiper.destroy(!1,!1),Object.assign(t.current,p),t.current.initialize(),n(t.current.swiper),i())},[p.dir,p.loop,d,p.slidesPerView,n,i,p.spaceBetween,p.slidesOffsetBefore]),React.useEffect(()=>{let e=t.current;e&&(Object.assign(e,p),e.swiper?.update(),y())},[p]),React.useEffect(()=>{i()},[u,i]),React.useEffect(()=>{let e=t.current;if(!e)return;let r=()=>{y()};return e.addEventListener("swiperresize",r),()=>{e.removeEventListener("swiperresize",r)}},[]),jsxRuntime.jsx("swiper-container",{init:!1,ref:t,class:c,style:{...f,display:l?"block":"none"},...w,children:r})}exports.Swiper=Swiper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const convertTime=(e,t)=>{let
|
|
1
|
+
"use strict";const convertTime=(e,t)=>{let a=timeOffset(e);return{week:a.weeks,day:t.enableWeek?a.days:a.totalDays,hour:t.enableDay?a.hours:a.totalHours,minute:t.enableHour||t.enableDay||t.enableWeek?a.minutes:a.totalMinutes,second:t.enableMinute||t.enableHour||t.enableDay||t.enableWeek?a.seconds:a.totalSeconds}},timeOffset=e=>({seconds:e%60,minutes:Math.floor(e/60)%60,hours:Math.floor(e/60/60)%24,days:Math.floor(e/60/60/24)%7,weeks:Math.floor(e/60/60/24/7),months:Math.floor(e/60/60/24/30.4368),totalDays:Math.floor(e/60/60/24),totalHours:Math.floor(e/60/60),totalMinutes:Math.floor(e/60),totalSeconds:e}),formatTime=e=>Number.isNaN(e)||0===e?"00":e<10?`0${e}`:e,calculateTime=e=>{let t=new Date().getTime();e||(e=getEndTime(0,3,0));let a=Math.ceil((e-t)/1e3);return a>0?a:0},getEndTime=(e,t,a)=>{let r=new Date,n=new Date;return r.setDate(n.getDate()+e),r.setHours(n.getHours()+t),r.setMinutes(n.getMinutes()+a),r.setSeconds(n.getSeconds()),r.getTime()},daily=(e,t,a)=>{let r=new Date,n=to24HrTime(`${e}:${t} ${a}`);e=n.hours,t=n.mins;let s=new Date(r.getFullYear(),r.getMonth(),r.getDate(),e,t).getTime(),o=s-r.getTime();return o<0&&(o+=864e5),Math.ceil(o/1e3)},standard=(e,t)=>calculateTime(getStandardEndtime(e,t)),getStandardEndtime=(e,t)=>{let a=0,r=new Date(e);if(void 0!=t&&""!=t&&((a=parseInt(t)?parseInt(t):parseInt(t.slice(3)))||0===a)){let e=new Date().getTimezoneOffset();r=new Date(r.getTime()-6e4*e-36e5*a)}return r.getTime()},evergreen=e=>{let{days:t,hours:a,mins:r,seconds:n=0}=e;return(t??0)*86400+(a??0)*3600+(r??0)*60+(n??0)},refreshAfterFinish=(e,t)=>{let a=new Date().getTime(),r=(86400*t.days+3600*t.hours+60*t.mins)*1e3,n=(a-e)%r;return Math.ceil((r-n)/1e3)},to24HrTime=e=>{let[t,a,r]=e.toLowerCase().match(/\d+|[a-z]+/g)||[],n=`${Number(t)%12+("am"==r?0:12)}:${a}`.split(":");return{hours:parseInt(n[0]?n[0]:"0"),mins:parseInt(n[1]?n[1]:"0")}};exports.calculateTime=calculateTime,exports.convertTime=convertTime,exports.daily=daily,exports.evergreen=evergreen,exports.formatTime=formatTime,exports.getEndTime=getEndTime,exports.getStandardEndtime=getStandardEndtime,exports.refreshAfterFinish=refreshAfterFinish,exports.standard=standard;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),core=require("@gem-sdk/core"),helpers=require("../common/helpers.js");const useTimeLeft=e=>{let r=core.useEditorMode(),{timerDaily:t,behaviour:s,timerEverygreen:n,loopAfterFinish:a,redirectUrl:i,timeZone:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),core=require("@gem-sdk/core"),helpers=require("../common/helpers.js");const useTimeLeft=e=>{let r=core.useEditorMode(),{timerDaily:t,behaviour:s,timerEverygreen:n,loopAfterFinish:a,redirectUrl:i,timeZone:u,dateStandard:c}=e,l=React.useMemo(()=>{switch(s){case"daily":return helpers.daily(t.hours,t.mins,t.format);case"evergreen":return helpers.evergreen(n);case"standard":return helpers.standard(c,u);default:return 0}},[s,c,u,t.format,t.hours,t.mins,n.endTime]),[o,h]=React.useState(l),f=React.useRef(),d=React.useCallback(()=>h(e=>e<=0?(i.link&&"#"!==i.link&&"edit"!==r&&window.open(i.link,i.target),isLoopAfterFinish(a,s))?evergreenRefreshAfterFinish(n):(clearInterval(f.current),0):e-1),[s,a,r,i.link,i.target,n]);return React.useEffect(()=>{let e=isLoopAfterFinish(a,s);return e&&(clearInterval(f.current),h(evergreenRefreshAfterFinish(n)),f.current=setInterval(d,1e3)),l<=0&&!e&&(clearInterval(f.current),h(0)),l>0&&(clearInterval(f.current),h(l),f.current=setInterval(d,1e3)),()=>{clearInterval(f.current)}},[s,d,l,a,n]),o},isLoopAfterFinish=(e,r)=>e&&"evergreen"===r,evergreenRefreshAfterFinish=e=>helpers.refreshAfterFinish(e.endTime,{days:e.days,hours:e.hours,mins:e.mins});exports.default=useTimeLeft;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),Text=require("../../text/components/Text.js"),useDynamicProduct=require("../hooks/useDynamicProduct.js");const PostPurchaseProductPrice=({styles:e,style:r,builderAttrs:c,builderProps:
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),Text=require("../../text/components/Text.js"),useDynamicProduct=require("../hooks/useDynamicProduct.js");const PostPurchaseProductPrice=({styles:e,style:r,builderAttrs:c,builderProps:t,children:o})=>{let s=core.useCurrentVariant(),u=core.useProduct(),i=s?.price??0,p=s?.salePrice??0,a=parseFloat(core.shopifyPriceRounding(core.useProductOfferDiscount(),2)),{isDynamicProduct:d}=useDynamicProduct.useDynamicProduct(),n=React.useMemo(()=>a?e?.priceType==="compare"?i:i-a:e?.priceType==="compare"?p:i,[a,e?.priceType,i,p]),m=core.useFormatMoney(parseFloat(n.toFixed(2)),!1),l=u?.baseID?.replace("gid://shopify/Product/",""),y=React.useMemo(()=>e?.priceType==="compare"&&(!a&&p<i||i<=0),[a,i,p,e?.priceType]);return y?null:jsxRuntime.jsxs("div",{...c,className:core.cls(t?.uid),style:{...r},id:`shopify-text-element-${t?.uid}`,"data-product-id":l,children:[jsxRuntime.jsx(Text.default,{styles:e,setting:{text:d?"$???":m},className:core.cls({"gp-money":e?.priceType==="regular","gp-product-compare-price":e?.priceType==="compare","gp-line-through":e?.priceType==="compare"&&e?.lineThrough})}),o]})};exports.default=PostPurchaseProductPrice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const productOfferPlaceholder={id:"",title:"Dynamic product",description:"This is a dynamic product. The actual product will appear here based on your setup",descriptionHtml:'<p class="QN2lPu">This is a dynamic product. The actual product will</p>\n<p class="QN2lPu">appear here based on your setup</p>',createdAt:"2024-07-01T04:19:51.286753Z",handle:"dynamic-product",averageRating:0,isStorefront:!0,isSample:!1,baseID:"",sku:"",options:[{id:"1",name:"Variant",optionType:"",values:[{id:"1",label:"Variant option",isDefault:!0,baseID:""}]}],vendor:"",featuredImage:{id:"542178560626918105",contentType:"IMAGE",previewImage:"",src:"https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-312cf60c-d923-4913-9873-66545effe9cc.png",width:449,height:449,alt:""},collections:{edges:[{node:{id:"502321959132988135",title:"Home page"}},{node:{id:"539286505089204764",title:"b"}},{node:{id:"539286505089401372",title:"e"}}]},tags:[],medias:{edges:[{cursor:"gqFpzweGNIc/AALZoXYB",node:{id:"542178560626918105",contentType:"IMAGE",previewImage:"",src:"https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-312cf60c-d923-4913-9873-66545effe9cc.png",width:449,height:449,alt:""}}],pageInfo:{endCursor:"gqFpzweGNIc/AALZoXYB",hasNextPage:!0}},variants:{edges:[{cursor:"gqFpzwc5ZqRtDAMIoXYC",node:{id:"520560088328176392",title:"Default Title",barcode:"",baseID:"gid://shopify/ProductVariant/49298248925463",costPrice:
|
|
1
|
+
"use strict";const productOfferPlaceholder={id:"",title:"Dynamic product",description:"This is a dynamic product. The actual product will appear here based on your setup",descriptionHtml:'<p class="QN2lPu">This is a dynamic product. The actual product will</p>\n<p class="QN2lPu">appear here based on your setup</p>',createdAt:"2024-07-01T04:19:51.286753Z",handle:"dynamic-product",averageRating:0,isStorefront:!0,isSample:!1,baseID:"",sku:"",options:[{id:"1",name:"Variant",optionType:"",values:[{id:"1",label:"Variant option",isDefault:!0,baseID:""}]}],vendor:"",featuredImage:{id:"542178560626918105",contentType:"IMAGE",previewImage:"",src:"https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-312cf60c-d923-4913-9873-66545effe9cc.png",width:449,height:449,alt:""},collections:{edges:[{node:{id:"502321959132988135",title:"Home page"}},{node:{id:"539286505089204764",title:"b"}},{node:{id:"539286505089401372",title:"e"}}]},tags:[],medias:{edges:[{cursor:"gqFpzweGNIc/AALZoXYB",node:{id:"542178560626918105",contentType:"IMAGE",previewImage:"",src:"https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-312cf60c-d923-4913-9873-66545effe9cc.png",width:449,height:449,alt:""}}],pageInfo:{endCursor:"gqFpzweGNIc/AALZoXYB",hasNextPage:!0}},variants:{edges:[{cursor:"gqFpzwc5ZqRtDAMIoXYC",node:{id:"520560088328176392",title:"Default Title",barcode:"",baseID:"gid://shopify/ProductVariant/49298248925463",costPrice:88,height:0,inventoryPolicy:"DENY",inventoryQuantity:211,inventoryStatus:"",isDigital:!0,length:0,lowInventoryAmount:0,manageInventory:!1,mediaId:"0",platform:"SHOPIFY",price:88,salePrice:88,sku:"",soldIndividually:!1,weight:0,width:0,selectedOptions:[],media:void 0}},{cursor:"gqFpzwc5ZqRtDAMIoXYC",node:{id:"520560088328176392",title:"Default Title",barcode:"",baseID:"gid://shopify/ProductVariant/49298248925463",costPrice:88,height:0,inventoryPolicy:"DENY",inventoryQuantity:211,inventoryStatus:"",isDigital:!0,length:0,lowInventoryAmount:0,manageInventory:!1,mediaId:"0",platform:"SHOPIFY",price:88,salePrice:88,sku:"",soldIndividually:!1,weight:0,width:0,selectedOptions:[],media:void 0}}],pageInfo:{hasNextPage:!1,endCursor:"gaFpzwc5ZqRtDAMI"}}};exports.productOfferPlaceholder=productOfferPlaceholder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),useDynamicProduct=require("./useDynamicProduct.js");const useGetMoneyLines=(e,t)=>{let{isDynamicProduct:o,dynamicPrice:u,dynamicDiscount:i,isEnableDynamicDiscount:a}=useDynamicProduct.useDynamicProduct(),s=core.useProductOfferDiscount(),n=core.useCurrentVariant(),{quantity:l}=core.useQuantity(),r=s*(l||1),c=core.useFormatMoney(r,!1),
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),useDynamicProduct=require("./useDynamicProduct.js");const useGetMoneyLines=(e,t)=>{let{isDynamicProduct:o,dynamicPrice:u,dynamicDiscount:i,isEnableDynamicDiscount:a}=useDynamicProduct.useDynamicProduct(),s=core.useProductOfferDiscount(),n=core.useCurrentVariant(),{quantity:l}=core.useQuantity(),r=s*(l||1),c=core.useFormatMoney(r,!1),p=n?.price??0,b=p*(l||1),d=core.useFormatMoney(b,!1),L=core.shopifyPriceRounding(r,2),h=core.useFormatMoney(b-parseFloat(L),!1),y=()=>{let n=[];return!1!==e.isShowSubTotalLabel&&n.push({title:t.subTotalLabel,money:o?u:d,uniqueId:"subTotalLabel"}),!1!==e.isShowDiscountLabel&&n.push({title:t.discountLabel,money:o&&i&&a?`${i.value}%`:s>0?c:"No discount",uniqueId:"discountLabel"}),!1!==e.isShowShippingLabel&&n.push({title:t.shippingLabel,uniqueId:"shippingLabel",tooltip:{content:"Shipping fee will be calculated on real offer page",width:"23em"}}),!1!==e.isShowTaxesLabel&&n.push({title:t.taxesLabel,uniqueId:"taxesLabel",tooltip:{content:"Taxes will be calculated on real offer page",width:"20em"}}),!1!==e.isShowTotalLabel&&n.push({title:t.totalLabel,money:o?u:h,uniqueId:"totalLabel"}),n};return{getMoneyLines:y}};exports.useGetMoneyLines=useGetMoneyLines;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../../helpers.js"),generateLiquidContent=require("./utils/generateLiquidContent.js"),renderBadgeLiquid=require("./utils/renderBadgeLiquid.js"),system=require("@gem-sdk/system"),constants=require("./constants.js"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),attrs=require("./common/attrs.js");const ProductBadge=e=>{let{styles:t,setting:s,builderProps:r,pageContext:a}=e,i=s?.shape!=="image",
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../../helpers.js"),common=require("./utils/common.js"),generateLiquidContent=require("./utils/generateLiquidContent.js"),renderBadgeLiquid=require("./utils/renderBadgeLiquid.js"),system=require("@gem-sdk/system"),constants=require("./constants.js"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),attrs=require("./common/attrs.js");const ProductBadge=e=>{let{styles:t,setting:s,builderProps:r,pageContext:a}=e,i=s?.shape!=="image",c=common.checkDiscountContentProductBadge(s?.displayContent),n=system.createStyle({...styles.getContainerStyle(e,constants.IS_LIQUID)}),l=system.createClass({...classes.getWrapperClasses(e)}),o=system.createClass({...classes.getSubWrapperClass(e)}),d=system.createStyle({...styles.getSubWrapperStyle(e)}),p=system.createAttr({...attrs.getSubWrapperAttrs(e)}),u=styles.getContentStyleInternal(e),y=system.createClass({...classes.getTextContainerClasses()}),g=system.createAttr({...attrs.getContainerAttrs(e)}),m=system.createClass({...classes.getTextWrapperClasses()}),C=system.createStyle({...styles.getTextBadgeWrapperStyles({setting:s,styles:t})}),v=system.createClass({...classes.getTextContentClasses(t)}),S=system.createStyle({...styles.getTextContentStyle({setting:s,styles:t})}),$=system.createAttr({...attrs.getTextContentAttrs()}),q=system.createClass({...classes.getImageContainerClasses()}),I=system.createStyle({...styles.getImageContainerStyles({setting:s,styles:t})}),j=system.createClass({...classes.getImageClasses()}),D=system.createAttr({...attrs.getImageAttr({setting:s})}),P=system.createStateOrContext({minPrice:"{{ minPriceValue | replace: '\"', '\\\"' | escape }}",variantIDs:'{{ product.variants | map: "id" | json | escape }}',variantInventoryQuantities:'{{ product.variants | map: "inventory_quantity" | json | escape }}',amountDiscount:"{{amountDiscountValue | replace: '\"', '\\\"' | escape }}",percentDiscount:"{{percentDiscountValue}}",price:"{{price}}",displayTrigger:JSON.parse(JSON.stringify(s?.displayTrigger).replaceAll("'","'")),uid:e.builderProps?.uid,productCreatedAt:'{{product.created_at | date: "%Y-%m-%d" }}',productTags:"{{ product.tags | join: \",\" | replace: '\"', '\\\"' | escape }}",isTextBadge:i}),{displayContent:f,translate:A}=s??{},L=helpers.getDynamicSourceLocales({val:f?.trim(),uid:r?.uid,settingId:"displayContent",isLiquid:!0,pageContext:a,translate:A});return core.template`
|
|
2
2
|
{% if product %}
|
|
3
3
|
${generateLiquidContent.generateBadgeContent(L,a?.isPreviewing)}
|
|
4
|
-
${renderBadgeLiquid.renderBadgeInFirstTime(s?.displayTrigger
|
|
4
|
+
${renderBadgeLiquid.renderBadgeInFirstTime(s?.displayTrigger,c,i)}
|
|
5
5
|
<gp-product-badge
|
|
6
6
|
${{...g}}
|
|
7
|
-
gp-data='${core.dataStringify(
|
|
7
|
+
gp-data='${core.dataStringify(P)}'
|
|
8
8
|
class="containerClass {{className}}"
|
|
9
|
-
style="${
|
|
9
|
+
style="${n}"
|
|
10
10
|
data-display-content="${a?.isPreviewing?L:core.sanitizeLiquid(`{{${L}}}`)}"
|
|
11
11
|
>
|
|
12
|
-
<div class="${
|
|
12
|
+
<div class="${l}">
|
|
13
13
|
<div
|
|
14
14
|
${{...p}}
|
|
15
|
-
class="${
|
|
16
|
-
style="${
|
|
15
|
+
class="${o}"
|
|
16
|
+
style="${d}"
|
|
17
17
|
>
|
|
18
|
-
<style>${
|
|
18
|
+
<style>${u}</style>
|
|
19
19
|
${core.RenderIf(i,core.template`
|
|
20
|
-
<div class="${
|
|
20
|
+
<div class="${y}">
|
|
21
21
|
<div
|
|
22
22
|
class="${m}"
|
|
23
23
|
style="${C}"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
>{{ content | replace: percentDiscountKey, percentDiscountValue | replace: amountDiscountKey, amountDiscountValue | replace: inventoryQuantityKey, inventoryQuantityValue | replace: minPriceKey, minPriceValue }}</pre>
|
|
30
30
|
</div>
|
|
31
31
|
</div>`,core.template`<div class="${q}" style="${I}">
|
|
32
|
-
<img ${{...
|
|
32
|
+
<img ${{...D}} class="${j}" alt="" />
|
|
33
33
|
</div>`)}
|
|
34
34
|
</div>
|
|
35
35
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),common=require("../utils/common.js"),getShapePosition=require("../utils/getShapePosition.js"),getRotateShape=require("../utils/getRotateShape.js"),getStyleAdvanced=require("../utils/getStyleAdvanced.js"),getWhiteSpace=require("../utils/getWhiteSpace.js"),stylesV2=require("../utils/stylesV2.js"),shape=require("../utils/shape.js"),renderBadgeILP=require("../utils/renderBadgeILP.js");const getSizeStyles=e=>{let{setting:t,styles:o}=e,r=shape.getShape(t?.shape),a=t?.contentType==="text",i=a?o?.textSizeV2:o?.imageSizeV2;return a?common.getSize(r,i):common.getSize(void 0,i)},getContainerStyle=(e,t=!1)=>{let{setting:o,styles:r,style:a,navigationPosition:i,imageData:s,dotData:n}=e,g=o?.positionWithImage==="outside",l=common.getWrapperStyle(t),p=getShapePosition.getShapePosition({positionType:r?.position,isLiquid:!1,navigationPosition:i,dataImage:{...s,...n}}),S=getSizeStyles(e),d=getStyleAdvanced.getStyleAdvanced(g?{}:{...p,...S},a);return{...!g&&{"--pos":"absolute"},...l,...d}},getTextContentStyle=({styles:e,setting:t})=>{let o=core.makeGlobalSize(e?.textSizeV2).padding,r=shape.getShape(t?.shape),a=t?.positionWithImage==="outside";return{...getWhiteSpace.getWhiteSpaceStyle(e?.textSizeV2),...common.convertToStyle(r?.textStyle),...getRotateShape.composeTextStyleByPosition(r,e?.position,a),...core.composeTypographyStyle(e?.typo),...core.getStyleShadow({value:e?.typo?.custom?.textShadow,styleAppliedFor:"text-shadow",isEnableShadow:e?.typo?.custom?.hasShadowText}),...stylesV2.getStyleBackground(!!r?.backgroundColorInText,e?.badgeColorV2),...o}},getBorderStyles=({styles:e,setting:t})=>{let o=shape.getShape(t?.shape),r=t?.contentType==="text";return o?.supportBorder?r?stylesV2.getStyleBorder(e?.textBadgeBorder):stylesV2.getStyleBorder(e?.imageBadgeBorder):{}},getCornerStyles=({styles:e,setting:t})=>{let o=shape.getShape(t?.shape),r=t?.contentType==="text";return o?.supportCorner?r?stylesV2.getStyleCornerRadius(e?.textBadgeCorner,o?.shapeRadius):stylesV2.getStyleCornerRadius(e?.imageBadgeCorner,o?.shapeRadius):{}},getTextBadgeWrapperStyles=({styles:e,setting:t})=>{let o=shape.getShape(t?.shape),r=getBorderStyles({setting:t,styles:e}),a=t?.positionWithImage==="outside",i=getCornerStyles({setting:t,styles:e}),s=common.getShapeWrapperPadding(o?.ratio);return{...r,...i,...getRotateShape.composeShapeStyleByPosition(o,e?.position,a),...stylesV2.getStyleBackground(!o?.backgroundColorInText,e?.badgeColorV2),...s,height:o?.ratio===1?"0px":"100%"}},getImageContainerStyles=({styles:e,setting:t})=>{let o=getBorderStyles({setting:t,styles:e}),r=getCornerStyles({setting:t,styles:e}),a=core.makeGlobalSize(e?.imageSizeV2).padding;return{...o,...r,...a}},getOpacityProductBadge=(e,t,o,r)=>{let{"bundle-item":a,setting:i}=e;if(a)return 1;let s=common.checkDiscountContentProductBadge(i?.displayContent)&&i?.contentType==="text";if(!s)return 1;let n=
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),common=require("../utils/common.js"),getShapePosition=require("../utils/getShapePosition.js"),getRotateShape=require("../utils/getRotateShape.js"),getStyleAdvanced=require("../utils/getStyleAdvanced.js"),getWhiteSpace=require("../utils/getWhiteSpace.js"),stylesV2=require("../utils/stylesV2.js"),shape=require("../utils/shape.js"),renderBadgeILP=require("../utils/renderBadgeILP.js");const getSizeStyles=e=>{let{setting:t,styles:o}=e,r=shape.getShape(t?.shape),a=t?.contentType==="text",i=a?o?.textSizeV2:o?.imageSizeV2;return a?common.getSize(r,i):common.getSize(void 0,i)},getContainerStyle=(e,t=!1)=>{let{setting:o,styles:r,style:a,navigationPosition:i,imageData:s,dotData:n}=e,g=o?.positionWithImage==="outside",l=common.getWrapperStyle(t),p=getShapePosition.getShapePosition({positionType:r?.position,isLiquid:!1,navigationPosition:i,dataImage:{...s,...n}}),S=getSizeStyles(e),d=getStyleAdvanced.getStyleAdvanced(g?{}:{...p,...S},a);return{...!g&&{"--pos":"absolute"},...l,...d}},getTextContentStyle=({styles:e,setting:t})=>{let o=core.makeGlobalSize(e?.textSizeV2).padding,r=shape.getShape(t?.shape),a=t?.positionWithImage==="outside";return{...getWhiteSpace.getWhiteSpaceStyle(e?.textSizeV2),...common.convertToStyle(r?.textStyle),...getRotateShape.composeTextStyleByPosition(r,e?.position,a),...core.composeTypographyStyle(e?.typo),...core.getStyleShadow({value:e?.typo?.custom?.textShadow,styleAppliedFor:"text-shadow",isEnableShadow:e?.typo?.custom?.hasShadowText}),...stylesV2.getStyleBackground(!!r?.backgroundColorInText,e?.badgeColorV2),...o}},getBorderStyles=({styles:e,setting:t})=>{let o=shape.getShape(t?.shape),r=t?.contentType==="text";return o?.supportBorder?r?stylesV2.getStyleBorder(e?.textBadgeBorder):stylesV2.getStyleBorder(e?.imageBadgeBorder):{}},getCornerStyles=({styles:e,setting:t})=>{let o=shape.getShape(t?.shape),r=t?.contentType==="text";return o?.supportCorner?r?stylesV2.getStyleCornerRadius(e?.textBadgeCorner,o?.shapeRadius):stylesV2.getStyleCornerRadius(e?.imageBadgeCorner,o?.shapeRadius):{}},getTextBadgeWrapperStyles=({styles:e,setting:t})=>{let o=shape.getShape(t?.shape),r=getBorderStyles({setting:t,styles:e}),a=t?.positionWithImage==="outside",i=getCornerStyles({setting:t,styles:e}),s=common.getShapeWrapperPadding(o?.ratio);return{...r,...i,...getRotateShape.composeShapeStyleByPosition(o,e?.position,a),...stylesV2.getStyleBackground(!o?.backgroundColorInText,e?.badgeColorV2),...s,height:o?.ratio===1?"0px":"100%"}},getImageContainerStyles=({styles:e,setting:t})=>{let o=getBorderStyles({setting:t,styles:e}),r=getCornerStyles({setting:t,styles:e}),a=core.makeGlobalSize(e?.imageSizeV2).padding;return{...o,...r,...a}},getOpacityProductBadge=(e,t,o,r)=>{let{"bundle-item":a,setting:i}=e;if(a)return 1;let s=common.checkDiscountContentProductBadge(i?.displayContent)&&i?.contentType==="text";if(!s)return 1;let n=t?.price??0,g=t?.salePrice??0,l=g-n>0,p=renderBadgeILP.checkShowBadge(i?.displayTrigger,o,t);return l&&p?1:"edit"===r?.2:0},getSubWrapperStyle=(e,t,o,r)=>{let{setting:a}=e,i=a?.positionWithImage==="outside",s=getSizeStyles(e),n=r&&o?getOpacityProductBadge(e,o,t,r):1;return{...i?{...s,"--mb":0}:{},opacity:n}},getContentStyleInternal=e=>{let{styles:t,setting:o,builderProps:r}=e,a=o?.contentType==="text";return stylesV2.generateShadowCSS(`[id="${r?.uid}"] .product-badge-item`,a?t?.textBadgeShadow:t?.imageBadgeShadow)};exports.getContainerStyle=getContainerStyle,exports.getContentStyleInternal=getContentStyleInternal,exports.getImageContainerStyles=getImageContainerStyles,exports.getSubWrapperStyle=getSubWrapperStyle,exports.getTextBadgeWrapperStyles=getTextBadgeWrapperStyles,exports.getTextContentStyle=getTextContentStyle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),productBundle=require("../../../helpers/product-bundle.js"),productBundle$1=require("../../constants/product-bundle.js");const removeTrailingZeros=e=>e.replace(/\.00$/,""),getPriceDiffByPercent=(e,t)=>{if(!t)return"0";let r=1e3*t-1e3*e;return Math.round(100*r/(1e3*t))},getPriceDiffByValue=(e,t,r)=>removeTrailingZeros(core.formatMoney(t?(t-e).toFixed(2):"0",r)),getMinPrice=(e,t)=>{let r=e?.edges?.length&&e.edges.length>0?1/0:0;return e?.edges.forEach(({node:e})=>{if(!e)return;let t=
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),productBundle=require("../../../helpers/product-bundle.js"),productBundle$1=require("../../constants/product-bundle.js");const removeTrailingZeros=e=>e.replace(/\.00$/,""),getPriceDiffByPercent=(e,t)=>{if(!t)return"0";let r=1e3*t-1e3*e;return Math.round(100*r/(1e3*t))},getPriceDiffByValue=(e,t,r)=>removeTrailingZeros(core.formatMoney(t?(t-e).toFixed(2):"0",r)),getMinPrice=(e,t)=>{let r=e?.edges?.length&&e.edges.length>0?1/0:0;return e?.edges.forEach(({node:e})=>{if(!e)return;let t=e?.price;void 0!==t&&t<r&&(r=t)}),removeTrailingZeros(core.formatMoney(r.toString(),t))},checkNoDiscountState=(e,t)=>{let{discountPercentAmount:r}=productBundle.applyBundleDiscountAmount({currentVariant:e?.currentVariant,bundleItem:e?.bundleItem,options:{moneyFormat:t,useProductCompareAtPrice:e?.useProductCompareAtPrice}});return!(e?.bundleItem?.discountType===productBundle$1.DiscountType.NoDiscount&&e?.useProductCompareAtPrice||Number(e?.bundleItem?.discountValue)&&r)&&!e?.currentVariant?.salePrice},getBadgeContent=(e,t,r)=>{if(!e.detail||!t?.trim()?.length)return t;let{detail:i,currentVariant:o}=e,{discountPercentAmount:n,discountAmount:c}=productBundle.applyBundleDiscountAmount({currentVariant:o,bundleItem:e?.bundleItem,options:{moneyFormat:r,useProductCompareAtPrice:e?.useProductCompareAtPrice}}),u=()=>e?.bundleItem?.discountType!==productBundle$1.DiscountType.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?`${n}%`:`${getPriceDiffByPercent(o?.price||0,o?.salePrice||0)||0}%`:"0%",l=()=>e?.bundleItem?.discountType!==productBundle$1.DiscountType.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?c:getPriceDiffByValue(o?.price||0,o?.salePrice||0,r):core.formatMoney("0",r),a=new Map([["{percent_discount}",u],["{amount_discount}",l],["{min_price}",()=>getMinPrice(i.variants,r)||0],["{inventory_quantity}",()=>o?.inventoryQuantity||0]]);return[...a.entries()].reduce((e,[t,r])=>e.replaceAll(t,r()),t)},checkDiscountContentProductBadge=e=>{if(!e)return!1;let t=/\{percent_discount\}|\{amount_discount\}/;return t.test(e)},getShapePlacementClass=(e,t,r="desktop")=>e?t?.[`--pos${deviceWithSurfix(r)}`]?"w-full h-full":"!gp-absolute":t?.[`--d${deviceWithSurfix(r)}`]?"":"!gp-inline-block gp-w-fit",getAlignShape=(e,t)=>t?"":core.cls("gp-flex",{"gp-justify-start":e?.desktop==="left","gp-justify-center":e?.desktop==="center","gp-justify-end":e?.desktop==="right","tablet:gp-justify-start":e?.tablet==="left","tablet:gp-justify-center":e?.tablet==="center","tablet:gp-justify-end":e?.tablet==="right","mobile:gp-justify-start":e?.mobile==="left","mobile:gp-justify-center":e?.mobile==="center","mobile:gp-justify-end":e?.mobile==="right"}),convertToStyle=e=>Object.entries(e||{}).reduce((e,[t,r])=>{let i=new Map([["clipPath","clip-path"],["writingMode","writing-mode"],["borderRadius","border-radius"],["transform","transform"],["alignItems","align-items"],["maxWidth","max-width"]]),o=i.get(t)||t;return{...e,[o]:r}},{}),getWrapperStyle=e=>({[e?"z-index":"zIndex"]:2}),getWidthByShapeSize=(e,t)=>{let r={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let o=core.getResponsiveValueByScreen(e,i,null),n=o?.width||t?.wrapperWidth;n&&(r={...r,[i]:n})}),r},getHeightByShapeSize=(e,t)=>{let r={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let o=core.getResponsiveValueByScreen(e,i,null);r={...r,[i]:o?.height||t?.wrapperHeight}}),r},getSize=(e,t)=>{let r=core.makeStyleResponsive("w",getWidthByShapeSize(t,e)),i=core.makeStyleResponsive("h",getHeightByShapeSize(t,e));return{...r,...i}},getShapeWrapperPadding=e=>{let t={};if(1!==e)return t;let r=["desktop","mobile","tablet"];return r.forEach(e=>{t={...t,height:0,[`--p${"desktop"!==e?`-${e}`:""}`]:"50% 0"}}),t},deviceWithSurfix=e=>"desktop"===e?"":`-${e}`,getDeviceSpecificStyle=(e,t)=>{for(let r of({desktop:["desktop"],tablet:["tablet","desktop"],mobile:["mobile","tablet","desktop"]})[t])if(e?.[r])return e[r]},getIsNoDiscountState=({props:e,product:t,currentVariant:r,moneyFormat:i,useProductCompareAtPrice:o})=>{let{setting:n,"bundle-item":c}=e,u=checkDiscountContentProductBadge(n?.displayContent);return u&&checkNoDiscountState({detail:t,currentVariant:r,bundleItem:c,useProductCompareAtPrice:o},i)};exports.checkDiscountContentProductBadge=checkDiscountContentProductBadge,exports.checkNoDiscountState=checkNoDiscountState,exports.convertToStyle=convertToStyle,exports.deviceWithSurfix=deviceWithSurfix,exports.getAlignShape=getAlignShape,exports.getBadgeContent=getBadgeContent,exports.getDeviceSpecificStyle=getDeviceSpecificStyle,exports.getIsNoDiscountState=getIsNoDiscountState,exports.getShapePlacementClass=getShapePlacementClass,exports.getShapeWrapperPadding=getShapeWrapperPadding,exports.getSize=getSize,exports.getWidthByShapeSize=getWidthByShapeSize,exports.getWrapperStyle=getWrapperStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var types=require("../types.js");const getMinValueForInventory=e=>e===types.CompareType.ABOVE?0:e===types.CompareType.BELOW?2:1,renderBadgeInFirstTime=(e,i)=>`
|
|
1
|
+
"use strict";var types=require("../types.js");const getMinValueForInventory=e=>e===types.CompareType.ABOVE?0:e===types.CompareType.BELOW?2:1,renderBadgeInFirstTime=(e,i,n)=>`
|
|
2
2
|
{% assign isShow = true %}
|
|
3
3
|
{% assign conditionTriggers = "" %}
|
|
4
4
|
{% assign isInventoryStatus = false %}
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
{% assign price = variant.price | times: 1.0 %}
|
|
17
17
|
{% assign salePrice = variant.compare_at_price | times: 1.0 %}
|
|
18
18
|
{% assign priceSave = salePrice | minus: price %}
|
|
19
|
-
{% assign
|
|
20
|
-
{%
|
|
19
|
+
{% assign isDiscountContent = ${i} %}
|
|
20
|
+
{% assign isTextBadge = ${n} %}
|
|
21
|
+
{% if priceSave <= 0 or isDiscountContent == false or isTextBadge == false %}
|
|
21
22
|
{% assign isShow = false %}
|
|
22
23
|
{% endif %}
|
|
23
24
|
{% if isShow %}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),React=require("react"),tracking=require("../../../helpers/tracking.js"),useDispatchAfterSubmitEvent=require("./useDispatchAfterSubmitEvent.js"),useCartMessage=require("./useCartMessage.js"),useCartOperations=require("./useCartOperations.js");const useBtnAddToCart=({styles:e,setting:r,builderProps:t})=>{let s=React.useRef(null),{isEditMode:u,isPreviewSharePageMode:a}=core.useRenderMode(),i=core.useProduct(),{currency:c}=core.useCurrency(),{quantity:n}=core.useQuantity(),o=core.useProductProperties(),l=core.useCurrentVariant(),{hasPreSelected:d}=core.useHasPreSelected(),b=core.useStickyStore(e=>e.setStickyVisible),
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),React=require("react"),tracking=require("../../../helpers/tracking.js"),useDispatchAfterSubmitEvent=require("./useDispatchAfterSubmitEvent.js"),useCartMessage=require("./useCartMessage.js"),useCartOperations=require("./useCartOperations.js");const useBtnAddToCart=({styles:e,setting:r,builderProps:t})=>{let s=React.useRef(null),{isEditMode:u,isPreviewSharePageMode:a}=core.useRenderMode(),i=core.useProduct(),{currency:c}=core.useCurrency(),{quantity:n}=core.useQuantity(),o=core.useProductProperties(),l=core.useCurrentVariant(),{hasPreSelected:d}=core.useHasPreSelected(),b=core.useStickyStore(e=>e.setStickyVisible),C=core.useProductStore(e=>e.updateIsSubmit),v=useDispatchAfterSubmitEvent.useDispatchAfterSubmitEvent(t?.uid),{showMessage:g,notiComponent:p}=useCartMessage.useCartMessage(e,r),{handleSuccess:f,handleError:k,cartId:S}=useCartOperations.useCartOperations(r,g,v),{isMutating:I,trigger:m}=core.useCreateCart({onSuccess:f,onError:k}),{isMutating:D,trigger:E}=core.useAddToCart({onSuccess:f,onError:k});React.useEffect(()=>{let e=new IntersectionObserver(e=>{let r=e[0];b(r?.isIntersecting)},{threshold:.1}),r=s.current;return s.current&&e.observe(s.current),()=>{r&&e.unobserve(r)}},[b]);let A=React.useCallback(()=>{if(!l?.baseID||!n||!i?.baseID||void 0!==d&&!d||u||a)return;let e=o?.some(e=>e.required&&!e.value);if(C(!0),e)return;let t=o?.filter(e=>!!e.value)?.map(e=>({key:e.key,value:e.value}));tracking.addToCartTracking({quantity:n,currency:c,id:i?.baseID,name:i?.title,brand:i?.vendor,sku:l.sku,price:l?.price,variant:l.title});let s={quantity:n,attributes:t,variantId:l.baseID};r?.actionEffect!=="buy-now"&&S?E({cartId:S,lines:[s]}):m({items:[s]})},[u,a,S,c,n,o,d,i?.title,i?.vendor,i?.baseID,l?.sku,l?.price,l?.title,l?.baseID,r?.actionEffect,m,E,C]),h=core.useCurrentVariantInStock(),q=I||D,y=l?r?.outOfStockLabel:"Unavailable";return{addToCartRef:s,isLoading:q,isInStock:h,notiComponent:p,outOfStockLabel:y,addToCart:A}};exports.useBtnAddToCart=useBtnAddToCart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),React=require("react"),productBundle=require("../../../helpers/product-bundle.js"),productBundle$1=require("../../constants/product-bundle.js");const useGpDiscountTag=e=>{let{setting:
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),React=require("react"),productBundle=require("../../../helpers/product-bundle.js"),productBundle$1=require("../../constants/product-bundle.js");const useGpDiscountTag=e=>{let{setting:t,...u}=e,{customContent:r}=t??{},o=u["bundle-item"],{moneyFormat:n}=core.useMoneyFormat(),c=core.useEditorMode(),s=core.useProduct(),i=core.useCurrentVariant(),{quantity:a,hasUpdatePrice:d}=core.useQuantity(),p=React.useMemo(()=>d&&r?.unit!=="percentage"?a??1:1,[d,r?.unit,a]),l=i?.price??0,m=i?.salePrice??0,g=(m-l)*p,M=core.useFormatMoney(g<0?0:g,t?.moneyWithCurrentFormat||!1),y=React.useMemo(()=>{if(!m&&0!==m||!l&&0!==l)return`${r?.unit==="percentage"?"0%":M}`;if(r?.unit==="percentage"){let e=Math.round(g/(m/100));return`${e<0?0:e}%`}return`${M}`},[r?.unit,M,l,g,m]),{useProductCompareAtPrice:D}=core.useProductBundleDiscount(),{discountPercentAmount:B}=productBundle.applyBundleDiscountAmount({currentVariant:i,bundleItem:o,options:{moneyFormat:n,useProductCompareAtPrice:D}}),R=React.useMemo(()=>{if(!o)return 0;let{discountPercentAmount:e,discountAmount:t}=productBundle.applyBundleDiscountAmount({currentVariant:i,bundleItem:o,options:{moneyFormat:n,useProductCompareAtPrice:D}}),{discountType:u}=o,{unit:c}=r||{};return u!==productBundle$1.DiscountType.NoDiscount||D?"percentage"===c?`${e}%`:t:"percentage"===c?"0%":core.formatMoney("0",n)},[o,i,n,D,r]),$=React.useMemo(()=>o?R:y,[R,o,y]),f=s?.baseID?.replace("gid://shopify/Product/",""),b=React.useMemo(()=>{let e=o?B<=0:g<=0;return"edit"===c&&e},[o,B,c,g]);return{mode:c,product:s,salePrice:m,priceSave:g,currentProductId:f,unitCustomDisplay:$,shouldPlaceholderNoDiscount:b}};exports.useGpDiscountTag=useGpDiscountTag;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
{% else %}
|
|
14
14
|
${_()}
|
|
15
15
|
{% endcase %}
|
|
16
|
-
`,f=()=>Modal3d_liquid.default({src:system.LiquidIf("featureMedia.sources.first.url contains '.glb'","{{ featureMedia.sources.first.url }}","{{featureMedia.sources.last.url}}"),alt:"{{featureMedia.preview_image.alt}}",poster:"{{featureMedia.preview_image.src | product_img_url: '1024x1024'}}",cameraControls:!0,arStatus:"not-presenting",style:{width:"100%"},aspectRatio:n}),y=()=>Video_liquid.default({src:"{{mediaSourceVideo}}",alt:"{{featureMedia.alt | escape}}",autoplay:!1,allowfullscreen:!0,controls:!0,style:{width:"100%",height:"100%"},aspectRatio:n}),h=()=>{let e=system.createStyle({...productFeaturedImage.getVideoHeight(a?.ftLayout),...core.makeStyleResponsive("objf",a?.ftLayout)}),t=system.createStyle({...productFeaturedImage.getVideoHeight(a?.ftLayout)});return HTML5Embed_liquid.default({src:"{{mediaSourceVideo}}",title:"{{featureMedia.alt | escape}}",autoplay:!1,controls:!0,thumbnail:"{{featureMedia.preview_image.src | product_img_url: '1024x1024'}}",isCheckLoaded:!0,wrapperStyles:t,
|
|
16
|
+
`,f=()=>Modal3d_liquid.default({src:system.LiquidIf("featureMedia.sources.first.url contains '.glb'","{{ featureMedia.sources.first.url }}","{{featureMedia.sources.last.url}}"),alt:"{{featureMedia.preview_image.alt}}",poster:"{{featureMedia.preview_image.src | product_img_url: '1024x1024'}}",cameraControls:!0,arStatus:"not-presenting",style:{width:"100%"},aspectRatio:n}),y=()=>Video_liquid.default({src:"{{mediaSourceVideo}}",alt:"{{featureMedia.alt | escape}}",autoplay:!1,allowfullscreen:!0,controls:!0,style:{width:"100%",height:"100%"},aspectRatio:n}),h=()=>{let e=system.createStyle({...productFeaturedImage.getVideoHeight(a?.ftLayout),...core.makeStyleResponsive("objf",a?.ftLayout)}),t=system.createStyle({...productFeaturedImage.getVideoHeight(a?.ftLayout)});return HTML5Embed_liquid.default({src:"{{mediaSourceVideo}}",title:"{{featureMedia.alt | escape}}",autoplay:!1,controls:!0,thumbnail:"{{featureMedia.preview_image.src | product_img_url: '1024x1024'}}",isCheckLoaded:!0,wrapperStyles:t,style:{width:"100%","max-height":"100%",...e},className:"gp-invisible"})},I=()=>core.template`
|
|
17
17
|
${q(core.cls("gp-w-full gp-transition-opacity",{"group-hover:gp-opacity-0":"other"==a.hoverEffect},"{{shouldHidden}}"))}
|
|
18
18
|
${system.If(a?.hoverEffect!=="none",`<div class="${core.cls("zoom-element !gp-max-w-none",productFeaturedImage.getZoomImageClass())}">
|
|
19
19
|
${q("image-zoom",!0)}
|
|
@@ -56,19 +56,19 @@
|
|
|
56
56
|
${M()}`)}
|
|
57
57
|
`,NextImage_liquid.default({src:"https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif",id:"noImageError",width:"480",height:"480",alt:"no image",priority:a?.preload,setting:{layout:a?.ftLayout,aspectRatio:n,qualityType:a?.qualityType,qualityPercent:a?.qualityPercent},style:{height:"100%"},className:"gp-w-full featured-image-only !gp-rounded-none",customLazyload:!0,enableLazyLoadImage:i})),L=()=>`
|
|
58
58
|
${Carousel_liquid.default({builderProps:{uid:e},rootId:`ft-${e}-{{section.id}}-{{product.id}}`,conditionAppendJs:"product.media.size > 1",wrapperClass:$,rootClass:`${s}`,rootAttrs:{type:"gp-feature-image-carousel","product-id":"{{product.id}}","product-media":"{{product.media.size}}"},isHiddenArrowWhenDisabled:!0,setting:c,rootStyles:o,styles:u,style:{playSpeed:600},disableMarginAuto:!0,children:w,productBadgeLiquid:t||""})}
|
|
59
|
-
`,
|
|
59
|
+
`,S=()=>{switch(a?.preDisplay){case"1st-images":return`
|
|
60
60
|
{% assign featureMedia = product.media.first %}
|
|
61
61
|
`;case"1st-3d-mode":return system.LiquidFor("media in product.media",system.LiquidIf("media.media_type == 'model'","{% assign featureMedia = media %}{% break %}"));case"1st-video":return system.LiquidFor("media in product.media",system.LiquidIf("media.media_type == 'video' or media.media_type == 'external_video'","{% assign featureMedia = media %}{% break %}"));default:return`
|
|
62
62
|
{% assign featureMedia = variant.featured_media %}
|
|
63
63
|
{% unless featureMedia %}
|
|
64
64
|
{% assign featureMedia = product.featured_media %}
|
|
65
65
|
{% endunless %}
|
|
66
|
-
`}},
|
|
66
|
+
`}},x=()=>system.Liquid(`
|
|
67
67
|
{% assign featureMedia = variant.featured_media %}
|
|
68
68
|
{% unless featureMedia %}
|
|
69
69
|
{% assign featureMedia = product.featured_media %}
|
|
70
70
|
{% endunless %}
|
|
71
|
-
${system.LiquidIf("product.media.size > 1",
|
|
71
|
+
${system.LiquidIf("product.media.size > 1",S())}
|
|
72
72
|
{% assign largestRatio = 0 %}
|
|
73
73
|
{% assign height = featureMedia.height | times: 1.0 %}
|
|
74
74
|
{% assign width = featureMedia.width | times: 1.0 %}
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
</div>
|
|
110
110
|
`);return system.Liquid(`
|
|
111
111
|
{% capture featureImageOnlyOne %}
|
|
112
|
-
${
|
|
112
|
+
${x()}
|
|
113
113
|
{% endcapture %}
|
|
114
114
|
${system.LiquidIf("product.media.size > 1",`
|
|
115
115
|
${system.If(v,L()," ")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),dynamic=require("next/dynamic"),Loading=require("../../../common/components/Loading.js"),React=require("react"),core=require("@gem-sdk/core"),SalePageProductListWarning=require("../SalePageProductListWarning.js"),Head=require("next/head"),ProductListGridLayout=require("./ProductListGridLayout.js"),ProductListCarouselLayout=require("./ProductListCarouselLayout.js"),styles=require("./common/styles.js"),system=require("@gem-sdk/system"),classes=require("./common/classes.js"),helpers=require("./common/helpers.js"),helpers$1=require("../../../dialog/common/helpers.js");const ProductNotFound=dynamic(()=>Promise.resolve().then(function(){return require("../ProductNotFound.js")}),{loading:Loading.default}),ProductList=e=>{let{children:t,styles:r,builderProps:o,setting:s,builderAttrs:a}=e,{isRelatedProduct:d,productSetting:i}=helpers.getData(e),l=i.relatedTag&&i.relatedTag[0],{isEditMode:c,isPreviewSharePageMode:u}=core.useRenderMode(),n=core.useCurrentDevice(),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),dynamic=require("next/dynamic"),Loading=require("../../../common/components/Loading.js"),React=require("react"),core=require("@gem-sdk/core"),SalePageProductListWarning=require("../SalePageProductListWarning.js"),Head=require("next/head"),ProductListGridLayout=require("./ProductListGridLayout.js"),ProductListCarouselLayout=require("./ProductListCarouselLayout.js"),styles=require("./common/styles.js"),system=require("@gem-sdk/system"),classes=require("./common/classes.js"),helpers=require("./common/helpers.js"),helpers$1=require("../../../dialog/common/helpers.js");const ProductNotFound=dynamic(()=>Promise.resolve().then(function(){return require("../ProductNotFound.js")}),{loading:Loading.default}),ProductList=e=>{let{children:t,styles:r,builderProps:o,setting:s,builderAttrs:a}=e,{isRelatedProduct:d,productSetting:i}=helpers.getData(e),l=i.relatedTag&&i.relatedTag[0],{isEditMode:c,isPreviewSharePageMode:u}=core.useRenderMode(),n=core.useCurrentDevice(),m=core.usePageType(),g=core.usePageStore(e=>e.dynamicProduct),h=core.usePageStore(e=>e.dynamicCollection),[P,j]=React.useState(1),[p,x]=React.useState(!0),[f,y]=React.useState(),[R,v]=React.useState(!1),b="GP_FUNNEL_PAGE"===m,T="GP_COLLECTION"==m;T&&(i.productSrc="DynamicCollection",i.collectionId=h?.collectionId??"latest");let I=i?.productSrc??"Collection",S=g?.productId&&g?.productId!==i.relatedProductId?g?.productId:i.relatedProductId,k=core.useFetchHandle(),L=core.usePageStore(e=>e.publicStoreFrontData),C=React.useMemo(()=>core.hasPublicStoreFrontData(L)?core.createStoreFrontFetcher(L):k,[L]),{data:O}=core.useProductQuery(d&&S?S:void 0,{revalidateOnMount:c||u},C),E=i.relatedTag&&"tags"===i.relatedTag[0]&&(!O?.tags||O?.tags.length===0),N=i.relatedTag&&"collection"===i.relatedTag[0]&&(!O?.collections?.edges||O?.collections.edges.length===0),q=i.relatedTag&&"vendor"===i.relatedTag[0]&&!O?.vendor,M=E||N||q,w=core.useProductsQueryAll(f,{revalidateOnMount:c||u},C),W=c||u,F=core.useProductsQuery("PickProduct"===I?i?.productIds:void 0,{revalidateOnMount:W},{defaultSelectedProductCount:i?.numOfSelectedProducts}),G=React.useMemo(()=>({id:i?.collectionId??"latest",numberOfProducts:s?.numberOfProducts??4,orderBy:s?.orderBy}),[i?.collectionId,Number(s?.numberOfProducts),s?.orderBy]),Q=core.useCollectionQuery("PickProduct"!==I?G:void 0,{revalidateOnMount:W});React.useEffect(()=>{if(d&&O&&i.relatedTag&&"recommended-product"!==i.relatedType){let e;switch(v(!1),i.hasRelatedExclude&&(e=i?.relatedExclude&&i.relatedExclude.split(",").map(e=>e.trim())),i.relatedTag[0]){case"vendor":y({vendor:i.relatedTag&&"vendor"===i.relatedTag[0]?O?.vendor:"",limit:s?.numberOfProducts,idNEQ:O.id});break;case"collection":{let t;let r=O?.collections?.edges.map(e=>e.node?.id);if(!r||r?.length===0){v(!0);break}y(t=e&&e.length>0?{idNEQ:O.id,hasCollectionProductsWith:[{hasCollectionWith:[{idIn:r},{titleNotIn:e}]}],limit:s?.numberOfProducts}:{idNEQ:O.id,hasCollectionProductsWith:[{hasCollectionWith:[{idIn:r}]}],limit:s?.numberOfProducts});break}case"tags":{let t;if(!O.tags||0===O.tags.length){v(!0);break}y(t=e&&e.length>0?{idNEQ:O.id,hasProductTagsWith:[{hasTagsWith:[{nameIn:O.tags},{nameNotIn:e}]}],limit:s?.numberOfProducts}:{idNEQ:O.id,hasProductTagsWith:[{hasTagsWith:[{nameIn:O.tags}]}],limit:s?.numberOfProducts})}}}},[O,i.relatedType,i.relatedTag,s?.numberOfProducts,i.relatedExclude,i.hasRelatedExclude,d]);let B="PickProduct"===I?F.isValidating:Q.isValidating,D="PickProduct"===I?F.isLoading:Q.isLoading,A="PickProduct"===I?F.error:Q.error,H=Q.data?.collections?.edges?.[0]?.node,$="PickProduct"===I?core.flattenConnection(F.data?.products):core.flattenConnection(H?.products),_=w?.data?.products?core.flattenConnection(w?.data?.products):void 0,z=d&&_?_:"PickProduct"===I&&i?.productIds?.length?i?.productIds?.map(e=>$?.find(t=>t?.baseID===e)).filter(Boolean)??$:"PickProduct"!==I?$:$.filter((e,t)=>t<(i?.numOfSelectedProducts??4)),V=React.useMemo(()=>R&&d&&c||!z.length&&!D&&p&&c,[p,D,R,d,c,z.length]),U=React.useMemo(()=>!z||R&&d,[R,d,z]),J=React.useMemo(()=>{if(!s?.sameHeight)return[];let e=0,t=Math.ceil((z?.length??0)/+(s?.slidesToShow?.[n]??1));return Array.from(Array(z?.length??0)).map((o,a)=>(a>=+(s?.slidesToShow?.[n]??1)*(e+1)&&++e,{gridRow:`${1+P*e}/${P+1+P*e}`,marginBottom:e+1<t?helpers$1.getPropertyByDevice(r?.horizontalGutter,n):void 0}))},[s?.sameHeight,s?.slidesToShow,P,z?.length,n,r?.horizontalGutter]),K=React.useMemo(()=>B||D||A||!z||R&&d,[A,D,R,d,B,z]);React.useEffect(()=>{K||setTimeout(()=>{let{builderData:e}=o??{},t=e?.childrens?.[0];if(!t)return;let r=document.querySelector(`[data-id=${t}] div`);r&&j(r.childElementCount||1)},c?0:500)},[o,K,c]);let X=React.useMemo(()=>({collection:H,products:z,settings:{loop:s?.loop??{desktop:!1},scrollMode:s?.scrollMode??{desktop:"snap"},slidesToShow:s?.slidesToShow??{desktop:4,tablet:3,mobile:1},layout:r?.layout,dot:s?.dot,dotStyle:s?.dotStyle,arrow:s?.arrow,controlOverContent:s?.controlOverContent},styles:{horizontalGutter:r?.horizontalGutter,verticalGutter:r?.verticalGutter,fullWidth:r?.fullWidth,spacing:r?.spacing,width:r?.width,height:r?.height}}),[H,z,s,r]);if(o?.isPreview&&b)return jsxRuntime.jsx(jsxRuntime.Fragment,{});if(V)return jsxRuntime.jsx(jsxRuntime.Fragment,{children:system.If(p,jsxRuntime.jsx(ProductNotFound,{builderAttrs:a,collectionHandle:H?.handle,productSrc:I,onClose:()=>x(!1),children:t,relatedTagString:l,assignProductNoTags:M,noAssignedProduct:!S}))});let{productListWrapStyle:Y,productListContentStyle:Z,productListWrapAlignStyle:ee}=styles.getStyle(e),{productListWrapClass:et}=classes.getClass(e),er=()=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:system.If(r?.layout==="grid",jsxRuntime.jsx(ProductListGridLayout.default,{...e,productSortedById:z,generateGridRowArray:J}),jsxRuntime.jsx(ProductListCarouselLayout.default,{...e,productSortedById:z}))});return jsxRuntime.jsxs("div",{...a,className:et,style:Y,children:[!!r?.preloadBgImage&&jsxRuntime.jsxs(Head,{children:[!!r.backgroundImage?.desktop?.image?.src&&jsxRuntime.jsx("link",{rel:"preload",href:r.backgroundImage.desktop.image.src,as:"image"}),!!r.backgroundImage?.tablet?.image?.src&&jsxRuntime.jsx("link",{rel:"preload",href:r.backgroundImage?.tablet?.image?.src,as:"image"}),!!r.backgroundImage?.mobile?.image?.src&&jsxRuntime.jsx("link",{rel:"preload",href:r.backgroundImage?.mobile?.image?.src,as:"image"})]}),B||D?jsxRuntime.jsx(Loading.default,{}):A?jsxRuntime.jsxs("div",{children:["Error: ",A?.message]}):U?jsxRuntime.jsx("div",{children:"Products not found"}):jsxRuntime.jsx(core.ProductListProvider,{...X,children:jsxRuntime.jsx("div",{className:"gp-flex gp-w-full",style:ee,children:jsxRuntime.jsxs("div",{style:Z,children:[b&&jsxRuntime.jsx(SalePageProductListWarning.default,{}),er()]})})}),core.filterToolbarPreview(t,!0)]})};exports.default=ProductList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),common=require("../../product-variants/common/common.js"),core=require("@gem-sdk/core");const useGpPrice=e=>{let{setting:r,builderProps:
|
|
1
|
+
"use strict";var React=require("react"),common=require("../../product-variants/common/common.js"),core=require("@gem-sdk/core");const useGpPrice=e=>{let{setting:r,builderProps:t}=e,c=React.useRef(null),o=core.useEditorMode(),{quantity:u,hasUpdatePrice:i}=core.useQuantity(),a=core.useCurrentVariant(),{useProductCompareAtPrice:n}=core.useProductBundleDiscount(),s=e["bundle-item"],d=a?.price??0,p=a?.salePrice??0,l=r?.priceType==="compare",{trigger:m}=core.useInteraction(),g=core.useProduct(),y=g?.baseID?.replace("gid://shopify/Product/",""),P=core.useShopStore(e=>e.showPriceCurrency),h=React.useMemo(()=>s?.quantity?s.quantity:i&&u||1,[u,i,s?.quantity]),b=React.useMemo(()=>{let e=Number(s?.discountValue);return s?.discountType==="percentage"?d*h*e/100:e},[s?.discountType,s?.discountValue,d,h]),v=React.useMemo(()=>s?.discountValue?n?(p||d)*h:d*h:p*h,[s?.discountValue,d,h,p,n]),M=React.useMemo(()=>{let e=d*h;return l?v:b?Math.max(0,e-b):e},[d,h,b,v,l]),R=(e,r)=>{m({event:"price"===r?"gp:rollback:price-change":"gp:rollback:compare-price-change",selector:`[data-id="${t?.uid}"]`,element:c.current}),m({event:"price"===r?"gp:price-change":"gp:compare-price-change",data:e,selector:`[data-id="${t?.uid}"]`,element:c.current})};common.useTransition(e=>{e!==d&&R(d,"price")},[d]),common.useTransition(e=>{e!==p&&R(p,"compare")},[p]);let q=()=>{if("edit"!==o)return;let e=new CustomEvent("editor:product-source-no-data-warning",{bubbles:!0,detail:{uid:t?.uid,value:!M&&l,tag:"ProductPrice"}});window.dispatchEvent(e)},w=core.useFormatMoney(M??0,P||!1),T=l&&!M,V="edit"!==o&&T;return{elementRef:c,moneyFormatted:w,currentProductId:y,isNoComparePrice:T,isNoComparePriceILP:V,emitNoDataSignal:q}};exports.useGpPrice=useGpPrice;
|
|
@@ -1,8 +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")
|
|
2
|
-
|
|
3
|
-
${system.
|
|
4
|
-
${system.Liquid(`{%- assign presets = "${V()}" | split: '($1)' -%}`)}
|
|
5
|
-
${system.Liquid(`{% assign hiddenPresetOptions = "${D()}" | split: ',' %}`)}
|
|
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");const DEFAULT_ADVANCED_DISPLAY_SETTING={desktop:!0,tablet:!0,mobile:!0},ProductVariants=e=>{let{builderProps:s,styles:t,setting:i,advanced:a}=e,{align:o,swatchItemWidth:n,dropdownItemWidth:r,swatchSpacing:l,optionTypo:p,marginBottom:d}=t??{},{label:u,optionType:m,showAsSwatches:c,layout:y,hasPreSelected:g}=i??{},$=a?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:v}=s??{},q="groupOption"===m,f=()=>{let e={};return core.DEVICES.forEach(s=>{let t=core.getResponsiveValueByScreen(n,s);e[s]="auto"===t}),e},_=()=>{let e={};return core.DEVICES.forEach(s=>{e[s]=r?.[s]==="fill"}),e},L=core.composeMemo(()=>{let e=mappingVariantStyles.mappingVariantStyles(i?.variantPresets,t);return{...i,variantPresets:e}},[i?.variantPresets,t]),S=e=>{let s={"'":"'",'"':"""},t=e;for(let i in s)e.indexOf(i)>=0&&(t=t.replaceAll(i,s[i]));return t},I=()=>i?.variantPresets?.map(e=>`${S(e.optionName)}($2)${e.optionType}`).join("($1)"),V=()=>i?.variantPresets?.filter(e=>!!e?.hide)?.map(e=>e.optionName).join(","),h=system.createClass(classes.getVariantOptionGroupClass(o)),j=system.createStyle(styles.getVariantOptionGroupStyle(l,l)),w=getData.getTextVariantTitleData(e,"Liquid"),A=system.createClass(classes$1.getWrapVariantOptionClass(y,o)),b=()=>core.template`
|
|
2
|
+
${system.Liquid(`{%- assign presets = "${I()}" | split: '($1)' -%}`)}
|
|
3
|
+
${system.Liquid(`{% assign hiddenPresetOptions = "${V()}" | split: ',' %}`)}
|
|
6
4
|
|
|
7
5
|
${system.Liquid(`{% assign all_option_names = options | map: 'name' %}
|
|
8
6
|
{% assign filtered_options_string = '' %}
|
|
@@ -32,7 +30,7 @@
|
|
|
32
30
|
${system.LiquidFor("option in options",`
|
|
33
31
|
<div
|
|
34
32
|
option-name="{{option.name | escape}}"
|
|
35
|
-
class="${
|
|
33
|
+
class="${A} ${system.LiquidIf("hiddenPresetOptions contains option.name","gp-hidden")}"
|
|
36
34
|
style="${_function.getStyleOfObject(styles$1.getMarginBottomStyle(d))}${system.Liquid("{% if forloop.last or option.name == last_option_name %}--mb:0;--mb-mobile:0;--mb-tablet:0;{% endif %}")}"
|
|
37
35
|
>
|
|
38
36
|
${system.Liquid("{%- assign showVariantClass = 'variant-display' -%}")}
|
|
@@ -41,11 +39,11 @@
|
|
|
41
39
|
${system.Liquid("{%- assign presetDetail = preset | split: '($2)' -%}")}
|
|
42
40
|
${system.LiquidIf("presetDetail[1] == 'dropdown' and presetDetail[0] == optionName",`${system.Liquid("{%- assign showVariantClass = '' -%}")} ${system.Liquid("{%- break -%}")}`)}
|
|
43
41
|
`)}
|
|
44
|
-
${system.If(u,Text_liquid.default(
|
|
42
|
+
${system.If(u,Text_liquid.default(w)," ")}
|
|
45
43
|
<div
|
|
46
44
|
variant-option-name="{{option.name | escape}}"
|
|
47
|
-
class="${
|
|
48
|
-
style="${_function.getStyleOfObject(
|
|
45
|
+
class="${h}"
|
|
46
|
+
style="${_function.getStyleOfObject(j)}"
|
|
49
47
|
>
|
|
50
48
|
${system.Liquid("{%- assign values = option.values -%}")}
|
|
51
49
|
${system.Liquid("{%- assign rootForloop = forloop.index0 -%}")}
|
|
@@ -58,22 +56,76 @@
|
|
|
58
56
|
{%- assign selectedValue = variant.option3 -%}
|
|
59
57
|
{%- endif -%}
|
|
60
58
|
`)}
|
|
61
|
-
${system.If(!
|
|
62
|
-
${system.If(c,
|
|
59
|
+
${system.If(!g,system.Liquid("{%- assign selectedValue = null -%}"),"")}
|
|
60
|
+
${system.If(c,P(),T())}
|
|
63
61
|
</div>
|
|
64
62
|
</div>`)}
|
|
65
|
-
`,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
`,D=i?.variantPresets?.map(e=>({name:S(e.optionName),type:e.optionType})).map(e=>`${e.name}($1)${e.type}`).join("($2)").toString(),P=()=>core.template`
|
|
64
|
+
${system.Liquid("{%- assign optionRendered = false -%}")}
|
|
65
|
+
${system.Liquid("{%- assign swatches = shop.metafields.GEMPAGES.swatches -%}")}
|
|
66
|
+
${system.Liquid("{%- assign swatchesItems = swatches | split: '($1)' -%}")}
|
|
67
|
+
|
|
68
|
+
${system.LiquidFor("swatchesItem in swatchesItems",`
|
|
69
|
+
${system.Liquid('{%- assign colorArraysString = "" -%}')}
|
|
70
|
+
${system.Liquid('{%- assign labelsString = "" -%}')}
|
|
71
|
+
${system.Liquid('{%- assign imageUrlsString = "" -%}')}
|
|
72
|
+
${system.Liquid("{%- assign attrItems = swatchesItem | split: '($3)' -%}")}
|
|
73
|
+
|
|
74
|
+
${system.LiquidFor("attrItem in attrItems",`${system.Liquid("{%- assign attrs = attrItem | split: '($2)' -%}")}
|
|
75
|
+
${system.Liquid("{%- assign optionKey = attrs[0] -%}")}
|
|
76
|
+
${system.Liquid("{%- assign optionValue = attrs[1] -%}")}
|
|
77
|
+
${system.Liquid(`
|
|
78
|
+
{% if optionKey == 'optionTitle' %}
|
|
79
|
+
{% assign optionTitle = optionValue %}
|
|
80
|
+
{% elsif optionKey == 'optionType' %}
|
|
81
|
+
{% assign optionType = optionValue %}
|
|
82
|
+
{% endif %}
|
|
83
|
+
`)}
|
|
84
|
+
|
|
85
|
+
${system.LiquidIf("optionKey == 'optionValues'",`${system.Liquid("{%- assign opValueItems = optionValue | split: '($4)' -%}")}
|
|
86
|
+
${system.LiquidFor("opValueItem in opValueItems",`${system.Liquid("{%- assign opValueItemAttrs = opValueItem | split: '($6)' -%}")}
|
|
87
|
+
${system.LiquidFor("opValueItemAttr in opValueItemAttrs",`${system.Liquid("{%- assign attrs = opValueItemAttr | split: '($5)' -%}")}
|
|
88
|
+
${system.Liquid("{%- assign opValueItemKey = attrs[0] -%}")}
|
|
89
|
+
${system.Liquid("{%- assign opValueItemValue = attrs[1] -%}")}
|
|
90
|
+
|
|
91
|
+
${system.LiquidIf("opValueItemKey == 'label'",`${system.Liquid("{%- assign labelsString = labelsString | append: opValueItemValue -%}")}${system.Liquid('{%- assign labelsString = labelsString | append: "($8)" -%}')}`)}
|
|
92
|
+
|
|
93
|
+
${system.LiquidIf("opValueItemKey == 'colors'",`${system.Liquid("{%- assign colorArraysString = colorArraysString | append: opValueItemValue -%}")}${system.Liquid('{%- assign colorArraysString = colorArraysString | append: "($8)" -%}')}`)}
|
|
94
|
+
|
|
95
|
+
${system.LiquidIf("opValueItemKey == 'imageUrl'",`${system.Liquid("{%- assign imageUrlsString = imageUrlsString | append: opValueItemValue -%}")}${system.Liquid('{%- assign imageUrlsString = imageUrlsString | append: "($8)" -%}')}`)}`)}`)}`)}
|
|
96
|
+
`)}
|
|
97
|
+
|
|
98
|
+
${system.Liquid("{%- assign labels = labelsString | split: '($8)' -%}")}
|
|
99
|
+
${system.Liquid("{%- assign colorStrings = colorArraysString | split: '($8)' -%}")}
|
|
100
|
+
${system.Liquid("{%- assign imageUrls = imageUrlsString | split: '($8)' -%}")}
|
|
101
|
+
|
|
102
|
+
${system.LiquidIf("optionTitle == option.name",`
|
|
103
|
+
${system.Liquid(`{%- assign variantPresetString = "${D}" -%}`)}
|
|
104
|
+
${system.Liquid('{%- assign optionName = option.name | replace: "\'", "'" | replace: \'"\', """ -%}')}
|
|
105
|
+
${system.Liquid("{%- assign items = variantPresetString | split:'($2)' -%}")}
|
|
106
|
+
${system.Liquid("{%- assign type = 'dropdown' -%}")}
|
|
107
|
+
${system.LiquidFor("item in items",`
|
|
108
|
+
${system.Liquid("{%- assign itemPreset = item | split:'($1)' -%}")}
|
|
109
|
+
${system.LiquidIf("itemPreset[0] == optionName",system.Liquid("{%- assign type = itemPreset[1] -%}"))}
|
|
110
|
+
${system.LiquidIf('itemPreset[0] == "base"',system.Liquid("{%- assign type = itemPreset[1] -%}"))}
|
|
111
|
+
`)}
|
|
112
|
+
${system.Liquid("{%- assign optionRendered = true -%}")}
|
|
113
|
+
${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:v,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:g?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",optionType:"optionType",activeClass:g?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...t,...L,swatchAutoWidth:f(),optionTypo:p}))}
|
|
114
|
+
${system.LiquidIf("type == 'dropdown'",Dropdown_liquid.default({...t,...L,swatchAutoWidth:_(),optionTypo:p}))}
|
|
115
|
+
`)}
|
|
116
|
+
`)}
|
|
117
|
+
|
|
118
|
+
${system.LiquidIf("optionRendered == false",T())}
|
|
119
|
+
`,T=()=>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:v,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:g?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:"optionType",activeClass:g?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...t,...L,swatchAutoWidth:f(),optionTypo:p,isRenderDefault:!0})),x=system.createClass(classes.getWrapDropdownClass(o)),O=getData.getDropdownGroupData(e),C=()=>`
|
|
120
|
+
<div className="${x}">
|
|
121
|
+
${DropdownGroup_liquid.default(O)}
|
|
70
122
|
</div>
|
|
71
|
-
`,
|
|
123
|
+
`;system.createStateOrContext({setting:L,styles:JSON.stringify(t),variants:"{{ product.variants | json | escape }}",optionsWithValues:"{{ product.options_with_values | json | escape }}",variantSelected:"{{ variant | json | escape }}",variantInventoryQuantity:"{{ product.variants | map: 'inventory_quantity' | json | escape }}",variantInventoryPolicy:"{{ product.variants | map: 'inventory_policy' | json | escape }}",moneyFormat:"{{ shop.money_format | json | escape }}",productId:"{{ product.id | json | escape }}",productUrl:"{{ product.url | json | escape }}",productHandle:"{{ product.handle | json | escape }}",displayState:`${JSON.stringify($)}`,totalVariantCombinations:"{{ total_combinations }}",firstAvailableVariant:"{{ product.selected_or_first_available_variant | json | escape }}"});let E=system.createAttr(getAttr.getAttrs({uid:v,hasPreSelected:g,cssClass:a?.cssClass})),N=system.createStyle(styles.getWrapperStyle(e)),F=system.createClass({"gp-flex gp-flex-col !gp-ml-0":!0}),U=()=>{let e=core.isLocalEnv?"{{ 'gp-product-variant-v7-5.js' | asset_url }}":`${core.baseAssetURL}/assets-v2/gp-product-variant-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`};return core.template`
|
|
72
124
|
<gp-product-variants
|
|
73
|
-
${
|
|
125
|
+
${E}
|
|
74
126
|
gp-data='{
|
|
75
|
-
"setting":${JSON.stringify(
|
|
76
|
-
"styles":${JSON.stringify(
|
|
127
|
+
"setting":${JSON.stringify(L)?.replaceAll("'","'")},
|
|
128
|
+
"styles":${JSON.stringify(t)},
|
|
77
129
|
"variants":{{product.variants | json | escape}},
|
|
78
130
|
"optionsWithValues": {{product.options_with_values | json | escape}},
|
|
79
131
|
"variantSelected": {{ variant | json | escape }},
|
|
@@ -83,7 +135,7 @@
|
|
|
83
135
|
"productId": {{product.id | json | escape}},
|
|
84
136
|
"productUrl": {{product.url | json | escape}},
|
|
85
137
|
"productHandle": {{product.handle | json | escape}},
|
|
86
|
-
"displayState": ${JSON.stringify(
|
|
138
|
+
"displayState": ${JSON.stringify($)},
|
|
87
139
|
"totalVariantCombinations": {{total_combinations}},
|
|
88
140
|
"firstAvailableVariant": {{product.selected_or_first_available_variant | json | escape}}
|
|
89
141
|
}
|
|
@@ -92,12 +144,12 @@
|
|
|
92
144
|
${system.Liquid("{%- assign options = product.options_with_values -%}")}
|
|
93
145
|
${system.Liquid("{%- assign variants = product.variants -%}")}
|
|
94
146
|
${system.LiquidIf("options.size == 0 or options.size == 1 and variants.size == 1 and variants[0].title == 'Default Title' and variants[0].option1 == 'Default Title'","<div></div>",core.template`<div
|
|
95
|
-
class="${
|
|
96
|
-
style="${
|
|
147
|
+
class="${F}"
|
|
148
|
+
style="${N}"
|
|
97
149
|
>
|
|
98
|
-
${system.If(
|
|
150
|
+
${system.If(q,C(),b())}
|
|
99
151
|
</div>`)}
|
|
100
152
|
</gp-product-variants>
|
|
101
153
|
|
|
102
|
-
${
|
|
154
|
+
${U()}
|
|
103
155
|
`};exports.default=ProductVariants;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),helpers=require("../../../../../helpers.js");const getColorStyleWidth=e=>{let t=e?.height||"32px",o=e?.width||{desktop:t},r=Object.fromEntries(Object.entries(o).map(([e,o])=>{let r=o&&"undefined"!==o&&"auto"!==o?o:t;return[e,r]}));return core.makeStyleResponsive("minw",r)},getWrapperStyleActive=e=>{let{preset:t,optionTypography:o,optionTypo:r,typeOfOption:l}=e,a=t?.optionBgColor,p=t?.optionTextColor,i=t?.optionBorder,n=t?.optionHasShadow,c=t?.optionShadow,d=t?.optionRounded,h="color"===l,s="image"===l||"image_shopify"===l,y=core.composeTypographyStyle(r,o),S=e=>{let t=a?.active??a?.normal,o=i?.active??i?.normal;return core.makeStyle({bg:e&&core.getSingleColorVariable(t),bs:o?.border,bw:o?.width,bc:core.getSingleColorVariable(o?.color)})},g=c?.active??c?.normal,
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),helpers=require("../../../../../helpers.js");const getColorStyleWidth=e=>{let t=e?.height||"32px",o=e?.width||{desktop:t},r=Object.fromEntries(Object.entries(o).map(([e,o])=>{let r=o&&"undefined"!==o&&"auto"!==o?o:t;return[e,r]}));return core.makeStyleResponsive("minw",r)},getWrapperStyleActive=e=>{let{preset:t,optionTypography:o,optionTypo:r,typeOfOption:l}=e,a=t?.optionBgColor,p=t?.optionTextColor,i=t?.optionBorder,n=t?.optionHasShadow,c=t?.optionShadow,d=t?.optionRounded,h="color"===l,s="image"===l||"image_shopify"===l,y=core.composeTypographyStyle(r,o),S=e=>{let t=a?.active??a?.normal,o=i?.active??i?.normal;return core.makeStyle({bg:e&&core.getSingleColorVariable(t),bs:o?.border,bw:o?.width,bc:core.getSingleColorVariable(o?.color)})},g=c?.active??c?.normal,b=n?.active??n?.normal,u=p?.active??p?.normal;return helpers.filterTruthyObject({...S(!h),...core.getRadiusStyleActiveState(d),...core.getStyleShadow({value:g,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:b},!0),...y,...!h&&!s&&core.makeStyle({c:core.getSingleColorVariable(u)}),...h&&getColorStyleWidth(t),...core.makeStyle({h:t?.height})})},getWrapperStyleNormalAndHover=e=>{let{preset:t,optionTransform:o,optionTypography:r,optionTypo:l,typeOfOption:a}=e,p=t?.optionBgColor,i=t?.optionTextColor,n=t?.optionBorder,c=t?.optionHasShadow,d=t?.optionShadow,h=t?.optionRounded,s="color"===a,y="image"===a||"image_shopify"===a,S=["normal","hover"].reduce((e,t)=>({...e,...core.getStyleShadow({value:d?.[t],state:t,styleAppliedFor:"box-shadow",isEnableShadow:c?.[t]})}),{});return helpers.filterTruthyObject({...core.composeRadius(h),...S,...!s&&core.getGlobalColorStateStyle("bg",p),...!s&&core.handleConvertBorderStyle(n),...!s&&core.handleConvertBorderWidth(n),...!s&&core.handleConvertBorderColor(n),...!s&&!y&&core.makeStyle({c:o}),...!s&&!y&&core.getGlobalColorStateStyle("c",i),...typoStyleNotIn(l,r,["--c"]),...s&&getColorStyleWidth(t),...core.makeStyle({h:t?.height})})};function typoStyleNotIn(e,t,o){let r=core.composeTypographyStyle(e,t);return o&&0!==o.length?Object.fromEntries(Object.entries(r).filter(([e])=>!o.includes(e))):r}const getWrapperTextStyle=e=>{let{preset:t,typeOfOption:o,checked:r}=e,l=t?.optionBorder,a=t?.optionRounded,p="color"===o,i=()=>{let e="16px",o={"--pl":"0px","--pr":"0px","--pl-tablet":"0px","--pr-tablet":"0px","--pl-mobile":"0px","--pr-mobile":"0px","--pt":"0px","--pb":"0px"};return t?.width?.desktop?.toLowerCase()!=="auto"&&t?.width?.desktop||(o["--pl"]=e,o["--pr"]=e),t?.width?.tablet?.toLowerCase()!=="auto"&&t?.width?.tablet||(o["--pl-tablet"]=e,o["--pr-tablet"]=e),t?.width?.mobile?.toLowerCase()!=="auto"&&t?.width?.mobile||(o["--pl-mobile"]=e,o["--pr-mobile"]=e),(t?.height?.toLowerCase()==="auto"||t?.height)&&(o["--pt"]="8px",o["--pb"]="8px"),o},n={...a,active:{...a?.active||{},radiusType:"custom"}},c=r?core.getRadiusStyleActiveState(n):core.composeRadius(a),d=!r&&p?{...core.handleConvertBorderStyle(l),...core.handleConvertBorderWidth(l),...core.handleConvertBorderColor(l)}:{};return helpers.filterTruthyObject({...!p&&i(),...p&&c,...d})},getColorStyle=({optionBorder:e,optionRounded:t,isActive:o,color:r})=>{let l=()=>r?r?.startsWith("linear-gradient")?{backgroundImage:r}:{backgroundColor:r}:{},a=t=>t?{"--bs":"none"}:core.handleConvertBorderStyle(e),p=o=>({"--d":"flex","--jc":"center"," --ai":"center","--w":"100%","--h":"100%","--of":"hidden",...a(o),...core.handleConvertBorderWidth(e),...core.handleConvertBorderColor(e),...core.composeRadius(t),...l()});return p(!!o)},getTextStyle=({optionTypo:e,optionTypography:t})=>{let o=core.composeTypographyStyle(e,t);return delete o["--c"],helpers.filterTruthyObject({...o})};exports.getColorStyle=getColorStyle,exports.getTextStyle=getTextStyle,exports.getWrapperStyleActive=getWrapperStyleActive,exports.getWrapperStyleNormalAndHover=getWrapperStyleNormalAndHover,exports.getWrapperTextStyle=getWrapperTextStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),base_liquid=require("../base/base.liquid.js"),mappingVariantStyles=require("../../utils/mappingVariantStyles.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),base_liquid=require("../base/base.liquid.js"),mappingVariantStyles=require("../../utils/mappingVariantStyles.js");const ColorVariant=({isVariantOutStock:e,swatchValue:o,...i})=>core.template`
|
|
2
2
|
{% assign colorsString = null %}
|
|
3
3
|
{% assign colors = null %}
|
|
4
4
|
{% for label in labels %}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{% endif %}
|
|
8
8
|
{% endfor %}
|
|
9
9
|
{% if colorsString != null %}
|
|
10
|
-
{% assign colors = colorsString | split: '$
|
|
10
|
+
{% assign colors = colorsString | split: '($7)' %}
|
|
11
11
|
{% endif %}
|
|
12
|
-
${base_liquid.default({...
|
|
12
|
+
${base_liquid.default({...i,typeOfOption:"color",optionRounded:mappingVariantStyles.optionRoundedColorDefault})}
|
|
13
13
|
`;exports.default=ColorVariant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),productBundle=require("../components/constants/product-bundle.js");const noDiscount=e=>({discountPercentAmount:0,discountAmount:core.formatMoney("0",e)}),applyBundleDiscountAmount=e=>{let{currentVariant:t,bundleItem:
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),productBundle=require("../components/constants/product-bundle.js");const noDiscount=e=>({discountPercentAmount:0,discountAmount:core.formatMoney("0",e)}),applyBundleDiscountAmount=e=>{let{currentVariant:t,bundleItem:n,options:o}=e;if(!o?.useProductCompareAtPrice&&n?.discountType===productBundle.DiscountType.NoDiscount||!n||!t?.price)return noDiscount(o?.moneyFormat||"${{amount}}");let u=Number(t?.price),c=Number(t?.salePrice)||u,r=Number(n?.quantity),i=calculateBundleFixedDiscount(u,n),a=discountPercentAmount(i,r*u),d=u*r-i,s=c*r;return c<=u&&i<=0?noDiscount(o?.moneyFormat||"${{amount}}"):{discountPercentAmount:o?.useProductCompareAtPrice?calculateDiffPercentPrice(d,s):a,discountAmount:o?.useProductCompareAtPrice?calculateDiffFixedPrice(d,s,o?.moneyFormat):core.formatMoney(i.toString(),o?.moneyFormat)}},calculateDiffPercentPrice=(e,t)=>{let n=(t-e)/t*100;return Math.round(n)},calculateDiffFixedPrice=(e,t,n)=>core.formatMoney((t-e).toString(),n),calculateBundleFixedDiscount=(e,t)=>{let n=parseInt(t?.discountValue);return t?.discountType===productBundle.DiscountType.Percentage?e*t.quantity*n/100:t?.discountType===productBundle.DiscountType.FixedAmount?n:0},discountPercentAmount=(e,t)=>Math.round(e/t*100);exports.applyBundleDiscountAmount=applyBundleDiscountAmount;
|