@gem-sdk/components 22.0.0-dev.69 → 22.0.0-dev.72
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/common/components/Loading.js +1 -1
- package/dist/cjs/common/helpers.js +1 -1
- package/dist/cjs/hero-banner/common/helpers.js +1 -1
- package/dist/cjs/product/components/product-list/ProductList.js +1 -1
- package/dist/cjs/product/components/product-list/common/helpers.js +1 -1
- package/dist/esm/common/components/Loading.js +1 -1
- package/dist/esm/common/helpers.js +1 -1
- package/dist/esm/hero-banner/common/helpers.js +1 -1
- package/dist/esm/product/components/product-list/ProductList.js +1 -1
- package/dist/esm/product/components/product-list/common/helpers.js +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../const.js"),s=require("../helpers.js"),l=require("../hooks/useElementWidth.js"),i=require("../hooks/useLoadingProgress.js");const g="gp-loading-placeholder gp-border-loading-frame gp-flex gp-w-full gp-flex-col gp-gap-4 gp-overflow-hidden gp-border-[0.5px] gp-border-solid gp-bg-white",d="gp-text-loading-label !gp-font-g-ui !gp-text-xs !gp-font-medium !gp-leading-5 gp-px-4 gp-text-center";exports.default=({label:t,error:a,retry:o})=>{var p,n;let u=i.useLoadingProgress(),{ref:c,width:x}=l.useElementWidth(),h=(p=r.LOADING_MIN_WIDTH.SHOW_TEXT,void 0===x||x>p),f=(n=r.LOADING_MIN_WIDTH.SHOW_LABEL,void 0===x||x>n);return a?e.jsx("div",{ref:c,className:g,children:e.jsxs("div",{className:`${d} gp-py-4`,children:[t&&f?`${t} failed to load.`:"Failed to load.",!!o&&e.jsx("button",{type:"button",onClick:o,className:"gp-ml-1 gp-underline",children:"Retry"})]})}):e.jsxs("div",{ref:c,className:g,children:[e.jsx("div",{className:"gp-h-0.5 gp-w-full gp-bg-loading-track",children:e.jsx("div",{className:"gp-bg-loading-bar gp-h-full gp-transition-[width] gp-duration-100 gp-ease-linear",style:{width:`${u}%`}})}),h&&e.jsx("div",{className:`${d} gp-pb-4`,children:s.getLoadingText({label:t,percent:u,hasRoomForLabel:f})})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.getElementLabel=e=>e?.customLabel??e?.label,exports.isQueryLoading=({hasQuery:e,data:
|
|
1
|
+
"use strict";exports.getElementLabel=e=>e?.customLabel??e?.label,exports.getLoadingText=({label:e,percent:o,hasRoomForLabel:t})=>t?e?`Loading ${e}...${o}%`:`Loading ${o}%`:`${o}%`,exports.isQueryLoading=({hasQuery:e,data:o,error:t,isLoading:i})=>i||e&&void 0===o&&void 0===t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@gem-sdk/core"),t=require("../../image/common/helpers.js"),o=require("../../image/types.js"),r=require("../../constant.js"),l=require("./const.js");const i=(t,o,r)=>{let l={};return e.DEVICES.map(i=>{let s=e.getResponsiveValueByScreen(t,i),a=e.getResponsiveValueByScreen(o,i),n=e.getResponsiveValueByScreen(r,i);l={...l,[i]:1>=(s?.cols?.length||1)?a:n}}),l},s=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},a=e=>{let o=s(e);return{desktop:t.createBlurDataURL(o?.desktop?.width??0,o?.desktop?.height??0),tablet:t.createBlurDataURL(o?.tablet?.width??o?.desktop?.width??0,o?.tablet?.height??o?.desktop?.width??0),mobile:t.createBlurDataURL(o?.mobile?.width??o?.tablet?.width??o?.desktop?.width??0,o?.mobile?.height??o?.tablet?.height??o?.desktop?.width??0)}},n=(o,r,l,i)=>{if(!o)return"";let n=s(o),p=e.getResponsiveValueByScreen(o,r),b=l?`url(${a(o)[r]})`:`url(${t.getImageSrc(e.getResponsiveValueByScreen(n,r),r,i)})`,g=p?.color?`, ${p.color}`:"";return p?.color?.includes(e.GRADIENT_BGR_KEY)&&p?.type==="image"?`${b}${g}`:p?.color?.includes(e.GRADIENT_BGR_KEY)&&p?.type!=="image"?`${p.color}`:p?.type==="image"?b:"url()"},p=(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}}},b=(e,t)=>{if(!e)return t;let o=e?.shapeVideo;return"custom"===o?e?.shapeValue||t:void 0!==o?o:e?.shapeValue??t},g=({shapeByDevice:e,fallbackRatio:t,device:o,currentResult:r})=>{let l=b(e,t);return l?{...r,[o]:l}:r},c=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},u=(e,t)=>{if(!e)return;if(!t)return e.shapeValue;let o=e.shapeVideo;return"custom"===o?e.shapeValue:o},d=(t,o)=>{let r=!1,l=e.DEVICES.reduce((l,i)=>{let s=e.getResponsiveValueByScreen(t,i),a=e.getResponsiveValueByScreen(o,i),n=u(s,a?.type==="video");return n&&(l[i]=n,r=!0),l},{});return{aspectRatio:r?l:void 0}},m=(t,o,r)=>e.DEVICES.reduce((l,i)=>{let s=e.getValueByDevice(t,i),a=s?.type==="video"?s?.videoType:void 0,n=e.getValueByDevice(o,i),p=r?.[i];return p&&"youtube"===a&&"cover"!==n&&(l[i]=p),l},{}),y=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,h=(t,o)=>{let r={};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=i?.type==="image"&&o,a=y({enableParallax:s,attachment:t[l]?.attachment});r={...r,[l]:s?"150%":a?"100vh":"100%"}}),e.makeStyleResponsive("h",r)},f=(t,o)=>{let r={};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=i?.type==="image"&&o,a=y({enableParallax:s,attachment:t[l]?.attachment});r={...r,[l]:a?"100vw":"100%"}}),e.makeStyleResponsive("w",r)},I=t=>{let o={};return["desktop","mobile","tablet"].forEach(e=>{o={...o,[e]:t[e]?.attachment==="fixed"?"0px":""}}),e.makeStyleResponsive("top",o)},v=(e,t=0,o=0)=>{let r=t,l=t;if(t>o?r=o:l=o,e>=999){let t=e-r;return t>0?t:0}let i=e-l;return i>0?i:0},k=({device:e,settingLayoutRes:t,contentPosition1ColRes:o})=>{let r=t[e]?.cols??[],l=r.length<=1,i=o[e];if(l&&i)return["space-between","top","center","bottom"].includes(i)?i:void 0},S=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,r=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:r}},x=(t,o)=>{if(!t||!o)return 16/9;let r=e.getResponsiveValueByScreen(t,o),l=r?.videoCustomRatio;if(l?.width&&l?.height){let e=Number(l.width),t=Number(l.height);if(e>0&&t>0)return e/t}return 16/9},C=e=>{switch(e){case"top":default:return{top:"0%",transform:`translate(-50%, 0%) scale(${l.VIDEO_IFRAME_SCALE})`};case"bottom":return{top:"100%",transform:`translate(-50%, -100%) scale(${l.VIDEO_IFRAME_SCALE})`};case"center":return{top:"50%",transform:`translate(-50%, -50%) scale(${l.VIDEO_IFRAME_SCALE})`}}};exports.collectAspectRatioByDevice=d,exports.collectYoutubeAspectRatio=m,exports.debounce=function(e,t){let o;return function(...r){clearTimeout(o),o=setTimeout(()=>e.apply(this,r),t)}},exports.fallbackImg="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",exports.formatHoverScale=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",exports.getAspectRatio=(e,t)=>{let{aspectRatio:o}=d(e,t);return o},exports.getAttachmentDevice=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let r=e?.[o]?.attachment;t={...t,[o]:"fixed"===r?"fixed":"absolute"}}),t},exports.getBackgroundImageHeroBanner=(t,o=!1,r=!1)=>{if(!t)return;let l={};return e.DEVICES.forEach(e=>{l={...l,[e]:n(t,e,o,r)}}),e.makeStyleResponsive("bgi",l)},exports.getBannerLink=e=>{let t=e?.link;return t?.type===o.LINK_ACTION.GO_TO_SALES_PAGE?{type:o.LINK_ACTION.GO_TO_SALES_PAGE,link:r.HREF_TO_SALES_PAGE,target:"_self"}:t},exports.getBgImage=s,exports.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}),exports.getClassContentPosition=e=>{let t={center:"center",top:"start",bottom:"end","space-between":"between"},o=e.desktop||"center",r=e.tablet||o,l=e.mobile||r;return{[`gp-justify-${t[o]}`]:!0,[`tablet:gp-justify-${t[r]}`]:!0,[`mobile:gp-justify-${t[l]}`]:!0}},exports.getClassForContentByFitContent=(t,o)=>{let r={desktop:!1,tablet:!1,mobile:!1};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=!!p(l,o),a=i?.shape,n=i?.height;r={...r,[l]:"original"===a&&"fit-content"!==n&&!s}}),e.cls(r.desktop?"!gp-absolute":"",r.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",r.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},exports.getClassForStretchContent=t=>{let o={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(r=>{let l=e.getResponsiveValueByScreen(t,r);o={...o,[r]:l}}),e.cls("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}`)},exports.getClassSpaceBetween=(t,o)=>{let r=S(t),l=S(o),i={desktop:k({device:"desktop",settingLayoutRes:r,contentPosition1ColRes:l}),tablet:k({device:"tablet",settingLayoutRes:r,contentPosition1ColRes:l}),mobile:k({device:"mobile",settingLayoutRes:r,contentPosition1ColRes:l})},s={"space-between":{desktop:"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(3)]:gp-absolute [&>*:nth-child(3)]:gp-hidden",tablet:"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(3)]:gp-absolute tablet:[&>*:nth-child(3)]:gp-hidden",mobile:"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(3)]:gp-absolute mobile:[&>*:nth-child(3)]:gp-hidden"},top:{desktop:"!gp-content-stretch [&>*]:!gp-justify-start",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start"},center:{desktop:"!gp-content-stretch [&>*]:!gp-justify-center",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center"},bottom:{desktop:"!gp-content-stretch [&>*]:!gp-justify-end",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end"}},a={};return e.DEVICES.forEach(e=>{let t=i[e],o=s?.[t]?.[e];a[o]=!0}),a},exports.getClassSpaceBetweenLeftRight=e=>{let t=S(e),o=t?.desktop?.type=="left-distributed"||t?.desktop?.type=="right-distributed",r=t?.tablet?.type=="left-distributed"||t?.tablet?.type=="right-distributed",l=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":r,"mobile:!gp-h-full mobile:[&>*]:!gp-justify-between":l,"mobile:!gp-h-auto":!l}},exports.getClipPath=(e,t)=>{if(!t)return`${l.DEFAULT_CLIP_PATH}`;let[o,r,i,s]=(e??"0 0 0 0").split(" ").map(e=>parseInt(e??"0")||0),{btlr:a,btrr:n,bbrr:p,bblr:b}=t,g=v(parseInt(a??"0")||0,o,s),c=v(parseInt(n??"0")||0,o,r),u=v(parseInt(p??"0")||0,r,i),d=v(parseInt(b??"0")||0,i,s);return[g,c,u,d].every(e=>0===e)?`${l.DEFAULT_CLIP_PATH}`:`inset(0 0 0 round ${g}px ${c}px ${u}px ${d}px)`},exports.getContainerRatio=e=>{if(!e)return 0;let{width:t,height:o}=e.getBoundingClientRect();return t&&o?t/o:0},exports.getContentPosition=i,exports.getDataVideoHeroBannerResponsive=p,exports.getDisplayStyleByFitContent=(t,o)=>{let r={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=!!p(l,o),a=i?.shape,n=i?.height;r={...r,[l]:"original"!==a||"fit-content"===n||s?"none":"block"}}),e.makeStyleResponsive("d",r)},exports.getEnableBgImageByDevice=(t,o)=>{if(!e.getResponsiveValueByScreen(s(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"},exports.getOpacityHover=e=>{let{overlayOpacity:t}=e??{},o="number"!=typeof t?.hover||isNaN(t?.hover)?"string"==typeof t?.hover?`${parseInt(t?.hover)}%`:"":`${t?.hover}%`,r="number"!=typeof t?.normal||isNaN(t?.normal)?"string"==typeof t?.normal?`${parseInt(t?.normal)}%`:"0%":`${t?.normal}%`;return o||r},exports.getPercentageVisible=(e,t)=>{let{top:o,height:r}=e,l=-r;return o<l?0:o>t?100:Math.min(Math.max((o-l)/(t-l)*100,0),100)},exports.getResponsiveSetting=S,exports.getStyleAspectRatioHeroBannerCustom=(t,o)=>{let r=e.getAspectRatioGlobalSize(o);return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(o,l),s=!!p(l,t);s&&(r=g({shapeByDevice:i,fallbackRatio:"auto",device:l,currentResult:r}))}),e.makeStyleResponsive("aspect",r)},exports.getStyleHeroBannerBg=(e,t)=>{let o=h(e,t),r=f(e,t),l=I(e);return{...o,...r,...l}},exports.getVideoAspectRatio=x,exports.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]}),{}):{},exports.getWidth=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let r=e?.[o];r&&(t={...t,[o]:"default"===r?"var(--g-ct-w, 1200px)":r})}),t},exports.getYoutubeAspectRatio=(e,t,o)=>{let r=m(e,t,o);return Object.keys(r).length?r:void 0},exports.horizontalAlign=(e,t,o)=>c(i(e,t,o)),exports.imagePlaceholder=a,exports.isScaleImage=y,exports.mapContentPositionToHorizontal=c,exports.opacityEnabledData=e=>{let{overlayColor:t,overlayOpacity:o}=e??{},r=!t?.normal||o?.normal=="0%"||!o?.normal;return{disableOpacity:r}},exports.resetVideoIframeStyle=e=>{e&&(e.style.removeProperty("width"),e.style.removeProperty("height"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("transform"),e.style.removeProperty("position"))},exports.resetVideoWrapperStyle=e=>{e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("width"),e.style.removeProperty("height")},exports.scrollToContentBanner=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),exports.setVideoIframeAlign=(e,t)=>{if(!e)return;let o=C(t);e.style.top=o.top,e.style.transform=o.transform},exports.setVideoWrapperStyle=e=>{Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"})},exports.showVideoType=t=>e.DEVICES.some(o=>{let r=e.getValueByDevice(t,o);return r?.type!=="color"&&r?.type!=="image"&&!!r&&(r?.videoType==="html5"&&r?.videoHtml5||r?.videoType==="youtube"&&r?.video)}),exports.updateVideoIframeSize=({iframeEl:t,containerRatio:o,videoObjectFit:r,background:i,currentDevice:s,isYoutubeVideoMigrated:a})=>{let n,p;let b=x(i,s),g=e.getResponsiveValueByScreen(i,s);if(!t||!o)return;let c=g?.videoAlign||"top",u=C(c);if("contain"===r){Object.assign(t.style,{position:"absolute",top:"50%",left:"50%",width:"100%",height:"100%",maxWidth:"none",transform:`translate(-50%, -50%) scale(${l.VIDEO_IFRAME_SCALE})`});return}o>=b?(n=100,p=o/b*100):(p=100,n=b/o*100),Object.assign(t.style,{position:"absolute",top:u.top,left:"50%",width:a?"500%":`${n}%`,height:a?"100%":`${p}%`,maxWidth:"none",transform:u.transform})};
|
|
1
|
+
"use strict";var e=require("@gem-sdk/core"),t=require("../../image/common/helpers.js"),o=require("../../image/types.js"),r=require("../../constant.js"),l=require("./const.js");const i=(t,o,r)=>{let l={};return e.DEVICES.map(i=>{let s=e.getResponsiveValueByScreen(t,i),a=e.getResponsiveValueByScreen(o,i),n=e.getResponsiveValueByScreen(r,i);l={...l,[i]:1>=(s?.cols?.length||1)?a:n}}),l},s=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},a=e=>{let o=s(e);return{desktop:t.createBlurDataURL(o?.desktop?.width??0,o?.desktop?.height??0),tablet:t.createBlurDataURL(o?.tablet?.width??o?.desktop?.width??0,o?.tablet?.height??o?.desktop?.width??0),mobile:t.createBlurDataURL(o?.mobile?.width??o?.tablet?.width??o?.desktop?.width??0,o?.mobile?.height??o?.tablet?.height??o?.desktop?.width??0)}},n=(o,r,l,i)=>{if(!o)return"";let n=s(o),p=e.getResponsiveValueByScreen(o,r),b=l?`url(${a(o)[r]})`:`url(${t.getImageSrc(e.getResponsiveValueByScreen(n,r),r,i)})`,g=p?.color?`, ${p.color}`:"";return p?.color?.includes(e.GRADIENT_BGR_KEY)&&p?.type==="image"?`${b}${g}`:p?.color?.includes(e.GRADIENT_BGR_KEY)&&p?.type!=="image"?`${p.color}`:p?.type==="image"?b:"url()"},p=(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}}},b=({shapeByDevice:e})=>{let t=e?.shapeVideo;return"custom"===t?e?.shapeValue:void 0!==t?t:e?.shapeValue},g=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},c=(e,t)=>{if(!e)return;if(!t)return e.shapeValue;let o=e.shapeVideo;return"custom"===o?e.shapeValue:o},u=(t,o)=>{let r=!1,l=e.DEVICES.reduce((l,i)=>{let s=e.getResponsiveValueByScreen(t,i),a=e.getResponsiveValueByScreen(o,i),n=c(s,a?.type==="video");return n&&(l[i]=n,r=!0),l},{});return{aspectRatio:r?l:void 0}},d=(t,o,r)=>e.DEVICES.reduce((l,i)=>{let s=e.getValueByDevice(t,i),a=s?.type==="video"?s?.videoType:void 0,n=e.getValueByDevice(o,i),p=r?.[i];return p&&"youtube"===a&&"cover"!==n&&(l[i]=p),l},{}),m=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,y=(t,o)=>{let r={};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=i?.type==="image"&&o,a=m({enableParallax:s,attachment:t[l]?.attachment});r={...r,[l]:s?"150%":a?"100vh":"100%"}}),e.makeStyleResponsive("h",r)},h=(t,o)=>{let r={};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=i?.type==="image"&&o,a=m({enableParallax:s,attachment:t[l]?.attachment});r={...r,[l]:a?"100vw":"100%"}}),e.makeStyleResponsive("w",r)},f=t=>{let o={};return["desktop","mobile","tablet"].forEach(e=>{o={...o,[e]:t[e]?.attachment==="fixed"?"0px":""}}),e.makeStyleResponsive("top",o)},I=(e,t=0,o=0)=>{let r=t,l=t;if(t>o?r=o:l=o,e>=999){let t=e-r;return t>0?t:0}let i=e-l;return i>0?i:0},v=({device:e,settingLayoutRes:t,contentPosition1ColRes:o})=>{let r=t[e]?.cols??[],l=r.length<=1,i=o[e];if(l&&i)return["space-between","top","center","bottom"].includes(i)?i:void 0},S=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,r=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:r}},k=(t,o)=>{if(!t||!o)return 16/9;let r=e.getResponsiveValueByScreen(t,o),l=r?.videoCustomRatio;if(l?.width&&l?.height){let e=Number(l.width),t=Number(l.height);if(e>0&&t>0)return e/t}return 16/9},x=e=>{switch(e){case"top":default:return{top:"0%",transform:`translate(-50%, 0%) scale(${l.VIDEO_IFRAME_SCALE})`};case"bottom":return{top:"100%",transform:`translate(-50%, -100%) scale(${l.VIDEO_IFRAME_SCALE})`};case"center":return{top:"50%",transform:`translate(-50%, -50%) scale(${l.VIDEO_IFRAME_SCALE})`}}};exports.collectAspectRatioByDevice=u,exports.collectYoutubeAspectRatio=d,exports.debounce=function(e,t){let o;return function(...r){clearTimeout(o),o=setTimeout(()=>e.apply(this,r),t)}},exports.fallbackImg="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",exports.formatHoverScale=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",exports.getAspectRatio=(e,t)=>{let{aspectRatio:o}=u(e,t);return o},exports.getAttachmentDevice=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let r=e?.[o]?.attachment;t={...t,[o]:"fixed"===r?"fixed":"absolute"}}),t},exports.getBackgroundImageHeroBanner=(t,o=!1,r=!1)=>{if(!t)return;let l={};return e.DEVICES.forEach(e=>{l={...l,[e]:n(t,e,o,r)}}),e.makeStyleResponsive("bgi",l)},exports.getBannerLink=e=>{let t=e?.link;return t?.type===o.LINK_ACTION.GO_TO_SALES_PAGE?{type:o.LINK_ACTION.GO_TO_SALES_PAGE,link:r.HREF_TO_SALES_PAGE,target:"_self"}:t},exports.getBgImage=s,exports.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}),exports.getClassContentPosition=e=>{let t={center:"center",top:"start",bottom:"end","space-between":"between"},o=e.desktop||"center",r=e.tablet||o,l=e.mobile||r;return{[`gp-justify-${t[o]}`]:!0,[`tablet:gp-justify-${t[r]}`]:!0,[`mobile:gp-justify-${t[l]}`]:!0}},exports.getClassForContentByFitContent=(t,o)=>{let r={desktop:!1,tablet:!1,mobile:!1};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=!!p(l,o),a=i?.shape,n=i?.height;r={...r,[l]:"original"===a&&"fit-content"!==n&&!s}}),e.cls(r.desktop?"!gp-absolute":"",r.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",r.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},exports.getClassForStretchContent=t=>{let o={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(r=>{let l=e.getResponsiveValueByScreen(t,r);o={...o,[r]:l}}),e.cls("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}`)},exports.getClassSpaceBetween=(t,o)=>{let r=S(t),l=S(o),i={desktop:v({device:"desktop",settingLayoutRes:r,contentPosition1ColRes:l}),tablet:v({device:"tablet",settingLayoutRes:r,contentPosition1ColRes:l}),mobile:v({device:"mobile",settingLayoutRes:r,contentPosition1ColRes:l})},s={"space-between":{desktop:"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(3)]:gp-absolute [&>*:nth-child(3)]:gp-hidden",tablet:"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(3)]:gp-absolute tablet:[&>*:nth-child(3)]:gp-hidden",mobile:"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(3)]:gp-absolute mobile:[&>*:nth-child(3)]:gp-hidden"},top:{desktop:"!gp-content-stretch [&>*]:!gp-justify-start",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start"},center:{desktop:"!gp-content-stretch [&>*]:!gp-justify-center",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center"},bottom:{desktop:"!gp-content-stretch [&>*]:!gp-justify-end",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end"}},a={};return e.DEVICES.forEach(e=>{let t=i[e],o=s?.[t]?.[e];a[o]=!0}),a},exports.getClassSpaceBetweenLeftRight=e=>{let t=S(e),o=t?.desktop?.type=="left-distributed"||t?.desktop?.type=="right-distributed",r=t?.tablet?.type=="left-distributed"||t?.tablet?.type=="right-distributed",l=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":r,"mobile:!gp-h-full mobile:[&>*]:!gp-justify-between":l,"mobile:!gp-h-auto":!l}},exports.getClipPath=(e,t)=>{if(!t)return`${l.DEFAULT_CLIP_PATH}`;let[o,r,i,s]=(e??"0 0 0 0").split(" ").map(e=>parseInt(e??"0")||0),{btlr:a,btrr:n,bbrr:p,bblr:b}=t,g=I(parseInt(a??"0")||0,o,s),c=I(parseInt(n??"0")||0,o,r),u=I(parseInt(p??"0")||0,r,i),d=I(parseInt(b??"0")||0,i,s);return[g,c,u,d].every(e=>0===e)?`${l.DEFAULT_CLIP_PATH}`:`inset(0 0 0 round ${g}px ${c}px ${u}px ${d}px)`},exports.getContainerRatio=e=>{if(!e)return 0;let{width:t,height:o}=e.getBoundingClientRect();return t&&o?t/o:0},exports.getContentPosition=i,exports.getDataVideoHeroBannerResponsive=p,exports.getDisplayStyleByFitContent=(t,o)=>{let r={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(l=>{let i=e.getResponsiveValueByScreen(t,l),s=!!p(l,o),a=i?.shape,n=i?.height;r={...r,[l]:"original"!==a||"fit-content"===n||s?"none":"block"}}),e.makeStyleResponsive("d",r)},exports.getEnableBgImageByDevice=(t,o)=>{if(!e.getResponsiveValueByScreen(s(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"},exports.getOpacityHover=e=>{let{overlayOpacity:t}=e??{},o="number"!=typeof t?.hover||isNaN(t?.hover)?"string"==typeof t?.hover?`${parseInt(t?.hover)}%`:"":`${t?.hover}%`,r="number"!=typeof t?.normal||isNaN(t?.normal)?"string"==typeof t?.normal?`${parseInt(t?.normal)}%`:"0%":`${t?.normal}%`;return o||r},exports.getPercentageVisible=(e,t)=>{let{top:o,height:r}=e,l=-r;return o<l?0:o>t?100:Math.min(Math.max((o-l)/(t-l)*100,0),100)},exports.getResponsiveSetting=S,exports.getStyleAspectRatioHeroBannerCustom=(t,o)=>{let r=e.getAspectRatioGlobalSize(o),l={};return["desktop","mobile","tablet"].forEach(i=>{let s=e.getResponsiveValueByScreen(o,i),a=!!p(i,t),n=a?b({shapeByDevice:s}):r[i];l[i]=n||"auto"}),e.makeStyleResponsive("aspect",l)},exports.getStyleHeroBannerBg=(e,t)=>{let o=y(e,t),r=h(e,t),l=f(e);return{...o,...r,...l}},exports.getVideoAspectRatio=k,exports.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]}),{}):{},exports.getWidth=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let r=e?.[o];r&&(t={...t,[o]:"default"===r?"var(--g-ct-w, 1200px)":r})}),t},exports.getYoutubeAspectRatio=(e,t,o)=>{let r=d(e,t,o);return Object.keys(r).length?r:void 0},exports.horizontalAlign=(e,t,o)=>g(i(e,t,o)),exports.imagePlaceholder=a,exports.isScaleImage=m,exports.mapContentPositionToHorizontal=g,exports.opacityEnabledData=e=>{let{overlayColor:t,overlayOpacity:o}=e??{},r=!t?.normal||o?.normal=="0%"||!o?.normal;return{disableOpacity:r}},exports.resetVideoIframeStyle=e=>{e&&(e.style.removeProperty("width"),e.style.removeProperty("height"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("transform"),e.style.removeProperty("position"))},exports.resetVideoWrapperStyle=e=>{e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("width"),e.style.removeProperty("height")},exports.scrollToContentBanner=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),exports.setVideoIframeAlign=(e,t)=>{if(!e)return;let o=x(t);e.style.top=o.top,e.style.transform=o.transform},exports.setVideoWrapperStyle=e=>{Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"})},exports.showVideoType=t=>e.DEVICES.some(o=>{let r=e.getValueByDevice(t,o);return r?.type!=="color"&&r?.type!=="image"&&!!r&&(r?.videoType==="html5"&&r?.videoHtml5||r?.videoType==="youtube"&&r?.video)}),exports.updateVideoIframeSize=({iframeEl:t,containerRatio:o,videoObjectFit:r,background:i,currentDevice:s,isYoutubeVideoMigrated:a})=>{let n,p;let b=k(i,s),g=e.getResponsiveValueByScreen(i,s);if(!t||!o)return;let c=g?.videoAlign||"top",u=x(c);if("contain"===r){Object.assign(t.style,{position:"absolute",top:"50%",left:"50%",width:"100%",height:"100%",maxWidth:"none",transform:`translate(-50%, -50%) scale(${l.VIDEO_IFRAME_SCALE})`});return}o>=b?(n=100,p=o/b*100):(p=100,n=b/o*100),Object.assign(t.style,{position:"absolute",top:u.top,left:"50%",width:a?"500%":`${n}%`,height:a?"100%":`${p}%`,maxWidth:"none",transform:u.transform})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("next/dynamic"),r=require("../../../common/components/Loading.js"),o=require("react"),d=require("@gem-sdk/core"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("next/dynamic"),r=require("../../../common/components/Loading.js"),o=require("react"),d=require("@gem-sdk/core"),a=require("../../../common/const.js"),l=require("../../../common/helpers.js"),s=require("../SalePageProductListWarning.js"),i=require("next/head"),u=require("./ProductListGridLayout.js"),n=require("./ProductListCarouselLayout.js"),c=require("./common/styles.js"),g=require("@gem-sdk/system"),m=require("./common/classes.js"),P=require("./common/helpers.js"),T=require("../../../dialog/common/helpers.js"),h=require("../../helpers/buildRelatedProductsQuery.js"),C=require("../constants/misc.js");const p=t(()=>Promise.resolve().then(function(){return require("../ProductNotFound.js")}),{loading:r.default});exports.default=t=>{let{children:O,styles:S,builderProps:f,setting:y,builderAttrs:R}=t,{isRelatedProduct:_,productSetting:I}=P.getData(t),U=I.relatedTag&&I.relatedTag[0],{isEditMode:D,isPreviewSharePageMode:j}=d.useRenderMode(),v=d.useCurrentDevice(),L=d.usePageType(),b=d.usePageStore(e=>e.dynamicProduct),x=d.usePageStore(e=>e.dynamicCollection),[E,k]=o.useState(1),[q,M]=o.useState(!0),[N,w]=o.useState(),[G,Q]=o.useState(!1),[A,B]=o.useState(),F="GP_FUNNEL_PAGE"===L;"GP_COLLECTION"!=L||[a.PRODUCT_LIST_PRODUCT_SOURCE.Collection,a.PRODUCT_LIST_PRODUCT_SOURCE.DynamicCollection].includes(I?.productSrc)||(I.productSrc=a.PRODUCT_LIST_PRODUCT_SOURCE.DynamicCollection);let H=I?.productSrc??a.PRODUCT_LIST_PRODUCT_SOURCE.Collection;H===a.PRODUCT_LIST_PRODUCT_SOURCE.DynamicCollection&&(I.collectionId=x?.collectionId||"latest");let z=b?.productId&&b?.productId!==I.relatedProductId?b?.productId:I.relatedProductId,{data:W,error:$,isLoading:K}=d.useProductQuery({productId:_&&z?z:void 0,options:{revalidateOnMount:D||j,refreshInterval:0,revalidateIfStale:!1}}),V=I.relatedTag&&"tags"===I.relatedTag[0]&&(!W?.tags||W?.tags.length===0),J=I.relatedTag&&"collection"===I.relatedTag[0]&&(!W?.collections?.edges||W?.collections.edges.length===0),X=I.relatedTag&&"vendor"===I.relatedTag[0]&&!W?.vendor,Y=d.useProductsQueryAll({query:N,options:{revalidateOnMount:D||j}}),Z=D||j,ee=d.useProductsQuery({ids:H===a.PRODUCT_LIST_PRODUCT_SOURCE.PickProduct?I?.productIds:void 0,options:{revalidateOnMount:Z},defaultSelectedProductCount:I?.numOfSelectedProducts,selectedStatus:Z&&I?.productIds?.length?d.PICKED_PRODUCT_STATUSES:void 0}),et=o.useMemo(()=>({id:I?.collectionId??"latest",numberOfProducts:y?.numberOfProducts??4,orderBy:y?.orderBy}),[I?.collectionId,Number(y?.numberOfProducts),y?.orderBy]),er=d.useCollectionQuery({query:H!==a.PRODUCT_LIST_PRODUCT_SOURCE.PickProduct?et:void 0,options:{revalidateOnMount:Z}});o.useEffect(()=>{let{relatedTag:e,relatedType:t,hasRelatedExclude:r,relatedExclude:o}=I,d=_&&"recommended-product"!==t;if(!d||!W||!e?.length)return;let a=r&&o?o.split(",").map(e=>e.trim()):void 0,l=Number.isNaN(Number(y?.numberOfProducts))?C.DEFAULT_COLLECTION_NUMBER_OF_PRODUCTS:Number(y?.numberOfProducts),s=h.buildRelatedProductsQuery({mainRelatedProduct:W,relatedTag:e[0],numberOfProducts:l,excludeList:a});Q(!s),s&&(w(s),B(W.id))},[W,I.relatedType,I.relatedTag,y?.numberOfProducts,I.relatedExclude,I.hasRelatedExclude,_]);let eo=H===a.PRODUCT_LIST_PRODUCT_SOURCE.PickProduct,ed=eo?ee:er,ea=ed.isValidating,el=ed.error,es=l.isQueryLoading({hasQuery:Z&&(!eo||!!I?.productIds),data:ed.data,error:ed.error,isLoading:ed.isLoading}),ei=P.isRelatedProductsLoading({isRelatedProduct:_,relatedType:I.relatedType,hasRelatedTag:!!I.relatedTag?.length,relatedProductIdAssigned:z,canRefetchMainProduct:Z,mainProduct:{data:W,error:$,isLoading:K},relatedQuery:N,relatedQuerySource:A,mainProductId:W?.id,isNotFoundRelatedProduct:G,relatedProducts:{data:Y.data,error:Y.error,isLoading:Y.isLoading}}),eu=es||ei,en=er.data?.collections?.edges?.[0]?.node,ec=H===a.PRODUCT_LIST_PRODUCT_SOURCE.PickProduct?d.flattenConnection(ee.data?.products):d.flattenConnection(en?.products),eg=Y?.data?.products?d.flattenConnection(Y?.data?.products):void 0,em=_&&eg?eg:H===a.PRODUCT_LIST_PRODUCT_SOURCE.PickProduct&&I?.productIds?.length?I?.productIds?.map(e=>ec?.find(t=>t?.baseID===e)).filter(Boolean)??ec:H!==a.PRODUCT_LIST_PRODUCT_SOURCE.PickProduct?ec:ec.filter((e,t)=>t<(I?.numOfSelectedProducts??4)),eP=o.useMemo(()=>G&&_&&D||!em.length&&!eu&&q&&D,[q,eu,G,_,D,em.length]),eT=o.useMemo(()=>!em||G&&_,[G,_,em]),eh=o.useMemo(()=>{if(!y?.sameHeight)return[];let e=0,t=Math.ceil((em?.length??0)/+(y?.slidesToShow?.[v]??1));return Array.from(Array(em?.length??0)).map((r,o)=>(o>=+(y?.slidesToShow?.[v]??1)*(e+1)&&++e,{gridRow:`${1+E*e}/${E+1+E*e}`,marginBottom:e+1<t?T.getPropertyByDevice(S?.horizontalGutter,v):void 0}))},[y?.sameHeight,y?.slidesToShow,E,em?.length,v,S?.horizontalGutter]),eC=o.useMemo(()=>ea||eu||el||!em||G&&_,[el,eu,G,_,ea,em]);o.useEffect(()=>{eC||setTimeout(()=>{let{builderData:e}=f??{},t=e?.childrens?.[0];if(!t)return;let r=document.querySelector(`[data-id=${t}] div`);r&&k(r.childElementCount||1)},D?0:500)},[f,eC,D]);let ep=o.useMemo(()=>({collection:en,products:em,settings:{loop:y?.loop??{desktop:!1},scrollMode:y?.scrollMode??{desktop:"snap"},slidesToShow:y?.slidesToShow??{desktop:4,tablet:3,mobile:1},layout:S?.layout,dot:y?.dot,dotStyle:y?.dotStyle,arrow:y?.arrow,controlOverContent:y?.controlOverContent,sameHeight:y?.sameHeight},styles:{horizontalGutter:S?.horizontalGutter,verticalGutter:S?.verticalGutter,fullWidth:S?.fullWidth,spacing:S?.spacing,width:S?.width,height:S?.height}}),[en,em,y,S]);if(f?.isPreview&&F)return e.jsx(e.Fragment,{});if(eP)return e.jsx(e.Fragment,{children:g.If(q,e.jsx(p,{builderAttrs:R,collectionHandle:en?.handle,productSrc:H,onClose:()=>M(!1),children:O,relatedTagString:U,assignProductNoTags:V||J||X,noAssignedProduct:!z}))});let{productListWrapStyle:eO,productListContentStyle:eS,productListWrapAlignStyle:ef}=c.getStyle(t),{productListWrapClass:ey}=m.getClass(t);return e.jsxs("div",{...R,className:ey,style:eO,children:[!!S?.preloadBgImage&&e.jsxs(i,{children:[!!S.backgroundImage?.desktop?.image?.src&&e.jsx("link",{rel:"preload",href:S.backgroundImage.desktop.image.src,as:"image"}),!!S.backgroundImage?.tablet?.image?.src&&e.jsx("link",{rel:"preload",href:S.backgroundImage?.tablet?.image?.src,as:"image"}),!!S.backgroundImage?.mobile?.image?.src&&e.jsx("link",{rel:"preload",href:S.backgroundImage?.mobile?.image?.src,as:"image"})]}),ea||eu?e.jsx(r.default,{label:l.getElementLabel(f?.builderData)}):el?e.jsxs("div",{children:["Error: ",el?.message]}):eT?e.jsx("div",{children:"Products not found"}):e.jsx(d.ProductListProvider,{...ep,children:e.jsx("div",{className:"gp-flex gp-w-full",style:ef,children:e.jsxs("div",{style:eS,children:[F&&e.jsx(s.default,{}),e.jsx(e.Fragment,{children:g.If(S?.layout==="grid",e.jsx(u.default,{...t,productSortedById:em,generateGridRowArray:eh}),e.jsx(n.default,{...t,productSortedById:em}))})]})})}),d.filterToolbarPreview(O,!0)]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../../helpers/product.js"),
|
|
1
|
+
"use strict";require("react/jsx-runtime"),require("../../../../common/const.js");var e=require("../../../../common/helpers.js");require("@gem-sdk/core"),require("react");var t=require("../../../helpers/product.js"),r=require("../../product-images/common/productFeaturedImage.js"),o=require("../../../../carousel/components/dot/common/helpers.js");const d="gid://shopify/Collection/",c="gid://shopify/Product/";exports.PREFIX_COLLECTION_ID=d,exports.PREFIX_PRODUCT_ID=c,exports.getData=e=>{let{setting:r,styles:d}=e,c=r?.productSetting??{},i="RelatedProduct"===c.productSrc,l=o.getUpdatedDotStyle(r?.dot,r?.dotStyle),u={dotSize:{desktop:12},dotGapToCarousel:{desktop:16},arrowIconSize:{desktop:24},showWhenHover:!1,rtl:!1,...r};delete u.childItem;let a={...d,sizeSetting:{...t.getSizeSetting({adaptiveHeight:d?.adaptiveHeight,height:d?.height,fullWidth:{desktop:!0}})},spacing:d?.spacing};return delete a.backgroundColor,delete a.backgroundImage,{isRelatedProduct:i,productSetting:c,dotStyle:l,carouselConfigSetting:u,carouselConfigStyle:a}},exports.getDataLiquid=e=>{let{setting:t,styles:o}=e,i=t?.productSetting,l=i?.relatedTag,u=i?.hasRelatedExclude,a=(l&&"collection"===l[0]?i?.relatedCollectionExclude:i?.relatedTagsExclude)??"",n=a?.split(",").map(e=>e.trim()).toString(),s=i?.productSrc??"Collection",p=i?.collectionId?.replace(d,"")??"latest",g=i?.productSrc==="PickProduct"&&i?.productIds?.length===0,m=o?.layout==="grid",h=r.convertUnitToNumber(t?.numberOfProducts,4),S="PickProduct"===s&&i?.productIds?.length?i?.productIds.map(e=>e.replace(c,"")):[],P="PickProduct"===s&&i?.productHandles?.length?i?.productHandles:[],I=t?.orderBy&&t?.orderBy!=="none",y=(i?.productSrc==="Collection"||i?.productSrc==="DynamicCollection")&&I?t?.orderBy?.split("_"):"none",k=I&&y?.[0]==="TITLE"?"| sort: 'title'":"| sort: 'updated_at'",C=y?.[y.length-1]==="DESC";return{hasRelatedExclude:u,relatedExcludeTrim:n,collectionID:p,isLatestProducts:g,isGrid:m,numberOfProducts:h,productListId:S,productListHandles:P,sortedBy:k,isReverse:C,productSrc:s,productSetting:i,isSorted:I,relatedTag:l,productNumber:"PickProduct"===s?g?4:i?.numOfSelectedProducts??4:h,collectionHandle:i?.collectionHandle}},exports.isRelatedProductsLoading=({isRelatedProduct:t,relatedType:r,hasRelatedTag:o,relatedProductIdAssigned:d,canRefetchMainProduct:c,mainProduct:i,mainProductId:l,relatedQuery:u,relatedQuerySource:a,isNotFoundRelatedProduct:n,relatedProducts:s})=>{if(!t)return!1;let p="recommended-product"!==r&&o&&!!d,g=p&&!!i.data&&a!==l&&!n;return e.isQueryLoading({hasQuery:p&&c,...i})||g||e.isQueryLoading({hasQuery:!!u,...s})};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{LOADING_MIN_WIDTH as
|
|
2
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{LOADING_MIN_WIDTH as o}from"../const.js";import{getLoadingText as i}from"../helpers.js";import{useElementWidth as r}from"../hooks/useElementWidth.js";import{useLoadingProgress as g}from"../hooks/useLoadingProgress.js";let p="gp-loading-placeholder gp-border-loading-frame gp-flex gp-w-full gp-flex-col gp-gap-4 gp-overflow-hidden gp-border-[0.5px] gp-border-solid gp-bg-white",a="gp-text-loading-label !gp-font-g-ui !gp-text-xs !gp-font-medium !gp-leading-5 gp-px-4 gp-text-center",d=({label:d,error:t,retry:s})=>{var n,m;let c=g(),{ref:f,width:h}=r(),u=(n=o.SHOW_TEXT,void 0===h||h>n),b=(m=o.SHOW_LABEL,void 0===h||h>m);return t?e("div",{ref:f,className:p,children:l("div",{className:`${a} gp-py-4`,children:[d&&b?`${d} failed to load.`:"Failed to load.",!!s&&e("button",{type:"button",onClick:s,className:"gp-ml-1 gp-underline",children:"Retry"})]})}):l("div",{ref:f,className:p,children:[e("div",{className:"gp-h-0.5 gp-w-full gp-bg-loading-track",children:e("div",{className:"gp-bg-loading-bar gp-h-full gp-transition-[width] gp-duration-100 gp-ease-linear",style:{width:`${c}%`}})}),u&&e("div",{className:`${a} gp-pb-4`,children:i({label:d,percent:c,hasRoomForLabel:b})})]})};export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let e=e=>e?.customLabel??e?.label,
|
|
1
|
+
let e=e=>e?.customLabel??e?.label,o=({label:e,percent:o,hasRoomForLabel:a})=>a?e?`Loading ${e}...${o}%`:`Loading ${o}%`:`${o}%`,a=({hasQuery:e,data:o,error:a,isLoading:i})=>i||e&&void 0===o&&void 0===a;export{e as getElementLabel,o as getLoadingText,a as isQueryLoading};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEVICES as e,makeStyleResponsive as t,getValueByDevice as o,getAspectRatioGlobalSize as l,getResponsiveValueByScreen as i,cls as r,GRADIENT_BGR_KEY as a}from"@gem-sdk/core";import{getImageSrc as n,createBlurDataURL as s}from"../../image/common/helpers.js";import{LINK_ACTION as p}from"../../image/types.js";import{HREF_TO_SALES_PAGE as b}from"../../constant.js";import{DEFAULT_CLIP_PATH as g,VIDEO_IFRAME_SCALE as d}from"./const.js";let c=(t,o,l)=>{let r={};return e.map(e=>{let a=i(t,e),n=i(o,e),s=i(l,e);r={...r,[e]:1>=(a?.cols?.length||1)?n:s}}),r},m=(e,t)=>{if(!i(u(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"},u=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},h=e=>{let t=u(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)}},y=(e,t,o,l)=>{if(!e)return"";let r=u(e),s=i(e,t),p=o?`url(${h(e)[t]})`:`url(${n(i(r,t),t,l)})`,b=s?.color?`, ${s.color}`:"";return s?.color?.includes(a)&&s?.type==="image"?`${p}${b}`:s?.color?.includes(a)&&s?.type!=="image"?`${s.color}`:s?.type==="image"?p:"url()"},f=(o,l=!1,i=!1)=>{if(!o)return;let r={};return e.forEach(e=>{r={...r,[e]:y(o,e,l,i)}}),t("bgi",r)},I=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let l=e?.[o]?.attachment;t={...t,[o]:"fixed"===l?"fixed":"absolute"}}),t},v=(e,t,o)=>P(c(e,t,o)),k=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),w=(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}}},C=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]}),{}):{},A=(e,t)=>{if(!e)return t;let o=e?.shapeVideo;return"custom"===o?e?.shapeValue||t:void 0!==o?o:e?.shapeValue??t},j=({shapeByDevice:e,fallbackRatio:t,device:o,currentResult:l})=>{let i=A(e,t);return i?{...l,[o]:i}:l},S=(e,o)=>{let r=l(o);return["desktop","mobile","tablet"].forEach(t=>{let l=i(o,t),a=!!w(t,e);a&&(r=j({shapeByDevice:l,fallbackRatio:"auto",device:t,currentResult:r}))}),t("aspect",r)},P=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},Z=(e,o)=>{let l={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=!!w(t,o),n=r?.shape,s=r?.height;l={...l,[t]:"original"!==n||"fit-content"===s||a?"none":"block"}}),t("d",l)},B=(e,t)=>{if(!e)return;if(!t)return e.shapeValue;let o=e.shapeVideo;return"custom"===o?e.shapeValue:o},x=(t,o)=>{let l=!1,r=e.reduce((e,r)=>{let a=i(t,r),n=i(o,r),s=B(a,n?.type==="video");return s&&(e[r]=s,l=!0),e},{});return{aspectRatio:l?r:void 0}},$=(t,l,i)=>e.reduce((e,r)=>{let a=o(t,r),n=a?.type==="video"?a?.videoType:void 0,s=o(l,r),p=i?.[r];return p&&"youtube"===n&&"cover"!==s&&(e[r]=p),e},{}),T=(e,t)=>{let{aspectRatio:o}=x(e,t);return o},D=(e,t,o)=>{let l=$(e,t,o);return Object.keys(l).length?l:void 0},R=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let l=e?.[o];l&&(t={...t,[o]:"default"===l?"var(--g-ct-w, 1200px)":l})}),t},V=(e,t)=>{let{top:o,height:l}=e,i=-l;return o<i?0:o>t?100:Math.min(Math.max((o-i)/(t-i)*100,0),100)},E=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,G=(e,o)=>{let l={};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=r?.type==="image"&&o,n=E({enableParallax:a,attachment:e[t]?.attachment});l={...l,[t]:a?"150%":n?"100vh":"100%"}}),t("h",l)},z=(e,o)=>{let l={};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=r?.type==="image"&&o,n=E({enableParallax:a,attachment:e[t]?.attachment});l={...l,[t]:n?"100vw":"100%"}}),t("w",l)},M=e=>{let o={};return["desktop","mobile","tablet"].forEach(t=>{o={...o,[t]:e[t]?.attachment==="fixed"?"0px":""}}),t("top",o)},W=(e,t)=>{let o=G(e,t),l=z(e,t),i=M(e);return{...o,...l,...i}},L=(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 r=e-i;return r>0?r:0},H=(e,t)=>{if(!t)return`${g}`;let[o,l,i,r]=(e??"0 0 0 0").split(" ").map(e=>parseInt(e??"0")||0),{btlr:a,btrr:n,bbrr:s,bblr:p}=t,b=L(parseInt(a??"0")||0,o,r),d=L(parseInt(n??"0")||0,o,l),c=L(parseInt(s??"0")||0,l,i),m=L(parseInt(p??"0")||0,i,r);return[b,d,c,m].every(e=>0===e)?`${g}`:`inset(0 0 0 round ${b}px ${d}px ${c}px ${m}px)`},N=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}),O=({device:e,settingLayoutRes:t,contentPosition1ColRes:o})=>{let l=t[e]?.cols??[],i=l.length<=1,r=o[e];if(i&&r)return["space-between","top","center","bottom"].includes(r)?r:void 0},J=(t,o)=>{let l=_(t),i=_(o),r={desktop:O({device:"desktop",settingLayoutRes:l,contentPosition1ColRes:i}),tablet:O({device:"tablet",settingLayoutRes:l,contentPosition1ColRes:i}),mobile:O({device:"mobile",settingLayoutRes:l,contentPosition1ColRes:i})},a={"space-between":{desktop:"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(3)]:gp-absolute [&>*:nth-child(3)]:gp-hidden",tablet:"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(3)]:gp-absolute tablet:[&>*:nth-child(3)]:gp-hidden",mobile:"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(3)]:gp-absolute mobile:[&>*:nth-child(3)]:gp-hidden"},top:{desktop:"!gp-content-stretch [&>*]:!gp-justify-start",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start"},center:{desktop:"!gp-content-stretch [&>*]:!gp-justify-center",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center"},bottom:{desktop:"!gp-content-stretch [&>*]:!gp-justify-end",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end"}},n={};return e.forEach(e=>{let t=r[e],o=a?.[t]?.[e];n[o]=!0}),n},K=e=>{let t=_(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}},X=e=>{let t={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(o=>{let l=i(e,o);t={...t,[o]:l}}),r("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}`)},F=(e,t)=>{let o={desktop:!1,tablet:!1,mobile:!1};return["desktop","mobile","tablet"].forEach(l=>{let r=i(e,l),a=!!w(l,t),n=r?.shape,s=r?.height;o={...o,[l]:"original"===n&&"fit-content"!==s&&!a}}),r(o.desktop?"!gp-absolute":"",o.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",o.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},Y=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]}`]:!0,[`tablet:gp-justify-${t[l]}`]:!0,[`mobile:gp-justify-${t[i]}`]:!0}},_=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,l=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:l}},U=t=>e.some(e=>{let l=o(t,e);return l?.type!=="color"&&l?.type!=="image"&&!!l&&(l?.videoType==="html5"&&l?.videoHtml5||l?.videoType==="youtube"&&l?.video)});function Q(e,t){let o;return function(...l){clearTimeout(o),o=setTimeout(()=>e.apply(this,l),t)}}let q="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",ee=e=>{let t=e?.link;return t?.type===p.GO_TO_SALES_PAGE?{type:p.GO_TO_SALES_PAGE,link:b,target:"_self"}:t},et=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",eo=e=>{let{overlayColor:t,overlayOpacity:o}=e??{},l=!t?.normal||o?.normal=="0%"||!o?.normal;return{disableOpacity:l}},el=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},ei=(e,t)=>{if(!e||!t)return 16/9;let o=i(e,t),l=o?.videoCustomRatio;if(l?.width&&l?.height){let e=Number(l.width),t=Number(l.height);if(e>0&&t>0)return e/t}return 16/9},er=e=>{e&&(e.style.removeProperty("width"),e.style.removeProperty("height"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("transform"),e.style.removeProperty("position"))},ea=e=>{Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"})},en=e=>{e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("width"),e.style.removeProperty("height")},es=e=>{if(!e)return 0;let{width:t,height:o}=e.getBoundingClientRect();return t&&o?t/o:0},ep=e=>{switch(e){case"top":default:return{top:"0%",transform:`translate(-50%, 0%) scale(${d})`};case"bottom":return{top:"100%",transform:`translate(-50%, -100%) scale(${d})`};case"center":return{top:"50%",transform:`translate(-50%, -50%) scale(${d})`}}},eb=(e,t)=>{if(!e)return;let o=ep(t);e.style.top=o.top,e.style.transform=o.transform},eg=({iframeEl:e,containerRatio:t,videoObjectFit:o,background:l,currentDevice:r,isYoutubeVideoMigrated:a})=>{let n,s;let p=ei(l,r),b=i(l,r);if(!e||!t)return;let g=b?.videoAlign||"top",c=ep(g);if("contain"===o){Object.assign(e.style,{position:"absolute",top:"50%",left:"50%",width:"100%",height:"100%",maxWidth:"none",transform:`translate(-50%, -50%) scale(${d})`});return}t>=p?(n=100,s=t/p*100):(s=100,n=p/t*100),Object.assign(e.style,{position:"absolute",top:c.top,left:"50%",width:a?"500%":`${n}%`,height:a?"100%":`${s}%`,maxWidth:"none",transform:c.transform})};export{x as collectAspectRatioByDevice,$ as collectYoutubeAspectRatio,Q as debounce,q as fallbackImg,et as formatHoverScale,T as getAspectRatio,I as getAttachmentDevice,f as getBackgroundImageHeroBanner,ee as getBannerLink,u as getBgImage,N as getClassAlignBanner,Y as getClassContentPosition,F as getClassForContentByFitContent,X as getClassForStretchContent,J as getClassSpaceBetween,K as getClassSpaceBetweenLeftRight,H as getClipPath,es as getContainerRatio,c as getContentPosition,w as getDataVideoHeroBannerResponsive,Z as getDisplayStyleByFitContent,m as getEnableBgImageByDevice,el as getOpacityHover,V as getPercentageVisible,_ as getResponsiveSetting,S as getStyleAspectRatioHeroBannerCustom,W as getStyleHeroBannerBg,ei as getVideoAspectRatio,C as getVisibilityStyle,R as getWidth,D as getYoutubeAspectRatio,v as horizontalAlign,h as imagePlaceholder,E as isScaleImage,P as mapContentPositionToHorizontal,eo as opacityEnabledData,er as resetVideoIframeStyle,en as resetVideoWrapperStyle,k as scrollToContentBanner,eb as setVideoIframeAlign,ea as setVideoWrapperStyle,U as showVideoType,eg as updateVideoIframeSize};
|
|
1
|
+
import{DEVICES as e,makeStyleResponsive as t,getValueByDevice as o,getAspectRatioGlobalSize as l,getResponsiveValueByScreen as i,cls as r,GRADIENT_BGR_KEY as a}from"@gem-sdk/core";import{getImageSrc as n,createBlurDataURL as s}from"../../image/common/helpers.js";import{LINK_ACTION as p}from"../../image/types.js";import{HREF_TO_SALES_PAGE as b}from"../../constant.js";import{DEFAULT_CLIP_PATH as g,VIDEO_IFRAME_SCALE as d}from"./const.js";let m=(t,o,l)=>{let r={};return e.map(e=>{let a=i(t,e),n=i(o,e),s=i(l,e);r={...r,[e]:1>=(a?.cols?.length||1)?n:s}}),r},c=(e,t)=>{if(!i(u(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"},u=e=>{if(!e)return{};let t={desktop:e?.desktop?.image,tablet:e?.tablet?.image,mobile:e?.mobile?.image};return t},h=e=>{let t=u(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)}},y=(e,t,o,l)=>{if(!e)return"";let r=u(e),s=i(e,t),p=o?`url(${h(e)[t]})`:`url(${n(i(r,t),t,l)})`,b=s?.color?`, ${s.color}`:"";return s?.color?.includes(a)&&s?.type==="image"?`${p}${b}`:s?.color?.includes(a)&&s?.type!=="image"?`${s.color}`:s?.type==="image"?p:"url()"},f=(o,l=!1,i=!1)=>{if(!o)return;let r={};return e.forEach(e=>{r={...r,[e]:y(o,e,l,i)}}),t("bgi",r)},I=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let l=e?.[o]?.attachment;t={...t,[o]:"fixed"===l?"fixed":"absolute"}}),t},v=(e,t,o)=>S(m(e,t,o)),k=e=>e?.target?.closest("div.gp-hero-banner-row")?.scrollTo(0,0),w=(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}}},C=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]}),{}):{},A=({shapeByDevice:e})=>{let t=e?.shapeVideo;return"custom"===t?e?.shapeValue:void 0!==t?t:e?.shapeValue},j=(e,o)=>{let r=l(o),a={};return["desktop","mobile","tablet"].forEach(t=>{let l=i(o,t),n=!!w(t,e),s=n?A({shapeByDevice:l}):r[t];a[t]=s||"auto"}),t("aspect",a)},S=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},P=(e,o)=>{let l={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=!!w(t,o),n=r?.shape,s=r?.height;l={...l,[t]:"original"!==n||"fit-content"===s||a?"none":"block"}}),t("d",l)},Z=(e,t)=>{if(!e)return;if(!t)return e.shapeValue;let o=e.shapeVideo;return"custom"===o?e.shapeValue:o},B=(t,o)=>{let l=!1,r=e.reduce((e,r)=>{let a=i(t,r),n=i(o,r),s=Z(a,n?.type==="video");return s&&(e[r]=s,l=!0),e},{});return{aspectRatio:l?r:void 0}},x=(t,l,i)=>e.reduce((e,r)=>{let a=o(t,r),n=a?.type==="video"?a?.videoType:void 0,s=o(l,r),p=i?.[r];return p&&"youtube"===n&&"cover"!==s&&(e[r]=p),e},{}),$=(e,t)=>{let{aspectRatio:o}=B(e,t);return o},T=(e,t,o)=>{let l=x(e,t,o);return Object.keys(l).length?l:void 0},D=e=>{let t={};return["desktop","mobile","tablet"].forEach(o=>{let l=e?.[o];l&&(t={...t,[o]:"default"===l?"var(--g-ct-w, 1200px)":l})}),t},R=(e,t)=>{let{top:o,height:l}=e,i=-l;return o<i?0:o>t?100:Math.min(Math.max((o-i)/(t-i)*100,0),100)},V=({enableParallax:e=!1,attachment:t="scroll"})=>!!e||"fixed"===t,E=(e,o)=>{let l={};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=r?.type==="image"&&o,n=V({enableParallax:a,attachment:e[t]?.attachment});l={...l,[t]:a?"150%":n?"100vh":"100%"}}),t("h",l)},G=(e,o)=>{let l={};return["desktop","mobile","tablet"].forEach(t=>{let r=i(e,t),a=r?.type==="image"&&o,n=V({enableParallax:a,attachment:e[t]?.attachment});l={...l,[t]:n?"100vw":"100%"}}),t("w",l)},z=e=>{let o={};return["desktop","mobile","tablet"].forEach(t=>{o={...o,[t]:e[t]?.attachment==="fixed"?"0px":""}}),t("top",o)},M=(e,t)=>{let o=E(e,t),l=G(e,t),i=z(e);return{...o,...l,...i}},W=(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 r=e-i;return r>0?r:0},L=(e,t)=>{if(!t)return`${g}`;let[o,l,i,r]=(e??"0 0 0 0").split(" ").map(e=>parseInt(e??"0")||0),{btlr:a,btrr:n,bbrr:s,bblr:p}=t,b=W(parseInt(a??"0")||0,o,r),d=W(parseInt(n??"0")||0,o,l),m=W(parseInt(s??"0")||0,l,i),c=W(parseInt(p??"0")||0,i,r);return[b,d,m,c].every(e=>0===e)?`${g}`:`inset(0 0 0 round ${b}px ${d}px ${m}px ${c}px)`},H=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}),N=({device:e,settingLayoutRes:t,contentPosition1ColRes:o})=>{let l=t[e]?.cols??[],i=l.length<=1,r=o[e];if(i&&r)return["space-between","top","center","bottom"].includes(r)?r:void 0},O=(t,o)=>{let l=Y(t),i=Y(o),r={desktop:N({device:"desktop",settingLayoutRes:l,contentPosition1ColRes:i}),tablet:N({device:"tablet",settingLayoutRes:l,contentPosition1ColRes:i}),mobile:N({device:"mobile",settingLayoutRes:l,contentPosition1ColRes:i})},a={"space-between":{desktop:"!gp-h-full !gp-content-stretch [&>*]:!gp-justify-between [&>*:nth-child(3)]:gp-absolute [&>*:nth-child(3)]:gp-hidden",tablet:"tablet:!gp-h-full tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-between tablet:[&>*:nth-child(3)]:gp-absolute tablet:[&>*:nth-child(3)]:gp-hidden",mobile:"mobile:!gp-h-full mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-between mobile:[&>*:nth-child(3)]:gp-absolute mobile:[&>*:nth-child(3)]:gp-hidden"},top:{desktop:"!gp-content-stretch [&>*]:!gp-justify-start",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-start",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-start"},center:{desktop:"!gp-content-stretch [&>*]:!gp-justify-center",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-center",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-center"},bottom:{desktop:"!gp-content-stretch [&>*]:!gp-justify-end",tablet:"tablet:!gp-content-stretch tablet:[&>*]:!gp-justify-end",mobile:"mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end"}},n={};return e.forEach(e=>{let t=r[e],o=a?.[t]?.[e];n[o]=!0}),n},J=e=>{let t=Y(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}},K=e=>{let t={desktop:"none",tablet:"none",mobile:"none"};return["desktop","mobile","tablet"].forEach(o=>{let l=i(e,o);t={...t,[o]:l}}),r("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}`)},X=(e,t)=>{let o={desktop:!1,tablet:!1,mobile:!1};return["desktop","mobile","tablet"].forEach(l=>{let r=i(e,l),a=!!w(l,t),n=r?.shape,s=r?.height;o={...o,[l]:"original"===n&&"fit-content"!==s&&!a}}),r(o.desktop?"!gp-absolute":"",o.tablet?"tablet:!gp-absolute":"tablet:!gp-relative",o.mobile?"mobile:!gp-absolute":"mobile:!gp-relative")},F=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]}`]:!0,[`tablet:gp-justify-${t[l]}`]:!0,[`mobile:gp-justify-${t[i]}`]:!0}},Y=e=>{let t=e.desktop,o=e.tablet?e.tablet:t,l=e.mobile?e.mobile:o;return{desktop:t,tablet:o,mobile:l}},_=t=>e.some(e=>{let l=o(t,e);return l?.type!=="color"&&l?.type!=="image"&&!!l&&(l?.videoType==="html5"&&l?.videoHtml5||l?.videoType==="youtube"&&l?.video)});function U(e,t){let o;return function(...l){clearTimeout(o),o=setTimeout(()=>e.apply(this,l),t)}}let Q="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZGVmcz4KICAgICAgPGxpbmVhckdyYWRpZW50IGlkPSJnLTE5MjAtOTAwIj4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjIwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjUwJSIgLz4KICAgICAgICA8c3RvcCBzdG9wLWNvbG9yPSJyZ2JhKDUxLCA1MSwgNTEsIDApIiBvZmZzZXQ9IjcwJSIgLz4KICAgICAgPC9saW5lYXJHcmFkaWVudD4KICAgIDwvZGVmcz4KICAgIDxyZWN0IHdpZHRoPSIxOTIwIiBoZWlnaHQ9IjkwMCIgZmlsbD0icmdiYSg1MSwgNTEsIDUxLCAwKSIgLz4KICAgIDxyZWN0IGlkPSJyIiB3aWR0aD0iMTkyMCIgaGVpZ2h0PSI5MDAiIGZpbGw9InVybCgjZy0xOTIwLTkwMCkiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTE5MjAiIHRvPSIxOTIwIiBkdXI9IjFzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgIC8+CiAgPC9zdmc+",q=e=>{let t=e?.link;return t?.type===p.GO_TO_SALES_PAGE?{type:p.GO_TO_SALES_PAGE,link:b,target:"_self"}:t},ee=e=>e?String(e).includes("%")?`${e}`:`${e}%`:"100%",et=e=>{let{overlayColor:t,overlayOpacity:o}=e??{},l=!t?.normal||o?.normal=="0%"||!o?.normal;return{disableOpacity:l}},eo=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},el=(e,t)=>{if(!e||!t)return 16/9;let o=i(e,t),l=o?.videoCustomRatio;if(l?.width&&l?.height){let e=Number(l.width),t=Number(l.height);if(e>0&&t>0)return e/t}return 16/9},ei=e=>{e&&(e.style.removeProperty("width"),e.style.removeProperty("height"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("transform"),e.style.removeProperty("position"))},er=e=>{Object.assign(e.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%"})},ea=e=>{e.style.removeProperty("position"),e.style.removeProperty("top"),e.style.removeProperty("left"),e.style.removeProperty("width"),e.style.removeProperty("height")},en=e=>{if(!e)return 0;let{width:t,height:o}=e.getBoundingClientRect();return t&&o?t/o:0},es=e=>{switch(e){case"top":default:return{top:"0%",transform:`translate(-50%, 0%) scale(${d})`};case"bottom":return{top:"100%",transform:`translate(-50%, -100%) scale(${d})`};case"center":return{top:"50%",transform:`translate(-50%, -50%) scale(${d})`}}},ep=(e,t)=>{if(!e)return;let o=es(t);e.style.top=o.top,e.style.transform=o.transform},eb=({iframeEl:e,containerRatio:t,videoObjectFit:o,background:l,currentDevice:r,isYoutubeVideoMigrated:a})=>{let n,s;let p=el(l,r),b=i(l,r);if(!e||!t)return;let g=b?.videoAlign||"top",m=es(g);if("contain"===o){Object.assign(e.style,{position:"absolute",top:"50%",left:"50%",width:"100%",height:"100%",maxWidth:"none",transform:`translate(-50%, -50%) scale(${d})`});return}t>=p?(n=100,s=t/p*100):(s=100,n=p/t*100),Object.assign(e.style,{position:"absolute",top:m.top,left:"50%",width:a?"500%":`${n}%`,height:a?"100%":`${s}%`,maxWidth:"none",transform:m.transform})};export{B as collectAspectRatioByDevice,x as collectYoutubeAspectRatio,U as debounce,Q as fallbackImg,ee as formatHoverScale,$ as getAspectRatio,I as getAttachmentDevice,f as getBackgroundImageHeroBanner,q as getBannerLink,u as getBgImage,H as getClassAlignBanner,F as getClassContentPosition,X as getClassForContentByFitContent,K as getClassForStretchContent,O as getClassSpaceBetween,J as getClassSpaceBetweenLeftRight,L as getClipPath,en as getContainerRatio,m as getContentPosition,w as getDataVideoHeroBannerResponsive,P as getDisplayStyleByFitContent,c as getEnableBgImageByDevice,eo as getOpacityHover,R as getPercentageVisible,Y as getResponsiveSetting,j as getStyleAspectRatioHeroBannerCustom,M as getStyleHeroBannerBg,el as getVideoAspectRatio,C as getVisibilityStyle,D as getWidth,T as getYoutubeAspectRatio,v as horizontalAlign,h as imagePlaceholder,V as isScaleImage,S as mapContentPositionToHorizontal,et as opacityEnabledData,ei as resetVideoIframeStyle,ea as resetVideoWrapperStyle,k as scrollToContentBanner,ep as setVideoIframeAlign,er as setVideoWrapperStyle,_ as showVideoType,eb as updateVideoIframeSize};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import o from"next/dynamic";import d from"../../../common/components/Loading.js";import{useState as a,useMemo as l,useEffect as i}from"react";import{useRenderMode as c,useCurrentDevice as s,usePageType as n,usePageStore as u,useProductQuery as m,useProductsQueryAll as g,useProductsQuery as p,PICKED_PRODUCT_STATUSES as h,useCollectionQuery as f,flattenConnection as P,ProductListProvider as y,filterToolbarPreview as b}from"@gem-sdk/core";import{PRODUCT_LIST_PRODUCT_SOURCE as I}from"../../../common/const.js";import{getElementLabel as v,isQueryLoading as T}from"../../../common/helpers.js";import k from"../SalePageProductListWarning.js";import S from"next/head";import L from"./ProductListGridLayout.js";import O from"./ProductListCarouselLayout.js";import{getStyle as j}from"./common/styles.js";import{If as C}from"@gem-sdk/system";import{getClass as N}from"./common/classes.js";import{getData as w,isRelatedProductsLoading as G}from"./common/helpers.js";import{getPropertyByDevice as M}from"../../../dialog/common/helpers.js";import{buildRelatedProductsQuery as x}from"../../helpers/buildRelatedProductsQuery.js";import{DEFAULT_COLLECTION_NUMBER_OF_PRODUCTS as E}from"../constants/misc.js";let B=o(()=>import("../ProductNotFound.js"),{loading:d}),A=o=>{let{children:A,styles:D,builderProps:H,setting:R,builderAttrs:z}=o,{isRelatedProduct:q,productSetting:Q}=w(o),W=Q.relatedTag&&Q.relatedTag[0],{isEditMode:$,isPreviewSharePageMode:_}=c(),F=s(),U=n(),V=u(e=>e.dynamicProduct),J=u(e=>e.dynamicCollection),[K,X]=a(1),[Y,Z]=a(!0),[ee,et]=a(),[er,eo]=a(!1),[ed,ea]=a(),el="GP_FUNNEL_PAGE"===U;"GP_COLLECTION"!=U||[I.Collection,I.DynamicCollection].includes(Q?.productSrc)||(Q.productSrc=I.DynamicCollection);let ei=Q?.productSrc??I.Collection;ei===I.DynamicCollection&&(Q.collectionId=J?.collectionId||"latest");let ec=V?.productId&&V?.productId!==Q.relatedProductId?V?.productId:Q.relatedProductId,{data:es,error:en,isLoading:eu}=m({productId:q&&ec?ec:void 0,options:{revalidateOnMount:$||_,refreshInterval:0,revalidateIfStale:!1}}),em=Q.relatedTag&&"tags"===Q.relatedTag[0]&&(!es?.tags||es?.tags.length===0),eg=Q.relatedTag&&"collection"===Q.relatedTag[0]&&(!es?.collections?.edges||es?.collections.edges.length===0),ep=Q.relatedTag&&"vendor"===Q.relatedTag[0]&&!es?.vendor,eh=g({query:ee,options:{revalidateOnMount:$||_}}),ef=$||_,eP=p({ids:ei===I.PickProduct?Q?.productIds:void 0,options:{revalidateOnMount:ef},defaultSelectedProductCount:Q?.numOfSelectedProducts,selectedStatus:ef&&Q?.productIds?.length?h:void 0}),ey=l(()=>({id:Q?.collectionId??"latest",numberOfProducts:R?.numberOfProducts??4,orderBy:R?.orderBy}),[Q?.collectionId,Number(R?.numberOfProducts),R?.orderBy]),eb=f({query:ei!==I.PickProduct?ey:void 0,options:{revalidateOnMount:ef}});i(()=>{let{relatedTag:e,relatedType:t,hasRelatedExclude:r,relatedExclude:o}=Q,d=q&&"recommended-product"!==t;if(!d||!es||!e?.length)return;let a=r&&o?o.split(",").map(e=>e.trim()):void 0,l=Number.isNaN(Number(R?.numberOfProducts))?E:Number(R?.numberOfProducts),i=x({mainRelatedProduct:es,relatedTag:e[0],numberOfProducts:l,excludeList:a});eo(!i),i&&(et(i),ea(es.id))},[es,Q.relatedType,Q.relatedTag,R?.numberOfProducts,Q.relatedExclude,Q.hasRelatedExclude,q]);let eI=ei===I.PickProduct,ev=eI?eP:eb,eT=ev.isValidating,ek=ev.error,eS=T({hasQuery:ef&&(!eI||!!Q?.productIds),data:ev.data,error:ev.error,isLoading:ev.isLoading}),eL=G({isRelatedProduct:q,relatedType:Q.relatedType,hasRelatedTag:!!Q.relatedTag?.length,relatedProductIdAssigned:ec,canRefetchMainProduct:ef,mainProduct:{data:es,error:en,isLoading:eu},relatedQuery:ee,relatedQuerySource:ed,mainProductId:es?.id,isNotFoundRelatedProduct:er,relatedProducts:{data:eh.data,error:eh.error,isLoading:eh.isLoading}}),eO=eS||eL,ej=eb.data?.collections?.edges?.[0]?.node,eC=ei===I.PickProduct?P(eP.data?.products):P(ej?.products),eN=eh?.data?.products?P(eh?.data?.products):void 0,ew=q&&eN?eN:ei===I.PickProduct&&Q?.productIds?.length?Q?.productIds?.map(e=>eC?.find(t=>t?.baseID===e)).filter(Boolean)??eC:ei!==I.PickProduct?eC:eC.filter((e,t)=>t<(Q?.numOfSelectedProducts??4)),eG=l(()=>er&&q&&$||!ew.length&&!eO&&Y&&$,[Y,eO,er,q,$,ew.length]),eM=l(()=>!ew||er&&q,[er,q,ew]),ex=l(()=>{if(!R?.sameHeight)return[];let e=0,t=Math.ceil((ew?.length??0)/+(R?.slidesToShow?.[F]??1));return Array.from(Array(ew?.length??0)).map((r,o)=>(o>=+(R?.slidesToShow?.[F]??1)*(e+1)&&++e,{gridRow:`${1+K*e}/${K+1+K*e}`,marginBottom:e+1<t?M(D?.horizontalGutter,F):void 0}))},[R?.sameHeight,R?.slidesToShow,K,ew?.length,F,D?.horizontalGutter]),eE=l(()=>eT||eO||ek||!ew||er&&q,[ek,eO,er,q,eT,ew]);i(()=>{eE||setTimeout(()=>{let{builderData:e}=H??{},t=e?.childrens?.[0];if(!t)return;let r=document.querySelector(`[data-id=${t}] div`);r&&X(r.childElementCount||1)},$?0:500)},[H,eE,$]);let eB=l(()=>({collection:ej,products:ew,settings:{loop:R?.loop??{desktop:!1},scrollMode:R?.scrollMode??{desktop:"snap"},slidesToShow:R?.slidesToShow??{desktop:4,tablet:3,mobile:1},layout:D?.layout,dot:R?.dot,dotStyle:R?.dotStyle,arrow:R?.arrow,controlOverContent:R?.controlOverContent,sameHeight:R?.sameHeight},styles:{horizontalGutter:D?.horizontalGutter,verticalGutter:D?.verticalGutter,fullWidth:D?.fullWidth,spacing:D?.spacing,width:D?.width,height:D?.height}}),[ej,ew,R,D]);if(H?.isPreview&&el)return e(t,{});if(eG)return e(t,{children:C(Y,e(B,{builderAttrs:z,collectionHandle:ej?.handle,productSrc:ei,onClose:()=>Z(!1),children:A,relatedTagString:W,assignProductNoTags:em||eg||ep,noAssignedProduct:!ec}))});let{productListWrapStyle:eA,productListContentStyle:eD,productListWrapAlignStyle:eH}=j(o),{productListWrapClass:eR}=N(o);return r("div",{...z,className:eR,style:eA,children:[!!D?.preloadBgImage&&r(S,{children:[!!D.backgroundImage?.desktop?.image?.src&&e("link",{rel:"preload",href:D.backgroundImage.desktop.image.src,as:"image"}),!!D.backgroundImage?.tablet?.image?.src&&e("link",{rel:"preload",href:D.backgroundImage?.tablet?.image?.src,as:"image"}),!!D.backgroundImage?.mobile?.image?.src&&e("link",{rel:"preload",href:D.backgroundImage?.mobile?.image?.src,as:"image"})]}),eT||eO?e(d,{label:v(H?.builderData)}):ek?r("div",{children:["Error: ",ek?.message]}):eM?e("div",{children:"Products not found"}):e(y,{...eB,children:e("div",{className:"gp-flex gp-w-full",style:eH,children:r("div",{style:eD,children:[el&&e(k,{}),e(t,{children:C(D?.layout==="grid",e(L,{...o,productSortedById:ew,generateGridRowArray:ex}),e(O,{...o,productSortedById:ew}))})]})})}),b(A,!0)]})};export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import"react/jsx-runtime";import"../../../../common/const.js";import{isQueryLoading as t}from"../../../../common/helpers.js";import"@gem-sdk/core";import"react";import{getSizeSetting as e}from"../../../helpers/product.js";import{convertUnitToNumber as o}from"../../product-images/common/productFeaturedImage.js";import{getUpdatedDotStyle as r}from"../../../../carousel/components/dot/common/helpers.js";let d=t=>{let{setting:o,styles:d}=t,c=o?.productSetting??{},l="RelatedProduct"===c.productSrc,i=r(o?.dot,o?.dotStyle),a={dotSize:{desktop:12},dotGapToCarousel:{desktop:16},arrowIconSize:{desktop:24},showWhenHover:!1,rtl:!1,...o};delete a.childItem;let n={...d,sizeSetting:{...e({adaptiveHeight:d?.adaptiveHeight,height:d?.height,fullWidth:{desktop:!0}})},spacing:d?.spacing};return delete n.backgroundColor,delete n.backgroundImage,{isRelatedProduct:l,productSetting:c,dotStyle:i,carouselConfigSetting:a,carouselConfigStyle:n}},c=t=>{let{setting:e,styles:r}=t,d=e?.productSetting,c=d?.relatedTag,a=d?.hasRelatedExclude,n=(c&&"collection"===c[0]?d?.relatedCollectionExclude:d?.relatedTagsExclude)??"",p=n?.split(",").map(t=>t.trim()).toString(),u=d?.productSrc??"Collection",s=d?.collectionId?.replace(l,"")??"latest",m=d?.productSrc==="PickProduct"&&d?.productIds?.length===0,g=r?.layout==="grid",h=o(e?.numberOfProducts,4),P="PickProduct"===u&&d?.productIds?.length?d?.productIds.map(t=>t.replace(i,"")):[],I="PickProduct"===u&&d?.productHandles?.length?d?.productHandles:[],S=e?.orderBy&&e?.orderBy!=="none",k=(d?.productSrc==="Collection"||d?.productSrc==="DynamicCollection")&&S?e?.orderBy?.split("_"):"none",C=S&&k?.[0]==="TITLE"?"| sort: 'title'":"| sort: 'updated_at'",f=k?.[k.length-1]==="DESC";return{hasRelatedExclude:a,relatedExcludeTrim:p,collectionID:s,isLatestProducts:m,isGrid:g,numberOfProducts:h,productListId:P,productListHandles:I,sortedBy:C,isReverse:f,productSrc:u,productSetting:d,isSorted:S,relatedTag:c,productNumber:"PickProduct"===u?m?4:d?.numOfSelectedProducts??4:h,collectionHandle:d?.collectionHandle}},l="gid://shopify/Collection/",i="gid://shopify/Product/",a=({isRelatedProduct:e,relatedType:o,hasRelatedTag:r,relatedProductIdAssigned:d,canRefetchMainProduct:c,mainProduct:l,mainProductId:i,relatedQuery:a,relatedQuerySource:n,isNotFoundRelatedProduct:p,relatedProducts:u})=>{if(!e)return!1;let s="recommended-product"!==o&&r&&!!d,m=s&&!!l.data&&n!==i&&!p;return t({hasQuery:s&&c,...l})||m||t({hasQuery:!!a,...u})};export{l as PREFIX_COLLECTION_ID,i as PREFIX_PRODUCT_ID,d as getData,c as getDataLiquid,a as isRelatedProductsLoading};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "22.0.0-dev.
|
|
3
|
+
"version": "22.0.0-dev.72",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"i18n:extract": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/translate/extract-texts-to-locales.js && node ./scripts/translate/en-keys-usage.js"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@gem-sdk/core": "22.0.0-dev.
|
|
29
|
+
"@gem-sdk/core": "22.0.0-dev.71",
|
|
30
30
|
"@gem-sdk/styles": "22.0.0-dev.69",
|
|
31
31
|
"@gem-sdk/system": "22.0.0-dev.63",
|
|
32
32
|
"@types/react-transition-group": "^4.4.12",
|