@gem-sdk/components 3.0.9 → 3.0.11
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/article/components/ArticleList.js +1 -1
- package/dist/cjs/form/components/textarea/TextArea.liquid.js +2 -2
- package/dist/cjs/hero-banner/common/classes.js +1 -1
- package/dist/cjs/hero-banner/common/helpers.js +1 -1
- package/dist/cjs/hero-banner/common/styles.js +1 -1
- package/dist/cjs/product/components/product-badge/ProductBadge.js +1 -1
- package/dist/cjs/product/components/product-badge/common/styles.js +1 -1
- package/dist/cjs/product/components/product-badge/utils/renderBadgeILP.js +1 -1
- package/dist/cjs/product/components/product-list/ProductListCarouselItem.liquid.js +5 -5
- package/dist/cjs/product/components/product-list/ProductListGridItem.liquid.js +5 -5
- package/dist/cjs/product/components/product-wrap/Product.liquid.js +8 -8
- package/dist/esm/article/components/ArticleList.js +1 -1
- package/dist/esm/form/components/textarea/TextArea.liquid.js +2 -2
- package/dist/esm/hero-banner/common/classes.js +1 -1
- package/dist/esm/hero-banner/common/helpers.js +1 -1
- package/dist/esm/hero-banner/common/styles.js +1 -1
- package/dist/esm/product/components/product-badge/ProductBadge.js +1 -1
- package/dist/esm/product/components/product-badge/common/styles.js +1 -1
- package/dist/esm/product/components/product-badge/utils/renderBadgeILP.js +1 -1
- package/dist/esm/product/components/product-list/ProductListCarouselItem.liquid.js +3 -3
- package/dist/esm/product/components/product-list/ProductListGridItem.liquid.js +6 -6
- package/dist/esm/product/components/product-wrap/Product.liquid.js +10 -10
- package/package.json +1 -1
|
@@ -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"),ChildrenDroppable=require("../../grid/components/ChildrenDroppable.js"),Loading=require("../../common/components/Loading.js"),React=require("react"),ArticleNotFound=require("./ArticleNotFound.js");const ArticleList=e=>{let t=core.useEditorMode(),{styles:i,setting:r,className:l,children:o,builderProps:a,advanced:n,builderAttrs:s}=e??{},{articleSetting:d,numberOfArticle:c}=r??{},{articleIds:u,articlePickType:
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),ChildrenDroppable=require("../../grid/components/ChildrenDroppable.js"),Loading=require("../../common/components/Loading.js"),React=require("react"),ArticleNotFound=require("./ArticleNotFound.js");const ArticleList=e=>{let t=core.useEditorMode(),{styles:i,setting:r,className:l,children:o,builderProps:a,advanced:n,builderAttrs:s}=e??{},{articleSetting:d,numberOfArticle:c}=r??{},{articleIds:u,articlePickType:m}=d??{},{border:g,rounded:p,hasBoxShadow:h,boxShadow:b}=n??{},x=core.composeAdvanceStyle({border:g,rounded:p,hasBoxShadow:h,boxShadow:b,"spacing-setting":n?.["spacing-setting"]}),y={first:u?.length||50,where:{baseIDIn:[...d?.articleIds??[]]},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},j={first:1,where:{baseID:d?.blogId},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"},articlesOrderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},[v,f]=React.useState(!0),R=core.useBlogsQuery("latest"===m?j:null,{revalidateOnMount:!0}),A=core.useArticlesQuery("manually"===m?y:null,{revalidateOnMount:!0}),S=R.data?.blogs?.edges?.[0]?.node,D="manually"===m?A.isLoading:R.isLoading,w="manually"===m?A.isValidating:R.isValidating,T="manually"===m?A.error:R.error,k=R?.data?.blogs?.edges?.[0]?.node,B="latest"===m?core.flattenConnection(k?.articles):core.flattenConnection(A?.data?.articles),P=(e,t)=>({...e??{},blog:{title:t?.title??"",handle:t?.handle??""}}),L="latest"===m?B?.filter((e,t)=>t<+(c||4)).map(e=>P(e,k)):"manually"===m&&d?.articleIds?.length?u?.map(e=>{let t=B?.find(t=>t?.baseID===e);return P(t,t?.blogs?.edges?.[0]?.node)}).filter(Boolean):B.filter((e,t)=>t<(d?.numOfSelectedArticles||4)).map(e=>P(e,e?.blogs?.edges?.[0]?.node));return L?.length||D||"edit"!=t?jsxRuntime.jsxs("div",{...s,className:a?.builderData?.uid,children:[w||D?jsxRuntime.jsx(Loading.default,{}):T?jsxRuntime.jsxs("div",{children:["Error: ",T?.message]}):L?.length?jsxRuntime.jsx(core.ArticleListProvider,{styles:{horizontalGutter:i?.horizontalGutter,verticalGutter:i?.verticalGutter,spacing:i?.spacing,width:i?.width,height:i?.height},settings:{slidesToShow:r?.slideToShow??{desktop:4,tablet:3,mobile:1}},articles:L,children:jsxRuntime.jsx("div",{"data-id":a?.uid,className:"gp-relative",children:jsxRuntime.jsx("div",{style:{...x,...core.makeStyleWithDefault("w",core.makeWidth(i?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...core.makeStyleResponsive("rg",i?.horizontalGutter),...core.makeStyleResponsive("cg",i?.verticalGutter),...core.getStyleBackgroundByDevice(r?.background),...core.getGradientBgrStyleByDevice(r?.background),...core.makeStyleResponsive("gtc",{desktop:`repeat(${core.getResponsiveValueByScreen(r?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:r?.slideToShow?.tablet&&`repeat(${core.getResponsiveValueByScreen(r?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:r?.slideToShow?.mobile&&`repeat(${core.getResponsiveValueByScreen(r?.slideToShow,"mobile")}, minmax(0, 1fr))`})},className:core.cls(l,"gp-m-auto gp-grid gp-w-full"),children:L.map(e=>jsxRuntime.jsx(core.ArticleProvider,{article:e,readOnly:!0,children:jsxRuntime.jsx("div",{"data-component-type":"component","data-component-tag":"Article","data-component-label":"Article","data-component-no-setting":!0,"data-article-id":e?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:core.isEmptyChildren(o)?jsxRuntime.jsx(ChildrenDroppable.default,{}):o})},e?.id))})})}):jsxRuntime.jsx("div",{children:"Articles not found"}),core.filterToolbarPreview(o,!0)]}):v?jsxRuntime.jsxs("div",{...s,className:a?.builderData?.uid,children:[jsxRuntime.jsx(ArticleNotFound.default,{blogHandle:S?.handle,onClose:()=>f(!1),articlePickType:m??"manually",children:o}),core.filterToolbarPreview(o,!0)]}):null};exports.default=ArticleList;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../../helpers.js"),system=require("@gem-sdk/system"),styles=require("./common/styles.js"),classes=require("./common/classes.js");const FormTextarea=({setting:e,builderProps:s,className:t,builderAttrs:r,advanced:a,pageContext:l,styles:o})=>{let{text:c,name:m,placeholder:y,required:i}=e??{},
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../../helpers.js"),system=require("@gem-sdk/system"),styles=require("./common/styles.js"),classes=require("./common/classes.js");const FormTextarea=({setting:e,builderProps:s,className:t,builderAttrs:r,advanced:a,pageContext:l,styles:o})=>{let{text:c,name:m,placeholder:y,required:i,translate:d}=e??{},u=""===m||void 0===m?"contact[note]":m,n=helpers.getDynamicSourceLocales({val:y,uid:s?.uid,settingId:"placeholder",pageContext:l,translate:d}),p=system.createStyle(styles.composeContainerStyles(a,e)),$=system.createStyle(styles.composeTextareaStyles(a,e,o)),x=system.createClass(classes.composeContainerClasses(a,s)),v=system.createClass(classes.composeTextareaClasses(e,s,t??""));return core.template`
|
|
2
2
|
<div
|
|
3
3
|
${r}
|
|
4
4
|
data-id="${s?.uid}"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
style="${$}"
|
|
11
11
|
placeholder="${n}"
|
|
12
12
|
${system.If(i,"required")}
|
|
13
|
-
name="${
|
|
13
|
+
name="${u}"
|
|
14
14
|
value="${c}"
|
|
15
15
|
></textarea>
|
|
16
16
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),helpers=require("./helpers.js");function composeClasses(e){return e.split(" ").reduce((e,s)=>(e[s]=!0,e),{})}const getClasses=({setting:e,builderProps:s,advancedCssClass:t})=>{let o="gp-group/hero gp-flex gp-w-full gp-flex-col gp-self-center gp-transition-colors gp-duration-200 gp-ease-in-out";return t&&(o+=` ${t}`),{...s?.uid&&{[s.uid]:!0},...composeClasses(o),...helpers.getClassAlignBanner(helpers.getResponsiveSetting(e?.alignBanner||{}))}},getLinkClasses=()=>({...composeClasses("gp-cursor-pointer gp-h-full")}),getContainerClasses=(e,s)=>({...composeClasses("gp-relative gp-flex gp-w-full gp-flex-col gp-items-center gp-overflow-hidden hero-banner-container"),...helpers.getClassContentPosition(helpers.getContentPosition(e?.layout,s?.contentPosition1Col,s?.contentPosition2Col)||{})}),
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),helpers=require("./helpers.js");function composeClasses(e){return e.split(" ").reduce((e,s)=>(e[s]=!0,e),{})}const getClasses=({setting:e,builderProps:s,advancedCssClass:t})=>{let o="gp-group/hero gp-flex gp-w-full gp-flex-col gp-self-center gp-transition-colors gp-duration-200 gp-ease-in-out";return t&&(o+=` ${t}`),{...s?.uid&&{[s.uid]:!0},...composeClasses(o),...helpers.getClassAlignBanner(helpers.getResponsiveSetting(e?.alignBanner||{}))}},getLinkClasses=()=>({...composeClasses("gp-cursor-pointer gp-h-full")}),getContainerClasses=(e,s)=>({...composeClasses("gp-relative gp-flex gp-w-full gp-flex-col gp-items-center gp-overflow-hidden hero-banner-container"),...helpers.getClassContentPosition(helpers.getContentPosition(e?.layout,s?.contentPosition1Col,s?.contentPosition2Col)||{})}),enableTransitionHover=e=>{let{overlayColor:s}=e??{},t=s?.hover||s?.normal;return t&&"transparent"!==t&&"0%"!=helpers.getOpacityHover(e)},getOverlayClasses=e=>{let{overlayColor:s,hoverEffect:t}=e??{},{disableOpacity:o}=helpers.opacityEnabledData(e),a="gp-absolute gp-inset-0 gp-left-[var(--left)] gp-top-[var(--top)] gp-z-1";return enableTransitionHover(e)&&(a+=" gp-transition-all gp-duration-300"),t&&(a+=" group-hover/hero:gp-bg-[color:var(--hvr-bgc,_var(--bgc))] group-hover/hero:gp-opacity-[var(--hvr-op,_var(--op))]"),core.getGlobalColorStateClass("bg",s,o,!t)&&(a+=` ${core.getGlobalColorStateClass("bg",s,o,!t)}`),composeClasses(a)},getRowClasses=(e,s)=>{let{sizeSetting:t,background:o}=e??{},{verticalAlign:a}=s??{},l=helpers.getClassForContentByFitContent(t,o),r=helpers.getClassForStretchContent(a),g=helpers.getClassSpaceBetween(s?.layout||{},e?.contentPosition1Col||{},e?.contentPosition2Col||{}),p=helpers.getClassSpaceBetweenLeftRight(s?.layout||{}),n=`gp-hero-banner-row ${l} ${r}`;return{...composeClasses(n),...g,...p}},getAdaptiveClasses=()=>composeClasses("adaptive-hero-banner"),getAdaptivePictureClasses=()=>composeClasses("gp-w-full"),getBackgroundClasses=(e,s)=>{let t="hero-banner-bg gp-hero-banner-image-background hero-banner-bg-parallax";return s&&(t+=" gp_lazybg"),e&&(t+=" gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)] gp-transition-transform"),composeClasses(t)},getContainBackgroundClasses=()=>composeClasses("gp-hero-banner-bg gp-absolute gp-overflow-hidden gp-w-full gp-h-full top-0 left-0"),getHtml5VideoClasses=(e,s=!1)=>{let t="gp-relative",o=core.getValueByDevice(e,"tablet"),a=core.getValueByDevice(e,"mobile");return s&&(t+=" gp-hidden"),o&&(t+=" tablet:gp-h-full tablet:gp-object-cover"),a&&(t+=" mobile:gp-h-full mobile:gp-object-cover"),composeClasses(t)},getWrapperYoutubeClasses=()=>composeClasses("gp-pb-[56.25%] gp-h-full gp-w-full !gp-max-w-none gp-pointer-events-none"),getIframeYoutubeClasses=()=>composeClasses("!gp-w-[500%] !gp-ml-[-200%] !gp-h-full !gp-max-w-none gp-scale-[104%]"),getLazyBackgroundClasses=e=>{let s="gp-absolute gp-top-0 gp-invisible gp-w-full gp_lazyload gp-h-full gp_lazyforbg";return"tablet"===e&&(s+=" gp_lazybg_tl"),"mobile"===e&&(s+=" gp_lazybg_mb"),composeClasses(s)};exports.enableTransitionHover=enableTransitionHover,exports.getAdaptiveClasses=getAdaptiveClasses,exports.getAdaptivePictureClasses=getAdaptivePictureClasses,exports.getBackgroundClasses=getBackgroundClasses,exports.getClasses=getClasses,exports.getContainBackgroundClasses=getContainBackgroundClasses,exports.getContainerClasses=getContainerClasses,exports.getHtml5VideoClasses=getHtml5VideoClasses,exports.getIframeYoutubeClasses=getIframeYoutubeClasses,exports.getLazyBackgroundClasses=getLazyBackgroundClasses,exports.getLinkClasses=getLinkClasses,exports.getOverlayClasses=getOverlayClasses,exports.getRowClasses=getRowClasses,exports.getWrapperYoutubeClasses=getWrapperYoutubeClasses;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),helpers=require("../../image/common/helpers.js"),constant=require("../../constant.js");const getContentPosition=(e,t,o)=>{let l={};return core.DEVICES.map(i=>{let n=core.getResponsiveValueByScreen(e,i),a=core.getResponsiveValueByScreen(t,i),s=core.getResponsiveValueByScreen(o,i);l={...l,[i]:1>=(n?.cols?.length||1)?a:s}}),l},getAspectRatioSettings=(e,t)=>{let o={desktop:e?.desktop?.width,tablet:e?.tablet?.width,mobile:e?.mobile?.width},l={desktop:e?.desktop?.height,tablet:e?.tablet?.height,mobile:e?.mobile?.height},i={desktop:t?.desktop==="custom"?`${core.getResponsiveValueByScreen(o,"desktop")}/${core.getResponsiveValueByScreen(l,"desktop")}`:t?.desktop==="cover"?"unset":t?.desktop,tablet:t?.tablet==="custom"?`${core.getResponsiveValueByScreen(o,"tablet")}/${core.getResponsiveValueByScreen(l,"tablet")}`:t?.tablet==="cover"?"unset":t?.tablet,mobile:t?.mobile==="custom"?`${core.getResponsiveValueByScreen(o,"mobile")}/${core.getResponsiveValueByScreen(l,"mobile")}`:t?.mobile==="cover"?"unset":t?.mobile};return i},getEnableBgImageByDevice=(e,t)=>{if(!core.getResponsiveValueByScreen(getBgImage(t),e))return!1;if(!t?.[e]){if("mobile"===e)return t?.tablet?.type==="image"||t?.desktop?.type==="image"&&!t?.tablet;if("tablet"===e)return t?.desktop?.type==="image"}return t?.[e]?.type==="image"},getBgImage=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},imagePlaceholder=e=>{let t=getBgImage(e);return{desktop:helpers.createBlurDataURL(t?.desktop?.width??0,t?.desktop?.height??0),tablet:helpers.createBlurDataURL(t?.tablet?.width??t?.desktop?.width??0,t?.tablet?.height??t?.desktop?.width??0),mobile:helpers.createBlurDataURL(t?.mobile?.width??t?.tablet?.width??t?.desktop?.width??0,t?.mobile?.height??t?.tablet?.height??t?.desktop?.width??0)}},getBgImageByScreen=(e,t,o,l)=>{if(!e)return"";let i=getBgImage(e),n=core.getResponsiveValueByScreen(e,t),a=o?`url(${imagePlaceholder(e)[t]})`:`url(${helpers.getImageSrc(core.getResponsiveValueByScreen(i,t),t,l)})`,s=n?.color?`, ${n.color}`:"";return n?.color?.includes(core.GRADIENT_BGR_KEY)&&n?.type==="image"?`${a}${s}`:n?.color?.includes(core.GRADIENT_BGR_KEY)&&n?.type!=="image"?`${n.color}`:n?.type==="image"?a:"url()"},getBackgroundImageHeroBanner=(e,t=!1,o=!1)=>{if(!e)return;let l={};return core.DEVICES.forEach(i=>{l={...l,[i]:getBgImageByScreen(e,i,t,o)}}),core.makeStyleResponsive("bgi",l)},getAttachmentDevice=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let l=e?.[o]?.attachment;t={...t,[o]:"fixed"===l?"fixed":"absolute"}}),t},horizontalAlign=(e,t,o)=>mapContentPositionToHorizontal(getContentPosition(e,t,o)),scrollToContentBanner=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),getDataVideoHeroBannerResponsive=(e,t)=>{switch(e){case"desktop":if(t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"tablet":if(t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.tablet&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"mobile":if(t?.mobile?.type==="video")return{device:"mobile",data:t.mobile};if(!t?.mobile&&t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.mobile&&!t?.tablet?.type&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop}}},getVisibilityStyle=e=>e?Object.keys(e).filter(e=>["--d","--d-tablet","--d-mobile"].includes(e)).reduce((t,o)=>({...t,[o]:e?.[o]!=="none"?"flex":e?.[o]}),{}):{},getStyleAspectRatioHeroBannerCustom=(e,t,o)=>{let l=core.getAspectRatioGlobalSize(t),i=["desktop","mobile","tablet"];return i.forEach(i=>{let n=core.getResponsiveValueByScreen(t,i),a=!!getDataVideoHeroBannerResponsive(i,e),s=n?.shape,r=n?.height,g="original"===s&&"fit-content"!==r,p=g&&a;p&&(l={...l,[i]:"16/9"}),o&&o[i]&&getDataVideoHeroBannerResponsive(i,e)?.data?.videoType==="html5"&&(l={...l,[i]:o[i]})}),core.makeStyleResponsive("aspect",l)},mapContentPositionToHorizontal=e=>{let t={};for(let o in e)"top"===e[o]?t[o]="start":"bottom"===e[o]?t[o]="end":t[o]="center";return t},getDisplayStyleByFitContent=(e,t)=>{let o={desktop:"none",tablet:"none",mobile:"none"},l=["desktop","mobile","tablet"];return l.forEach(l=>{let i=core.getResponsiveValueByScreen(e,l),n=!!getDataVideoHeroBannerResponsive(l,t),a=i?.shape,s=i?.height,r="original"===a&&"fit-content"!==s&&!n;o={...o,[l]:r?"block":"none"}}),core.makeStyleResponsive("d",o)},getWidth=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let l=e?.[o];l&&(t={...t,[o]:"default"===l?"var(--g-ct-w, 1200px)":l})}),t},getPercentageVisible=(e,t)=>{let{top:o,height:l}=e,i=-l;if(o<i)return 0;if(o>t)return 100;let n=(o-i)/(t-i)*100;return Math.min(Math.max(n,0),100)},isScaleImage=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,getHeightHeroBanner=(e,t)=>{let o={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let i=isScaleImage({enableParallax:t,attachment:e[l]?.attachment});o={...o,[l]:t?"150%":i?"100vh":"100%"}}),core.makeStyleResponsive("h",o)},getWidthHeroBanner=(e,t)=>{let o={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let i=isScaleImage({enableParallax:t,attachment:e[l]?.attachment});o={...o,[l]:i?"100vw":"100%"}}),core.makeStyleResponsive("w",o)},getTopHeroBanner=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{t={...t,[o]:e[o]?.attachment==="fixed"?"0px":""}}),core.makeStyleResponsive("top",t)},getStyleHeroBannerBg=(e,t)=>{let o=getHeightHeroBanner(e,t),l=getWidthHeroBanner(e,t),i=getTopHeroBanner(e);return{...o,...l,...i}},calcRounderClipPath=(e,t=0,o=0)=>{let l=t,i=t;if(t>o?l=o:i=o,e>=999){let t=e-l;return t>0?t:0}let n=e-i;return n>0?n:0},getClipPath=(e,t)=>{if(!t||!e)return"inset(0 0 0)";let[o,l,i,n]=e.split(" ").map(e=>parseInt(e??"0")),{btlr:a,btrr:s,bbrr:r,bblr:g}=t,p=calcRounderClipPath(parseInt(a??"0"),o,n),c=calcRounderClipPath(parseInt(s??"0"),o,l),b=calcRounderClipPath(parseInt(r??"0"),l,i),d=calcRounderClipPath(parseInt(g??"0"),i,n);return`inset(0 0 0 round ${p}px ${c}px ${b}px ${d}px)`},getClassAlignBanner=e=>({"!gp-self-start":"left"===e.desktop,"!gp-self-center":"center"===e.desktop,"!gp-self-end":"right"===e.desktop,"tablet:!gp-self-start":"left"===e.tablet,"tablet:!gp-self-center":"center"===e.tablet,"tablet:!gp-self-end":"right"===e.tablet,"mobile:!gp-self-start":"left"===e.mobile,"mobile:!gp-self-center":"center"===e.mobile,"mobile:!gp-self-end":"right"===e.mobile}),getClassSpaceBetween=(e,t,o)=>{let l=getResponsiveSetting(e),i=getResponsiveSetting(t),n=getResponsiveSetting(o),a=1>=(l?.desktop?.cols?.length||1)?i.desktop:n.desktop,s=1>=(l?.tablet?.cols?.length||1)?i.tablet:n.tablet,r=1>=(l?.mobile?.cols?.length||1)?i.mobile:n.mobile;return{"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":l.desktop?.cols?.length===1&&"space-between"===a,"!gp-content-stretch [&>*]:!gp-justify-start":l.desktop?.cols?.length===1&&"top"===a,"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":l.tablet?.cols?.length===1&&"space-between"===s,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start":l.tablet?.cols?.length===1&&"top"===s,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center":l.tablet?.cols?.length===1&&"center"===s,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end":l.tablet?.cols?.length===1&&"bottom"===s,"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":l.mobile?.cols?.length===1&&"space-between"===r,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start":l.mobile?.cols?.length===1&&"top"===r,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center":l.mobile?.cols?.length===1&&"center"===r,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end":l.mobile?.cols?.length===1&&"bottom"===r}},getClassSpaceBetweenLeftRight=e=>{let t=getResponsiveSetting(e),o=t?.desktop?.type=="left-distributed"||t?.desktop?.type=="right-distributed",l=t?.tablet?.type=="left-distributed"||t?.tablet?.type=="right-distributed",i=t?.mobile?.type=="left-distributed"||t?.mobile?.type=="right-distributed";return{"gp-h-full tablet:gp-h-auto mobile:gp-h-auto [&>*]:!gp-justify-between":o,"tablet:!gp-h-full tablet:[&>*]:!gp-justify-between mobile:gp-h-auto":l,"mobile:!gp-h-full mobile:[&>*]:!gp-justify-between":i,"mobile:!gp-h-auto":!i}},getClassForStretchContent=e=>{let t={desktop:"none",tablet:"none",mobile:"none"},o=["desktop","mobile","tablet"];return o.forEach(o=>{let l=core.getResponsiveValueByScreen(e,o);t={...t,[o]:l}}),core.cls("space-between"===t.desktop?"[&>*>*]:!gp-justify-between":"","space-between"===t.tablet?"tablet:[&>*>*]:!gp-justify-between ":`tablet:[&>*>*]:!gp-justify-${e?.tablet}`,"space-between"===t.mobile?"mobile:[&>*>*]:!gp-justify-between ":`mobile:[&>*>*]:!gp-justify-${e?.mobile}`)},getClassForContentByFitContent=(e,t)=>{let o={desktop:!1,tablet:!1,mobile:!1},l=["desktop","mobile","tablet"];return l.forEach(l=>{let i=core.getResponsiveValueByScreen(e,l),n=!!getDataVideoHeroBannerResponsive(l,t),a=i?.shape,s=i?.height,r="original"===a&&"fit-content"!==s;o={...o,[l]:r&&!n}}),core.cls(o.desktop?"!gp-absolute":"",o.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",o.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},getClassContentPosition=e=>{let t={center:"center",top:"start",bottom:"end","space-between":"between"},o=e.desktop||"center",l=e.tablet||o,i=e.mobile||l;return{[`gp-justify-${t[o||"center"]}`]:!!o,[`tablet:gp-justify-${t[l||"center"]}`]:!!l,[`mobile:gp-justify-${t[i||"center"]}`]:!!i}},getResponsiveSetting=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,l=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:l}},showVideoType=e=>core.DEVICES.some(t=>{let o=core.getValueByDevice(e,t);return o?.type!=="color"&&o?.type!=="image"&&!!o&&(o?.videoType==="html5"&&o?.videoHtml5||o?.videoType==="youtube"&&o?.video)});function debounce(e,t){let o;return function(...l){clearTimeout(o),o=setTimeout(()=>e.apply(this,l),t)}}const fallbackImg="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",getBannerLink=e=>{let t=e?.link;return t?.type==="go-to-sales-page"?{type:"go-to-sales-page",link:constant.HREF_TO_SALES_PAGE,target:"_self"}:t},formatHoverScale=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",opacityEnabledData=e=>{let{overlayColor:t,overlayOpacity:o,hoverEffect:l}=e??{},i=!t?.normal||o?.normal=="0%"||!o?.normal,n=!l;return{disableOpacity:i,disableHoverOpacity:n}};exports.debounce=debounce,exports.fallbackImg="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",exports.formatHoverScale=formatHoverScale,exports.getAspectRatioSettings=getAspectRatioSettings,exports.getAttachmentDevice=getAttachmentDevice,exports.getBackgroundImageHeroBanner=getBackgroundImageHeroBanner,exports.getBannerLink=getBannerLink,exports.getBgImage=getBgImage,exports.getClassAlignBanner=getClassAlignBanner,exports.getClassContentPosition=getClassContentPosition,exports.getClassForContentByFitContent=getClassForContentByFitContent,exports.getClassForStretchContent=getClassForStretchContent,exports.getClassSpaceBetween=getClassSpaceBetween,exports.getClassSpaceBetweenLeftRight=getClassSpaceBetweenLeftRight,exports.getClipPath=getClipPath,exports.getContentPosition=getContentPosition,exports.getDataVideoHeroBannerResponsive=getDataVideoHeroBannerResponsive,exports.getDisplayStyleByFitContent=getDisplayStyleByFitContent,exports.getEnableBgImageByDevice=getEnableBgImageByDevice,exports.getPercentageVisible=getPercentageVisible,exports.getResponsiveSetting=getResponsiveSetting,exports.getStyleAspectRatioHeroBannerCustom=getStyleAspectRatioHeroBannerCustom,exports.getStyleHeroBannerBg=getStyleHeroBannerBg,exports.getVisibilityStyle=getVisibilityStyle,exports.getWidth=getWidth,exports.horizontalAlign=horizontalAlign,exports.imagePlaceholder=imagePlaceholder,exports.isScaleImage=isScaleImage,exports.mapContentPositionToHorizontal=mapContentPositionToHorizontal,exports.opacityEnabledData=opacityEnabledData,exports.scrollToContentBanner=scrollToContentBanner,exports.showVideoType=showVideoType;
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),helpers=require("../../image/common/helpers.js"),constant=require("../../constant.js");const getContentPosition=(e,t,o)=>{let l={};return core.DEVICES.map(n=>{let i=core.getResponsiveValueByScreen(e,n),a=core.getResponsiveValueByScreen(t,n),r=core.getResponsiveValueByScreen(o,n);l={...l,[n]:1>=(i?.cols?.length||1)?a:r}}),l},getAspectRatioSettings=(e,t)=>{let o={desktop:e?.desktop?.width,tablet:e?.tablet?.width,mobile:e?.mobile?.width},l={desktop:e?.desktop?.height,tablet:e?.tablet?.height,mobile:e?.mobile?.height},n={desktop:t?.desktop==="custom"?`${core.getResponsiveValueByScreen(o,"desktop")}/${core.getResponsiveValueByScreen(l,"desktop")}`:t?.desktop==="cover"?"unset":t?.desktop,tablet:t?.tablet==="custom"?`${core.getResponsiveValueByScreen(o,"tablet")}/${core.getResponsiveValueByScreen(l,"tablet")}`:t?.tablet==="cover"?"unset":t?.tablet,mobile:t?.mobile==="custom"?`${core.getResponsiveValueByScreen(o,"mobile")}/${core.getResponsiveValueByScreen(l,"mobile")}`:t?.mobile==="cover"?"unset":t?.mobile};return n},getEnableBgImageByDevice=(e,t)=>{if(!core.getResponsiveValueByScreen(getBgImage(t),e))return!1;if(!t?.[e]){if("mobile"===e)return t?.tablet?.type==="image"||t?.desktop?.type==="image"&&!t?.tablet;if("tablet"===e)return t?.desktop?.type==="image"}return t?.[e]?.type==="image"},getBgImage=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},imagePlaceholder=e=>{let t=getBgImage(e);return{desktop:helpers.createBlurDataURL(t?.desktop?.width??0,t?.desktop?.height??0),tablet:helpers.createBlurDataURL(t?.tablet?.width??t?.desktop?.width??0,t?.tablet?.height??t?.desktop?.width??0),mobile:helpers.createBlurDataURL(t?.mobile?.width??t?.tablet?.width??t?.desktop?.width??0,t?.mobile?.height??t?.tablet?.height??t?.desktop?.width??0)}},getBgImageByScreen=(e,t,o,l)=>{if(!e)return"";let n=getBgImage(e),i=core.getResponsiveValueByScreen(e,t),a=o?`url(${imagePlaceholder(e)[t]})`:`url(${helpers.getImageSrc(core.getResponsiveValueByScreen(n,t),t,l)})`,r=i?.color?`, ${i.color}`:"";return i?.color?.includes(core.GRADIENT_BGR_KEY)&&i?.type==="image"?`${a}${r}`:i?.color?.includes(core.GRADIENT_BGR_KEY)&&i?.type!=="image"?`${i.color}`:i?.type==="image"?a:"url()"},getBackgroundImageHeroBanner=(e,t=!1,o=!1)=>{if(!e)return;let l={};return core.DEVICES.forEach(n=>{l={...l,[n]:getBgImageByScreen(e,n,t,o)}}),core.makeStyleResponsive("bgi",l)},getAttachmentDevice=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let l=e?.[o]?.attachment;t={...t,[o]:"fixed"===l?"fixed":"absolute"}}),t},horizontalAlign=(e,t,o)=>mapContentPositionToHorizontal(getContentPosition(e,t,o)),scrollToContentBanner=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),getDataVideoHeroBannerResponsive=(e,t)=>{switch(e){case"desktop":if(t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"tablet":if(t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.tablet&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"mobile":if(t?.mobile?.type==="video")return{device:"mobile",data:t.mobile};if(!t?.mobile&&t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.mobile&&!t?.tablet?.type&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop}}},getVisibilityStyle=e=>e?Object.keys(e).filter(e=>["--d","--d-tablet","--d-mobile"].includes(e)).reduce((t,o)=>({...t,[o]:e?.[o]!=="none"?"flex":e?.[o]}),{}):{},getStyleAspectRatioHeroBannerCustom=(e,t,o)=>{let l=core.getAspectRatioGlobalSize(t),n=["desktop","mobile","tablet"];return n.forEach(n=>{let i=core.getResponsiveValueByScreen(t,n),a=!!getDataVideoHeroBannerResponsive(n,e),r=i?.shape,s=i?.height,g="original"===r&&"fit-content"!==s,p=g&&a;p&&(l={...l,[n]:"16/9"}),o&&o[n]&&getDataVideoHeroBannerResponsive(n,e)?.data?.videoType==="html5"&&(l={...l,[n]:o[n]})}),core.makeStyleResponsive("aspect",l)},mapContentPositionToHorizontal=e=>{let t={};for(let o in e)"top"===e[o]?t[o]="start":"bottom"===e[o]?t[o]="end":t[o]="center";return t},getDisplayStyleByFitContent=(e,t)=>{let o={desktop:"none",tablet:"none",mobile:"none"},l=["desktop","mobile","tablet"];return l.forEach(l=>{let n=core.getResponsiveValueByScreen(e,l),i=!!getDataVideoHeroBannerResponsive(l,t),a=n?.shape,r=n?.height,s="original"===a&&"fit-content"!==r&&!i;o={...o,[l]:s?"block":"none"}}),core.makeStyleResponsive("d",o)},getWidth=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let l=e?.[o];l&&(t={...t,[o]:"default"===l?"var(--g-ct-w, 1200px)":l})}),t},getPercentageVisible=(e,t)=>{let{top:o,height:l}=e,n=-l;if(o<n)return 0;if(o>t)return 100;let i=(o-n)/(t-n)*100;return Math.min(Math.max(i,0),100)},isScaleImage=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,getHeightHeroBanner=(e,t)=>{let o={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let n=isScaleImage({enableParallax:t,attachment:e[l]?.attachment});o={...o,[l]:t?"150%":n?"100vh":"100%"}}),core.makeStyleResponsive("h",o)},getWidthHeroBanner=(e,t)=>{let o={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let n=isScaleImage({enableParallax:t,attachment:e[l]?.attachment});o={...o,[l]:n?"100vw":"100%"}}),core.makeStyleResponsive("w",o)},getTopHeroBanner=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{t={...t,[o]:e[o]?.attachment==="fixed"?"0px":""}}),core.makeStyleResponsive("top",t)},getStyleHeroBannerBg=(e,t)=>{let o=getHeightHeroBanner(e,t),l=getWidthHeroBanner(e,t),n=getTopHeroBanner(e);return{...o,...l,...n}},calcRounderClipPath=(e,t=0,o=0)=>{let l=t,n=t;if(t>o?l=o:n=o,e>=999){let t=e-l;return t>0?t:0}let i=e-n;return i>0?i:0},getClipPath=(e,t)=>{if(!t||!e)return"inset(0 0 0)";let[o,l,n,i]=e.split(" ").map(e=>parseInt(e??"0")),{btlr:a,btrr:r,bbrr:s,bblr:g}=t,p=calcRounderClipPath(parseInt(a??"0"),o,i),c=calcRounderClipPath(parseInt(r??"0"),o,l),b=calcRounderClipPath(parseInt(s??"0"),l,n),d=calcRounderClipPath(parseInt(g??"0"),n,i);return`inset(0 0 0 round ${p}px ${c}px ${b}px ${d}px)`},getClassAlignBanner=e=>({"!gp-self-start":"left"===e.desktop,"!gp-self-center":"center"===e.desktop,"!gp-self-end":"right"===e.desktop,"tablet:!gp-self-start":"left"===e.tablet,"tablet:!gp-self-center":"center"===e.tablet,"tablet:!gp-self-end":"right"===e.tablet,"mobile:!gp-self-start":"left"===e.mobile,"mobile:!gp-self-center":"center"===e.mobile,"mobile:!gp-self-end":"right"===e.mobile}),getClassSpaceBetween=(e,t,o)=>{let l=getResponsiveSetting(e),n=getResponsiveSetting(t),i=getResponsiveSetting(o),a=1>=(l?.desktop?.cols?.length||1)?n.desktop:i.desktop,r=1>=(l?.tablet?.cols?.length||1)?n.tablet:i.tablet,s=1>=(l?.mobile?.cols?.length||1)?n.mobile:i.mobile;return{"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":l.desktop?.cols?.length===1&&"space-between"===a,"!gp-content-stretch [&>*]:!gp-justify-start":l.desktop?.cols?.length===1&&"top"===a,"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":l.tablet?.cols?.length===1&&"space-between"===r,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start":l.tablet?.cols?.length===1&&"top"===r,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center":l.tablet?.cols?.length===1&&"center"===r,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end":l.tablet?.cols?.length===1&&"bottom"===r,"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":l.mobile?.cols?.length===1&&"space-between"===s,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start":l.mobile?.cols?.length===1&&"top"===s,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center":l.mobile?.cols?.length===1&&"center"===s,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end":l.mobile?.cols?.length===1&&"bottom"===s}},getClassSpaceBetweenLeftRight=e=>{let t=getResponsiveSetting(e),o=t?.desktop?.type=="left-distributed"||t?.desktop?.type=="right-distributed",l=t?.tablet?.type=="left-distributed"||t?.tablet?.type=="right-distributed",n=t?.mobile?.type=="left-distributed"||t?.mobile?.type=="right-distributed";return{"gp-h-full tablet:gp-h-auto mobile:gp-h-auto [&>*]:!gp-justify-between":o,"tablet:!gp-h-full tablet:[&>*]:!gp-justify-between mobile:gp-h-auto":l,"mobile:!gp-h-full mobile:[&>*]:!gp-justify-between":n,"mobile:!gp-h-auto":!n}},getClassForStretchContent=e=>{let t={desktop:"none",tablet:"none",mobile:"none"},o=["desktop","mobile","tablet"];return o.forEach(o=>{let l=core.getResponsiveValueByScreen(e,o);t={...t,[o]:l}}),core.cls("space-between"===t.desktop?"[&>*>*]:!gp-justify-between":"","space-between"===t.tablet?"tablet:[&>*>*]:!gp-justify-between ":`tablet:[&>*>*]:!gp-justify-${e?.tablet}`,"space-between"===t.mobile?"mobile:[&>*>*]:!gp-justify-between ":`mobile:[&>*>*]:!gp-justify-${e?.mobile}`)},getClassForContentByFitContent=(e,t)=>{let o={desktop:!1,tablet:!1,mobile:!1},l=["desktop","mobile","tablet"];return l.forEach(l=>{let n=core.getResponsiveValueByScreen(e,l),i=!!getDataVideoHeroBannerResponsive(l,t),a=n?.shape,r=n?.height,s="original"===a&&"fit-content"!==r;o={...o,[l]:s&&!i}}),core.cls(o.desktop?"!gp-absolute":"",o.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",o.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},getClassContentPosition=e=>{let t={center:"center",top:"start",bottom:"end","space-between":"between"},o=e.desktop||"center",l=e.tablet||o,n=e.mobile||l;return{[`gp-justify-${t[o||"center"]}`]:!!o,[`tablet:gp-justify-${t[l||"center"]}`]:!!l,[`mobile:gp-justify-${t[n||"center"]}`]:!!n}},getResponsiveSetting=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,l=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:l}},showVideoType=e=>core.DEVICES.some(t=>{let o=core.getValueByDevice(e,t);return o?.type!=="color"&&o?.type!=="image"&&!!o&&(o?.videoType==="html5"&&o?.videoHtml5||o?.videoType==="youtube"&&o?.video)});function debounce(e,t){let o;return function(...l){clearTimeout(o),o=setTimeout(()=>e.apply(this,l),t)}}const fallbackImg="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",getBannerLink=e=>{let t=e?.link;return t?.type==="go-to-sales-page"?{type:"go-to-sales-page",link:constant.HREF_TO_SALES_PAGE,target:"_self"}:t},formatHoverScale=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",opacityEnabledData=e=>{let{overlayColor:t,overlayOpacity:o}=e??{},l=!t?.normal||o?.normal=="0%"||!o?.normal;return{disableOpacity:l}},getOpacityHover=e=>{let{overlayOpacity:t}=e??{},o="number"!=typeof t?.hover||isNaN(t?.hover)?"string"==typeof t?.hover?`${parseInt(t?.hover)}%`:"":`${t?.hover}%`,l="number"!=typeof t?.normal||isNaN(t?.normal)?"string"==typeof t?.normal?`${parseInt(t?.normal)}%`:"0%":`${t?.normal}%`;return o||l};exports.debounce=debounce,exports.fallbackImg="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",exports.formatHoverScale=formatHoverScale,exports.getAspectRatioSettings=getAspectRatioSettings,exports.getAttachmentDevice=getAttachmentDevice,exports.getBackgroundImageHeroBanner=getBackgroundImageHeroBanner,exports.getBannerLink=getBannerLink,exports.getBgImage=getBgImage,exports.getClassAlignBanner=getClassAlignBanner,exports.getClassContentPosition=getClassContentPosition,exports.getClassForContentByFitContent=getClassForContentByFitContent,exports.getClassForStretchContent=getClassForStretchContent,exports.getClassSpaceBetween=getClassSpaceBetween,exports.getClassSpaceBetweenLeftRight=getClassSpaceBetweenLeftRight,exports.getClipPath=getClipPath,exports.getContentPosition=getContentPosition,exports.getDataVideoHeroBannerResponsive=getDataVideoHeroBannerResponsive,exports.getDisplayStyleByFitContent=getDisplayStyleByFitContent,exports.getEnableBgImageByDevice=getEnableBgImageByDevice,exports.getOpacityHover=getOpacityHover,exports.getPercentageVisible=getPercentageVisible,exports.getResponsiveSetting=getResponsiveSetting,exports.getStyleAspectRatioHeroBannerCustom=getStyleAspectRatioHeroBannerCustom,exports.getStyleHeroBannerBg=getStyleHeroBannerBg,exports.getVisibilityStyle=getVisibilityStyle,exports.getWidth=getWidth,exports.horizontalAlign=horizontalAlign,exports.imagePlaceholder=imagePlaceholder,exports.isScaleImage=isScaleImage,exports.mapContentPositionToHorizontal=mapContentPositionToHorizontal,exports.opacityEnabledData=opacityEnabledData,exports.scrollToContentBanner=scrollToContentBanner,exports.showVideoType=showVideoType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),helpers=require("./helpers.js");function filterTruthyStyles(e){return Object.fromEntries(Object.entries(e||{}).filter(([,e])=>!!e))}const getStyle=(e,t,r)=>{let{sizeSetting:l,background:o}=e??{},{ratioOptions:a,aspectRatio:i}=t??{},s={...r,...helpers.getVisibilityStyle(r),...core.makeStyleWithDefault("w",core.getWidthByShapeGlobalSize(l,!0),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...helpers.getStyleAspectRatioHeroBannerCustom(o,l,helpers.getAspectRatioSettings(a,i)),...core.makeStyleResponsive("h",core.getHeightByShapeGlobalSize(l))};return filterTruthyStyles(s)},getContainerStyle=(e,t)=>{let{sizeSetting:r,background:l,borderBg:o,cornerBg:a,shadowBg:i,hasActiveShadow:s}=e??{},{ratioOptions:y,aspectRatio:g}=t??{},
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),helpers=require("./helpers.js");function filterTruthyStyles(e){return Object.fromEntries(Object.entries(e||{}).filter(([,e])=>!!e))}const getStyle=(e,t,r)=>{let{sizeSetting:l,background:o}=e??{},{ratioOptions:a,aspectRatio:i}=t??{},s={...r,...helpers.getVisibilityStyle(r),...core.makeStyleWithDefault("w",core.getWidthByShapeGlobalSize(l,!0),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...helpers.getStyleAspectRatioHeroBannerCustom(o,l,helpers.getAspectRatioSettings(a,i)),...core.makeStyleResponsive("h",core.getHeightByShapeGlobalSize(l))};return filterTruthyStyles(s)},getContainerStyle=(e,t)=>{let{sizeSetting:r,background:l,borderBg:o,cornerBg:a,shadowBg:i,hasActiveShadow:s}=e??{},{ratioOptions:y,aspectRatio:g}=t??{},n={...core.makeStyleResponsive("h",core.getHeightByShapeGlobalSize(r)),...helpers.getStyleAspectRatioHeroBannerCustom(l,r,helpers.getAspectRatioSettings(y,g)),...core.makeStyle({bs:o?.border??o?.border,bw:o?.width??o?.width,bc:core.getSingleColorVariable(o?.color)}),...core.getRadiusStyleActiveState({...a,active:{...a||{},radiusType:"custom"}}),...l?{...core.getStyleBgColor(l)}:{},...core.getStyleShadow({value:i,styleAppliedFor:"box-shadow",isEnableShadow:s})};return filterTruthyStyles(n)},getOverlayStyle=e=>{let{overlayColor:t,overlayOpacity:r,hoverEffect:l}=e??{},{disableOpacity:o}=helpers.opacityEnabledData(e),a="number"!=typeof r?.normal||isNaN(r?.normal)?"string"==typeof r?.normal?`${parseInt(r?.normal)}%`:"0%":`${r?.normal}%`,i=core.makeStyleState("op",{normal:a,hover:helpers.getOpacityHover(e)}),s=core.getGlobalColorStateStyle("bgc",{...t,hover:t?.hover||t?.normal});o&&(delete s?.["--bgc"],delete i?.["--op"]),l||(delete s?.["--hvr-bgc"],delete i?.["--hvr-op"]);let y={...s,...i,"--top":"0","--left":"0"};return filterTruthyStyles(y)},getRowStyle=e=>{let{contentPadding:t}=e??{},r={...core.getResponsiveStylePadding(t)};return filterTruthyStyles(r)},getAdaptiveStyle=e=>{let{sizeSetting:t,background:r}=e??{},l={...helpers.getDisplayStyleByFitContent(t,r),...core.makeStyleResponsive("h",core.getHeightByShapeGlobalSize(t)),...core.makeStyleWithDefault("w",core.getWidthByShapeGlobalSize(t,!0),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),"--op":0,"--z":-1};return filterTruthyStyles(l)},getBackgroundStyle=(e,t,r)=>{let{hoverEffectScale:l,background:o,hoverEffectDuration:a}=e??{},i={...helpers.getStyleHeroBannerBg(helpers.getResponsiveSetting(o||{}),t),...core.getStyleBackgroundByDevice(o,{ignoreBgAttachment:!0,ignoreBackgroundImage:!0}),"--duration":`${parseInt(`${a}`)??0}s`,"--scale":helpers.formatHoverScale(l),...core.makeStyleResponsive("pos",helpers.getAttachmentDevice(o)),transform:r,transition:"transform 300ms cubic-bezier(0,0,0,1)"};return filterTruthyStyles(i)},getContainBackgroundStyle=e=>{let{borderBg:t,cornerBg:r}=e??{},l={"clip-path":helpers.getClipPath(t?.width,r)};return filterTruthyStyles(l)},getHtml5VideoStyle=e=>{let t={...core.makeStyleResponsive("aspect",e)};return filterTruthyStyles(t)},getYoutubeIframeStyle=e=>{let t={...core.makeStyleResponsive("aspect",e),"pointer-event":"none"};return filterTruthyStyles(t)};exports.getAdaptiveStyle=getAdaptiveStyle,exports.getBackgroundStyle=getBackgroundStyle,exports.getContainBackgroundStyle=getContainBackgroundStyle,exports.getContainerStyle=getContainerStyle,exports.getHtml5VideoStyle=getHtml5VideoStyle,exports.getOverlayStyle=getOverlayStyle,exports.getRowStyle=getRowStyle,exports.getStyle=getStyle,exports.getYoutubeIframeStyle=getYoutubeIframeStyle;
|
|
@@ -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"),common=require("./utils/common.js");require("./constants.js");var NoDataState=require("../../../common/components/NoDataState.js"),TooltipHover=require("../../../common/components/TooltipHover.js"),system=require("@gem-sdk/system"),attrs=require("./common/attrs.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js");const ProductBadge=e=>{let{setting:s,styles:t,children:r,...a}=e,l=core.useProduct(),c=core.useCurrentVariant(),{moneyFormat:o}=core.useMoneyFormat(),n=core.useCurrentDevice(),{useProductCompareAtPrice:m}=core.useProductBundleDiscount(),i=a?.["bundle-item"],y=core.useEditorMode(),u="STATIC"===core.usePageType(),d=common.getBadgeContent({detail:l,currentVariant:c,bundleItem:i,useProductCompareAtPrice:m},s?.displayContent,o),g=common.getIsNoDiscountState({props:e,product:l,currentVariant:c,moneyFormat:o,useProductCompareAtPrice:m}),j=system.createClass({...classes.getContainerClasses({mode:y,isInstant:u,product:l,currentVariant:c,props:e})}),x=system.createStyle({...styles.getContainerStyle(e)}),C=system.createAttr({...attrs.getEditTooltipAttrs(e)}),p=system.createAttr({...attrs.getNoDataAttrs(e)}),S=system.createClass({...classes.getWrapperClasses(e)}),v=system.createClass({...classes.getSubWrapperClass(e,n)}),T=system.createStyle({...styles.getSubWrapperStyle(e,c,y)}),A=system.createAttr({...attrs.getSubWrapperAttrs(e,l)}),N=styles.getContentStyleInternal(e),R=system.createClass({...classes.getTextContainerClasses()}),h=system.createAttr({...attrs.getContainerAttrs(e)}),q=system.createClass({...classes.getTextWrapperClasses()}),I=system.createStyle({...styles.getTextBadgeWrapperStyles({setting:s,styles:t})}),f=system.createClass({...classes.getTextContentClasses(t)}),D=system.createStyle({...styles.getTextContentStyle({setting:s,styles:t})}),P=system.createAttr({...attrs.getTextContentAttrs()}),b=system.createClass({...classes.getImageContainerClasses()}),W=system.createStyle({...styles.getImageContainerStyles({setting:s,styles:t})}),B=system.createClass({...classes.getImageClasses()}),H=system.createAttr({...attrs.getImageAttr({setting:s})});return l?jsxRuntime.jsxs("div",{...h,style:x,className:j,children:[system.If("edit"===y&&g,jsxRuntime.jsx(TooltipHover.default,{...C,children:jsxRuntime.jsx(NoDataState.default,{...p})}),jsxRuntime.jsx("div",{className:S,children:jsxRuntime.jsxs("div",{...A,className:v,style:T,children:[jsxRuntime.jsx("style",{children:N}),system.If(s?.shape!=="image",jsxRuntime.jsx("div",{className:R,children:jsxRuntime.jsx("div",{className:q,style:I,children:jsxRuntime.jsx("pre",{...P,className:f,style:D,children:d})})}),jsxRuntime.jsx("div",{className:b,style:W,children:jsxRuntime.jsx("img",{...H,className:B,alt:""})}))]})})),core.filterToolbarPreview(r,!0)]}):null};exports.default=ProductBadge;
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),common=require("./utils/common.js");require("./constants.js");var NoDataState=require("../../../common/components/NoDataState.js"),TooltipHover=require("../../../common/components/TooltipHover.js"),system=require("@gem-sdk/system"),attrs=require("./common/attrs.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js");const ProductBadge=e=>{let{setting:s,styles:t,children:r,...a}=e,l=core.useProduct(),c=core.useCurrentVariant(),{moneyFormat:o}=core.useMoneyFormat(),n=core.useCurrentDevice(),{useProductCompareAtPrice:m}=core.useProductBundleDiscount(),i=a?.["bundle-item"],y=core.useEditorMode(),u="STATIC"===core.usePageType(),d=common.getBadgeContent({detail:l,currentVariant:c,bundleItem:i,useProductCompareAtPrice:m},s?.displayContent,o),g=common.getIsNoDiscountState({props:e,product:l,currentVariant:c,moneyFormat:o,useProductCompareAtPrice:m}),j=system.createClass({...classes.getContainerClasses({mode:y,isInstant:u,product:l,currentVariant:c,props:e})}),x=system.createStyle({...styles.getContainerStyle(e)}),C=system.createAttr({...attrs.getEditTooltipAttrs(e)}),p=system.createAttr({...attrs.getNoDataAttrs(e)}),S=system.createClass({...classes.getWrapperClasses(e)}),v=system.createClass({...classes.getSubWrapperClass(e,n)}),T=system.createStyle({...styles.getSubWrapperStyle(e,l,c,y)}),A=system.createAttr({...attrs.getSubWrapperAttrs(e,l)}),N=styles.getContentStyleInternal(e),R=system.createClass({...classes.getTextContainerClasses()}),h=system.createAttr({...attrs.getContainerAttrs(e)}),q=system.createClass({...classes.getTextWrapperClasses()}),I=system.createStyle({...styles.getTextBadgeWrapperStyles({setting:s,styles:t})}),f=system.createClass({...classes.getTextContentClasses(t)}),D=system.createStyle({...styles.getTextContentStyle({setting:s,styles:t})}),P=system.createAttr({...attrs.getTextContentAttrs()}),b=system.createClass({...classes.getImageContainerClasses()}),W=system.createStyle({...styles.getImageContainerStyles({setting:s,styles:t})}),B=system.createClass({...classes.getImageClasses()}),H=system.createAttr({...attrs.getImageAttr({setting:s})});return l?jsxRuntime.jsxs("div",{...h,style:x,className:j,children:[system.If("edit"===y&&g,jsxRuntime.jsx(TooltipHover.default,{...C,children:jsxRuntime.jsx(NoDataState.default,{...p})}),jsxRuntime.jsx("div",{className:S,children:jsxRuntime.jsxs("div",{...A,className:v,style:T,children:[jsxRuntime.jsx("style",{children:N}),system.If(s?.shape!=="image",jsxRuntime.jsx("div",{className:R,children:jsxRuntime.jsx("div",{className:q,style:I,children:jsxRuntime.jsx("pre",{...P,className:f,style:D,children:d})})}),jsxRuntime.jsx("div",{className:b,style:W,children:jsxRuntime.jsx("img",{...H,className:B,alt:""})}))]})})),core.filterToolbarPreview(r,!0)]}):null};exports.default=ProductBadge;
|
|
@@ -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");const getSizeStyles=e=>{let{setting:t,styles:o}=e,r=shape.getShape(t?.shape),a=t?.contentType==="text",
|
|
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 types=require("../types.js");const toggleBadge=(e,r,t)=>{let o=checkShowBadge(e,r,t);return o?"":"!gp-hidden"},checkShowBadge=(e,r,t)=>{if(!t)return;let o=r?.createdAt||"",n=r?.tags||[],
|
|
1
|
+
"use strict";var types=require("../types.js");const toggleBadge=(e,r,t)=>{let o=checkShowBadge(e,r,t);return o?"":"!gp-hidden"},checkShowBadge=(e,r,t)=>{if(!t)return;let o=r?.createdAt||"",n=r?.tags||[],a={...t,product_created_at:o,product_tags:n},i=e?.map(e=>{switch(e?.triggerEvent){case"inventory_status":return inventoryTrigger(a,e);case"discount_price":return discountPriceTrigger(a,e);case"price_range":return priceRangeTrigger(a,e);case"creation_date":return creationDateTrigger(a,e);case"product_tags":return productTagsTrigger(a,e);default:return!1}});return i?.every(e=>!0===e)},compareNumberFunc=(e,r,t)=>{switch(t){case"exact":return e===r.from;case"above":return e>r.from;case"below":return e<r.from;case"exact_or_above":return e>=r.from;case"exact_or_below":return e<=r.from;case"between":return e>=r.from&&e<=r.to;default:return!1}},getMinValueForInventory=e=>e===types.CompareType.ABOVE?0:e===types.CompareType.BELOW?2:1,inventoryTrigger=(e,r)=>{if(void 0===e.inventoryQuantity)return!1;if("in_stock"===r.type){if(!1===e.manageInventory||e.inventoryPolicy?.toLowerCase()=="continue")return!0;if(r.conditionType===types.CompareType.BELOW||r.conditionType===types.CompareType.EXACT_OR_BELOW){let t=getMinValueForInventory(r.conditionType);return compareNumberFunc(e?.inventoryQuantity,{from:1,to:Number(r.from)-t+1},types.CompareType.BETWEEN)}return compareNumberFunc(e?.inventoryQuantity,{from:Number(r.from),to:Number(r?.to)},r.conditionType)}return!1!==e.manageInventory&&e.inventoryPolicy?.toLowerCase()!="continue"&&compareNumberFunc(e.inventoryQuantity,{from:0,to:0},types.CompareType.EXACT_OR_BELOW)},discountPriceTrigger=(e,r)=>{if(e?.compare_at_price===void 0||void 0===e.price||e.compare_at_price<e.price)return!1;let t=(e.compare_at_price-e.price)/100,o=t/(e.compare_at_price/100),n="fixed"===r.discountType?t:Math.round(100*o);return compareNumberFunc(n,{from:Number(r.from),to:Number(r.to)},r.conditionType)},priceRangeTrigger=(e,r)=>{if(void 0===e.price)return!1;let t=e.price/100;return compareNumberFunc(t,{from:Number(r.from),to:Number(r.to)},r.conditionType)},creationDateTrigger=(e,r)=>{if(!e.product_created_at)return!1;let t=new Date(new Date(e.product_created_at).setHours(0,0,0,0)),o=new Date(r.from),n=new Date(r.to),a=t.getTime();if("exact_date"===r.type)return compareNumberFunc(a,{from:o.getTime(),to:0},types.CompareType.EXACT);if("duration"===r.type){let e=new Date().setHours(0,0,0,0),o=(e-t.getTime())/864e5;if(o>=0&&o<=Number(r.days))return!0}return!(o.getTime()>=n.getTime())&&compareNumberFunc(a,{from:o.getTime(),to:n.getTime()},types.CompareType.BETWEEN)},productTagsTrigger=(e,r)=>{let t=e.product_tags||[],o=r.searchTag;return o.some(e=>t.includes(e))};exports.checkShowBadge=checkShowBadge,exports.toggleBadge=toggleBadge;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),classes=require("./common/classes.js");const ProductListItem=e=>{let{pageContext:t,children:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),classes=require("./common/classes.js");const ProductListItem=e=>{let{pageContext:t,children:n}=e,{productItemClass:o,gpProductClass:a}=classes.getClass(e);return core.template`
|
|
2
2
|
<gp-product
|
|
3
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
4
4
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }},"pageContext" : ${JSON.stringify(t)}}'
|
|
5
|
-
class="${
|
|
5
|
+
class="${a}"
|
|
6
6
|
|
|
7
7
|
>
|
|
8
|
-
{%- form 'product', product, id: product_form_id, class: 'form contents ${
|
|
8
|
+
{%- form 'product', product, id: product_form_id, class: 'form contents ${o}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
9
9
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
10
10
|
<input type="hidden" min="1" name="quantity" value="{{ quantity }}" />
|
|
11
11
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
12
|
-
${
|
|
12
|
+
${n}
|
|
13
13
|
{%- endform -%}
|
|
14
14
|
</gp-product>
|
|
15
15
|
`};exports.default=ProductListItem;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),classes=require("./common/classes.js");const ProductListItem=e=>{let{pageContext:t,rawChildren:
|
|
2
|
-
${
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),classes=require("./common/classes.js");const ProductListItem=e=>{let{pageContext:t,rawChildren:n}=e,{productItemClass:o,gpProductClass:a}=classes.getClass(e),r=()=>core.template`
|
|
2
|
+
${n?.map((e,t)=>{if(e)return core.template`
|
|
3
3
|
${core.RenderChildren({...e,index:t})}
|
|
4
4
|
`}).join("")}
|
|
5
5
|
`;return core.template`
|
|
6
6
|
<gp-product
|
|
7
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
7
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
8
8
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }},"pageContext" : ${JSON.stringify(t)}}'
|
|
9
9
|
class="${a}"
|
|
10
10
|
|
|
11
11
|
>
|
|
12
|
-
{%- form 'product', product, id: product_form_id, class: 'form contents ${
|
|
12
|
+
{%- form 'product', product, id: product_form_id, class: 'form contents ${o}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
13
13
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
14
14
|
<input type="hidden" min="1" name="quantity" value="{{ quantity }}" />
|
|
15
15
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
16
|
-
${
|
|
16
|
+
${r()}
|
|
17
17
|
{%- endform -%}
|
|
18
18
|
</gp-product>
|
|
19
19
|
`};exports.default=ProductListItem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Row_liquid=require("../../../grid/components/row/Row.liquid.js"),system=require("@gem-sdk/system"),helpers$1=require("../../../helpers.js"),helpers=require("./common/helpers.js");const Product=e=>{let{children:t,setting:r,style:i,builderProps:a,rawChildren:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Row_liquid=require("../../../grid/components/row/Row.liquid.js"),system=require("@gem-sdk/system"),helpers$1=require("../../../helpers.js"),helpers=require("./common/helpers.js");const Product=e=>{let{children:t,setting:r,style:i,builderProps:a,rawChildren:o,advanced:d}=e,{isSyncProduct:s}=r??{},{rowSetting:n,rowStyles:c,formatVariantId:l,formatProductId:p,productStatus:u,preSelectedOptionIds:f,productHandle:g,advancedStyle:m}=helpers.getData(e),_=()=>core.template`
|
|
2
2
|
{%- liquid
|
|
3
3
|
if request.page_type == 'product'
|
|
4
4
|
if '${u}' == '${helpers.STATIC_PRODUCT_STATUS}'
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
endif
|
|
57
57
|
endif
|
|
58
58
|
-%}
|
|
59
|
-
|
|
59
|
+
`,v=()=>core.template`
|
|
60
60
|
{%- assign gpBkProduct = product -%}
|
|
61
61
|
${system.If(u==helpers.DYNAMIC_PRODUCT_STATUS,y(),_())}
|
|
62
|
-
|
|
62
|
+
`,$=()=>core.template`
|
|
63
63
|
{%- assign initVariantId = ${l} -%}
|
|
64
64
|
{%- assign product_form_id = 'product-form-' | append: "${a?.uid}" -%}
|
|
65
65
|
${l?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
`,S=()=>core.template`
|
|
74
74
|
<div class="gp-text-center">${helpers$1.getStaticLocale("Product","product_not_found")}</div>
|
|
75
75
|
`,I=()=>core.template`
|
|
76
|
-
${
|
|
76
|
+
${$()}
|
|
77
77
|
<gp-product
|
|
78
78
|
data-uid="${a?.uid}"
|
|
79
79
|
data-id="${a?.uid}"
|
|
80
80
|
style="${m}"
|
|
81
|
-
class="${
|
|
82
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${f}], "isSyncProduct": "${s}", "variantSelected": {{ variant | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
81
|
+
class="${d?.cssClass}"
|
|
82
|
+
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${f}], "isSyncProduct": "${s}", "variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
83
83
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }}}'
|
|
84
84
|
>
|
|
85
85
|
<product-form class="product-form">
|
|
@@ -87,13 +87,13 @@
|
|
|
87
87
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
88
88
|
<input type="hidden" name="quantity" value="{{ quantity }}" />
|
|
89
89
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
90
|
-
${Row_liquid.default({builderProps:{...a,uid:a?.uid,uidInteraction:`${a?.uid}-row`},style:i,styles:
|
|
90
|
+
${Row_liquid.default({builderProps:{...a,uid:a?.uid,uidInteraction:`${a?.uid}-row`},style:i,styles:c,setting:n,children:t,rawChildren:o})}
|
|
91
91
|
{%- endform -%}
|
|
92
92
|
</product-form>
|
|
93
93
|
</gp-product>
|
|
94
94
|
{%- assign product = gpBkProduct -%}
|
|
95
95
|
`;return core.template`
|
|
96
|
-
${
|
|
96
|
+
${v()}
|
|
97
97
|
${system.LiquidIf("product != empty and product != null",I(),S())}
|
|
98
98
|
${core.RenderIf(core.isLocalEnv,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-product-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-product-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
99
99
|
`};exports.default=Product;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{
|
|
2
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useEditorMode as i,composeAdvanceStyle as l,useBlogsQuery as a,useArticlesQuery as r,flattenConnection as o,filterToolbarPreview as d,ArticleListProvider as n,makeStyleWithDefault as s,makeWidth as c,makeStyleResponsive as m,getStyleBackgroundByDevice as g,getGradientBgrStyleByDevice as p,getResponsiveValueByScreen as h,cls as u,ArticleProvider as b,isEmptyChildren as f}from"@gem-sdk/core";import w from"../../grid/components/ChildrenDroppable.js";import A from"../../common/components/Loading.js";import{useState as T}from"react";import D from"./ArticleNotFound.js";let ArticleList=y=>{let v=i(),{styles:S,setting:O,className:k,children:I,builderProps:L,advanced:E,builderAttrs:P}=y??{},{articleSetting:G,numberOfArticle:_}=O??{},{articleIds:x,articlePickType:C}=G??{},{border:M,rounded:N,hasBoxShadow:j,boxShadow:B}=E??{},F=l({border:M,rounded:N,hasBoxShadow:j,boxShadow:B,"spacing-setting":E?.["spacing-setting"]}),z={first:x?.length||50,where:{baseIDIn:[...G?.articleIds??[]]},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},R={first:1,where:{baseID:G?.blogId},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"},articlesOrderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},[U,$]=T(!0),V=a("latest"===C?R:null,{revalidateOnMount:!0}),H=r("manually"===C?z:null,{revalidateOnMount:!0}),q=V.data?.blogs?.edges?.[0]?.node,J="manually"===C?H.isLoading:V.isLoading,K="manually"===C?H.isValidating:V.isValidating,Q="manually"===C?H.error:V.error,W=V?.data?.blogs?.edges?.[0]?.node,X="latest"===C?o(W?.articles):o(H?.data?.articles),Y=(e,t)=>({...e??{},blog:{title:t?.title??"",handle:t?.handle??""}}),Z="latest"===C?X?.filter((e,t)=>t<+(_||4)).map(e=>Y(e,W)):"manually"===C&&G?.articleIds?.length?x?.map(e=>{let t=X?.find(t=>t?.baseID===e);return Y(t,t?.blogs?.edges?.[0]?.node)}).filter(Boolean):X.filter((e,t)=>t<(G?.numOfSelectedArticles||4)).map(e=>Y(e,e?.blogs?.edges?.[0]?.node));return Z?.length||J||"edit"!=v?e("div",{...P,className:L?.builderData?.uid,children:[K||J?t(A,{}):Q?e("div",{children:["Error: ",Q?.message]}):Z?.length?t(n,{styles:{horizontalGutter:S?.horizontalGutter,verticalGutter:S?.verticalGutter,spacing:S?.spacing,width:S?.width,height:S?.height},settings:{slidesToShow:O?.slideToShow??{desktop:4,tablet:3,mobile:1}},articles:Z,children:t("div",{"data-id":L?.uid,className:"gp-relative",children:t("div",{style:{...F,...s("w",c(S?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...m("rg",S?.horizontalGutter),...m("cg",S?.verticalGutter),...g(O?.background),...p(O?.background),...m("gtc",{desktop:`repeat(${h(O?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:O?.slideToShow?.tablet&&`repeat(${h(O?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:O?.slideToShow?.mobile&&`repeat(${h(O?.slideToShow,"mobile")}, minmax(0, 1fr))`})},className:u(k,"gp-m-auto gp-grid gp-w-full"),children:Z.map(e=>t(b,{article:e,readOnly:!0,children:t("div",{"data-component-type":"component","data-component-tag":"Article","data-component-label":"Article","data-component-no-setting":!0,"data-article-id":e?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:f(I)?t(w,{}):I})},e?.id))})})}):t("div",{children:"Articles not found"}),d(I,!0)]}):U?e("div",{...P,className:L?.builderData?.uid,children:[t(D,{blogHandle:q?.handle,onClose:()=>$(!1),articlePickType:C??"manually",children:I}),d(I,!0)]}):null};export{ArticleList as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{template as e}from"@gem-sdk/core";import{getDynamicSourceLocales as t}from"../../../helpers.js";import{createStyle as r,createClass as o,If as a}from"@gem-sdk/system";import{composeContainerStyles as s,composeTextareaStyles as m}from"./common/styles.js";import{composeContainerClasses as l,composeTextareaClasses as d}from"./common/classes.js";let FormTextarea=({setting:i,builderProps:c,className:$,builderAttrs:p,advanced:n,pageContext:u,styles:f})=>{let{text:v,name:x,placeholder:y,required:g}=i??{},
|
|
1
|
+
import{template as e}from"@gem-sdk/core";import{getDynamicSourceLocales as t}from"../../../helpers.js";import{createStyle as r,createClass as o,If as a}from"@gem-sdk/system";import{composeContainerStyles as s,composeTextareaStyles as m}from"./common/styles.js";import{composeContainerClasses as l,composeTextareaClasses as d}from"./common/classes.js";let FormTextarea=({setting:i,builderProps:c,className:$,builderAttrs:p,advanced:n,pageContext:u,styles:f})=>{let{text:v,name:x,placeholder:y,required:g,translate:h}=i??{},j=""===x||void 0===x?"contact[note]":x,k=t({val:y,uid:c?.uid,settingId:"placeholder",pageContext:u,translate:h}),F=r(s(n,i)),T=r(m(n,i,f)),q=o(l(n,c)),I=o(d(i,c,$??""));return e`
|
|
2
2
|
<div
|
|
3
3
|
${p}
|
|
4
4
|
data-id="${c?.uid}"
|
|
@@ -10,7 +10,7 @@ import{template as e}from"@gem-sdk/core";import{getDynamicSourceLocales as t}fro
|
|
|
10
10
|
style="${T}"
|
|
11
11
|
placeholder="${k}"
|
|
12
12
|
${a(g,"required")}
|
|
13
|
-
name="${
|
|
13
|
+
name="${j}"
|
|
14
14
|
value="${v}"
|
|
15
15
|
></textarea>
|
|
16
16
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getGlobalColorStateClass as e,getValueByDevice as s}from"@gem-sdk/core";import{getClassAlignBanner as o,getResponsiveSetting as l,getClassContentPosition as a,getContentPosition as t,getClassForContentByFitContent as
|
|
1
|
+
import{getGlobalColorStateClass as e,getValueByDevice as s}from"@gem-sdk/core";import{getClassAlignBanner as o,getResponsiveSetting as l,getClassContentPosition as a,getContentPosition as t,getClassForContentByFitContent as r,getClassForStretchContent as g,opacityEnabledData as p,getClassSpaceBetween as n,getClassSpaceBetweenLeftRight as i,getOpacityHover as u}from"./helpers.js";function composeClasses(e){return e.split(" ").reduce((e,s)=>(e[s]=!0,e),{})}let getClasses=({setting:e,builderProps:s,advancedCssClass:a})=>{let t="gp-group/hero gp-flex gp-w-full gp-flex-col gp-self-center gp-transition-colors gp-duration-200 gp-ease-in-out";return a&&(t+=` ${a}`),{...s?.uid&&{[s.uid]:!0},...composeClasses(t),...o(l(e?.alignBanner||{}))}},getLinkClasses=()=>({...composeClasses("gp-cursor-pointer gp-h-full")}),getContainerClasses=(e,s)=>({...composeClasses("gp-relative gp-flex gp-w-full gp-flex-col gp-items-center gp-overflow-hidden hero-banner-container"),...a(t(e?.layout,s?.contentPosition1Col,s?.contentPosition2Col)||{})}),enableTransitionHover=e=>{let{overlayColor:s}=e??{},o=s?.hover||s?.normal;return o&&"transparent"!==o&&"0%"!=u(e)},getOverlayClasses=s=>{let{overlayColor:o,hoverEffect:l}=s??{},{disableOpacity:a}=p(s),t="gp-absolute gp-inset-0 gp-left-[var(--left)] gp-top-[var(--top)] gp-z-1";return enableTransitionHover(s)&&(t+=" gp-transition-all gp-duration-300"),l&&(t+=" group-hover/hero:gp-bg-[color:var(--hvr-bgc,_var(--bgc))] group-hover/hero:gp-opacity-[var(--hvr-op,_var(--op))]"),e("bg",o,a,!l)&&(t+=` ${e("bg",o,a,!l)}`),composeClasses(t)},getRowClasses=(e,s)=>{let{sizeSetting:o,background:l}=e??{},{verticalAlign:a}=s??{},t=r(o,l),p=g(a),u=n(s?.layout||{},e?.contentPosition1Col||{},e?.contentPosition2Col||{}),c=i(s?.layout||{}),C=`gp-hero-banner-row ${t} ${p}`;return{...composeClasses(C),...u,...c}},getAdaptiveClasses=()=>composeClasses("adaptive-hero-banner"),getAdaptivePictureClasses=()=>composeClasses("gp-w-full"),getBackgroundClasses=(e,s)=>{let o="hero-banner-bg gp-hero-banner-image-background hero-banner-bg-parallax";return s&&(o+=" gp_lazybg"),e&&(o+=" gp-duration-[var(--duration)] group-hover/hero:gp-scale-[var(--scale)] gp-transition-transform"),composeClasses(o)},getContainBackgroundClasses=()=>composeClasses("gp-hero-banner-bg gp-absolute gp-overflow-hidden gp-w-full gp-h-full top-0 left-0"),getHtml5VideoClasses=(e,o=!1)=>{let l="gp-relative",a=s(e,"tablet"),t=s(e,"mobile");return o&&(l+=" gp-hidden"),a&&(l+=" tablet:gp-h-full tablet:gp-object-cover"),t&&(l+=" mobile:gp-h-full mobile:gp-object-cover"),composeClasses(l)},getWrapperYoutubeClasses=()=>composeClasses("gp-pb-[56.25%] gp-h-full gp-w-full !gp-max-w-none gp-pointer-events-none"),getIframeYoutubeClasses=()=>composeClasses("!gp-w-[500%] !gp-ml-[-200%] !gp-h-full !gp-max-w-none gp-scale-[104%]"),getLazyBackgroundClasses=e=>{let s="gp-absolute gp-top-0 gp-invisible gp-w-full gp_lazyload gp-h-full gp_lazyforbg";return"tablet"===e&&(s+=" gp_lazybg_tl"),"mobile"===e&&(s+=" gp_lazybg_mb"),composeClasses(s)};export{enableTransitionHover,getAdaptiveClasses,getAdaptivePictureClasses,getBackgroundClasses,getClasses,getContainBackgroundClasses,getContainerClasses,getHtml5VideoClasses,getIframeYoutubeClasses,getLazyBackgroundClasses,getLinkClasses,getOverlayClasses,getRowClasses,getWrapperYoutubeClasses};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getResponsiveValueByScreen as e,getAspectRatioGlobalSize as t,makeStyleResponsive as l,DEVICES as o,getValueByDevice as i,GRADIENT_BGR_KEY as n,cls as a}from"@gem-sdk/core";import{getImageSrc as r,createBlurDataURL as s}from"../../image/common/helpers.js";import{HREF_TO_SALES_PAGE as g}from"../../constant.js";let getContentPosition=(t,l,i)=>{let n={};return o.map(o=>{let a=e(t,o),r=e(l,o),s=e(i,o);n={...n,[o]:1>=(a?.cols?.length||1)?r:s}}),n},getAspectRatioSettings=(t,l)=>{let o={desktop:t?.desktop?.width,tablet:t?.tablet?.width,mobile:t?.mobile?.width},i={desktop:t?.desktop?.height,tablet:t?.tablet?.height,mobile:t?.mobile?.height},n={desktop:l?.desktop==="custom"?`${e(o,"desktop")}/${e(i,"desktop")}`:l?.desktop==="cover"?"unset":l?.desktop,tablet:l?.tablet==="custom"?`${e(o,"tablet")}/${e(i,"tablet")}`:l?.tablet==="cover"?"unset":l?.tablet,mobile:l?.mobile==="custom"?`${e(o,"mobile")}/${e(i,"mobile")}`:l?.mobile==="cover"?"unset":l?.mobile};return n},getEnableBgImageByDevice=(t,l)=>{if(!e(getBgImage(l),t))return!1;if(!l?.[t]){if("mobile"===t)return l?.tablet?.type==="image"||l?.desktop?.type==="image"&&!l?.tablet;if("tablet"===t)return l?.desktop?.type==="image"}return l?.[t]?.type==="image"},getBgImage=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},imagePlaceholder=e=>{let t=getBgImage(e);return{desktop:s(t?.desktop?.width??0,t?.desktop?.height??0),tablet:s(t?.tablet?.width??t?.desktop?.width??0,t?.tablet?.height??t?.desktop?.width??0),mobile:s(t?.mobile?.width??t?.tablet?.width??t?.desktop?.width??0,t?.mobile?.height??t?.tablet?.height??t?.desktop?.width??0)}},getBgImageByScreen=(t,l,o,i)=>{if(!t)return"";let a=getBgImage(t),s=e(t,l),g=o?`url(${imagePlaceholder(t)[l]})`:`url(${r(e(a,l),l,i)})`,p=s?.color?`, ${s.color}`:"";return s?.color?.includes(n)&&s?.type==="image"?`${g}${p}`:s?.color?.includes(n)&&s?.type!=="image"?`${s.color}`:s?.type==="image"?g:"url()"},getBackgroundImageHeroBanner=(e,t=!1,i=!1)=>{if(!e)return;let n={};return o.forEach(l=>{n={...n,[l]:getBgImageByScreen(e,l,t,i)}}),l("bgi",n)},getAttachmentDevice=e=>{let t={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let o=e?.[l]?.attachment;t={...t,[l]:"fixed"===o?"fixed":"absolute"}}),t},horizontalAlign=(e,t,l)=>mapContentPositionToHorizontal(getContentPosition(e,t,l)),scrollToContentBanner=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),getDataVideoHeroBannerResponsive=(e,t)=>{switch(e){case"desktop":if(t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"tablet":if(t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.tablet&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"mobile":if(t?.mobile?.type==="video")return{device:"mobile",data:t.mobile};if(!t?.mobile&&t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.mobile&&!t?.tablet?.type&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop}}},getVisibilityStyle=e=>e?Object.keys(e).filter(e=>["--d","--d-tablet","--d-mobile"].includes(e)).reduce((t,l)=>({...t,[l]:e?.[l]!=="none"?"flex":e?.[l]}),{}):{},getStyleAspectRatioHeroBannerCustom=(o,i,n)=>{let a=t(i),r=["desktop","mobile","tablet"];return r.forEach(t=>{let l=e(i,t),r=!!getDataVideoHeroBannerResponsive(t,o),s=l?.shape,g=l?.height,p="original"===s&&"fit-content"!==g,b=p&&r;b&&(a={...a,[t]:"16/9"}),n&&n[t]&&getDataVideoHeroBannerResponsive(t,o)?.data?.videoType==="html5"&&(a={...a,[t]:n[t]})}),l("aspect",a)},mapContentPositionToHorizontal=e=>{let t={};for(let l in e)"top"===e[l]?t[l]="start":"bottom"===e[l]?t[l]="end":t[l]="center";return t},getDisplayStyleByFitContent=(t,o)=>{let i={desktop:"none",tablet:"none",mobile:"none"},n=["desktop","mobile","tablet"];return n.forEach(l=>{let n=e(t,l),a=!!getDataVideoHeroBannerResponsive(l,o),r=n?.shape,s=n?.height,g="original"===r&&"fit-content"!==s&&!a;i={...i,[l]:g?"block":"none"}}),l("d",i)},getWidth=e=>{let t={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let o=e?.[l];o&&(t={...t,[l]:"default"===o?"var(--g-ct-w, 1200px)":o})}),t},getPercentageVisible=(e,t)=>{let{top:l,height:o}=e,i=-o;if(l<i)return 0;if(l>t)return 100;let n=(l-i)/(t-i)*100;return Math.min(Math.max(n,0),100)},isScaleImage=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,getHeightHeroBanner=(e,t)=>{let o={},i=["desktop","mobile","tablet"];return i.forEach(l=>{let i=isScaleImage({enableParallax:t,attachment:e[l]?.attachment});o={...o,[l]:t?"150%":i?"100vh":"100%"}}),l("h",o)},getWidthHeroBanner=(e,t)=>{let o={},i=["desktop","mobile","tablet"];return i.forEach(l=>{let i=isScaleImage({enableParallax:t,attachment:e[l]?.attachment});o={...o,[l]:i?"100vw":"100%"}}),l("w",o)},getTopHeroBanner=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(l=>{t={...t,[l]:e[l]?.attachment==="fixed"?"0px":""}}),l("top",t)},getStyleHeroBannerBg=(e,t)=>{let l=getHeightHeroBanner(e,t),o=getWidthHeroBanner(e,t),i=getTopHeroBanner(e);return{...l,...o,...i}},calcRounderClipPath=(e,t=0,l=0)=>{let o=t,i=t;if(t>l?o=l:i=l,e>=999){let t=e-o;return t>0?t:0}let n=e-i;return n>0?n:0},getClipPath=(e,t)=>{if(!t||!e)return"inset(0 0 0)";let[l,o,i,n]=e.split(" ").map(e=>parseInt(e??"0")),{btlr:a,btrr:r,bbrr:s,bblr:g}=t,p=calcRounderClipPath(parseInt(a??"0"),l,n),b=calcRounderClipPath(parseInt(r??"0"),l,o),c=calcRounderClipPath(parseInt(s??"0"),o,i),d=calcRounderClipPath(parseInt(g??"0"),i,n);return`inset(0 0 0 round ${p}px ${b}px ${c}px ${d}px)`},getClassAlignBanner=e=>({"!gp-self-start":"left"===e.desktop,"!gp-self-center":"center"===e.desktop,"!gp-self-end":"right"===e.desktop,"tablet:!gp-self-start":"left"===e.tablet,"tablet:!gp-self-center":"center"===e.tablet,"tablet:!gp-self-end":"right"===e.tablet,"mobile:!gp-self-start":"left"===e.mobile,"mobile:!gp-self-center":"center"===e.mobile,"mobile:!gp-self-end":"right"===e.mobile}),getClassSpaceBetween=(e,t,l)=>{let o=getResponsiveSetting(e),i=getResponsiveSetting(t),n=getResponsiveSetting(l),a=1>=(o?.desktop?.cols?.length||1)?i.desktop:n.desktop,r=1>=(o?.tablet?.cols?.length||1)?i.tablet:n.tablet,s=1>=(o?.mobile?.cols?.length||1)?i.mobile:n.mobile;return{"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":o.desktop?.cols?.length===1&&"space-between"===a,"!gp-content-stretch [&>*]:!gp-justify-start":o.desktop?.cols?.length===1&&"top"===a,"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":o.tablet?.cols?.length===1&&"space-between"===r,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start":o.tablet?.cols?.length===1&&"top"===r,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center":o.tablet?.cols?.length===1&&"center"===r,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end":o.tablet?.cols?.length===1&&"bottom"===r,"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":o.mobile?.cols?.length===1&&"space-between"===s,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start":o.mobile?.cols?.length===1&&"top"===s,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center":o.mobile?.cols?.length===1&&"center"===s,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end":o.mobile?.cols?.length===1&&"bottom"===s}},getClassSpaceBetweenLeftRight=e=>{let t=getResponsiveSetting(e),l=t?.desktop?.type=="left-distributed"||t?.desktop?.type=="right-distributed",o=t?.tablet?.type=="left-distributed"||t?.tablet?.type=="right-distributed",i=t?.mobile?.type=="left-distributed"||t?.mobile?.type=="right-distributed";return{"gp-h-full tablet:gp-h-auto mobile:gp-h-auto [&>*]:!gp-justify-between":l,"tablet:!gp-h-full tablet:[&>*]:!gp-justify-between mobile:gp-h-auto":o,"mobile:!gp-h-full mobile:[&>*]:!gp-justify-between":i,"mobile:!gp-h-auto":!i}},getClassForStretchContent=t=>{let l={desktop:"none",tablet:"none",mobile:"none"},o=["desktop","mobile","tablet"];return o.forEach(o=>{let i=e(t,o);l={...l,[o]:i}}),a("space-between"===l.desktop?"[&>*>*]:!gp-justify-between":"","space-between"===l.tablet?"tablet:[&>*>*]:!gp-justify-between ":`tablet:[&>*>*]:!gp-justify-${t?.tablet}`,"space-between"===l.mobile?"mobile:[&>*>*]:!gp-justify-between ":`mobile:[&>*>*]:!gp-justify-${t?.mobile}`)},getClassForContentByFitContent=(t,l)=>{let o={desktop:!1,tablet:!1,mobile:!1},i=["desktop","mobile","tablet"];return i.forEach(i=>{let n=e(t,i),a=!!getDataVideoHeroBannerResponsive(i,l),r=n?.shape,s=n?.height,g="original"===r&&"fit-content"!==s;o={...o,[i]:g&&!a}}),a(o.desktop?"!gp-absolute":"",o.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",o.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},getClassContentPosition=e=>{let t={center:"center",top:"start",bottom:"end","space-between":"between"},l=e.desktop||"center",o=e.tablet||l,i=e.mobile||o;return{[`gp-justify-${t[l||"center"]}`]:!!l,[`tablet:gp-justify-${t[o||"center"]}`]:!!o,[`mobile:gp-justify-${t[i||"center"]}`]:!!i}},getResponsiveSetting=e=>{let t=e.desktop,l=e.tablet?e.tablet:t,o=e.mobile?e.mobile:l;return{desktop:t,tablet:l,mobile:o}},showVideoType=e=>o.some(t=>{let l=i(e,t);return l?.type!=="color"&&l?.type!=="image"&&!!l&&(l?.videoType==="html5"&&l?.videoHtml5||l?.videoType==="youtube"&&l?.video)});function debounce(e,t){let l;return function(...o){clearTimeout(l),l=setTimeout(()=>e.apply(this,o),t)}}let fallbackImg="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",getBannerLink=e=>{let t=e?.link;return t?.type==="go-to-sales-page"?{type:"go-to-sales-page",link:g,target:"_self"}:t},formatHoverScale=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",opacityEnabledData=e=>{let{overlayColor:t,overlayOpacity:l,hoverEffect:o}=e??{},i=!t?.normal||l?.normal=="0%"||!l?.normal,n=!o;return{disableOpacity:i,disableHoverOpacity:n}};export{debounce,fallbackImg,formatHoverScale,getAspectRatioSettings,getAttachmentDevice,getBackgroundImageHeroBanner,getBannerLink,getBgImage,getClassAlignBanner,getClassContentPosition,getClassForContentByFitContent,getClassForStretchContent,getClassSpaceBetween,getClassSpaceBetweenLeftRight,getClipPath,getContentPosition,getDataVideoHeroBannerResponsive,getDisplayStyleByFitContent,getEnableBgImageByDevice,getPercentageVisible,getResponsiveSetting,getStyleAspectRatioHeroBannerCustom,getStyleHeroBannerBg,getVisibilityStyle,getWidth,horizontalAlign,imagePlaceholder,isScaleImage,mapContentPositionToHorizontal,opacityEnabledData,scrollToContentBanner,showVideoType};
|
|
1
|
+
import{getResponsiveValueByScreen as e,getAspectRatioGlobalSize as t,makeStyleResponsive as o,DEVICES as l,getValueByDevice as i,GRADIENT_BGR_KEY as n,cls as a}from"@gem-sdk/core";import{getImageSrc as r,createBlurDataURL as s}from"../../image/common/helpers.js";import{HREF_TO_SALES_PAGE as g}from"../../constant.js";let getContentPosition=(t,o,i)=>{let n={};return l.map(l=>{let a=e(t,l),r=e(o,l),s=e(i,l);n={...n,[l]:1>=(a?.cols?.length||1)?r:s}}),n},getAspectRatioSettings=(t,o)=>{let l={desktop:t?.desktop?.width,tablet:t?.tablet?.width,mobile:t?.mobile?.width},i={desktop:t?.desktop?.height,tablet:t?.tablet?.height,mobile:t?.mobile?.height},n={desktop:o?.desktop==="custom"?`${e(l,"desktop")}/${e(i,"desktop")}`:o?.desktop==="cover"?"unset":o?.desktop,tablet:o?.tablet==="custom"?`${e(l,"tablet")}/${e(i,"tablet")}`:o?.tablet==="cover"?"unset":o?.tablet,mobile:o?.mobile==="custom"?`${e(l,"mobile")}/${e(i,"mobile")}`:o?.mobile==="cover"?"unset":o?.mobile};return n},getEnableBgImageByDevice=(t,o)=>{if(!e(getBgImage(o),t))return!1;if(!o?.[t]){if("mobile"===t)return o?.tablet?.type==="image"||o?.desktop?.type==="image"&&!o?.tablet;if("tablet"===t)return o?.desktop?.type==="image"}return o?.[t]?.type==="image"},getBgImage=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},imagePlaceholder=e=>{let t=getBgImage(e);return{desktop:s(t?.desktop?.width??0,t?.desktop?.height??0),tablet:s(t?.tablet?.width??t?.desktop?.width??0,t?.tablet?.height??t?.desktop?.width??0),mobile:s(t?.mobile?.width??t?.tablet?.width??t?.desktop?.width??0,t?.mobile?.height??t?.tablet?.height??t?.desktop?.width??0)}},getBgImageByScreen=(t,o,l,i)=>{if(!t)return"";let a=getBgImage(t),s=e(t,o),g=l?`url(${imagePlaceholder(t)[o]})`:`url(${r(e(a,o),o,i)})`,p=s?.color?`, ${s.color}`:"";return s?.color?.includes(n)&&s?.type==="image"?`${g}${p}`:s?.color?.includes(n)&&s?.type!=="image"?`${s.color}`:s?.type==="image"?g:"url()"},getBackgroundImageHeroBanner=(e,t=!1,i=!1)=>{if(!e)return;let n={};return l.forEach(o=>{n={...n,[o]:getBgImageByScreen(e,o,t,i)}}),o("bgi",n)},getAttachmentDevice=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let l=e?.[o]?.attachment;t={...t,[o]:"fixed"===l?"fixed":"absolute"}}),t},horizontalAlign=(e,t,o)=>mapContentPositionToHorizontal(getContentPosition(e,t,o)),scrollToContentBanner=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),getDataVideoHeroBannerResponsive=(e,t)=>{switch(e){case"desktop":if(t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"tablet":if(t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.tablet&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop};break;case"mobile":if(t?.mobile?.type==="video")return{device:"mobile",data:t.mobile};if(!t?.mobile&&t?.tablet?.type==="video")return{device:"tablet",data:t.tablet};if(!t?.mobile&&!t?.tablet?.type&&t?.desktop?.type==="video")return{device:"desktop",data:t.desktop}}},getVisibilityStyle=e=>e?Object.keys(e).filter(e=>["--d","--d-tablet","--d-mobile"].includes(e)).reduce((t,o)=>({...t,[o]:e?.[o]!=="none"?"flex":e?.[o]}),{}):{},getStyleAspectRatioHeroBannerCustom=(l,i,n)=>{let a=t(i),r=["desktop","mobile","tablet"];return r.forEach(t=>{let o=e(i,t),r=!!getDataVideoHeroBannerResponsive(t,l),s=o?.shape,g=o?.height,p="original"===s&&"fit-content"!==g,b=p&&r;b&&(a={...a,[t]:"16/9"}),n&&n[t]&&getDataVideoHeroBannerResponsive(t,l)?.data?.videoType==="html5"&&(a={...a,[t]:n[t]})}),o("aspect",a)},mapContentPositionToHorizontal=e=>{let t={};for(let o in e)"top"===e[o]?t[o]="start":"bottom"===e[o]?t[o]="end":t[o]="center";return t},getDisplayStyleByFitContent=(t,l)=>{let i={desktop:"none",tablet:"none",mobile:"none"},n=["desktop","mobile","tablet"];return n.forEach(o=>{let n=e(t,o),a=!!getDataVideoHeroBannerResponsive(o,l),r=n?.shape,s=n?.height,g="original"===r&&"fit-content"!==s&&!a;i={...i,[o]:g?"block":"none"}}),o("d",i)},getWidth=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let l=e?.[o];l&&(t={...t,[o]:"default"===l?"var(--g-ct-w, 1200px)":l})}),t},getPercentageVisible=(e,t)=>{let{top:o,height:l}=e,i=-l;if(o<i)return 0;if(o>t)return 100;let n=(o-i)/(t-i)*100;return Math.min(Math.max(n,0),100)},isScaleImage=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,getHeightHeroBanner=(e,t)=>{let l={},i=["desktop","mobile","tablet"];return i.forEach(o=>{let i=isScaleImage({enableParallax:t,attachment:e[o]?.attachment});l={...l,[o]:t?"150%":i?"100vh":"100%"}}),o("h",l)},getWidthHeroBanner=(e,t)=>{let l={},i=["desktop","mobile","tablet"];return i.forEach(o=>{let i=isScaleImage({enableParallax:t,attachment:e[o]?.attachment});l={...l,[o]:i?"100vw":"100%"}}),o("w",l)},getTopHeroBanner=e=>{let t={},l=["desktop","mobile","tablet"];return l.forEach(o=>{t={...t,[o]:e[o]?.attachment==="fixed"?"0px":""}}),o("top",t)},getStyleHeroBannerBg=(e,t)=>{let o=getHeightHeroBanner(e,t),l=getWidthHeroBanner(e,t),i=getTopHeroBanner(e);return{...o,...l,...i}},calcRounderClipPath=(e,t=0,o=0)=>{let l=t,i=t;if(t>o?l=o:i=o,e>=999){let t=e-l;return t>0?t:0}let n=e-i;return n>0?n:0},getClipPath=(e,t)=>{if(!t||!e)return"inset(0 0 0)";let[o,l,i,n]=e.split(" ").map(e=>parseInt(e??"0")),{btlr:a,btrr:r,bbrr:s,bblr:g}=t,p=calcRounderClipPath(parseInt(a??"0"),o,n),b=calcRounderClipPath(parseInt(r??"0"),o,l),c=calcRounderClipPath(parseInt(s??"0"),l,i),d=calcRounderClipPath(parseInt(g??"0"),i,n);return`inset(0 0 0 round ${p}px ${b}px ${c}px ${d}px)`},getClassAlignBanner=e=>({"!gp-self-start":"left"===e.desktop,"!gp-self-center":"center"===e.desktop,"!gp-self-end":"right"===e.desktop,"tablet:!gp-self-start":"left"===e.tablet,"tablet:!gp-self-center":"center"===e.tablet,"tablet:!gp-self-end":"right"===e.tablet,"mobile:!gp-self-start":"left"===e.mobile,"mobile:!gp-self-center":"center"===e.mobile,"mobile:!gp-self-end":"right"===e.mobile}),getClassSpaceBetween=(e,t,o)=>{let l=getResponsiveSetting(e),i=getResponsiveSetting(t),n=getResponsiveSetting(o),a=1>=(l?.desktop?.cols?.length||1)?i.desktop:n.desktop,r=1>=(l?.tablet?.cols?.length||1)?i.tablet:n.tablet,s=1>=(l?.mobile?.cols?.length||1)?i.mobile:n.mobile;return{"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":l.desktop?.cols?.length===1&&"space-between"===a,"!gp-content-stretch [&>*]:!gp-justify-start":l.desktop?.cols?.length===1&&"top"===a,"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":l.tablet?.cols?.length===1&&"space-between"===r,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start":l.tablet?.cols?.length===1&&"top"===r,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center":l.tablet?.cols?.length===1&&"center"===r,"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end":l.tablet?.cols?.length===1&&"bottom"===r,"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(2)]:gp-absolute [&>*:nth-child(2)]:gp-hidden":l.mobile?.cols?.length===1&&"space-between"===s,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start":l.mobile?.cols?.length===1&&"top"===s,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center":l.mobile?.cols?.length===1&&"center"===s,"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end":l.mobile?.cols?.length===1&&"bottom"===s}},getClassSpaceBetweenLeftRight=e=>{let t=getResponsiveSetting(e),o=t?.desktop?.type=="left-distributed"||t?.desktop?.type=="right-distributed",l=t?.tablet?.type=="left-distributed"||t?.tablet?.type=="right-distributed",i=t?.mobile?.type=="left-distributed"||t?.mobile?.type=="right-distributed";return{"gp-h-full tablet:gp-h-auto mobile:gp-h-auto [&>*]:!gp-justify-between":o,"tablet:!gp-h-full tablet:[&>*]:!gp-justify-between mobile:gp-h-auto":l,"mobile:!gp-h-full mobile:[&>*]:!gp-justify-between":i,"mobile:!gp-h-auto":!i}},getClassForStretchContent=t=>{let o={desktop:"none",tablet:"none",mobile:"none"},l=["desktop","mobile","tablet"];return l.forEach(l=>{let i=e(t,l);o={...o,[l]:i}}),a("space-between"===o.desktop?"[&>*>*]:!gp-justify-between":"","space-between"===o.tablet?"tablet:[&>*>*]:!gp-justify-between ":`tablet:[&>*>*]:!gp-justify-${t?.tablet}`,"space-between"===o.mobile?"mobile:[&>*>*]:!gp-justify-between ":`mobile:[&>*>*]:!gp-justify-${t?.mobile}`)},getClassForContentByFitContent=(t,o)=>{let l={desktop:!1,tablet:!1,mobile:!1},i=["desktop","mobile","tablet"];return i.forEach(i=>{let n=e(t,i),a=!!getDataVideoHeroBannerResponsive(i,o),r=n?.shape,s=n?.height,g="original"===r&&"fit-content"!==s;l={...l,[i]:g&&!a}}),a(l.desktop?"!gp-absolute":"",l.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",l.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},getClassContentPosition=e=>{let t={center:"center",top:"start",bottom:"end","space-between":"between"},o=e.desktop||"center",l=e.tablet||o,i=e.mobile||l;return{[`gp-justify-${t[o||"center"]}`]:!!o,[`tablet:gp-justify-${t[l||"center"]}`]:!!l,[`mobile:gp-justify-${t[i||"center"]}`]:!!i}},getResponsiveSetting=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,l=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:l}},showVideoType=e=>l.some(t=>{let o=i(e,t);return o?.type!=="color"&&o?.type!=="image"&&!!o&&(o?.videoType==="html5"&&o?.videoHtml5||o?.videoType==="youtube"&&o?.video)});function debounce(e,t){let o;return function(...l){clearTimeout(o),o=setTimeout(()=>e.apply(this,l),t)}}let fallbackImg="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",getBannerLink=e=>{let t=e?.link;return t?.type==="go-to-sales-page"?{type:"go-to-sales-page",link:g,target:"_self"}:t},formatHoverScale=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",opacityEnabledData=e=>{let{overlayColor:t,overlayOpacity:o}=e??{},l=!t?.normal||o?.normal=="0%"||!o?.normal;return{disableOpacity:l}},getOpacityHover=e=>{let{overlayOpacity:t}=e??{},o="number"!=typeof t?.hover||isNaN(t?.hover)?"string"==typeof t?.hover?`${parseInt(t?.hover)}%`:"":`${t?.hover}%`,l="number"!=typeof t?.normal||isNaN(t?.normal)?"string"==typeof t?.normal?`${parseInt(t?.normal)}%`:"0%":`${t?.normal}%`;return o||l};export{debounce,fallbackImg,formatHoverScale,getAspectRatioSettings,getAttachmentDevice,getBackgroundImageHeroBanner,getBannerLink,getBgImage,getClassAlignBanner,getClassContentPosition,getClassForContentByFitContent,getClassForStretchContent,getClassSpaceBetween,getClassSpaceBetweenLeftRight,getClipPath,getContentPosition,getDataVideoHeroBannerResponsive,getDisplayStyleByFitContent,getEnableBgImageByDevice,getOpacityHover,getPercentageVisible,getResponsiveSetting,getStyleAspectRatioHeroBannerCustom,getStyleHeroBannerBg,getVisibilityStyle,getWidth,horizontalAlign,imagePlaceholder,isScaleImage,mapContentPositionToHorizontal,opacityEnabledData,scrollToContentBanner,showVideoType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeStyleWithDefault as e,getWidthByShapeGlobalSize as t,makeStyleResponsive as r,getHeightByShapeGlobalSize as l,makeStyle as o,getSingleColorVariable as
|
|
1
|
+
import{makeStyleWithDefault as e,getWidthByShapeGlobalSize as t,makeStyleResponsive as r,getHeightByShapeGlobalSize as l,makeStyle as o,getSingleColorVariable as n,getRadiusStyleActiveState as i,getStyleBgColor as y,getStyleShadow as a,makeStyleState as g,getGlobalColorStateStyle as u,getResponsiveStylePadding as s,getStyleBackgroundByDevice as c}from"@gem-sdk/core";import{getVisibilityStyle as S,getStyleAspectRatioHeroBannerCustom as d,getAspectRatioSettings as h,getOpacityHover as p,getDisplayStyleByFitContent as m,getStyleHeroBannerBg as b,formatHoverScale as f,getAttachmentDevice as w,getClipPath as v,opacityEnabledData as T,getResponsiveSetting as k}from"./helpers.js";function filterTruthyStyles(e){return Object.fromEntries(Object.entries(e||{}).filter(([,e])=>!!e))}let getStyle=(o,n,i)=>{let{sizeSetting:y,background:a}=o??{},{ratioOptions:g,aspectRatio:u}=n??{},s={...i,...S(i),...e("w",t(y,!0),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...d(a,y,h(g,u)),...r("h",l(y))};return filterTruthyStyles(s)},getContainerStyle=(e,t)=>{let{sizeSetting:g,background:u,borderBg:s,cornerBg:c,shadowBg:S,hasActiveShadow:p}=e??{},{ratioOptions:m,aspectRatio:b}=t??{},f={...r("h",l(g)),...d(u,g,h(m,b)),...o({bs:s?.border??s?.border,bw:s?.width??s?.width,bc:n(s?.color)}),...i({...c,active:{...c||{},radiusType:"custom"}}),...u?{...y(u)}:{},...a({value:S,styleAppliedFor:"box-shadow",isEnableShadow:p})};return filterTruthyStyles(f)},getOverlayStyle=e=>{let{overlayColor:t,overlayOpacity:r,hoverEffect:l}=e??{},{disableOpacity:o}=T(e),n="number"!=typeof r?.normal||isNaN(r?.normal)?"string"==typeof r?.normal?`${parseInt(r?.normal)}%`:"0%":`${r?.normal}%`,i=g("op",{normal:n,hover:p(e)}),y=u("bgc",{...t,hover:t?.hover||t?.normal});o&&(delete y?.["--bgc"],delete i?.["--op"]),l||(delete y?.["--hvr-bgc"],delete i?.["--hvr-op"]);let a={...y,...i,"--top":"0","--left":"0"};return filterTruthyStyles(a)},getRowStyle=e=>{let{contentPadding:t}=e??{},r={...s(t)};return filterTruthyStyles(r)},getAdaptiveStyle=o=>{let{sizeSetting:n,background:i}=o??{},y={...m(n,i),...r("h",l(n)),...e("w",t(n,!0),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),"--op":0,"--z":-1};return filterTruthyStyles(y)},getBackgroundStyle=(e,t,l)=>{let{hoverEffectScale:o,background:n,hoverEffectDuration:i}=e??{},y={...b(k(n||{}),t),...c(n,{ignoreBgAttachment:!0,ignoreBackgroundImage:!0}),"--duration":`${parseInt(`${i}`)??0}s`,"--scale":f(o),...r("pos",w(n)),transform:l,transition:"transform 300ms cubic-bezier(0,0,0,1)"};return filterTruthyStyles(y)},getContainBackgroundStyle=e=>{let{borderBg:t,cornerBg:r}=e??{},l={"clip-path":v(t?.width,r)};return filterTruthyStyles(l)},getHtml5VideoStyle=e=>{let t={...r("aspect",e)};return filterTruthyStyles(t)},getYoutubeIframeStyle=e=>{let t={...r("aspect",e),"pointer-event":"none"};return filterTruthyStyles(t)};export{getAdaptiveStyle,getBackgroundStyle,getContainBackgroundStyle,getContainerStyle,getHtml5VideoStyle,getOverlayStyle,getRowStyle,getStyle,getYoutubeIframeStyle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsxs as e,jsx as m}from"react/jsx-runtime";import{useProduct as s,useCurrentVariant as o,useMoneyFormat as t,useCurrentDevice as r,useProductBundleDiscount as l,useEditorMode as i,usePageType as a,filterToolbarPreview as c}from"@gem-sdk/core";import{getBadgeContent as n,getIsNoDiscountState as d}from"./utils/common.js";import"./constants.js";import p from"../../../common/components/NoDataState.js";import f from"../../../common/components/TooltipHover.js";import{createClass as h,createStyle as y,createAttr as N,If as j}from"@gem-sdk/system";import{getEditTooltipAttrs as u,getNoDataAttrs as v,getSubWrapperAttrs as g,getContainerAttrs as T,getTextContentAttrs as k,getImageAttr as x}from"./common/attrs.js";import{getContainerClasses as B,getWrapperClasses as C,getSubWrapperClass as P,getTextContainerClasses as S,getTextWrapperClasses as b,getTextContentClasses as A,getImageContainerClasses as D,getImageClasses as H}from"./common/classes.js";import{getContainerStyle as I,getSubWrapperStyle as q,getContentStyleInternal as w,getTextBadgeWrapperStyles as z,getTextContentStyle as E,getImageContainerStyles as F}from"./common/styles.js";let ProductBadge=G=>{let{setting:J,styles:K,children:L,...M}=G,O=s(),Q=o(),{moneyFormat:R}=t(),U=r(),{useProductCompareAtPrice:V}=l(),W=M?.["bundle-item"],X=i(),Y="STATIC"===a(),Z=n({detail:O,currentVariant:Q,bundleItem:W,useProductCompareAtPrice:V},J?.displayContent,R),$=d({props:G,product:O,currentVariant:Q,moneyFormat:R,useProductCompareAtPrice:V}),_=h({...B({mode:X,isInstant:Y,product:O,currentVariant:Q,props:G})}),ee=y({...I(G)}),em=N({...u(G)}),es=N({...v(G)}),eo=h({...C(G)}),et=h({...P(G,U)}),er=y({...q(G,Q,X)}),el=N({...g(G,O)}),ei=w(G),ea=h({...S()}),ec=N({...T(G)}),en=h({...b()}),ed=y({...z({setting:J,styles:K})}),ep=h({...A(K)}),ef=y({...E({setting:J,styles:K})}),eh=N({...k()}),ey=h({...D()}),eN=y({...F({setting:J,styles:K})}),ej=h({...H()}),eu=N({...x({setting:J})});return O?e("div",{...ec,style:ee,className:_,children:[j("edit"===X&&$,m(f,{...em,children:m(p,{...es})}),m("div",{className:eo,children:e("div",{...el,className:et,style:er,children:[m("style",{children:ei}),j(J?.shape!=="image",m("div",{className:ea,children:m("div",{className:en,style:ed,children:m("pre",{...eh,className:ep,style:ef,children:Z})})}),m("div",{className:ey,style:eN,children:m("img",{...eu,className:ej,alt:""})}))]})})),c(L,!0)]}):null};export{ProductBadge as default};
|
|
2
|
+
import{jsxs as e,jsx as m}from"react/jsx-runtime";import{useProduct as s,useCurrentVariant as o,useMoneyFormat as t,useCurrentDevice as r,useProductBundleDiscount as l,useEditorMode as i,usePageType as a,filterToolbarPreview as c}from"@gem-sdk/core";import{getBadgeContent as n,getIsNoDiscountState as d}from"./utils/common.js";import"./constants.js";import p from"../../../common/components/NoDataState.js";import f from"../../../common/components/TooltipHover.js";import{createClass as h,createStyle as y,createAttr as N,If as j}from"@gem-sdk/system";import{getEditTooltipAttrs as u,getNoDataAttrs as v,getSubWrapperAttrs as g,getContainerAttrs as T,getTextContentAttrs as k,getImageAttr as x}from"./common/attrs.js";import{getContainerClasses as B,getWrapperClasses as C,getSubWrapperClass as P,getTextContainerClasses as S,getTextWrapperClasses as b,getTextContentClasses as A,getImageContainerClasses as D,getImageClasses as H}from"./common/classes.js";import{getContainerStyle as I,getSubWrapperStyle as q,getContentStyleInternal as w,getTextBadgeWrapperStyles as z,getTextContentStyle as E,getImageContainerStyles as F}from"./common/styles.js";let ProductBadge=G=>{let{setting:J,styles:K,children:L,...M}=G,O=s(),Q=o(),{moneyFormat:R}=t(),U=r(),{useProductCompareAtPrice:V}=l(),W=M?.["bundle-item"],X=i(),Y="STATIC"===a(),Z=n({detail:O,currentVariant:Q,bundleItem:W,useProductCompareAtPrice:V},J?.displayContent,R),$=d({props:G,product:O,currentVariant:Q,moneyFormat:R,useProductCompareAtPrice:V}),_=h({...B({mode:X,isInstant:Y,product:O,currentVariant:Q,props:G})}),ee=y({...I(G)}),em=N({...u(G)}),es=N({...v(G)}),eo=h({...C(G)}),et=h({...P(G,U)}),er=y({...q(G,O,Q,X)}),el=N({...g(G,O)}),ei=w(G),ea=h({...S()}),ec=N({...T(G)}),en=h({...b()}),ed=y({...z({setting:J,styles:K})}),ep=h({...A(K)}),ef=y({...E({setting:J,styles:K})}),eh=N({...k()}),ey=h({...D()}),eN=y({...F({setting:J,styles:K})}),ej=h({...H()}),eu=N({...x({setting:J})});return O?e("div",{...ec,style:ee,className:_,children:[j("edit"===X&&$,m(f,{...em,children:m(p,{...es})}),m("div",{className:eo,children:e("div",{...el,className:et,style:er,children:[m("style",{children:ei}),j(J?.shape!=="image",m("div",{className:ea,children:m("div",{className:en,style:ed,children:m("pre",{...eh,className:ep,style:ef,children:Z})})}),m("div",{className:ey,style:eN,children:m("img",{...eu,className:ej,alt:""})}))]})})),c(L,!0)]}):null};export{ProductBadge as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{makeGlobalSize as e,composeTypographyStyle as t,getStyleShadow as o}from"@gem-sdk/core";import{convertToStyle as r,getSize as i,getWrapperStyle as a,getShapeWrapperPadding as n,checkDiscountContentProductBadge as s}from"../utils/common.js";import{getShapePosition as p}from"../utils/getShapePosition.js";import{composeTextStyleByPosition as g,composeShapeStyleByPosition as l}from"../utils/getRotateShape.js";import{getStyleAdvanced as d}from"../utils/getStyleAdvanced.js";import{getWhiteSpaceStyle as u}from"../utils/getWhiteSpace.js";import{getStyleBackground as S,generateShadowCSS as y,getStyleBorder as m,getStyleCornerRadius as h}from"../utils/stylesV2.js";import{getShape as x}from"../utils/shape.js";let getSizeStyles=e=>{let{setting:t,styles:o}=e,r=x(t?.shape),a=t?.contentType==="text",n=a?o?.textSizeV2:o?.imageSizeV2;return a?i(r,n):i(void 0,n)},getContainerStyle=(e,t=!1)=>{let{setting:o,styles:r,style:i,navigationPosition:n,imageData:s,dotData:g}=e,l=o?.positionWithImage==="outside",u=a(t),S=p({positionType:r?.position,isLiquid:!1,navigationPosition:n,dataImage:{...s,...g}}),y=getSizeStyles(e),m=d(l?{}:{...S,...y},i);return{...!l&&{"--pos":"absolute"},...u,...m}},getTextContentStyle=({styles:i,setting:a})=>{let n=e(i?.textSizeV2).padding,s=x(a?.shape),p=a?.positionWithImage==="outside";return{...u(i?.textSizeV2),...r(s?.textStyle),...g(s,i?.position,p),...t(i?.typo),...o({value:i?.typo?.custom?.textShadow,styleAppliedFor:"text-shadow",isEnableShadow:i?.typo?.custom?.hasShadowText}),...S(!!s?.backgroundColorInText,i?.badgeColorV2),...n}},getBorderStyles=({styles:e,setting:t})=>{let o=x(t?.shape),r=t?.contentType==="text";return o?.supportBorder?r?m(e?.textBadgeBorder):m(e?.imageBadgeBorder):{}},getCornerStyles=({styles:e,setting:t})=>{let o=x(t?.shape),r=t?.contentType==="text";return o?.supportCorner?r?h(e?.textBadgeCorner,o?.shapeRadius):h(e?.imageBadgeCorner,o?.shapeRadius):{}},getTextBadgeWrapperStyles=({styles:e,setting:t})=>{let o=x(t?.shape),r=getBorderStyles({setting:t,styles:e}),i=t?.positionWithImage==="outside",a=getCornerStyles({setting:t,styles:e}),s=n(o?.ratio);return{...r,...a,...l(o,e?.position,i),...S(!o?.backgroundColorInText,e?.badgeColorV2),...s,height:o?.ratio===1?"0px":"100%"}},getImageContainerStyles=({styles:t,setting:o})=>{let r=getBorderStyles({setting:o,styles:t}),i=getCornerStyles({setting:o,styles:t}),a=e(t?.imageSizeV2).padding;return{...r,...i,...a}},getOpacityProductBadge=(e,t,o)=>{let{"bundle-item":
|
|
1
|
+
import{makeGlobalSize as e,composeTypographyStyle as t,getStyleShadow as o}from"@gem-sdk/core";import{convertToStyle as r,getSize as i,getWrapperStyle as a,getShapeWrapperPadding as n,checkDiscountContentProductBadge as s}from"../utils/common.js";import{getShapePosition as p}from"../utils/getShapePosition.js";import{composeTextStyleByPosition as g,composeShapeStyleByPosition as l}from"../utils/getRotateShape.js";import{getStyleAdvanced as d}from"../utils/getStyleAdvanced.js";import{getWhiteSpaceStyle as u}from"../utils/getWhiteSpace.js";import{getStyleBackground as S,generateShadowCSS as y,getStyleBorder as m,getStyleCornerRadius as h}from"../utils/stylesV2.js";import{getShape as x}from"../utils/shape.js";import{checkShowBadge as c}from"../utils/renderBadgeILP.js";let getSizeStyles=e=>{let{setting:t,styles:o}=e,r=x(t?.shape),a=t?.contentType==="text",n=a?o?.textSizeV2:o?.imageSizeV2;return a?i(r,n):i(void 0,n)},getContainerStyle=(e,t=!1)=>{let{setting:o,styles:r,style:i,navigationPosition:n,imageData:s,dotData:g}=e,l=o?.positionWithImage==="outside",u=a(t),S=p({positionType:r?.position,isLiquid:!1,navigationPosition:n,dataImage:{...s,...g}}),y=getSizeStyles(e),m=d(l?{}:{...S,...y},i);return{...!l&&{"--pos":"absolute"},...u,...m}},getTextContentStyle=({styles:i,setting:a})=>{let n=e(i?.textSizeV2).padding,s=x(a?.shape),p=a?.positionWithImage==="outside";return{...u(i?.textSizeV2),...r(s?.textStyle),...g(s,i?.position,p),...t(i?.typo),...o({value:i?.typo?.custom?.textShadow,styleAppliedFor:"text-shadow",isEnableShadow:i?.typo?.custom?.hasShadowText}),...S(!!s?.backgroundColorInText,i?.badgeColorV2),...n}},getBorderStyles=({styles:e,setting:t})=>{let o=x(t?.shape),r=t?.contentType==="text";return o?.supportBorder?r?m(e?.textBadgeBorder):m(e?.imageBadgeBorder):{}},getCornerStyles=({styles:e,setting:t})=>{let o=x(t?.shape),r=t?.contentType==="text";return o?.supportCorner?r?h(e?.textBadgeCorner,o?.shapeRadius):h(e?.imageBadgeCorner,o?.shapeRadius):{}},getTextBadgeWrapperStyles=({styles:e,setting:t})=>{let o=x(t?.shape),r=getBorderStyles({setting:t,styles:e}),i=t?.positionWithImage==="outside",a=getCornerStyles({setting:t,styles:e}),s=n(o?.ratio);return{...r,...a,...l(o,e?.position,i),...S(!o?.backgroundColorInText,e?.badgeColorV2),...s,height:o?.ratio===1?"0px":"100%"}},getImageContainerStyles=({styles:t,setting:o})=>{let r=getBorderStyles({setting:o,styles:t}),i=getCornerStyles({setting:o,styles:t}),a=e(t?.imageSizeV2).padding;return{...r,...i,...a}},getOpacityProductBadge=(e,t,o,r)=>{let{"bundle-item":i,setting:a}=e;if(i)return 1;let n=s(a?.displayContent)&&a?.contentType==="text";if(!n)return 1;let p=t?.price??0,g=t?.salePrice??0,l=g-p>0,d=c(a?.displayTrigger,o,t);return l&&d?1:"edit"===r?.2:0},getSubWrapperStyle=(e,t,o,r)=>{let{setting:i}=e,a=i?.positionWithImage==="outside",n=getSizeStyles(e),s=r&&o?getOpacityProductBadge(e,o,t,r):1;return{...a?{...n,"--mb":0}:{},opacity:s}},getContentStyleInternal=e=>{let{styles:t,setting:o,builderProps:r}=e,i=o?.contentType==="text";return y(`[id="${r?.uid}"] .product-badge-item`,i?t?.textBadgeShadow:t?.imageBadgeShadow)};export{getContainerStyle,getContentStyleInternal,getImageContainerStyles,getSubWrapperStyle,getTextBadgeWrapperStyles,getTextContentStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CompareType as e}from"../types.js";let toggleBadge=(e,r,t)=>{let o=checkShowBadge(e,r,t);return o?"":"!gp-hidden"},checkShowBadge=(e,r,t)=>{if(!t)return;let o=r?.createdAt||"",n=r?.tags||[],i={...t,product_created_at:o,product_tags:n},c=e?.map(e=>{switch(e?.triggerEvent){case"inventory_status":return inventoryTrigger(i,e);case"discount_price":return discountPriceTrigger(i,e);case"price_range":return priceRangeTrigger(i,e);case"creation_date":return creationDateTrigger(i,e);case"product_tags":return productTagsTrigger(i,e);default:return!1}});return c?.every(e=>!0===e)},compareNumberFunc=(e,r,t)=>{switch(t){case"exact":return e===r.from;case"above":return e>r.from;case"below":return e<r.from;case"exact_or_above":return e>=r.from;case"exact_or_below":return e<=r.from;case"between":return e>=r.from&&e<=r.to;default:return!1}},getMinValueForInventory=r=>r===e.ABOVE?0:r===e.BELOW?2:1,inventoryTrigger=(r,t)=>{if(
|
|
1
|
+
import{CompareType as e}from"../types.js";let toggleBadge=(e,r,t)=>{let o=checkShowBadge(e,r,t);return o?"":"!gp-hidden"},checkShowBadge=(e,r,t)=>{if(!t)return;let o=r?.createdAt||"",n=r?.tags||[],i={...t,product_created_at:o,product_tags:n},c=e?.map(e=>{switch(e?.triggerEvent){case"inventory_status":return inventoryTrigger(i,e);case"discount_price":return discountPriceTrigger(i,e);case"price_range":return priceRangeTrigger(i,e);case"creation_date":return creationDateTrigger(i,e);case"product_tags":return productTagsTrigger(i,e);default:return!1}});return c?.every(e=>!0===e)},compareNumberFunc=(e,r,t)=>{switch(t){case"exact":return e===r.from;case"above":return e>r.from;case"below":return e<r.from;case"exact_or_above":return e>=r.from;case"exact_or_below":return e<=r.from;case"between":return e>=r.from&&e<=r.to;default:return!1}},getMinValueForInventory=r=>r===e.ABOVE?0:r===e.BELOW?2:1,inventoryTrigger=(r,t)=>{if(void 0===r.inventoryQuantity)return!1;if("in_stock"===t.type){if(!1===r.manageInventory||r.inventoryPolicy?.toLowerCase()=="continue")return!0;if(t.conditionType===e.BELOW||t.conditionType===e.EXACT_OR_BELOW){let o=getMinValueForInventory(t.conditionType);return compareNumberFunc(r?.inventoryQuantity,{from:1,to:Number(t.from)-o+1},e.BETWEEN)}return compareNumberFunc(r?.inventoryQuantity,{from:Number(t.from),to:Number(t?.to)},t.conditionType)}return!1!==r.manageInventory&&r.inventoryPolicy?.toLowerCase()!="continue"&&compareNumberFunc(r.inventoryQuantity,{from:0,to:0},e.EXACT_OR_BELOW)},discountPriceTrigger=(e,r)=>{if(e?.compare_at_price===void 0||void 0===e.price||e.compare_at_price<e.price)return!1;let t=(e.compare_at_price-e.price)/100,o=t/(e.compare_at_price/100),n="fixed"===r.discountType?t:Math.round(100*o);return compareNumberFunc(n,{from:Number(r.from),to:Number(r.to)},r.conditionType)},priceRangeTrigger=(e,r)=>{if(void 0===e.price)return!1;let t=e.price/100;return compareNumberFunc(t,{from:Number(r.from),to:Number(r.to)},r.conditionType)},creationDateTrigger=(r,t)=>{if(!r.product_created_at)return!1;let o=new Date(new Date(r.product_created_at).setHours(0,0,0,0)),n=new Date(t.from),i=new Date(t.to),c=o.getTime();if("exact_date"===t.type)return compareNumberFunc(c,{from:n.getTime(),to:0},e.EXACT);if("duration"===t.type){let e=new Date().setHours(0,0,0,0),r=(e-o.getTime())/864e5;if(r>=0&&r<=Number(t.days))return!0}return!(n.getTime()>=i.getTime())&&compareNumberFunc(c,{from:n.getTime(),to:i.getTime()},e.BETWEEN)},productTagsTrigger=(e,r)=>{let t=e.product_tags||[],o=r.searchTag;return o.some(e=>t.includes(e))};export{checkShowBadge,toggleBadge};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{template as t}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";let ProductListItem=
|
|
1
|
+
import{template as t}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";let ProductListItem=n=>{let{pageContext:o,children:a}=n,{productItemClass:r,gpProductClass:c}=e(n);return t`
|
|
2
2
|
<gp-product
|
|
3
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
4
|
-
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }},"pageContext" : ${JSON.stringify(
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
4
|
+
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }},"pageContext" : ${JSON.stringify(o)}}'
|
|
5
5
|
class="${c}"
|
|
6
6
|
|
|
7
7
|
>
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{template as t,RenderChildren as e}from"@gem-sdk/core";import{getClass as
|
|
2
|
-
${r?.map((o
|
|
3
|
-
${e({...
|
|
1
|
+
import{template as t,RenderChildren as e}from"@gem-sdk/core";import{getClass as n}from"./common/classes.js";let ProductListItem=o=>{let{pageContext:a,rawChildren:r}=o,{productItemClass:c,gpProductClass:i}=n(o),d=()=>t`
|
|
2
|
+
${r?.map((n,o)=>{if(n)return t`
|
|
3
|
+
${e({...n,index:o})}
|
|
4
4
|
`}).join("")}
|
|
5
5
|
`;return t`
|
|
6
6
|
<gp-product
|
|
7
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
7
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
8
8
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }},"pageContext" : ${JSON.stringify(a)}}'
|
|
9
|
-
class="${
|
|
9
|
+
class="${i}"
|
|
10
10
|
|
|
11
11
|
>
|
|
12
12
|
{%- form 'product', product, id: product_form_id, class: 'form contents ${c}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
13
13
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
14
14
|
<input type="hidden" min="1" name="quantity" value="{{ quantity }}" />
|
|
15
15
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
16
|
-
${
|
|
16
|
+
${d()}
|
|
17
17
|
{%- endform -%}
|
|
18
18
|
</gp-product>
|
|
19
19
|
`};export{ProductListItem as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{template as t,RenderIf as e,isLocalEnv as
|
|
1
|
+
import{template as t,RenderIf as e,isLocalEnv as i,baseAssetURL as r}from"@gem-sdk/core";import o from"../../../grid/components/row/Row.liquid.js";import{LiquidIf as a,If as d}from"@gem-sdk/system";import{getSettingPreloadData as n,getStaticLocale as s}from"../../../helpers.js";import{getData as c,DYNAMIC_PRODUCT_STATUS as p,STATIC_PRODUCT_STATUS as l,PRODUCT_ID_LATEST as u}from"./common/helpers.js";let Product=f=>{let{children:m,setting:g,style:y,builderProps:v,rawChildren:_,advanced:$}=f,{isSyncProduct:I}=g??{},{rowSetting:S,rowStyles:b,formatVariantId:j,formatProductId:h,productStatus:q,preSelectedOptionIds:V,productHandle:P,advancedStyle:k}=c(f),w=()=>t`
|
|
2
2
|
{%- liquid
|
|
3
3
|
if request.page_type == 'product'
|
|
4
4
|
if '${q}' == '${l}'
|
|
@@ -58,10 +58,10 @@ import{template as t,RenderIf as e,isLocalEnv as r,baseAssetURL as i}from"@gem-s
|
|
|
58
58
|
-%}
|
|
59
59
|
`,x=()=>t`
|
|
60
60
|
{%- assign gpBkProduct = product -%}
|
|
61
|
-
${
|
|
61
|
+
${d(q==p,E(),w())}
|
|
62
62
|
`,A=()=>t`
|
|
63
63
|
{%- assign initVariantId = ${j} -%}
|
|
64
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
64
|
+
{%- assign product_form_id = 'product-form-' | append: "${v?.uid}" -%}
|
|
65
65
|
${j?"{%- assign variant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign variant = product.selected_or_first_available_variant -%}"}
|
|
66
66
|
${j?"{%- assign productSelectedVariant = product.variants | where: 'id', initVariantId | first -%}":"{%- assign productSelectedVariant = product.selected_or_first_available_variant -%}"}
|
|
67
67
|
{%-if productSelectedVariant == empty or productSelectedVariant == null -%}
|
|
@@ -71,15 +71,15 @@ import{template as t,RenderIf as e,isLocalEnv as r,baseAssetURL as i}from"@gem-s
|
|
|
71
71
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
72
72
|
{%- endif -%}
|
|
73
73
|
`,B=()=>t`
|
|
74
|
-
<div class="gp-text-center">${
|
|
74
|
+
<div class="gp-text-center">${s("Product","product_not_found")}</div>
|
|
75
75
|
`,G=()=>t`
|
|
76
76
|
${A()}
|
|
77
77
|
<gp-product
|
|
78
|
-
data-uid="${
|
|
79
|
-
data-id="${
|
|
78
|
+
data-uid="${v?.uid}"
|
|
79
|
+
data-id="${v?.uid}"
|
|
80
80
|
style="${k}"
|
|
81
81
|
class="${$?.cssClass}"
|
|
82
|
-
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${V}], "isSyncProduct": "${I}", "variantSelected": {{ variant | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
82
|
+
gp-context='{"productId": {{ product.id }}, "preSelectedOptionIds": [${V}], "isSyncProduct": "${I}", "variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
83
83
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }}}'
|
|
84
84
|
>
|
|
85
85
|
<product-form class="product-form">
|
|
@@ -87,13 +87,13 @@ import{template as t,RenderIf as e,isLocalEnv as r,baseAssetURL as i}from"@gem-s
|
|
|
87
87
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
88
88
|
<input type="hidden" name="quantity" value="{{ quantity }}" />
|
|
89
89
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
90
|
-
${
|
|
90
|
+
${o({builderProps:{...v,uid:v?.uid,uidInteraction:`${v?.uid}-row`},style:y,styles:b,setting:S,children:m,rawChildren:_})}
|
|
91
91
|
{%- endform -%}
|
|
92
92
|
</product-form>
|
|
93
93
|
</gp-product>
|
|
94
94
|
{%- assign product = gpBkProduct -%}
|
|
95
95
|
`;return t`
|
|
96
96
|
${x()}
|
|
97
|
-
${
|
|
98
|
-
${e(
|
|
97
|
+
${a("product != empty and product != null",G(),B())}
|
|
98
|
+
${e(i,`<script ${n('class="gps-link" delay',"src")}="{{ 'gp-product-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${n('class="gps-link" delay',"src")}="${r}/assets-v2/gp-product-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
99
99
|
`};export{Product as default};
|