@anker-in/headless-ui 1.3.84 → 1.3.86
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/README.md +6 -0
- package/dist/cjs/biz-components/AccordionCards/index.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +4 -3
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
- package/dist/cjs/biz-components/ActivityMechanism/index.d.ts +4 -7
- package/dist/cjs/biz-components/ActivityMechanism/index.js +1 -1
- package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/AnchorNavigation/index.js +1 -1
- package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/PriceAndActions.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/PriceAndActions.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +4 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductInfo.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductInfo.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/tracking.d.ts +20 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/tracking.js +1 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/types.d.ts +2 -0
- package/dist/cjs/biz-components/Category/index.d.ts +4 -2
- package/dist/cjs/biz-components/Category/index.js +1 -1
- package/dist/cjs/biz-components/Chat/action.d.ts +25 -0
- package/dist/cjs/biz-components/Chat/action.js +1 -0
- package/dist/cjs/biz-components/Chat/button.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/button.js +1 -0
- package/dist/cjs/biz-components/Chat/chatContext.d.ts +101 -0
- package/dist/cjs/biz-components/Chat/chatContext.js +1 -0
- package/dist/cjs/biz-components/Chat/exports.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/exports.js +1 -0
- package/dist/cjs/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
- package/dist/cjs/biz-components/Chat/helpers/fetchResponse.js +1 -0
- package/dist/cjs/biz-components/Chat/helpers/fetcher.d.ts +2 -0
- package/dist/cjs/biz-components/Chat/helpers/fetcher.js +1 -0
- package/dist/cjs/biz-components/Chat/index.d.ts +71 -0
- package/dist/cjs/biz-components/Chat/index.js +1 -0
- package/dist/cjs/biz-components/Chat/markdown.d.ts +5 -0
- package/dist/cjs/biz-components/Chat/markdown.js +1 -0
- package/dist/cjs/biz-components/Chat/messages.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/messages.js +1 -0
- package/dist/cjs/biz-components/Chat/props.d.ts +43 -0
- package/dist/cjs/biz-components/Chat/props.js +1 -0
- package/dist/cjs/biz-components/Chat/response.d.ts +4 -0
- package/dist/cjs/biz-components/Chat/response.js +1 -0
- package/dist/cjs/biz-components/Chat/suggestions.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/suggestions.js +1 -0
- package/dist/cjs/biz-components/Chat/utils.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/utils.js +1 -0
- package/dist/cjs/biz-components/Evaluate/index.js +1 -1
- package/dist/cjs/biz-components/EventSchedule/index.js +1 -1
- package/dist/cjs/biz-components/Faq/Faq.d.ts +3 -1
- package/dist/cjs/biz-components/Faq/Faq.js +2 -2
- package/dist/cjs/biz-components/FeatureCards/FeatureCards.js +1 -1
- package/dist/cjs/biz-components/GiftShelf/index.js +1 -1
- package/dist/cjs/biz-components/GiftTierShelf/index.js +1 -1
- package/dist/cjs/biz-components/Graphic/index.js +1 -1
- package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
- package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerMulti/index.js +1 -1
- package/dist/cjs/biz-components/MemberEquity/index.js +2 -2
- package/dist/cjs/biz-components/MiniCart/index.js +1 -1
- package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
- package/dist/cjs/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/cjs/biz-components/PromotionalBar/index.d.ts +3 -2
- package/dist/cjs/biz-components/PromotionalBar/index.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductsPanel.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/Root.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/context.d.ts +11 -1
- package/dist/cjs/biz-components/SceneShelf/context.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/types.d.ts +5 -0
- package/dist/cjs/biz-components/SearchPage/index.js +1 -1
- package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/cjs/biz-components/Title/index.js +1 -1
- package/dist/cjs/components/container.js +1 -1
- package/dist/cjs/helpers/utils.js +1 -1
- package/dist/cjs/shared/track.d.ts +13 -7
- package/dist/cjs/shared/track.js +1 -1
- package/dist/esm/biz-components/AccordionCards/index.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +4 -3
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
- package/dist/esm/biz-components/ActivityMechanism/index.d.ts +4 -7
- package/dist/esm/biz-components/ActivityMechanism/index.js +1 -1
- package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/AnchorNavigation/index.js +1 -1
- package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/PriceAndActions.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/PriceAndActions.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +4 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductInfo.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductInfo.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/tracking.d.ts +20 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/tracking.js +1 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/types.d.ts +2 -0
- package/dist/esm/biz-components/Category/index.d.ts +4 -2
- package/dist/esm/biz-components/Category/index.js +1 -1
- package/dist/esm/biz-components/Chat/action.d.ts +25 -0
- package/dist/esm/biz-components/Chat/action.js +1 -0
- package/dist/esm/biz-components/Chat/button.d.ts +3 -0
- package/dist/esm/biz-components/Chat/button.js +1 -0
- package/dist/esm/biz-components/Chat/chatContext.d.ts +101 -0
- package/dist/esm/biz-components/Chat/chatContext.js +1 -0
- package/dist/esm/biz-components/Chat/exports.d.ts +3 -0
- package/dist/esm/biz-components/Chat/exports.js +1 -0
- package/dist/esm/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
- package/dist/esm/biz-components/Chat/helpers/fetchResponse.js +1 -0
- package/dist/esm/biz-components/Chat/helpers/fetcher.d.ts +2 -0
- package/dist/esm/biz-components/Chat/helpers/fetcher.js +1 -0
- package/dist/esm/biz-components/Chat/index.d.ts +71 -0
- package/dist/esm/biz-components/Chat/index.js +1 -0
- package/dist/esm/biz-components/Chat/markdown.d.ts +5 -0
- package/dist/esm/biz-components/Chat/markdown.js +1 -0
- package/dist/esm/biz-components/Chat/messages.d.ts +3 -0
- package/dist/esm/biz-components/Chat/messages.js +1 -0
- package/dist/esm/biz-components/Chat/props.d.ts +43 -0
- package/dist/esm/biz-components/Chat/props.js +1 -0
- package/dist/esm/biz-components/Chat/response.d.ts +4 -0
- package/dist/esm/biz-components/Chat/response.js +1 -0
- package/dist/esm/biz-components/Chat/suggestions.d.ts +3 -0
- package/dist/esm/biz-components/Chat/suggestions.js +1 -0
- package/dist/esm/biz-components/Chat/utils.d.ts +3 -0
- package/dist/esm/biz-components/Chat/utils.js +1 -0
- package/dist/esm/biz-components/Evaluate/index.js +1 -1
- package/dist/esm/biz-components/EventSchedule/index.js +1 -1
- package/dist/esm/biz-components/Faq/Faq.d.ts +3 -1
- package/dist/esm/biz-components/Faq/Faq.js +2 -2
- package/dist/esm/biz-components/FeatureCards/FeatureCards.js +1 -1
- package/dist/esm/biz-components/GiftShelf/index.js +1 -1
- package/dist/esm/biz-components/GiftTierShelf/index.js +1 -1
- package/dist/esm/biz-components/Graphic/index.js +1 -1
- package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
- package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerMulti/index.js +1 -1
- package/dist/esm/biz-components/MemberEquity/index.js +2 -2
- package/dist/esm/biz-components/MiniCart/index.js +1 -1
- package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
- package/dist/esm/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/esm/biz-components/PromotionalBar/index.d.ts +3 -2
- package/dist/esm/biz-components/PromotionalBar/index.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductsPanel.js +1 -1
- package/dist/esm/biz-components/SceneShelf/Root.js +1 -1
- package/dist/esm/biz-components/SceneShelf/context.d.ts +11 -1
- package/dist/esm/biz-components/SceneShelf/context.js +1 -1
- package/dist/esm/biz-components/SceneShelf/types.d.ts +5 -0
- package/dist/esm/biz-components/SearchPage/index.js +1 -1
- package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/esm/biz-components/Title/index.js +1 -1
- package/dist/esm/components/container.js +1 -1
- package/dist/esm/helpers/utils.js +1 -1
- package/dist/esm/shared/track.d.ts +13 -7
- package/dist/esm/shared/track.js +1 -1
- package/dist/tokens/base.css +48 -0
- package/package.json +50 -3
- package/src/biz-components/Chat/styles/chat.css +14 -0
- package/src/biz-components/Chat/styles/css/animations.css +35 -0
- package/src/biz-components/Chat/styles/css/button.css +56 -0
- package/src/biz-components/Chat/styles/css/colors.css +12 -0
- package/src/biz-components/Chat/styles/css/console.css +134 -0
- package/src/biz-components/Chat/styles/css/header.css +43 -0
- package/src/biz-components/Chat/styles/css/input.css +89 -0
- package/src/biz-components/Chat/styles/css/markdown.css +131 -0
- package/src/biz-components/Chat/styles/css/messages.css +85 -0
- package/src/biz-components/Chat/styles/css/panel.css +23 -0
- package/src/biz-components/Chat/styles/css/popup.css +44 -0
- package/src/biz-components/Chat/styles/css/response.css +25 -0
- package/src/biz-components/Chat/styles/css/sidebar.css +31 -0
- package/src/biz-components/Chat/styles/css/suggestions.css +36 -0
- package/src/biz-components/Chat/styles/css/window.css +60 -0
- package/src/biz-components/Chat/styles/image.png +0 -0
- package/style.css +9 -12
- package/tailwind.config.js +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var he=Object.create;var
|
|
1
|
+
"use strict";"use client";var he=Object.create;var x=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var Be=Object.getPrototypeOf,Ie=Object.prototype.hasOwnProperty;var Me=(i,t)=>{for(var e in t)x(i,e,{get:t[e],enumerable:!0})},j=(i,t,e,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of ve(t))!Ie.call(i,c)&&c!==e&&x(i,c,{get:()=>t[c],enumerable:!(d=Te(t,c))||d.enumerable});return i};var h=(i,t,e)=>(e=i!=null?he(Be(i)):{},j(t||!i||!i.__esModule?x(e,"default",{value:i,enumerable:!0}):e,i)),Se=i=>j(x({},"__esModule",{value:!0}),i);var Le={};Me(Le,{default:()=>Ce,secondaryBannerVariants:()=>U});module.exports=Se(Le);var n=require("react/jsx-runtime"),u=h(require("react")),J=require("class-variance-authority"),C=require("react-responsive"),L=h(require("jump.js")),o=require("../../helpers/index.js"),a=require("../../components/index.js"),q=require("../../shared/Styles.js"),F=h(require("../Media/index.js")),W=require("../AiuiProvider/index.js"),G=require("../../hooks/useExposure.js"),g=require("../../shared/trackUrlRef.js"),b=require("../../shared/track.js"),Q=h(require("./SecondaryBannerCarousel.js"));const T="secondary_banner",U=(0,J.cva)("text-info-primary relative w-full",{variants:{size:{sm:"tablet:aspect-[768/480] laptop:aspect-[1024/480] desktop:aspect-[1440/480] lg-desktop:aspect-[1920/480] aspect-[390/480]",base:"tablet:aspect-[768/660] laptop:aspect-[1024/432] desktop:aspect-[1440/576] lg-desktop:aspect-[1920/720] aspect-[390/660]",lg:"tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660]",xlg:"tablet:aspect-[768/1320] laptop:aspect-[1024/864] desktop:aspect-[1440/1152] lg-desktop:aspect-[1920/1440] aspect-[390/1440] overflow-visible"}},defaultVariants:{size:"base"}}),$=u.forwardRef(({className:i,classNames:t={},data:e,jumpOptions:d={},isActive:c,a11yLabels:K,trackExposure:X=!0,frameIndex:v,...z},m)=>{const{pcImage:Y,padImage:Z,mobileImage:ee,isVideoLoop:te,endDate:N,endDate_tz:ne,dateFormat:ie,size:oe,iconArray:B,theme:ae,primaryButton:s,secondaryButton:r,title:y,titleTag:se}=e,re=te??!0,I=oe??"base",le=ae??"light",pe=se??"h2",{locale:R="us",pageHandle:ce}=(0,W.useAiuiContext)(),me=(0,C.useMediaQuery)({query:"(max-width: 767px)"}),de=(0,C.useMediaQuery)({query:"(min-width: 768px) and (max-width: 1024px)"}),D=me?e.mobileImage:de?e.padImage??e.pcImage:e.pcImage,f=(0,b.resolveComponentMediaType)(D?.mimeType==="video/mp4"),A=v??1,H=`${(0,g.buildTrackingRef)(ce??"",f,T)}${v===void 0?"":`_${v}`}`,M=D?.id||e.pcImage?.id||"",E=u.useRef(null),ue=u.useCallback(l=>{E.current=l,typeof m=="function"?m(l):m&&(m.current=l)},[m]),ge=u.useRef(null);(0,G.useExposure)(X?E:ge,{componentType:f,componentName:T,componentTitle:y?.trim()||"",componentDescription:e.subtitle?.trim()||"",position:1,creativeId:M});const be=!!(r?.link||typeof r?.onClick=="function"),ye=!!(s?.link||typeof s?.onClick=="function"),w=r?.link&&!r.link.startsWith("#")?(0,g.trackUrlRef)((0,o.getLocalizedPath)(r.link,R),H):void 0,O=s?.link&&!s.link.startsWith("#")?(0,g.trackUrlRef)((0,o.getLocalizedPath)(s.link,R),H):void 0,fe=(0,b.buildClickTrackingProps)({interactive:be,componentType:f,componentName:T,title:y,description:e.subtitle,buttonName:r?.text,position:A,creativeId:M}),ke=(0,b.buildClickTrackingProps)({interactive:ye,componentType:f,componentName:T,title:y,description:e.subtitle,buttonName:s?.text,position:A,creativeId:M}),P={...{duration:500,offset:0},...d},S=u.useId(),k=y?`${S}-title`:void 0,V=e.subtitle?`${S}-subtitle`:void 0,_=e.superTitle?`${S}-super-title`:void 0,xe=[_,V].filter(Boolean).join(" ")||void 0;return e.items&&e.items.length>0?(0,n.jsx)(Q.default,{data:e,className:i,classNames:t,jumpOptions:d,a11yLabels:K,ref:m,...z}):(0,n.jsxs)("section",{ref:ue,role:"banner","aria-labelledby":k,"aria-describedby":xe,className:(0,o.cn)({"aiui-dark":le==="dark"},U({size:I}),i,t?.root),...z,children:[(0,n.jsx)("div",{className:(0,o.cn)("absolute inset-0",{"h-fit":I==="xlg"}),children:(0,n.jsx)(F.default,{pcImage:Y,padImage:Z,mobileImage:ee,className:"size-full",imgClassName:"object-cover",videoClassName:"object-cover",muted:!0,loop:re,playsInline:!0,autoPlay:c??!0})}),(0,n.jsxs)("div",{className:(0,o.cn)("banner-content laptop:top-[min(50%,50vh)] laptop:-translate-y-1/2 px-grid absolute top-12 z-10 flex flex-col items-start justify-center text-left",t?.content),children:[(0,n.jsxs)("div",{className:"banner-inner-title desktop:gap-2 flex flex-col items-start gap-1",children:[e.superTitle&&(0,n.jsx)(a.Text,{as:"p",size:2,id:_,className:(0,o.cn)("banner-super-title desktop:text-[16px] lg-desktop:text-[18px]",t?.superTitle),html:e.superTitle}),e.title&&(0,n.jsx)(a.Heading,{as:pe,size:["xlg","lg"].includes(I)?5:4,id:k,className:(0,o.cn)("banner-title ",t?.title),html:e.title}),e.subtitle&&(0,n.jsx)(a.Text,{as:"p",size:3,id:V,className:(0,o.cn)("banner-subtitle desktop:text-[16px] lg-desktop:text-[18px]",t?.subtitle),html:e.subtitle})]}),N&&(0,n.jsx)("div",{className:"banner-countdown",children:(0,n.jsx)(a.Countdown,{endDate:N,endDate_tz:ne,dateFormat:ie,variant:"spacious",className:"lg-desktop:mt-8 mt-6"})}),(0,n.jsxs)("div",{className:(0,o.cn)("banner-cta-group lg-desktop:mt-[32px] lg-desktop:gap-3 mt-6 flex gap-2",t?.buttonGroup),children:[r?.text&&(0,n.jsx)(a.Button,{variant:"secondary",onClick:l=>{if(r.link?.startsWith("#")){l.preventDefault();const p=document.querySelector(r.link);p&&(0,L.default)(p,P)}r.onClick?.()},className:(0,o.cn)("",t?.secondaryButton),"aria-describedby":k,...w?{as:"a",href:w}:{},...fe,children:r.text}),s?.text&&(0,n.jsx)(a.Button,{onClick:l=>{if(s.link?.startsWith("#")){l.preventDefault();const p=document.querySelector(s.link);p&&(0,L.default)(p,P)}s.onClick?.()},className:(0,o.cn)("",t?.primaryButton),"aria-describedby":k,...O?{as:"a",href:O}:{},...ke,children:s.text})]}),Array.isArray(B)&&B.length>0&&(0,n.jsx)("div",{className:"banner-icons desktop:mt-3 lg-desktop:mt-4 mt-2 flex items-center gap-2",role:"group","aria-label":"brand icons",children:B.map((l,p)=>l.pcImage?(0,n.jsx)(a.Picture,{source:l.pcImage.url,alt:l.pcImage.alt||`icon ${p+1}`,role:"img",className:"laptop:h-auto h-[48px] max-w-none",imgClassName:"h-full"},p):null)})]})]})});$.displayName="SecondaryBanner";var Ce=(0,q.withLayout)($);
|
|
@@ -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,Ee=Object.prototype.hasOwnProperty;var Oe=(e,t)=>{for(var p in t)fe(e,p,{get:t[p],enumerable:!0})},Ie=(e,t,p,N)=>{if(t&&typeof t=="object"||typeof t=="function")for(let g of Fe(t))!Ee.call(e,g)&&g!==p&&fe(e,g,{get:()=>t[g],enumerable:!(N=Ae(t,g))||N.enumerable});return e};var Ne=(e,t,p)=>(p=e!=null?ze(Me(e)):{},Ie(t||!e||!e.__esModule?fe(p,"default",{value:e,enumerable:!0}):p,e)),je=e=>Ie(fe({},"__esModule",{value:!0}),e);var Re={};Oe(Re,{ShelfDisplayHorizontalItem:()=>Ue,ShelfDisplayWrapItem:()=>He,getProductImage:()=>De});module.exports=je(Re);var s=require("react/jsx-runtime"),Te=require("../AiuiProvider/index.js"),Ce=require("./shelfDisplay.js"),xe=Ne(require("../../components/picture.js")),ve=Ne(require("../../components/badge.js")),k=require("../../helpers/utils.js"),be=require("../../components/text.js"),se=Ne(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,N=p?.find(j=>j?.sku===t),g=N?.image?.url||p?.[0]?.image?.url||"",re=N?.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:N,metafields:g,isTopTag:re=!1,isShowTag:j,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,Te.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:T,onBuyNow:ee,onLearnMore:te,event:Se}=t||{};if(b){if(b==="AddCart"&&T)return T(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:T,onBuyNow:ee,onLearnMore:te,event:Se}=t||{};if(b){if(b==="AddCart"&&T)return T(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:E,basePrice:P,discount:L,discountAmount:O}=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=O||"",d=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(d){const[,u,f,b]=d;let T=f;return f.endsWith(".00")?T=f.replace(/\.00$/,""):f.endsWith(",00")&&(T=f.replace(/,00$/,"")),`${u}${T}${b}`}return i}return L||""};(0,c.useEffect)(()=>{let i=[];if(L||O){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,O,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 flex flex-1 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:E,basePrice:P,discount:L,discountAmount:O,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&&E||""}),Q?Q(e,{price:E,basePrice:P,discount:L,discountAmount:O,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] box-border flex min-h-6 flex-wrap gap-1 overflow-hidden",children:[z&&ce&&(0,s.jsx)(ve.default,{className:"shelf-prices-tag",variant:"fill",style:y,children:ce||""}),j&&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)("shelf-display-item box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300","rounded-box relative",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.jsxs)(s.Fragment,{children:[(0,s.jsx)(xe.default,{source:V,alt:ue,className:(0,k.cn)("absolute inset-0 size-full",{"opacity-0":v}),imgClassName:"size-full object-cover"}),(0,s.jsxs)("div",{className:"desktop:p-6 relative flex flex-1 flex-col p-4",children:[(0,s.jsx)(D,{}),m()]})]}):(0,s.jsxs)("div",{className:"desktop:gap-2 desktop:p-6 desktop:pt-4 flex flex-1 flex-col gap-1 p-4",children:[(0,s.jsx)(D,{}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-display-item-image lg-desktop:size-[240px] relative mx-auto size-[180px] 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}]}})},className:"block size-full",children:(0,s.jsx)(xe.default,{source:V,alt:ue,className:"size-full",imgClassName:"size-full object-cover"})}),(0,s.jsx)(We,{items:e?.socialEndorsements})]}),m()]})},e?.id||e?.handle)},Ue=({data:e,configuration:t})=>{const{itemShape:p,itemLength:N,metafields:g,isShowShortTitle:re,formatPrice:j,renderOriginalPrice:I,renderPriceLabel:ke,renderPrice:z}=t||{},{discounts:W,discountsCopy:H}=g||{},{locale:w="us",copyWriting:K,currencyDisplay:ie}=(0,Te.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:j}),[me,w,R,_?.variant_price4wscode,n,j]),{price:o,basePrice:M,discount:B,discountAmount:h}=_e,{imageUrl:S,altText:de}=De(e),q=e?.custom_name||e?.title,E=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)}}},O=async()=>{if(!X&&!e?.custom_secondary_link){Y(!0);try{await ne(e,t?.index,t,_)}finally{Y(!1)}}},V=()=>N>=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=()=>N>=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))}),E?(0,s.jsx)(Le.Heading,{as:"h3",title:E||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:E||""}):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:O,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 Fe=Object.create;var ye=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty;var We=(e,t)=>{for(var n in t)ye(e,n,{get:t[n],enumerable:!0})},Ae=(e,t,n,N)=>{if(t&&typeof t=="object"||typeof t=="function")for(let g of Ee(t))!je.call(e,g)&&g!==n&&ye(e,g,{get:()=>t[g],enumerable:!(N=Me(t,g))||N.enumerable});return e};var Ne=(e,t,n)=>(n=e!=null?Fe(Oe(e)):{},Ae(t||!e||!e.__esModule?ye(n,"default",{value:e,enumerable:!0}):n,e)),He=e=>Ae(ye({},"__esModule",{value:!0}),e);var Ve={};We(Ve,{ShelfDisplayHorizontalItem:()=>qe,ShelfDisplayWrapItem:()=>Re,getProductImage:()=>ze});module.exports=He(Ve);var s=require("react/jsx-runtime"),Ce=require("../AiuiProvider/index.js"),Be=require("./shelfDisplay.js"),ve=Ne(require("../../components/picture.js")),be=Ne(require("../../components/badge.js")),k=require("../../helpers/utils.js"),ke=require("../../components/text.js"),se=Ne(require("../../components/button.js")),Pe=require("../../shared/track.js"),Le=require("../../shared/trackUrlRef.js"),De=require("../../components/heading.js"),Ie=require("../../hooks/useExposure.js"),m=require("react"),$e=require("../../hooks/useTracking.js");const ge="image",he="product_shelf",xe=999999999e-2,ze=e=>{const t=e?.sku,n=e?.variants,N=n?.find(re=>re?.sku===t),g=N?.image?.url||n?.[0]?.image?.url||"",J=N?.image?.altText||n?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:g,altText:J}},Ue=({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,n)=>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"},n):(0,s.jsx)(ke.Text,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},n))}):null,Re=({data:e,configuration:t})=>{const{buildRef:n}=(0,$e.useTracking)(),{isDisplayBackImage:N=!1,itemShape:g,metafields:J,isTopTag:re=!1,isShowTag:ie,isShowOriginalPrice:$,isShowShortTitle:we=!1,isShowPricesTag:z=!1,pricesTagTextColor:j,pricesTagBgColor:W,itemsTagTextColor:w,itemsTagBgColor:K,formatPrice:oe,renderOriginalPrice:Q,renderPriceLabel:_e,renderPrice:H}=t||{},{locale:C="es",copyWriting:le,currencyDisplay:X}=(0,Ce.useAiuiContext)(),{discounts:Y,discountsCopy:ne}=J||{},ae=(0,m.useRef)(null),[a,ce]=(0,m.useState)([]),[me,A]=(0,m.useState)(""),[pe,F]=(0,m.useState)(!1),[_,U]=(0,m.useState)(!1),de=(i,d,u,f)=>{const{primaryFun:b,onAddCart:T,onBuyNow:ee,onLearnMore:te,event:Te}=t||{};if(b){if(b==="AddCart"&&T)return T(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)}Te?.primaryButton?.(i,d+1,u,f)},Se=(i,d,u,f)=>{const{secondaryFun:b,onAddCart:T,onBuyNow:ee,onLearnMore:te,event:Te}=t||{};if(b){if(b==="AddCart"&&T)return T(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)}Te?.secondaryButton?.(i,d+1,u,f)},o=(0,m.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===xe||o?.price===xe,S=o?.coupons?.[0],ue=e?.price?.currencyCode||"USD",R=(0,m.useMemo)(()=>(0,Be.formatVariantPrice)({locale:C,amount:S?S?.variant_price4wscode:o?.price,baseAmount:S?o?.price:0,currencyCode:ue,currencyDisplay:X,customFormatPrice:oe}),[ue,C,S,X,o,oe]),{price:E,basePrice:P,discount:L,discountAmount:O}=R,{imageUrl:q,altText:fe}=ze(e),V=e?.custom_name||e?.title,D=we&&o?.metafields?.infos?.page_short_title||V,Z=e?.custom_description||e?.description,r=()=>{if(S?.value_type==="fixed_amount"){const i=O||"",d=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(d){const[,u,f,b]=d;let T=f;return f.endsWith(".00")?T=f.replace(/\.00$/,""):f.endsWith(",00")&&(T=f.replace(/,00$/,"")),`${u}${T}${b}`}return i}return L||""};(0,m.useEffect)(()=>{let i=[];if(L||O){const u=`${r()} ${Y?.off||ne?.off||""}`;A(u)}const d=e?.tags?.filter?.(u=>u?.startsWith?.("CLtag"))?.map?.(u=>u?.replace?.("CLtag:",""))?.slice?.(0,L&&z?1:2)||[];ce(i.concat(d))},[e?.tags,L,O,z,Y?.off,ne?.off]),(0,Ie.useExposure)(ae,{componentType:ge,componentName:he,componentTitle:V,componentDescription:Z,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){F(!0);try{await de(e,t?.index,t,S)}finally{F(!1)}}},c=async()=>{if(!_&&!e?.custom_secondary_link){U(!0);try{await Se(e,t?.index,t,S)}finally{U(!1)}}},p=()=>(0,s.jsxs)("div",{className:"shelf-display-product-content desktop:gap-6 flex flex-1 flex-col justify-between gap-4",children:[(0,s.jsxs)("div",{className:"shelf-display-product-content-title-desc",children:[D?(0,s.jsx)(De.Heading,{as:"h3",title:D||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:D||""}):null,(0,s.jsx)(ke.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:H?H(e,{price:E,basePrice:P,discount:L,discountAmount:O,variant:o,coupon:S,isSoldOut:h,isShowOriginalPrice:$}):h?(0,s.jsx)("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:le?.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&&E||""}),Q?Q(e,{price:E,basePrice:P,discount:L,discountAmount:O,isShowOriginalPrice:$}):P&&$&&(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||""})]})}),!H&&_e?.(e,o,{isShowOriginalPrice:$}),(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:c,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={...j?{color:j}:{},...W?{backgroundColor:W,backgroundImage:"none"}:{},...j||W?{outline:"none"}:{}},x={...w?{color:w}:{},...K?{backgroundColor:K,backgroundImage:"none"}:{},...w||K?{outlineColor:w}:{}},I=()=>(0,s.jsxs)("div",{className:"lg-desktop:min-h-[28px] box-border flex min-h-6 flex-wrap gap-1 overflow-hidden",children:[z&&me&&(0,s.jsx)(be.default,{className:"shelf-prices-tag",variant:"fill",style:y,children:me||""}),ie&&a?.length>0&&a?.map?.((i,d)=>(0,s.jsx)(be.default,{className:"shelf-items-tag",variant:"outline",style:x,children:i},d))]}),v=e?.custom_bg_image,G=e?.custom_theme;return(0,s.jsx)("div",{ref:ae,className:(0,k.cn)("shelf-display-item box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300","rounded-box relative",v?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":G==="dark","aiui-light":G==="light"}),style:v?{backgroundImage:`url(${v})`}:void 0,children:N?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ve.default,{source:q,alt:fe,className:(0,k.cn)("absolute inset-0 size-full",{"opacity-0":v}),imgClassName:"size-full object-cover"}),(0,s.jsxs)("div",{className:"desktop:p-6 relative flex flex-1 flex-col p-4",children:[(0,s.jsx)(I,{}),p()]})]}):(0,s.jsxs)("div",{className:"desktop:gap-2 desktop:p-6 desktop:pt-4 flex flex-1 flex-col gap-1 p-4",children:[(0,s.jsx)(I,{}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-display-item-image lg-desktop:size-[240px] relative mx-auto size-[180px] overflow-hidden",{"opacity-0":v}),children:[(0,s.jsx)("a",{"aria-label":V,target:t?.target,href:(0,Le.trackUrlRef)(`${C==="us"||!C?"":`/${C}`}/products/${e?.handle}?variant=${B}`,n(ge,he)),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||o?.sku,item_name:e?.name,item_variant:o?.name,price:o?.price,index:t?.index+1}]}})},className:"block size-full",children:(0,s.jsx)(ve.default,{source:q,alt:fe,className:"size-full",imgClassName:"size-full object-cover"})}),(0,s.jsx)(Ue,{items:e?.socialEndorsements})]}),p()]})},e?.id||e?.handle)},qe=({data:e,configuration:t})=>{const{buildRef:n}=(0,$e.useTracking)(),{itemShape:N,itemLength:g,metafields:J,isShowShortTitle:re,formatPrice:ie,renderOriginalPrice:$,renderPriceLabel:we,renderPrice:z}=t||{},{discounts:j,discountsCopy:W}=J||{},{locale:w="us",copyWriting:K,currencyDisplay:oe}=(0,Ce.useAiuiContext)(),[Q,_e]=(0,m.useState)([]),H=(0,m.useRef)(null),[C,le]=(0,m.useState)(!1),[X,Y]=(0,m.useState)(!1),ne=(r,l,c,p)=>{const{primaryFun:y,onAddCart:x,onBuyNow:I,onLearnMore:v,event:G}=t||{};if(y){if(y==="AddCart"&&x)return x(r,l+1,c,p);if(y==="BuyNow"&&I)return I(r,l+1,c,p);if(y==="LearnMore"&&v)return v(r,l+1,c,p)}G?.primaryButton?.(r,l+1,c,p)},ae=(r,l,c,p)=>{const{secondaryFun:y,onAddCart:x,onBuyNow:I,onLearnMore:v,event:G}=t||{};if(y){if(y==="AddCart"&&x)return x(r,l+1,c,p);if(y==="BuyNow"&&I)return I(r,l+1,c,p);if(y==="LearnMore"&&v)return v(r,l+1,c,p)}G?.secondaryButton?.(r,l+1,c,p)},a=(0,m.useMemo)(()=>{const r=e?.variants||[];if(r.length)return e?.sku&&r.find(l=>l?.sku===e?.sku)||r[0]},[e?.sku,e?.variants]),ce=a?.id?.split?.("/")||[],me=ce?.[ce?.length-1],A=!a?.availableForSale||a?.price?.amount===xe||a?.price===xe,pe=t?.isShowTag,F=t?.isShowOriginalPrice,_=a?.coupons?.[0],U=!!(F&&_),de=e?.price?.currencyCode||"USD",Se=(0,m.useMemo)(()=>(0,Be.formatVariantPrice)({locale:w,amount:U?_?.variant_price4wscode:a?.price,baseAmount:U?a?.price:0,currencyCode:de,currencyDisplay:oe,customFormatPrice:ie}),[de,w,U,_?.variant_price4wscode,a,ie]),{price:o,basePrice:M,discount:B,discountAmount:h}=Se,{imageUrl:S,altText:ue}=ze(e),R=e?.custom_name||e?.title,E=re&&a?.metafields?.infos?.page_short_title||R,P=e?.custom_description||e?.description;(0,Ie.useExposure)(H,{componentType:ge,componentName:he,componentTitle:R,componentDescription:P,position:t?.index+1});const L=async()=>{if(!C&&!e?.custom_primary_link){le(!0);try{await ne(e,t?.index,t,_)}finally{le(!1)}}},O=async()=>{if(!X&&!e?.custom_secondary_link){Y(!0);try{await ae(e,t?.index,t,_)}finally{Y(!1)}}},q=()=>g>=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"},fe=()=>g>=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",V=()=>{if(_?.value_type==="fixed_amount"){const r=h||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,c,p,y]=l;let x=p;return p.endsWith(".00")?x=p.replace(/\.00$/,""):p.endsWith(",00")&&(x=p.replace(/,00$/,"")),`${c}${x}${y}`}return r}return B||""};(0,m.useEffect)(()=>{let r=[];if(B||h){const c=`${V()} ${j?.off||W?.off||""}`;r.push(c)}const l=e?.tags?.filter?.(c=>c?.startsWith?.("CLtag"))?.map?.(c=>c?.replace?.("CLtag:",""))?.slice?.(0,B?1:2)||[];_e(r.concat(l))},[e?.tags,B,h,j?.off,W?.off]);const D=e?.custom_bg_image,Z=e?.custom_theme;return(0,s.jsx)("div",{ref:H,className:(0,k.cn)(q().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",D?"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:D?{backgroundImage:`url(${D})`}:void 0,children:(0,s.jsxs)("div",{className:(0,k.cn)(fe(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[(0,s.jsx)("div",{className:(0,k.cn)(q().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":D}),children:(0,s.jsx)("a",{"aria-label":R,target:t?.target,href:(0,Le.trackUrlRef)(`${w==="us"||!w?"":`/${w}`}/products/${e?.handle}?variant=${me}`,n(ge,he)),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||a?.sku,item_name:e?.name,item_variant:a?.name,price:a?.price,index:t?.index+1}]}})},children:(0,s.jsx)(ve.default,{source:S,alt:ue,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",q().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)(be.default,{className:"shelf-items-tag",variant:"fill",children:r},l))}),E?(0,s.jsx)(De.Heading,{as:"h3",title:E||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:E||""}):null,P?(0,s.jsx)(ke.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:a,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:a?.availableForSale&&o||""}),$?$(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:a?.availableForSale&&M||""})]})}),!z&&we?.(e,a,{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:O,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";"use client";var
|
|
1
|
+
"use strict";"use client";var I=Object.create;var f=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var W=(o,r)=>{for(var a in r)f(o,a,{get:r[a],enumerable:!0})},S=(o,r,a,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of $(r))!V.call(o,s)&&s!==a&&f(o,s,{get:()=>r[s],enumerable:!(u=U(r,s))||u.enumerable});return o};var A=(o,r,a)=>(a=o!=null?I(O(o)):{},S(r||!o||!o.__esModule?f(a,"default",{value:o,enumerable:!0}):a,o)),q=o=>S(f({},"__esModule",{value:!0}),o);var K={};W(K,{default:()=>J});module.exports=q(K);var t=require("react/jsx-runtime"),i=A(require("react")),l=require("../../components/index.js"),n=require("../../helpers/utils.js"),L=require("../../shared/Styles.js"),z=require("../../hooks/useExposure.js"),E=require("../AiuiProvider/index.js"),R=require("../../hooks/useTracking.js"),D=require("../../shared/trackUrlRef.js"),h=require("../../shared/track.js"),p=require("swiper/react"),v=require("swiper/modules"),X=require("swiper/css"),Y=require("swiper/css/navigation"),Z=require("swiper/css/pagination"),ee=require("swiper/css/effect-coverflow");const w="carousel",b="three_d_carousel",F=()=>(0,t.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]",children:[(0,t.jsx)("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),(0,t.jsx)("path",{d:"M32 20L24 28L32 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),G=()=>(0,t.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]",children:[(0,t.jsx)("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),(0,t.jsx)("path",{d:"M24 20L32 28L24 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),C=i.default.forwardRef(({data:o,className:r},a)=>{const{title:u,items:s=[],titleTag:P}=o,g=s.length<4?[...s,...s]:s,c=(0,i.useRef)(null),x=(0,i.useRef)(null),_=(0,i.useRef)(null),[j,B]=i.default.useState(180),{locale:k="us"}=(0,E.useAiuiContext)(),{buildRef:H}=(0,R.useTracking)(),y=e=>e?(0,D.trackUrlRef)((0,n.getLocalizedPath)(e,k),H(w,b)):(0,n.getLocalizedPath)("",k),N=e=>e.buttonLink?{"data-headless-type-name":`${w}#${b}`,"data-headless-title-desc-button":`${(0,h.toPlainTrackingText)(e.title)}#${(0,h.toPlainTrackingText)(e.description)}#${(0,h.toPlainTrackingText)(e.buttonText)}`,"data-headless-nav-position":`#${s.indexOf(e)+1}`}:{};return(0,z.useExposure)(x,{componentType:w,componentName:b,componentTitle:u}),(0,i.useImperativeHandle)(a,()=>x.current),i.default.useEffect(()=>{const e=_.current;if(!e)return;const d=()=>{const M=e.offsetWidth,T=Math.round(M*.125);B(T),c.current?.params?.coverflowEffect&&(c.current.params.coverflowEffect.stretch=T,c.current.update())};d();const m=new ResizeObserver(d);return m.observe(e),()=>m.disconnect()},[]),(0,t.jsxs)("section",{ref:x,"data-ui-component-id":"ThreeDCarousel",className:(0,n.cn)("three-d-carousel laptop:overflow-hidden w-full overflow-visible",r),children:[(0,t.jsx)(l.Heading,{as:P??"h2",size:4,html:u,className:"three-d-carousel__title laptop:text-center text-left"}),(0,t.jsxs)("div",{ref:_,className:"three-d-carousel__desktop laptop:block relative mx-auto mt-[24px] hidden w-full",children:[(0,t.jsx)(p.Swiper,{onSwiper:e=>c.current=e,centeredSlides:!0,initialSlide:0,loop:!0,slidesPerView:"auto",spaceBetween:0,grabCursor:!0,modules:[v.EffectCoverflow,v.Navigation],slideToClickedSlide:!0,className:"three-d-carousel__swiper rounded-box relative aspect-[1386/502] overflow-visible",effect:"coverflow",coverflowEffect:{rotate:0,stretch:j,depth:300,modifier:1,slideShadows:!0},children:g.map((e,d)=>(0,t.jsx)(p.SwiperSlide,{className:"three-d-carousel__slide relative !w-1/2 cursor-grab overflow-hidden opacity-0 [.swiper-slide-active&]:opacity-100 [.swiper-slide-next&]:opacity-100 [.swiper-slide-prev&]:opacity-100",children:({isActive:m})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.Picture,{source:e.imageUrl?.url||"",alt:e.imageUrl?.alt||e.title,className:(0,n.cn)("three-d-carousel__image rounded-box mx-auto h-full overflow-hidden"),imgClassName:"h-full object-cover",style:{filter:m?"":"brightness(50%) contrast(120%)"}}),(0,t.jsxs)("div",{className:(0,n.cn)("three-d-carousel__image-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 box-border flex size-full flex-col justify-end gap-1 p-[16px]",{"aiui-dark":e.theme==="dark","opacity-0":!m}),children:[(0,t.jsx)(l.Heading,{as:"h2",size:2,html:e.title}),(0,t.jsx)(l.Text,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-description lg-desktop:text-[18px] desktop:text-[16px] text-[14px]"}),e.buttonText&&(0,t.jsx)("a",{href:y(e.buttonLink),...N(e),className:"three-d-carousel__image-link ",children:(0,t.jsx)(l.Button,{size:"base",variant:"secondary",className:"three-d-carousel__image-button desktop:mt-6 mt-4",children:e.buttonText})})]})]})},d))}),(0,t.jsxs)("div",{className:"three-d-carousel__nav-controls laptop:px-[64px] desktop:px-[140px] lg-desktop:px-[200px] absolute left-1/2 top-1/2 z-20 flex w-full -translate-x-1/2 -translate-y-1/2 justify-between",children:[(0,t.jsx)("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--prev",onClick:()=>c.current?.slidePrev(),"aria-label":"Previous slide",children:(0,t.jsx)(F,{})}),(0,t.jsx)("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--next",onClick:()=>c.current?.slideNext(),"aria-label":"Next slide",children:(0,t.jsx)(G,{})})]})]}),(0,t.jsx)("div",{className:"three-d-carousel__mobile laptop:hidden mt-[24px] block w-full overflow-visible",children:(0,t.jsx)(p.Swiper,{loop:!0,loopAdditionalSlides:1,slidesPerView:"auto",spaceBetween:12,grabCursor:!0,className:"three-d-carousel__swiper-mobile relative w-full !overflow-visible",children:g.map((e,d)=>(0,t.jsxs)(p.SwiperSlide,{className:"three-d-carousel__slide-mobile relative !h-[360px] !w-[296px] cursor-grab overflow-hidden",children:[(0,t.jsx)(l.Picture,{source:e.mobImageUrl?.url||e.imageUrl?.url||"",alt:e.mobImageUrl?.alt||e.title,className:"three-d-carousel__image-mobile rounded-box mx-auto h-full overflow-hidden",imgClassName:"h-full object-cover"}),(0,t.jsxs)("div",{className:(0,n.cn)("three-d-carousel__image-mobile-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 flex size-full flex-col justify-end gap-1 p-[16px]",{"aiui-dark":e.theme==="dark"}),children:[(0,t.jsx)(l.Heading,{as:"h2",size:2,html:e.title}),(0,t.jsx)(l.Text,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-mobile-description text-[14px]"}),e.buttonText&&(0,t.jsx)("a",{href:y(e.buttonLink),...N(e),className:"three-d-carousel__image-mobile-link ",children:(0,t.jsx)(l.Button,{size:"base",variant:"secondary",className:"three-d-carousel__image-mobile-button mt-3",children:e.buttonText})})]})]},d))})})]})});C.displayName="ThreeDCarousel";var J=(0,L.withLayout)(C,{style:"overflow: hidden;"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var ft=Object.create;var b=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var xt=Object.getPrototypeOf,wt=Object.prototype.hasOwnProperty;var bt=(t,n)=>{for(var e in n)b(t,e,{get:n[e],enumerable:!0})},j=(t,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of ht(n))!wt.call(t,l)&&l!==e&&b(t,l,{get:()=>n[l],enumerable:!(o=gt(n,l))||o.enumerable});return t};var yt=(t,n,e)=>(e=t!=null?ft(xt(t)):{},j(n||!t||!t.__esModule?b(e,"default",{value:t,enumerable:!0}):e,t)),Tt=t=>j(b({},"__esModule",{value:!0}),t);var Ct={};bt(Ct,{default:()=>Lt});module.exports=Tt(Ct);var r=require("react/jsx-runtime"),s=yt(require("react")),y=require("gsap"),P=require("gsap/dist/SplitText"),R=require("gsap/dist/ScrollTrigger"),a=require("../../helpers/utils.js"),c=require("../../components/index.js"),_=require("../../shared/Styles.js"),W=require("../AiuiProvider/index.js"),Z=require("../../hooks/useExposure.js"),q=require("../../hooks/useTracking.js"),F=require("@payloadcms/richtext-lexical/plaintext"),G=require("../../shared/trackUrlRef.js"),J=require("react-intersection-observer");const M="link",z="title";function vt(t){if(!t)return!1;if(typeof t=="string")return t.trim().length>0;const n=t?.root?.children;return!Array.isArray(n)||n.length===0?!1:n.some(e=>{const o=e?.children;return!Array.isArray(o)||o.length===0?!1:o.some(l=>typeof l?.text=="string"&&l.text.length>0)})}function g(t){if(!t)return"";if(typeof t=="string")return t;try{return(0,F.convertLexicalToPlaintext)({data:t})||""}catch{return""}}const kt="text-info-primary desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]",O=({data:t,onClick:n,className:e})=>{const{extensions:o,title:l,caption:h,subtitle:T,align:x}=t,{locale:v="us"}=(0,W.useAiuiContext)(),{buildRef:u}=(0,q.useTracking)();if(!o?.textLink)return null;const w=o?.link?(0,G.trackUrlRef)((0,a.getLocalizedPath)(o.link,v),u(M,z)):void 0;return(0,r.jsxs)("a",{className:(0,a.cn)("text-info-primary hover:text-brand-0 lg-desktop:text-base flex cursor-pointer items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]",{"justify-center mt-4":x==="center"},{"mt-1 laptop:mt-0":x==="left"},e),...w?{href:w}:{},"data-headless-type-name":`${M}#${z}`,"data-headless-title-desc-button":`${g(h||l)}#${g(T)}#${g(o.textLink)}`,...n?{onClick:n}:{},children:[(0,r.jsx)("div",{className:"truncate whitespace-nowrap",children:o?.textLink}),(0,r.jsx)("div",{className:"lg-desktop:size-5 size-4",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:(0,r.jsx)("path",{d:"M5.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z",fill:"currentColor",className:"transition-all duration-[0.4s]"})})})]})},U=s.default.forwardRef(({data:t,className:n,classNames:e,as:o="h2",weight:l="bold",onButtonClick:h,id:T,...x},v)=>{const{title:u,titleSize:w=4,caption:k,subtitle:L,content:N,countdown:i,showCountdown:K=!1,theme:S="light",extensions:A,align:p="left"}=t,C=(0,s.useRef)(null),m=(0,s.useRef)(null),d=(0,s.useRef)(null),f=(0,s.useRef)(null),[Q,X]=(0,s.useState)(!0),{ref:Y,inView:V}=(0,J.useInView)();(0,s.useImperativeHandle)(v,()=>C.current),(0,Z.useExposure)(C,{componentType:M,componentName:z,componentTitle:g(k||u),componentDescription:g(L)});const tt=()=>{X(!1)},et=i?.targetDateTime||i?.targetDate||"",nt=i?.targetDateTime_tz,rt=i?.labels?{day:i.labels.days||"Day",hour:i.labels.hours||"Hours",minute:i.labels.minutes||"Mins",second:i.labels.seconds||"Secs"}:void 0;return(0,s.useEffect)(()=>{y.gsap.registerPlugin(P.SplitText,R.ScrollTrigger);function ot(){if(!m.current)return;const it=m.current?.clientHeight||80;d.current&&d.current.revert(),f.current&&f.current.kill(),d.current=new P.SplitText(m.current,{type:"words",wordsClass:"word"});const H=d.current.words;y.gsap.set(H,{opacity:0}),f.current=R.ScrollTrigger.create({trigger:m.current,start:"bottom bottom-=4%",end:`bottom+=${it*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:st=>{const lt=st.progress,$=H.length||1,at=.5,D=1/$,B=D*(1-at),I=($-1)*B+D,ct=Math.min(1,I>0?lt/I:0);H.forEach((dt,ut)=>{const pt=ut*B,mt=D;let E=(ct-pt)/mt;E=Math.max(0,Math.min(1,E)),y.gsap.set(dt,{opacity:E})})}})}return V&&ot(),()=>{d.current&&d.current.revert(),f.current&&f.current.kill()}},[V]),(0,r.jsxs)("div",{id:A?.id?A?.id:T,className:(0,a.cn)("titleBottom title-box flex items-end justify-between gap-2 pb-6",{"aiui-dark":S==="dark"},n,e?.wrapper),...x,ref:C,children:[(0,r.jsxs)("div",{ref:Y,className:(0,a.cn)("flex-1",e?.container,{"text-center":p==="center","text-left":p==="left"}),children:[(k||u)&&(0,r.jsx)(c.Heading,{ref:m,as:o,size:w,html:k||u,weight:l,className:(0,a.cn)("text-info-primary",e?.title)}),L&&(0,r.jsx)(c.Text,{html:L,as:"div",className:(0,a.cn)(kt,e?.subtitle)}),vt(N)&&(0,r.jsx)(c.Text,{html:N,as:"div",size:4,className:(0,a.cn)("title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]",e?.content)}),(0,r.jsx)(O,{data:t,className:(0,a.cn)({"laptop:hidden":p==="left"},e?.button),onClick:h}),K&&i&&Q&&(0,r.jsx)(c.Countdown,{endDate:et,endDate_tz:nt,timeLabels:rt,showDays:i?.showDays,showHours:i?.showHours,showMinutes:i?.showMinutes,showSeconds:i?.showSeconds,theme:S,onExpire:tt,hideWhenExpired:!0,align:p==="center"?"center":"left",className:(0,a.cn)("mt-4",e?.countdown)})]}),(0,r.jsx)(O,{data:t,className:(0,a.cn)("hidden",{"laptop:flex":p==="left"},e?.button),onClick:h})]})});U.displayName="Title";var Lt=(0,_.withLayout)(U);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var h=Object.create;var s=Object.defineProperty;var
|
|
1
|
+
"use strict";var h=Object.create;var s=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var T=(e,o)=>{for(var t in o)s(e,t,{get:o[t],enumerable:!0})},x=(e,o,t,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of k(o))!v.call(e,p)&&p!==t&&s(e,p,{get:()=>o[p],enumerable:!(a=S(o,p))||a.enumerable});return e};var B=(e,o,t)=>(t=e!=null?h(P(e)):{},x(o||!e||!e.__esModule?s(t,"default",{value:e,enumerable:!0}):t,e)),M=e=>x(s({},"__esModule",{value:!0}),e);var w={};T(w,{Container:()=>i});module.exports=M(w);var n=require("react/jsx-runtime"),r=B(require("react")),m=require("../helpers/utils.js"),y=require("@radix-ui/react-slot");const Y=({children:e})=>(0,n.jsx)(n.Fragment,{children:e}),C=r.default.forwardRef(({...e},o)=>{const{asChild:t,children:a,className:p,childClassName:c,spaceY:l="none",spaceTop:d="none",spaceBottom:f="none",...R}=e,g=t?y.Slot:"div",u={default:"tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]",none:""},N={default:"tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",none:""},b={default:"tablet:pb-[80px] laptop:pb-[96px] desktop:pb-[112px] lg-desktop:pb-[128px] pb-[64px]",none:""};return(0,n.jsx)(g,{...R,ref:o,className:(0,m.cn)(p,"ipc_container","relative z-10 w-full"),children:(0,n.jsx)("div",{className:(0,m.cn)("lg-desktop:max-w-full px-grid mx-auto size-full",c,u?.[l]||l,N?.[d]||d,b?.[f]||f),children:a})})});C.displayName="Section";const i=r.default.forwardRef(({...e},o)=>{const{children:t,mode:a="section"}=e,c={section:C,fragment:Y}[a];return(0,n.jsx)(c,{...e,ref:o,children:t})});i.displayName="Container";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var a=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},b=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of h(e))!$.call(t,i)&&i!==r&&g(t,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return t};var p=t=>b(g({},"__esModule",{value:!0}),t);var T={};a(T,{atobID:()=>W,cn:()=>w,getLocalizedPath:()=>z,highlightSearchWord:()=>j,noop:()=>R,replaceTemplate:()=>S,spaceToHyphen:()=>E});module.exports=p(T);var u=require("clsx"),l=require("tailwind-merge");const y=(0,l.extendTailwindMerge)({extend:{theme:{spacing:["grid"],borderRadius:["btn","box","box-small","card","tabs","sidebar-shelf","image-text"]},classGroups:{"font-size":["text-heading-1","text-heading-2","text-heading-3","text-heading-4","text-heading-5","text-text-3","text-text-2","text-text-1"],"text-color":["text-info-primary","text-info-secondary","text-info-tertiary","text-info-quaternary","text-info-white"],leading:["leading-tight","leading-normal","leading-loose"]}}});function w(...t){return y((0,u.clsx)(t))}function R(){}function W(t){return t&&typeof t=="string"&&t.includes("/")?t.split("/").pop()?.split("?")?.shift():t}const E=t=>t?.replace(/\s+/g,"-"),c=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),S=(t,e,r="{",n="}")=>{if(!t||!e||Object.keys(e).length===0)return t;const i=c(r),o=c(n),s=new RegExp(`${i}([a-zA-Z0-9_-]+)${o}`,"g");return t.replace(s,(f,x)=>e[x]!==void 0?e[x]:f)},j=(t,e)=>{try{if(!t||!e)return t;const r=c(e),n=new RegExp(r,"gi");return t.replace(n,i=>`<span class='text-brand-0 font-bold'>${i}</span>`)}catch(r){return console.error("highlightSearchWord error:",r),t}},z=(t,e,r)=>{if(!t)return t;if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("#"))return r?t.includes("?")?`${t}&${r}`:`${t}?${r}`:t;const n=t.split("/").filter(Boolean);if(n.length===0){const s=e==="us"?"/":`/${e}`;return r?`${s}?${r}`:s}if(n[0]===e){const s=`/${n.join("/")}`;return r?`${s}?${r}`:s}const o=`${e==="us"?"":`/${e}`}/${n.join("/")}`;return r?`${o}?${r}`:o};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical';
|
|
1
2
|
export declare const gaTrack: (data: any) => "" | undefined;
|
|
2
3
|
/**
|
|
3
4
|
* GA4 `select_item` 事件商品项
|
|
@@ -30,12 +31,17 @@ export interface TrackSelectItemOptions {
|
|
|
30
31
|
export declare const trackSelectItem: ({ pageGroup, currency, itemListId, itemListName, position, items, }: TrackSelectItemOptions) => void;
|
|
31
32
|
/** 组件类型:图片 image / 视频 video(埋点规范) */
|
|
32
33
|
export type ComponentMediaType = 'image' | 'video';
|
|
34
|
+
/** 埋点文本入参:纯字符串,或 CMS 返回的 Lexical 富文本对象 */
|
|
35
|
+
export type TrackingTextInput = string | SerializedEditorState | null | undefined;
|
|
33
36
|
/**
|
|
34
37
|
* 埋点文本归一化:CMS 富文本标题常携带 `<br>` 等 HTML 标签,
|
|
35
38
|
* 直接上报会污染 GA4 维度(如 component_title 出现 `<br>`)。
|
|
36
39
|
* 此函数去标签、还原常见实体并压缩空白。
|
|
40
|
+
*
|
|
41
|
+
* 入参也可以是 Lexical 富文本对象(CMS 的标题、描述字段),会先转成纯文本再归一化;
|
|
42
|
+
* 转换失败时返回空字符串,不抛错,避免埋点异常拖垮组件渲染。
|
|
37
43
|
*/
|
|
38
|
-
export declare const toPlainTrackingText: (value?:
|
|
44
|
+
export declare const toPlainTrackingText: (value?: TrackingTextInput) => string;
|
|
39
45
|
/** 按当前渲染的创意是否为视频解析 component_type。
|
|
40
46
|
* 埋点规范:图片传 image、视频传 video。
|
|
41
47
|
*/
|
|
@@ -48,12 +54,12 @@ export interface ClickTrackingPropsInput {
|
|
|
48
54
|
interactive: boolean;
|
|
49
55
|
componentType: ComponentMediaType;
|
|
50
56
|
componentName: string;
|
|
51
|
-
/** 运营配置的创意标题 → component_title */
|
|
52
|
-
title?:
|
|
53
|
-
/** 运营配置的创意描述 → component_description */
|
|
54
|
-
description?:
|
|
55
|
-
/** 按钮文案(视频播放入口固定传 `video play` / `video pause`) → button_name */
|
|
56
|
-
buttonName?:
|
|
57
|
+
/** 运营配置的创意标题 → component_title(可为 Lexical 富文本) */
|
|
58
|
+
title?: TrackingTextInput;
|
|
59
|
+
/** 运营配置的创意描述 → component_description(可为 Lexical 富文本) */
|
|
60
|
+
description?: TrackingTextInput;
|
|
61
|
+
/** 按钮文案(视频播放入口固定传 `video play` / `video pause`) → button_name(可为 Lexical 富文本) */
|
|
62
|
+
buttonName?: TrackingTextInput;
|
|
57
63
|
/** 导航/电梯/锚点文案,与 position 以 `#` 分隔 */
|
|
58
64
|
navigation?: string;
|
|
59
65
|
/** 同一位置内的组件顺序 / 轮播帧序号(1-based) → position */
|
package/dist/cjs/shared/track.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var k=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},x=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _(t))!y.call(e,i)&&i!==n&&g(e,i,{get:()=>t[i],enumerable:!(r=T(t,i))||r.enumerable});return e};var v=e=>x(g({},"__esModule",{value:!0}),e);var h={};k(h,{buildClickTrackingProps:()=>w,gaTrack:()=>d,resolveComponentMediaType:()=>b,toPlainTrackingText:()=>o,trackComponentClick:()=>S,trackSelectItem:()=>f});module.exports=v(h);var l=require("@payloadcms/richtext-lexical/plaintext");const d=e=>{if(typeof window>"u")return"";window.dataLayer=window.dataLayer||[];try{window.dataLayer?.push({event_parameters:null}),window.dataLayer?.push(e||{})}catch(t){console.log("pageGTMEvent error",t)}},f=({pageGroup:e="Home Page",currency:t="USD",itemListId:n,itemListName:r,position:i,items:a})=>{d({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:e,position:i,item_list_id:n,item_list_name:r,currency:t,items:a.map(p=>({...p,item_list_id:n,item_list_name:r}))}})},C=/<[^>]*>/g,I={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"},o=e=>{if(!e)return"";let t;if(typeof e=="string")t=e;else try{t=(0,l.convertLexicalToPlaintext)({data:e})||""}catch{return""}return t.replace(C," ").replace(/&[a-z#0-9]+;/gi,n=>I[n.toLowerCase()]??" ").replace(/\s+/g," ").trim()},b=e=>e?"video":"image",w=({interactive:e,componentType:t,componentName:n,title:r,description:i,buttonName:a,navigation:p="",position:m=1,creativeId:s,sku:c})=>{if(!e)return{};const u=`${o(r)}#${o(i)}${a===void 0?"":`#${o(a)}`}`;return{"data-headless-type-name":`${t}#${n}`,"data-headless-title-desc-button":u,"data-headless-nav-position":`${p}#${m}`,...s?{"data-headless-creative-id":s}:{},...c?{"data-headless-sku":c}:{}}},S=({pageGroup:e="Home Page",componentType:t,componentName:n,position:r=1,buttonName:i,componentTitle:a,componentDescription:p,creativeId:m,sku:s,navigation:c=""})=>{d({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:e,component_type:t,component_name:n,position:r,creative_id:m||"",button_name:o(i),component_title:o(a),component_description:o(p),SKU:s||"",navigation:c}})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as i,jsxs as a}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{jsx as i,jsxs as a}from"react/jsx-runtime";import C from"../Title/index.js";import{cn as o}from"../../helpers/utils.js";import x from"../../components/picture.js";import L from"../../components/button.js";import D from"../SwiperBox/index.js";import{withLayout as S}from"../../shared/Styles.js";import j,{useState as _,useRef as T,useCallback as A,useImperativeHandle as z,useEffect as M}from"react";import{useExposure as E}from"../../hooks/useExposure.js";import{trackUrlRef as k}from"../../shared/trackUrlRef.js";import P from"../../shared/throttle.js";import{Heading as w}from"../../components/heading.js";import{useTracking as B}from"../../hooks/useTracking.js";const l="image",s="scene_banner",O=({item:e,idx:t,itemShape:c,hoverIndex:m,getRef:I,handleSwiperItemClick:g,contentWidth:d,primaryButton:p,event:u,data:f,accordionRef:N})=>{const{buildRef:y}=B(),v=m===t,R=v?8:1;return E({current:N.current[t]},{componentType:l,componentName:s,componentTitle:e?.title,position:t+1,componentDescription:e?.subTitle}),a("div",{style:{flex:`${R} 1 0%`,transition:"all 0.6s"},ref:h=>{h&&I(t,h)},className:o("rounded-box relative cursor-pointer overflow-hidden"),onMouseEnter:()=>g(t),onClick:()=>{g(t)},children:[e?.imgLink?i("a",{href:k(e.imgLink,y(l,s)),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}`,children:i(x,{source:e?.img?.url,className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",alt:e?.img?.alt||""})}):i(x,{source:e?.img?.url,className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",alt:e?.img?.alt||""}),a("div",{style:{width:d},className:o("absolute inset-x-0 bottom-0 flex w-full items-end justify-between overflow-hidden px-8 pb-8 opacity-0 transition-opacity duration-[600ms] ease-in",v&&d?"opacity-100":"opacity-0"),children:[a("div",{className:"mr-16 flex-1 overflow-hidden",children:[i(w,{as:"h3",className:"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold",html:e?.title}),i(w,{as:"h4",className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]",html:e?.subTitle})]}),p&&a(L,{className:o("mb-1.5 font-bold"),as:"a",href:k(e?.link,y(l,s)),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${p}`,onClick:()=>u?.primaryButton?.(f,t),children:[p,i("span",{className:"sr-only",children:e?.title??e?.subTitle})]})]})]},t)},V=({data:e,configuration:t})=>{const{buildRef:c}=B(),m=T(null);return E(m,{componentType:l,componentName:s,componentTitle:e?.title,position:t?.index+1,componentDescription:e?.subTitle}),a("div",{ref:m,className:o("bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid","rounded-box"),children:[e?.imgLink?i("a",{href:k(e.imgLink,c(l,s)),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}@${e?.subTitle}`,"data-headless-nav-position":`''#${t?.index+1}`,children:i(x,{className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",source:e?.mobileImg?.url||"",alt:e?.mobileImg?.alt||""})}):i(x,{className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",source:e?.mobileImg?.url||"",alt:e?.mobileImg?.alt||""}),a("div",{className:o("absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4"),children:[a("div",{className:"tablet:mb-6 mb-4 flex-1 overflow-hidden",children:[i(w,{as:"h3",className:"text-info-primary line-clamp-3 text-2xl font-bold leading-[1.2]",html:e?.title}),i(w,{as:"h4",className:"text-info-primary line-clamp-2 text-sm font-bold",html:e?.subTitle})]}),t?.primaryButton&&i(L,{as:"a",variant:"secondary","aria-label":e?.title??e?.subTitle,className:o("text-info-primary text-sm font-bold"),href:k(e.link,c(l,s)),"data-headless-type-name":`${l}#${s}`,"data-headless-nav-position":`''#${t?.index+1}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${t?.primaryButton}`,children:t?.primaryButton})]})]})},H=j.forwardRef(({data:e,autoplay:t={enabled:!1,loop:!1,interval:1500},className:c="",event:m,...I},g)=>{const[d,p]=_(0),u=T(0),f=T([]),[N,y]=_(0),v=T(null);z(g,()=>v.current);const R=(n,r)=>{r&&(f.current[n]=r)};M(()=>{const n=()=>{f.current[u.current]&&y(f.current[u.current].offsetWidth)};n();const r=P(n,300);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]);const h=A(n=>{d!==n&&(p(n),u.current=n)},[e?.products,d]);return M(()=>{let n;return t?.enabled&&(n=setInterval(()=>{p(r=>{const $=r??0;let b;if(t.loop!==!1)b=($+1)%e?.products?.length;else if(b=$+1,b>=e?.products?.length)return b=e?.products?.length-1,n&&clearInterval(n),$;return u.current=b,b})},t?.interval)),()=>{n&&clearInterval(n)}},[t?.enabled,t?.interval,t?.loop,e?.products?.length,h]),a("div",{...I,ref:v,children:[e?.title&&i(C,{data:{title:e?.title}}),i("div",{className:o("laptop:block hidden",{"aiui-dark":e?.theme==="dark"}),children:i("div",{className:o("lg-desktop:h-[calc(560_/_1920*100vw)] desktop:h-[calc(448_/_1440*100vw)] laptop:h-[calc(336_/_1025*100vw)] flex max-h-[560px] min-h-[336px] w-full gap-4 overflow-hidden",c),children:e?.products?.map((n,r)=>i(O,{item:n,idx:r,itemShape:e?.itemShape,hoverIndex:d,getRef:R,handleSwiperItemClick:h,contentWidth:N,primaryButton:e?.primaryButton,event:m,data:e,accordionRef:f},r))})}),i("div",{className:o("laptop:hidden block",{"aiui-dark":e?.theme==="dark"}),children:i(D,{className:o("h-[400px] !overflow-visible",c),id:"AccordionCards"+e?.key,data:{list:e?.products,configuration:{shape:e?.shape,itemShape:e?.itemShape,primaryButton:e?.primaryButton,event:m,title:e?.title}},Slide:V,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3}}})})]})});H.displayName="AccordionCards";var te=S(H);export{te as default};
|
|
@@ -101,12 +101,13 @@ export interface VariantData {
|
|
|
101
101
|
*/
|
|
102
102
|
export interface ProductCardData extends BaseProductData, VariantData {
|
|
103
103
|
}
|
|
104
|
-
/**
|
|
105
|
-
* 产品卡片组件 Props
|
|
106
|
-
*/
|
|
107
104
|
export interface ProductCardProps {
|
|
108
105
|
/** 产品数据 */
|
|
109
106
|
product: ProductCardData;
|
|
107
|
+
/** 当前所在 Tab 的文案,上报为 navigation */
|
|
108
|
+
tabName?: string;
|
|
109
|
+
/** 卡片在列表中的位置(从 1 开始),上报为 position */
|
|
110
|
+
position?: number;
|
|
110
111
|
/** 样式类名 */
|
|
111
112
|
className?: string;
|
|
112
113
|
/** 是否展示标签系统 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as Ie,jsx as t,jsxs as l}from"react/jsx-runtime";import*as L from"react";import{cn as a}from"../../helpers/index.js";import{Button as J,Badge as Ne,Card as Pe,CardContent as Ae,Picture as Q,Text as x,Heading as D,Progress as Be}from"../../components/index.js";import{toPlainTrackingText as z}from"../../shared/track.js";import{trackUrlRef as Le}from"../../shared/trackUrlRef.js";import{useTracking as De}from"../../hooks/useTracking.js";import{MemberLabel as ze}from"./MemberLabel.js";import{layoutModeStyles as W}from"./styles.js";const _e=5,X="shelf",Y="active_shelf";function Re(e,n,r,y){if(e===void 0)return!0;switch(e){case"always":return!0;case"never":return!1;case"below-quantity":return n===void 0?!0:r<=n;case"below-percentage":return n===void 0?!0:r/y*100<=n;default:return!0}}const Me=({items:e})=>e?.length?t("div",{className:"active-shelf-display-social-endorsements desktop:gap-2 laptop:flex absolute right-0 top-0 z-10 hidden flex-col items-center gap-1",children:e.slice(0,3).map((n,r)=>typeof n.icon=="string"?t("img",{src:n.icon,alt:n.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},r):t(x,{"aria-label":n.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:n.icon},r))}):null,Z={style1:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/2_7746fc9c-d4e4-4a59-a972-fa4cb0f3f8bd.png?v=1789381635",textClass:"aiui-dark text-info-primary"},style2:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/1_e0438358-493b-40cb-9a58-89d6ee2d3751.png?v=1789381628",textClass:"aiui-dark text-info-primary"},style3:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/1_19208ba4-71ea-4580-892d-72167f1cf606.png?v=1789381639",textClass:"aiui-dark text-info-primary"}},we=({text:e,style:n="style1",icon:r,className:y,textClassName:_,textColor:h,layoutMode:C="flex",renderBadge:v})=>{if(!e)return null;const g=n==="custom",k=g&&!!v,o=g&&!v&&!!r?.url,m=g?void 0:Z[n],S=Z.style1,c=W[C],T={style1:c.discountBadgeText,style2:c.discountBadgeTextStyle2,style3:c.discountBadgeTextStyle3},N=g?c.discountBadgeTextCenter:T[n];return l("div",{className:a("active-shelf-discount-badge","absolute left-0 top-0 z-30",c.discountBadgeSize,y),children:[k?v({text:e,layoutMode:C}):o?t(Q,{source:r.url,alt:r.alt||e,className:"block size-full",imgClassName:"block size-full object-contain"}):t("img",{src:(m??S).bg,alt:e,loading:"lazy",className:"block size-full object-contain"}),!k&&t(x,{className:a("active-shelf-discount-badge-text text-center","absolute inset-0 font-bold !leading-[1.2]",N,(m??S).textClass,_),style:h?{color:h}:void 0,html:e})]})},w=L.forwardRef(({product:e,tabName:n="",position:r=1,className:y,showTags:_=!0,stockDisplayMode:h,stockThresholdValue:C,onLearnMore:v,onShopNow:g,onAddToCart:k,classNames:o,secondaryButtonText:m,secondaryButtonFun:S,primaryButtonText:c,primaryButtonFun:T,showOriginalPrice:N,renderOriginalPrice:I,copy:f,onProductImageClick:b,tagTypeConfig:E,fill:F,outline:j,memberPriceTextColor:q,userType:P,memberImages:ee,customTagsIcon:te,customTagStyle:ae,discountTagTextColor:ie,onMemberSignUp:ne,onPlusMemberAddCart:oe,showMemberPrice:V,layoutMode:R,renderDiscountBadge:se},re)=>{const[le,ce]=L.useState(!1),[de,ue]=L.useState(!1),{buildRef:ge}=De(),me=e.custom_name||e.name,A=i=>({"data-headless-type-name":`${X}#${Y}`,"data-headless-title-desc-button":`${z(me)}#${z(e.description)}#${z(i)}`,"data-headless-nav-position":`${z(n)}#${r}`,...e.sku?{"data-headless-sku":e.sku}:{}}),B=e?.listingLink?Le(e.listingLink,ge(X,Y)):void 0,fe=e?.memberDiscountAmount,be=e?.plusMemberDiscountAmount,pe=e?.activityLabels??[],ye=P==="guest"?"guest":"member",$=pe.find(i=>i.type===ye)?.label,ve=P==="guest"?f?.memberActivityLabelUnLogin:f?.memberActivityLabel,Se=!!$||!!ve,xe=e?.discountAmount,s=W[R??"flex"],he=L.useMemo(()=>e?.availableForSale&&e?.quantityAvailable<=0?_e:e?.availableForSale?(e?.quantityAvailable??0)/(e?.totalInventory??1)*100:0,[e?.availableForSale,e?.quantityAvailable,e?.totalInventory]),O=async(i,d)=>{if(!i)return;const u=d==="primary"?ce:ue;u(!0);try{switch(i){case"buyNow":await g?.(e);break;case"addCart":await k?.(e);break;case"learnMore":await v?.(e);break;default:break}}finally{u(!1)}},Ce=e.availableForSale&&e.quantityAvailable<=0,ke=(i,d)=>{const u=i===0?E?.firstTagVariant:i===1?E?.secondTagVariant:void 0,M=(u||void 0)??(d==="fill"?"fill":d!==void 0?"outline":i===0?"fill":"outline"),p=M==="fill"?{outline:F?.outlineColor,bg:F?.bgColor}:{outline:j?.outlineColor,bg:j?.bgColor},K={...p.outline?{outlineColor:p.outline}:{},...p.bg?{backgroundColor:p.bg,backgroundImage:"none"}:{}};return M==="outline"&&p.outline&&(K.color=p.outline),{variant:M,style:K}},U=!!e.custom_bg_image,Te=!!e.custom_scene_image,H=i=>i?{backgroundImage:`url(${i})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"}:void 0;return l(Pe,{ref:re,className:a("active-shelf-card","hover:bg-container-secondary-0 bg-container-primary relative flex h-full cursor-pointer flex-col overflow-hidden border-none",s.cardRadius,y,o?.productCard),children:[t(we,{text:xe,style:ae,icon:te,layoutMode:R,renderBadge:se,className:o?.discountBadge,textClassName:o?.discountBadgeText,textColor:ie}),l(Ae,{className:a(s.cardContent,"relative flex flex-1 flex-col justify-between"),children:[l("div",{className:"product-image-wrapper group/product-image laptop:pb-2 laptop:mb-4 desktop:pb-6 desktop:mb-4 relative mb-4",children:[U&&t("div",{"aria-hidden":!0,className:a("pointer-events-none absolute inset-0 z-20",s.imageOffset),style:H(e.custom_bg_image)}),Te&&t("div",{"aria-hidden":!0,className:a("laptop:block laptop:group-hover/product-image:opacity-100 pointer-events-none absolute inset-0 z-20 hidden opacity-0 transition-opacity duration-300",s.imageOffset),style:H(e.custom_scene_image)}),t("div",{className:a("product-image mx-auto cursor-pointer overflow-hidden",s.image),children:t("a",{onClick:()=>b?.(e),...!b&&{href:B},...b||B?A():{},rel:"noreferrer",className:a("block size-full",U&&"opacity-0"),children:t(Q,{source:e.image,alt:e.name,className:"aspect-square size-full object-contain",imgClassName:"size-full object-contain"})})}),t(Me,{items:e?.socialEndorsements})]}),_&&t("div",{className:"desktop:mb-2 mb-1 flex h-[24px] gap-1",children:e.tags?.map((i,d)=>{if(!i.label)return null;const{variant:u,style:G}=ke(d,i.variant);return t(Ne,{size:"sm",variant:u,className:"active-shelf-items-tag py-0",style:G,children:i.label},d)})}),l("div",{className:"flex h-full flex-1 grow flex-col justify-between gap-4",children:[l("div",{children:[t(D,{as:"h3",size:"none",className:a("text-info-primary",s.title,o?.productTitle),children:t("a",{onClick:()=>b?.(e),...!b&&{href:B},...b||B?A():{},rel:"noreferrer",className:"hover:text-brand-0 cursor-pointer ",children:e.custom_name||e.name})}),e?.description&&t(x,{size:"none",className:a("active-shelf-product-description text-info-primary",s.description,o?.productDescription),html:e.custom_description||e.description})]}),l("div",{children:[t("div",{className:a(o?.productPrice),children:t("div",{className:a("flex items-baseline",s.priceGap),children:e.availableForSale?l(Ie,{children:[t(D,{size:"none",className:a("text-info-primary",s.price),as:"h6",children:e.price}),I?I(e,{showOriginalPrice:N}):N&&e.originalPrice&&t(D,{size:"none",className:a("text-info-tertiary line-through",s.price,o?.originalPrice),as:"h6",children:e.originalPrice})]}):t(D,{size:"none",className:a("text-info-tertiary",s.price),children:f?.outOfStockLabel??"Sold Out"})})}),V&&e?.priceLabel&&e?.availableForSale&&t("div",{className:a("min-h-[1lh]",s.priceLabel),children:t(x,{size:"none",className:a("text-brand-0",o?.productPriceLabel),style:{...q?{color:q}:{}},children:e.priceLabel})}),l("div",{className:a("mt-2 flex",s.buttonContainer,o?.buttonGroup),children:[m&&t(J,{variant:"secondary",size:"lg",className:a(s.buttonItem,o?.secondaryButton),onClick:()=>O(S,"secondary"),disabled:!e.availableForSale&&S!=="learnMore",loading:de,...A(m),children:m}),c&&t(J,{variant:"primary",size:"lg",className:a(s.buttonItem,o?.primaryButton),onClick:()=>O(T,"primary"),disabled:!e.availableForSale&&T!=="learnMore",loading:le,...A(c),children:c})]}),Re(h,C,e?.quantityAvailable??0,e?.totalInventory??0)&&l("div",{className:"active-shelf-stock mt-4 flex flex-col gap-1",children:[t(Be,{value:he,max:100,min:0,size:"base",variant:"default","aria-label":"stock progress",classNames:{root:a("active-shelf-stock-track","bg-[var(--progress-track-bg,rgba(0,0,0,0.2))]",o?.stockTrack),progressBar:a("active-shelf-stock-bar","bg-brand-0 transition-all duration-300 ease-in-out",o?.stockBar)}}),t(x,{size:3,className:"text-info-tertiary text-[14px]",children:Ce?f?.limitedStock:f?.stockDisplayText?.replace("{count}",`${e.availableForSale?e.quantityAvailable:0}`)})]})]})]})]}),V&&P&&t(ze,{userType:P,copy:f,images:ee,onSignUp:ne,onPlusMemberAddCart:oe,hasActivity:Se,activityLabel:$,memberDiscountAmount:fe,plusMemberDiscountAmount:be,layoutMode:R})]})});w.displayName="ActiveShelf.ProductCard";var Ue=w;export{w as ProductCard,Ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as ge,jsx as t,jsxs as n}from"react/jsx-runtime";import*as i from"react";import{cn as p}from"../../helpers/index.js";import{withLayout as Ce}from"../../shared/Styles.js";import{Text as xe,Heading as ve,Tabs as Pe,TabsList as Me,TabsTrigger as ke,TabsContent as Se}from"../../components/index.js";import le from"../PromotionalBar/index.js";import{Swiper as Be,SwiperSlide as De}from"swiper/react";import{Navigation as Le}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import{ProductCard as ie}from"./ProductCard.js";import{useExposure as Ne}from"../../hooks/useExposure.js";const Re="shelf",Ae="active_shelf",Ee=()=>n("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"prev-mask bg-masks-0 group-hover/prev-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M15 6L9 12L15 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),Ie=()=>n("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"next-mask bg-masks-0 group-hover/next-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M9 6L15 12L9 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});function ce(r){return typeof window>"u"?2:window.matchMedia("(min-width: 1440px)").matches?r==="3"?3:4:window.matchMedia("(min-width: 768px)").matches?3:2}function de(){return typeof window>"u"?!0:!window.matchMedia("(min-width: 768px)").matches}function ue(){return typeof window>"u"?!1:window.matchMedia("(min-width: 1025px)").matches}const se=i.forwardRef(({products:r,layoutMode:o,className:$,copy:c,showTags:f,stockDisplayMode:T,stockThresholdValue:y,onLearnMore:h,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:P,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,renderDiscountBadge:D,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,discountTagTextColor:A,onMemberSignUp:E,onPlusMemberAddCart:q,tileMaxRowsPc:Z,tileMaxRowsMob:G,tileDesktopColumns:l,tileExpandText:J,tileCollapseText:K,showMemberPrice:I},Q)=>{const z=i.useId().replace(/:/g,""),F=`swiper-button-next-custom-${z}`,H=`swiper-button-prev-custom-${z}`,[O,d]=i.useState({isBeginning:!0,isEnd:!1}),X=i.useRef(null),u=i.useCallback(()=>{const e=X.current;if(!e?.slides||e.slides.length===0)return;e.slides.forEach(U=>{U.style.height="auto"});const V=Array.from(e.slides).map(U=>U.scrollHeight),ne=Math.max(...V);ne>0&&e.slides.forEach(U=>{U.style.height=`${ne}px`})},[]);i.useEffect(()=>{const e=()=>{requestAnimationFrame(u)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[u]);const[g,s]=i.useState(!1),[Y,ee]=i.useState(()=>ce(l)),[fe,Te]=i.useState(()=>de()),[ye,he]=i.useState(()=>ue());i.useEffect(()=>{const e=()=>{ee(ce(l)),Te(de()),he(ue())};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[l]);const te=o==="horizontal"&&!ye?"flex":o,oe=fe?G:Z,re=te==="flex"&&!!oe&&oe>0,ae=oe?oe*Y:r.length,be=re&&r.length>ae,we=re&&!g?r.slice(0,ae):r;return r?.length===0?null:t("div",{ref:Q,className:$,children:te==="flex"?n(ge,{children:[t("div",{className:p("tablet:grid-cols-3 tablet:gap-4 grid grid-cols-2 justify-start gap-3",l==="3"?"desktop:grid-cols-3 lg-desktop:grid-cols-3":"desktop:grid-cols-4 lg-desktop:grid-cols-4"),children:we.map((e,V)=>t(ie,{product:e,layoutMode:te,className:"shrink-0",showTags:f,stockDisplayMode:T,stockThresholdValue:y,onLearnMore:h,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:P,renderDiscountBadge:D,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,copy:c,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,discountTagTextColor:A,onMemberSignUp:E,onPlusMemberAddCart:q,showMemberPrice:I},e.shopify_id+"-"+e.sku||V))}),be&&n("div",{className:"active-shelf-toggle laptop:hover:text-brand-0 text-info-primary mt-6 flex items-center justify-center",children:[t("button",{className:"laptop:text-base text-sm font-bold",onClick:()=>s(e=>!e),children:g?K??"Show less":J??"Show more"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",className:p("laptop:size-5 size-4",g&&"rotate-180"),width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:t("path",{d:"M17.2929 8.29302C17.6834 7.90249 18.3164 7.90249 18.707 8.29302C19.0975 8.68354 19.0975 9.31655 18.707 9.70708L12.707 15.7071C12.3164 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70708C4.90237 9.31655 4.90237 8.68354 5.29289 8.29302C5.68342 7.90249 6.31643 7.90249 6.70696 8.29302L11.9999 13.586L17.2929 8.29302Z",fill:"currentColor"})})]})]}):n("div",{className:"group relative",children:[t(Be,{modules:[Le],spaceBetween:16,navigation:{nextEl:`.${F}`,prevEl:`.${H}`},onSwiper:e=>{X.current=e,d({isBeginning:e.isBeginning,isEnd:e.isEnd}),setTimeout(u,100)},slidesPerView:3,breakpoints:{1025:{freeMode:!1,slidesPerView:3},1440:{freeMode:!1,slidesPerView:l==="3"?3:4}},onReachEnd:()=>{d(e=>({...e,isEnd:!0}))},onReachBeginning:()=>{d(e=>({...e,isBeginning:!0}))},onFromEdge:()=>{d({isBeginning:!1,isEnd:!1})},className:"!overflow-visible [&_.swiper-wrapper]:items-start",children:r.map((e,V)=>t(De,{className:"overflow-hidden",children:t(ie,{product:e,layoutMode:te,className:"w-full max-w-full",showTags:f,stockDisplayMode:T,stockThresholdValue:y,onLearnMore:h,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:P,renderDiscountBadge:D,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,copy:c,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,discountTagTextColor:A,onMemberSignUp:E,onPlusMemberAddCart:q,showMemberPrice:I})},e.shopify_id+"-"+e.sku||V))}),t("button",{className:`${H} tablet:block group/prev-mask absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 ${O.isBeginning?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":c?.previousSlideLabel,children:t(Ee,{})}),t("button",{className:`${F} tablet:block group/next-mask absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 ${O.isEnd?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":c?.nextSlideLabel,children:t(Ie,{})})]})})});se.displayName="ProductsList";const pe=i.forwardRef(({className:r,data:o,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:T,onMemberSignUp:y,onPlusMemberAddCart:h,classNames:a,renderOriginalPrice:b,renderDiscountBadge:w,...j},W)=>{const m=i.useRef(null);Ne(m,{componentType:Re,componentName:Ae,componentTitle:o.title,componentDescription:o.description}),i.useImperativeHandle(W,()=>m.current);const{theme:C="light",layoutMode:x="flex",showTags:v=!0,stockDisplayMode:P,stockThresholdValue:M,showOriginalPrice:k,secondaryButtonText:S,primaryButtonText:B,secondaryButtonFun:D,primaryButtonFun:L,isShowTab:_=!0,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,copy:q,userType:Z,memberImages:G,customTagsIcon:l,customTagStyle:J,discountTagTextColor:K,showMemberPrice:I,tileMaxRowsPc:Q,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O}=o,d=q||{},X=o.productsTab&&o.productsTab.length>0,u=_&&X,g=u?void 0:o.resourceBlocks?.find(s=>s.blockType==="PromotionalBar"&&s.display==="visible");return n("div",{ref:m,className:p("w-full",{"aiui-dark":C==="dark"},r,a?.root),style:{"--progress-track-bg":C==="dark"?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)"},...j,children:[o.title&&t(ve,{as:"h2",html:o.title,size:4,className:p("text-info-primary mb-4 leading-tight",a?.title)}),o.description&&t(xe,{size:3,as:"p",html:o.description,className:p("text-info-primary mb-6",a?.description)}),n(Pe,{defaultValue:o.productsTab?.[0]?.id,className:"w-full",children:[u&&t(Me,{className:"mb-6",children:o.productsTab?.map(s=>t(ke,{value:s.id,children:s.tab},"tab-"+s.id))}),u?o.productsTab?.map(s=>{const Y=s.resourceBlocks?.find(ee=>ee.blockType==="PromotionalBar"&&ee.display==="visible");return n(Se,{value:s.id,children:[Y&&t(le,{data:Y,className:p("laptop:mb-4 mb-3",a?.promotionalBar)}),t(se,{products:s.data,layoutMode:x,copy:d,showTags:v,stockDisplayMode:P,stockThresholdValue:M,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:T,classNames:a,secondaryButtonText:S,secondaryButtonFun:D,primaryButtonText:B,primaryButtonFun:L,showOriginalPrice:k,renderOriginalPrice:b,renderDiscountBadge:w,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,userType:Z,memberImages:G,customTagsIcon:l,customTagStyle:J,discountTagTextColor:K,onMemberSignUp:y,onPlusMemberAddCart:h,showMemberPrice:I,tileMaxRowsPc:Q,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O})]},"tab-content-"+s.id)}):n(ge,{children:[g&&t(le,{data:g,className:p("laptop:mb-4 mb-3",a?.promotionalBar)}),t(se,{products:o.productsCard,layoutMode:x,copy:d,showTags:v,stockDisplayMode:P,stockThresholdValue:M,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:T,classNames:a,secondaryButtonText:S,secondaryButtonFun:D,primaryButtonText:B,primaryButtonFun:L,showOriginalPrice:k,renderOriginalPrice:b,renderDiscountBadge:w,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,userType:Z,memberImages:G,customTagsIcon:l,customTagStyle:J,discountTagTextColor:K,onMemberSignUp:y,onPlusMemberAddCart:h,showMemberPrice:I,tileMaxRowsPc:Q,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O})]})]})]})});pe.displayName="ActiveShelf";const me=pe;me.ProductCard=ie;const ze=Ce(me);var Ge=ze;export{Ge as default};
|
|
1
|
+
"use client";import{Fragment as Te,jsx as t,jsxs as a}from"react/jsx-runtime";import*as s from"react";import{cn as f}from"../../helpers/index.js";import{withLayout as Se}from"../../shared/Styles.js";import{Text as Be,Heading as De,Tabs as Le,TabsList as Ne,TabsTrigger as Re,TabsContent as Ae}from"../../components/index.js";import ue from"../PromotionalBar/index.js";import{Swiper as Ee,SwiperSlide as Ie}from"swiper/react";import{Navigation as ze}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import{ProductCard as se}from"./ProductCard.js";import{useExposure as $e}from"../../hooks/useExposure.js";import{toPlainTrackingText as h}from"../../shared/track.js";const re="shelf",ne="active_shelf",Fe=()=>a("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"prev-mask bg-masks-0 group-hover/prev-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M15 6L9 12L15 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),He=()=>a("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"next-mask bg-masks-0 group-hover/next-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M9 6L15 12L9 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});function pe(d){return typeof window>"u"?2:window.matchMedia("(min-width: 1440px)").matches?d==="3"?3:4:window.matchMedia("(min-width: 768px)").matches?3:2}function me(){return typeof window>"u"?!0:!window.matchMedia("(min-width: 768px)").matches}function ge(){return typeof window>"u"?!1:window.matchMedia("(min-width: 1025px)").matches}const ae=s.forwardRef(({tabName:d="",shelfTitle:o="",shelfDescription:q="",products:n,layoutMode:b,className:Z,copy:u,showTags:w,stockDisplayMode:r,stockThresholdValue:C,onLearnMore:v,onShopNow:G,onAddToCart:J,onProductImageClick:T,classNames:x,secondaryButtonText:P,secondaryButtonFun:M,primaryButtonText:k,primaryButtonFun:S,showOriginalPrice:B,renderOriginalPrice:D,tagTypeConfig:L,fill:N,outline:R,memberPriceTextColor:K,renderDiscountBadge:A,userType:E,memberImages:I,customTagsIcon:z,customTagStyle:Q,discountTagTextColor:$,onMemberSignUp:F,onPlusMemberAddCart:H,tileMaxRowsPc:X,tileMaxRowsMob:Y,tileDesktopColumns:l,tileExpandText:O,tileCollapseText:V,showMemberPrice:U},ee)=>{const j=s.useId().replace(/:/g,""),W=`swiper-button-next-custom-${j}`,te=`swiper-button-prev-custom-${j}`,[y,p]=s.useState({isBeginning:!0,isEnd:!1}),i=s.useRef(null),c=s.useCallback(()=>{const e=i.current;if(!e?.slides||e.slides.length===0)return;e.slides.forEach(_=>{_.style.height="auto"});const g=Array.from(e.slides).map(_=>_.scrollHeight),de=Math.max(...g);de>0&&e.slides.forEach(_=>{_.style.height=`${de}px`})},[]);s.useEffect(()=>{const e=()=>{requestAnimationFrame(c)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[c]);const[m,ye]=s.useState(!1),[be,we]=s.useState(()=>pe(l)),[Ce,ve]=s.useState(()=>me()),[xe,Pe]=s.useState(()=>ge());s.useEffect(()=>{const e=()=>{we(pe(l)),ve(me()),Pe(ge())};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[l]);const oe=b==="horizontal"&&!xe?"flex":b,ie=Ce?Y:X,le=oe==="flex"&&!!ie&&ie>0,ce=ie?ie*be:n.length,Me=le&&n.length>ce,ke=le&&!m?n.slice(0,ce):n;return n?.length===0?null:t("div",{ref:ee,className:Z,children:oe==="flex"?a(Te,{children:[t("div",{className:f("tablet:grid-cols-3 tablet:gap-4 grid grid-cols-2 justify-start gap-3",l==="3"?"desktop:grid-cols-3 lg-desktop:grid-cols-3":"desktop:grid-cols-4 lg-desktop:grid-cols-4"),children:ke.map((e,g)=>t(se,{product:e,tabName:d,position:g+1,layoutMode:oe,className:"shrink-0",showTags:w,stockDisplayMode:r,stockThresholdValue:C,onLearnMore:v,onShopNow:G,onAddToCart:J,onProductImageClick:T,classNames:x,secondaryButtonText:P,secondaryButtonFun:M,primaryButtonText:k,primaryButtonFun:S,showOriginalPrice:B,renderOriginalPrice:D,renderDiscountBadge:A,tagTypeConfig:L,fill:N,outline:R,memberPriceTextColor:K,copy:u,userType:E,memberImages:I,customTagsIcon:z,customTagStyle:Q,discountTagTextColor:$,onMemberSignUp:F,onPlusMemberAddCart:H,showMemberPrice:U},e.shopify_id+"-"+e.sku||g))}),Me&&a("div",{className:"active-shelf-toggle laptop:hover:text-brand-0 text-info-primary mt-6 flex items-center justify-center",children:[t("button",{className:"laptop:text-base text-sm font-bold",onClick:()=>ye(e=>!e),"data-headless-type-name":`${re}#${ne}`,"data-headless-title-desc-button":`${h(o)}#${h(q)}#${m?V??"Show less":O??"Show more"}`,"data-headless-nav-position":`${h(d)}#1`,children:m?V??"Show less":O??"Show more"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",className:f("laptop:size-5 size-4",m&&"rotate-180"),width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:t("path",{d:"M17.2929 8.29302C17.6834 7.90249 18.3164 7.90249 18.707 8.29302C19.0975 8.68354 19.0975 9.31655 18.707 9.70708L12.707 15.7071C12.3164 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70708C4.90237 9.31655 4.90237 8.68354 5.29289 8.29302C5.68342 7.90249 6.31643 7.90249 6.70696 8.29302L11.9999 13.586L17.2929 8.29302Z",fill:"currentColor"})})]})]}):a("div",{className:"group relative",children:[t(Ee,{modules:[ze],spaceBetween:16,navigation:{nextEl:`.${W}`,prevEl:`.${te}`},onSwiper:e=>{i.current=e,p({isBeginning:e.isBeginning,isEnd:e.isEnd}),setTimeout(c,100)},slidesPerView:3,breakpoints:{1025:{freeMode:!1,slidesPerView:3},1440:{freeMode:!1,slidesPerView:l==="3"?3:4}},onReachEnd:()=>{p(e=>({...e,isEnd:!0}))},onReachBeginning:()=>{p(e=>({...e,isBeginning:!0}))},onFromEdge:()=>{p({isBeginning:!1,isEnd:!1})},className:"!overflow-visible [&_.swiper-wrapper]:items-start",children:n.map((e,g)=>t(Ie,{className:"overflow-hidden",children:t(se,{product:e,tabName:d,position:g+1,layoutMode:oe,className:"w-full max-w-full",showTags:w,stockDisplayMode:r,stockThresholdValue:C,onLearnMore:v,onShopNow:G,onAddToCart:J,onProductImageClick:T,classNames:x,secondaryButtonText:P,secondaryButtonFun:M,primaryButtonText:k,primaryButtonFun:S,showOriginalPrice:B,renderOriginalPrice:D,renderDiscountBadge:A,tagTypeConfig:L,fill:N,outline:R,memberPriceTextColor:K,copy:u,userType:E,memberImages:I,customTagsIcon:z,customTagStyle:Q,discountTagTextColor:$,onMemberSignUp:F,onPlusMemberAddCart:H,showMemberPrice:U})},e.shopify_id+"-"+e.sku||g))}),t("button",{className:`${te} tablet:block group/prev-mask absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 ${y.isBeginning?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":u?.previousSlideLabel,children:t(Fe,{})}),t("button",{className:`${W} tablet:block group/next-mask absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 ${y.isEnd?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":u?.nextSlideLabel,children:t(He,{})})]})})});ae.displayName="ProductsList";const fe=s.forwardRef(({className:d,data:o,onLearnMore:q,onShopNow:n,onAddToCart:b,onProductImageClick:Z,onMemberSignUp:u,onPlusMemberAddCart:w,classNames:r,renderOriginalPrice:C,renderDiscountBadge:v,...G},J)=>{const T=s.useRef(null);$e(T,{componentType:re,componentName:ne,componentTitle:o.title,componentDescription:o.description}),s.useImperativeHandle(J,()=>T.current);const{theme:x="light",layoutMode:P="flex",showTags:M=!0,stockDisplayMode:k,stockThresholdValue:S,showOriginalPrice:B,secondaryButtonText:D,primaryButtonText:L,secondaryButtonFun:N,primaryButtonFun:R,isShowTab:K=!0,tagTypeConfig:A,fill:E,outline:I,memberPriceTextColor:z,copy:Q,userType:$,memberImages:F,customTagsIcon:H,customTagStyle:X,discountTagTextColor:Y,showMemberPrice:l,tileMaxRowsPc:O,tileMaxRowsMob:V,tileDesktopColumns:U,tileExpandText:ee,tileCollapseText:j}=o,W=Q||{},te=o.productsTab&&o.productsTab.length>0,y=K&&te,p=y?void 0:o.resourceBlocks?.find(i=>i.blockType==="PromotionalBar"&&i.display==="visible");return a("div",{ref:T,className:f("w-full",{"aiui-dark":x==="dark"},d,r?.root),style:{"--progress-track-bg":x==="dark"?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)"},...G,children:[o.title&&t(De,{as:"h2",html:o.title,size:4,className:f("text-info-primary mb-4 leading-tight",r?.title)}),o.description&&t(Be,{size:3,as:"p",html:o.description,className:f("text-info-primary mb-6",r?.description)}),a(Le,{defaultValue:o.productsTab?.[0]?.id,className:"w-full",children:[y&&t(Ne,{className:"mb-6",children:o.productsTab?.map((i,c)=>t(Re,{value:i.id,"data-headless-type-name":`${re}#${ne}`,"data-headless-title-desc-button":`${h(o.title)}#${h(o.description)}#${h(i.tab)}`,"data-headless-nav-position":`${h(i.tab)}#${c+1}`,children:i.tab},"tab-"+i.id))}),y?o.productsTab?.map(i=>{const c=i.resourceBlocks?.find(m=>m.blockType==="PromotionalBar"&&m.display==="visible");return a(Ae,{value:i.id,children:[c&&t(ue,{data:c,className:f("laptop:mb-4 mb-3",r?.promotionalBar)}),t(ae,{tabName:i.tab,shelfTitle:o.title,shelfDescription:o.description,products:i.data,layoutMode:P,copy:W,showTags:M,stockDisplayMode:k,stockThresholdValue:S,onLearnMore:q,onShopNow:n,onAddToCart:b,onProductImageClick:Z,classNames:r,secondaryButtonText:D,secondaryButtonFun:N,primaryButtonText:L,primaryButtonFun:R,showOriginalPrice:B,renderOriginalPrice:C,renderDiscountBadge:v,tagTypeConfig:A,fill:E,outline:I,memberPriceTextColor:z,userType:$,memberImages:F,customTagsIcon:H,customTagStyle:X,discountTagTextColor:Y,onMemberSignUp:u,onPlusMemberAddCart:w,showMemberPrice:l,tileMaxRowsPc:O,tileMaxRowsMob:V,tileDesktopColumns:U,tileExpandText:ee,tileCollapseText:j})]},"tab-content-"+i.id)}):a(Te,{children:[p&&t(ue,{data:p,className:f("laptop:mb-4 mb-3",r?.promotionalBar)}),t(ae,{shelfTitle:o.title,shelfDescription:o.description,products:o.productsCard,layoutMode:P,copy:W,showTags:M,stockDisplayMode:k,stockThresholdValue:S,onLearnMore:q,onShopNow:n,onAddToCart:b,onProductImageClick:Z,classNames:r,secondaryButtonText:D,secondaryButtonFun:N,primaryButtonText:L,primaryButtonFun:R,showOriginalPrice:B,renderOriginalPrice:C,renderDiscountBadge:v,tagTypeConfig:A,fill:E,outline:I,memberPriceTextColor:z,userType:$,memberImages:F,customTagsIcon:H,customTagStyle:X,discountTagTextColor:Y,onMemberSignUp:u,onPlusMemberAddCart:w,showMemberPrice:l,tileMaxRowsPc:O,tileMaxRowsMob:V,tileDesktopColumns:U,tileExpandText:ee,tileCollapseText:j})]})]})]})});fe.displayName="ActiveShelf";const he=fe;he.ProductCard=se;const Oe=Se(he);var Ye=Oe;export{Ye as default};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ActivityMechanismProps } from './types.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
declare const ActivityMechanism: React.ForwardRefExoticComponent<ActivityMechanismProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
-
export default ActivityMechanism;
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<ActivityMechanismProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../index.js").ContainerProps & React.RefAttributes<unknown>> & {
|
|
4
|
+
readonly $$typeof: symbol;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as U,jsx as l,jsxs as h}from"react/jsx-runtime";import $,{useImperativeHandle as P,useRef as z}from"react";import{Heading as x,Picture as y,Text as A,Button as D,Link as H,Container as w}from"../../components/index.js";import{withLayout as L}from"../../shared/Styles.js";import{cn as o}from"../../helpers/utils.js";import{useExposure as b}from"../../hooks/useExposure.js";import{useTracking as B}from"../../hooks/useTracking.js";import{trackUrlRef as T}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as E,toPlainTrackingText as M}from"../../shared/track.js";import{cva as v}from"class-variance-authority";import{getLocalizedPath as R}from"../../helpers/index.js";import{useAiuiContext as S}from"../AiuiProvider/index.js";const m="image",u="activity_mechanism",N=v("line-clamp-2",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{theme:"light"}}),C=v("desktop:text-[16px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] tracking-[-0.02em]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white/80"}},defaultVariants:{theme:"light"}}),F=v("mt-2 !p-0 text-[14px]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{theme:"light"}}),f={default:767,tablet:1024,laptop:1439,desktop:1919,lgDesktop:9999},j=t=>{if(!t)return"";const e=[];return t.lgDesktop?.url&&e.push(`${t.lgDesktop.url}`),t.desktop?.url&&e.push(`${t.desktop.url} ${f.desktop}`),t.laptop?.url&&e.push(`${t.laptop.url} ${f.laptop}`),t.tablet?.url&&e.push(`${t.tablet.url} ${f.tablet}`),t.default?.url&&e.push(`${t.default.url} ${f.default}`),e.join(", ")},K=t=>t&&(t.default?.alt||t.tablet?.alt||t.laptop?.alt||t.desktop?.alt||t.lgDesktop?.alt)||"",O=({item:t,theme:e,classNames:s})=>{const{title:i,description:p,linkText:a,linkHref:n,backgroundImage:c}=t,r=j(c),d=K(c),{locale:g="us"}=S(),{buildRef:k}=B();return l("div",{className:o("rounded-card relative flex flex-col overflow-hidden","desktop:px-6 h-[280px] p-4","laptop:gap-4 gap-3","laptop:h-[320px] lg-desktop:h-[400px]",s?.card),children:n?h(H,{href:R(T(n,k(m,u)),g),className:"no-underline",...E({interactive:!0,componentType:m,componentName:u,title:M(i),description:M(p),buttonName:a}),children:[r&&l(y,{source:r,alt:d||i,className:o("absolute inset-0 size-full",s?.background),imgClassName:"size-full object-cover"}),h("div",{className:"relative z-10",children:[l(x,{as:"h3",size:3,className:o(N({theme:e}),s?.title),children:i}),l(A,{as:"p",className:o(C({theme:e}),s?.description),children:p}),a&&l(D,{variant:"link",as:"a",href:R(T(n,k(m,u)),g),className:o(F({theme:e}),s?.link),children:a})]})]}):h(U,{children:[r&&l(y,{source:r,alt:d||i,className:o("absolute inset-0 size-full",s?.background),imgClassName:"size-full object-cover"}),h("div",{className:"relative z-10",children:[l(x,{as:"h3",size:3,className:o(N({theme:e}),s?.title),children:i}),l(A,{as:"p",className:o(C({theme:e}),s?.description),children:p})]})]})})},V=$.forwardRef(({data:t,classNames:e},s)=>{const{items:i=[],theme:p="light"}=t,a=z(null);if(P(s,()=>a.current),b(a,{componentType:m,componentName:u,componentTitle:i[0]?.title||"",componentDescription:i[0]?.description||""}),!i||i.length===0)return null;const n={1:"laptop:grid-cols-1 desktop:grid-cols-1 lg-desktop:grid-cols-1",2:"laptop:grid-cols-2 desktop:grid-cols-2 lg-desktop:grid-cols-2",3:"tablet:grid-cols-2 laptop:grid-cols-3 desktop:grid-cols-3 lg-desktop:grid-cols-3",4:"laptop:grid-cols-4 desktop:grid-cols-4 lg-desktop:grid-cols-4"},c=n[Math.min(i.length,4)]||n[4];return l(w,{"data-ui-component-id":"ActivityMechanism",className:o("activity-mechanism","w-full",e?.root),ref:a,children:l("div",{className:o("tablet:grid-cols-2 laptop:gap-4 grid grid-cols-1 gap-3",c,e?.grid),children:i.map((r,d)=>l(O,{item:r,theme:p,classNames:{...e,...i?.length===3&&{card:e?.card+" first:tablet:col-span-full first:laptop:col-span-1"}}},`${r.title}-${d}`))})})});V.displayName="ActivityMechanism";var et=L(V);export{et as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as i,jsxs as f}from"react/jsx-runtime";import*as c from"react";import{cn as r}from"../../helpers/index.js";import{Text as P,Picture as I,Heading as g,Container as L,Link as T}from"../../components/index.js";import{cva as w}from"class-variance-authority";import{Swiper as V,SwiperSlide as z}from"swiper/react";import{withLayout as B}from"../../shared/Styles.js";import{useExposure as E}from"../../hooks/useExposure.js";import{useTracking as R}from"../../hooks/useTracking.js";import{trackUrlRef as j}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as D,toPlainTrackingText as x}from"../../shared/track.js";const m="image",v="activity_schedule",H=w("rounded-card laptop:px-6 laptop:py-4 relative flex min-w-0 flex-col justify-between gap-2 overflow-hidden px-4 py-3",{variants:{state:{"active-light":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","active-dark":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","inactive-light":"bg-[#EAEAEC]","inactive-dark":"bg-[#1E2024]"},size:{small:"laptop:h-[160px] h-[120px]",large:"laptop:h-[240px] h-[200px]"}},defaultVariants:{state:"inactive-light",size:"small"}}),h=w("font-bold leading-[1.2]",{variants:{state:{"active-light":"text-white","active-dark":"text-white","inactive-light":"text-[#080A0F]","inactive-dark":"text-white"}},defaultVariants:{state:"inactive-light"}}),y=c.memo(({item:e,theme:s="light",className:d,size:n,position:u})=>{const l=e.isActive||!1,{buildRef:o}=R(),t=`${l?"active":"inactive"}-${s}`;return i("div",{className:r(H({state:t,size:n}),d),"data-ui-component-id":"ActivityScheduleCard",children:f(T,{asChild:!e?.link,href:e?.link?j(e.link,o(m,v)):void 0,className:"size-full no-underline hover:text-current",...D({interactive:!!e?.link,componentType:m,componentName:v,title:e.title,description:e.subtitle,position:u}),children:[(l?e.activeIcon:e.inactiveIcon)&&i("div",{className:"laptop:w-[160px] aspect-1 absolute right-0 top-0 z-10 w-[120px]",children:i(I,{source:l?e.activeIcon.url:e.inactiveIcon.url,alt:l?e.activeIcon.alt:e.inactiveIcon.alt,className:"aspect-square"})}),f("div",{className:"relative z-20 flex h-full flex-col justify-between",children:[i(g,{as:"h3",size:3,html:e.title,className:r(h({state:t}))}),f("div",{className:"flex flex-col gap-1",children:[i("div",{className:"flex flex-col justify-end overflow-hidden",children:i(g,{as:"h4",size:2,html:e.subtitle,className:r(" line-clamp-2",h({state:t}))})}),n==="large"&&e.description&&i(P,{html:e.description,className:r("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-3 text-[14px] leading-[1.4]",h({state:t}))})]})]})]})})});y.displayName="ActivityScheduleCard";const k=c.forwardRef(({classNames:e={},data:s,...d},n)=>{const u=s.theme||"light",l=s.size||"large",o=c.useRef(null);c.useImperativeHandle(n,()=>o.current),E(o,{componentType:m,componentName:v,componentTitle:s.scheduleList?.map(a=>x(a.title)).join(" | "),componentDescription:s.scheduleList?.map(a=>x(a.subtitle)).join(" | ")});const t=c.useMemo(()=>s?.scheduleList?.length||2,[s?.scheduleList]),b=c.useMemo(()=>{const a=C=>{switch(C){case"mobile":return{slidesPerView:1.17,spaceBetween:12};case"tablet":return t===2?{slidesPerView:2,spaceBetween:12}:{slidesPerView:2.4,spaceBetween:12};case"laptop":return t===2?{}:t===4?{slidesPerView:3.2,spaceBetween:16}:{slidesPerView:t,spaceBetween:16};case"desktop":return t===2?{slidesPerView:2,spaceBetween:16}:{slidesPerView:t,spaceBetween:16}}},p=a("mobile"),S=a("tablet"),A=a("laptop"),N=a("desktop");return{0:p,768:S,1024:A,1440:N}},[t]);return i(L,{ref:o,className:r(e?.root),childClassName:"overflow-hidden","data-ui-component-id":"ActivitySchedule",...d,children:i(V,{breakpoints:b,className:"w-full !overflow-visible",children:s.scheduleList.map((a,p)=>i(z,{children:i(y,{item:a,theme:u,size:l,className:e?.card,position:p+1})},"activityScheduleCardItem"+p))})})});k.displayName="ActivitySchedule";var O=B(k);export{O as default};
|