@gem-sdk/components 17.0.0-dev.19 → 17.0.0-dev.21
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/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/video/common/helpers.js +1 -1
- package/dist/cjs/video/components/LiteYouTubeEmbed.liquid.js +11 -11
- 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/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/video/common/helpers.js +1 -1
- package/dist/esm/video/components/LiteYouTubeEmbed.liquid.js +12 -12
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@gem-sdk/core"),s=require("react"),i=require("../../text/components/Text.js"),o=require("../hooks/useDynamicProduct.js"),t=require("../../../common/components/TooltipHover.js"),l=require("../helpers/product-price-breakdown/getPrice.js"),n=require("../hooks/useSubscriptionSellingType.js");exports.default=({styles:u,style:a,builderAttrs:p,builderProps:c,children:d,setting:g})=>{let m=r.useCurrentVariant(),f=r.useProduct(),{isOneTime:y}=n.useSubscriptionSellingType(),P=r.useProductStore(e=>e.selectedSellingPlan),h=r.convertDecimalToNumber(m?.price)??0,x=r.convertDecimalToNumber(m?.salePrice)??0,b=parseFloat(r.shopifyPriceRounding(r.useProductOfferDiscount(),2)),{isDynamicProduct:j}=o.useDynamicProduct(),{t:N}=r.useI18nStore(),{isEditMode:S}=r.useRenderMode(),{quantity:D,hasUpdatePrice:M}=r.useQuantity(),{priceType:q,source:v}=g??{},T=s.useMemo(()=>M&&D||1,[D,M]),k="compare"===q,F="offer"===q,R="price"===v,O="compare-price"===v,w=m?.sellingPlanGroups,G=f?.sellingPlanGroups,I=s.useMemo(()=>{if(!P||y)return null;let e=m?.sellingPlanGroups??f?.sellingPlanGroups??[];for(let r of e)if(r?.sellingPlans){for(let e of r.sellingPlans)if(e?.baseID===P)return e}return null},[JSON.stringify(w),JSON.stringify(G),P,y]),J=JSON.stringify(I?.pricingPolicies),$=I?.baseID,_=s.useMemo(()=>!I||h<=0||y?0:l.calculateSellingPlanDiscount({variantPrice:h,pricingPolicies:I.pricingPolicies}),[J,h,y]),C=s.useMemo(()=>{let e=F&&!y&&P&&$;if(e){let e=parseFloat(r.shopifyPriceRounding(h-_,2)),s=parseFloat(r.shopifyPriceRounding(e-b,2));return s>0?s:0}let s=parseFloat(r.shopifyPriceRounding(h-b,2));return s>0?s:0},[F,y,P,$,h,_,b]),H=s.useMemo(()=>k?R?h:x:F?C:h,[k,R,F,h,x,C]),Q=s.useMemo(()=>H*T,[H,T]),V=r.useFormatMoney(parseFloat(r.shopifyPriceRounding(Number(Q)||0,2)),!1),z=f?.baseID?.replace("gid://shopify/Product/",""),A=s.useMemo(()=>k&&(!b&&x<h||O&&!x||R&&h<=0),[k,b,h,x,O,R]);return(!H&&!F||A)&&S?e.jsx(t.default,{enable:!0,text:N("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:N("No compare price")})})}):A&&!S?null:e.jsxs("div",{...p,className:r.cls(c?.uid),style:{...a},id:`shopify-text-element-${c?.uid}`,"data-product-id":z,children:[e.jsx(i.default,{styles:u,setting:{text:j?"$???":V},className:r.cls({"gp-money":F,"gp-product-compare-price":k,"gp-line-through":k&&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("@gem-sdk/system"),r=require("../helpers/product-quantity/getStyles.js"),l=require("../hooks/useHandleQuantity.js");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("@gem-sdk/system"),r=require("../helpers/product-quantity/getStyles.js"),l=require("../hooks/useHandleQuantity.js"),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}=l.useHandleQuantity(o,C,i),h=s.useCurrentVariantInStock(),q=a.createClass(t.getWrapperClasses(p)),x=a.createClass(t.getContainerClasses()),f=a.createClass(t.getWrapperInputClasses()),v=a.createClass(t.getLabelClasses()),b=a.createClass(t.getInputClasses()),N=a.createStyle({...r.getWrapperStyles(c)});return u.useEffect(()=>{m(d)},[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,onBlur:g,onChange:j})]})})})};
|
|
@@ -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 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@gem-sdk/core"),t=require("../../helpers.js"),o=require("../settings/configs/translate.js");const i=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=|shorts\/)|youtu\.be\/)([^"&?/\s]{11})/i;exports.covertStrParamsToObj=e=>{let t=e.split("&");return t.shift(),t.reduce((e,t)=>{let[o,i]=t.split("=");return"loop"!==o&&(e[o]=i),e},{})},exports.fallbackImageVideoUrl="https://cdn.shopify.com/s/files/1/0703/5214/2562/files/gempages_518090459516502570-3d3a4631-1d7d-4a2f-9ef0-9bbe7220e02d.jpg",exports.getAspectRatioSettings=(t,o)=>{let i={desktop:t?.desktop?.width,tablet:t?.tablet?.width,mobile:t?.mobile?.width},s={desktop:t?.desktop?.height,tablet:t?.tablet?.height,mobile:t?.mobile?.height},r={desktop:o?.desktop==="custom"?`${e.getResponsiveValueByScreen(i,"desktop")}/${e.getResponsiveValueByScreen(s,"desktop")}`:o?.desktop==="cover"?"unset":o?.desktop,tablet:o?.tablet==="custom"?`${e.getResponsiveValueByScreen(i,"tablet")}/${e.getResponsiveValueByScreen(s,"tablet")}`:o?.tablet==="cover"?"unset":o?.tablet,mobile:o?.mobile==="custom"?`${e.getResponsiveValueByScreen(i,"mobile")}/${e.getResponsiveValueByScreen(s,"mobile")}`:o?.mobile==="cover"?"unset":o?.mobile};return r},exports.getSettingTranslatedVideoAndThumbnail=({setting:i,uid:s,pageContext:r})=>{if(!i||!s)return{};if(r?.isPreviewing)return i;let l=e.cloneDeep(i);if(l.youtubeUrl&&"youtube"===l.type){let e=t.getDynamicSourceLocales({val:l.youtubeUrl,uid:s,settingId:t.createSettingId({id:o.Video?.youtubeUrl?.id}),pageContext:r});l.youtubeUrlTranslated=String(e)}if(l.vimeoUrl&&"vimeo"===l.type){let e=t.getDynamicSourceLocales({val:l.vimeoUrl,uid:s,settingId:t.createSettingId({id:o.Video?.vimeoUrl?.id}),pageContext:r});l.vimeoUrlTranslated=String(e)}if(l.html5Url&&"html5"===l.type){let e=t.getDynamicSourceLocales({val:l.html5Url,uid:s,settingId:t.createSettingId({id:o.Video?.html5Url?.id}),pageContext:r});l.html5Url=String(e)}if(l.poster){let e=t.getDynamicSourceLocales({val:l.poster?.src,uid:s,settingId:o.Video?.poster?.id?`${o.Video.poster.id}_src`:"",pageContext:r});l.poster.src=String(e)}return l},exports.getVimeoParams=e=>{let{id:t,autoplay:o,muted:i,controls:s,loop:r,lazy:l}=e,a=encodeURIComponent(t),p=`?&autoplay=${l?1:o?1:0}&muted=${i?1:0}&loop=${r?1:0}&controls=${s}&autopause=false`,n=`https://player.vimeo.com/video/${a}${p}`;return{videoId:a,params:p,iframeSrc:n}},exports.getVimeoVideoId=e=>e.match(/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/|video\/)?(\d+)(?:$|\/|\?)/)?.[3],exports.getYoutubeParams=e=>{let{id:t,params:o,muted:i,webp:s,controls:r,adNetwork:l,autoplay:a,lazy:p}=e,
|
|
1
|
+
"use strict";var e=require("@gem-sdk/core"),t=require("../../helpers.js"),o=require("../settings/configs/translate.js");const i=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=|shorts\/)|youtu\.be\/)([^"&?/\s]{11})/i;exports.covertStrParamsToObj=e=>{let t=e.split("&");return t.shift(),t.reduce((e,t)=>{let[o,i]=t.split("=");return"loop"!==o&&(e[o]=i),e},{})},exports.fallbackImageVideoUrl="https://cdn.shopify.com/s/files/1/0703/5214/2562/files/gempages_518090459516502570-3d3a4631-1d7d-4a2f-9ef0-9bbe7220e02d.jpg",exports.getAspectRatioSettings=(t,o)=>{let i={desktop:t?.desktop?.width,tablet:t?.tablet?.width,mobile:t?.mobile?.width},s={desktop:t?.desktop?.height,tablet:t?.tablet?.height,mobile:t?.mobile?.height},r={desktop:o?.desktop==="custom"?`${e.getResponsiveValueByScreen(i,"desktop")}/${e.getResponsiveValueByScreen(s,"desktop")}`:o?.desktop==="cover"?"unset":o?.desktop,tablet:o?.tablet==="custom"?`${e.getResponsiveValueByScreen(i,"tablet")}/${e.getResponsiveValueByScreen(s,"tablet")}`:o?.tablet==="cover"?"unset":o?.tablet,mobile:o?.mobile==="custom"?`${e.getResponsiveValueByScreen(i,"mobile")}/${e.getResponsiveValueByScreen(s,"mobile")}`:o?.mobile==="cover"?"unset":o?.mobile};return r},exports.getSettingTranslatedVideoAndThumbnail=({setting:i,uid:s,pageContext:r})=>{if(!i||!s)return{};if(r?.isPreviewing)return i;let l=e.cloneDeep(i);if(l.youtubeUrl&&"youtube"===l.type){let e=t.getDynamicSourceLocales({val:l.youtubeUrl,uid:s,settingId:t.createSettingId({id:o.Video?.youtubeUrl?.id}),pageContext:r});l.youtubeUrlTranslated=String(e)}if(l.vimeoUrl&&"vimeo"===l.type){let e=t.getDynamicSourceLocales({val:l.vimeoUrl,uid:s,settingId:t.createSettingId({id:o.Video?.vimeoUrl?.id}),pageContext:r});l.vimeoUrlTranslated=String(e)}if(l.html5Url&&"html5"===l.type){let e=t.getDynamicSourceLocales({val:l.html5Url,uid:s,settingId:t.createSettingId({id:o.Video?.html5Url?.id}),pageContext:r});l.html5Url=String(e)}if(l.poster){let e=t.getDynamicSourceLocales({val:l.poster?.src,uid:s,settingId:o.Video?.poster?.id?`${o.Video.poster.id}_src`:"",pageContext:r});l.poster.src=String(e)}return l},exports.getVimeoParams=e=>{let{id:t,autoplay:o,muted:i,controls:s,loop:r,lazy:l}=e,a=encodeURIComponent(t),p=`?&autoplay=${l?1:o?1:0}&muted=${i?1:0}&loop=${r?1:0}&controls=${s}&autopause=false`,n=`https://player.vimeo.com/video/${a}${p}`;return{videoId:a,params:p,iframeSrc:n}},exports.getVimeoVideoId=e=>e.match(/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/|video\/)?(\d+)(?:$|\/|\?)/)?.[3],exports.getYoutubeParams=e=>{let{id:t,params:o,muted:i,webp:s,controls:r,adNetwork:l,autoplay:a,lazy:p,thumbnail:n}=e,d=encodeURIComponent(t),u="hqdefault",m=`${o}`||"",c=i?"&mute=1":"",b=s?"webp":"jpg",g=s?"vi_webp":"vi",v=e.thumbnail||`https://i.ytimg.com/${g}/${d}/${u}.${b}`,h=e.noCookie?"https://www.youtube-nocookie.com":"https://www.youtube.com",y=`${h}/embed/${d}?autoplay=${!!p||!!n||a}&state=1${c}${m}&controls=${r?1:0}`;return{videoId:d,posterImp:u,paramsImp:m,mutedImp:c,format:b,vi:g,posterUrl:v,ytUrl:h,iframeSrc:y,adNetworkImp:l||!1}},exports.getYoutubeVideoId=e=>{let t=e.match(i);return t?.[1]??void 0},exports.isSettingLoop=e=>e.includes("loop=1"),exports.makeStyleResponsiveRatio=(e,t)=>({[`--${e}`]:t?.desktop,[`--${e}-tablet`]:t?.tablet,[`--${e}-mobile`]:t?.mobile}),exports.parseTimeVideo=e=>{let t=e.split(":",2);return t.length<=1?parseInt(t[0]||"0"):60*parseInt(t[0]||"0")+parseInt(t[1]||"0")},exports.vimeoVideoRegex=/^(?:http:\/\/|https:\/\/)vimeo\.com\/[\w/]+(?:\?.*)?$/im,exports.youtubeVideoRegex=i;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../../image/components/NextImage.liquid.js"),
|
|
2
|
-
<gp-lite-youtube-embed gp-data='${JSON.stringify(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../../image/components/NextImage.liquid.js"),a=require("../../helpers.js"),s=require("@gem-sdk/system"),l=require("../common/classes.js"),r=require("../common/styles.js"),i=require("../common/helpers.js");exports.default=o=>{let{style:u,iframeClass:c,wrapperClass:d,title:p,poster:m,translatedVideoUrl:g}=o,n=`gp-video-${o.uid}`,{posterUrl:y,iframeSrc:b}=i.getYoutubeParams(o),f=!!o.thumbnail,$=m?.preload,C=s.createStateOrContext({lazy:o.lazy,style:u,title:p,iframeSrc:b,translatedVideoUrl:g}),S=!o.lazy&&!f,v=s.createClass({...l.getButtonYoutubeClasses(S)}),h=s.createClass({...l.getImageYoutubeClasses()}),j=s.createClass({...l.getArticleYoutubeClasses($||!1,d)}),q=s.createClass({...l.getIframeYoutubeClasses(c)}),I=s.createStyle({...r.getIframeYoutubeStyle(u)}),Y=s.createStyle({...r.getArticleYoutubeStyle(u,y)}),x=s.createClass({...l.getYoutubeContentClasses()});return e.template`
|
|
2
|
+
<gp-lite-youtube-embed gp-data='${JSON.stringify(C)}'>
|
|
3
3
|
<article
|
|
4
4
|
aria-hidden
|
|
5
|
-
class="${
|
|
5
|
+
class="${j}"
|
|
6
6
|
data-title="${p}"
|
|
7
|
-
style="${
|
|
7
|
+
style="${Y}"
|
|
8
8
|
>
|
|
9
|
-
${t.default({id:n,src:y,alt:
|
|
10
|
-
<button type="button" aria-label="Play" class="${
|
|
9
|
+
${t.default({id:n,src:y,alt:m?.altText,title:m?.imageTitle,priority:m?.preload,enableLazyLoadImage:!0,className:h,isDisableAspectStyle:!0,isNotLazyload:m?.preload})}
|
|
10
|
+
<button type="button" aria-label="Play" class="${v}">
|
|
11
11
|
<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%">
|
|
12
12
|
<path
|
|
13
13
|
d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z"
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
<path d="M 45,24 27,14 27,34" fill="#fff"></path>
|
|
17
17
|
</svg>
|
|
18
18
|
</button>
|
|
19
|
-
${
|
|
19
|
+
${s.If(S,(()=>{let t=e.template`
|
|
20
20
|
<iframe
|
|
21
21
|
id="player-wrapper-${o.uid}"
|
|
22
|
-
class="${
|
|
23
|
-
style="${
|
|
22
|
+
class="${q}"
|
|
23
|
+
style="${I}"
|
|
24
24
|
title="${p}"
|
|
25
25
|
frameborder="0"
|
|
26
26
|
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
src="${b}"
|
|
29
29
|
></iframe>
|
|
30
30
|
`;return o.isHeroBanner?e.template`
|
|
31
|
-
<div class="${
|
|
31
|
+
<div class="${x}">${t}</div>
|
|
32
32
|
`:t})())}
|
|
33
33
|
</article>
|
|
34
34
|
</gp-lite-youtube-embed>
|
|
35
|
-
${e.RenderIf(e.isLocalEnv,`<script ${
|
|
35
|
+
${e.RenderIf(e.isLocalEnv,`<script ${a.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-lite-youtube-embed-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${a.getSettingPreloadData('class="gps-link" delay',"src")}="${e.baseAssetURL}/assets-v2/gp-lite-youtube-embed-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
36
36
|
`};
|
|
@@ -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 i,useProductStore as o,convertDecimalToNumber as l,shopifyPriceRounding as s,useProductOfferDiscount as p,useI18nStore as a,useRenderMode as n,
|
|
2
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useCurrentVariant as t,useProduct as i,useProductStore as o,convertDecimalToNumber as l,shopifyPriceRounding as s,useProductOfferDiscount as p,useI18nStore as a,useRenderMode as n,useQuantity as c,useFormatMoney as g,cls as m}from"@gem-sdk/core";import{useMemo as d}from"react";import u from"../../text/components/Text.js";import{useDynamicProduct as f}from"../hooks/useDynamicProduct.js";import h from"../../../common/components/TooltipHover.js";import{calculateSellingPlanDiscount as P}from"../helpers/product-price-breakdown/getPrice.js";import{useSubscriptionSellingType as y}from"../hooks/useSubscriptionSellingType.js";let x=({styles:x,style:b,builderAttrs:N,builderProps:j,children:S,setting:k})=>{let D=t(),F=i(),{isOneTime:v}=y(),w=o(e=>e.selectedSellingPlan),G=l(D?.price)??0,T=l(D?.salePrice)??0,I=parseFloat(s(p(),2)),{isDynamicProduct:J}=f(),{t:O}=a(),{isEditMode:$}=n(),{quantity:H,hasUpdatePrice:q}=c(),{priceType:z,source:A}=k??{},B=d(()=>q&&H||1,[H,q]),C="compare"===z,E="offer"===z,K="price"===A,L="compare-price"===A,M=D?.sellingPlanGroups,Q=F?.sellingPlanGroups,R=d(()=>{if(!w||v)return null;let e=D?.sellingPlanGroups??F?.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(M),JSON.stringify(Q),w,v]),U=JSON.stringify(R?.pricingPolicies),V=R?.baseID,W=d(()=>!R||G<=0||v?0:P({variantPrice:G,pricingPolicies:R.pricingPolicies}),[U,G,v]),X=d(()=>{let e=E&&!v&&w&&V;if(e){let e=parseFloat(s(G-W,2)),r=parseFloat(s(e-I,2));return r>0?r:0}let r=parseFloat(s(G-I,2));return r>0?r:0},[E,v,w,V,G,W,I]),Y=d(()=>C?K?G:T:E?X:G,[C,K,E,G,T,X]),Z=d(()=>Y*B,[Y,B]),_=g(parseFloat(s(Number(Z)||0,2)),!1),ee=F?.baseID?.replace("gid://shopify/Product/",""),er=d(()=>C&&(!I&&T<G||L&&!T||K&&G<=0),[C,I,G,T,L,K]);return(!Y&&!E||er)&&$?e(h,{enable:!0,text:O("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:O("No compare price")})})}):er&&!$?null:r("div",{...N,className:m(j?.uid),style:{...b},id:`shopify-text-element-${j?.uid}`,"data-product-id":ee,children:[e(u,{styles:x,setting:{text:J?"$???":_},className:m({"gp-money":E,"gp-product-compare-price":C,"gp-line-through":C&&x?.lineThrough})}),S]})};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{createClass as n,createStyle as u}from"@gem-sdk/system";import{getWrapperStyles as c}from"../helpers/product-quantity/getStyles.js";import{useHandleQuantity as p}from"../hooks/useHandleQuantity.js";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}=p(j,v,f),Q=s(),q=n(o(g)),x=n(a()),S=n(m()),B=n(l()),F=n(i()),H=u({...c(y)});return d(()=>{b(N)},[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,onBlur:C,onChange:P})]})})})};export{f as default};
|
|
@@ -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 +1 @@
|
|
|
1
|
-
import{getResponsiveValueByScreen as e,cloneDeep as t}from"@gem-sdk/core";import{getDynamicSourceLocales as o,createSettingId as i}from"../../helpers.js";import{Video as l}from"../settings/configs/translate.js";let s=(t,o)=>{let i={desktop:t?.desktop?.width,tablet:t?.tablet?.width,mobile:t?.mobile?.width},l={desktop:t?.desktop?.height,tablet:t?.tablet?.height,mobile:t?.mobile?.height},s={desktop:o?.desktop==="custom"?`${e(i,"desktop")}/${e(l,"desktop")}`:o?.desktop==="cover"?"unset":o?.desktop,tablet:o?.tablet==="custom"?`${e(i,"tablet")}/${e(l,"tablet")}`:o?.tablet==="cover"?"unset":o?.tablet,mobile:o?.mobile==="custom"?`${e(i,"mobile")}/${e(l,"mobile")}`:o?.mobile==="cover"?"unset":o?.mobile};return s},r=({setting:e,uid:s,pageContext:r})=>{if(!e||!s)return{};if(r?.isPreviewing)return e;let m=t(e);if(m.youtubeUrl&&"youtube"===m.type){let e=o({val:m.youtubeUrl,uid:s,settingId:i({id:l?.youtubeUrl?.id}),pageContext:r});m.youtubeUrlTranslated=String(e)}if(m.vimeoUrl&&"vimeo"===m.type){let e=o({val:m.vimeoUrl,uid:s,settingId:i({id:l?.vimeoUrl?.id}),pageContext:r});m.vimeoUrlTranslated=String(e)}if(m.html5Url&&"html5"===m.type){let e=o({val:m.html5Url,uid:s,settingId:i({id:l?.html5Url?.id}),pageContext:r});m.html5Url=String(e)}if(m.poster){let e=o({val:m.poster?.src,uid:s,settingId:l?.poster?.id?`${l.poster.id}_src`:"",pageContext:r});m.poster.src=String(e)}return m},m=e=>{let{id:t,params:o,muted:i,webp:l,controls:s,adNetwork:r,autoplay:m,lazy:a}=e,
|
|
1
|
+
import{getResponsiveValueByScreen as e,cloneDeep as t}from"@gem-sdk/core";import{getDynamicSourceLocales as o,createSettingId as i}from"../../helpers.js";import{Video as l}from"../settings/configs/translate.js";let s=(t,o)=>{let i={desktop:t?.desktop?.width,tablet:t?.tablet?.width,mobile:t?.mobile?.width},l={desktop:t?.desktop?.height,tablet:t?.tablet?.height,mobile:t?.mobile?.height},s={desktop:o?.desktop==="custom"?`${e(i,"desktop")}/${e(l,"desktop")}`:o?.desktop==="cover"?"unset":o?.desktop,tablet:o?.tablet==="custom"?`${e(i,"tablet")}/${e(l,"tablet")}`:o?.tablet==="cover"?"unset":o?.tablet,mobile:o?.mobile==="custom"?`${e(i,"mobile")}/${e(l,"mobile")}`:o?.mobile==="cover"?"unset":o?.mobile};return s},r=({setting:e,uid:s,pageContext:r})=>{if(!e||!s)return{};if(r?.isPreviewing)return e;let m=t(e);if(m.youtubeUrl&&"youtube"===m.type){let e=o({val:m.youtubeUrl,uid:s,settingId:i({id:l?.youtubeUrl?.id}),pageContext:r});m.youtubeUrlTranslated=String(e)}if(m.vimeoUrl&&"vimeo"===m.type){let e=o({val:m.vimeoUrl,uid:s,settingId:i({id:l?.vimeoUrl?.id}),pageContext:r});m.vimeoUrlTranslated=String(e)}if(m.html5Url&&"html5"===m.type){let e=o({val:m.html5Url,uid:s,settingId:i({id:l?.html5Url?.id}),pageContext:r});m.html5Url=String(e)}if(m.poster){let e=o({val:m.poster?.src,uid:s,settingId:l?.poster?.id?`${l.poster.id}_src`:"",pageContext:r});m.poster.src=String(e)}return m},m=e=>{let{id:t,params:o,muted:i,webp:l,controls:s,adNetwork:r,autoplay:m,lazy:a,thumbnail:d}=e,p=encodeURIComponent(t),n="hqdefault",u=`${o}`||"",b=i?"&mute=1":"",g=l?"webp":"jpg",h=l?"vi_webp":"vi",c=e.thumbnail||`https://i.ytimg.com/${h}/${p}/${n}.${g}`,$=e.noCookie?"https://www.youtube-nocookie.com":"https://www.youtube.com",v=`${$}/embed/${p}?autoplay=${!!a||!!d||m}&state=1${b}${u}&controls=${s?1:0}`;return{videoId:p,posterImp:n,paramsImp:u,mutedImp:b,format:g,vi:h,posterUrl:c,ytUrl:$,iframeSrc:v,adNetworkImp:r||!1}},a=e=>{let{id:t,autoplay:o,muted:i,controls:l,loop:s,lazy:r}=e,m=encodeURIComponent(t),a=`?&autoplay=${r?1:o?1:0}&muted=${i?1:0}&loop=${s?1:0}&controls=${l}&autopause=false`,d=`https://player.vimeo.com/video/${m}${a}`;return{videoId:m,params:a,iframeSrc:d}},d=(e,t)=>({[`--${e}`]:t?.desktop,[`--${e}-tablet`]:t?.tablet,[`--${e}-mobile`]:t?.mobile}),p="https://cdn.shopify.com/s/files/1/0703/5214/2562/files/gempages_518090459516502570-3d3a4631-1d7d-4a2f-9ef0-9bbe7220e02d.jpg",n=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=|shorts\/)|youtu\.be\/)([^"&?/\s]{11})/i,u=/^(?:http:\/\/|https:\/\/)vimeo\.com\/[\w/]+(?:\?.*)?$/im,b=e=>{let t=e.match(n);return t?.[1]??void 0},g=e=>e.match(/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/|video\/)?(\d+)(?:$|\/|\?)/)?.[3],h=e=>{let t=e.split(":",2);return t.length<=1?parseInt(t[0]||"0"):60*parseInt(t[0]||"0")+parseInt(t[1]||"0")},c=e=>{let t=e.split("&");return t.shift(),t.reduce((e,t)=>{let[o,i]=t.split("=");return"loop"!==o&&(e[o]=i),e},{})},$=e=>e.includes("loop=1");export{c as covertStrParamsToObj,p as fallbackImageVideoUrl,s as getAspectRatioSettings,r as getSettingTranslatedVideoAndThumbnail,a as getVimeoParams,g as getVimeoVideoId,m as getYoutubeParams,b as getYoutubeVideoId,$ as isSettingLoop,d as makeStyleResponsiveRatio,h as parseTimeVideo,u as vimeoVideoRegex,n as youtubeVideoRegex};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{RenderIf as e,isLocalEnv as t,baseAssetURL as s,template as
|
|
2
|
-
<gp-lite-youtube-embed gp-data='${JSON.stringify(
|
|
1
|
+
import{RenderIf as e,isLocalEnv as t,baseAssetURL as s,template as a}from"@gem-sdk/core";import l from"../../image/components/NextImage.liquid.js";import{getSettingPreloadData as r}from"../../helpers.js";import{createStateOrContext as i,createClass as o,createStyle as p,If as m}from"@gem-sdk/system";import{getButtonYoutubeClasses as d,getImageYoutubeClasses as c,getArticleYoutubeClasses as u,getIframeYoutubeClasses as f,getYoutubeContentClasses as y}from"../common/classes.js";import{getIframeYoutubeStyle as n,getArticleYoutubeStyle as g}from"../common/styles.js";import{getYoutubeParams as $}from"../common/helpers.js";let b=b=>{let{style:h,iframeClass:v,wrapperClass:S,title:j,poster:z,translatedVideoUrl:w}=b,C=`gp-video-${b.uid}`,{posterUrl:E,iframeSrc:N}=$(b),k=!!b.thumbnail,x=z?.preload,L=i({lazy:b.lazy,style:h,title:j,iframeSrc:N,translatedVideoUrl:w}),T=!b.lazy&&!k,A=o({...d(T)}),I=o({...c()}),M=o({...u(x||!1,S)}),B=o({...f(v)}),G=p({...n(h)}),O=p({...g(h,E)}),P=o({...y()});return a`
|
|
2
|
+
<gp-lite-youtube-embed gp-data='${JSON.stringify(L)}'>
|
|
3
3
|
<article
|
|
4
4
|
aria-hidden
|
|
5
|
-
class="${
|
|
5
|
+
class="${M}"
|
|
6
6
|
data-title="${j}"
|
|
7
|
-
style="${
|
|
7
|
+
style="${O}"
|
|
8
8
|
>
|
|
9
|
-
${
|
|
10
|
-
<button type="button" aria-label="Play" class="${
|
|
9
|
+
${l({id:C,src:E,alt:z?.altText,title:z?.imageTitle,priority:z?.preload,enableLazyLoadImage:!0,className:I,isDisableAspectStyle:!0,isNotLazyload:z?.preload})}
|
|
10
|
+
<button type="button" aria-label="Play" class="${A}">
|
|
11
11
|
<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%">
|
|
12
12
|
<path
|
|
13
13
|
d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z"
|
|
@@ -16,21 +16,21 @@ import{RenderIf as e,isLocalEnv as t,baseAssetURL as s,template as r}from"@gem-s
|
|
|
16
16
|
<path d="M 45,24 27,14 27,34" fill="#fff"></path>
|
|
17
17
|
</svg>
|
|
18
18
|
</button>
|
|
19
|
-
${m(
|
|
19
|
+
${m(T,(()=>{let e=a`
|
|
20
20
|
<iframe
|
|
21
21
|
id="player-wrapper-${b.uid}"
|
|
22
|
-
class="${
|
|
23
|
-
style="${
|
|
22
|
+
class="${B}"
|
|
23
|
+
style="${G}"
|
|
24
24
|
title="${j}"
|
|
25
25
|
frameborder="0"
|
|
26
26
|
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
|
27
27
|
allowfullscreen
|
|
28
28
|
src="${N}"
|
|
29
29
|
></iframe>
|
|
30
|
-
`;return b.isHeroBanner?
|
|
31
|
-
<div class="${
|
|
30
|
+
`;return b.isHeroBanner?a`
|
|
31
|
+
<div class="${P}">${e}</div>
|
|
32
32
|
`:e})())}
|
|
33
33
|
</article>
|
|
34
34
|
</gp-lite-youtube-embed>
|
|
35
|
-
${e(t,`<script ${
|
|
35
|
+
${e(t,`<script ${r('class="gps-link" delay',"src")}="{{ 'gp-lite-youtube-embed-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${r('class="gps-link" delay',"src")}="${s}/assets-v2/gp-lite-youtube-embed-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
36
36
|
`};export{b as default};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2832,6 +2832,7 @@ declare const PostPurchaseProductVariants: React.FC<PostPurchaseProductVariantsP
|
|
|
2832
2832
|
type PostPurchaseProductQuantitySettingProps = {
|
|
2833
2833
|
title?: string;
|
|
2834
2834
|
defaultQtyValue?: number;
|
|
2835
|
+
updatePrice?: boolean;
|
|
2835
2836
|
};
|
|
2836
2837
|
type PostPurchaseProductQuantityStyleProps = {
|
|
2837
2838
|
fullWidth?: ObjectDevices<boolean>;
|