@anker-in/headless-ui 1.3.66 → 1.3.68

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.
@@ -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:h-[28px] lg-desktop:flex-[28] box-border flex 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 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:flex-[28] box-border flex 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 +1 @@
1
- "use strict";var s=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var b=(e,n)=>{for(var r in n)s(e,r,{get:n[r],enumerable:!0})},E=(e,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of y(n))!L.call(e,t)&&t!==r&&s(e,t,{get:()=>n[t],enumerable:!(i=f(n,t))||i.enumerable});return e};var R=e=>E(s({},"__esModule",{value:!0}),e);var I={};b(I,{PRICE_SYMBOL:()=>S,extendLocaleMap:()=>A,formatPrice:()=>D,languageTerritory:()=>d});module.exports=R(I);const S={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",fr:"\u20AC",de:"\u20AC",nl:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED"},u={us:"en-US",uk:"en-GB",ca:"en-CA",au:"AU","eu-en":"en","eu-fr":"fr-FR",fr:"FR","ca-fr":"FR","nl-fr":"FR",my:"MY",it:"IT",vn:"VN",es:"es-ES","eu-it":"it-IT","eu-de":"de-DE",de:"de-DE","eu-es":"es-ES","cz-en":"en-CZ",nl:"nl-NL","dk-en":"en-DK","gr-en":"en-GR","mk-en":"en-MK","hu-en":"en-HU","se-en":"en-SE","hr-en":"en-HR","bg-en":"en-BG","ee-en":"en-EE","fi-en":"en-FI","lt-en":"en-LT",pl:"pl-PL","ro-en":"en-RO","si-en":"en-SI","sk-en":"en-SK","no-en":"en-NO","ad-en":"en-AD","al-en":"en-AL","ba-en":"en-BA","me-en":"en-ME","rs-en":"en-RS","gl-en":"en-GL","is-en":"en-IS","ua-en":"en-UA","by-en":"en-BY","md-en":"en-MD","lv-en":"en-LV","at-de":"de-AT","lu-de":"de-LU","li-de":"de-LI","va-it":"it-VA","sm-it":"it-SM","be-nl":"nl-BE","ae-en":"en-AE",nz:"en-NZ","sg-en":"en-SG","sa-en":"en-SA","vn-vi":"vi-VN",ie:"en-IE",tw:"zh-TW"};let c={},o=u;const A=e=>{c={...c,...e},o={...u,...c}},d=e=>o[e]||"";function D({amount:e,currencyCode:n,locale:r,maximumFractionDigits:i,minimumFractionDigits:t,removeTrailingZeros:m=!1,currencyDisplay:g="symbol"}){const p=r==="nl"?"EUR":n||"USD",l=d(r);if(!l)return null;let a=new Intl.NumberFormat(l,{style:"currency",currency:p,currencyDisplay:g,minimumFractionDigits:i===0?0:t,maximumFractionDigits:i})?.format?.(e);return["eu-de","eu-en","de","eu"].includes(r)&&(a=a?.toString()?.replace?.(/[\s]/g,"")),m&&(a=a?.replace?.(/(\.\d*?[1-9])0+\b/,"$1")?.replace?.(/\.0+\b/,"")?.replace?.(/(,\d*?[1-9])0+\b/,"$1")?.replace?.(/,0+\b/,"")),a}
1
+ "use strict";var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var b=(e,n)=>{for(var r in n)a(e,r,{get:n[r],enumerable:!0})},E=(e,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of y(n))!L.call(e,t)&&t!==r&&a(e,t,{get:()=>n[t],enumerable:!(s=f(n,t))||s.enumerable});return e};var R=e=>E(a({},"__esModule",{value:!0}),e);var I={};b(I,{PRICE_SYMBOL:()=>S,extendLocaleMap:()=>A,formatPrice:()=>D,languageTerritory:()=>d});module.exports=R(I);const S={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",fr:"\u20AC",de:"\u20AC",nl:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED"},u={us:"en-US",uk:"en-GB",ca:"en-CA",au:"AU","eu-en":"en","eu-fr":"fr-FR",fr:"FR","ca-fr":"FR","nl-fr":"FR",my:"MY",it:"IT",vn:"VN",es:"es-ES","eu-it":"it-IT","eu-de":"de-DE",de:"de-DE","eu-es":"es-ES","cz-en":"en-CZ",nl:"nl-NL","dk-en":"en-DK","gr-en":"en-GR","mk-en":"en-MK","hu-en":"en-HU","se-en":"en-SE","hr-en":"en-HR","bg-en":"en-BG","ee-en":"en-EE","fi-en":"en-FI","lt-en":"en-LT",pl:"pl-PL","ro-en":"en-RO","si-en":"en-SI","sk-en":"en-SK","no-en":"en-NO","ad-en":"en-AD","al-en":"en-AL","ba-en":"en-BA","me-en":"en-ME","rs-en":"en-RS","gl-en":"en-GL","is-en":"en-IS","ua-en":"en-UA","by-en":"en-BY","md-en":"en-MD","lv-en":"en-LV","at-de":"de-AT","lu-de":"de-LU","li-de":"de-LI","va-it":"it-VA","sm-it":"it-SM","be-nl":"nl-BE","ae-en":"en-AE",nz:"en-NZ","sg-en":"en-SG","sa-en":"en-SA","vn-vi":"vi-VN",ie:"en-IE",tw:"zh-TW",eu:"en",sg:"en-sg",plus:"en-us",cl:"es-cl",dk:"en-dk",fi:"en-fi",no:"en-no",is:"en-is",se:"en-se","eu-pl":"pl-PL"};let l={},o=u;const A=e=>{l={...l,...e},o={...u,...l}},d=e=>o[e]||"";function D({amount:e,currencyCode:n,locale:r,maximumFractionDigits:s,minimumFractionDigits:t,removeTrailingZeros:g=!1,currencyDisplay:m="symbol"}){const p=r==="nl"?"EUR":n||"USD",c=d(r);if(!c)return null;let i=new Intl.NumberFormat(c,{style:"currency",currency:p,currencyDisplay:m,minimumFractionDigits:s===0?0:t,maximumFractionDigits:s})?.format?.(e);return["eu-de","eu-en","de","eu"].includes(r)&&(i=i?.toString()?.replace?.(/[\s]/g,"")),g&&(i=i?.replace?.(/(\.\d*?[1-9])0+\b/,"$1")?.replace?.(/\.0+\b/,"")?.replace?.(/(,\d*?[1-9])0+\b/,"$1")?.replace?.(/,0+\b/,"")),i}
@@ -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:h-[28px] lg-desktop:flex-[28] box-border flex 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 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:flex-[28] box-border flex 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 +1 @@
1
- const f={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",fr:"\u20AC",de:"\u20AC",nl:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED"},s={us:"en-US",uk:"en-GB",ca:"en-CA",au:"AU","eu-en":"en","eu-fr":"fr-FR",fr:"FR","ca-fr":"FR","nl-fr":"FR",my:"MY",it:"IT",vn:"VN",es:"es-ES","eu-it":"it-IT","eu-de":"de-DE",de:"de-DE","eu-es":"es-ES","cz-en":"en-CZ",nl:"nl-NL","dk-en":"en-DK","gr-en":"en-GR","mk-en":"en-MK","hu-en":"en-HU","se-en":"en-SE","hr-en":"en-HR","bg-en":"en-BG","ee-en":"en-EE","fi-en":"en-FI","lt-en":"en-LT",pl:"pl-PL","ro-en":"en-RO","si-en":"en-SI","sk-en":"en-SK","no-en":"en-NO","ad-en":"en-AD","al-en":"en-AL","ba-en":"en-BA","me-en":"en-ME","rs-en":"en-RS","gl-en":"en-GL","is-en":"en-IS","ua-en":"en-UA","by-en":"en-BY","md-en":"en-MD","lv-en":"en-LV","at-de":"de-AT","lu-de":"de-LU","li-de":"de-LI","va-it":"it-VA","sm-it":"it-SM","be-nl":"nl-BE","ae-en":"en-AE",nz:"en-NZ","sg-en":"en-SG","sa-en":"en-SA","vn-vi":"vi-VN",ie:"en-IE",tw:"zh-TW"};let t={},c=s;const y=e=>{t={...t,...e},c={...s,...t}},g=e=>c[e]||"";function L({amount:e,currencyCode:l,locale:r,maximumFractionDigits:i,minimumFractionDigits:u,removeTrailingZeros:o=!1,currencyDisplay:d="symbol"}){const m=r==="nl"?"EUR":l||"USD",a=g(r);if(!a)return null;let n=new Intl.NumberFormat(a,{style:"currency",currency:m,currencyDisplay:d,minimumFractionDigits:i===0?0:u,maximumFractionDigits:i})?.format?.(e);return["eu-de","eu-en","de","eu"].includes(r)&&(n=n?.toString()?.replace?.(/[\s]/g,"")),o&&(n=n?.replace?.(/(\.\d*?[1-9])0+\b/,"$1")?.replace?.(/\.0+\b/,"")?.replace?.(/(,\d*?[1-9])0+\b/,"$1")?.replace?.(/,0+\b/,"")),n}export{f as PRICE_SYMBOL,y as extendLocaleMap,L as formatPrice,g as languageTerritory};
1
+ const f={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",fr:"\u20AC",de:"\u20AC",nl:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED"},a={us:"en-US",uk:"en-GB",ca:"en-CA",au:"AU","eu-en":"en","eu-fr":"fr-FR",fr:"FR","ca-fr":"FR","nl-fr":"FR",my:"MY",it:"IT",vn:"VN",es:"es-ES","eu-it":"it-IT","eu-de":"de-DE",de:"de-DE","eu-es":"es-ES","cz-en":"en-CZ",nl:"nl-NL","dk-en":"en-DK","gr-en":"en-GR","mk-en":"en-MK","hu-en":"en-HU","se-en":"en-SE","hr-en":"en-HR","bg-en":"en-BG","ee-en":"en-EE","fi-en":"en-FI","lt-en":"en-LT",pl:"pl-PL","ro-en":"en-RO","si-en":"en-SI","sk-en":"en-SK","no-en":"en-NO","ad-en":"en-AD","al-en":"en-AL","ba-en":"en-BA","me-en":"en-ME","rs-en":"en-RS","gl-en":"en-GL","is-en":"en-IS","ua-en":"en-UA","by-en":"en-BY","md-en":"en-MD","lv-en":"en-LV","at-de":"de-AT","lu-de":"de-LU","li-de":"de-LI","va-it":"it-VA","sm-it":"it-SM","be-nl":"nl-BE","ae-en":"en-AE",nz:"en-NZ","sg-en":"en-SG","sa-en":"en-SA","vn-vi":"vi-VN",ie:"en-IE",tw:"zh-TW",eu:"en",sg:"en-sg",plus:"en-us",cl:"es-cl",dk:"en-dk",fi:"en-fi",no:"en-no",is:"en-is",se:"en-se","eu-pl":"pl-PL"};let t={},l=a;const y=e=>{t={...t,...e},l={...a,...t}},m=e=>l[e]||"";function L({amount:e,currencyCode:c,locale:r,maximumFractionDigits:s,minimumFractionDigits:u,removeTrailingZeros:o=!1,currencyDisplay:d="symbol"}){const g=r==="nl"?"EUR":c||"USD",i=m(r);if(!i)return null;let n=new Intl.NumberFormat(i,{style:"currency",currency:g,currencyDisplay:d,minimumFractionDigits:s===0?0:u,maximumFractionDigits:s})?.format?.(e);return["eu-de","eu-en","de","eu"].includes(r)&&(n=n?.toString()?.replace?.(/[\s]/g,"")),o&&(n=n?.replace?.(/(\.\d*?[1-9])0+\b/,"$1")?.replace?.(/\.0+\b/,"")?.replace?.(/(,\d*?[1-9])0+\b/,"$1")?.replace?.(/,0+\b/,"")),n}export{f as PRICE_SYMBOL,y as extendLocaleMap,L as formatPrice,m as languageTerritory};
@@ -19,6 +19,7 @@
19
19
  --sidebar-shelf-radius: 6px;
20
20
  /* 图文圆角:<=1024px 为 12px */
21
21
  --image-text-radius: 12px;
22
+ --btn-text-active-color: #1E2024;
22
23
  }
23
24
 
24
25
  /* 侧边栏选中状态和货架组件圆角:>1024px 为 8px */
@@ -38,4 +39,5 @@
38
39
  --tabs-hover-foreground-color: #004966;
39
40
  --brand-gradient-color-0: linear-gradient(90deg, var(--brand-color-0) 0%, var(--brand-color-0) 100%);
40
41
  --badge-text-color: #080a0f;
42
+ --btn-text-active-color: #1E2024;
41
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anker-in/headless-ui",
3
- "version": "1.3.66",
3
+ "version": "1.3.68",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/cjs/index.d.ts",