@anker-in/headless-ui 1.3.74 → 1.3.75
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/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/CreditsShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/SceneShelfV3/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplayHorizontal/shelfDisplayHorizontalItem.js +1 -1
- package/dist/cjs/biz-components/Specs/dropdown.d.ts +2 -1
- package/dist/cjs/biz-components/Specs/dropdown.js +2 -2
- package/dist/cjs/biz-components/Specs/index.js +1 -1
- package/dist/cjs/components/board.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/CreditsShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/SceneShelfV3/ProductCard.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/esm/biz-components/ShelfDisplayHorizontal/shelfDisplayHorizontalItem.js +1 -1
- package/dist/esm/biz-components/Specs/dropdown.d.ts +2 -1
- package/dist/esm/biz-components/Specs/dropdown.js +2 -2
- package/dist/esm/biz-components/Specs/index.js +1 -1
- package/dist/esm/components/board.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var M=(a,e)=>{for(var i in e)d(a,i,{get:e[i],enumerable:!0})},P=(a,e,i,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of T(e))!_.call(a,o)&&o!==i&&d(a,o,{get:()=>e[o],enumerable:!(c=D(e,o))||c.enumerable});return a};var R=a=>P(d({},"__esModule",{value:!0}),a);var S={};M(S,{AiuiContext:()=>m,default:()=>O,useAiuiContext:()=>L});module.exports=R(S);var g=require("react/jsx-runtime"),h=require("../../shared/track.js"),t=require("react"),k=require("../../helpers/index.js");const m=(0,t.createContext)({trackingData:{},locale:void 0,copyWriting:{}}),L=()=>{const a=(0,t.useContext)(m);if(!a)throw new Error("useAiui must be used in <AiuiProvider>");return a},N=({children:a,...e})=>{const i=(0,t.useRef)(null),c=(0,t.useRef)(e?.trackingData),[o,x]=(0,t.useState)(!1);(0,t.useEffect)(()=>{e.localeMap&&Object.keys(e.localeMap).length>0&&(0,k.extendLocaleMap)(e.localeMap)},[e.localeMap]),(0,t.useEffect)(()=>{c.current=e?.trackingData},[e?.trackingData]),(0,t.useEffect)(()=>{const p=i.current;if(!p)return;const y=(n,r)=>{const s={};if(!r||!r.attributes)return s;for(const E of Array.from(r.attributes)){const u=E?.name;u?.startsWith("data-headless-")&&(s[u]=r.getAttribute(u))}const A=s?.["data-headless-sku"],b=s?.["data-headless-type-name"]?.split?.("#"),l=s?.["data-headless-title-desc-button"]?.split?.("#"),f=s?.["data-headless-nav-position"]?.split?.("#");(0,h.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:c.current?.pageGroup||"Home Page",component_type:b?.[0]||"",component_name:b?.[1]||"",position:f?.[1]||"",navigation:f?.[0]||"",button_name:l?.[2]||"",SKU:A||"",component_title:l?.[0]||"",component_description:l?.[1]||""}})},v=new MutationObserver(()=>{p.querySelectorAll("[data-headless-type-name]").forEach(n=>{n.hasAttribute("data-headless-track-bound")||(n.addEventListener("click",r=>y(r,n)),n.setAttribute("data-headless-track-bound","true"))})});return v.observe(p,{childList:!0,subtree:!0}),p.querySelectorAll("[data-headless-type-name]").forEach(n=>{n.hasAttribute("data-headless-track-bound")||(n.addEventListener("click",r=>y(r,n)),n.setAttribute("data-headless-track-bound","true"))}),()=>v.disconnect()},[]);const C=(0,t.useMemo)(()=>({...e,navCollapsed:o,setNavCollapsed:x}),[e,o]);return(0,g.jsx)(m.Provider,{value:C,children:(0,g.jsx)("div",{ref:i,children:a})})};var O=N;
|
|
1
|
+
"use strict";"use client";var d=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var M=(a,e)=>{for(var i in e)d(a,i,{get:e[i],enumerable:!0})},P=(a,e,i,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of T(e))!_.call(a,o)&&o!==i&&d(a,o,{get:()=>e[o],enumerable:!(c=D(e,o))||c.enumerable});return a};var R=a=>P(d({},"__esModule",{value:!0}),a);var S={};M(S,{AiuiContext:()=>m,default:()=>O,useAiuiContext:()=>L});module.exports=R(S);var g=require("react/jsx-runtime"),h=require("../../shared/track.js"),t=require("react"),k=require("../../helpers/index.js");const m=(0,t.createContext)({trackingData:{},locale:void 0,copyWriting:{}}),L=()=>{const a=(0,t.useContext)(m);if(!a)throw new Error("useAiui must be used in <AiuiProvider>");return a},N=({children:a,...e})=>{const i=(0,t.useRef)(null),c=(0,t.useRef)(e?.trackingData),[o,x]=(0,t.useState)(!1);(0,t.useEffect)(()=>{e.localeMap&&Object.keys(e.localeMap).length>0&&(0,k.extendLocaleMap)(e.localeMap)},[e.localeMap]),(0,t.useEffect)(()=>{c.current=e?.trackingData},[e?.trackingData]),(0,t.useEffect)(()=>{const p=i.current;if(!p)return;const y=(n,r)=>{const s={};if(!r||!r.attributes)return s;for(const E of Array.from(r.attributes)){const u=E?.name;u?.startsWith("data-headless-")&&(s[u]=r.getAttribute(u))}const A=s?.["data-headless-sku"],b=s?.["data-headless-type-name"]?.split?.("#"),l=s?.["data-headless-title-desc-button"]?.split?.("#"),f=s?.["data-headless-nav-position"]?.split?.("#");(0,h.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:c.current?.pageGroup||"Home Page",component_type:b?.[0]||"",component_name:b?.[1]||"",position:f?.[1]||"",navigation:f?.[0]||"",button_name:l?.[2]||"",SKU:A||"",component_title:l?.[0]||"",component_description:l?.[1]||""}})},v=new MutationObserver(()=>{p.querySelectorAll("[data-headless-type-name]").forEach(n=>{n.hasAttribute("data-headless-track-bound")||(n.addEventListener("click",r=>y(r,n)),n.setAttribute("data-headless-track-bound","true"))})});return v.observe(p,{childList:!0,subtree:!0}),p.querySelectorAll("[data-headless-type-name]").forEach(n=>{n.hasAttribute("data-headless-track-bound")||(n.addEventListener("click",r=>y(r,n)),n.setAttribute("data-headless-track-bound","true"))}),()=>v.disconnect()},[]);const C=(0,t.useMemo)(()=>({...e,navCollapsed:o,setNavCollapsed:x}),[e,o]);return(0,g.jsx)(m.Provider,{value:C,children:(0,g.jsx)("div",{ref:i,children:a})})};var O=N;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var Z=Object.create;var u=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var V=(e,o)=>{for(var i in o)u(e,i,{get:o[i],enumerable:!0})},N=(e,o,i,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of K(o))!U.call(e,c)&&c!==i&&u(e,c,{get:()=>o[c],enumerable:!(m=J(o,c))||m.enumerable});return e};var W=(e,o,i)=>(i=e!=null?Z(Q(e)):{},N(o||!e||!e.__esModule?u(i,"default",{value:e,enumerable:!0}):i,e)),X=e=>N(u({},"__esModule",{value:!0}),e);var ae={};V(ae,{CreditsProductCard:()=>g,default:()=>ee});module.exports=X(ae);var a=require("react/jsx-runtime"),d=W(require("react")),s=require("../../helpers/index.js"),t=require("../../components/index.js"),k=require("./context.js");const Y=()=>(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{d:"M8 1L10.163 5.279L15 6.001L11.5 9.409L12.326 14.226L8 11.97L3.674 14.226L4.5 9.409L1 6.001L5.837 5.279L8 1Z",fill:"currentColor"})}),g=d.forwardRef(({product:e,className:o,showTags:i,onLearnMore:m,onShopNow:c,onAddToCart:P,classNames:T,secondaryButtonText:B,secondaryButtonFun:L,primaryButtonText:S,primaryButtonFun:F,showOriginalPrice:z,copy:M,onProductImageClick:D},A)=>{const n=(0,k.useCreditsShelfContext)(),O=i??n?.showTags??!0,$=z??n?.showOriginalPrice??!0,f=M??n?.copy,r=T??n?.classNames,y=B??n?.secondaryButtonText,h=L??n?.secondaryButtonFun,x=S??n?.primaryButtonText,C=F??n?.primaryButtonFun,j=m??n?.onLearnMore,H=c??n?.onShopNow,I=P??n?.onAddToCart,
|
|
1
|
+
"use strict";"use client";var Z=Object.create;var u=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var V=(e,o)=>{for(var i in o)u(e,i,{get:o[i],enumerable:!0})},N=(e,o,i,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of K(o))!U.call(e,c)&&c!==i&&u(e,c,{get:()=>o[c],enumerable:!(m=J(o,c))||m.enumerable});return e};var W=(e,o,i)=>(i=e!=null?Z(Q(e)):{},N(o||!e||!e.__esModule?u(i,"default",{value:e,enumerable:!0}):i,e)),X=e=>N(u({},"__esModule",{value:!0}),e);var ae={};V(ae,{CreditsProductCard:()=>g,default:()=>ee});module.exports=X(ae);var a=require("react/jsx-runtime"),d=W(require("react")),s=require("../../helpers/index.js"),t=require("../../components/index.js"),k=require("./context.js");const Y=()=>(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{d:"M8 1L10.163 5.279L15 6.001L11.5 9.409L12.326 14.226L8 11.97L3.674 14.226L4.5 9.409L1 6.001L5.837 5.279L8 1Z",fill:"currentColor"})}),g=d.forwardRef(({product:e,className:o,showTags:i,onLearnMore:m,onShopNow:c,onAddToCart:P,classNames:T,secondaryButtonText:B,secondaryButtonFun:L,primaryButtonText:S,primaryButtonFun:F,showOriginalPrice:z,copy:M,onProductImageClick:D},A)=>{const n=(0,k.useCreditsShelfContext)(),O=i??n?.showTags??!0,$=z??n?.showOriginalPrice??!0,f=M??n?.copy,r=T??n?.classNames,y=B??n?.secondaryButtonText,h=L??n?.secondaryButtonFun,x=S??n?.primaryButtonText,C=F??n?.primaryButtonFun,j=m??n?.onLearnMore,H=c??n?.onShopNow,I=P??n?.onAddToCart,w=D??n?.onProductImageClick,[R,_]=d.useState(!1),[q,E]=d.useState(!1),v=async(l,p)=>{if(!l)return;const b=p==="primary"?_:E;b(!0);try{switch(l){case"buyNow":await H?.(e);break;case"addCart":await I?.(e);break;case"learnMore":await j?.(e);break;default:break}}finally{b(!1)}},G=d.useMemo(()=>e.creditSavingAmount?(f?.creditsSavingLabel??"Save up to {amount} with Credits").replace("{amount}",e.creditSavingAmount):null,[e.creditSavingAmount,f?.creditsSavingLabel]);return(0,a.jsxs)(t.Card,{ref:A,className:(0,s.cn)("bg-container-primary hover:bg-container-secondary-0 box-border flex h-full flex-col overflow-hidden border-none",o,r?.productCard),children:[(0,a.jsxs)(t.CardContent,{className:"lg-desktop:gap-[10px] lg-desktop:px-6 lg-desktop:py-4 relative flex flex-1 flex-col gap-2 p-4",children:[(0,a.jsx)("div",{className:"lg-desktop:h-[28px] flex h-[24px] gap-1",children:O&&e.tags?.map((l,p)=>l.label?(0,a.jsx)(t.Badge,{size:"sm",variant:l.variant||"outline",className:(0,s.cn)(l.variant==="promotional"?"ml-2":""),promotionalType:l.promotionalType,children:l.label},p):(0,a.jsx)(d.Fragment,{children:l},p))}),(0,a.jsx)("div",{className:"product-image-wrapper lg-desktop:size-[196px] mx-auto size-[138px] cursor-pointer overflow-hidden",children:(0,a.jsx)("a",{onClick:()=>w?.(e),...!w&&{href:e?.listingLink},rel:"noreferrer",children:(0,a.jsx)(t.Picture,{source:e.image,alt:e.name,className:"aspect-square size-full object-contain",imgClassName:"w-full h-full object-contain"})})}),(0,a.jsxs)("div",{className:"lg-desktop:gap-6 flex flex-1 grow flex-col justify-between gap-4",children:[(0,a.jsxs)("div",{className:"lg-desktop:gap-1 flex flex-col gap-0.5",children:[(0,a.jsx)(t.Heading,{as:"h3",size:2,className:(0,s.cn)("text-info-primary line-clamp-2 min-h-[2.4em]",r?.productTitle),html:e.custom_name||e.name}),e?.description&&(0,a.jsx)(t.Text,{size:2,className:(0,s.cn)("text-info-secondary desktop:line-clamp-2 desktop:min-h-[2.4em] line-clamp-2 min-h-[2.4em]",r?.productDescription),html:e.custom_description||e.description})]}),(0,a.jsxs)("div",{className:"lg-desktop:gap-2 flex flex-col gap-1.5",children:[(0,a.jsx)("div",{className:(0,s.cn)(r?.productPrice),children:(0,a.jsx)("div",{className:"flex flex-wrap items-baseline gap-1",children:e.availableForSale?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.Heading,{size:2,className:"text-info-primary whitespace-nowrap",as:"h6",children:e.price}),$&&e.originalPrice&&(0,a.jsx)(t.Heading,{size:2,className:(0,s.cn)("text-info-tertiary whitespace-nowrap line-through",r?.originalPrice),as:"h6",children:e.originalPrice})]}):(0,a.jsx)(t.Heading,{size:2,className:"text-info-tertiary",children:f?.outOfStockLabel??"Sold Out"})})}),e?.priceLabel&&(0,a.jsx)(t.Text,{size:4,className:(0,s.cn)("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] text-[14px]",r?.productPriceLabel),children:e.priceLabel}),(0,a.jsxs)("div",{className:(0,s.cn)("lg-desktop:gap-3 tablet:flex-nowrap flex flex-wrap gap-2",r?.buttonGroup),children:[y&&(0,a.jsx)(t.Button,{variant:"secondary",size:"base",className:(0,s.cn)("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",r?.secondaryButton),onClick:()=>v(h,"secondary"),disabled:!e.availableForSale&&h!=="learnMore",loading:q,"data-headless-type-name":"CreditsShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${y}`,"data-headless-sku":e.sku,children:y}),x&&(0,a.jsx)(t.Button,{variant:"primary",size:"base",className:(0,s.cn)("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",r?.primaryButton),onClick:()=>v(C,"primary"),disabled:!e.availableForSale&&C!=="learnMore",loading:R,"data-headless-type-name":"CreditsShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${x}`,"data-headless-sku":e.sku,children:x})]})]})]})]}),(0,a.jsxs)("div",{className:(0,s.cn)("bg-container-secondary-0 lg-desktop:px-6 lg-desktop:py-4 flex items-center justify-center gap-1 px-4 py-3",r?.creditTip),children:[(0,a.jsx)("div",{className:"bg-info-primary flex size-6 items-center justify-center rounded-full p-1",children:(0,a.jsx)("span",{className:"text-info-white",children:(0,a.jsx)(Y,{})})}),(0,a.jsx)(t.Text,{size:2,className:"text-info-primary",children:G})]})]})});g.displayName="CreditsShelf.ProductCard";var ee=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var G=Object.create;var E=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var O=(n,l)=>{for(var c in l)E(n,c,{get:l[c],enumerable:!0})},M=(n,l,c,h)=>{if(l&&typeof l=="object"||typeof l=="function")for(let p of _(l))!q.call(n,p)&&p!==c&&E(n,p,{get:()=>l[p],enumerable:!(h=V(l,p))||h.enumerable});return n};var W=(n,l,c)=>(c=n!=null?G($(n)):{},M(l||!n||!n.__esModule?E(c,"default",{value:n,enumerable:!0}):c,n)),J=n=>M(E({},"__esModule",{value:!0}),n);var Z={};O(Z,{default:()=>X});module.exports=J(Z);var e=require("react/jsx-runtime"),r=require("react"),S=require("../../helpers/utils.js"),H=require("../../shared/Styles.js"),
|
|
1
|
+
"use strict";"use client";var G=Object.create;var E=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var O=(n,l)=>{for(var c in l)E(n,c,{get:l[c],enumerable:!0})},M=(n,l,c,h)=>{if(l&&typeof l=="object"||typeof l=="function")for(let p of _(l))!q.call(n,p)&&p!==c&&E(n,p,{get:()=>l[p],enumerable:!(h=V(l,p))||h.enumerable});return n};var W=(n,l,c)=>(c=n!=null?G($(n)):{},M(l||!n||!n.__esModule?E(c,"default",{value:n,enumerable:!0}):c,n)),J=n=>M(E({},"__esModule",{value:!0}),n);var Z={};O(Z,{default:()=>X});module.exports=J(Z);var e=require("react/jsx-runtime"),r=require("react"),S=require("../../helpers/utils.js"),H=require("../../shared/Styles.js"),u=require("../../components/index.js"),I=require("../../hooks/useExposure.js"),L=W(require("@radix-ui/react-popover"));const K="navigation",Q="product_nav",P=n=>n.anchorId??n.id??"",U=n=>(0,e.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:(0,e.jsx)("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})}),D=(0,r.forwardRef)(({className:n="",data:l,id:c,onAnchorClick:h,scrollOffsetExtra:p=0},B)=>{const{tabLinks:k=[],anchorList:a=[],textLink:m,buyBtn:f,theme:z="light"}=l||{},[j,b]=(0,r.useState)(""),x=(0,r.useRef)(null),y=(0,r.useRef)(!1),g=(0,r.useRef)(""),w=(0,r.useRef)(null),R=(0,r.useRef)(new Map);(0,r.useImperativeHandle)(B,()=>x.current),(0,I.useExposure)(x,{componentType:K,componentName:Q});const T=(0,r.useCallback)(()=>{if(a.length===0)return;const t=window.scrollY;window.scrollTo({top:0,behavior:"instant"}),requestAnimationFrame(()=>{const o=new Map;a.forEach(i=>{const s=P(i),d=document.getElementById(s);if(d){const N=d.getBoundingClientRect();o.set(s,N.top+window.scrollY)}}),R.current=o,window.scrollTo({top:t,behavior:"instant"})})},[a]);(0,r.useEffect)(()=>{if(a.length===0)return;const t=setTimeout(T,100);return()=>clearTimeout(t)},[a,T]),(0,r.useEffect)(()=>{if(a.length===0)return;let t=null;const o=new ResizeObserver(()=>{t&&clearTimeout(t),t=setTimeout(T,150)});return o.observe(document.body),()=>{o.disconnect(),t&&clearTimeout(t)}},[a,T]),(0,r.useEffect)(()=>{if(a.length===0)return;const t=()=>{if(y.current){w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{y.current=!1,g.current&&(b(g.current),g.current="")},100);return}const i=x.current?.offsetHeight||0,s=window.scrollY+i+p+10;let d="";const N=R.current;for(let v=a.length-1;v>=0;v--){const F=a[v],A=P(F),C=N.get(A);if(C!==void 0&&s>=C){d=A;break}}if(!d&&a.length>0){const v=N.get(P(a[0]));v!==void 0&&s<v&&(d="")}b(d)},o=setTimeout(()=>{t()},200);return window.addEventListener("scroll",t,{passive:!0}),()=>{clearTimeout(o),window.removeEventListener("scroll",t),w.current&&clearTimeout(w.current)}},[a,p]),(0,r.useEffect)(()=>{const t=document.querySelectorAll(".header"),o=[];return t.forEach(i=>{const s=i;o.push({element:s,originalPosition:s.style.position||getComputedStyle(s).position}),s.style.position="relative"}),()=>{o.forEach(({element:i,originalPosition:s})=>{i.style.position=s==="static"?"":s})}},[]);const Y=(t,o)=>{t.preventDefault();const i=R.current.get(o);if(i===void 0){console.warn(`Cached position for "${o}" not found`);return}b(o),g.current=o,y.current=!0;const s=x.current?.offsetHeight||0,d=i-s-p;window.scrollTo({top:d,behavior:"smooth"}),window.history.pushState(null,"",`#${o}`)};return(0,e.jsxs)("div",{id:c,ref:x,className:(0,S.cn)("product-nav text-info-primary bg-container-primary tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] !sticky top-0 !z-[51] flex w-full justify-between overflow-hidden px-4 py-0",{"aiui-dark":z==="dark"},n),children:[(0,e.jsxs)("div",{className:"product-nav-main desktop:flex-row desktop:gap-[48px] flex w-full flex-col justify-start",children:[(0,e.jsxs)("div",{className:"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] pt-[14px]",children:[(0,e.jsxs)("div",{className:"product-nav-tabs flex flex-row items-center gap-[8px]",children:[k.map((t,o)=>(0,e.jsxs)("div",{className:"product-nav-tab-item flex items-center gap-[8px]",children:[(0,e.jsx)("a",{href:t.link,className:(0,S.cn)("product-nav-tab-link hover:text-brand-color text-nowrap text-[14px] font-bold tracking-[-0.04em]",{"text-[#6D6D6F]":o!==0,"hidden desktop:block":o===1}),children:(0,e.jsx)("span",{children:t.label})}),o!==k.length-1&&(0,e.jsx)("div",{className:"product-nav-tab-divider desktop:inline-block hidden h-[14px] w-px bg-[#E4E5E6]"})]},t.link||o)),k.length>1&&(0,e.jsxs)(L.Root,{children:[(0,e.jsx)(L.Trigger,{asChild:!0,children:(0,e.jsx)("button",{className:"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block","aria-label":"More products",children:(0,e.jsx)(U,{className:"text-[#1D1D1F]"})})}),(0,e.jsx)(L.Content,{className:"product-nav-dropdown-content rounded-[6px] border border-[#E4E5E6] bg-white p-[6px] px-[8px] py-[4px]",style:{boxShadow:"0px 4px 8px 0px rgba(0,0,0,0.12)"},side:"bottom",align:"end",alignOffset:10,sideOffset:10,children:k.slice(1).map(t=>(0,e.jsx)("a",{href:t.link,className:"product-nav-dropdown-link hover:text-brand-color text-nowrap",children:(0,e.jsx)("span",{children:t.label})},t.link))})]})]}),(0,e.jsxs)("div",{className:"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]",children:[m?.link&&(0,e.jsx)("a",{href:m.link,target:m.target||"_self",className:"product-nav-text-link hover:text-brand-color cursor-pointer",children:(0,e.jsx)(u.Text,{size:2,className:"text-nowrap",children:m.text})}),f?.link&&(0,e.jsx)(u.Button,{as:"a",href:f.link,size:"sm",className:"product-nav-buy-button text-nowrap",children:f.text})]})]}),(0,e.jsx)("div",{className:"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[12px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:a.map((t,o)=>{const i=P(t);return(0,e.jsxs)("a",{href:`#${i}`,className:"product-nav-anchor-link",onClick:s=>{h?(s.preventDefault(),b(i),g.current=i,y.current=!0,h(t,o)):Y(s,i)},children:[(0,e.jsx)(u.Text,{size:2,className:"product-nav-anchor-text text-nowrap",children:t.label}),(0,e.jsx)("div",{className:(0,S.cn)("product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent",{"!bg-brand-0":j===i})})]},i)})})]}),(0,e.jsxs)("div",{className:"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]",children:[m?.link&&(0,e.jsx)(u.Link,{href:m.link,target:m.target||"_self",className:"product-nav-text-link no-underline",children:(0,e.jsx)(u.Text,{size:2,className:"text-nowrap",children:m.text})}),f?.link&&(0,e.jsx)(u.Button,{as:"a",href:f.link,size:"sm",className:"product-nav-buy-button text-nowrap",children:f.text})]})]})});D.displayName="ProductNav";var X=(0,H.withLayout)(D);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var j=Object.create;var g=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var H=(t,i)=>{for(var e in i)g(t,e,{get:i[e],enumerable:!0})},b=(t,i,e,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of O(i))!A.call(t,r)&&r!==e&&g(t,r,{get:()=>i[r],enumerable:!(d=D(i,r))||d.enumerable});return t};var I=(t,i,e)=>(e=t!=null?j(q(t)):{},b(i||!t||!t.__esModule?g(e,"default",{value:t,enumerable:!0}):e,t)),R=t=>b(g({},"__esModule",{value:!0}),t);var U={};H(U,{SceneProductCard:()=>x});module.exports=R(U);var a=require("react/jsx-runtime"),M=I(require("react")),
|
|
1
|
+
"use strict";"use client";var j=Object.create;var g=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var H=(t,i)=>{for(var e in i)g(t,e,{get:i[e],enumerable:!0})},b=(t,i,e,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of O(i))!A.call(t,r)&&r!==e&&g(t,r,{get:()=>i[r],enumerable:!(d=D(i,r))||d.enumerable});return t};var I=(t,i,e)=>(e=t!=null?j(q(t)):{},b(i||!t||!t.__esModule?g(e,"default",{value:t,enumerable:!0}):e,t)),R=t=>b(g({},"__esModule",{value:!0}),t);var U={};H(U,{SceneProductCard:()=>x});module.exports=R(U);var a=require("react/jsx-runtime"),M=I(require("react")),o=require("../../helpers/index.js"),s=require("../../components/index.js"),k=require("./context.js"),C=require("../../shared/LocalizedLink.js");const x=M.forwardRef(({className:t,classNames:i,product:e,selected:d,onSelectChange:r,showTags:P,showOriginalPrice:u,onProductImageClick:N,...S},v)=>{const n=(0,k.useSceneShelfContext)(),w=P??n?.showTags??!0,y=u??n?.showOriginalPrice??!0,l=i??n?.classNames??{},p=d??(n?n.selectedIds.has(e.id):!1),h=r??n?.onSelectChange,f=N??n?.onProductImageClick,m=e.soldOut??!1,z=c=>{m||typeof c=="boolean"&&h?.(c,e)},T=()=>{m||h?.(!p,e)};return(0,a.jsxs)("div",{ref:v,className:(0,o.cn)("lg-desktop:gap-2 lg-desktop:h-[362px] lg-desktop:px-6 lg-desktop:pb-6 lg-desktop:pt-4 rounded-box box-border flex h-[284px] flex-col justify-between gap-2 border-2 border-solid p-4 pb-6 transition-colors",m?"cursor-not-allowed opacity-50":"cursor-pointer",p?(0,o.cn)("border-brand-0 bg-container-secondary-0",l?.cardSelected):(0,o.cn)("border-lines bg-container-primary",l?.card),t),onClick:T,"data-headless-type-name":"SceneShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name??e.title}##Select`,"data-headless-sku":e.id,...S,children:[(0,a.jsx)("div",{className:(0,o.cn)("lg-desktop:left-6 lg-desktop:top-6 flex max-h-[24px] min-h-[24px] flex-wrap gap-1 overflow-visible pr-9",l?.tags),children:w&&e.tags?.map((c,L)=>(0,a.jsx)(s.Badge,{variant:c.variant||"outline",size:"sm",children:c.label},L))}),(0,a.jsx)(s.Checkbox,{checked:p,disabled:m,onCheckedChange:z,onClick:c=>c.stopPropagation(),className:(0,o.cn)("text-brand-0 border-brand-0 lg-desktop:right-6 lg-desktop:top-6 absolute right-4 top-4 size-5 shrink-0",l?.checkbox)}),(0,a.jsx)("div",{className:(0,o.cn)("flex flex-1 grow-0 items-center justify-center",l?.image),children:f?(0,a.jsx)("a",{onClick:()=>f(e),role:"button",children:(0,a.jsx)(s.Picture,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):e?.href?(0,a.jsx)(C.LocalizedLink,{href:e.href,children:(0,a.jsx)(s.Picture,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):(0,a.jsx)(s.Picture,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}),(0,a.jsxs)("div",{className:"flex grow flex-col justify-start gap-4",children:[(0,a.jsx)(s.Heading,{as:"h3",size:2,className:(0,o.cn)("text-info-primary line-clamp-2 h-[2.2em]",l?.title),html:e.custom_name??e.title}),(0,a.jsxs)("div",{className:(0,o.cn)("flex flex-wrap items-center gap-1",l?.priceWrapper),children:[(0,a.jsx)(s.Text,{as:"span",size:2,className:(0,o.cn)("text-info-primary lg-desktop:text-[24px] whitespace-nowrap text-[20px]",l?.currentPrice),children:e.currentPrice.formatted}),y&&e.originalPrice&&e.originalPrice.value>e.currentPrice.value&&(0,a.jsx)(s.Text,{as:"span",size:2,className:(0,o.cn)("text-info-quaternary lg-desktop:text-[24px] whitespace-nowrap text-[20px] line-through",l?.originalPrice),children:e.originalPrice.formatted})]}),e?.priceLabel&&(0,a.jsx)(s.Text,{size:4,className:(0,o.cn)("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",l?.productPriceLabel),children:e.priceLabel})]})]})});x.displayName="SceneShelf.ProductCard";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var V=Object.create;var g=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var J=(e,i)=>{for(var r in i)g(e,r,{get:i[r],enumerable:!0})},L=(e,i,r,m)=>{if(i&&typeof i=="object"||typeof i=="function")for(let l of K(i))!I.call(e,l)&&l!==r&&g(e,l,{get:()=>i[l],enumerable:!(m=q(i,l))||m.enumerable});return e};var Q=(e,i,r)=>(r=e!=null?V(W(e)):{},L(i||!e||!e.__esModule?g(r,"default",{value:e,enumerable:!0}):r,e)),X=e=>L(g({},"__esModule",{value:!0}),e);var Z={};J(Z,{ProductCard:()=>
|
|
1
|
+
"use strict";"use client";var V=Object.create;var g=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var J=(e,i)=>{for(var r in i)g(e,r,{get:i[r],enumerable:!0})},L=(e,i,r,m)=>{if(i&&typeof i=="object"||typeof i=="function")for(let l of K(i))!I.call(e,l)&&l!==r&&g(e,l,{get:()=>i[l],enumerable:!(m=q(i,l))||m.enumerable});return e};var Q=(e,i,r)=>(r=e!=null?V(W(e)):{},L(i||!e||!e.__esModule?g(r,"default",{value:e,enumerable:!0}):r,e)),X=e=>L(g({},"__esModule",{value:!0}),e);var Z={};J(Z,{ProductCard:()=>b,default:()=>Y});module.exports=X(Z);var t=require("react/jsx-runtime"),c=Q(require("react")),o=require("../../helpers/index.js"),a=require("../../components/index.js"),z=require("../../shared/trackUrlRef.js"),u=require("../../shared/track.js"),D=require("../AiuiProvider/index.js");const b=c.forwardRef(({product:e,className:i,showTags:r=!0,onLearnMore:m,onShopNow:l,onAddToCart:_,classNames:n,secondaryButtonText:f,secondaryButtonFun:h,primaryButtonText:y,primaryButtonFun:P,showOriginalPrice:k,renderOriginalPrice:w,copy:M,onProductImageClick:v,theme:H="light",locale:C="us",index:d=0,tabName:S},O)=>{const[j,R]=c.useState(!1),[A,G]=c.useState(!1),{trackingData:U}=(0,D.useAiuiContext)(),p=U?.pageGroup,N=!e.soldOut,T=c.useCallback(async(s,x)=>{if(!s)return;const B=x==="primary"?R:G;B(!0);try{switch(s){case"buyNow":await l?.(e);break;case"addCart":await _?.(e);break;case"learnMore":await m?.(e.href);break}}finally{B(!1)}},[e,l,_,m]),E=c.useMemo(()=>(0,o.getLocalizedPath)((0,z.trackUrlRef)(e.href,p+"_shelf_scene_shelf_v3"),C),[e.href,p,C]),F=c.useCallback(()=>{v?.(e),(0,u.gaTrack)({event:"ga4Event",event_name:"select_item",item_list_name:"Scene_Shelf_3_Products",page_group:p,items:[{item_id:e.sku,item_name:e.title,item_variant:e.id,price:e.currentPrice,index:d}],tab_name:S,position:d})},[v,e,p,d,S]);return(0,t.jsx)(a.Card,{ref:O,className:(0,o.cn)("bg-container-primary flex h-full flex-col overflow-hidden border-none hover:bg-white",i,n?.productCard,{"hover:bg-container-secondary-0 ":H==="dark"}),children:(0,t.jsxs)(a.CardContent,{className:"desktop:p-6 relative flex flex-1 flex-col justify-between p-4",children:[(0,t.jsx)("div",{className:"product-image-wrapper lg-desktop:size-[196px] mx-auto size-[138px] cursor-pointer overflow-hidden",children:(0,t.jsx)("a",{onClick:F,...!v&&{href:E},rel:"noreferrer",children:(0,t.jsx)(a.Picture,{source:e.imageUrl,alt:e.imageAlt,className:"aspect-square size-full object-contain",imgClassName:"w-full h-full object-contain"})})}),(0,t.jsx)("div",{className:"lg-desktop:h-[28px] mb-1 flex h-[24px] gap-1",children:r&&e.tags?.map((s,x)=>(0,t.jsx)(a.Badge,{size:"sm",variant:s.variant||"outline",className:(0,o.cn)(s.variant==="promotional"?"ml-2":""),promotionalType:s.promotionalType,children:s.label},x))}),(0,t.jsxs)("div",{className:"flex h-full flex-1 grow flex-col justify-between",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(a.Heading,{as:"h3",size:2,className:(0,o.cn)("text-info-primary laptop:line-clamp-2 mb-2 line-clamp-3 min-h-[2.4em]",n?.productTitle),html:e.custom_name||e.title}),(e?.custom_description||e?.description)&&(0,t.jsx)(a.Text,{size:2,className:(0,o.cn)("text-info-secondary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1 text-[14px]",n?.productDescription),html:e.custom_description||e.description})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:(0,o.cn)("mb-2",n?.productPrice),children:(0,t.jsx)("div",{className:(0,o.cn)("laptop:gap-1 flex flex-wrap items-baseline gap-[2px]",n?.priceWrapper),children:N?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.Heading,{size:2,className:"text-info-primary",as:"h6",children:e.currentPrice}),w?w(e,{showOriginalPrice:k}):k&&e.originalPrice&&(0,t.jsx)(a.Heading,{size:2,className:(0,o.cn)("text-info-tertiary line-through",n?.originalPrice),as:"h6",children:e.originalPrice})]}):(0,t.jsx)(a.Heading,{size:2,className:"text-info-tertiary",children:M?.outOfStockLabel??"Sold Out"})})}),e?.priceLabel&&N&&(0,t.jsx)(a.Text,{size:4,className:(0,o.cn)("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",n?.productPriceLabel),children:e.priceLabel}),(0,t.jsxs)("div",{className:(0,o.cn)("lg-desktop:gap-3 laptop:flex-row laptop:flex-nowrap flex flex-col flex-wrap gap-2",n?.buttonGroup),children:[f&&(0,t.jsx)(a.Button,{variant:"secondary",size:"base",className:(0,o.cn)("laptop:flex-1 laptop:min-w-0 laptop:whitespace-normal laptop:text-center w-full min-w-0 whitespace-normal text-center",n?.secondaryButton),onClick:()=>{T(h,"secondary"),(0,u.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:p||"Home Page",component_type:"copy",component_name:"scene_shelf_product",component_title:e.custom_name||e.title,component_description:e.custom_description||"",button_name:f,SKU:e.sku||"",position:d}})},disabled:e.soldOut&&h!=="learnMore",loading:A,children:f}),y&&(0,t.jsx)(a.Button,{variant:"primary",size:"base",className:(0,o.cn)("laptop:flex-1 laptop:min-w-0 laptop:whitespace-normal laptop:text-center w-full min-w-0 whitespace-normal text-center",n?.primaryButton),onClick:()=>{T(P,"primary"),(0,u.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:p||"Home Page",component_type:"copy",component_name:"scene_shelf_product",component_title:e.custom_name||e.title,component_description:e.custom_description||"",button_name:y,SKU:e.sku||"",position:d}})},disabled:e.soldOut&&P!=="learnMore",loading:j,children:y})]})]})]})]})})});b.displayName="SceneShelfV3.ProductCard";var Y=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ze=Object.create;var fe=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var Fe=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty;var Ee=(e,t)=>{for(var p in t)fe(e,p,{get:t[p],enumerable:!0})},Ie=(e,t,p,T)=>{if(t&&typeof t=="object"||typeof t=="function")for(let g of Fe(t))!je.call(e,g)&&g!==p&&fe(e,g,{get:()=>t[g],enumerable:!(T=Ae(t,g))||T.enumerable});return e};var Te=(e,t,p)=>(p=e!=null?ze(Me(e)):{},Ie(t||!e||!e.__esModule?fe(p,"default",{value:e,enumerable:!0}):p,e)),Oe=e=>Ie(fe({},"__esModule",{value:!0}),e);var Re={};Ee(Re,{ShelfDisplayHorizontalItem:()=>Ue,ShelfDisplayWrapItem:()=>He,getProductImage:()=>De});module.exports=Oe(Re);var s=require("react/jsx-runtime"),Ne=require("../AiuiProvider/index.js"),Ce=require("./shelfDisplay.js"),xe=Te(require("../../components/picture.js")),ve=Te(require("../../components/badge.js")),k=require("../../helpers/utils.js"),be=require("../../components/text.js"),se=Te(require("../../components/button.js")),Be=require("../../shared/track.js"),Pe=require("../../shared/trackUrlRef.js"),Le=require("../../components/heading.js"),$e=require("../../hooks/useExposure.js"),c=require("react");const ye="image",ge="product_shelf",he=999999999e-2,De=e=>{const t=e?.sku,p=e?.variants,T=p?.find(O=>O?.sku===t),g=T?.image?.url||p?.[0]?.image?.url||"",re=T?.image?.altText||p?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:g,altText:re}},We=({items:e})=>e?.length?(0,s.jsx)("div",{className:"shelf-display-social-endorsements desktop:gap-2 absolute right-0 top-0 z-10 flex flex-col items-center gap-1",children:e.map((t,p)=>typeof t.icon=="string"?(0,s.jsx)("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},p):(0,s.jsx)(be.Text,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},p))}):null,He=({data:e,configuration:t})=>{const{isDisplayBackImage:p=!1,itemShape:T,metafields:g,isTopTag:re=!1,isShowTag:O,isShowOriginalPrice:I,isShowShortTitle:ke=!1,isShowPricesTag:z=!1,pricesTagTextColor:W,pricesTagBgColor:H,itemsTagTextColor:w,itemsTagBgColor:K,formatPrice:ie,renderOriginalPrice:Q,renderPriceLabel:we,renderPrice:U}=t||{},{locale:C="es",copyWriting:oe,currencyDisplay:X}=(0,Ne.useAiuiContext)(),{discounts:Y,discountsCopy:le}=g||{},ne=(0,c.useRef)(null),[n,ae]=(0,c.useState)([]),[ce,A]=(0,c.useState)(""),[pe,F]=(0,c.useState)(!1),[_,R]=(0,c.useState)(!1),me=(i,d,u,f)=>{const{primaryFun:b,onAddCart:N,onBuyNow:ee,onLearnMore:te,event:Se}=t||{};if(b){if(b==="AddCart"&&N)return N(i,d+1,u,f);if(b==="BuyNow"&&ee)return ee(i,d+1,u,f);if(b==="LearnMore"&&te)return te(i,d+1,u,f)}Se?.primaryButton?.(i,d+1,u,f)},_e=(i,d,u,f)=>{const{secondaryFun:b,onAddCart:N,onBuyNow:ee,onLearnMore:te,event:Se}=t||{};if(b){if(b==="AddCart"&&N)return N(i,d+1,u,f);if(b==="BuyNow"&&ee)return ee(i,d+1,u,f);if(b==="LearnMore"&&te)return te(i,d+1,u,f)}Se?.secondaryButton?.(i,d+1,u,f)},o=(0,c.useMemo)(()=>{const i=e?.variants||[];if(i.length)return e?.sku?i?.find?.(d=>d?.sku===e?.sku)||i[0]:i?.[0]},[e?.sku,e?.variants]),M=o?.id?.split?.("/")||[],B=M?.[M?.length-1],h=!o?.availableForSale||o?.price?.amount===he||o?.price===he,S=o?.coupons?.[0],de=e?.price?.currencyCode||"USD",q=(0,c.useMemo)(()=>(0,Ce.formatVariantPrice)({locale:C,amount:S?S?.variant_price4wscode:o?.price,baseAmount:S?o?.price:0,currencyCode:de,currencyDisplay:X,customFormatPrice:ie}),[de,C,S,X,o,ie]),{price:j,basePrice:P,discount:L,discountAmount:E}=q,{imageUrl:V,altText:ue}=De(e),G=e?.custom_name||e?.title,$=ke&&o?.metafields?.infos?.page_short_title||G,Z=e?.custom_description||e?.description,r=()=>{if(S?.value_type==="fixed_amount"){const i=E||"",d=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(d){const[,u,f,b]=d;let N=f;return f.endsWith(".00")?N=f.replace(/\.00$/,""):f.endsWith(",00")&&(N=f.replace(/,00$/,"")),`${u}${N}${b}`}return i}return L||""};(0,c.useEffect)(()=>{let i=[];if(L||E){const u=`${r()} ${Y?.off||le?.off||""}`;A(u)}const d=e?.tags?.filter?.(u=>u?.startsWith?.("CLtag"))?.map?.(u=>u?.replace?.("CLtag:",""))?.slice?.(0,L&&z?1:2)||[];ae(i.concat(d))},[e?.tags,L,E,z,Y?.off,le?.off]),(0,$e.useExposure)(ne,{componentType:ye,componentName:ge,componentTitle:G,componentDescription:Z,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){F(!0);try{await me(e,t?.index,t,S)}finally{F(!1)}}},a=async()=>{if(!_&&!e?.custom_secondary_link){R(!0);try{await _e(e,t?.index,t,S)}finally{R(!1)}}},m=()=>(0,s.jsxs)("div",{className:"shelf-display-product-content desktop:gap-6 lg-desktop:flex-[221] desktop:flex-[190] flex flex-[178] flex-col justify-between gap-4",children:[(0,s.jsxs)("div",{className:"shelf-display-product-content-title-desc",children:[$?(0,s.jsx)(Le.Heading,{as:"h3",title:$||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:$||""}):null,(0,s.jsx)(be.Text,{size:2,className:(0,k.cn)("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:Z||""})]}),(0,s.jsxs)("div",{className:"shelf-display-product-content-price-button",children:[(0,s.jsx)("div",{className:"mb-2 flex items-center",children:U?U(e,{price:j,basePrice:P,discount:L,discountAmount:E,variant:o,coupon:S,isSoldOut:h,isShowOriginalPrice:I}):h?(0,s.jsx)("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:oe?.soldOutText}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"final-price lg-desktop:text-2xl text-info-primary text-xl font-bold !leading-[1.2]",children:o?.availableForSale&&j||""}),Q?Q(e,{price:j,basePrice:P,discount:L,discountAmount:E,isShowOriginalPrice:I}):P&&I&&(0,s.jsx)("div",{className:"origin-price lg-desktop:text-2xl text-info-quaternary ml-1 text-xl font-bold !leading-[1.2] line-through",children:o?.availableForSale&&P||""})]})}),!U&&we?.(e,o,{isShowOriginalPrice:I}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!h?(0,s.jsx)(se.default,{disabled:h&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:a,loading:_,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(se.default,{disabled:h&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:l,loading:pe,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]}),y={...W?{color:W}:{},...H?{backgroundColor:H,backgroundImage:"none"}:{},...W||H?{outline:"none"}:{}},x={...w?{color:w}:{},...K?{backgroundColor:K,backgroundImage:"none"}:{},...w||K?{outlineColor:w}:{}},D=()=>(0,s.jsxs)("div",{className:"lg-desktop:min-h-[28px] lg-desktop:flex-[28] box-border flex min-h-6 flex-[24] flex-wrap gap-1 overflow-hidden",children:[z&&ce&&(0,s.jsx)(ve.default,{className:"shelf-prices-tag",variant:"fill",style:y,children:ce||""}),O&&n?.length>0&&n?.map?.((i,d)=>(0,s.jsx)(ve.default,{className:"shelf-items-tag",variant:"outline",style:x,children:i},d))]}),v=e?.custom_bg_image,J=e?.custom_theme;return(0,s.jsx)("div",{ref:ne,className:(0,k.cn)("box-border w-full cursor-pointer overflow-hidden duration-300","rounded-box","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[545] desktop:aspect-w-[316] desktop:aspect-h-[450]","laptop:aspect-w-[288] laptop:aspect-h-[422] aspect-w-[296] aspect-h-[422] relative","md-tablet:h-[422px] shelf-display-item",v?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":J==="dark","aiui-light":J==="light"}),style:v?{backgroundImage:`url(${v})`}:void 0,children:p?(0,s.jsx)("div",{className:"absolute inset-0 box-border overflow-hidden",children:(0,s.jsxs)("div",{className:"relative inset-0 size-full",children:[(0,s.jsx)(D,{}),(0,s.jsx)(xe.default,{source:V,alt:ue,className:(0,k.cn)("flex h-full justify-center object-cover [&_img]:w-auto",{"opacity-0":v})}),(0,s.jsx)("div",{className:"desktop:p-6 absolute inset-x-0 bottom-0 box-border overflow-hidden p-4",children:m()})]})}):(0,s.jsxs)("div",{className:"desktop:p-6 desktop:pt-4 desktop:gap-2 absolute inset-0 box-border flex flex-col justify-between gap-1 overflow-hidden p-4",children:[(0,s.jsx)(D,{}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-display-item-image lg-desktop:flex-[240] relative inline-block w-full flex-[180] overflow-hidden",{"opacity-0":v}),children:[(0,s.jsx)("a",{"aria-label":G,target:t?.target,href:(0,Pe.trackUrlRef)(`${C==="us"||!C?"":`/${C}`}/products/${e?.handle}?variant=${B}`,`${ye}_${ge}`),onClick:()=>{(0,Be.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||o?.sku,item_name:e?.name,item_variant:o?.name,price:o?.price,index:t?.index+1}]}})},children:(0,s.jsx)(xe.default,{source:V,alt:ue,className:"flex h-full justify-center object-cover [&_img]:w-auto"})}),(0,s.jsx)(We,{items:e?.socialEndorsements})]}),m()]})},e?.id||e?.handle)},Ue=({data:e,configuration:t})=>{const{itemShape:p,itemLength:T,metafields:g,isShowShortTitle:re,formatPrice:O,renderOriginalPrice:I,renderPriceLabel:ke,renderPrice:z}=t||{},{discounts:W,discountsCopy:H}=g||{},{locale:w="us",copyWriting:K,currencyDisplay:ie}=(0,Ne.useAiuiContext)(),[Q,we]=(0,c.useState)([]),U=(0,c.useRef)(null),[C,oe]=(0,c.useState)(!1),[X,Y]=(0,c.useState)(!1),le=(r,l,a,m)=>{const{primaryFun:y,onAddCart:x,onBuyNow:D,onLearnMore:v,event:J}=t||{};if(y){if(y==="AddCart"&&x)return x(r,l+1,a,m);if(y==="BuyNow"&&D)return D(r,l+1,a,m);if(y==="LearnMore"&&v)return v(r,l+1,a,m)}J?.primaryButton?.(r,l+1,a,m)},ne=(r,l,a,m)=>{const{secondaryFun:y,onAddCart:x,onBuyNow:D,onLearnMore:v,event:J}=t||{};if(y){if(y==="AddCart"&&x)return x(r,l+1,a,m);if(y==="BuyNow"&&D)return D(r,l+1,a,m);if(y==="LearnMore"&&v)return v(r,l+1,a,m)}J?.secondaryButton?.(r,l+1,a,m)},n=(0,c.useMemo)(()=>{const r=e?.variants||[];if(r.length)return e?.sku&&r.find(l=>l?.sku===e?.sku)||r[0]},[e?.sku,e?.variants]),ae=n?.id?.split?.("/")||[],ce=ae?.[ae?.length-1],A=!n?.availableForSale||n?.price?.amount===he||n?.price===he,pe=t?.isShowTag,F=t?.isShowOriginalPrice,_=n?.coupons?.[0],R=!!(F&&_),me=e?.price?.currencyCode||"USD",_e=(0,c.useMemo)(()=>(0,Ce.formatVariantPrice)({locale:w,amount:R?_?.variant_price4wscode:n?.price,baseAmount:R?n?.price:0,currencyCode:me,currencyDisplay:ie,customFormatPrice:O}),[me,w,R,_?.variant_price4wscode,n,O]),{price:o,basePrice:M,discount:B,discountAmount:h}=_e,{imageUrl:S,altText:de}=De(e),q=e?.custom_name||e?.title,j=re&&n?.metafields?.infos?.page_short_title||q,P=e?.custom_description||e?.description;(0,$e.useExposure)(U,{componentType:ye,componentName:ge,componentTitle:q,componentDescription:P,position:t?.index+1});const L=async()=>{if(!C&&!e?.custom_primary_link){oe(!0);try{await le(e,t?.index,t,_)}finally{oe(!1)}}},E=async()=>{if(!X&&!e?.custom_secondary_link){Y(!0);try{await ne(e,t?.index,t,_)}finally{Y(!1)}}},V=()=>T>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},ue=()=>T>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col",G=()=>{if(_?.value_type==="fixed_amount"){const r=h||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,a,m,y]=l;let x=m;return m.endsWith(".00")?x=m.replace(/\.00$/,""):m.endsWith(",00")&&(x=m.replace(/,00$/,"")),`${a}${x}${y}`}return r}return B||""};(0,c.useEffect)(()=>{let r=[];if(B||h){const a=`${G()} ${W?.off||H?.off||""}`;r.push(a)}const l=e?.tags?.filter?.(a=>a?.startsWith?.("CLtag"))?.map?.(a=>a?.replace?.("CLtag:",""))?.slice?.(0,B?1:2)||[];we(r.concat(l))},[e?.tags,B,h,W?.off,H?.off]);const $=e?.custom_bg_image,Z=e?.custom_theme;return(0,s.jsx)("div",{ref:U,className:(0,k.cn)(V().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",$?"bg-cover bg-center bg-no-repeat":"bg-container-secondary-1 tablet:hover:bg-info-white",{"aiui-dark":Z==="dark","aiui-light":Z==="light"}),style:$?{backgroundImage:`url(${$})`}:void 0,children:(0,s.jsxs)("div",{className:(0,k.cn)(ue(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[(0,s.jsx)("div",{className:(0,k.cn)(V().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":$}),children:(0,s.jsx)("a",{"aria-label":q,target:t?.target,href:(0,Pe.trackUrlRef)(`${w==="us"||!w?"":`/${w}`}/products/${e?.handle}?variant=${ce}`,`${ye}_${ge}`),onClick:()=>{(0,Be.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||n?.sku,item_name:e?.name,item_variant:n?.name,price:n?.price,index:t?.index+1}]}})},children:(0,s.jsx)(xe.default,{source:S,alt:de,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),(0,s.jsxs)("div",{className:(0,k.cn)("flex flex-col items-start justify-center",V().boxItem),children:[pe&&(0,s.jsx)("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:Q?.length>0&&Q?.map?.((r,l)=>(0,s.jsx)(ve.default,{className:"shelf-items-tag",variant:"fill",children:r},l))}),j?(0,s.jsx)(Le.Heading,{as:"h3",title:j||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:j||""}):null,P?(0,s.jsx)(be.Text,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description text-info-primary line-clamp-1 h-5 text-sm",html:P||""}):null,(0,s.jsx)("div",{className:"mb-2 mt-5 flex items-center",children:z?z(e,{price:o,basePrice:M,discount:B,discountAmount:h,variant:n,coupon:_,isSoldOut:A,isShowOriginalPrice:F}):A?(0,s.jsx)("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:K?.soldOutText}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"final-price tablet:text-xl text-info-primary text-xl font-bold",children:n?.availableForSale&&o||""}),I?I(e,{price:o,basePrice:M,discount:B,discountAmount:h,isShowOriginalPrice:F}):M&&(0,s.jsx)("div",{className:"origin-price tablet:text-xl text-info-quaternary ml-1 text-lg font-bold line-through",children:n?.availableForSale&&M||""})]})}),!z&&ke?.(e,n,{isShowOriginalPrice:F}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!A?(0,s.jsx)(se.default,{disabled:A&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:E,loading:X,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(se.default,{disabled:A&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:L,loading:C,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};
|
|
1
|
+
"use strict";var ze=Object.create;var fe=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var Fe=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty;var Ee=(e,t)=>{for(var p in t)fe(e,p,{get:t[p],enumerable:!0})},Ie=(e,t,p,T)=>{if(t&&typeof t=="object"||typeof t=="function")for(let g of Fe(t))!je.call(e,g)&&g!==p&&fe(e,g,{get:()=>t[g],enumerable:!(T=Ae(t,g))||T.enumerable});return e};var Te=(e,t,p)=>(p=e!=null?ze(Me(e)):{},Ie(t||!e||!e.__esModule?fe(p,"default",{value:e,enumerable:!0}):p,e)),Oe=e=>Ie(fe({},"__esModule",{value:!0}),e);var Re={};Ee(Re,{ShelfDisplayHorizontalItem:()=>Ue,ShelfDisplayWrapItem:()=>He,getProductImage:()=>De});module.exports=Oe(Re);var s=require("react/jsx-runtime"),Ne=require("../AiuiProvider/index.js"),Ce=require("./shelfDisplay.js"),xe=Te(require("../../components/picture.js")),ve=Te(require("../../components/badge.js")),k=require("../../helpers/utils.js"),be=require("../../components/text.js"),se=Te(require("../../components/button.js")),Be=require("../../shared/track.js"),Pe=require("../../shared/trackUrlRef.js"),Le=require("../../components/heading.js"),$e=require("../../hooks/useExposure.js"),c=require("react");const ye="image",ge="product_shelf",he=999999999e-2,De=e=>{const t=e?.sku,p=e?.variants,T=p?.find(O=>O?.sku===t),g=T?.image?.url||p?.[0]?.image?.url||"",re=T?.image?.altText||p?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:g,altText:re}},We=({items:e})=>e?.length?(0,s.jsx)("div",{className:"shelf-display-social-endorsements desktop:gap-2 absolute right-0 top-0 z-10 flex flex-col items-center gap-1",children:e.map((t,p)=>typeof t.icon=="string"?(0,s.jsx)("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},p):(0,s.jsx)(be.Text,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},p))}):null,He=({data:e,configuration:t})=>{const{isDisplayBackImage:p=!1,itemShape:T,metafields:g,isTopTag:re=!1,isShowTag:O,isShowOriginalPrice:I,isShowShortTitle:ke=!1,isShowPricesTag:z=!1,pricesTagTextColor:W,pricesTagBgColor:H,itemsTagTextColor:w,itemsTagBgColor:K,formatPrice:ie,renderOriginalPrice:Q,renderPriceLabel:we,renderPrice:U}=t||{},{locale:C="es",copyWriting:oe,currencyDisplay:X}=(0,Ne.useAiuiContext)(),{discounts:Y,discountsCopy:le}=g||{},ne=(0,c.useRef)(null),[n,ae]=(0,c.useState)([]),[ce,A]=(0,c.useState)(""),[pe,F]=(0,c.useState)(!1),[_,R]=(0,c.useState)(!1),me=(i,d,u,f)=>{const{primaryFun:b,onAddCart:N,onBuyNow:ee,onLearnMore:te,event:Se}=t||{};if(b){if(b==="AddCart"&&N)return N(i,d+1,u,f);if(b==="BuyNow"&&ee)return ee(i,d+1,u,f);if(b==="LearnMore"&&te)return te(i,d+1,u,f)}Se?.primaryButton?.(i,d+1,u,f)},_e=(i,d,u,f)=>{const{secondaryFun:b,onAddCart:N,onBuyNow:ee,onLearnMore:te,event:Se}=t||{};if(b){if(b==="AddCart"&&N)return N(i,d+1,u,f);if(b==="BuyNow"&&ee)return ee(i,d+1,u,f);if(b==="LearnMore"&&te)return te(i,d+1,u,f)}Se?.secondaryButton?.(i,d+1,u,f)},o=(0,c.useMemo)(()=>{const i=e?.variants||[];if(i.length)return e?.sku?i?.find?.(d=>d?.sku===e?.sku)||i[0]:i?.[0]},[e?.sku,e?.variants]),M=o?.id?.split?.("/")||[],B=M?.[M?.length-1],h=!o?.availableForSale||o?.price?.amount===he||o?.price===he,S=o?.coupons?.[0],de=e?.price?.currencyCode||"USD",q=(0,c.useMemo)(()=>(0,Ce.formatVariantPrice)({locale:C,amount:S?S?.variant_price4wscode:o?.price,baseAmount:S?o?.price:0,currencyCode:de,currencyDisplay:X,customFormatPrice:ie}),[de,C,S,X,o,ie]),{price:j,basePrice:P,discount:L,discountAmount:E}=q,{imageUrl:V,altText:ue}=De(e),G=e?.custom_name||e?.title,$=ke&&o?.metafields?.infos?.page_short_title||G,Z=e?.custom_description||e?.description,r=()=>{if(S?.value_type==="fixed_amount"){const i=E||"",d=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(d){const[,u,f,b]=d;let N=f;return f.endsWith(".00")?N=f.replace(/\.00$/,""):f.endsWith(",00")&&(N=f.replace(/,00$/,"")),`${u}${N}${b}`}return i}return L||""};(0,c.useEffect)(()=>{let i=[];if(L||E){const u=`${r()} ${Y?.off||le?.off||""}`;A(u)}const d=e?.tags?.filter?.(u=>u?.startsWith?.("CLtag"))?.map?.(u=>u?.replace?.("CLtag:",""))?.slice?.(0,L&&z?1:2)||[];ae(i.concat(d))},[e?.tags,L,E,z,Y?.off,le?.off]),(0,$e.useExposure)(ne,{componentType:ye,componentName:ge,componentTitle:G,componentDescription:Z,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){F(!0);try{await me(e,t?.index,t,S)}finally{F(!1)}}},a=async()=>{if(!_&&!e?.custom_secondary_link){R(!0);try{await _e(e,t?.index,t,S)}finally{R(!1)}}},m=()=>(0,s.jsxs)("div",{className:"shelf-display-product-content desktop:gap-6 lg-desktop:flex-[221] desktop:flex-[190] flex flex-[178] flex-col justify-between gap-4",children:[(0,s.jsxs)("div",{className:"shelf-display-product-content-title-desc",children:[$?(0,s.jsx)(Le.Heading,{as:"h3",title:$||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:$||""}):null,(0,s.jsx)(be.Text,{size:2,className:(0,k.cn)("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:Z||""})]}),(0,s.jsxs)("div",{className:"shelf-display-product-content-price-button",children:[(0,s.jsx)("div",{className:"mb-2 flex flex-wrap items-center",children:U?U(e,{price:j,basePrice:P,discount:L,discountAmount:E,variant:o,coupon:S,isSoldOut:h,isShowOriginalPrice:I}):h?(0,s.jsx)("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:oe?.soldOutText}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"final-price lg-desktop:text-2xl text-info-primary whitespace-nowrap text-xl font-bold !leading-[1.2]",children:o?.availableForSale&&j||""}),Q?Q(e,{price:j,basePrice:P,discount:L,discountAmount:E,isShowOriginalPrice:I}):P&&I&&(0,s.jsx)("div",{className:"origin-price lg-desktop:text-2xl text-info-quaternary ml-1 whitespace-nowrap text-xl font-bold !leading-[1.2] line-through",children:o?.availableForSale&&P||""})]})}),!U&&we?.(e,o,{isShowOriginalPrice:I}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!h?(0,s.jsx)(se.default,{disabled:h&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:a,loading:_,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(se.default,{disabled:h&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:l,loading:pe,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]}),y={...W?{color:W}:{},...H?{backgroundColor:H,backgroundImage:"none"}:{},...W||H?{outline:"none"}:{}},x={...w?{color:w}:{},...K?{backgroundColor:K,backgroundImage:"none"}:{},...w||K?{outlineColor:w}:{}},D=()=>(0,s.jsxs)("div",{className:"lg-desktop:min-h-[28px] lg-desktop:flex-[28] box-border flex min-h-6 flex-[24] flex-wrap gap-1 overflow-hidden",children:[z&&ce&&(0,s.jsx)(ve.default,{className:"shelf-prices-tag",variant:"fill",style:y,children:ce||""}),O&&n?.length>0&&n?.map?.((i,d)=>(0,s.jsx)(ve.default,{className:"shelf-items-tag",variant:"outline",style:x,children:i},d))]}),v=e?.custom_bg_image,J=e?.custom_theme;return(0,s.jsx)("div",{ref:ne,className:(0,k.cn)("box-border w-full cursor-pointer overflow-hidden duration-300","rounded-box","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[545] desktop:aspect-w-[316] desktop:aspect-h-[450]","laptop:aspect-w-[288] laptop:aspect-h-[422] aspect-w-[296] aspect-h-[422] relative","md-tablet:h-[422px] shelf-display-item",v?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":J==="dark","aiui-light":J==="light"}),style:v?{backgroundImage:`url(${v})`}:void 0,children:p?(0,s.jsx)("div",{className:"absolute inset-0 box-border overflow-hidden",children:(0,s.jsxs)("div",{className:"relative inset-0 size-full",children:[(0,s.jsx)(D,{}),(0,s.jsx)(xe.default,{source:V,alt:ue,className:(0,k.cn)("flex h-full justify-center object-cover [&_img]:w-auto",{"opacity-0":v})}),(0,s.jsx)("div",{className:"desktop:p-6 absolute inset-x-0 bottom-0 box-border overflow-hidden p-4",children:m()})]})}):(0,s.jsxs)("div",{className:"desktop:p-6 desktop:pt-4 desktop:gap-2 absolute inset-0 box-border flex flex-col justify-between gap-1 overflow-hidden p-4",children:[(0,s.jsx)(D,{}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-display-item-image lg-desktop:flex-[240] relative inline-block w-full flex-[180] overflow-hidden",{"opacity-0":v}),children:[(0,s.jsx)("a",{"aria-label":G,target:t?.target,href:(0,Pe.trackUrlRef)(`${C==="us"||!C?"":`/${C}`}/products/${e?.handle}?variant=${B}`,`${ye}_${ge}`),onClick:()=>{(0,Be.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||o?.sku,item_name:e?.name,item_variant:o?.name,price:o?.price,index:t?.index+1}]}})},children:(0,s.jsx)(xe.default,{source:V,alt:ue,className:"flex h-full justify-center object-cover [&_img]:w-auto"})}),(0,s.jsx)(We,{items:e?.socialEndorsements})]}),m()]})},e?.id||e?.handle)},Ue=({data:e,configuration:t})=>{const{itemShape:p,itemLength:T,metafields:g,isShowShortTitle:re,formatPrice:O,renderOriginalPrice:I,renderPriceLabel:ke,renderPrice:z}=t||{},{discounts:W,discountsCopy:H}=g||{},{locale:w="us",copyWriting:K,currencyDisplay:ie}=(0,Ne.useAiuiContext)(),[Q,we]=(0,c.useState)([]),U=(0,c.useRef)(null),[C,oe]=(0,c.useState)(!1),[X,Y]=(0,c.useState)(!1),le=(r,l,a,m)=>{const{primaryFun:y,onAddCart:x,onBuyNow:D,onLearnMore:v,event:J}=t||{};if(y){if(y==="AddCart"&&x)return x(r,l+1,a,m);if(y==="BuyNow"&&D)return D(r,l+1,a,m);if(y==="LearnMore"&&v)return v(r,l+1,a,m)}J?.primaryButton?.(r,l+1,a,m)},ne=(r,l,a,m)=>{const{secondaryFun:y,onAddCart:x,onBuyNow:D,onLearnMore:v,event:J}=t||{};if(y){if(y==="AddCart"&&x)return x(r,l+1,a,m);if(y==="BuyNow"&&D)return D(r,l+1,a,m);if(y==="LearnMore"&&v)return v(r,l+1,a,m)}J?.secondaryButton?.(r,l+1,a,m)},n=(0,c.useMemo)(()=>{const r=e?.variants||[];if(r.length)return e?.sku&&r.find(l=>l?.sku===e?.sku)||r[0]},[e?.sku,e?.variants]),ae=n?.id?.split?.("/")||[],ce=ae?.[ae?.length-1],A=!n?.availableForSale||n?.price?.amount===he||n?.price===he,pe=t?.isShowTag,F=t?.isShowOriginalPrice,_=n?.coupons?.[0],R=!!(F&&_),me=e?.price?.currencyCode||"USD",_e=(0,c.useMemo)(()=>(0,Ce.formatVariantPrice)({locale:w,amount:R?_?.variant_price4wscode:n?.price,baseAmount:R?n?.price:0,currencyCode:me,currencyDisplay:ie,customFormatPrice:O}),[me,w,R,_?.variant_price4wscode,n,O]),{price:o,basePrice:M,discount:B,discountAmount:h}=_e,{imageUrl:S,altText:de}=De(e),q=e?.custom_name||e?.title,j=re&&n?.metafields?.infos?.page_short_title||q,P=e?.custom_description||e?.description;(0,$e.useExposure)(U,{componentType:ye,componentName:ge,componentTitle:q,componentDescription:P,position:t?.index+1});const L=async()=>{if(!C&&!e?.custom_primary_link){oe(!0);try{await le(e,t?.index,t,_)}finally{oe(!1)}}},E=async()=>{if(!X&&!e?.custom_secondary_link){Y(!0);try{await ne(e,t?.index,t,_)}finally{Y(!1)}}},V=()=>T>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},ue=()=>T>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col",G=()=>{if(_?.value_type==="fixed_amount"){const r=h||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,a,m,y]=l;let x=m;return m.endsWith(".00")?x=m.replace(/\.00$/,""):m.endsWith(",00")&&(x=m.replace(/,00$/,"")),`${a}${x}${y}`}return r}return B||""};(0,c.useEffect)(()=>{let r=[];if(B||h){const a=`${G()} ${W?.off||H?.off||""}`;r.push(a)}const l=e?.tags?.filter?.(a=>a?.startsWith?.("CLtag"))?.map?.(a=>a?.replace?.("CLtag:",""))?.slice?.(0,B?1:2)||[];we(r.concat(l))},[e?.tags,B,h,W?.off,H?.off]);const $=e?.custom_bg_image,Z=e?.custom_theme;return(0,s.jsx)("div",{ref:U,className:(0,k.cn)(V().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",$?"bg-cover bg-center bg-no-repeat":"bg-container-secondary-1 tablet:hover:bg-info-white",{"aiui-dark":Z==="dark","aiui-light":Z==="light"}),style:$?{backgroundImage:`url(${$})`}:void 0,children:(0,s.jsxs)("div",{className:(0,k.cn)(ue(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[(0,s.jsx)("div",{className:(0,k.cn)(V().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":$}),children:(0,s.jsx)("a",{"aria-label":q,target:t?.target,href:(0,Pe.trackUrlRef)(`${w==="us"||!w?"":`/${w}`}/products/${e?.handle}?variant=${ce}`,`${ye}_${ge}`),onClick:()=>{(0,Be.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||n?.sku,item_name:e?.name,item_variant:n?.name,price:n?.price,index:t?.index+1}]}})},children:(0,s.jsx)(xe.default,{source:S,alt:de,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),(0,s.jsxs)("div",{className:(0,k.cn)("flex flex-col items-start justify-center",V().boxItem),children:[pe&&(0,s.jsx)("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:Q?.length>0&&Q?.map?.((r,l)=>(0,s.jsx)(ve.default,{className:"shelf-items-tag",variant:"fill",children:r},l))}),j?(0,s.jsx)(Le.Heading,{as:"h3",title:j||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:j||""}):null,P?(0,s.jsx)(be.Text,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description text-info-primary line-clamp-1 h-5 text-sm",html:P||""}):null,(0,s.jsx)("div",{className:"mb-2 mt-5 flex flex-wrap items-center",children:z?z(e,{price:o,basePrice:M,discount:B,discountAmount:h,variant:n,coupon:_,isSoldOut:A,isShowOriginalPrice:F}):A?(0,s.jsx)("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:K?.soldOutText}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"final-price tablet:text-xl text-info-primary whitespace-nowrap text-xl font-bold",children:n?.availableForSale&&o||""}),I?I(e,{price:o,basePrice:M,discount:B,discountAmount:h,isShowOriginalPrice:F}):M&&(0,s.jsx)("div",{className:"origin-price tablet:text-xl text-info-quaternary ml-1 whitespace-nowrap text-lg font-bold line-through",children:n?.availableForSale&&M||""})]})}),!z&&ke?.(e,n,{isShowOriginalPrice:F}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!A?(0,s.jsx)(se.default,{disabled:A&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:E,loading:X,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(se.default,{disabled:A&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:L,loading:C,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Le=Object.create;var C=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,Ae=Object.prototype.hasOwnProperty;var Fe=(e,t)=>{for(var a in t)C(e,a,{get:t[a],enumerable:!0})},oe=(e,t,a,N)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Ie(t))!Ae.call(e,d)&&d!==a&&C(e,d,{get:()=>t[d],enumerable:!(N=$e(t,d))||N.enumerable});return e};var A=(e,t,a)=>(a=e!=null?Le(Ee(e)):{},oe(t||!e||!e.__esModule?C(a,"default",{value:e,enumerable:!0}):a,e)),Me=e=>oe(C({},"__esModule",{value:!0}),e);var je={};Fe(je,{ShelfDisplayHorizontalCardItem:()=>Oe});module.exports=Me(je);var o=require("react/jsx-runtime"),le=require("../AiuiProvider/index.js"),ne=require("../ShelfDisplay/shelfDisplay.js"),ae=require("../ShelfDisplay/shelfDisplayItem.js"),ce=A(require("../../components/picture.js")),F=A(require("../../components/badge.js")),x=require("../../helpers/utils.js"),M=require("../../components/text.js"),H=A(require("../../components/button.js")),pe=require("../../shared/track.js"),me=require("../../shared/trackUrlRef.js"),de=require("../../components/heading.js"),fe=require("../../hooks/useExposure.js"),c=require("react");const se="image",re="product_shelf",ie=999999999e-2,He=({items:e})=>e?.length?(0,o.jsx)("div",{className:"shelf-display-horizontal-social-endorsements desktop:gap-2 desktop:top-2 absolute right-0 top-0 flex flex-none flex-col items-center gap-1 self-center",children:e.map((t,a)=>typeof t.icon=="string"?(0,o.jsx)("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},a):(0,o.jsx)(M.Text,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},a))}):null,Oe=({data:e,configuration:t})=>{const{isDisplayBackImage:a=!1,itemShape:N,metafields:d,isTopTag:Ue=!1,isShowTag:ue,isShowOriginalPrice:b,isShowShortTitle:ge=!1,isShowPricesTag:P=!1,pricesTagTextColor:B,pricesTagBgColor:z,itemsTagTextColor:_,itemsTagBgColor:D,formatPrice:O,renderOriginalPrice:j,renderPriceLabel:ye,renderPrice:L}=t||{},{locale:g="es",copyWriting:he,currencyDisplay:U}=(0,le.useAiuiContext)(),{discounts:W,discountsCopy:R}=d||{},q=(0,c.useRef)(null),[V,ve]=(0,c.useState)([]),[G,ke]=(0,c.useState)(""),[J,K]=(0,c.useState)(!1),[Q,X]=(0,c.useState)(!1),xe=(s,r,i,n)=>{const{primaryFun:p,onAddCart:m,onBuyNow:v,onLearnMore:k,event:E}=t||{};if(p){if(p==="AddCart"&&m)return m(s,r+1,i,n);if(p==="BuyNow"&&v)return v(s,r+1,i,n);if(p==="LearnMore"&&k)return k(s,r+1,i,n)}E?.primaryButton?.(s,r+1,i,n)},be=(s,r,i,n)=>{const{secondaryFun:p,onAddCart:m,onBuyNow:v,onLearnMore:k,event:E}=t||{};if(p){if(p==="AddCart"&&m)return m(s,r+1,i,n);if(p==="BuyNow"&&v)return v(s,r+1,i,n);if(p==="LearnMore"&&k)return k(s,r+1,i,n)}E?.secondaryButton?.(s,r+1,i,n)},l=(0,c.useMemo)(()=>{const s=e?.variants||[];if(s.length)return e?.sku?s?.find?.(r=>r?.sku===e?.sku)||s[0]:s?.[0]},[e?.sku,e?.variants]),Y=l?.id?.split?.("/")||[],_e=Y?.[Y?.length-1],y=!l?.availableForSale||l?.price?.amount===ie||l?.price===ie,f=l?.coupons?.[0],Z=e?.price?.currencyCode||"USD",Se=(0,c.useMemo)(()=>(0,ne.formatVariantPrice)({locale:g,amount:f?f?.variant_price4wscode:l?.price,baseAmount:f?l?.price:0,currencyCode:Z,currencyDisplay:U,customFormatPrice:O}),[Z,g,U,f,l,O]),{price:$,basePrice:S,discount:u,discountAmount:h}=Se,{imageUrl:
|
|
1
|
+
"use strict";var Le=Object.create;var C=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,Ae=Object.prototype.hasOwnProperty;var Fe=(e,t)=>{for(var a in t)C(e,a,{get:t[a],enumerable:!0})},oe=(e,t,a,N)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Ie(t))!Ae.call(e,d)&&d!==a&&C(e,d,{get:()=>t[d],enumerable:!(N=$e(t,d))||N.enumerable});return e};var A=(e,t,a)=>(a=e!=null?Le(Ee(e)):{},oe(t||!e||!e.__esModule?C(a,"default",{value:e,enumerable:!0}):a,e)),Me=e=>oe(C({},"__esModule",{value:!0}),e);var je={};Fe(je,{ShelfDisplayHorizontalCardItem:()=>Oe});module.exports=Me(je);var o=require("react/jsx-runtime"),le=require("../AiuiProvider/index.js"),ne=require("../ShelfDisplay/shelfDisplay.js"),ae=require("../ShelfDisplay/shelfDisplayItem.js"),ce=A(require("../../components/picture.js")),F=A(require("../../components/badge.js")),x=require("../../helpers/utils.js"),M=require("../../components/text.js"),H=A(require("../../components/button.js")),pe=require("../../shared/track.js"),me=require("../../shared/trackUrlRef.js"),de=require("../../components/heading.js"),fe=require("../../hooks/useExposure.js"),c=require("react");const se="image",re="product_shelf",ie=999999999e-2,He=({items:e})=>e?.length?(0,o.jsx)("div",{className:"shelf-display-horizontal-social-endorsements desktop:gap-2 desktop:top-2 absolute right-0 top-0 flex flex-none flex-col items-center gap-1 self-center",children:e.map((t,a)=>typeof t.icon=="string"?(0,o.jsx)("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},a):(0,o.jsx)(M.Text,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},a))}):null,Oe=({data:e,configuration:t})=>{const{isDisplayBackImage:a=!1,itemShape:N,metafields:d,isTopTag:Ue=!1,isShowTag:ue,isShowOriginalPrice:b,isShowShortTitle:ge=!1,isShowPricesTag:P=!1,pricesTagTextColor:B,pricesTagBgColor:z,itemsTagTextColor:_,itemsTagBgColor:D,formatPrice:O,renderOriginalPrice:j,renderPriceLabel:ye,renderPrice:L}=t||{},{locale:g="es",copyWriting:he,currencyDisplay:U}=(0,le.useAiuiContext)(),{discounts:W,discountsCopy:R}=d||{},q=(0,c.useRef)(null),[V,ve]=(0,c.useState)([]),[G,ke]=(0,c.useState)(""),[J,K]=(0,c.useState)(!1),[Q,X]=(0,c.useState)(!1),xe=(s,r,i,n)=>{const{primaryFun:p,onAddCart:m,onBuyNow:v,onLearnMore:k,event:E}=t||{};if(p){if(p==="AddCart"&&m)return m(s,r+1,i,n);if(p==="BuyNow"&&v)return v(s,r+1,i,n);if(p==="LearnMore"&&k)return k(s,r+1,i,n)}E?.primaryButton?.(s,r+1,i,n)},be=(s,r,i,n)=>{const{secondaryFun:p,onAddCart:m,onBuyNow:v,onLearnMore:k,event:E}=t||{};if(p){if(p==="AddCart"&&m)return m(s,r+1,i,n);if(p==="BuyNow"&&v)return v(s,r+1,i,n);if(p==="LearnMore"&&k)return k(s,r+1,i,n)}E?.secondaryButton?.(s,r+1,i,n)},l=(0,c.useMemo)(()=>{const s=e?.variants||[];if(s.length)return e?.sku?s?.find?.(r=>r?.sku===e?.sku)||s[0]:s?.[0]},[e?.sku,e?.variants]),Y=l?.id?.split?.("/")||[],_e=Y?.[Y?.length-1],y=!l?.availableForSale||l?.price?.amount===ie||l?.price===ie,f=l?.coupons?.[0],Z=e?.price?.currencyCode||"USD",Se=(0,c.useMemo)(()=>(0,ne.formatVariantPrice)({locale:g,amount:f?f?.variant_price4wscode:l?.price,baseAmount:f?l?.price:0,currencyCode:Z,currencyDisplay:U,customFormatPrice:O}),[Z,g,U,f,l,O]),{price:$,basePrice:S,discount:u,discountAmount:h}=Se,{imageUrl:we,altText:Te}=(0,ae.getProductImage)(e),w=e?.custom_name||e?.title,I=ge&&l?.metafields?.infos?.page_short_title||w,ee=e?.custom_description||e?.description,Ce=()=>{if(f?.value_type==="fixed_amount"){const s=h||"",r=s.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(r){const[,i,n,p]=r;let m=n;return n.endsWith(".00")?m=n.replace(/\.00$/,""):n.endsWith(",00")&&(m=n.replace(/,00$/,"")),`${i}${m}${p}`}return s}return u||""};(0,c.useEffect)(()=>{let s=[];if(u||h){const i=`${Ce()} ${W?.off||R?.off||""}`;ke(i)}const r=e?.tags?.filter?.(i=>i?.startsWith?.("CLtag"))?.map?.(i=>i?.replace?.("CLtag:",""))?.slice?.(0,u&&P?1:2)||[];ve(s.concat(r))},[e?.tags,u,h,W?.off,R?.off,P]),(0,fe.useExposure)(q,{componentType:se,componentName:re,componentTitle:w,componentDescription:ee,position:t?.index+1});const Ne=async()=>{if(!J&&!e?.custom_primary_link){K(!0);try{await xe(e,t?.index,t,f)}finally{K(!1)}}},Pe=async()=>{if(!Q&&!e?.custom_secondary_link){X(!0);try{await be(e,t?.index,t,f)}finally{X(!1)}}},Be={...B?{color:B}:{},...z?{backgroundColor:z,backgroundImage:"none"}:{},...B||z?{outline:"none"}:{}},ze={..._?{color:_}:{},...D?{backgroundColor:D,backgroundImage:"none"}:{},..._||D?{outlineColor:_}:{}},De=()=>(0,o.jsxs)("div",{className:"lg-desktop:h-[28px] absolute left-0 top-0 z-10 box-border flex h-6 flex-wrap gap-1 overflow-hidden",children:[P&&G&&(0,o.jsx)(F.default,{className:"shelf-prices-tag",variant:"fill",style:Be,children:G||""}),ue&&V?.length>0&&V?.map?.((s,r)=>(0,o.jsx)(F.default,{className:"shelf-items-tag",variant:"outline",style:ze,children:s},r))]}),T=e?.custom_bg_image,te=e?.custom_theme;return(0,o.jsx)("div",{ref:q,className:(0,x.cn)("box-border w-full cursor-pointer overflow-hidden duration-300","rounded-box","shelf-display-horizontal-item","lg-desktop:aspect-[824/269] desktop:aspect-[648/238] laptop:aspect-[440/256] relative",T?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":te==="dark","aiui-light":te==="light"}),style:T?{backgroundImage:`url(${T})`}:void 0,children:(0,o.jsxs)("div",{className:"desktop:p-6 desktop:pt-4 absolute inset-0 box-border flex overflow-hidden p-4",children:[(0,o.jsxs)("div",{className:"shelf-display-horizontal-left laptop:flex-[196] desktop:flex-[292] lg-desktop:flex-[380] relative flex h-full flex-none flex-col items-center justify-center gap-2",children:[(0,o.jsx)(De,{}),(0,o.jsx)("div",{className:(0,x.cn)("shelf-display-horizontal-item-image desktop:h-[92.3%] lg-desktop:h-[89.5%] relative inline-block aspect-[1] h-[63.6%] min-h-0 overflow-hidden",{"opacity-0":T}),children:(0,o.jsx)("a",{"aria-label":w,target:t?.target,href:(0,me.trackUrlRef)(`${g==="us"||!g?"":`/${g}`}/products/${e?.handle}?variant=${_e}`,`${se}_${re}`),onClick:()=>{(0,pe.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||l?.sku,item_name:e?.name,item_variant:l?.name,price:l?.price,index:t?.index+1}]}})},children:(0,o.jsx)(ce.default,{source:we,alt:Te,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),(0,o.jsx)(He,{items:e?.socialEndorsements||d?.socialEndorsements})]}),(0,o.jsxs)("div",{className:"shelf-display-horizontal-content desktop:flex-[332] desktop:pl-6 desktop:pt-2 lg-desktop:flex-[420] desktop:gap-6 flex min-w-0 flex-[224] flex-col justify-between gap-4 pl-4",children:[(0,o.jsxs)("div",{className:"shelf-display-horizontal-content-title-desc",children:[I?(0,o.jsx)(de.Heading,{as:"h3",title:I||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:I||""}):null,(0,o.jsx)(M.Text,{size:2,className:(0,x.cn)("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:ee||""})]}),(0,o.jsxs)("div",{className:"shelf-display-horizontal-content-price-button",children:[(0,o.jsx)("div",{className:"mb-2 flex flex-wrap items-center",children:L?L(e,{price:$,basePrice:S,discount:u,discountAmount:h,variant:l,coupon:f,isSoldOut:y,isShowOriginalPrice:b}):y?(0,o.jsx)("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:he?.soldOutText}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"final-price lg-desktop:text-2xl text-info-primary whitespace-nowrap text-xl font-bold !leading-[1.2]",children:l?.availableForSale&&$||""}),j?j(e,{price:$,basePrice:S,discount:u,discountAmount:h,isShowOriginalPrice:b}):S&&b&&(0,o.jsx)("div",{className:"origin-price lg-desktop:text-2xl text-info-quaternary ml-1 whitespace-nowrap text-xl font-bold !leading-[1.2] line-through",children:l?.availableForSale&&S||""})]})}),!L&&ye?.(e,l,{isShowOriginalPrice:b}),(0,o.jsxs)("div",{className:(0,x.cn)("shelf-flex-button-group","lg-desktop:gap-3 desktop:flex-row flex flex-col items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!y?(0,o.jsx)(H.default,{disabled:y&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:Pe,loading:Q,className:"laptop:w-full desktop:w-auto",children:t?.secondaryButton||""}):null,t?.primaryButton?(0,o.jsx)(H.default,{disabled:y&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:Ne,loading:J,className:"laptop:w-full desktop:w-auto",children:t?.primaryButton||""}):null]})]})]})]})},e?.id||e?.handle)};
|
|
@@ -5,6 +5,7 @@ export type DropDownProps = {
|
|
|
5
5
|
setActive: any;
|
|
6
6
|
setVisible: any;
|
|
7
7
|
visible: any;
|
|
8
|
+
resolveName?: (item: any, sku?: string) => string;
|
|
8
9
|
};
|
|
9
|
-
declare const DropDown: ({ index, active, list, setActive, setVisible, visible }: DropDownProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const DropDown: ({ index, active, list, setActive, setVisible, visible, resolveName }: DropDownProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export default DropDown;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
${
|
|
1
|
+
"use strict";var p=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var h=(e,n)=>{for(var r in n)p(e,r,{get:n[r],enumerable:!0})},k=(e,n,r,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of v(n))!D.call(e,t)&&t!==r&&p(e,t,{get:()=>n[t],enumerable:!(l=m(n,t))||l.enumerable});return e};var w=e=>k(p({},"__esModule",{value:!0}),e);var E={};h(E,{default:()=>g});module.exports=w(E);var c=require("react/jsx-runtime"),i=require("react");const x="openDropDown",y=({index:e,active:n,list:r,setActive:l,setVisible:t,visible:u,resolveName:f})=>{const b=(0,i.useRef)(null);return(0,i.useEffect)(()=>{const o=s=>{const a=s?.target?.getAttribute?.("class");!b?.current?.contains(s?.target)&&!a?.includes(x)&&t({...u,[e]:!1})};return document.addEventListener("click",o),()=>document.removeEventListener("click",o)},[]),(0,c.jsx)("div",{ref:b,className:`absolute left-0 top-[104%] z-30 box-border max-h-[340px] w-full overflow-auto rounded-lg bg-white ${u?.[e]?"block":"hidden"}`,children:(0,c.jsx)("div",{className:"dropdown-wrapper m-0 box-border h-full flex-1 overflow-hidden p-0 [&:last-child]:border-r-0",children:r?.map((o,s)=>{const a=o?.sku||o?.variants?.[0]?.sku,d=f?f(o,a):o?.name||o?.title;return(0,c.jsx)("div",{onClick:()=>{l({...n,[e]:{sku:a,name:d,handle:o?.handle}}),t({...u,[e]:!1})},title:d,className:`openDropDown min-xl:text-lg min-xxl:text-lg box-border cursor-pointer truncate px-6 py-4 text-base font-bold [&:hover]:bg-[#EAEAEC]
|
|
2
|
+
${o?.handle===n?.handle?"bg-[#EAEAEC]":""}`,children:d},s)})})})};var g=y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var ne=Object.create;var y=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var ce=(o,a)=>{for(var d in a)y(o,d,{get:a[d],enumerable:!0})},P=(o,a,d,w)=>{if(a&&typeof a=="object"||typeof a=="function")for(let f of ae(a))!le.call(o,f)&&f!==d&&y(o,f,{get:()=>a[f],enumerable:!(w=oe(a,f))||w.enumerable});return o};var R=(o,a,d)=>(d=o!=null?ne(re(o)):{},P(a||!o||!o.__esModule?y(d,"default",{value:o,enumerable:!0}):d,o)),ie=o=>P(y({},"__esModule",{value:!0}),o);var de={};ce(de,{default:()=>pe});module.exports=ie(de);var t=require("react/jsx-runtime"),I=R(require("./dropdown.js")),$=require("../AiuiProvider/index.js"),O=require("react-responsive"),l=require("react"),U=require("../../shared/Styles.js"),V=require("../ShelfDisplay/shelfDisplay.js"),i=require("../../components/index.js"),B=require("../../helpers/index.js"),b=R(require("react"));const _=b.default.forwardRef(({data:o,buildData:a,onChange:d,onSecondaryChange:w,className:f,...z},q)=>{const g=(0,O.useMediaQuery)({query:"(max-width: 768px)"}),[u,k]=(0,l.useState)({}),[N,Q]=(0,l.useState)([]),[A,E]=(0,l.useState)(!1),[C,T]=(0,l.useState)({}),j=(0,b.useRef)(null),{locale:W="us",currencyDisplay:G,trackingData:J,currencyCode:K}=(0,$.useAiuiContext)(),X=J?.showComparePrice??!0,{LeftMenu:H,RightMenu:M,DefaultSelectMenu:v}=(0,l.useMemo)(()=>o?.data||{},[o?.data]),S=(0,l.useMemo)(()=>{const e={};return(Array.isArray(o?.items)?o?.items:[]).forEach(s=>{s?.custom_name&&(s?.sku&&(e[s.sku]=s.custom_name),s?.handle&&(e[s.handle]=s.custom_name))}),e},[o?.items]),L=(0,l.useCallback)((e,n)=>S[n||""]||S[e?.handle||""]||e?.name||e?.title||"",[S]),Y=e=>{try{const s=new URL(e).pathname.toLowerCase();return/\.(jpeg|jpg|gif|png|webp|bmp|svg|tiff)$/.test(s)}catch{return/\.(jpeg|jpg|gif|png|webp|bmp|svg|tiff)$/i.test(e)}},Z=(e,n)=>{const s=e?.variants?.find?.(m=>m?.sku===e?.sku),r=s?.coupons?.[0],{price:c,basePrice:p}=(0,V.formatVariantPrice)({locale:K==="CAD"?"us":W||"us",amount:r?r?.variant_price4wscode:s?.price,baseAmount:r?s?.price:0,currencyDisplay:G,currencyCode:e?.price?.currencyCode||"USD"}),x=typeof v?.buttonText=="string"?v?.buttonText:v?.buttonText?.[String(n)]||"";return(0,t.jsxs)("div",{className:"specs-sku-node-wrap box-border",children:[(0,t.jsxs)(i.Text,{as:"div",className:"md-tablet:p-2 l-tablet:mb-4 l-tablet:text-sm desktop:px-6 lg-desktop:mb-8 lg-desktop:text-lg openDropDown specs-sku-node-text relative mb-6 box-border block rounded-[50px] border border-[#E4E5E6] bg-[#F5F5F7] px-6 py-4 text-base font-bold",onClick:()=>{if(N?.length<=1)return null;T({...C,[n]:!C?.[n]})},children:[(0,t.jsxs)("div",{className:"flex items-center justify-between overflow-hidden",children:[(0,t.jsx)("div",{className:"openDropDown md-tablet:text-sm lg-desktop:text-lg specs-sku-node-title flex-1 truncate text-base",title:u?.[n]?.name||"",children:u?.[n]?.name||""}),N?.length>1?(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",className:"openDropDown",children:(0,t.jsx)("path",{d:"M6 9.5L12 15.5L18 9.5",stroke:"#1D1D1F",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),(0,t.jsx)(I.default,{index:n,list:N,active:u,setActive:k,visible:C,setVisible:T,resolveName:L})]}),(0,t.jsx)("div",{className:"lg-desktop:max-h-[196px] lg-desktop:max-w-[196px] max-h-[138px] max-w-[138px]",children:(0,t.jsx)(i.Picture,{source:s?.image?.url||"",className:"aspect-h-[280] aspect-w-[280]",imgClassName:"w-full h-full object-cover hover:scale-105 transition-all duration-300"})}),(0,t.jsx)("div",{className:"lg-desktop:text-2xl mb-2 mt-6 text-xl font-bold",children:(0,t.jsx)("div",{className:"lg-desktop:min-h-[32px] flex min-h-[28px] flex-wrap items-center gap-1",children:s?.availableForSale?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"specs-sku-node-price whitespace-nowrap text-[#080A0F]",children:c||""}),X&&p&&(0,t.jsx)("div",{className:"lg-desktop:text-2xl specs-sku-node-base-price whitespace-nowrap text-xl text-[#86868C] line-through",children:p})]}):null})}),x?(0,t.jsx)(i.Button,{onClick:()=>{d?.(e,n)},className:"specs-sku-node-button",children:x}):null]})},ee=e=>e&&typeof e!="string"?(0,t.jsxs)("div",{className:"size-full",children:[(0,t.jsx)("p",{className:"min-xxl:text-lg specs-normal-node-text text-base font-bold text-[#080A0F] md:text-sm",dangerouslySetInnerHTML:{__html:e?.text||""}}),(0,t.jsx)(i.Picture,{source:e?.imgUrl,className:"l:max-h-[174px] l:max-w-[174px] m-auto max-h-[360px] max-w-[360px]",imgClassName:"w-full h-full object-cover"})]}):(0,t.jsx)("div",{className:"break-all",children:Y(e)?(0,t.jsx)(i.Picture,{source:e,className:"l:max-h-[174px] l:max-w-[174px] m-auto max-h-[360px] max-w-[360px]",imgClassName:"w-full h-full object-cover"}):(0,t.jsx)("p",{className:"min-xxl:text-lg specs-normal-node-text text-base font-bold text-[#080A0F] md:text-sm",dangerouslySetInnerHTML:{__html:e||""}})}),F=e=>e.map((n,s)=>{const r=s===0;return(0,t.jsxs)("div",{className:"l-tablet:flex l-tablet:flex-col box-border grid w-full cursor-pointer grid-cols-3 overflow-hidden border-t border-t-[#E4E5E6] specs-product-node-wrap",children:[(0,t.jsx)(i.Heading,{as:"h3",html:n||"",className:"tablet:py-6 l-tablet:text-[#86868C] desktop:p-6 lg-desktop:text-lg specs-product-node-title mr-4 flex-1 pt-4 text-base font-bold md:text-sm"}),(0,t.jsx)("div",{className:`l-tablet:w-full l-tablet:gap-4 laptop:gap-8 desktop:gap-12 desktop:p-6 lg-desktop:gap-16 grid-cols-${A?3:2} specs-product-node-body col-span-2 grid flex-1 py-6`,children:Object.keys(u)?.map?.(c=>{const p=u?.[c],x=M?.menus?.find?.(m=>m?.handle===p?.handle)?.subTitle;return ee(x?.[n])})})]},n)}),te=e=>{if(!u)return;const{subTitle:n,isProduct:s}=e;return s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"l-tablet:flex l-tablet:flex-col specs-content-item-product box-border grid w-full cursor-pointer grid-cols-3 border-t-0 border-t-[#E4E5E6]",children:[e?.title&&(0,t.jsx)(i.Heading,{as:"h3",html:e?.title||"",className:"lg-desktop:text-lg desktop:px-6 specs-product-node-title l:hidden specs-item-product-title py-4 text-base font-bold md:text-sm"}),(0,t.jsx)("div",{className:`l-tablet:w-full l-tablet:gap-4 laptop:gap-8 desktop:gap-12 desktop:px-6 desktop:pb-6 lg-desktop:gap-16 grid-cols-${A?3:2} specs-item-product-body col-span-2 grid flex-1 pb-4 pr-0`,children:Object.keys(u)?.map((r,c)=>{const p=u?.[r],x=a?.products?.find?.(m=>m?.handle===p?.handle);return(0,t.jsx)("div",{children:Z({...x,item:r,sku:p?.sku},c)},r)})})]}),e?.categoryLabel&&(0,t.jsx)(i.Heading,{size:2,as:"h4",html:e?.categoryLabel||"",className:"desktop:p-6 specs-item-product-category py-6"}),n?.length?F(n):null]}):F(n)};return(0,b.useImperativeHandle)(q,()=>j.current),(0,l.useEffect)(()=>{if(!a?.products?.length)return;const e=v?.sku?.split?.(",")||[],n=g&&e?.length>2?e?.slice(0,2):e;let s={};n?.forEach?.((c,p)=>{const m=M?.menus?.find?.(h=>h?.sku===c)?.handle,D=m?a?.products?.find?.(h=>h?.handle===m):a?.products?.find?.(h=>{if(h?.variants?.find?.(se=>se?.sku===c))return!0});D&&(s={...s,[p]:{sku:c,name:L(D,c),handle:D?.handle}})});const r=a?.products?.filter(c=>M?.menus?.find(p=>p?.handle===c?.handle));k(s),Q(r),E(e?.length>2&&!g)},[a,g,L]),(0,l.useEffect)(()=>{if(g){const e=Object.keys(u||{});if(e?.length>2){const n=e?.slice?.(0,2);let s={};n?.forEach?.(r=>{s={...s,[r]:u?.[r]}}),E(!1),k(s)}}},[g]),(0,t.jsx)("div",{...z,className:(0,B.cn)("specs-wrapper w-full overflow-hidden",f),ref:j,children:H?.data?(0,t.jsx)("div",{className:"specs-wrapper-content box-border w-full overflow-hidden",children:H?.data?.map?.((e,n)=>(0,t.jsx)("div",{className:"specs-wrapper-content-item w-full overflow-hidden pt-10 [&:first-child]:pt-0",children:te(e)},n))}):null})});_.displayName="Specs";var pe=(0,U.withLayout)(_);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var h=Object.create;var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var x=(e,n)=>{for(var o in n)i(e,o,{get:n[o],enumerable:!0})},m=(e,n,o,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of u(n))!I.call(e,l)&&l!==o&&i(e,l,{get:()=>n[l],enumerable:!(a=p(n,l))||a.enumerable});return e};var k=(e,n,o)=>(o=e!=null?h(b(e)):{},m(n||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),N=e=>m(i({},"__esModule",{value:!0}),e);var y={};x(y,{default:()=>B});module.exports=N(y);var r=require("react/jsx-runtime"),d=require("react"),s=require("../helpers/utils.js"),f=require("./container.js"),c=k(require("./link.js")),t=require("./text.js"),g=require("../biz-components/AiuiProvider/index.js");const v=({data:e,sizeClass:n})=>{const{navCollapsed:o}=(0,g.useAiuiContext)();return(0,r.jsx)("div",{className:"aiui-dark relative z-[46] box-border h-[30px]",children:(0,r.jsxs)(f.Container,{childClassName:"flex !bg-container-primary items-center justify-between",className:"h-full",children:[(0,r.jsx)("div",{className:(0,s.cn)("h-full items-center gap-3",o===void 0?"desktop:flex hidden":o?"hidden":"flex"),children:e?.leftIcon?.map?.((a,l)=>(0,r.jsxs)(d.Fragment,{children:[l>0&&(0,r.jsx)("span",{className:"bg-lines h-3 w-px","aria-hidden":"true"}),a?.link?(0,r.jsx)(c.default,{href:a?.link,variant:"secondary","aria-label":a?.label||a?.title,className:(0,s.cn)("text-sm leading-[1.4] no-underline",n),children:(0,r.jsx)(t.Text,{className:"board-left-icon","aria-hidden":"true",html:a?.logo||""})}):(0,r.jsx)(t.Text,{className:"board-left-icon",html:a?.logo||""})]},l))}),(0,r.jsx)("div",{className:"flex h-full flex-1 items-center justify-end gap-2",children:e?.rightIcon?.map?.((a,l)=>(0,r.jsx)(d.Fragment,{children:a?.link?(0,r.jsx)(c.default,{href:a?.link,variant:"secondary","aria-label":a?.label||a?.title,className:(0,s.cn)("flex items-center text-sm leading-[1.4] no-underline",n),children:(0,r.jsx)(t.Text,{className:"board-right-icon","aria-hidden":"true",html:a?.logo||""})}):(0,r.jsx)(t.Text,{className:"board-right-icon",html:a?.logo||""})},l))})]})})};var B=v;
|
|
1
|
+
"use strict";"use client";var h=Object.create;var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var x=(e,n)=>{for(var o in n)i(e,o,{get:n[o],enumerable:!0})},m=(e,n,o,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of u(n))!I.call(e,l)&&l!==o&&i(e,l,{get:()=>n[l],enumerable:!(a=p(n,l))||a.enumerable});return e};var k=(e,n,o)=>(o=e!=null?h(b(e)):{},m(n||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),N=e=>m(i({},"__esModule",{value:!0}),e);var y={};x(y,{default:()=>B});module.exports=N(y);var r=require("react/jsx-runtime"),d=require("react"),s=require("../helpers/utils.js"),f=require("./container.js"),c=k(require("./link.js")),t=require("./text.js"),g=require("../biz-components/AiuiProvider/index.js");const v=({data:e,sizeClass:n})=>{const{navCollapsed:o}=(0,g.useAiuiContext)();return(0,r.jsx)("div",{className:"aiui-dark relative z-[46] box-border h-[30px]",children:(0,r.jsxs)(f.Container,{childClassName:"flex !bg-container-primary items-center justify-between",className:"h-full",children:[(0,r.jsx)("div",{className:(0,s.cn)("h-full items-center gap-3",o===void 0?"desktop:flex hidden":o?"hidden":"flex"),children:e?.leftIcon?.map?.((a,l)=>(0,r.jsxs)(d.Fragment,{children:[l>0&&(0,r.jsx)("span",{className:"bg-lines h-3 w-px","aria-hidden":"true"}),a?.link?(0,r.jsx)(c.default,{href:a?.link,variant:"secondary","aria-label":a?.label||a?.title,className:(0,s.cn)("text-sm leading-[1.4] no-underline",n),children:(0,r.jsx)(t.Text,{className:"board-left-icon","aria-hidden":"true",html:a?.logo||""})}):(0,r.jsx)(t.Text,{className:"board-left-icon",html:a?.logo||""})]},l))}),(0,r.jsx)("div",{className:"flex h-full flex-1 items-center justify-end gap-2",children:e?.rightIcon?.map?.((a,l)=>(0,r.jsx)(d.Fragment,{children:a?.link?(0,r.jsx)(c.default,{href:a?.link,variant:"secondary","aria-label":a?.label||a?.title,className:(0,s.cn)("flex items-center text-sm leading-[1.4] no-underline",n),children:(0,r.jsx)(t.Text,{className:"board-right-icon","aria-hidden":"true",html:a?.logo||""})}):(0,r.jsx)(t.Text,{className:"board-right-icon",html:a?.logo||""})},l))})]})})};var B=v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as f}from"react/jsx-runtime";import{gaTrack as A}from"../../shared/track.js";import{createContext as E,useContext as D,useEffect as c,useMemo as T,useRef as v,useState as _}from"react";import{extendLocaleMap as M}from"../../helpers/index.js";const b=E({trackingData:{},locale:void 0,copyWriting:{}}),S=()=>{const o=D(b);if(!o)throw new Error("useAiui must be used in <AiuiProvider>");return o},P=({children:o,...t})=>{const p=v(null),l=v(t?.trackingData),[u,h]=_(!1);c(()=>{t.localeMap&&Object.keys(t.localeMap).length>0&&M(t.localeMap)},[t.localeMap]),c(()=>{l.current=t?.trackingData},[t?.trackingData]),c(()=>{const r=p.current;if(!r)return;const d=(e,a)=>{const n={};if(!a||!a.attributes)return n;for(const C of Array.from(a.attributes)){const s=C?.name;s?.startsWith("data-headless-")&&(n[s]=a.getAttribute(s))}const x=n?.["data-headless-sku"],g=n?.["data-headless-type-name"]?.split?.("#"),i=n?.["data-headless-title-desc-button"]?.split?.("#"),y=n?.["data-headless-nav-position"]?.split?.("#");A({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:l.current?.pageGroup||"Home Page",component_type:g?.[0]||"",component_name:g?.[1]||"",position:y?.[1]||"",navigation:y?.[0]||"",button_name:i?.[2]||"",SKU:x||"",component_title:i?.[0]||"",component_description:i?.[1]||""}})},m=new MutationObserver(()=>{r.querySelectorAll("[data-headless-type-name]").forEach(e=>{e.hasAttribute("data-headless-track-bound")||(e.addEventListener("click",a=>d(a,e)),e.setAttribute("data-headless-track-bound","true"))})});return m.observe(r,{childList:!0,subtree:!0}),r.querySelectorAll("[data-headless-type-name]").forEach(e=>{e.hasAttribute("data-headless-track-bound")||(e.addEventListener("click",a=>d(a,e)),e.setAttribute("data-headless-track-bound","true"))}),()=>m.disconnect()},[]);const k=T(()=>({...t,navCollapsed:u,setNavCollapsed:h}),[t,u]);return f(b.Provider,{value:k,children:f("div",{ref:p,children:o})})};var w=P;export{b as AiuiContext,w as default,S as useAiuiContext};
|
|
1
|
+
"use client";import{jsx as f}from"react/jsx-runtime";import{gaTrack as A}from"../../shared/track.js";import{createContext as E,useContext as D,useEffect as c,useMemo as T,useRef as v,useState as _}from"react";import{extendLocaleMap as M}from"../../helpers/index.js";const b=E({trackingData:{},locale:void 0,copyWriting:{}}),S=()=>{const o=D(b);if(!o)throw new Error("useAiui must be used in <AiuiProvider>");return o},P=({children:o,...t})=>{const p=v(null),l=v(t?.trackingData),[u,h]=_(!1);c(()=>{t.localeMap&&Object.keys(t.localeMap).length>0&&M(t.localeMap)},[t.localeMap]),c(()=>{l.current=t?.trackingData},[t?.trackingData]),c(()=>{const r=p.current;if(!r)return;const d=(e,a)=>{const n={};if(!a||!a.attributes)return n;for(const C of Array.from(a.attributes)){const s=C?.name;s?.startsWith("data-headless-")&&(n[s]=a.getAttribute(s))}const x=n?.["data-headless-sku"],g=n?.["data-headless-type-name"]?.split?.("#"),i=n?.["data-headless-title-desc-button"]?.split?.("#"),y=n?.["data-headless-nav-position"]?.split?.("#");A({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:l.current?.pageGroup||"Home Page",component_type:g?.[0]||"",component_name:g?.[1]||"",position:y?.[1]||"",navigation:y?.[0]||"",button_name:i?.[2]||"",SKU:x||"",component_title:i?.[0]||"",component_description:i?.[1]||""}})},m=new MutationObserver(()=>{r.querySelectorAll("[data-headless-type-name]").forEach(e=>{e.hasAttribute("data-headless-track-bound")||(e.addEventListener("click",a=>d(a,e)),e.setAttribute("data-headless-track-bound","true"))})});return m.observe(r,{childList:!0,subtree:!0}),r.querySelectorAll("[data-headless-type-name]").forEach(e=>{e.hasAttribute("data-headless-track-bound")||(e.addEventListener("click",a=>d(a,e)),e.setAttribute("data-headless-track-bound","true"))}),()=>m.disconnect()},[]);const k=T(()=>({...t,navCollapsed:u,setNavCollapsed:h}),[t,u]);return f(b.Provider,{value:k,children:f("div",{ref:p,children:o})})};var w=P;export{b as AiuiContext,w as default,S as useAiuiContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as W,jsx as a,jsxs as i}from"react/jsx-runtime";import*as r from"react";import{cn as o}from"../../helpers/index.js";import{Button as
|
|
1
|
+
"use client";import{Fragment as W,jsx as a,jsxs as i}from"react/jsx-runtime";import*as r from"react";import{cn as o}from"../../helpers/index.js";import{Button as w,Badge as Z,Card as J,CardContent as K,Picture as Q,Text as u,Heading as c}from"../../components/index.js";import{useCreditsShelfContext as U}from"./context.js";const V=()=>a("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a("path",{d:"M8 1L10.163 5.279L15 6.001L11.5 9.409L12.326 14.226L8 11.97L3.674 14.226L4.5 9.409L1 6.001L5.837 5.279L8 1Z",fill:"currentColor"})}),g=r.forwardRef(({product:e,className:v,showTags:b,onLearnMore:N,onShopNow:k,onAddToCart:P,classNames:T,secondaryButtonText:B,secondaryButtonFun:L,primaryButtonText:S,primaryButtonFun:F,showOriginalPrice:z,copy:M,onProductImageClick:D},A)=>{const t=U(),O=b??t?.showTags??!0,$=z??t?.showOriginalPrice??!0,d=M??t?.copy,n=T??t?.classNames,m=B??t?.secondaryButtonText,f=L??t?.secondaryButtonFun,p=S??t?.primaryButtonText,y=F??t?.primaryButtonFun,j=N??t?.onLearnMore,H=k??t?.onShopNow,I=P??t?.onAddToCart,x=D??t?.onProductImageClick,[R,_]=r.useState(!1),[q,E]=r.useState(!1),h=async(s,l)=>{if(!s)return;const C=l==="primary"?_:E;C(!0);try{switch(s){case"buyNow":await H?.(e);break;case"addCart":await I?.(e);break;case"learnMore":await j?.(e);break;default:break}}finally{C(!1)}},G=r.useMemo(()=>e.creditSavingAmount?(d?.creditsSavingLabel??"Save up to {amount} with Credits").replace("{amount}",e.creditSavingAmount):null,[e.creditSavingAmount,d?.creditsSavingLabel]);return i(J,{ref:A,className:o("bg-container-primary hover:bg-container-secondary-0 box-border flex h-full flex-col overflow-hidden border-none",v,n?.productCard),children:[i(K,{className:"lg-desktop:gap-[10px] lg-desktop:px-6 lg-desktop:py-4 relative flex flex-1 flex-col gap-2 p-4",children:[a("div",{className:"lg-desktop:h-[28px] flex h-[24px] gap-1",children:O&&e.tags?.map((s,l)=>s.label?a(Z,{size:"sm",variant:s.variant||"outline",className:o(s.variant==="promotional"?"ml-2":""),promotionalType:s.promotionalType,children:s.label},l):a(r.Fragment,{children:s},l))}),a("div",{className:"product-image-wrapper lg-desktop:size-[196px] mx-auto size-[138px] cursor-pointer overflow-hidden",children:a("a",{onClick:()=>x?.(e),...!x&&{href:e?.listingLink},rel:"noreferrer",children:a(Q,{source:e.image,alt:e.name,className:"aspect-square size-full object-contain",imgClassName:"w-full h-full object-contain"})})}),i("div",{className:"lg-desktop:gap-6 flex flex-1 grow flex-col justify-between gap-4",children:[i("div",{className:"lg-desktop:gap-1 flex flex-col gap-0.5",children:[a(c,{as:"h3",size:2,className:o("text-info-primary line-clamp-2 min-h-[2.4em]",n?.productTitle),html:e.custom_name||e.name}),e?.description&&a(u,{size:2,className:o("text-info-secondary desktop:line-clamp-2 desktop:min-h-[2.4em] line-clamp-2 min-h-[2.4em]",n?.productDescription),html:e.custom_description||e.description})]}),i("div",{className:"lg-desktop:gap-2 flex flex-col gap-1.5",children:[a("div",{className:o(n?.productPrice),children:a("div",{className:"flex flex-wrap items-baseline gap-1",children:e.availableForSale?i(W,{children:[a(c,{size:2,className:"text-info-primary whitespace-nowrap",as:"h6",children:e.price}),$&&e.originalPrice&&a(c,{size:2,className:o("text-info-tertiary whitespace-nowrap line-through",n?.originalPrice),as:"h6",children:e.originalPrice})]}):a(c,{size:2,className:"text-info-tertiary",children:d?.outOfStockLabel??"Sold Out"})})}),e?.priceLabel&&a(u,{size:4,className:o("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] text-[14px]",n?.productPriceLabel),children:e.priceLabel}),i("div",{className:o("lg-desktop:gap-3 tablet:flex-nowrap flex flex-wrap gap-2",n?.buttonGroup),children:[m&&a(w,{variant:"secondary",size:"base",className:o("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",n?.secondaryButton),onClick:()=>h(f,"secondary"),disabled:!e.availableForSale&&f!=="learnMore",loading:q,"data-headless-type-name":"CreditsShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${m}`,"data-headless-sku":e.sku,children:m}),p&&a(w,{variant:"primary",size:"base",className:o("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",n?.primaryButton),onClick:()=>h(y,"primary"),disabled:!e.availableForSale&&y!=="learnMore",loading:R,"data-headless-type-name":"CreditsShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${p}`,"data-headless-sku":e.sku,children:p})]})]})]})]}),i("div",{className:o("bg-container-secondary-0 lg-desktop:px-6 lg-desktop:py-4 flex items-center justify-center gap-1 px-4 py-3",n?.creditTip),children:[a("div",{className:"bg-info-primary flex size-6 items-center justify-center rounded-full p-1",children:a("span",{className:"text-info-white",children:a(V,{})})}),a(u,{size:2,className:"text-info-primary",children:G})]})]})});g.displayName="CreditsShelf.ProductCard";var ae=g;export{g as CreditsProductCard,ae as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o,jsxs as a}from"react/jsx-runtime";import{useState as F,useEffect as b,useCallback as G,forwardRef as V,useImperativeHandle as _,useRef as v}from"react";import{cn as E}from"../../helpers/utils.js";import{withLayout as $}from"../../shared/Styles.js";import{Button as
|
|
1
|
+
"use client";import{jsx as o,jsxs as a}from"react/jsx-runtime";import{useState as F,useEffect as b,useCallback as G,forwardRef as V,useImperativeHandle as _,useRef as v}from"react";import{cn as E}from"../../helpers/utils.js";import{withLayout as $}from"../../shared/Styles.js";import{Button as C,Link as q,Text as P}from"../../components/index.js";import{useExposure as O}from"../../hooks/useExposure.js";import*as S from"@radix-ui/react-popover";const W="navigation",J="product_nav",y=c=>c.anchorId??c.id??"",K=c=>o("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c,children:o("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})}),M=V(({className:c="",data:D,id:H,onAnchorClick:R,scrollOffsetExtra:T=0},I)=>{const{tabLinks:h=[],anchorList:s=[],textLink:l,buyBtn:p,theme:B="light"}=D||{},[z,x]=F(""),u=v(null),g=v(!1),m=v(""),f=v(null),N=v(new Map);_(I,()=>u.current),O(u,{componentType:W,componentName:J});const w=G(()=>{if(s.length===0)return;const e=window.scrollY;window.scrollTo({top:0,behavior:"instant"}),requestAnimationFrame(()=>{const t=new Map;s.forEach(r=>{const n=y(r),i=document.getElementById(n);if(i){const k=i.getBoundingClientRect();t.set(n,k.top+window.scrollY)}}),N.current=t,window.scrollTo({top:e,behavior:"instant"})})},[s]);b(()=>{if(s.length===0)return;const e=setTimeout(w,100);return()=>clearTimeout(e)},[s,w]),b(()=>{if(s.length===0)return;let e=null;const t=new ResizeObserver(()=>{e&&clearTimeout(e),e=setTimeout(w,150)});return t.observe(document.body),()=>{t.disconnect(),e&&clearTimeout(e)}},[s,w]),b(()=>{if(s.length===0)return;const e=()=>{if(g.current){f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{g.current=!1,m.current&&(x(m.current),m.current="")},100);return}const r=u.current?.offsetHeight||0,n=window.scrollY+r+T+10;let i="";const k=N.current;for(let d=s.length-1;d>=0;d--){const Y=s[d],L=y(Y),A=k.get(L);if(A!==void 0&&n>=A){i=L;break}}if(!i&&s.length>0){const d=k.get(y(s[0]));d!==void 0&&n<d&&(i="")}x(i)},t=setTimeout(()=>{e()},200);return window.addEventListener("scroll",e,{passive:!0}),()=>{clearTimeout(t),window.removeEventListener("scroll",e),f.current&&clearTimeout(f.current)}},[s,T]),b(()=>{const e=document.querySelectorAll(".header"),t=[];return e.forEach(r=>{const n=r;t.push({element:n,originalPosition:n.style.position||getComputedStyle(n).position}),n.style.position="relative"}),()=>{t.forEach(({element:r,originalPosition:n})=>{r.style.position=n==="static"?"":n})}},[]);const j=(e,t)=>{e.preventDefault();const r=N.current.get(t);if(r===void 0){console.warn(`Cached position for "${t}" not found`);return}x(t),m.current=t,g.current=!0;const n=u.current?.offsetHeight||0,i=r-n-T;window.scrollTo({top:i,behavior:"smooth"}),window.history.pushState(null,"",`#${t}`)};return a("div",{id:H,ref:u,className:E("product-nav text-info-primary bg-container-primary tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] !sticky top-0 !z-[51] flex w-full justify-between overflow-hidden px-4 py-0",{"aiui-dark":B==="dark"},c),children:[a("div",{className:"product-nav-main desktop:flex-row desktop:gap-[48px] flex w-full flex-col justify-start",children:[a("div",{className:"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] pt-[14px]",children:[a("div",{className:"product-nav-tabs flex flex-row items-center gap-[8px]",children:[h.map((e,t)=>a("div",{className:"product-nav-tab-item flex items-center gap-[8px]",children:[o("a",{href:e.link,className:E("product-nav-tab-link hover:text-brand-color text-nowrap text-[14px] font-bold tracking-[-0.04em]",{"text-[#6D6D6F]":t!==0,"hidden desktop:block":t===1}),children:o("span",{children:e.label})}),t!==h.length-1&&o("div",{className:"product-nav-tab-divider desktop:inline-block hidden h-[14px] w-px bg-[#E4E5E6]"})]},e.link||t)),h.length>1&&a(S.Root,{children:[o(S.Trigger,{asChild:!0,children:o("button",{className:"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block","aria-label":"More products",children:o(K,{className:"text-[#1D1D1F]"})})}),o(S.Content,{className:"product-nav-dropdown-content rounded-[6px] border border-[#E4E5E6] bg-white p-[6px] px-[8px] py-[4px]",style:{boxShadow:"0px 4px 8px 0px rgba(0,0,0,0.12)"},side:"bottom",align:"end",alignOffset:10,sideOffset:10,children:h.slice(1).map(e=>o("a",{href:e.link,className:"product-nav-dropdown-link hover:text-brand-color text-nowrap",children:o("span",{children:e.label})},e.link))})]})]}),a("div",{className:"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]",children:[l?.link&&o("a",{href:l.link,target:l.target||"_self",className:"product-nav-text-link hover:text-brand-color cursor-pointer",children:o(P,{size:2,className:"text-nowrap",children:l.text})}),p?.link&&o(C,{as:"a",href:p.link,size:"sm",className:"product-nav-buy-button text-nowrap",children:p.text})]})]}),o("div",{className:"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[12px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:s.map((e,t)=>{const r=y(e);return a("a",{href:`#${r}`,className:"product-nav-anchor-link",onClick:n=>{R?(n.preventDefault(),x(r),m.current=r,g.current=!0,R(e,t)):j(n,r)},children:[o(P,{size:2,className:"product-nav-anchor-text text-nowrap",children:e.label}),o("div",{className:E("product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent",{"!bg-brand-0":z===r})})]},r)})})]}),a("div",{className:"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]",children:[l?.link&&o(q,{href:l.link,target:l.target||"_self",className:"product-nav-text-link no-underline",children:o(P,{size:2,className:"text-nowrap",children:l.text})}),p?.link&&o(C,{as:"a",href:p.link,size:"sm",className:"product-nav-buy-button text-nowrap",children:p.text})]})]})});M.displayName="ProductNav";var te=$(M);export{te as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import*as T from"react";import{cn as t}from"../../helpers/index.js";import{Checkbox as L,Badge as j,Heading as D,Text as n,Picture as c}from"../../components/index.js";import{useSceneShelfContext as O}from"./context.js";import{LocalizedLink as q}from"../../shared/LocalizedLink.js";const p=T.forwardRef(({className:x,classNames:
|
|
1
|
+
"use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import*as T from"react";import{cn as t}from"../../helpers/index.js";import{Checkbox as L,Badge as j,Heading as D,Text as n,Picture as c}from"../../components/index.js";import{useSceneShelfContext as O}from"./context.js";import{LocalizedLink as q}from"../../shared/LocalizedLink.js";const p=T.forwardRef(({className:x,classNames:h,product:e,selected:f,onSelectChange:b,showTags:k,showOriginalPrice:C,onProductImageClick:P,...u},N)=>{const i=O(),S=k??i?.showTags??!0,v=C??i?.showOriginalPrice??!0,s=h??i?.classNames??{},r=f??(i?i.selectedIds.has(e.id):!1),m=b??i?.onSelectChange,g=P??i?.onProductImageClick,l=e.soldOut??!1,w=o=>{l||typeof o=="boolean"&&m?.(o,e)},y=()=>{l||m?.(!r,e)};return d("div",{ref:N,className:t("lg-desktop:gap-2 lg-desktop:h-[362px] lg-desktop:px-6 lg-desktop:pb-6 lg-desktop:pt-4 rounded-box box-border flex h-[284px] flex-col justify-between gap-2 border-2 border-solid p-4 pb-6 transition-colors",l?"cursor-not-allowed opacity-50":"cursor-pointer",r?t("border-brand-0 bg-container-secondary-0",s?.cardSelected):t("border-lines bg-container-primary",s?.card),x),onClick:y,"data-headless-type-name":"SceneShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name??e.title}##Select`,"data-headless-sku":e.id,...u,children:[a("div",{className:t("lg-desktop:left-6 lg-desktop:top-6 flex max-h-[24px] min-h-[24px] flex-wrap gap-1 overflow-visible pr-9",s?.tags),children:S&&e.tags?.map((o,z)=>a(j,{variant:o.variant||"outline",size:"sm",children:o.label},z))}),a(L,{checked:r,disabled:l,onCheckedChange:w,onClick:o=>o.stopPropagation(),className:t("text-brand-0 border-brand-0 lg-desktop:right-6 lg-desktop:top-6 absolute right-4 top-4 size-5 shrink-0",s?.checkbox)}),a("div",{className:t("flex flex-1 grow-0 items-center justify-center",s?.image),children:g?a("a",{onClick:()=>g(e),role:"button",children:a(c,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):e?.href?a(q,{href:e.href,children:a(c,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):a(c,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}),d("div",{className:"flex grow flex-col justify-start gap-4",children:[a(D,{as:"h3",size:2,className:t("text-info-primary line-clamp-2 h-[2.2em]",s?.title),html:e.custom_name??e.title}),d("div",{className:t("flex flex-wrap items-center gap-1",s?.priceWrapper),children:[a(n,{as:"span",size:2,className:t("text-info-primary lg-desktop:text-[24px] whitespace-nowrap text-[20px]",s?.currentPrice),children:e.currentPrice.formatted}),v&&e.originalPrice&&e.originalPrice.value>e.currentPrice.value&&a(n,{as:"span",size:2,className:t("text-info-quaternary lg-desktop:text-[24px] whitespace-nowrap text-[20px] line-through",s?.originalPrice),children:e.originalPrice.formatted})]}),e?.priceLabel&&a(n,{size:4,className:t("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",s?.productPriceLabel),children:e.priceLabel})]})]})});p.displayName="SceneShelf.ProductCard";export{p as SceneProductCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as Q,jsx as t,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{cn as a,getLocalizedPath as F}from"../../helpers/index.js";import{Button as N,Badge as V,Card as q,CardContent as K,Picture as W,Text as T,Heading as p}from"../../components/index.js";import{trackUrlRef as I}from"../../shared/trackUrlRef.js";import{gaTrack as u}from"../../shared/track.js";import{useAiuiContext as J}from"../AiuiProvider/index.js";const B=n.forwardRef(({product:e,className:L,showTags:z=!0,onLearnMore:f,onShopNow:y,onAddToCart:v,classNames:o,secondaryButtonText:c,secondaryButtonFun:
|
|
1
|
+
"use client";import{Fragment as Q,jsx as t,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{cn as a,getLocalizedPath as F}from"../../helpers/index.js";import{Button as N,Badge as V,Card as q,CardContent as K,Picture as W,Text as T,Heading as p}from"../../components/index.js";import{trackUrlRef as I}from"../../shared/trackUrlRef.js";import{gaTrack as u}from"../../shared/track.js";import{useAiuiContext as J}from"../AiuiProvider/index.js";const B=n.forwardRef(({product:e,className:L,showTags:z=!0,onLearnMore:f,onShopNow:y,onAddToCart:v,classNames:o,secondaryButtonText:c,secondaryButtonFun:x,primaryButtonText:m,primaryButtonFun:b,showOriginalPrice:_,renderOriginalPrice:h,copy:D,onProductImageClick:d,theme:M="light",locale:P="us",index:s=0,tabName:k},H)=>{const[O,j]=n.useState(!1),[R,A]=n.useState(!1),{trackingData:G}=J(),r=G?.pageGroup,w=!e.soldOut,C=n.useCallback(async(i,g)=>{if(!i)return;const S=g==="primary"?j:A;S(!0);try{switch(i){case"buyNow":await y?.(e);break;case"addCart":await v?.(e);break;case"learnMore":await f?.(e.href);break}}finally{S(!1)}},[e,y,v,f]),U=n.useMemo(()=>F(I(e.href,r+"_shelf_scene_shelf_v3"),P),[e.href,r,P]),E=n.useCallback(()=>{d?.(e),u({event:"ga4Event",event_name:"select_item",item_list_name:"Scene_Shelf_3_Products",page_group:r,items:[{item_id:e.sku,item_name:e.title,item_variant:e.id,price:e.currentPrice,index:s}],tab_name:k,position:s})},[d,e,r,s,k]);return t(q,{ref:H,className:a("bg-container-primary flex h-full flex-col overflow-hidden border-none hover:bg-white",L,o?.productCard,{"hover:bg-container-secondary-0 ":M==="dark"}),children:l(K,{className:"desktop:p-6 relative flex flex-1 flex-col justify-between p-4",children:[t("div",{className:"product-image-wrapper lg-desktop:size-[196px] mx-auto size-[138px] cursor-pointer overflow-hidden",children:t("a",{onClick:E,...!d&&{href:U},rel:"noreferrer",children:t(W,{source:e.imageUrl,alt:e.imageAlt,className:"aspect-square size-full object-contain",imgClassName:"w-full h-full object-contain"})})}),t("div",{className:"lg-desktop:h-[28px] mb-1 flex h-[24px] gap-1",children:z&&e.tags?.map((i,g)=>t(V,{size:"sm",variant:i.variant||"outline",className:a(i.variant==="promotional"?"ml-2":""),promotionalType:i.promotionalType,children:i.label},g))}),l("div",{className:"flex h-full flex-1 grow flex-col justify-between",children:[l("div",{className:"mb-4",children:[t(p,{as:"h3",size:2,className:a("text-info-primary laptop:line-clamp-2 mb-2 line-clamp-3 min-h-[2.4em]",o?.productTitle),html:e.custom_name||e.title}),(e?.custom_description||e?.description)&&t(T,{size:2,className:a("text-info-secondary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1 text-[14px]",o?.productDescription),html:e.custom_description||e.description})]}),l("div",{children:[t("div",{className:a("mb-2",o?.productPrice),children:t("div",{className:a("laptop:gap-1 flex flex-wrap items-baseline gap-[2px]",o?.priceWrapper),children:w?l(Q,{children:[t(p,{size:2,className:"text-info-primary",as:"h6",children:e.currentPrice}),h?h(e,{showOriginalPrice:_}):_&&e.originalPrice&&t(p,{size:2,className:a("text-info-tertiary line-through",o?.originalPrice),as:"h6",children:e.originalPrice})]}):t(p,{size:2,className:"text-info-tertiary",children:D?.outOfStockLabel??"Sold Out"})})}),e?.priceLabel&&w&&t(T,{size:4,className:a("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",o?.productPriceLabel),children:e.priceLabel}),l("div",{className:a("lg-desktop:gap-3 laptop:flex-row laptop:flex-nowrap flex flex-col flex-wrap gap-2",o?.buttonGroup),children:[c&&t(N,{variant:"secondary",size:"base",className:a("laptop:flex-1 laptop:min-w-0 laptop:whitespace-normal laptop:text-center w-full min-w-0 whitespace-normal text-center",o?.secondaryButton),onClick:()=>{C(x,"secondary"),u({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:r||"Home Page",component_type:"copy",component_name:"scene_shelf_product",component_title:e.custom_name||e.title,component_description:e.custom_description||"",button_name:c,SKU:e.sku||"",position:s}})},disabled:e.soldOut&&x!=="learnMore",loading:R,children:c}),m&&t(N,{variant:"primary",size:"base",className:a("laptop:flex-1 laptop:min-w-0 laptop:whitespace-normal laptop:text-center w-full min-w-0 whitespace-normal text-center",o?.primaryButton),onClick:()=>{C(b,"primary"),u({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:r||"Home Page",component_type:"copy",component_name:"scene_shelf_product",component_title:e.custom_name||e.title,component_description:e.custom_description||"",button_name:m,SKU:e.sku||"",position:s}})},disabled:e.soldOut&&b!=="learnMore",loading:O,children:m})]})]})]})]})})});B.displayName="SceneShelfV3.ProductCard";var te=B;export{B as ProductCard,te as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as Ae,jsx as s,jsxs as f}from"react/jsx-runtime";import{useAiuiContext as Ne}from"../AiuiProvider/index.js";import{formatVariantPrice as Ce}from"./shelfDisplay.js";import _e from"../../components/picture.js";import Se from"../../components/badge.js";import{cn as w}from"../../helpers/utils.js";import{Text as Te}from"../../components/text.js";import fe from"../../components/button.js";import{gaTrack as Be}from"../../shared/track.js";import{trackUrlRef as Pe}from"../../shared/trackUrlRef.js";import{Heading as Le}from"../../components/heading.js";import{useExposure as $e}from"../../hooks/useExposure.js";import{useRef as De,useEffect as Ie,useMemo as ye,useState as j}from"react";const ge="image",he="product_shelf",xe=999999999e-2,ze=e=>{const t=e?.sku,_=e?.variants,E=_?.find(O=>O?.sku===t),K=E?.image?.url||_?.[0]?.image?.url||"",re=E?.image?.altText||_?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:K,altText:re}},Fe=({items:e})=>e?.length?s("div",{className:"shelf-display-social-endorsements desktop:gap-2 absolute right-0 top-0 z-10 flex flex-col items-center gap-1",children:e.map((t,_)=>typeof t.icon=="string"?s("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},_):s(Te,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},_))}):null,Ke=({data:e,configuration:t})=>{const{isDisplayBackImage:_=!1,itemShape:E,metafields:K,isTopTag:re=!1,isShowTag:O,isShowOriginalPrice:$,isShowShortTitle:ve=!1,isShowPricesTag:D=!1,pricesTagTextColor:W,pricesTagBgColor:H,itemsTagTextColor:v,itemsTagBgColor:Q,formatPrice:ie,renderOriginalPrice:X,renderPriceLabel:be,renderPrice:U}=t||{},{locale:T="es",copyWriting:oe,currencyDisplay:Y}=Ne(),{discounts:Z,discountsCopy:le}=K||{},ne=De(null),[n,ae]=j([]),[ce,I]=j(""),[pe,z]=j(!1),[b,R]=j(!1),me=(i,p,m,d)=>{const{primaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:we}=t||{};if(x){if(x==="AddCart"&&S)return S(i,p+1,m,d);if(x==="BuyNow"&&te)return te(i,p+1,m,d);if(x==="LearnMore"&&se)return se(i,p+1,m,d)}we?.primaryButton?.(i,p+1,m,d)},ke=(i,p,m,d)=>{const{secondaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:we}=t||{};if(x){if(x==="AddCart"&&S)return S(i,p+1,m,d);if(x==="BuyNow"&&te)return te(i,p+1,m,d);if(x==="LearnMore"&&se)return se(i,p+1,m,d)}we?.secondaryButton?.(i,p+1,m,d)},o=ye(()=>{const i=e?.variants||[];if(i.length)return e?.sku?i?.find?.(p=>p?.sku===e?.sku)||i[0]:i?.[0]},[e?.sku,e?.variants]),A=o?.id?.split?.("/")||[],N=A?.[A?.length-1],y=!o?.availableForSale||o?.price?.amount===xe||o?.price===xe,k=o?.coupons?.[0],de=e?.price?.currencyCode||"USD",q=ye(()=>Ce({locale:T,amount:k?k?.variant_price4wscode:o?.price,baseAmount:k?o?.price:0,currencyCode:de,currencyDisplay:Y,customFormatPrice:ie}),[de,T,k,Y,o,ie]),{price:F,basePrice:C,discount:B,discountAmount:M}=q,{imageUrl:V,altText:ue}=ze(e),G=e?.custom_name||e?.title,P=ve&&o?.metafields?.infos?.page_short_title||G,ee=e?.custom_description||e?.description,r=()=>{if(k?.value_type==="fixed_amount"){const i=M||"",p=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(p){const[,m,d,x]=p;let S=d;return d.endsWith(".00")?S=d.replace(/\.00$/,""):d.endsWith(",00")&&(S=d.replace(/,00$/,"")),`${m}${S}${x}`}return i}return B||""};Ie(()=>{let i=[];if(B||M){const m=`${r()} ${Z?.off||le?.off||""}`;I(m)}const p=e?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,B&&D?1:2)||[];ae(i.concat(p))},[e?.tags,B,M,D,Z?.off,le?.off]),$e(ne,{componentType:ge,componentName:he,componentTitle:G,componentDescription:ee,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){z(!0);try{await me(e,t?.index,t,k)}finally{z(!1)}}},a=async()=>{if(!b&&!e?.custom_secondary_link){R(!0);try{await ke(e,t?.index,t,k)}finally{R(!1)}}},c=()=>f("div",{className:"shelf-display-product-content desktop:gap-6 lg-desktop:flex-[221] desktop:flex-[190] flex flex-[178] flex-col justify-between gap-4",children:[f("div",{className:"shelf-display-product-content-title-desc",children:[P?s(Le,{as:"h3",title:P||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:P||""}):null,s(Te,{size:2,className:w("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:ee||""})]}),f("div",{className:"shelf-display-product-content-price-button",children:[s("div",{className:"mb-2 flex items-center",children:U?U(e,{price:F,basePrice:C,discount:B,discountAmount:M,variant:o,coupon:k,isSoldOut:y,isShowOriginalPrice:$}):y?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:oe?.soldOutText}):f(Ae,{children:[s("div",{className:"final-price lg-desktop:text-2xl text-info-primary text-xl font-bold !leading-[1.2]",children:o?.availableForSale&&F||""}),X?X(e,{price:F,basePrice:C,discount:B,discountAmount:M,isShowOriginalPrice:$}):C&&$&&s("div",{className:"origin-price lg-desktop:text-2xl text-info-quaternary ml-1 text-xl font-bold !leading-[1.2] line-through",children:o?.availableForSale&&C||""})]})}),!U&&be?.(e,o,{isShowOriginalPrice:$}),f("div",{className:w("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!y?s(fe,{disabled:y&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:a,loading:b,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(fe,{disabled:y&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:l,loading:pe,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]}),u={...W?{color:W}:{},...H?{backgroundColor:H,backgroundImage:"none"}:{},...W||H?{outline:"none"}:{}},g={...v?{color:v}:{},...Q?{backgroundColor:Q,backgroundImage:"none"}:{},...v||Q?{outlineColor:v}:{}},L=()=>f("div",{className:"lg-desktop:min-h-[28px] lg-desktop:flex-[28] box-border flex min-h-6 flex-[24] flex-wrap gap-1 overflow-hidden",children:[D&&ce&&s(Se,{className:"shelf-prices-tag",variant:"fill",style:u,children:ce||""}),O&&n?.length>0&&n?.map?.((i,p)=>s(Se,{className:"shelf-items-tag",variant:"outline",style:g,children:i},p))]}),h=e?.custom_bg_image,J=e?.custom_theme;return s("div",{ref:ne,className:w("box-border w-full cursor-pointer overflow-hidden duration-300","rounded-box","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[545] desktop:aspect-w-[316] desktop:aspect-h-[450]","laptop:aspect-w-[288] laptop:aspect-h-[422] aspect-w-[296] aspect-h-[422] relative","md-tablet:h-[422px] shelf-display-item",h?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":J==="dark","aiui-light":J==="light"}),style:h?{backgroundImage:`url(${h})`}:void 0,children:_?s("div",{className:"absolute inset-0 box-border overflow-hidden",children:f("div",{className:"relative inset-0 size-full",children:[s(L,{}),s(_e,{source:V,alt:ue,className:w("flex h-full justify-center object-cover [&_img]:w-auto",{"opacity-0":h})}),s("div",{className:"desktop:p-6 absolute inset-x-0 bottom-0 box-border overflow-hidden p-4",children:c()})]})}):f("div",{className:"desktop:p-6 desktop:pt-4 desktop:gap-2 absolute inset-0 box-border flex flex-col justify-between gap-1 overflow-hidden p-4",children:[s(L,{}),f("div",{className:w("shelf-display-item-image lg-desktop:flex-[240] relative inline-block w-full flex-[180] overflow-hidden",{"opacity-0":h}),children:[s("a",{"aria-label":G,target:t?.target,href:Pe(`${T==="us"||!T?"":`/${T}`}/products/${e?.handle}?variant=${N}`,`${ge}_${he}`),onClick:()=>{Be({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||o?.sku,item_name:e?.name,item_variant:o?.name,price:o?.price,index:t?.index+1}]}})},children:s(_e,{source:V,alt:ue,className:"flex h-full justify-center object-cover [&_img]:w-auto"})}),s(Fe,{items:e?.socialEndorsements})]}),c()]})},e?.id||e?.handle)},Qe=({data:e,configuration:t})=>{const{itemShape:_,itemLength:E,metafields:K,isShowShortTitle:re,formatPrice:O,renderOriginalPrice:$,renderPriceLabel:ve,renderPrice:D}=t||{},{discounts:W,discountsCopy:H}=K||{},{locale:v="us",copyWriting:Q,currencyDisplay:ie}=Ne(),[X,be]=j([]),U=De(null),[T,oe]=j(!1),[Y,Z]=j(!1),le=(r,l,a,c)=>{const{primaryFun:u,onAddCart:g,onBuyNow:L,onLearnMore:h,event:J}=t||{};if(u){if(u==="AddCart"&&g)return g(r,l+1,a,c);if(u==="BuyNow"&&L)return L(r,l+1,a,c);if(u==="LearnMore"&&h)return h(r,l+1,a,c)}J?.primaryButton?.(r,l+1,a,c)},ne=(r,l,a,c)=>{const{secondaryFun:u,onAddCart:g,onBuyNow:L,onLearnMore:h,event:J}=t||{};if(u){if(u==="AddCart"&&g)return g(r,l+1,a,c);if(u==="BuyNow"&&L)return L(r,l+1,a,c);if(u==="LearnMore"&&h)return h(r,l+1,a,c)}J?.secondaryButton?.(r,l+1,a,c)},n=ye(()=>{const r=e?.variants||[];if(r.length)return e?.sku&&r.find(l=>l?.sku===e?.sku)||r[0]},[e?.sku,e?.variants]),ae=n?.id?.split?.("/")||[],ce=ae?.[ae?.length-1],I=!n?.availableForSale||n?.price?.amount===xe||n?.price===xe,pe=t?.isShowTag,z=t?.isShowOriginalPrice,b=n?.coupons?.[0],R=!!(z&&b),me=e?.price?.currencyCode||"USD",ke=ye(()=>Ce({locale:v,amount:R?b?.variant_price4wscode:n?.price,baseAmount:R?n?.price:0,currencyCode:me,currencyDisplay:ie,customFormatPrice:O}),[me,v,R,b?.variant_price4wscode,n,O]),{price:o,basePrice:A,discount:N,discountAmount:y}=ke,{imageUrl:k,altText:de}=ze(e),q=e?.custom_name||e?.title,F=re&&n?.metafields?.infos?.page_short_title||q,C=e?.custom_description||e?.description;$e(U,{componentType:ge,componentName:he,componentTitle:q,componentDescription:C,position:t?.index+1});const B=async()=>{if(!T&&!e?.custom_primary_link){oe(!0);try{await le(e,t?.index,t,b)}finally{oe(!1)}}},M=async()=>{if(!Y&&!e?.custom_secondary_link){Z(!0);try{await ne(e,t?.index,t,b)}finally{Z(!1)}}},V=()=>E>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},ue=()=>E>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col",G=()=>{if(b?.value_type==="fixed_amount"){const r=y||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,a,c,u]=l;let g=c;return c.endsWith(".00")?g=c.replace(/\.00$/,""):c.endsWith(",00")&&(g=c.replace(/,00$/,"")),`${a}${g}${u}`}return r}return N||""};Ie(()=>{let r=[];if(N||y){const a=`${G()} ${W?.off||H?.off||""}`;r.push(a)}const l=e?.tags?.filter?.(a=>a?.startsWith?.("CLtag"))?.map?.(a=>a?.replace?.("CLtag:",""))?.slice?.(0,N?1:2)||[];be(r.concat(l))},[e?.tags,N,y,W?.off,H?.off]);const P=e?.custom_bg_image,ee=e?.custom_theme;return s("div",{ref:U,className:w(V().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",P?"bg-cover bg-center bg-no-repeat":"bg-container-secondary-1 tablet:hover:bg-info-white",{"aiui-dark":ee==="dark","aiui-light":ee==="light"}),style:P?{backgroundImage:`url(${P})`}:void 0,children:f("div",{className:w(ue(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[s("div",{className:w(V().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":P}),children:s("a",{"aria-label":q,target:t?.target,href:Pe(`${v==="us"||!v?"":`/${v}`}/products/${e?.handle}?variant=${ce}`,`${ge}_${he}`),onClick:()=>{Be({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||n?.sku,item_name:e?.name,item_variant:n?.name,price:n?.price,index:t?.index+1}]}})},children:s(_e,{source:k,alt:de,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),f("div",{className:w("flex flex-col items-start justify-center",V().boxItem),children:[pe&&s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:X?.length>0&&X?.map?.((r,l)=>s(Se,{className:"shelf-items-tag",variant:"fill",children:r},l))}),F?s(Le,{as:"h3",title:F||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:F||""}):null,C?s(Te,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description text-info-primary line-clamp-1 h-5 text-sm",html:C||""}):null,s("div",{className:"mb-2 mt-5 flex items-center",children:D?D(e,{price:o,basePrice:A,discount:N,discountAmount:y,variant:n,coupon:b,isSoldOut:I,isShowOriginalPrice:z}):I?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:Q?.soldOutText}):f(Ae,{children:[s("div",{className:"final-price tablet:text-xl text-info-primary text-xl font-bold",children:n?.availableForSale&&o||""}),$?$(e,{price:o,basePrice:A,discount:N,discountAmount:y,isShowOriginalPrice:z}):A&&s("div",{className:"origin-price tablet:text-xl text-info-quaternary ml-1 text-lg font-bold line-through",children:n?.availableForSale&&A||""})]})}),!D&&ve?.(e,n,{isShowOriginalPrice:z}),f("div",{className:w("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!I?s(fe,{disabled:I&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:M,loading:Y,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(fe,{disabled:I&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:B,loading:T,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};export{Qe as ShelfDisplayHorizontalItem,Ke as ShelfDisplayWrapItem,ze as getProductImage};
|
|
1
|
+
import{Fragment as Ae,jsx as s,jsxs as f}from"react/jsx-runtime";import{useAiuiContext as Ne}from"../AiuiProvider/index.js";import{formatVariantPrice as Ce}from"./shelfDisplay.js";import _e from"../../components/picture.js";import Se from"../../components/badge.js";import{cn as w}from"../../helpers/utils.js";import{Text as Te}from"../../components/text.js";import fe from"../../components/button.js";import{gaTrack as Be}from"../../shared/track.js";import{trackUrlRef as Pe}from"../../shared/trackUrlRef.js";import{Heading as Le}from"../../components/heading.js";import{useExposure as $e}from"../../hooks/useExposure.js";import{useRef as De,useEffect as Ie,useMemo as ye,useState as j}from"react";const ge="image",he="product_shelf",xe=999999999e-2,ze=e=>{const t=e?.sku,_=e?.variants,E=_?.find(O=>O?.sku===t),K=E?.image?.url||_?.[0]?.image?.url||"",re=E?.image?.altText||_?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:K,altText:re}},Fe=({items:e})=>e?.length?s("div",{className:"shelf-display-social-endorsements desktop:gap-2 absolute right-0 top-0 z-10 flex flex-col items-center gap-1",children:e.map((t,_)=>typeof t.icon=="string"?s("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},_):s(Te,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},_))}):null,Ke=({data:e,configuration:t})=>{const{isDisplayBackImage:_=!1,itemShape:E,metafields:K,isTopTag:re=!1,isShowTag:O,isShowOriginalPrice:$,isShowShortTitle:ve=!1,isShowPricesTag:D=!1,pricesTagTextColor:W,pricesTagBgColor:H,itemsTagTextColor:v,itemsTagBgColor:Q,formatPrice:ie,renderOriginalPrice:X,renderPriceLabel:be,renderPrice:U}=t||{},{locale:T="es",copyWriting:oe,currencyDisplay:Y}=Ne(),{discounts:Z,discountsCopy:le}=K||{},ne=De(null),[n,ae]=j([]),[ce,I]=j(""),[pe,z]=j(!1),[b,R]=j(!1),me=(i,p,m,d)=>{const{primaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:we}=t||{};if(x){if(x==="AddCart"&&S)return S(i,p+1,m,d);if(x==="BuyNow"&&te)return te(i,p+1,m,d);if(x==="LearnMore"&&se)return se(i,p+1,m,d)}we?.primaryButton?.(i,p+1,m,d)},ke=(i,p,m,d)=>{const{secondaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:we}=t||{};if(x){if(x==="AddCart"&&S)return S(i,p+1,m,d);if(x==="BuyNow"&&te)return te(i,p+1,m,d);if(x==="LearnMore"&&se)return se(i,p+1,m,d)}we?.secondaryButton?.(i,p+1,m,d)},o=ye(()=>{const i=e?.variants||[];if(i.length)return e?.sku?i?.find?.(p=>p?.sku===e?.sku)||i[0]:i?.[0]},[e?.sku,e?.variants]),A=o?.id?.split?.("/")||[],N=A?.[A?.length-1],y=!o?.availableForSale||o?.price?.amount===xe||o?.price===xe,k=o?.coupons?.[0],de=e?.price?.currencyCode||"USD",q=ye(()=>Ce({locale:T,amount:k?k?.variant_price4wscode:o?.price,baseAmount:k?o?.price:0,currencyCode:de,currencyDisplay:Y,customFormatPrice:ie}),[de,T,k,Y,o,ie]),{price:F,basePrice:C,discount:B,discountAmount:M}=q,{imageUrl:V,altText:ue}=ze(e),G=e?.custom_name||e?.title,P=ve&&o?.metafields?.infos?.page_short_title||G,ee=e?.custom_description||e?.description,r=()=>{if(k?.value_type==="fixed_amount"){const i=M||"",p=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(p){const[,m,d,x]=p;let S=d;return d.endsWith(".00")?S=d.replace(/\.00$/,""):d.endsWith(",00")&&(S=d.replace(/,00$/,"")),`${m}${S}${x}`}return i}return B||""};Ie(()=>{let i=[];if(B||M){const m=`${r()} ${Z?.off||le?.off||""}`;I(m)}const p=e?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,B&&D?1:2)||[];ae(i.concat(p))},[e?.tags,B,M,D,Z?.off,le?.off]),$e(ne,{componentType:ge,componentName:he,componentTitle:G,componentDescription:ee,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){z(!0);try{await me(e,t?.index,t,k)}finally{z(!1)}}},a=async()=>{if(!b&&!e?.custom_secondary_link){R(!0);try{await ke(e,t?.index,t,k)}finally{R(!1)}}},c=()=>f("div",{className:"shelf-display-product-content desktop:gap-6 lg-desktop:flex-[221] desktop:flex-[190] flex flex-[178] flex-col justify-between gap-4",children:[f("div",{className:"shelf-display-product-content-title-desc",children:[P?s(Le,{as:"h3",title:P||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:P||""}):null,s(Te,{size:2,className:w("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:ee||""})]}),f("div",{className:"shelf-display-product-content-price-button",children:[s("div",{className:"mb-2 flex flex-wrap items-center",children:U?U(e,{price:F,basePrice:C,discount:B,discountAmount:M,variant:o,coupon:k,isSoldOut:y,isShowOriginalPrice:$}):y?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:oe?.soldOutText}):f(Ae,{children:[s("div",{className:"final-price lg-desktop:text-2xl text-info-primary whitespace-nowrap text-xl font-bold !leading-[1.2]",children:o?.availableForSale&&F||""}),X?X(e,{price:F,basePrice:C,discount:B,discountAmount:M,isShowOriginalPrice:$}):C&&$&&s("div",{className:"origin-price lg-desktop:text-2xl text-info-quaternary ml-1 whitespace-nowrap text-xl font-bold !leading-[1.2] line-through",children:o?.availableForSale&&C||""})]})}),!U&&be?.(e,o,{isShowOriginalPrice:$}),f("div",{className:w("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!y?s(fe,{disabled:y&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:a,loading:b,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(fe,{disabled:y&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:l,loading:pe,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]}),u={...W?{color:W}:{},...H?{backgroundColor:H,backgroundImage:"none"}:{},...W||H?{outline:"none"}:{}},g={...v?{color:v}:{},...Q?{backgroundColor:Q,backgroundImage:"none"}:{},...v||Q?{outlineColor:v}:{}},L=()=>f("div",{className:"lg-desktop:min-h-[28px] lg-desktop:flex-[28] box-border flex min-h-6 flex-[24] flex-wrap gap-1 overflow-hidden",children:[D&&ce&&s(Se,{className:"shelf-prices-tag",variant:"fill",style:u,children:ce||""}),O&&n?.length>0&&n?.map?.((i,p)=>s(Se,{className:"shelf-items-tag",variant:"outline",style:g,children:i},p))]}),h=e?.custom_bg_image,J=e?.custom_theme;return s("div",{ref:ne,className:w("box-border w-full cursor-pointer overflow-hidden duration-300","rounded-box","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[545] desktop:aspect-w-[316] desktop:aspect-h-[450]","laptop:aspect-w-[288] laptop:aspect-h-[422] aspect-w-[296] aspect-h-[422] relative","md-tablet:h-[422px] shelf-display-item",h?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":J==="dark","aiui-light":J==="light"}),style:h?{backgroundImage:`url(${h})`}:void 0,children:_?s("div",{className:"absolute inset-0 box-border overflow-hidden",children:f("div",{className:"relative inset-0 size-full",children:[s(L,{}),s(_e,{source:V,alt:ue,className:w("flex h-full justify-center object-cover [&_img]:w-auto",{"opacity-0":h})}),s("div",{className:"desktop:p-6 absolute inset-x-0 bottom-0 box-border overflow-hidden p-4",children:c()})]})}):f("div",{className:"desktop:p-6 desktop:pt-4 desktop:gap-2 absolute inset-0 box-border flex flex-col justify-between gap-1 overflow-hidden p-4",children:[s(L,{}),f("div",{className:w("shelf-display-item-image lg-desktop:flex-[240] relative inline-block w-full flex-[180] overflow-hidden",{"opacity-0":h}),children:[s("a",{"aria-label":G,target:t?.target,href:Pe(`${T==="us"||!T?"":`/${T}`}/products/${e?.handle}?variant=${N}`,`${ge}_${he}`),onClick:()=>{Be({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||o?.sku,item_name:e?.name,item_variant:o?.name,price:o?.price,index:t?.index+1}]}})},children:s(_e,{source:V,alt:ue,className:"flex h-full justify-center object-cover [&_img]:w-auto"})}),s(Fe,{items:e?.socialEndorsements})]}),c()]})},e?.id||e?.handle)},Qe=({data:e,configuration:t})=>{const{itemShape:_,itemLength:E,metafields:K,isShowShortTitle:re,formatPrice:O,renderOriginalPrice:$,renderPriceLabel:ve,renderPrice:D}=t||{},{discounts:W,discountsCopy:H}=K||{},{locale:v="us",copyWriting:Q,currencyDisplay:ie}=Ne(),[X,be]=j([]),U=De(null),[T,oe]=j(!1),[Y,Z]=j(!1),le=(r,l,a,c)=>{const{primaryFun:u,onAddCart:g,onBuyNow:L,onLearnMore:h,event:J}=t||{};if(u){if(u==="AddCart"&&g)return g(r,l+1,a,c);if(u==="BuyNow"&&L)return L(r,l+1,a,c);if(u==="LearnMore"&&h)return h(r,l+1,a,c)}J?.primaryButton?.(r,l+1,a,c)},ne=(r,l,a,c)=>{const{secondaryFun:u,onAddCart:g,onBuyNow:L,onLearnMore:h,event:J}=t||{};if(u){if(u==="AddCart"&&g)return g(r,l+1,a,c);if(u==="BuyNow"&&L)return L(r,l+1,a,c);if(u==="LearnMore"&&h)return h(r,l+1,a,c)}J?.secondaryButton?.(r,l+1,a,c)},n=ye(()=>{const r=e?.variants||[];if(r.length)return e?.sku&&r.find(l=>l?.sku===e?.sku)||r[0]},[e?.sku,e?.variants]),ae=n?.id?.split?.("/")||[],ce=ae?.[ae?.length-1],I=!n?.availableForSale||n?.price?.amount===xe||n?.price===xe,pe=t?.isShowTag,z=t?.isShowOriginalPrice,b=n?.coupons?.[0],R=!!(z&&b),me=e?.price?.currencyCode||"USD",ke=ye(()=>Ce({locale:v,amount:R?b?.variant_price4wscode:n?.price,baseAmount:R?n?.price:0,currencyCode:me,currencyDisplay:ie,customFormatPrice:O}),[me,v,R,b?.variant_price4wscode,n,O]),{price:o,basePrice:A,discount:N,discountAmount:y}=ke,{imageUrl:k,altText:de}=ze(e),q=e?.custom_name||e?.title,F=re&&n?.metafields?.infos?.page_short_title||q,C=e?.custom_description||e?.description;$e(U,{componentType:ge,componentName:he,componentTitle:q,componentDescription:C,position:t?.index+1});const B=async()=>{if(!T&&!e?.custom_primary_link){oe(!0);try{await le(e,t?.index,t,b)}finally{oe(!1)}}},M=async()=>{if(!Y&&!e?.custom_secondary_link){Z(!0);try{await ne(e,t?.index,t,b)}finally{Z(!1)}}},V=()=>E>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},ue=()=>E>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col",G=()=>{if(b?.value_type==="fixed_amount"){const r=y||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,a,c,u]=l;let g=c;return c.endsWith(".00")?g=c.replace(/\.00$/,""):c.endsWith(",00")&&(g=c.replace(/,00$/,"")),`${a}${g}${u}`}return r}return N||""};Ie(()=>{let r=[];if(N||y){const a=`${G()} ${W?.off||H?.off||""}`;r.push(a)}const l=e?.tags?.filter?.(a=>a?.startsWith?.("CLtag"))?.map?.(a=>a?.replace?.("CLtag:",""))?.slice?.(0,N?1:2)||[];be(r.concat(l))},[e?.tags,N,y,W?.off,H?.off]);const P=e?.custom_bg_image,ee=e?.custom_theme;return s("div",{ref:U,className:w(V().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",P?"bg-cover bg-center bg-no-repeat":"bg-container-secondary-1 tablet:hover:bg-info-white",{"aiui-dark":ee==="dark","aiui-light":ee==="light"}),style:P?{backgroundImage:`url(${P})`}:void 0,children:f("div",{className:w(ue(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[s("div",{className:w(V().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":P}),children:s("a",{"aria-label":q,target:t?.target,href:Pe(`${v==="us"||!v?"":`/${v}`}/products/${e?.handle}?variant=${ce}`,`${ge}_${he}`),onClick:()=>{Be({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||n?.sku,item_name:e?.name,item_variant:n?.name,price:n?.price,index:t?.index+1}]}})},children:s(_e,{source:k,alt:de,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),f("div",{className:w("flex flex-col items-start justify-center",V().boxItem),children:[pe&&s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:X?.length>0&&X?.map?.((r,l)=>s(Se,{className:"shelf-items-tag",variant:"fill",children:r},l))}),F?s(Le,{as:"h3",title:F||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:F||""}):null,C?s(Te,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description text-info-primary line-clamp-1 h-5 text-sm",html:C||""}):null,s("div",{className:"mb-2 mt-5 flex flex-wrap items-center",children:D?D(e,{price:o,basePrice:A,discount:N,discountAmount:y,variant:n,coupon:b,isSoldOut:I,isShowOriginalPrice:z}):I?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:Q?.soldOutText}):f(Ae,{children:[s("div",{className:"final-price tablet:text-xl text-info-primary whitespace-nowrap text-xl font-bold",children:n?.availableForSale&&o||""}),$?$(e,{price:o,basePrice:A,discount:N,discountAmount:y,isShowOriginalPrice:z}):A&&s("div",{className:"origin-price tablet:text-xl text-info-quaternary ml-1 whitespace-nowrap text-lg font-bold line-through",children:n?.availableForSale&&A||""})]})}),!D&&ve?.(e,n,{isShowOriginalPrice:z}),f("div",{className:w("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!I?s(fe,{disabled:I&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:M,loading:Y,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(fe,{disabled:I&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:B,loading:T,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};export{Qe as ShelfDisplayHorizontalItem,Ke as ShelfDisplayWrapItem,ze as getProductImage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as $e,jsx as s,jsxs as m}from"react/jsx-runtime";import{useAiuiContext as _e}from"../AiuiProvider/index.js";import{formatVariantPrice as Se}from"../ShelfDisplay/shelfDisplay.js";import{getProductImage as
|
|
1
|
+
import{Fragment as $e,jsx as s,jsxs as m}from"react/jsx-runtime";import{useAiuiContext as _e}from"../AiuiProvider/index.js";import{formatVariantPrice as Se}from"../ShelfDisplay/shelfDisplay.js";import{getProductImage as we}from"../ShelfDisplay/shelfDisplayItem.js";import Te from"../../components/picture.js";import X from"../../components/badge.js";import{cn as S}from"../../helpers/utils.js";import{Text as Y}from"../../components/text.js";import Z from"../../components/button.js";import{gaTrack as Ce}from"../../shared/track.js";import{trackUrlRef as Ne}from"../../shared/trackUrlRef.js";import{Heading as Pe}from"../../components/heading.js";import{useExposure as Be}from"../../hooks/useExposure.js";import{useRef as ze,useEffect as De,useMemo as ee,useState as w}from"react";const te="image",oe="product_shelf",se=999999999e-2,Le=({items:e})=>e?.length?s("div",{className:"shelf-display-horizontal-social-endorsements desktop:gap-2 desktop:top-2 absolute right-0 top-0 flex flex-none flex-col items-center gap-1 self-center",children:e.map((t,T)=>typeof t.icon=="string"?s("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},T):s(Y,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},T))}):null,Ke=({data:e,configuration:t})=>{const{isDisplayBackImage:T=!1,itemShape:Ie,metafields:I,isTopTag:Ee=!1,isShowTag:re,isShowOriginalPrice:v,isShowShortTitle:ie=!1,isShowPricesTag:C=!1,pricesTagTextColor:N,pricesTagBgColor:P,itemsTagTextColor:k,itemsTagBgColor:B,formatPrice:E,renderOriginalPrice:A,renderPriceLabel:le,renderPrice:z}=t||{},{locale:f="es",copyWriting:ne,currencyDisplay:F}=_e(),{discounts:M,discountsCopy:H}=I||{},O=ze(null),[j,ae]=w([]),[U,ce]=w(""),[W,R]=w(!1),[q,V]=w(!1),pe=(o,r,i,n)=>{const{primaryFun:a,onAddCart:c,onBuyNow:y,onLearnMore:h,event:$}=t||{};if(a){if(a==="AddCart"&&c)return c(o,r+1,i,n);if(a==="BuyNow"&&y)return y(o,r+1,i,n);if(a==="LearnMore"&&h)return h(o,r+1,i,n)}$?.primaryButton?.(o,r+1,i,n)},me=(o,r,i,n)=>{const{secondaryFun:a,onAddCart:c,onBuyNow:y,onLearnMore:h,event:$}=t||{};if(a){if(a==="AddCart"&&c)return c(o,r+1,i,n);if(a==="BuyNow"&&y)return y(o,r+1,i,n);if(a==="LearnMore"&&h)return h(o,r+1,i,n)}$?.secondaryButton?.(o,r+1,i,n)},l=ee(()=>{const o=e?.variants||[];if(o.length)return e?.sku?o?.find?.(r=>r?.sku===e?.sku)||o[0]:o?.[0]},[e?.sku,e?.variants]),G=l?.id?.split?.("/")||[],de=G?.[G?.length-1],u=!l?.availableForSale||l?.price?.amount===se||l?.price===se,p=l?.coupons?.[0],J=e?.price?.currencyCode||"USD",fe=ee(()=>Se({locale:f,amount:p?p?.variant_price4wscode:l?.price,baseAmount:p?l?.price:0,currencyCode:J,currencyDisplay:F,customFormatPrice:E}),[J,f,F,p,l,E]),{price:D,basePrice:x,discount:d,discountAmount:g}=fe,{imageUrl:ue,altText:ge}=we(e),b=e?.custom_name||e?.title,L=ie&&l?.metafields?.infos?.page_short_title||b,K=e?.custom_description||e?.description,ye=()=>{if(p?.value_type==="fixed_amount"){const o=g||"",r=o.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(r){const[,i,n,a]=r;let c=n;return n.endsWith(".00")?c=n.replace(/\.00$/,""):n.endsWith(",00")&&(c=n.replace(/,00$/,"")),`${i}${c}${a}`}return o}return d||""};De(()=>{let o=[];if(d||g){const i=`${ye()} ${M?.off||H?.off||""}`;ce(i)}const r=e?.tags?.filter?.(i=>i?.startsWith?.("CLtag"))?.map?.(i=>i?.replace?.("CLtag:",""))?.slice?.(0,d&&C?1:2)||[];ae(o.concat(r))},[e?.tags,d,g,M?.off,H?.off,C]),Be(O,{componentType:te,componentName:oe,componentTitle:b,componentDescription:K,position:t?.index+1});const he=async()=>{if(!W&&!e?.custom_primary_link){R(!0);try{await pe(e,t?.index,t,p)}finally{R(!1)}}},ve=async()=>{if(!q&&!e?.custom_secondary_link){V(!0);try{await me(e,t?.index,t,p)}finally{V(!1)}}},ke={...N?{color:N}:{},...P?{backgroundColor:P,backgroundImage:"none"}:{},...N||P?{outline:"none"}:{}},xe={...k?{color:k}:{},...B?{backgroundColor:B,backgroundImage:"none"}:{},...k||B?{outlineColor:k}:{}},be=()=>m("div",{className:"lg-desktop:h-[28px] absolute left-0 top-0 z-10 box-border flex h-6 flex-wrap gap-1 overflow-hidden",children:[C&&U&&s(X,{className:"shelf-prices-tag",variant:"fill",style:ke,children:U||""}),re&&j?.length>0&&j?.map?.((o,r)=>s(X,{className:"shelf-items-tag",variant:"outline",style:xe,children:o},r))]}),_=e?.custom_bg_image,Q=e?.custom_theme;return s("div",{ref:O,className:S("box-border w-full cursor-pointer overflow-hidden duration-300","rounded-box","shelf-display-horizontal-item","lg-desktop:aspect-[824/269] desktop:aspect-[648/238] laptop:aspect-[440/256] relative",_?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":Q==="dark","aiui-light":Q==="light"}),style:_?{backgroundImage:`url(${_})`}:void 0,children:m("div",{className:"desktop:p-6 desktop:pt-4 absolute inset-0 box-border flex overflow-hidden p-4",children:[m("div",{className:"shelf-display-horizontal-left laptop:flex-[196] desktop:flex-[292] lg-desktop:flex-[380] relative flex h-full flex-none flex-col items-center justify-center gap-2",children:[s(be,{}),s("div",{className:S("shelf-display-horizontal-item-image desktop:h-[92.3%] lg-desktop:h-[89.5%] relative inline-block aspect-[1] h-[63.6%] min-h-0 overflow-hidden",{"opacity-0":_}),children:s("a",{"aria-label":b,target:t?.target,href:Ne(`${f==="us"||!f?"":`/${f}`}/products/${e?.handle}?variant=${de}`,`${te}_${oe}`),onClick:()=>{Ce({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||l?.sku,item_name:e?.name,item_variant:l?.name,price:l?.price,index:t?.index+1}]}})},children:s(Te,{source:ue,alt:ge,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),s(Le,{items:e?.socialEndorsements||I?.socialEndorsements})]}),m("div",{className:"shelf-display-horizontal-content desktop:flex-[332] desktop:pl-6 desktop:pt-2 lg-desktop:flex-[420] desktop:gap-6 flex min-w-0 flex-[224] flex-col justify-between gap-4 pl-4",children:[m("div",{className:"shelf-display-horizontal-content-title-desc",children:[L?s(Pe,{as:"h3",title:L||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:L||""}):null,s(Y,{size:2,className:S("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:K||""})]}),m("div",{className:"shelf-display-horizontal-content-price-button",children:[s("div",{className:"mb-2 flex flex-wrap items-center",children:z?z(e,{price:D,basePrice:x,discount:d,discountAmount:g,variant:l,coupon:p,isSoldOut:u,isShowOriginalPrice:v}):u?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:ne?.soldOutText}):m($e,{children:[s("div",{className:"final-price lg-desktop:text-2xl text-info-primary whitespace-nowrap text-xl font-bold !leading-[1.2]",children:l?.availableForSale&&D||""}),A?A(e,{price:D,basePrice:x,discount:d,discountAmount:g,isShowOriginalPrice:v}):x&&v&&s("div",{className:"origin-price lg-desktop:text-2xl text-info-quaternary ml-1 whitespace-nowrap text-xl font-bold !leading-[1.2] line-through",children:l?.availableForSale&&x||""})]})}),!z&&le?.(e,l,{isShowOriginalPrice:v}),m("div",{className:S("shelf-flex-button-group","lg-desktop:gap-3 desktop:flex-row flex flex-col items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!u?s(Z,{disabled:u&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:ve,loading:q,className:"laptop:w-full desktop:w-auto",children:t?.secondaryButton||""}):null,t?.primaryButton?s(Z,{disabled:u&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:he,loading:W,className:"laptop:w-full desktop:w-auto",children:t?.primaryButton||""}):null]})]})]})]})},e?.id||e?.handle)};export{Ke as ShelfDisplayHorizontalCardItem};
|
|
@@ -5,6 +5,7 @@ export type DropDownProps = {
|
|
|
5
5
|
setActive: any;
|
|
6
6
|
setVisible: any;
|
|
7
7
|
visible: any;
|
|
8
|
+
resolveName?: (item: any, sku?: string) => string;
|
|
8
9
|
};
|
|
9
|
-
declare const DropDown: ({ index, active, list, setActive, setVisible, visible }: DropDownProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const DropDown: ({ index, active, list, setActive, setVisible, visible, resolveName }: DropDownProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export default DropDown;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
2
|
-
${e?.handle===a?.handle?"bg-[#EAEAEC]":""}`,children:
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{useEffect as f,useRef as b}from"react";const m="openDropDown",v=({index:n,active:a,list:u,setActive:p,setVisible:d,visible:l,resolveName:c})=>{const i=b(null);return f(()=>{const e=o=>{const t=o?.target?.getAttribute?.("class");!i?.current?.contains(o?.target)&&!t?.includes(m)&&d({...l,[n]:!1})};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),s("div",{ref:i,className:`absolute left-0 top-[104%] z-30 box-border max-h-[340px] w-full overflow-auto rounded-lg bg-white ${l?.[n]?"block":"hidden"}`,children:s("div",{className:"dropdown-wrapper m-0 box-border h-full flex-1 overflow-hidden p-0 [&:last-child]:border-r-0",children:u?.map((e,o)=>{const t=e?.sku||e?.variants?.[0]?.sku,r=c?c(e,t):e?.name||e?.title;return s("div",{onClick:()=>{p({...a,[n]:{sku:t,name:r,handle:e?.handle}}),d({...l,[n]:!1})},title:r,className:`openDropDown min-xl:text-lg min-xxl:text-lg box-border cursor-pointer truncate px-6 py-4 text-base font-bold [&:hover]:bg-[#EAEAEC]
|
|
2
|
+
${e?.handle===a?.handle?"bg-[#EAEAEC]":""}`,children:r},o)})})})};var k=v;export{k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as P,jsx as n,jsxs as i}from"react/jsx-runtime";import X from"./dropdown.js";import{useAiuiContext as Y}from"../AiuiProvider/index.js";import{useMediaQuery as Z}from"react-responsive";import{useMemo as j,useState as b,useEffect as H,useCallback as ee}from"react";import{withLayout as te}from"../../shared/Styles.js";import{formatVariantPrice as se}from"../ShelfDisplay/shelfDisplay.js";import{Picture as C,Text as ne,Button as oe,Heading as M}from"../../components/index.js";import{cn as ae}from"../../helpers/index.js";import re,{useImperativeHandle as le,useRef as ce}from"react";const F=re.forwardRef(({data:u,buildData:d,onChange:R,onSecondaryChange:ie,className:_,...I},$)=>{const m=Z({query:"(max-width: 768px)"}),[l,g]=b({}),[h,O]=b([]),[S,L]=b(!1),[v,D]=b({}),A=ce(null),{locale:U="us",currencyDisplay:V,trackingData:B,currencyCode:z}=Y(),q=B?.showComparePrice??!0,{LeftMenu:E,RightMenu:y,DefaultSelectMenu:x}=j(()=>u?.data||{},[u?.data]),w=j(()=>{const e={};return(Array.isArray(u?.items)?u?.items:[]).forEach(t=>{t?.custom_name&&(t?.sku&&(e[t.sku]=t.custom_name),t?.handle&&(e[t.handle]=t.custom_name))}),e},[u?.items]),k=ee((e,s)=>w[s||""]||w[e?.handle||""]||e?.name||e?.title||"",[w]),Q=e=>{try{const t=new URL(e).pathname.toLowerCase();return/\.(jpeg|jpg|gif|png|webp|bmp|svg|tiff)$/.test(t)}catch{return/\.(jpeg|jpg|gif|png|webp|bmp|svg|tiff)$/i.test(e)}},W=(e,s)=>{const t=e?.variants?.find?.(c=>c?.sku===e?.sku),o=t?.coupons?.[0],{price:a,basePrice:r}=se({locale:z==="CAD"?"us":U||"us",amount:o?o?.variant_price4wscode:t?.price,baseAmount:o?t?.price:0,currencyDisplay:V,currencyCode:e?.price?.currencyCode||"USD"}),p=typeof x?.buttonText=="string"?x?.buttonText:x?.buttonText?.[String(s)]||"";return i("div",{className:"specs-sku-node-wrap box-border",children:[i(ne,{as:"div",className:"md-tablet:p-2 l-tablet:mb-4 l-tablet:text-sm desktop:px-6 lg-desktop:mb-8 lg-desktop:text-lg openDropDown specs-sku-node-text relative mb-6 box-border block rounded-[50px] border border-[#E4E5E6] bg-[#F5F5F7] px-6 py-4 text-base font-bold",onClick:()=>{if(h?.length<=1)return null;D({...v,[s]:!v?.[s]})},children:[i("div",{className:"flex items-center justify-between overflow-hidden",children:[n("div",{className:"openDropDown md-tablet:text-sm lg-desktop:text-lg specs-sku-node-title flex-1 truncate text-base",title:l?.[s]?.name||"",children:l?.[s]?.name||""}),h?.length>1?n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",className:"openDropDown",children:n("path",{d:"M6 9.5L12 15.5L18 9.5",stroke:"#1D1D1F",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),n(X,{index:s,list:h,active:l,setActive:g,visible:v,setVisible:D,resolveName:k})]}),n("div",{className:"lg-desktop:max-h-[196px] lg-desktop:max-w-[196px] max-h-[138px] max-w-[138px]",children:n(C,{source:t?.image?.url||"",className:"aspect-h-[280] aspect-w-[280]",imgClassName:"w-full h-full object-cover hover:scale-105 transition-all duration-300"})}),n("div",{className:"lg-desktop:text-2xl mb-2 mt-6 text-xl font-bold",children:n("div",{className:"lg-desktop:min-h-[32px] flex min-h-[28px] flex-wrap items-center gap-1",children:t?.availableForSale?i(P,{children:[n("div",{className:"specs-sku-node-price whitespace-nowrap text-[#080A0F]",children:a||""}),q&&r&&n("div",{className:"lg-desktop:text-2xl specs-sku-node-base-price whitespace-nowrap text-xl text-[#86868C] line-through",children:r})]}):null})}),p?n(oe,{onClick:()=>{R?.(e,s)},className:"specs-sku-node-button",children:p}):null]})},G=e=>e&&typeof e!="string"?i("div",{className:"size-full",children:[n("p",{className:"min-xxl:text-lg specs-normal-node-text text-base font-bold text-[#080A0F] md:text-sm",dangerouslySetInnerHTML:{__html:e?.text||""}}),n(C,{source:e?.imgUrl,className:"l:max-h-[174px] l:max-w-[174px] m-auto max-h-[360px] max-w-[360px]",imgClassName:"w-full h-full object-cover"})]}):n("div",{className:"break-all",children:Q(e)?n(C,{source:e,className:"l:max-h-[174px] l:max-w-[174px] m-auto max-h-[360px] max-w-[360px]",imgClassName:"w-full h-full object-cover"}):n("p",{className:"min-xxl:text-lg specs-normal-node-text text-base font-bold text-[#080A0F] md:text-sm",dangerouslySetInnerHTML:{__html:e||""}})}),T=e=>e.map((s,t)=>{const o=t===0;return i("div",{className:"l-tablet:flex l-tablet:flex-col box-border grid w-full cursor-pointer grid-cols-3 overflow-hidden border-t border-t-[#E4E5E6] specs-product-node-wrap",children:[n(M,{as:"h3",html:s||"",className:"tablet:py-6 l-tablet:text-[#86868C] desktop:p-6 lg-desktop:text-lg specs-product-node-title mr-4 flex-1 pt-4 text-base font-bold md:text-sm"}),n("div",{className:`l-tablet:w-full l-tablet:gap-4 laptop:gap-8 desktop:gap-12 desktop:p-6 lg-desktop:gap-16 grid-cols-${S?3:2} specs-product-node-body col-span-2 grid flex-1 py-6`,children:Object.keys(l)?.map?.(a=>{const r=l?.[a],p=y?.menus?.find?.(c=>c?.handle===r?.handle)?.subTitle;return G(p?.[s])})})]},s)}),J=e=>{if(!l)return;const{subTitle:s,isProduct:t}=e;return t?i(P,{children:[i("div",{className:"l-tablet:flex l-tablet:flex-col specs-content-item-product box-border grid w-full cursor-pointer grid-cols-3 border-t-0 border-t-[#E4E5E6]",children:[e?.title&&n(M,{as:"h3",html:e?.title||"",className:"lg-desktop:text-lg desktop:px-6 specs-product-node-title l:hidden specs-item-product-title py-4 text-base font-bold md:text-sm"}),n("div",{className:`l-tablet:w-full l-tablet:gap-4 laptop:gap-8 desktop:gap-12 desktop:px-6 desktop:pb-6 lg-desktop:gap-16 grid-cols-${S?3:2} specs-item-product-body col-span-2 grid flex-1 pb-4 pr-0`,children:Object.keys(l)?.map((o,a)=>{const r=l?.[o],p=d?.products?.find?.(c=>c?.handle===r?.handle);return n("div",{children:W({...p,item:o,sku:r?.sku},a)},o)})})]}),e?.categoryLabel&&n(M,{size:2,as:"h4",html:e?.categoryLabel||"",className:"desktop:p-6 specs-item-product-category py-6"}),s?.length?T(s):null]}):T(s)};return le($,()=>A.current),H(()=>{if(!d?.products?.length)return;const e=x?.sku?.split?.(",")||[],s=m&&e?.length>2?e?.slice(0,2):e;let t={};s?.forEach?.((a,r)=>{const c=y?.menus?.find?.(f=>f?.sku===a)?.handle,N=c?d?.products?.find?.(f=>f?.handle===c):d?.products?.find?.(f=>{if(f?.variants?.find?.(K=>K?.sku===a))return!0});N&&(t={...t,[r]:{sku:a,name:k(N,a),handle:N?.handle}})});const o=d?.products?.filter(a=>y?.menus?.find(r=>r?.handle===a?.handle));g(t),O(o),L(e?.length>2&&!m)},[d,m,k]),H(()=>{if(m){const e=Object.keys(l||{});if(e?.length>2){const s=e?.slice?.(0,2);let t={};s?.forEach?.(o=>{t={...t,[o]:l?.[o]}}),L(!1),g(t)}}},[m]),n("div",{...I,className:ae("specs-wrapper w-full overflow-hidden",_),ref:A,children:E?.data?n("div",{className:"specs-wrapper-content box-border w-full overflow-hidden",children:E?.data?.map?.((e,s)=>n("div",{className:"specs-wrapper-content-item w-full overflow-hidden pt-10 [&:first-child]:pt-0",children:J(e)},s))}):null})});F.displayName="Specs";var ye=te(F);export{ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a,jsxs as c}from"react/jsx-runtime";import{Fragment as s}from"react";import{cn as o}from"../helpers/utils.js";import{Container as m}from"./container.js";import d from"./link.js";import{Text as n}from"./text.js";import{useAiuiContext as f}from"../biz-components/AiuiProvider/index.js";const g=({data:l,sizeClass:t})=>{const{navCollapsed:i}=f();return a("div",{className:"aiui-dark relative z-[46] box-border h-[30px]",children:c(m,{childClassName:"flex !bg-container-primary items-center justify-between",className:"h-full",children:[a("div",{className:o("h-full items-center gap-3",i===void 0?"desktop:flex hidden":i?"hidden":"flex"),children:l?.leftIcon?.map?.((e,r)=>c(s,{children:[r>0&&a("span",{className:"bg-lines h-3 w-px","aria-hidden":"true"}),e?.link?a(d,{href:e?.link,variant:"secondary","aria-label":e?.label||e?.title,className:o("text-sm leading-[1.4] no-underline",t),children:a(n,{className:"board-left-icon","aria-hidden":"true",html:e?.logo||""})}):a(n,{className:"board-left-icon",html:e?.logo||""})]},r))}),a("div",{className:"flex h-full flex-1 items-center justify-end gap-2",children:l?.rightIcon?.map?.((e,r)=>a(s,{children:e?.link?a(d,{href:e?.link,variant:"secondary","aria-label":e?.label||e?.title,className:o("flex items-center text-sm leading-[1.4] no-underline",t),children:a(n,{className:"board-right-icon","aria-hidden":"true",html:e?.logo||""})}):a(n,{className:"board-right-icon",html:e?.logo||""})},r))})]})})};var k=g;export{k as default};
|
|
1
|
+
"use client";import{jsx as a,jsxs as c}from"react/jsx-runtime";import{Fragment as s}from"react";import{cn as o}from"../helpers/utils.js";import{Container as m}from"./container.js";import d from"./link.js";import{Text as n}from"./text.js";import{useAiuiContext as f}from"../biz-components/AiuiProvider/index.js";const g=({data:l,sizeClass:t})=>{const{navCollapsed:i}=f();return a("div",{className:"aiui-dark relative z-[46] box-border h-[30px]",children:c(m,{childClassName:"flex !bg-container-primary items-center justify-between",className:"h-full",children:[a("div",{className:o("h-full items-center gap-3",i===void 0?"desktop:flex hidden":i?"hidden":"flex"),children:l?.leftIcon?.map?.((e,r)=>c(s,{children:[r>0&&a("span",{className:"bg-lines h-3 w-px","aria-hidden":"true"}),e?.link?a(d,{href:e?.link,variant:"secondary","aria-label":e?.label||e?.title,className:o("text-sm leading-[1.4] no-underline",t),children:a(n,{className:"board-left-icon","aria-hidden":"true",html:e?.logo||""})}):a(n,{className:"board-left-icon",html:e?.logo||""})]},r))}),a("div",{className:"flex h-full flex-1 items-center justify-end gap-2",children:l?.rightIcon?.map?.((e,r)=>a(s,{children:e?.link?a(d,{href:e?.link,variant:"secondary","aria-label":e?.label||e?.title,className:o("flex items-center text-sm leading-[1.4] no-underline",t),children:a(n,{className:"board-right-icon","aria-hidden":"true",html:e?.logo||""})}):a(n,{className:"board-right-icon",html:e?.logo||""})},r))})]})})};var k=g;export{k as default};
|