@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 client";import{Fragment as xt,jsx as a,jsxs as h}from"react/jsx-runtime";import he,{useRef as xe,useEffect as G,useCallback as E,useState as re}from"react";import{Swiper as Ke,SwiperSlide as Qe}from"swiper/react";import Xe from"../../helpers/ScrollLoadVideo.js";import{cn as V,getLocalizedPath as et}from"../../helpers/index.js";import{buildPictureSource as tt,resolveTierMedia as U,useMediaTier as Be}from"./mediaResolver.js";import{Button as ie,Heading as nt,Text as Se,Countdown as ot,Picture as Te}from"../../components/index.js";import{useCarouselPlayback as at}from"../../hooks/useCarouselPlayback.js";import{CarouselArrows as rt,CarouselCornerToggle as it,CarouselProgressControls as st}from"../../shared/CarouselControls.js";import{buildClickTrackingProps as lt,gaTrack as dt,resolveComponentMediaType as Pe,trackComponentClick as ct}from"../../shared/track.js";import{buildPageGroup as ut,buildTrackingRef as pt,trackUrlRef as mt}from"../../shared/trackUrlRef.js";import{useExposure as gt}from"../../hooks/useExposure.js";import{useAiuiContext as vt}from"../AiuiProvider/index.js";import{VideoModal as ft}from"../VideoModal/index.js";import"swiper/css";const yt=({size:d="base"})=>{const I=d==="lg"?"20":d==="sm"?"16":"18";return a("svg",{width:I,height:I,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:a("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},se="hero_banner",bt=({data:d,isActive:I,isAdjacent:le=!1,videoRef:de,slideIndex:Y,containerSize:W="default",theme:ce="light",slideLabel:ue,position:S,locale:r,pageHandle:R,onPlayVideo:Z,onPrimaryClick:m,onSecondaryClick:pe,onTertiaryClick:J})=>{const{pcImage:K,isVideoLoop:M=!0,isShowVideo:B,title:T,subtitle:b,label:z,endDate:F,endDate_tz:Q,dateFormat:k,iconArray:P,caption:f,blockLink:D,primaryButton:i,secondaryButton:s,tertiaryButton:l,align:C="left",titleSize:N}=d,_=Be(),p=tt(d),j=U(d,"lgDesktop","image")?.alt||K?.alt||"",y=U(d,_,"video")?.url||"",w=!!p&&!/\.(mp4|mov|webm|m4v)(\?|$)/i.test(p),X=Pe(B),me=U(d,_,B?"video":"image")?.id||K?.id||"",ee=`${pt(R??"",X,se)}_${S}`,ge=n=>n&&r?et(n,r):n,H=n=>n?mt(ge(n),ee):void 0,x=(n,g)=>lt({interactive:n,componentType:X,componentName:se,title:T,description:b,buttonName:g,position:S,creativeId:me});return h("div",{"data-ui-component-id":"HeroBannerSlide",role:"group","aria-roledescription":"slide","aria-label":ue,className:V("text-info-primary relative w-full overflow-hidden transition-colors duration-500",ce==="dark"&&"aiui-dark",W==="default"?"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":"lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]"),children:[D&&a("a",{className:"absolute inset-0 z-10",href:H(D),tabIndex:-1,"aria-hidden":"true","aria-label":T?.trim()||b?.trim()||j||void 0,...x(!0)}),B?h(xt,{children:[a(Xe,{videoRef:de,src:y,poster:void 0,className:"absolute inset-0 size-full transition-opacity duration-500",videoClassName:"size-full object-cover",videoLayerClassName:"opacity-0",muted:!0,loop:M,playsInline:!0,onPlaying:n=>{const g=n.currentTarget;g.parentElement?.classList.remove("opacity-0"),g.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:n=>{const g=n.currentTarget;if(g.currentTime>=.5)return;g.parentElement?.classList.add("opacity-0"),g.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),w&&a("div",{"data-video-poster":"true",className:"bg-container-primary pointer-events-none absolute inset-0 size-full transition-opacity duration-500",children:a(Te,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:Y===0||le?"eager":"lazy",fetchPriority:Y===0?"high":"auto",alt:j,source:p})})]}):a(Te,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:j,source:p}),h("div",{className:V("laptop:top-1/2 laptop:-translate-y-1/2 lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px] transition-colors duration-500",C==="center"?"left-1/2 -translate-x-1/2 items-center text-center":"tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] left-0 px-[16px]"),children:[h("div",{className:V("tablet:max-w-[704px] laptop:max-w-[440px] desktop:max-w-[648px] lg-desktop:max-w-[824px] max-w-[358px] transition-colors duration-500",C==="center"?"text-center":"laptop:text-left"),children:[z&&a(Se,{size:2,as:"p",className:V("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:z}),T&&a(nt,{as:N==="4"?"h1":"h2",html:T,size:N?Number(N||"5"):W==="sm"?4:5}),b&&a(Se,{as:"p",size:2,className:"font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",html:b}),F&&a("div",{className:"mt-3",children:a(ot,{endDate:F,endDate_tz:Q,dateFormat:k,variant:"spacious",align:C})})]}),(i?.text||s?.text||l?.text)&&h("div",{className:V("lg-desktop:gap-3 pointer-events-auto flex flex-wrap items-center gap-2",C==="center"?"justify-center":"laptop:justify-start"),children:[s?.isShowPlayVideoButton&&s?.playVideoButtonText?h(ie,{size:"lg",variant:"secondary",className:"hero-banner-play-video-button",onClick:()=>Z?.(),...x(!0,"video play"),children:[s.playVideoButtonText," ",a(yt,{size:"lg"})]}):s?.text?h(ie,{size:"lg",variant:"secondary",as:s?.isCustomSecondaryButton?"button":"a",href:H(s.link),target:s?.target,rel:s?.target==="_blank"?s?.rel??"noopener noreferrer":s?.rel,onClick:n=>s?.isCustomSecondaryButton&&pe?.(d,n,s?.customSecondaryEventId),...x(!!(s.link||s.isCustomSecondaryButton),s.text),children:[s.text,a("span",{className:"sr-only",children:T??b})]}):null,i?.text&&a(ie,{size:"lg",variant:"primary",as:i?.isCustomPrimaryButton?"button":"a",href:H(i.link),target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:n=>i?.isCustomPrimaryButton&&m?.(d,n,i?.customPrimaryEventId),...x(!!(i.link||i.isCustomPrimaryButton),i.text),children:i.text}),l?.text&&h(ie,{size:"lg",variant:"link",className:"tablet:basis-auto basis-full",as:l?.isCustomTertiaryButton?"button":"a",href:H(l.link),target:l?.target,rel:l?.target==="_blank"?l?.rel??"noopener noreferrer":l?.rel,onClick:n=>l?.isCustomTertiaryButton&&J?.(d,n,l?.customTertiaryEventId),...x(!!(l.link||l.isCustomTertiaryButton),l.text),children:[l.text,a("span",{className:"sr-only",children:T??b})]})]}),P&&P.length>0&&a("div",{className:V("flex items-center gap-2",C==="center"?"justify-center":"justify-start"),children:P.map(n=>a("div",{className:"h-12",children:a(Te,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",alt:n?.pcImage?.alt||"",source:n?.pcImage?.url})},n?.pcImage?.url||n?.pcImage?.alt))})]}),f&&f.length>0&&a("div",{className:"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] pointer-events-none absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]",children:f.map((n,g)=>h(he.Fragment,{children:[a(Se,{size:2,className:"hero-banner-product-text tablet:w-[108px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]",html:n.title}),g<f.length-1&&a("div",{className:"bg-info-primary w-px"})]},n.title))})]})},ht={prevSlide:"Previous slide",nextSlide:"Next slide",pauseAutoplay:"Pause autoplay",playAutoplay:"Play autoplay",pauseVideo:"Pause video",playVideo:"Play video",slideStatus:"Slide",carouselLabel:"Banner carousel"},Ne=he.forwardRef(({data:d,className:I,classNames:le={},a11yLabels:de,onPrimaryClick:Y,onSecondaryClick:W,onTertiaryClick:ce,...ue},S)=>{const r=d.items||[],R=d.carousel,Z=R?.size??d.size??"default",m={...ht,...de},{locale:pe,pageHandle:J,trackingData:K}=vt(),M=Be(),B=ut({pageHandle:J,pageGroup:K?.pageGroup}),T=xe(null),[b,z]=re(null),[F,Q]=re(null),[k,P]=re(null),[f,D]=re(null),i=xe(r);G(()=>{i.current=r});const s=e=>e!==void 0&&e!==999&&e>=5,l=e=>e!==void 0&&e!==999&&e>=1&&e<=30,C=R?.autoplaySeconds,N=e=>{const t=e?.autoplaySeconds;return l(t)?t:s(C)?C:void 0},_=r.length>1&&r.some(e=>N(e)!==void 0),p=xe(r.map(()=>he.createRef())),j=(R?.showArrows??!0)&&r.length>1,y=E((e,t)=>{dt({event:"ga4Event",event_name:e,event_parameters:t})},[]),w=E(e=>i.current[e]?.isShowVideo?"video":"image",[]),X=E((e,t)=>{t==="swipe"&&y("hero_banner_swipe",{to_index:e}),y("hero_banner_slide_view",{index:e,total:i.current.length,media_type:w(e),trigger:t})},[y,w]),me=E((e,t,o,u="arrow")=>{y("hero_banner_arrow_click",{direction:e,from_index:t,to_index:o,source:u})},[y]),ee=E((e,t)=>{y(e?"hero_banner_pause":"hero_banner_resume",{index:t,media_type:w(t)})},[y,w]),ge=E((e,t)=>{const o=i.current[t];o&&ct({pageGroup:B,componentType:"video",componentName:se,position:t+1,buttonName:e?"video pause":"video play",componentTitle:o.title,componentDescription:o.subtitle,creativeId:U(o,M,"video")?.id||o.pcImage?.id||""})},[B,M]),H=E(e=>{p.current.forEach((o,u)=>{u!==e&&o.current&&(o.current.pause(),o.current.currentTime=0)});const t=p.current[e];t?.current&&(t.current.currentTime=0,t.current.play()?.catch(()=>{}))},[]),{rootRef:x,activeIndex:n,playbackState:g,resetNonce:ve,announcement:_e,activeFrameIntervalSec:ke,isTimerRunning:He,handleSwiperInit:Ae,handleSlideChange:Ie,handleTransitionEnd:Re,handleSliderFirstMove:Me,goToSlide:Ce,goToSlideIndex:ze,handlePausePlayClick:Fe,notifyVideoPlaying:we,handleFocus:De,handleBlur:je}=at({frameCount:r.length,resolveFrameIntervalSec:e=>N(r[e]),isAutoplayEnabled:_,swiperRef:T,slideStatusLabel:m.slideStatus,onSlideMediaSync:H,onSlideChange:X,onArrowNavigate:me,delaysCountdownForVideo:e=>!!i.current[e]?.isShowVideo,onPauseToggle:(e,t)=>{ee(e,t);const o=p.current[t]?.current;o&&(e?o.pause():o.ended||o.play()?.catch(()=>{}))}}),qe=E(e=>{x.current=e,typeof S=="function"?S(e):S&&(S.current=e)},[S,x]),v=r[n]??r[0],$e=Pe(v?.isShowVideo),Oe=v?.title!==void 0?v?.title?.trim()||v?.subtitle?.trim()||v?.pcImage?.alt?.trim()||void 0:v?.subtitle&&v.subtitle.trim()||"",Ge=v&&(U(v,M,v.isShowVideo?"video":"image")?.id||v.pcImage?.id)||"";gt(x,{componentType:$e,componentName:se,componentTitle:Oe,componentDescription:v?.subtitle?.trim()||"",creativeId:Ge,position:1}),G(()=>{z(null),Q(null);const e=i.current[n],t=p.current[n]?.current;if(!e?.isShowVideo||!t)return;const o=()=>z(t.ended?"ended":t.paused?"paused":"playing"),u=()=>Q(Number.isFinite(t.duration)?t.duration:null),A=()=>{o(),we(n)};return o(),u(),t.addEventListener("playing",A),t.addEventListener("pause",o),t.addEventListener("ended",o),t.addEventListener("loadedmetadata",u),()=>{t.removeEventListener("playing",A),t.removeEventListener("pause",o),t.removeEventListener("ended",o),t.removeEventListener("loadedmetadata",u)}},[n,we]),G(()=>{const e=i.current[n];if(!e?.isShowVideo||!e?.isMultiThemeEnabled)return;const t=p.current[n]?.current;if(!t)return;const o=(c,L,ae,be)=>{if(!(!c||typeof L!="number"||typeof ae!="number"||typeof be!="number"))return be>=L&&be<ae?c:void 0};let u=null;const A=c=>{u=c,P(L=>L&&L.index===n&&L.theme===c?L:{index:n,theme:c})},te=c=>{A(o(e.theme_1,e.star_time_1,e.end_time_1,c)??o(e.theme_2,e.star_time_2,e.end_time_2,c)??e.theme??"light")},ne=t;let $=0,O=0;const fe=typeof ne.requestVideoFrameCallback=="function",Je=()=>fe?O!==0:$!==0,ye=()=>{if(!Je())if(fe){const c=(L,ae)=>{te(ae.mediaTime),O=ne.requestVideoFrameCallback(c)};O=ne.requestVideoFrameCallback(c)}else{const c=()=>{te(t.currentTime),$=requestAnimationFrame(c)};$=requestAnimationFrame(c)}},oe=()=>{fe?(ne.cancelVideoFrameCallback?.(O),O=0):(cancelAnimationFrame($),$=0)},Ve=()=>{oe(),u&&P({index:n,theme:u})};return t.addEventListener("play",ye),t.addEventListener("pause",oe),t.addEventListener("ended",Ve),!t.paused&&!t.ended&&ye(),()=>{oe(),t.removeEventListener("play",ye),t.removeEventListener("pause",oe),t.removeEventListener("ended",Ve)}},[n]),G(()=>{p.current.forEach((e,t)=>{t!==0&&e.current&&(e.current.pause(),e.current.currentTime=0)})},[]),G(()=>{i.current.length!==0&&y("hero_banner_slide_view",{index:0,total:i.current.length,media_type:w(0),trigger:"initial"})},[y,w]);const Ue=!!r[n]?.isShowVideo,Le=ke!==void 0,q=!Le&&Ue&&F!==null&&F>5&&b!=="ended"&&b!==null,Ye=Le||q,We=q?b==="paused":g==="STOPPED",Ze=()=>{if(!q){Fe();return}const e=p.current[n]?.current;if(!e)return;const t=!e.paused;t?e.pause():e.play()?.catch(()=>{}),ee(t,n),ge(t,n)},Ee=k&&k.index===n?k.theme:r[n]?.theme;return h("div",{ref:qe,role:"region","aria-roledescription":"carousel","aria-label":m.carouselLabel,"data-ui-component-id":"HeroBanner",onFocus:De,onBlur:je,className:V("hero-banner-carousel group relative w-full overflow-hidden",Z==="default"?"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":"lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]",le.root,I),...ue,children:[a(Ke,{onSwiper:Ae,onSlideChange:Ie,onSlideChangeTransitionEnd:Re,onSliderFirstMove:Me,slidesPerView:1,loop:!0,initialSlide:0,allowTouchMove:!0,children:r.map((e,t)=>{const o=k&&k.index===t?k.theme:e.theme??"light";return a(Qe,{children:({isActive:u,isPrev:A,isNext:te})=>a(bt,{data:e,isActive:u,isAdjacent:A||te,slideIndex:t,slideLabel:`${m.slideStatus} ${t+1} / ${r.length}`,videoRef:p.current[t],containerSize:Z,theme:o,position:t+1,locale:pe,pageHandle:J,onPlayVideo:()=>D(t),onPrimaryClick:Y,onSecondaryClick:W,onTertiaryClick:ce})},t)})}),j&&a(rt,{onPrev:()=>Ce("prev"),onNext:()=>Ce("next"),prevLabel:m.prevSlide,nextLabel:m.nextSlide}),_&&a(st,{frameCount:r.length,activeIndex:n,resetNonce:ve,activeFrameIntervalSec:ke,isAutoplayEnabled:_,isTimerRunning:He,onSegmentClick:ze,segmentLabel:e=>`${m.slideStatus} ${e+1} / ${r.length}`,classPrefix:"hero-banner",theme:Ee}),Ye&&a(it,{isPaused:We,onToggle:Ze,pausedLabel:q?m.playVideo:m.playAutoplay,playingLabel:q?m.pauseVideo:m.pauseAutoplay,classPrefix:"hero-banner",theme:Ee}),a("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:_e}),f!==null&&r[f]?.secondaryButton&&a(ft,{visible:!0,videoUrl:r[f].secondaryButton?.isYoutubeVideo?void 0:r[f].secondaryButton?.videoUrl?.url,youTubeId:r[f].secondaryButton?.isYoutubeVideo?r[f].secondaryButton?.youtubeId:void 0,onCloseModal:()=>D(null)})]})});Ne.displayName="HeroBannerCarousel";var It=Ne;export{It as default};
|
|
1
|
+
"use client";import{Fragment as St,jsx as a,jsxs as h}from"react/jsx-runtime";import he,{useRef as Se,useEffect as G,useCallback as E,useState as re}from"react";import{Swiper as Ke,SwiperSlide as Qe}from"swiper/react";import Xe from"../../helpers/ScrollLoadVideo.js";import{cn as V,getLocalizedPath as et}from"../../helpers/index.js";import{buildPictureSource as tt,resolveTierMedia as U,useMediaTier as Be}from"./mediaResolver.js";import{Button as ie,Heading as nt,Text as Te,Countdown as ot,Picture as xe}from"../../components/index.js";import{useCarouselPlayback as at}from"../../hooks/useCarouselPlayback.js";import{CarouselArrows as rt,CarouselCornerToggle as it,CarouselProgressControls as st}from"../../shared/CarouselControls.js";import{buildClickTrackingProps as lt,gaTrack as dt,resolveComponentMediaType as Pe,trackComponentClick as ct}from"../../shared/track.js";import{buildPageGroup as ut,buildTrackingRef as pt,trackUrlRef as mt}from"../../shared/trackUrlRef.js";import{useExposure as gt}from"../../hooks/useExposure.js";import{useAiuiContext as vt}from"../AiuiProvider/index.js";import{VideoModal as ft}from"../VideoModal/index.js";import"swiper/css";const yt=({size:d="base"})=>{const I=d==="lg"?"20":d==="sm"?"16":"18";return a("svg",{width:I,height:I,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:a("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},se="hero_banner",bt=({data:d,isActive:I,isAdjacent:le=!1,videoRef:de,slideIndex:Y,containerSize:W="default",theme:ce="light",slideLabel:ue,position:T,locale:r,pageHandle:R,onPlayVideo:Z,onPrimaryClick:m,onSecondaryClick:pe,onTertiaryClick:J})=>{const{pcImage:K,isVideoLoop:M=!0,isShowVideo:B,title:x,subtitle:b,label:z,endDate:F,endDate_tz:Q,dateFormat:k,iconArray:P,caption:f,blockLink:D,primaryButton:i,secondaryButton:s,tertiaryButton:l,align:C="left",titleSize:N}=d,_=Be(),p=tt(d),j=U(d,"lgDesktop","image")?.alt||K?.alt||"",y=U(d,_,"video")?.url||"",w=!!p&&!/\.(mp4|mov|webm|m4v)(\?|$)/i.test(p),X=Pe(B),me=U(d,_,B?"video":"image")?.id||K?.id||"",ee=`${pt(R??"",X,se)}_${T}`,ge=n=>n&&r?et(n,r):n,H=n=>n?mt(ge(n),ee):void 0,S=(n,g)=>lt({interactive:n,componentType:X,componentName:se,title:x,description:b,buttonName:g,position:T,creativeId:me});return h("div",{"data-ui-component-id":"HeroBannerSlide",role:"group","aria-roledescription":"slide","aria-label":ue,className:V("text-info-primary relative w-full overflow-hidden transition-colors duration-500",ce==="dark"&&"aiui-dark",W==="default"?"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":"lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]"),children:[D&&a("a",{className:"absolute inset-0 z-10",href:H(D),tabIndex:-1,"aria-hidden":"true","aria-label":x?.trim()||b?.trim()||j||void 0,...S(!0)}),B?h(St,{children:[a(Xe,{videoRef:de,src:y,poster:void 0,className:"absolute inset-0 size-full transition-opacity duration-500",videoClassName:"size-full object-cover",videoLayerClassName:"opacity-0",muted:!0,loop:M,playsInline:!0,onPlaying:n=>{const g=n.currentTarget;g.parentElement?.classList.remove("opacity-0"),g.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:n=>{const g=n.currentTarget;if(g.currentTime>=.5)return;g.parentElement?.classList.add("opacity-0"),g.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),w&&a("div",{"data-video-poster":"true",className:"bg-container-primary pointer-events-none absolute inset-0 size-full transition-opacity duration-500",children:a(xe,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:Y===0||le?"eager":"lazy",fetchPriority:Y===0?"high":"auto",alt:j,source:p})})]}):a(xe,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:j,source:p}),h("div",{className:V("laptop:top-1/2 laptop:-translate-y-1/2 lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px] transition-colors duration-500",C==="center"?"left-1/2 -translate-x-1/2 items-center text-center":"px-grid left-0"),children:[h("div",{className:V("tablet:max-w-[704px] laptop:max-w-[440px] desktop:max-w-[648px] lg-desktop:max-w-[824px] max-w-[358px] transition-colors duration-500",C==="center"?"text-center":"laptop:text-left"),children:[z&&a(Te,{size:2,as:"p",className:V("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:z}),x&&a(nt,{as:N==="4"?"h1":"h2",html:x,size:N?Number(N||"5"):W==="sm"?4:5}),b&&a(Te,{as:"p",size:2,className:"font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",html:b}),F&&a("div",{className:"mt-3",children:a(ot,{endDate:F,endDate_tz:Q,dateFormat:k,variant:"spacious",align:C})})]}),(i?.text||s?.text||l?.text)&&h("div",{className:V("lg-desktop:gap-3 pointer-events-auto flex flex-wrap items-center gap-2",C==="center"?"justify-center":"laptop:justify-start"),children:[s?.isShowPlayVideoButton&&s?.playVideoButtonText?h(ie,{size:"lg",variant:"secondary",className:"hero-banner-play-video-button",onClick:()=>Z?.(),...S(!0,"video play"),children:[s.playVideoButtonText," ",a(yt,{size:"lg"})]}):s?.text?h(ie,{size:"lg",variant:"secondary",as:s?.isCustomSecondaryButton?"button":"a",href:H(s.link),target:s?.target,rel:s?.target==="_blank"?s?.rel??"noopener noreferrer":s?.rel,onClick:n=>s?.isCustomSecondaryButton&&pe?.(d,n,s?.customSecondaryEventId),...S(!!(s.link||s.isCustomSecondaryButton),s.text),children:[s.text,a("span",{className:"sr-only",children:x??b})]}):null,i?.text&&a(ie,{size:"lg",variant:"primary",as:i?.isCustomPrimaryButton?"button":"a",href:H(i.link),target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:n=>i?.isCustomPrimaryButton&&m?.(d,n,i?.customPrimaryEventId),...S(!!(i.link||i.isCustomPrimaryButton),i.text),children:i.text}),l?.text&&h(ie,{size:"lg",variant:"link",className:"tablet:basis-auto basis-full",as:l?.isCustomTertiaryButton?"button":"a",href:H(l.link),target:l?.target,rel:l?.target==="_blank"?l?.rel??"noopener noreferrer":l?.rel,onClick:n=>l?.isCustomTertiaryButton&&J?.(d,n,l?.customTertiaryEventId),...S(!!(l.link||l.isCustomTertiaryButton),l.text),children:[l.text,a("span",{className:"sr-only",children:x??b})]})]}),P&&P.length>0&&a("div",{className:V("flex items-center gap-2",C==="center"?"justify-center":"justify-start"),children:P.map(n=>a("div",{className:"h-12",children:a(xe,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",alt:n?.pcImage?.alt||"",source:n?.pcImage?.url})},n?.pcImage?.url||n?.pcImage?.alt))})]}),f&&f.length>0&&a("div",{className:"hero-banner-caption-group laptop:gap-3 px-grid desktop:pb-[24px] pointer-events-none absolute bottom-0 z-10 flex items-stretch gap-2 pb-[16px]",children:f.map((n,g)=>h(he.Fragment,{children:[a(Te,{size:2,className:"hero-banner-product-text tablet:w-[108px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]",html:n.title}),g<f.length-1&&a("div",{className:"bg-info-primary w-px"})]},n.title))})]})},ht={prevSlide:"Previous slide",nextSlide:"Next slide",pauseAutoplay:"Pause autoplay",playAutoplay:"Play autoplay",pauseVideo:"Pause video",playVideo:"Play video",slideStatus:"Slide",carouselLabel:"Banner carousel"},Ne=he.forwardRef(({data:d,className:I,classNames:le={},a11yLabels:de,onPrimaryClick:Y,onSecondaryClick:W,onTertiaryClick:ce,...ue},T)=>{const r=d.items||[],R=d.carousel,Z=R?.size??d.size??"default",m={...ht,...de},{locale:pe,pageHandle:J,trackingData:K}=vt(),M=Be(),B=ut({pageHandle:J,pageGroup:K?.pageGroup}),x=Se(null),[b,z]=re(null),[F,Q]=re(null),[k,P]=re(null),[f,D]=re(null),i=Se(r);G(()=>{i.current=r});const s=e=>e!==void 0&&e!==999&&e>=5,l=e=>e!==void 0&&e!==999&&e>=1&&e<=30,C=R?.autoplaySeconds,N=e=>{const t=e?.autoplaySeconds;return l(t)?t:s(C)?C:void 0},_=r.length>1&&r.some(e=>N(e)!==void 0),p=Se(r.map(()=>he.createRef())),j=(R?.showArrows??!0)&&r.length>1,y=E((e,t)=>{dt({event:"ga4Event",event_name:e,event_parameters:t})},[]),w=E(e=>i.current[e]?.isShowVideo?"video":"image",[]),X=E((e,t)=>{t==="swipe"&&y("hero_banner_swipe",{to_index:e}),y("hero_banner_slide_view",{index:e,total:i.current.length,media_type:w(e),trigger:t})},[y,w]),me=E((e,t,o,u="arrow")=>{y("hero_banner_arrow_click",{direction:e,from_index:t,to_index:o,source:u})},[y]),ee=E((e,t)=>{y(e?"hero_banner_pause":"hero_banner_resume",{index:t,media_type:w(t)})},[y,w]),ge=E((e,t)=>{const o=i.current[t];o&&ct({pageGroup:B,componentType:"video",componentName:se,position:t+1,buttonName:e?"video pause":"video play",componentTitle:o.title,componentDescription:o.subtitle,creativeId:U(o,M,"video")?.id||o.pcImage?.id||""})},[B,M]),H=E(e=>{p.current.forEach((o,u)=>{u!==e&&o.current&&(o.current.pause(),o.current.currentTime=0)});const t=p.current[e];t?.current&&(t.current.currentTime=0,t.current.play()?.catch(()=>{}))},[]),{rootRef:S,activeIndex:n,playbackState:g,resetNonce:ve,announcement:_e,activeFrameIntervalSec:ke,isTimerRunning:He,handleSwiperInit:Ae,handleSlideChange:Ie,handleTransitionEnd:Re,handleSliderFirstMove:Me,goToSlide:Ce,goToSlideIndex:ze,handlePausePlayClick:Fe,notifyVideoPlaying:we,handleFocus:De,handleBlur:je}=at({frameCount:r.length,resolveFrameIntervalSec:e=>N(r[e]),isAutoplayEnabled:_,swiperRef:x,slideStatusLabel:m.slideStatus,onSlideMediaSync:H,onSlideChange:X,onArrowNavigate:me,delaysCountdownForVideo:e=>!!i.current[e]?.isShowVideo,onPauseToggle:(e,t)=>{ee(e,t);const o=p.current[t]?.current;o&&(e?o.pause():o.ended||o.play()?.catch(()=>{}))}}),qe=E(e=>{S.current=e,typeof T=="function"?T(e):T&&(T.current=e)},[T,S]),v=r[n]??r[0],$e=Pe(v?.isShowVideo),Oe=v?.title!==void 0?v?.title?.trim()||v?.subtitle?.trim()||v?.pcImage?.alt?.trim()||void 0:v?.subtitle&&v.subtitle.trim()||"",Ge=v&&(U(v,M,v.isShowVideo?"video":"image")?.id||v.pcImage?.id)||"";gt(S,{componentType:$e,componentName:se,componentTitle:Oe,componentDescription:v?.subtitle?.trim()||"",creativeId:Ge,position:1}),G(()=>{z(null),Q(null);const e=i.current[n],t=p.current[n]?.current;if(!e?.isShowVideo||!t)return;const o=()=>z(t.ended?"ended":t.paused?"paused":"playing"),u=()=>Q(Number.isFinite(t.duration)?t.duration:null),A=()=>{o(),we(n)};return o(),u(),t.addEventListener("playing",A),t.addEventListener("pause",o),t.addEventListener("ended",o),t.addEventListener("loadedmetadata",u),()=>{t.removeEventListener("playing",A),t.removeEventListener("pause",o),t.removeEventListener("ended",o),t.removeEventListener("loadedmetadata",u)}},[n,we]),G(()=>{const e=i.current[n];if(!e?.isShowVideo||!e?.isMultiThemeEnabled)return;const t=p.current[n]?.current;if(!t)return;const o=(c,L,ae,be)=>{if(!(!c||typeof L!="number"||typeof ae!="number"||typeof be!="number"))return be>=L&&be<ae?c:void 0};let u=null;const A=c=>{u=c,P(L=>L&&L.index===n&&L.theme===c?L:{index:n,theme:c})},te=c=>{A(o(e.theme_1,e.star_time_1,e.end_time_1,c)??o(e.theme_2,e.star_time_2,e.end_time_2,c)??e.theme??"light")},ne=t;let $=0,O=0;const fe=typeof ne.requestVideoFrameCallback=="function",Je=()=>fe?O!==0:$!==0,ye=()=>{if(!Je())if(fe){const c=(L,ae)=>{te(ae.mediaTime),O=ne.requestVideoFrameCallback(c)};O=ne.requestVideoFrameCallback(c)}else{const c=()=>{te(t.currentTime),$=requestAnimationFrame(c)};$=requestAnimationFrame(c)}},oe=()=>{fe?(ne.cancelVideoFrameCallback?.(O),O=0):(cancelAnimationFrame($),$=0)},Ve=()=>{oe(),u&&P({index:n,theme:u})};return t.addEventListener("play",ye),t.addEventListener("pause",oe),t.addEventListener("ended",Ve),!t.paused&&!t.ended&&ye(),()=>{oe(),t.removeEventListener("play",ye),t.removeEventListener("pause",oe),t.removeEventListener("ended",Ve)}},[n]),G(()=>{p.current.forEach((e,t)=>{t!==0&&e.current&&(e.current.pause(),e.current.currentTime=0)})},[]),G(()=>{i.current.length!==0&&y("hero_banner_slide_view",{index:0,total:i.current.length,media_type:w(0),trigger:"initial"})},[y,w]);const Ue=!!r[n]?.isShowVideo,Le=ke!==void 0,q=!Le&&Ue&&F!==null&&F>5&&b!=="ended"&&b!==null,Ye=Le||q,We=q?b==="paused":g==="STOPPED",Ze=()=>{if(!q){Fe();return}const e=p.current[n]?.current;if(!e)return;const t=!e.paused;t?e.pause():e.play()?.catch(()=>{}),ee(t,n),ge(t,n)},Ee=k&&k.index===n?k.theme:r[n]?.theme;return h("div",{ref:qe,role:"region","aria-roledescription":"carousel","aria-label":m.carouselLabel,"data-ui-component-id":"HeroBanner",onFocus:De,onBlur:je,className:V("hero-banner-carousel group relative w-full overflow-hidden",Z==="default"?"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":"lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]",le.root,I),...ue,children:[a(Ke,{onSwiper:Ae,onSlideChange:Ie,onSlideChangeTransitionEnd:Re,onSliderFirstMove:Me,slidesPerView:1,loop:!0,initialSlide:0,allowTouchMove:!0,children:r.map((e,t)=>{const o=k&&k.index===t?k.theme:e.theme??"light";return a(Qe,{children:({isActive:u,isPrev:A,isNext:te})=>a(bt,{data:e,isActive:u,isAdjacent:A||te,slideIndex:t,slideLabel:`${m.slideStatus} ${t+1} / ${r.length}`,videoRef:p.current[t],containerSize:Z,theme:o,position:t+1,locale:pe,pageHandle:J,onPlayVideo:()=>D(t),onPrimaryClick:Y,onSecondaryClick:W,onTertiaryClick:ce})},t)})}),j&&a(rt,{onPrev:()=>Ce("prev"),onNext:()=>Ce("next"),prevLabel:m.prevSlide,nextLabel:m.nextSlide}),_&&a(st,{frameCount:r.length,activeIndex:n,resetNonce:ve,activeFrameIntervalSec:ke,isAutoplayEnabled:_,isTimerRunning:He,onSegmentClick:ze,segmentLabel:e=>`${m.slideStatus} ${e+1} / ${r.length}`,classPrefix:"hero-banner",theme:Ee}),Ye&&a(it,{isPaused:We,onToggle:Ze,pausedLabel:q?m.playVideo:m.playAutoplay,playingLabel:q?m.pauseVideo:m.pauseAutoplay,classPrefix:"hero-banner",theme:Ee}),a("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:_e}),f!==null&&r[f]?.secondaryButton&&a(ft,{visible:!0,videoUrl:r[f].secondaryButton?.isYoutubeVideo?void 0:r[f].secondaryButton?.videoUrl?.url,youTubeId:r[f].secondaryButton?.isYoutubeVideo?r[f].secondaryButton?.youtubeId:void 0,onCloseModal:()=>D(null)})]})});Ne.displayName="HeroBannerCarousel";var It=Ne;export{It as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as d}from"react/jsx-runtime";import ge,{useImperativeHandle as ve,useRef as g,useState as v,useEffect as Q}from"react";import{Heading as y,Picture as S,Text as M,Link as U}from"../../components/index.js";import{cn as r,getLocalizedPath as X}from"../../helpers/utils.js";import{withLayout as be}from"../../shared/Styles.js";import{useExposure as we}from"../../hooks/useExposure.js";import{useIntersectionObserverDelay as _e}from"../../hooks/useIntersectionObserver.js";import{useAiuiContext as ye}from"../AiuiProvider/index.js";import{motion as Y,AnimatePresence as ee}from"framer-motion";const ke="image",Ne="image_with_text",te=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e("path",{d:"M6.91009 4.41058C7.23553 4.08514 7.76304 4.08514 8.08848 4.41058L13.0885 9.41058C13.4139 9.73602 13.4139 10.2635 13.0885 10.589L8.08848 15.589C7.76304 15.9144 7.23553 15.9144 6.91009 15.589C6.58466 15.2635 6.58466 14.736 6.91009 14.4106L11.3209 9.99977L6.91009 5.58897C6.58466 5.26353 6.58466 4.73602 6.91009 4.41058Z",fill:"currentColor"})}),ie=ge.forwardRef(({data:ae,className:oe},le)=>{const{title:b,subtitle:k,desc:f,descIcon:P,image:w,padImage:D,mobileImage:z,theme:se="dark",items:E=[],layout:re="left",mediaType:ne="image",datalist:s=[],video:H,padVideo:j,mobVideo:R,button:u,textAlign:l="left",titleTag:me}=ae,i=re,{locale:W="us"}=ye(),V=g(null),N=g(null),T=g(null),I=g(null),C=g(null),[p,de]=v(0),A=g([]),[q,pe]=v({left:0,width:0}),[h,$]=v(""),[B,F]=v(""),[O,Z]=v(""),n=s.length>0,_=ne==="video";we(V,{componentType:ke,componentName:Ne,componentTitle:b,componentDescription:k}),ve(le,()=>V.current),Q(()=>{if(s.length>0){const t=A.current[p];if(t){const{offsetLeft:o,offsetWidth:a}=t;pe({left:o,width:a})}}},[p,s.length]);const[G,ce]=v(!1);_e(C,{once:!0,threshold:.01,callback:()=>{ce(!0)}}),Q(()=>{if(!G||!_)return;let t="",o="",a="";if(n&&s[p]){const c=s[p];t=c.video?.url||"",o=c.padVideo?.url||t,a=c.mobVideo?.url||t}else t=H?.url||"",o=j?.url||t,a=R?.url||t;t&&$(t),o&&F(o),a&&Z(a),setTimeout(()=>{[N.current?.querySelector("video"),T.current?.querySelector("video"),I.current?.querySelector("video")].forEach(x=>{x&&(x.load(),x.play().catch(()=>{}))})},200)},[G,_,n,p,s,H?.url,j?.url,R?.url]);const xe=(t,o)=>{if(de(t),o.target.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}),_&&n&&s[t]){const a=s[t];a.video?.url&&$(a.video.url),a.padVideo?.url&&F(a.padVideo.url),a.mobVideo?.url&&Z(a.mobVideo.url),setTimeout(()=>{[N.current?.querySelector("video"),T.current?.querySelector("video"),I.current?.querySelector("video")].forEach(x=>{x&&(x.load(),x.play().catch(()=>{}))})},300)}},ue=()=>!L||!u?.text||i==="top"||i==="bottom"?null:e("div",{className:r("image-with-text__button-wrapper laptop:mt-[32px] mt-[24px]",{"flex justify-center":l==="center","flex justify-start":l==="left"}),children:e(U,{href:X(u.link||"",W),className:"image-with-text__button whitespace-nowrap no-underline",suffixIcon:te,children:u.text})}),m=E.length>0,L=!!u,J=()=>{if(n&&s[p]){const t=s[p];return`${t.image?.url} ,${t.imgPad?.url||t.image?.url} 1440, ${t.imageMob?.url||t.image?.url} 767`}return w?`${w?.url},${D?.url||w?.url} 1024, ${z?.url||w?.url} 768`:""},K=()=>{if(n){const c=s[p],x=c.image?.url,fe=c.imgPad?.url||x,he=c.imageMob?.url||x;return e(ee,{mode:"wait",children:e(Y.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__video-motion absolute left-0 top-0 w-full",children:d("div",{className:"image-with-text__video-wrapper rounded-box overflow-hidden",children:[e("div",{ref:N,className:"image-with-text__desktop-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:x,src:h,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),e("div",{ref:T,className:"image-with-text__tablet-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:fe,src:B||h,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),e("div",{ref:I,className:"image-with-text__mobile-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:he,src:O||h,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})},c.video?.url||c.image?.url)})}const t=w?.url,o=D?.url||t,a=z?.url||t;return d("div",{className:"image-with-text__video-wrapper rounded-box laptop:rounded-box overflow-hidden",children:[e("div",{ref:N,className:"image-with-text__desktop-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:t,src:h,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),e("div",{ref:T,className:"image-with-text__tablet-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:o,src:B||h,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),e("div",{ref:I,className:"image-with-text__mobile-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:a,src:O||h,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})};return d("section",{ref:V,"data-ui-component-id":"ImageWithText",className:r("image-with-text text-info-primary",{"flex gap-[24px] laptop:gap-[48px] lg-desktop:gap-[64px]":!n,"flex-col":!n&&(i==="top"||i==="bottom"),"items-center":i==="left"||i==="right","flex-col laptop:flex-row":!n&&(i==="left"||i==="right"),"flex l:gap-[24px] xl:flex-col min-md:justify-between min-l:gap-[20px]":n,"aiui-dark":se==="dark"},oe),children:[n&&(b||f||s.length>0)&&d("div",{className:r("image-with-text__tab-content min-md:gap-[24px] laptop:basis-[36%] inline-flex flex-col justify-center",{"text-left":l==="left","text-center":l==="center"}),children:[d("div",{className:"image-with-text__header",children:[e(y,{as:"h3",size:4,html:b,className:"image-with-text__title"}),e(M,{as:"p",size:1,html:f,className:"image-with-text__description tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]"})]}),e("div",{className:r("image-with-text__tabs-wrapper md:scrollbar-hidden relative md:overflow-hidden md:overflow-x-scroll",{"flex justify-center":l==="center"}),children:d("div",{className:"image-with-text__tabs rounded-btn relative inline-flex bg-[#1D1D1F] px-[4px] md:my-[24px]",children:[e("div",{className:"image-with-text__slider rounded-btn absolute inset-y-0 bg-white transition-all duration-300 ease-in-out",style:{left:q.left,width:q.width}}),s.map((t,o)=>e("div",{ref:a=>{A.current[o]=a},onClick:a=>xe(o,a),className:r("image-with-text__tab rounded-btn min-xxl:px-[28px] min-xxl:py-[15px] relative z-10 cursor-pointer px-[20px] py-[10px] text-center text-[12px] font-medium transition-colors duration-300 md:px-[20px] md:py-[10px]",p===o?"image-with-text__tab--active text-black":"text-white"),children:e(y,{as:me??"h3",size:1,html:t?.title,className:"image-with-text__tab-title text-balance-normal !whitespace-nowrap md:text-[14px]"})},o))]})})]}),!n&&(b||k||f)&&d("div",{className:r("image-with-text__content flex w-full flex-col",{"justify-center":!L,"justify-between":L,"items-start":l==="left"&&m,"items-center":l==="center"&&m,"text-left":l==="left","text-center":l==="center","laptop:order-1":i==="left"}),children:[d("div",{className:r("image-with-text__main-content",{"flex flex-col":L}),children:[d("div",{className:r("image-with-text__header",{"laptop:flex laptop:items-end laptop:justify-between laptop:gap-16":(i==="top"||i==="bottom")&&u?.text}),children:[d("div",{className:"image-with-text__title-wrapper flex min-w-0 flex-1 flex-col",children:[e(y,{as:"h2",size:4,html:b,className:r("image-with-text__title",{"text-left":m&&l==="left","text-center":m&&l==="center"})}),k&&e(M,{as:"p",size:m?4:3,html:k,className:r("image-with-text__subtitle tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]",{"laptop:mt-[16px]":!m,"min-xxl:mt-[8px] laptop:text-[16px] lg-desktop:text-[18px]":m,"text-left":m&&l==="left","text-center":m&&l==="center"})})]}),(i==="top"||i==="bottom")&&u?.text&&e(U,{href:X(u.link||"",W),className:"laptop:flex hidden whitespace-nowrap no-underline",suffixIcon:te,children:u.text})]}),!m&&(f||P)&&d("div",{className:"image-with-text__description flex flex-row gap-[8px]",children:[P&&e("img",{src:P,alt:"icon",className:"image-with-text__description-icon desktop:size-[48px] size-[36px]"}),f&&e(y,{as:"h4",size:5,html:f,className:"image-with-text__description-text min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] text-[#3AD1FF] md:text-[40px]"})]}),m&&e("div",{className:r("image-with-text__items laptop:mt-[32px] desktop:mt-[48px] mt-[24px] grid w-full gap-6",{"!mt-6":i==="top"||i==="bottom","grid-cols-2 tablet:grid-cols-4":i==="top"||i==="bottom","grid-cols-2 tablet:grid-cols-4 laptop:grid-cols-2":i==="left"||i==="right"}),children:E.map((t,o)=>d("div",{className:r("image-with-text__item",{"text-center":l==="center"}),children:[d("div",{className:r("image-with-text__item-header flex flex-row items-center gap-[8px]",{"justify-center":l==="center","justify-start":l==="left"}),children:[t.icon?.url&&e(S,{source:t.icon.url,alt:t.icon?.alt,className:"image-with-text__item-icon min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] desktop:h-[44px] lg-desktop:h-[52px] h-[28px] translate-y-[-12%] md:text-[40px]",imgClassName:"h-full !w-full"}),e(y,{size:4,as:"h6",className:"image-with-text__item-text bg-gradient-to-r from-[#3ad1ff] to-[#008cd6] bg-clip-text text-transparent",children:t.text})]}),e(M,{size:4,as:"p",html:t.desc,className:"image-with-text__item-desc tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[-2px] text-[14px]"})]},o))})]}),ue()]}),e("div",{ref:C,className:r("image-with-text__media-wrapper",{"laptop:w-[60%] w-full shrink-0":i==="left"||i==="right","aspect-[716/720] max-h-[560px] max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[824/560] shrink-0":m,"laptop:basis-[63%] desktop:basis-[57%]":m&&i==="left","relative w-full shrink md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] laptop:basis-[64%] desktop:aspect-[648/448]":n,"!max-w-none !max-h-none aspect-auto":i==="top"||i==="bottom"}),children:n?_?K():e(ee,{mode:"wait",children:e(Y.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__image-motion absolute left-0 top-0 w-full",children:e(S,{source:J(),alt:s[p].image?.alt,className:"image-with-text__image rounded-box min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] desktop:aspect-[648/448] md:aspect-[358/360]"})},s[p].image?.url)}):_?K():e(S,{source:J(),className:r("image-with-text__image rounded-box laptop:rounded-box")})})]})});ie.displayName="ImageWithText";var ze=be(ie);export{ze as default};
|
|
1
|
+
"use client";import{jsx as e,jsxs as d}from"react/jsx-runtime";import ke,{useImperativeHandle as ye,useRef as v,useState as b,useEffect as ee}from"react";import{Heading as y,Picture as S,Text as M,Link as te}from"../../components/index.js";import{cn as r,getLocalizedPath as Ne}from"../../helpers/utils.js";import{withLayout as Te}from"../../shared/Styles.js";import{useExposure as Ie}from"../../hooks/useExposure.js";import{useIntersectionObserverDelay as Le}from"../../hooks/useIntersectionObserver.js";import{useAiuiContext as Pe}from"../AiuiProvider/index.js";import{useTracking as Ve}from"../../hooks/useTracking.js";import{trackUrlRef as Se}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as Me}from"../../shared/track.js";import{motion as ie,AnimatePresence as oe}from"framer-motion";const D="image",z="image_with_text",ae=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e("path",{d:"M6.91009 4.41058C7.23553 4.08514 7.76304 4.08514 8.08848 4.41058L13.0885 9.41058C13.4139 9.73602 13.4139 10.2635 13.0885 10.589L8.08848 15.589C7.76304 15.9144 7.23553 15.9144 6.91009 15.589C6.58466 15.2635 6.58466 14.736 6.91009 14.4106L11.3209 9.99977L6.91009 5.58897C6.58466 5.26353 6.58466 4.73602 6.91009 4.41058Z",fill:"currentColor"})}),le=ke.forwardRef(({data:se,className:re},ne)=>{const{title:f,subtitle:w,desc:g,descIcon:P,image:_,padImage:H,mobileImage:E,theme:me="dark",items:R=[],layout:de="left",mediaType:ce="image",datalist:s=[],video:j,padVideo:C,mobVideo:W,button:u,textAlign:l="left",titleTag:pe}=se,i=de,{locale:xe="us"}=Pe(),{buildRef:ue}=Ve(),V=v(null),N=v(null),T=v(null),I=v(null),A=v(null),[c,fe]=b(0),q=v([]),[B,ge]=b({left:0,width:0}),[h,$]=b(""),[F,O]=b(""),[U,Z]=b(""),n=s.length>0,k=ce==="video";Ie(V,{componentType:D,componentName:z,componentTitle:f,componentDescription:w}),ye(ne,()=>V.current),ee(()=>{if(s.length>0){const t=q.current[c];if(t){const{offsetLeft:a,offsetWidth:o}=t;ge({left:a,width:o})}}},[c,s.length]);const[G,he]=b(!1);Le(A,{once:!0,threshold:.01,callback:()=>{he(!0)}}),ee(()=>{if(!G||!k)return;let t="",a="",o="";if(n&&s[c]){const p=s[c];t=p.video?.url||"",a=p.padVideo?.url||t,o=p.mobVideo?.url||t}else t=j?.url||"",a=C?.url||t,o=W?.url||t;t&&$(t),a&&O(a),o&&Z(o),setTimeout(()=>{[N.current?.querySelector("video"),T.current?.querySelector("video"),I.current?.querySelector("video")].forEach(x=>{x&&(x.load(),x.play().catch(()=>{}))})},200)},[G,k,n,c,s,j?.url,C?.url,W?.url]);const ve=(t,a)=>{if(fe(t),a.target.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}),k&&n&&s[t]){const o=s[t];o.video?.url&&$(o.video.url),o.padVideo?.url&&O(o.padVideo.url),o.mobVideo?.url&&Z(o.mobVideo.url),setTimeout(()=>{[N.current?.querySelector("video"),T.current?.querySelector("video"),I.current?.querySelector("video")].forEach(x=>{x&&(x.load(),x.play().catch(()=>{}))})},300)}},J=Ne(u?.link||"",xe),K=u?.link?Se(J,ue(D,z)):J,Q=Me({interactive:!!u?.link,componentType:D,componentName:z,title:f,description:w,buttonName:u?.text}),be=()=>!L||!u?.text||i==="top"||i==="bottom"?null:e("div",{className:r("image-with-text__button-wrapper laptop:mt-[32px] mt-[24px]",{"flex justify-center":l==="center","flex justify-start":l==="left"}),children:e(te,{href:K,...Q,className:"image-with-text__button whitespace-nowrap no-underline",suffixIcon:ae,children:u.text})}),m=R.length>0,L=!!u,X=()=>{if(n&&s[c]){const t=s[c];return`${t.image?.url} ,${t.imgPad?.url||t.image?.url} 1440, ${t.imageMob?.url||t.image?.url} 767`}return _?`${_?.url},${H?.url||_?.url} 1024, ${E?.url||_?.url} 768`:""},Y=()=>{if(n){const p=s[c],x=p.image?.url,we=p.imgPad?.url||x,_e=p.imageMob?.url||x;return e(oe,{mode:"wait",children:e(ie.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__video-motion absolute left-0 top-0 w-full",children:d("div",{className:"image-with-text__video-wrapper rounded-box overflow-hidden",children:[e("div",{ref:N,className:"image-with-text__desktop-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:x,src:h,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),e("div",{ref:T,className:"image-with-text__tablet-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:we,src:F||h,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),e("div",{ref:I,className:"image-with-text__mobile-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:_e,src:U||h,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})},p.video?.url||p.image?.url)})}const t=_?.url,a=H?.url||t,o=E?.url||t;return d("div",{className:"image-with-text__video-wrapper rounded-box laptop:rounded-box overflow-hidden",children:[e("div",{ref:N,className:"image-with-text__desktop-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:t,src:h,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),e("div",{ref:T,className:"image-with-text__tablet-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:a,src:F||h,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),e("div",{ref:I,className:"image-with-text__mobile-video-container",children:e("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:o,src:U||h,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})};return d("section",{ref:V,"data-ui-component-id":"ImageWithText",className:r("image-with-text text-info-primary",{"flex gap-[24px] laptop:gap-[48px] lg-desktop:gap-[64px]":!n,"flex-col":!n&&(i==="top"||i==="bottom"),"items-center":i==="left"||i==="right","flex-col laptop:flex-row":!n&&(i==="left"||i==="right"),"flex l:gap-[24px] xl:flex-col min-md:justify-between min-l:gap-[20px]":n,"aiui-dark":me==="dark"},re),children:[n&&(f||g||s.length>0)&&d("div",{className:r("image-with-text__tab-content min-md:gap-[24px] laptop:basis-[36%] inline-flex flex-col justify-center",{"text-left":l==="left","text-center":l==="center"}),children:[d("div",{className:"image-with-text__header",children:[e(y,{as:"h3",size:4,html:f,className:"image-with-text__title"}),e(M,{as:"p",size:1,html:g,className:"image-with-text__description tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]"})]}),e("div",{className:r("image-with-text__tabs-wrapper md:scrollbar-hidden relative md:overflow-hidden md:overflow-x-scroll",{"flex justify-center":l==="center"}),children:d("div",{className:"image-with-text__tabs rounded-btn relative inline-flex bg-[#1D1D1F] px-[4px] md:my-[24px]",children:[e("div",{className:"image-with-text__slider rounded-btn absolute inset-y-0 bg-white transition-all duration-300 ease-in-out",style:{left:B.left,width:B.width}}),s.map((t,a)=>e("div",{ref:o=>{q.current[a]=o},onClick:o=>ve(a,o),className:r("image-with-text__tab rounded-btn min-xxl:px-[28px] min-xxl:py-[15px] relative z-10 cursor-pointer px-[20px] py-[10px] text-center text-[12px] font-medium transition-colors duration-300 md:px-[20px] md:py-[10px]",c===a?"image-with-text__tab--active text-black":"text-white"),children:e(y,{as:pe??"h3",size:1,html:t?.title,className:"image-with-text__tab-title text-balance-normal !whitespace-nowrap md:text-[14px]"})},a))]})})]}),!n&&(f||w||g)&&d("div",{className:r("image-with-text__content flex w-full flex-col",{"justify-center":!L,"justify-between":L,"items-start":l==="left"&&m,"items-center":l==="center"&&m,"text-left":l==="left","text-center":l==="center","laptop:order-1":i==="left"}),children:[d("div",{className:r("image-with-text__main-content",{"flex flex-col":L}),children:[d("div",{className:r("image-with-text__header",{"laptop:flex laptop:items-end laptop:justify-between laptop:gap-16":(i==="top"||i==="bottom")&&u?.text}),children:[d("div",{className:"image-with-text__title-wrapper flex min-w-0 flex-1 flex-col",children:[e(y,{as:"h2",size:4,html:f,className:r("image-with-text__title",{"text-left":m&&l==="left","text-center":m&&l==="center"})}),w&&e(M,{as:"p",size:m?4:3,html:w,className:r("image-with-text__subtitle tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]",{"laptop:mt-[16px]":!m,"min-xxl:mt-[8px] laptop:text-[16px] lg-desktop:text-[18px]":m,"text-left":m&&l==="left","text-center":m&&l==="center"})})]}),(i==="top"||i==="bottom")&&u?.text&&e(te,{href:K,...Q,className:"laptop:flex hidden whitespace-nowrap no-underline",suffixIcon:ae,children:u.text})]}),!m&&(g||P)&&d("div",{className:"image-with-text__description flex flex-row gap-[8px]",children:[P&&e("img",{src:P,alt:"icon",className:"image-with-text__description-icon desktop:size-[48px] size-[36px]"}),g&&e(y,{as:"h4",size:5,html:g,className:"image-with-text__description-text min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] text-[#3AD1FF] md:text-[40px]"})]}),m&&e("div",{className:r("image-with-text__items laptop:mt-[32px] desktop:mt-[48px] mt-[24px] grid w-full gap-6",{"!mt-6":i==="top"||i==="bottom","grid-cols-2 tablet:grid-cols-4":i==="top"||i==="bottom","grid-cols-2 tablet:grid-cols-4 laptop:grid-cols-2":i==="left"||i==="right"}),children:R.map((t,a)=>d("div",{className:r("image-with-text__item",{"text-center":l==="center"}),children:[d("div",{className:r("image-with-text__item-header flex flex-row items-center gap-[8px]",{"justify-center":l==="center","justify-start":l==="left"}),children:[t.icon?.url&&e(S,{source:t.icon.url,alt:t.icon?.alt,className:"image-with-text__item-icon min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] desktop:h-[44px] lg-desktop:h-[52px] h-[28px] translate-y-[-12%] md:text-[40px]",imgClassName:"h-full !w-full"}),e(y,{size:4,as:"h6",className:"image-with-text__item-text bg-gradient-to-r from-[#3ad1ff] to-[#008cd6] bg-clip-text text-transparent",children:t.text})]}),e(M,{size:4,as:"p",html:t.desc,className:"image-with-text__item-desc tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[-2px] text-[14px]"})]},a))})]}),be()]}),e("div",{ref:A,className:r("image-with-text__media-wrapper",{"laptop:w-[60%] w-full shrink-0":i==="left"||i==="right","aspect-[716/720] max-h-[560px] max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[824/560] shrink-0":m,"laptop:basis-[63%] desktop:basis-[57%]":m&&i==="left","relative w-full shrink md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] laptop:basis-[64%] desktop:aspect-[648/448]":n,"!max-w-none !max-h-none aspect-auto":i==="top"||i==="bottom"}),children:n?k?Y():e(oe,{mode:"wait",children:e(ie.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__image-motion absolute left-0 top-0 w-full",children:e(S,{source:X(),alt:s[c].image?.alt,className:"image-with-text__image rounded-box min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] desktop:aspect-[648/448] md:aspect-[358/360]"})},s[c].image?.url)}):k?Y():e(S,{source:X(),className:r("image-with-text__image rounded-box laptop:rounded-box")})})]})});le.displayName="ImageWithText";var $e=Te(le);export{$e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useRef as o}from"react";import{Grid as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useRef as o}from"react";import{Grid as c,GridItem as a}from"../../../../components/index.js";import{useStickyFlip as r}from"../../hooks/useStickyFlip.js";const s=({BoxLeftGallery:i,BoxRightDetail:d,BoxBottomSummary:m})=>{const t=o(null),p=o(null);return r(t,p),l("div",{id:"ipc-product-card",className:"laptop-md:pt-6 laptop-md:px-grid",children:[l(c,{className:"ipc-box-grid laptop-md:gap-x-4 lg-desktop:gap-6 gap-8 laptop:gap-y-8 laptop-md:gap-y-8",children:[e(a,{ref:t,className:"ipc-box-left-grid-item laptop:px-0 laptop-md:col-start-1 laptop-md:col-span-8 laptop-md:sticky laptop-md:top-[124px] col-span-12 h-fit",children:i}),e(a,{ref:p,className:"ipc-box-right-grid-item laptop-md:col-start-9 laptop-md:col-span-4 col-span-12",children:d})]}),m]})};var x=s;export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,jsxs as m}from"react/jsx-runtime";import{Text as r,Container as L}from"../../../../../components/index.js";import{useAiuiContext as E}from"../../../../AiuiProvider/index.js";import{useBizProductContext as O}from"../../../BizProductProvider.js";import{useMemo as v}from"react";import{formatPrice as d}from"../../../utils/index.js";import{replaceTemplate as h}from"../../../utils/textFormat.js";import{useBenefits as _}from"../../../hooks/useBenefits.js";import j from"../../CartActionButtons/index.js";const q=({totalSavingsSlot:N,renderComparePrice:u}={})=>{const{copyWriting:e,locale:a="us",trackingData:w,currencyCode:n}=E(),{variant:t,finalPrice:S,totalSavings:l,isLogin:s,comparePrice:x,onAddToCart:P,onBuyNow:k,savingDetail:p,addToCartLoading:T,buyNowLoading:A,notifyMeMode:M,onNotifyMeClick:D,discount:z,memberFunctionResult:b}=O(),B=_({variant:t}),{commonCoupon:c,memberDiscount:i}=B,F=w?.showComparePrice??!0,R=v(()=>h(e?.totalSavings||"",{amount:d({amount:l,currencyCode:t.price.currencyCode,locale:n==="CAD"?"us":a||"us"})}),[e?.totalSavings,l,t.price.currencyCode,a]),f=v(()=>{if(!e?.unlockedSaving)return;const g=c?.enable?Number(c?.config?.fixed_value||0):0,C=i?.enable?i.config?.amount??0:0,y=Math.round((b?.withoutCouponMaxMemberTotalSave?Math.max(C,g):C+g)*100)/100;if(!(y<=0))return h(e.unlockedSaving,{amount:d({amount:y,currencyCode:t.price.currencyCode,locale:n==="CAD"?"us":a||"us"})})},[e?.unlockedSaving,c?.enable,c?.config?.fixed_value,i?.enable,i?.config?.amount,b,t.price.currencyCode,a]);return m(L,{childClassName:"tablet:flex tablet:justify-end tablet:gap-8 laptop-md:px-0 desktop:px-0 tablet:items-center tablet:gap-4",className:"laptop-md:border-none laptop-md:py-0 border-t border-[#E4E5E6] bg-white py-3",children:[t.availableForSale?m("div",{className:"ipc-purchase-bar-price laptop-md:items-end flex flex-col justify-between",children:[m("div",{className:"ipc-purchase-bar-price-row flex items-center gap-1",children:[o(r,{className:"ipc-purchase-bar-final-price tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2]",html:d({amount:parseFloat(S.toFixed(2)),currencyCode:t.price.currencyCode,locale:n==="CAD"?"us":a||"us"})}),u?u({comparePrice:x}):F&&(l>0||p?.member>0&&s)&&o(r,{className:"ipc-purchase-bar-compare-price tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2] text-[#4A4C56] line-through",html:d({amount:x,currencyCode:t.price.currencyCode,locale:n==="CAD"?"us":a||"us"})}),p?.member>0&&s&&o(r,{className:"ipc-purchase-bar-member-badge bg-brand-0 rounded px-1 py-[2px] text-sm font-bold text-white",html:e?.memberPrice||"Member Price"})]}),N||(l>0||p?.member>0&&s?o(r,{className:"ipc-purchase-bar-total-savings text-brand-0 tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:`${R}`}):f?o(r,{className:"ipc-purchase-bar-unlocked-saving text-info-quaternary tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:f}):null)]}):o(r,{className:"text-[20px] font-bold text-[#999999]",html:e?.soldOut??"Sold Out"}),o("div",{className:"tablet:mt-0 mt-2 flex items-center gap-2",children:o(j,{mode:M,availableForSale:t.availableForSale,addToCartText:e?.addToCart??"Add to Cart",buyNowText:e?.buyNow??"Buy Now",addToCartLoading:T,buyNowLoading:A,onAddToCart:P,onBuyNow:k,onNotifyMeClick:D,notifyMeText:e?.notifyMe,notifyMeClassName:"w-full"})})]})};var Q=q;export{Q as default};
|
|
1
|
+
import{jsx as o,jsxs as m}from"react/jsx-runtime";import{Text as r,Container as L}from"../../../../../components/index.js";import{useAiuiContext as E}from"../../../../AiuiProvider/index.js";import{useBizProductContext as O}from"../../../BizProductProvider.js";import{useMemo as v}from"react";import{formatPrice as d}from"../../../utils/index.js";import{replaceTemplate as h}from"../../../utils/textFormat.js";import{useBenefits as _}from"../../../hooks/useBenefits.js";import j from"../../CartActionButtons/index.js";const q=({totalSavingsSlot:N,renderComparePrice:u}={})=>{const{copyWriting:e,locale:a="us",trackingData:w,currencyCode:n}=E(),{variant:t,finalPrice:S,totalSavings:l,isLogin:s,comparePrice:x,onAddToCart:P,onBuyNow:k,savingDetail:p,addToCartLoading:T,buyNowLoading:A,notifyMeMode:M,onNotifyMeClick:D,discount:z,memberFunctionResult:b}=O(),B=_({variant:t}),{commonCoupon:c,memberDiscount:i}=B,F=w?.showComparePrice??!0,R=v(()=>h(e?.totalSavings||"",{amount:d({amount:l,currencyCode:t.price.currencyCode,locale:n==="CAD"?"us":a||"us"})}),[e?.totalSavings,l,t.price.currencyCode,a]),f=v(()=>{if(!e?.unlockedSaving)return;const g=c?.enable?Number(c?.config?.fixed_value||0):0,C=i?.enable?i.config?.amount??0:0,y=Math.round((b?.withoutCouponMaxMemberTotalSave?Math.max(C,g):C+g)*100)/100;if(!(y<=0))return h(e.unlockedSaving,{amount:d({amount:y,currencyCode:t.price.currencyCode,locale:n==="CAD"?"us":a||"us"})})},[e?.unlockedSaving,c?.enable,c?.config?.fixed_value,i?.enable,i?.config?.amount,b,t.price.currencyCode,a]);return m(L,{childClassName:"tablet:flex tablet:justify-end tablet:gap-8 laptop-md:px-0 desktop:px-0 lg-desktop:px-grid tablet:items-center tablet:gap-4",className:"laptop-md:border-none laptop-md:py-0 border-t border-[#E4E5E6] bg-white py-3",children:[t.availableForSale?m("div",{className:"ipc-purchase-bar-price laptop-md:items-end flex flex-col justify-between",children:[m("div",{className:"ipc-purchase-bar-price-row flex items-center gap-1",children:[o(r,{className:"ipc-purchase-bar-final-price tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2]",html:d({amount:parseFloat(S.toFixed(2)),currencyCode:t.price.currencyCode,locale:n==="CAD"?"us":a||"us"})}),u?u({comparePrice:x}):F&&(l>0||p?.member>0&&s)&&o(r,{className:"ipc-purchase-bar-compare-price tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2] text-[#4A4C56] line-through",html:d({amount:x,currencyCode:t.price.currencyCode,locale:n==="CAD"?"us":a||"us"})}),p?.member>0&&s&&o(r,{className:"ipc-purchase-bar-member-badge bg-brand-0 rounded px-1 py-[2px] text-sm font-bold text-white",html:e?.memberPrice||"Member Price"})]}),N||(l>0||p?.member>0&&s?o(r,{className:"ipc-purchase-bar-total-savings text-brand-0 tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:`${R}`}):f?o(r,{className:"ipc-purchase-bar-unlocked-saving text-info-quaternary tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:f}):null)]}):o(r,{className:"text-[20px] font-bold text-[#999999]",html:e?.soldOut??"Sold Out"}),o("div",{className:"tablet:mt-0 mt-2 flex items-center gap-2",children:o(j,{mode:M,availableForSale:t.availableForSale,addToCartText:e?.addToCart??"Add to Cart",buyNowText:e?.buyNow??"Buy Now",addToCartLoading:T,buyNowLoading:A,onAddToCart:P,onBuyNow:k,onNotifyMeClick:D,notifyMeText:e?.notifyMe,notifyMeClassName:"w-full"})})]})};var Q=q;export{Q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as l,jsxs as i}from"react/jsx-runtime";import{useState as
|
|
1
|
+
"use client";import{jsx as l,jsxs as i}from"react/jsx-runtime";import{useState as a,forwardRef as C,useRef as b}from"react";import{cn as V,getLocalizedPath as B}from"../../helpers/utils.js";import{withLayout as z}from"../../shared/Styles.js";import{Picture as v,Link as R,Text as D}from"../../components/index.js";import E from"../Title/index.js";import H from"../SwiperBox/index.js";import{Container as S}from"../../components/container.js";import{VideoModal as U}from"../VideoModal/index.js";import{convertLexicalToHTML as $}from"@payloadcms/richtext-lexical/html";import{useExposure as j}from"../../hooks/useExposure.js";import{useAiuiContext as q}from"../AiuiProvider/index.js";import{trackUrlRef as _}from"../../shared/trackUrlRef.js";import{useTracking as Y}from"../../hooks/useTracking.js";const p="video",n="media_player_multi",A=({data:e,configuration:o})=>{const{buildRef:t}=Y(),s=b(null);return j(s,{componentType:p,componentName:n,componentTitle:e?.title,position:o?.index+1,componentDescription:e?.description}),i("div",{ref:s,className:V("laptop:max-w-full w-full overflow-hidden","laptop:flex-row flex shrink-0 flex-col","lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] h-auto","rounded-box"),children:[i("div",{className:"laptop:w-[49%] laptop:h-full tablet:h-[18.22vw] relative h-[35.9vw] w-full flex-none",children:[l(v,{source:e.img?.url,alt:e.img?.alt||"",className:"tablet:block hidden size-full",imgClassName:"w-full h-full object-cover tablet:hover:scale-110 transition-all duration-300"}),l(v,{source:e.mobileImg?.url||e.img?.url,alt:e.mobileImg?.alt||e.img?.alt||"",className:"tablet:hidden block size-full",imgClassName:"w-full h-full object-cover"}),l("div",{className:"laptop:bottom-6 laptop:right-6 absolute bottom-4 right-4",children:(e?.video?.url||e?.youtubeId)&&l("button",{onClick:()=>{o?.onVideoPlayBtnClick?.(o?.index||0,e)},className:"laptop:size-14 bg-opacity/20 flex size-8 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75",children:l("svg",{width:"12",height:"14",viewBox:"0 0 12 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:l("path",{d:"M12 7L0 14L0 0L12 7Z",fill:"white"})})})})]}),i("div",{className:"laptop:gap-[60px] lg-desktop:p-8 tablet:p-6 bg-container-secondary-1 flex min-h-[200px] flex-1 flex-col gap-4 overflow-hidden p-4",children:[i("div",{className:"flex flex-col",children:[l("h3",{className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary mb-2 text-[14px] font-bold leading-[1.2] tracking-[-0.02em]",children:e.title}),e.quote&&l(R,{asChild:!e?.href,href:_(B(e?.href||"",o?.locale||"us"),t(p,n)),"data-headless-type-name":`${p}#${n}`,"data-headless-title-desc-button":`${e?.title}#${e?.description}`,children:l(D,{html:e.quote,weight:"bold",className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary text-sm"})})]}),l("p",{className:"lg-desktop:text-2xl lg-desktop:leading-[1.2] text-info-primary desktop:max-h-[186px] line-clamp-6 max-h-[144px] min-h-[100px] text-xl font-bold leading-[1.2] tracking-[-0.04em]",children:e.description})]})]})},g=C(({data:{items:e=[],shape:o="square",title:t,containerProps:s},className:m="",key:w,onVideoPlayBtnClick:y,...M},k)=>{const[d,c]=a(!1),[P,f]=a(""),[N,u]=a(""),{locale:T="us"}=q(),x=typeof t=="string"?t:t&&$({data:t}),L=b(null),h=e.length===2;return i("div",{...M,ref:L,className:m,children:[l("div",{className:"mediaplayermulti-box",children:l(S,{...s||{},className:"overflow-hidden",children:i("div",{className:m,ref:k,children:[t&&l(E,{className:"mediaplayermulti-title",data:{title:x||""}}),l(H,{className:"!overflow-visible",id:"MediaPlayerMultiSwiper"+w,data:{list:e,configuration:{shape:o,locale:T,onVideoPlayBtnClick:(I,r)=>{c(!0),r?.isYouTube?(u(r?.youtubeId||""),f("")):(f(r?.video?.url||""),u("")),y?.(I)},title:x}},Slide:A,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:h?2:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:h?2:1.5},1440:{spaceBetween:16,freeMode:!1,slidesPerView:2}}})]})})}),d&&l(U,{visible:d,youTubeId:N,videoUrl:P,onCloseModal:()=>c(!1)})]})});g.displayName="MediaPlayerMulti";var ie=z(g);export{ie as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import T,{useImperativeHandle as z,useRef as H}from"react";import{useMediaQuery as P}from"react-responsive";import{Button as x,Heading as R,Picture as y,Text as j}from"../../components/index.js";import{withLayout as C}from"../../shared/Styles.js";import{cn as c,getLocalizedPath as I}from"../../helpers/utils.js";import{isVideo as b}from"../../shared/mimeType.js";import{useExposure as L}from"../../hooks/useExposure.js";import{trackUrlRef as _}from"../../shared/trackUrlRef.js";import{useAiuiContext as D}from"../AiuiProvider/index.js";import{useTracking as S}from"../../hooks/useTracking.js";const r="image",m="member_area",f=T.forwardRef(({data:g,className:k="",...v},h)=>{const{buildRef:N}=S(),{title:t,description:o,backgroundImage:l,mobileBackgroundImage:p,primaryButton:i,secondaryButton:a,theme:B,shape:A,primaryButtonHandler:d,secondaryButtonHandler:q}=g,M=P({query:"(max-width: 768px)"}),n=H(null),{locale:E="us"}=D();z(h,()=>n.current),L(n,{componentType:r,componentName:m,componentTitle:t,componentDescription:o});const $=()=>{console.log("primaryButtonHandler",d),d?.()},w=()=>{q?.()},u="lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px]";return s("section",{"data-ui-component-id":"MemberEquity",...v,className:c("lg-desktop:aspect-[1384/560] desktop:aspect-[1090/488] laptop:aspect-[774/336] tablet:aspect-[704/480]","text-info-primary relative overflow-hidden",k,{"aiui-dark":B==="dark","rounded-box":!0,"h-[480px]":M}),ref:n,children:[b(l?.mimeType)?e("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"laptop:block absolute inset-0 hidden size-full object-cover",children:e("source",{src:l?.url,type:"video/mp4"})}):e(y,{source:l?.url,alt:l?.alt,className:"laptop:block absolute inset-0 hidden size-full object-cover [&_img]:h-full [&_img]:object-cover"}),b(p?.mimeType)?e("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"laptop:hidden absolute inset-0 size-full object-cover",children:e("source",{src:p?.url,type:"video/mp4"})}):e(y,{source:p?.url,alt:p?.alt,className:"laptop:hidden absolute inset-0 size-full object-cover [&_img]:h-full [&_img]:object-cover"}),e("div",{className:"laptop:items-center absolute inset-0 flex w-full items-end py-[16px]",children:s("div",{className:`
|
|
2
2
|
tablet:px-6 laptop:px-[76px] desktop:px-[111px] lg-desktop:px-[139px] tablet:gap-5
|
|
3
3
|
laptop:gap-4 desktop:gap-6 lg-desktop:gap-8 flex w-full flex-col gap-6 px-4
|
|
4
|
-
`,children:[
|
|
4
|
+
`,children:[s("div",{className:"desktop:gap-2 lg-desktop:gap-4 laptop:max-w-[286px] desktop:max-w-[426px] lg-desktop:max-w-[547px] flex flex-col",children:[e(R,{as:"h2",size:3,className:"member-equity-title ",html:t}),e(j,{size:2,className:"member-equity-description lg-desktop:text-[18px] desktop:text-[16px] text-[14px]",html:o})]}),s("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[a&&a.text&&s(x,{"aria-label":t??o,variant:"secondary",onClick:w,className:c("member-equity-button-secondary ",u),as:"a",href:_(I(a.link||"",E),N(r,m)),"data-headless-type-name":`${r}#${m}`,"data-headless-title-desc-button":`${t}#${o}#${a.text}`,children:[a.text,e("span",{className:"sr-only",children:t??o})]}),i&&i.text&&e(x,{variant:"primary",onClick:$,className:c("member-equity-button-primary ",u),"data-headless-type-name":`${r}#${m}`,"data-headless-title-desc-button":`${t}#${o}#${i.text}`,children:i.text})]})]})})]})});f.displayName="MemberEquity";var Y=C(f);export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import*as n from"react";import kt from"fitty";import{cn as o}from"../../helpers/index.js";import{Button as Lt}from"../../components/index.js";import{Text as y}from"../../components/index.js";import{Heading as u}from"../../components/index.js";import Mt from"./CircleProgress.js";import{useExposure as St}from"../../hooks/useExposure.js";const Nt="cart",Pt="mini_cart",Tt=(f,r)=>f==="notEligible"?{backgroundColor:r?.notEligibleLabelColor??"rgba(118, 120, 128, 0.60)"}:f==="gift"?{backgroundColor:r?.giftLabelColor??"rgba(251, 148, 63, 0.60)"}:{backgroundColor:"rgba(251, 148, 63, 0.60)"},G=n.forwardRef(({className:f,classNames:r={},data:U,cart:s,progressConfig:i,onRemoveItem:X,onCheckout:F,onClickToView:M,...Q},O)=>{const b=n.useRef(null),{copy:p,theme:S="light",locale:It="us",showMobileViewMore:Y=!0,maxQuantityDisplay:w,labelStyles:$}=U||{};St(b,{componentType:Nt,componentName:Pt,componentTitle:p?.itemsInCart||"Mini Cart",componentDescription:p?.description}),n.useImperativeHandle(O,()=>b.current);const K=p?.emptyCart||"Your Cart is Empty",N=p?.description||"",Z=p?.itemsInCart||"You have selected {count} items",_=p?.total||"Total {total}",zt=p?.totalWithCoupon||"total: {total} ({subtotal})",P=p?.clickToView||"Click to view cart",J=p?.buyNowText||"Buy Now",tt=p?.savingText||"Saving {amount}",m=n.useMemo(()=>s?.lineItems||[],[s?.lineItems]),T=m.reduce((e,a)=>e+(a?.quantity||0),0),et=T===0,ot=parseFloat(s?.cost?.totalAmount?.amount||"0"),rt=parseFloat(s?.cost?.subtotalAmount?.amount||"0"),at=parseFloat(s?.cost?.savingAmount?.amount||"0"),nt=s?.cost?.totalAmount?.formattedPrice||"",I=rt>ot?s?.cost?.subtotalAmount?.formattedPrice:null,z=at>0?s?.cost?.savingAmount?.formattedPrice:null,d=n.useRef(null),[x,it]=n.useState(!1),[A,B]=n.useState(!1),[E,D]=n.useState(null),j=async e=>{if(!E){D(e);try{await X?.(e,s)}finally{D(null)}}},[R,C]=n.useState(!1),[lt,st]=n.useState(0),[ct,pt]=n.useState(0),[H,dt]=n.useState(!1),[V,mt]=n.useState(!0),h=n.useCallback(()=>{const e=d.current;if(!e)return;const{scrollLeft:a,scrollWidth:c,clientWidth:v}=e;dt(a>0),mt(a<c-v-1)},[]),ut=n.useCallback(()=>{h()},[h]);n.useEffect(()=>{h()},[m.length,h]);const gt=m.map(e=>e.productLabel??"").join("|");n.useEffect(()=>{const e=b.current?.querySelectorAll("[data-fit-label]");if(!e?.length)return;const a=Array.from(e,c=>kt(c,{minSize:8,maxSize:12,multiLine:!1}));return()=>a.forEach(c=>c.unsubscribe())},[gt,x]);const ft=e=>{d.current&&(C(!0),st(e.pageX-d.current.offsetLeft),pt(d.current.scrollLeft))},bt=e=>{if(!R||!d.current)return;e.preventDefault();const c=(e.pageX-d.current.offsetLeft-lt)*1.5;d.current.scrollLeft=ct-c},xt=()=>{C(!1)},ht=()=>{C(!1)},W=e=>{if(d.current){const a=d.current,c=100;a.scrollBy({left:e==="right"?c:-c,behavior:"smooth"})}},k=({className:e})=>t("svg",{className:e,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M6 4L10 8L6 12",stroke:"currentColor",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"})}),vt=({className:e})=>t("svg",{className:e,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M2.5 5H17.5M8.33333 9.16667V14.1667M11.6667 9.16667V14.1667M3.33333 5L4.16667 16.6667C4.16667 17.1087 4.34226 17.5326 4.65482 17.8452C4.96738 18.1577 5.39131 18.3333 5.83333 18.3333H14.1667C14.6087 18.3333 15.0326 18.1577 15.3452 17.8452C15.6577 17.5326 15.8333 17.1087 15.8333 16.6667L16.6667 5M7.5 5V2.5C7.5 2.27899 7.5878 2.06702 7.74408 1.91074C7.90036 1.75446 8.11232 1.66667 8.33333 1.66667H11.6667C11.8877 1.66667 12.0996 1.75446 12.2559 1.91074C12.4122 2.06702 12.5 2.27899 12.5 2.5V5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),yt=e=>m.length?l("div",{className:o("laptop:bg-container-secondary-0 rounded-box-small flex gap-1 p-1",r?.itemsGrid),children:[m.length>=5&&t("button",{onClick:()=>W("left"),className:o("border-border laptop:flex hover:bg-muted-foreground/10 rounded-box-small hidden w-[32px] shrink-0 items-center justify-center px-2 transition-colors",!H&&"laptop:bg-container-secondary-1 laptop:text-transparent laptop:pointer-events-none laptop:-my-1 laptop:-ml-1 laptop:py-1 laptop:pl-1 laptop:rounded-r-none",r?.expandButton,{"laptop:bg-container-secondary-0":e==="dark","laptop:bg-container-primary":e==="dark"&&!H}),"aria-label":"Scroll left to see more items",children:t(k,{className:"laptop:size-4 size-5 rotate-180"})}),l("div",{ref:d,onMouseDown:ft,onMouseMove:bt,onMouseUp:xt,onMouseLeave:ht,onScroll:ut,className:o("scrollbar-hide laptop:gap-1 laptop:w-[156px] desktop:w-[256px] laptop:shrink-0 flex w-full gap-1 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",R?"cursor-grabbing":"cursor-grab",r?.itemGridContainer),children:[m.filter(a=>a&&a.id).map(a=>{const v=(a.merchandise||{}).image||{},q=v.url,Ct=v.altText||"Product image",L=E===a.id;return l("div",{className:o("laptop:size-12 bg-container-primary laptop:bg-white rounded-box-small group relative size-16 shrink-0 overflow-hidden",r?.gridItem),children:[q&&t("img",{src:q,alt:Ct,draggable:!1,className:"rounded-box-small pointer-events-none size-full select-none object-cover"}),L&&t("div",{className:"rounded-box-small absolute inset-0 z-20 flex items-center justify-center bg-black/50",children:l("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"animate-spin text-white",children:[t("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",opacity:"0.3"}),t("path",{d:"M14 8a6 6 0 0 0-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),t("span",{role:"button",onClick:()=>j(a.id),className:o("laptop:hidden absolute right-[2px] top-[2px] cursor-pointer",L&&"pointer-events-none opacity-0"),"aria-label":"delete",children:l("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"pointer-events-none",children:[t("rect",{x:"1.33301",y:"1.33301",width:"13.3333",height:"13.3333",rx:"6.66667",fill:"white"}),t("path",{d:"M5.37705 5.28896C5.57234 5.09402 5.88839 5.09442 6.08347 5.28965L8.08602 7.29358L10.0906 5.28896C10.2858 5.09402 10.6026 5.09395 10.7977 5.28896C10.9928 5.48418 10.9926 5.80078 10.7977 5.99607L8.79312 8.00069L10.7964 10.0053C10.9913 10.2007 10.9909 10.5179 10.7957 10.7131C10.6005 10.908 10.2844 10.9074 10.0893 10.7124L8.08602 8.7078L6.08347 10.7103C5.88821 10.9056 5.57155 10.9057 5.37636 10.7103C5.18148 10.515 5.18132 10.1984 5.37636 10.0032L7.37891 8.00069L5.37636 5.99676C5.18119 5.80143 5.18181 5.48423 5.37705 5.28896Z",fill:"#767880"})]})}),a.productLabel&&t("div",{className:"absolute inset-x-0 bottom-0 flex items-center justify-center",children:t("div",{className:"rounded-b-box-small relative flex max-h-4 w-full items-center justify-center overflow-hidden px-1 py-0 backdrop-blur-sm",style:Tt(a.labelVariant,$),children:t("div",{className:"w-full text-center",children:t(y,{size:1,"data-fit-label":!0,className:"relative leading-[16px] text-white",html:a.productLabel})})})}),a.quantity>1&&t("div",{className:"mini-cart-quantity bg-brand-0 absolute bottom-0 right-0 z-10 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-white",children:t(y,{className:"whitespace-nowrap text-sm leading-none",html:wt(a.quantity)})}),t("div",{role:"button",onClick:()=>j(a.id),className:o("rounded-box-small absolute inset-0 hidden cursor-pointer items-center justify-center bg-black/60 transition-opacity","laptop:flex laptop:opacity-0 laptop:group-hover:opacity-100",L&&"laptop:hidden",r?.gridItemOverlay),"aria-label":"Remove item",children:t(vt,{className:"pointer-events-none size-[20px] text-white"})})]},a.id)}),Y&&t("button",{onClick:()=>M?.(s),className:o("bg-container-secondary-0 laptop:hidden flex size-16 shrink-0 items-center justify-center rounded-md",r?.mobileViewMoreButton),"aria-label":P,children:t("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-quaternary",children:t("path",{d:"M7.5 5L12.5 10L7.5 15",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),m.length>=5&&t("button",{onClick:()=>W("right"),className:o("border-border laptop:flex hover:bg-muted-foreground/10 rounded-box-small hidden w-[32px] shrink-0 items-center justify-center px-2 transition-colors",!V&&"laptop:bg-container-secondary-1 laptop:text-transparent laptop:pointer-events-none laptop:-my-1 laptop:-mr-1 laptop:py-1 laptop:pr-1 laptop:rounded-l-none",r?.expandButton,{"laptop:bg-container-secondary-0":e==="dark","laptop:bg-container-primary":e==="dark"&&!V}),"aria-label":"Scroll right to see more items",children:t(k,{className:"laptop:size-4 size-5"})})]}):null,g=!et&&m.length>0,wt=e=>w!==void 0&&e>w?`${w}+`:String(e);return t("div",{ref:b,className:o("bg-container-secondary-1 text-info-primary tablet:px-6 laptop:px-12 desktop:px-12 lg-desktop:px-[128px] laptop:py-[16px] flex w-full px-4 py-[12px]","flex-col items-stretch gap-3","laptop:flex-row laptop:items-center laptop:justify-around","laptop:items-center laptop:gap-4","tablet:gap-6 laptop:gap-8",f,r?.root,{"aiui-dark bg-container-primary":S==="dark"}),...Q,children:l("div",{className:o("laptop:flex-row flex w-full flex-col gap-4","laptop:flex-1 laptop:items-center laptop:justify-between","tablet:gap-6 laptop:gap-8",r?.content),children:[l("div",{className:o("relative flex shrink flex-row items-center gap-2","desktop:gap-4",i&&"laptop:pl-[104px] pl-[72px]"),children:[i&&t(Mt,{totalSteps:i.totalSteps,currentStep:i.currentStep,image:i.image,label:i.label,progressColor:i.progressColor,labelColor:i.labelColor,backgroundColor:i.backgroundColor,size:i.size,laptopSize:i.laptopSize,centerText:i.centerText,dimmed:i.dimmed,dimmedBadge:i.dimmedBadge,trackColor:i.trackColor,classNames:i.classNames,className:o("mini-cart-progress absolute bottom-0 left-0","lg-desktop:bottom-auto lg-desktop:top-[-46px] desktop:bottom-auto desktop:top-[-52px]",r?.circleProgress)}),l("div",{className:"laptop:flex-1 flex w-full flex-col",children:[t("div",{className:o("tablet:gap-2 flex flex-col gap-1",r?.cartInfo),children:g?l("div",{className:"flex w-full items-center gap-2",children:[t(u,{size:2,as:"h3",className:o("",r?.cartTitle),html:Z.replace("{count}",`<span class="mini-cart-count text-brand-0">${T||0}</span>`)}),l(u,{size:1,as:"h5",onClick:()=>{window.innerWidth<1025?it(!x):M?.(s)},className:o("flex cursor-pointer items-center gap-1",r?.expandButton),children:[t(y,{as:"span",size:1,className:"desktop:block hidden text-nowrap text-[16px] ",html:P}),t(k,{className:o("size-4 transition-transform",x?"laptop:rotate-0 -rotate-90":"laptop:rotate-0 rotate-90")})]})]}):t(u,{as:"h3",size:2,className:o("tablet:text-2xl text-xl",r?.cartTitle),html:K})}),N&&t(y,{size:2,className:o("mini-cart-description text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] text-[14px]",r?.cartDescription),html:N})]})]}),g&&t("div",{className:o("laptop:block laptop:shrink",x?"block":"hidden"),children:yt(S)}),g&&t("hr",{className:"laptop:hidden border-lines w-full border-t"}),l("div",{className:o("tablet:gap-6 laptop:gap-4 laptop:justify-end flex flex-row items-stretch justify-between gap-4",r?.priceSection),children:[l("div",{className:"flex flex-col items-end justify-center",children:[l("div",{className:"flex items-center gap-2",children:[t(u,{as:"h6",size:2,className:o("whitespace-nowrap text-nowrap",r?.totalPrice),html:_.replace("{total}",nt)}),I&&t(u,{as:"h6",size:2,className:o("text-info-tertiary whitespace-nowrap line-through",r?.originalPrice),html:I})]}),z&&t(u,{size:2,as:"h6",className:o("mini-cart-saving laptop:text-right text-marketing-1 w-full whitespace-nowrap text-nowrap text-left",r?.saveAmount),html:tt.replace("{amount}",z)})]}),t(Lt,{disabled:!g,loading:A,onClick:async()=>{if(!A){B(!0);try{await F?.(s)}finally{B(!1)}}},className:o("mini-cart-action-button whitespace-nowrap",r?.actionButton),children:J})]})]})})});G.displayName="MiniCart";var Vt=G;export{Vt as default,Tt as resolveCartLineLabelStyle};
|
|
1
|
+
"use client";import{jsx as t,jsxs as s}from"react/jsx-runtime";import*as i from"react";import It from"fitty";import{cn as r}from"../../helpers/index.js";import{Button as zt}from"../../components/index.js";import{Text as k}from"../../components/index.js";import{Heading as f}from"../../components/index.js";import At from"./CircleProgress.js";import{useExposure as Bt}from"../../hooks/useExposure.js";import{toPlainTrackingText as x}from"../../shared/track.js";const Q="cart",O="mini_cart",Et=(h,a)=>h==="notEligible"?{backgroundColor:a?.notEligibleLabelColor??"rgba(118, 120, 128, 0.60)"}:h==="gift"?{backgroundColor:a?.giftLabelColor??"rgba(251, 148, 63, 0.60)"}:{backgroundColor:"rgba(251, 148, 63, 0.60)"},Y=i.forwardRef(({className:h,classNames:a={},data:K,cart:c,progressConfig:l,onRemoveItem:Z,onCheckout:_,onClickToView:T,...J},tt)=>{const v=i.useRef(null),{copy:p,theme:I="light",locale:Dt="us",showMobileViewMore:et=!0,maxQuantityDisplay:L,labelStyles:ot}=K||{};Bt(v,{componentType:Q,componentName:O,componentTitle:p?.itemsInCart||"Mini Cart",componentDescription:p?.description}),i.useImperativeHandle(tt,()=>v.current);const rt=p?.emptyCart||"Your Cart is Empty",z=p?.description||"",at=p?.itemsInCart||"You have selected {count} items",nt=p?.total||"Total {total}",jt=p?.totalWithCoupon||"total: {total} ({subtotal})",y=p?.clickToView||"Click to view cart",A=p?.buyNowText||"Buy Now",it=x(p?.itemsInCart||"Mini Cart"),lt=x(p?.description),u=(e,o=1,n)=>({"data-headless-type-name":`${Q}#${O}`,"data-headless-title-desc-button":`${n?.title??it}#${lt}#${x(e)}`,"data-headless-nav-position":`#${o}`,...n?.sku?{"data-headless-sku":n.sku}:{}}),st=p?.savingText||"Saving {amount}",m=i.useMemo(()=>c?.lineItems||[],[c?.lineItems]),B=m.reduce((e,o)=>e+(o?.quantity||0),0),ct=B===0,pt=parseFloat(c?.cost?.totalAmount?.amount||"0"),dt=parseFloat(c?.cost?.subtotalAmount?.amount||"0"),mt=parseFloat(c?.cost?.savingAmount?.amount||"0"),ut=c?.cost?.totalAmount?.formattedPrice||"",E=dt>pt?c?.cost?.subtotalAmount?.formattedPrice:null,D=mt>0?c?.cost?.savingAmount?.formattedPrice:null,d=i.useRef(null),[w,gt]=i.useState(!1),[j,R]=i.useState(!1),[H,V]=i.useState(null),W=async e=>{if(!H){V(e);try{await Z?.(e,c)}finally{V(null)}}},[$,M]=i.useState(!1),[ft,bt]=i.useState(0),[xt,ht]=i.useState(0),[q,vt]=i.useState(!1),[G,yt]=i.useState(!0),C=i.useCallback(()=>{const e=d.current;if(!e)return;const{scrollLeft:o,scrollWidth:n,clientWidth:g}=e;vt(o>0),yt(o<n-g-1)},[]),wt=i.useCallback(()=>{C()},[C]);i.useEffect(()=>{C()},[m.length,C]);const Ct=m.map(e=>e.productLabel??"").join("|");i.useEffect(()=>{const e=v.current?.querySelectorAll("[data-fit-label]");if(!e?.length)return;const o=Array.from(e,n=>It(n,{minSize:8,maxSize:12,multiLine:!1}));return()=>o.forEach(n=>n.unsubscribe())},[Ct,w]);const kt=e=>{d.current&&(M(!0),bt(e.pageX-d.current.offsetLeft),ht(d.current.scrollLeft))},Lt=e=>{if(!$||!d.current)return;e.preventDefault();const n=(e.pageX-d.current.offsetLeft-ft)*1.5;d.current.scrollLeft=xt-n},Mt=()=>{M(!1)},St=()=>{M(!1)},U=e=>{if(d.current){const o=d.current,n=100;o.scrollBy({left:e==="right"?n:-n,behavior:"smooth"})}},S=({className:e})=>t("svg",{className:e,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M6 4L10 8L6 12",stroke:"currentColor",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"})}),Nt=({className:e})=>t("svg",{className:e,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M2.5 5H17.5M8.33333 9.16667V14.1667M11.6667 9.16667V14.1667M3.33333 5L4.16667 16.6667C4.16667 17.1087 4.34226 17.5326 4.65482 17.8452C4.96738 18.1577 5.39131 18.3333 5.83333 18.3333H14.1667C14.6087 18.3333 15.0326 18.1577 15.3452 17.8452C15.6577 17.5326 15.8333 17.1087 15.8333 16.6667L16.6667 5M7.5 5V2.5C7.5 2.27899 7.5878 2.06702 7.74408 1.91074C7.90036 1.75446 8.11232 1.66667 8.33333 1.66667H11.6667C11.8877 1.66667 12.0996 1.75446 12.2559 1.91074C12.4122 2.06702 12.5 2.27899 12.5 2.5V5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),Pt=e=>m.length?s("div",{className:r("laptop:bg-container-secondary-0 rounded-box-small flex gap-1 p-1",a?.itemsGrid),children:[m.length>=5&&t("button",{onClick:()=>U("left"),...u("prev"),className:r("border-border laptop:flex hover:bg-muted-foreground/10 rounded-box-small hidden w-[32px] shrink-0 items-center justify-center px-2 transition-colors",!q&&"laptop:bg-container-secondary-1 laptop:text-transparent laptop:pointer-events-none laptop:-my-1 laptop:-ml-1 laptop:py-1 laptop:pl-1 laptop:rounded-r-none",a?.expandButton,{"laptop:bg-container-secondary-0":e==="dark","laptop:bg-container-primary":e==="dark"&&!q}),"aria-label":"Scroll left to see more items",children:t(S,{className:"laptop:size-4 size-5 rotate-180"})}),s("div",{ref:d,onMouseDown:kt,onMouseMove:Lt,onMouseUp:Mt,onMouseLeave:St,onScroll:wt,className:r("scrollbar-hide laptop:gap-1 laptop:w-[156px] desktop:w-[256px] laptop:shrink-0 flex w-full gap-1 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",$?"cursor-grabbing":"cursor-grab",a?.itemGridContainer),children:[m.filter(o=>o&&o.id).map((o,n)=>{const g=o.merchandise||{},X=g.image||{},F=X.url,N=X.altText||"Product image",P=H===o.id;return s("div",{className:r("laptop:size-12 bg-container-primary laptop:bg-white rounded-box-small group relative size-16 shrink-0 overflow-hidden",a?.gridItem),children:[F&&t("img",{src:F,alt:N,draggable:!1,className:"rounded-box-small pointer-events-none size-full select-none object-cover"}),P&&t("div",{className:"rounded-box-small absolute inset-0 z-20 flex items-center justify-center bg-black/50",children:s("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"animate-spin text-white",children:[t("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",opacity:"0.3"}),t("path",{d:"M14 8a6 6 0 0 0-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),t("span",{role:"button",onClick:()=>W(o.id),...u("delete",n+1,{title:x(g.title??N),sku:g.sku}),className:r("laptop:hidden absolute right-[2px] top-[2px] cursor-pointer",P&&"pointer-events-none opacity-0"),"aria-label":"delete",children:s("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"pointer-events-none",children:[t("rect",{x:"1.33301",y:"1.33301",width:"13.3333",height:"13.3333",rx:"6.66667",fill:"white"}),t("path",{d:"M5.37705 5.28896C5.57234 5.09402 5.88839 5.09442 6.08347 5.28965L8.08602 7.29358L10.0906 5.28896C10.2858 5.09402 10.6026 5.09395 10.7977 5.28896C10.9928 5.48418 10.9926 5.80078 10.7977 5.99607L8.79312 8.00069L10.7964 10.0053C10.9913 10.2007 10.9909 10.5179 10.7957 10.7131C10.6005 10.908 10.2844 10.9074 10.0893 10.7124L8.08602 8.7078L6.08347 10.7103C5.88821 10.9056 5.57155 10.9057 5.37636 10.7103C5.18148 10.515 5.18132 10.1984 5.37636 10.0032L7.37891 8.00069L5.37636 5.99676C5.18119 5.80143 5.18181 5.48423 5.37705 5.28896Z",fill:"#767880"})]})}),o.productLabel&&t("div",{className:"absolute inset-x-0 bottom-0 flex items-center justify-center",children:t("div",{className:"rounded-b-box-small relative flex max-h-4 w-full items-center justify-center overflow-hidden px-1 py-0 backdrop-blur-sm",style:Et(o.labelVariant,ot),children:t("div",{className:"w-full text-center",children:t(k,{size:1,"data-fit-label":!0,className:"relative leading-[16px] text-white",html:o.productLabel})})})}),o.quantity>1&&t("div",{className:"mini-cart-quantity bg-brand-0 absolute bottom-0 right-0 z-10 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-white",children:t(k,{className:"whitespace-nowrap text-sm leading-none",html:Tt(o.quantity)})}),t("div",{role:"button",onClick:()=>W(o.id),...u("delete",n+1,{title:x(g.title??N),sku:g.sku}),className:r("rounded-box-small absolute inset-0 hidden cursor-pointer items-center justify-center bg-black/60 transition-opacity","laptop:flex laptop:opacity-0 laptop:group-hover:opacity-100",P&&"laptop:hidden",a?.gridItemOverlay),"aria-label":"Remove item",children:t(Nt,{className:"pointer-events-none size-[20px] text-white"})})]},o.id)}),et&&t("button",{onClick:()=>T?.(c),...u(y),className:r("bg-container-secondary-0 laptop:hidden flex size-16 shrink-0 items-center justify-center rounded-md",a?.mobileViewMoreButton),"aria-label":y,children:t("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-quaternary",children:t("path",{d:"M7.5 5L12.5 10L7.5 15",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),m.length>=5&&t("button",{onClick:()=>U("right"),...u("next"),className:r("border-border laptop:flex hover:bg-muted-foreground/10 rounded-box-small hidden w-[32px] shrink-0 items-center justify-center px-2 transition-colors",!G&&"laptop:bg-container-secondary-1 laptop:text-transparent laptop:pointer-events-none laptop:-my-1 laptop:-mr-1 laptop:py-1 laptop:pr-1 laptop:rounded-l-none",a?.expandButton,{"laptop:bg-container-secondary-0":e==="dark","laptop:bg-container-primary":e==="dark"&&!G}),"aria-label":"Scroll right to see more items",children:t(S,{className:"laptop:size-4 size-5"})})]}):null,b=!ct&&m.length>0,Tt=e=>L!==void 0&&e>L?`${L}+`:String(e);return t("div",{ref:v,className:r("bg-container-secondary-1 text-info-primary tablet:px-6 laptop:px-12 desktop:px-12 lg-desktop:px-[128px] laptop:py-[16px] flex w-full px-4 py-[12px]","flex-col items-stretch gap-3","laptop:flex-row laptop:items-center laptop:justify-around","laptop:items-center laptop:gap-4","tablet:gap-6 laptop:gap-8",h,a?.root,{"aiui-dark bg-container-primary":I==="dark"}),...J,children:s("div",{className:r("laptop:flex-row flex w-full flex-col gap-4","laptop:flex-1 laptop:items-center laptop:justify-between","tablet:gap-6 laptop:gap-8",a?.content),children:[s("div",{className:r("relative flex shrink flex-row items-center gap-2","desktop:gap-4",l&&"laptop:pl-[104px] pl-[72px]"),children:[l&&t(At,{totalSteps:l.totalSteps,currentStep:l.currentStep,image:l.image,label:l.label,progressColor:l.progressColor,labelColor:l.labelColor,backgroundColor:l.backgroundColor,size:l.size,laptopSize:l.laptopSize,centerText:l.centerText,dimmed:l.dimmed,dimmedBadge:l.dimmedBadge,trackColor:l.trackColor,classNames:l.classNames,className:r("mini-cart-progress absolute bottom-0 left-0","lg-desktop:bottom-auto lg-desktop:top-[-46px] desktop:bottom-auto desktop:top-[-52px]",a?.circleProgress)}),s("div",{className:"laptop:flex-1 flex w-full flex-col",children:[t("div",{className:r("tablet:gap-2 flex flex-col gap-1",a?.cartInfo),children:b?s("div",{className:"flex w-full items-center gap-2",children:[t(f,{size:2,as:"h3",className:r("",a?.cartTitle),html:at.replace("{count}",`<span class="mini-cart-count text-brand-0">${B||0}</span>`)}),s(f,{size:1,as:"h5",onClick:()=>{window.innerWidth<1025?gt(!w):T?.(c)},...u(y),className:r("flex cursor-pointer items-center gap-1",a?.expandButton),children:[t(k,{as:"span",size:1,className:"desktop:block hidden text-nowrap text-[16px] ",html:y}),t(S,{className:r("size-4 transition-transform",w?"laptop:rotate-0 -rotate-90":"laptop:rotate-0 rotate-90")})]})]}):t(f,{as:"h3",size:2,className:r("tablet:text-2xl text-xl",a?.cartTitle),html:rt})}),z&&t(k,{size:2,className:r("mini-cart-description text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] text-[14px]",a?.cartDescription),html:z})]})]}),b&&t("div",{className:r("laptop:block laptop:shrink",w?"block":"hidden"),children:Pt(I)}),b&&t("hr",{className:"laptop:hidden border-lines w-full border-t"}),s("div",{className:r("tablet:gap-6 laptop:gap-4 laptop:justify-end flex flex-row items-stretch justify-between gap-4",a?.priceSection),children:[s("div",{className:"flex flex-col items-end justify-center",children:[s("div",{className:"flex items-center gap-2",children:[t(f,{as:"h6",size:2,className:r("whitespace-nowrap text-nowrap",a?.totalPrice),html:nt.replace("{total}",ut)}),E&&t(f,{as:"h6",size:2,className:r("text-info-tertiary whitespace-nowrap line-through",a?.originalPrice),html:E})]}),D&&t(f,{size:2,as:"h6",className:r("mini-cart-saving laptop:text-right text-marketing-1 w-full whitespace-nowrap text-nowrap text-left",a?.saveAmount),html:st.replace("{amount}",D)})]}),t(zt,{disabled:!b,loading:j,onClick:async()=>{if(!j){R(!0);try{await _?.(c)}finally{R(!1)}}},...u(A),className:r("mini-cart-action-button whitespace-nowrap",a?.actionButton),children:A})]})]})})});Y.displayName="MiniCart";var Xt=Y;export{Xt as default,Et as resolveCartLineLabelStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as D,jsx as t,jsxs as l}from"react/jsx-runtime";import Q,{useState as L,useEffect as Y,useRef as q}from"react";import{useMediaQuery as O}from"react-responsive";import Z from"./MultiLayoutGraphicBlockCarousel.js";import{withLayout as F}from"../../shared/Styles.js";import z from"../../components/picture.js";import R from"../../components/button.js";import{Heading as j}from"../../components/heading.js";import{VideoModal as J}from"../VideoModal/index.js";import{Grid as K,GridItem as E}from"../../components/grid.js";import W from"../Title/index.js";import{cn as P,spaceToHyphen as I,getLocalizedPath as G}from"../../helpers/utils.js";import S from"../SwiperBox/index.js";import{isVideo as H}from"../../shared/mimeType.js";import{Tabs as X,TabsList as ee,TabsTrigger as te,TabsContent as ae}from"../../components/tabs.js";import{useExposure as se}from"../../hooks/useExposure.js";import{trackUrlRef as _}from"../../shared/trackUrlRef.js";import{useAiuiContext as oe}from"../AiuiProvider/index.js";import{gaTrack as le}from"../../shared/track.js";const h="image",k="p1_banner",$=({data:b,configuration:o,jIndex:d,spanType:T,title:w,onSecondaryButtonClick:u,onPrimaryButtonClick:N})=>{const[i,M]=L(!1),m=O({query:"(max-width: 768px)"}),n=q(null),C=()=>{if(T)switch(T){case"full":return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case"half":return"tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case"one-third":return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}else switch(o?.num){case 1:return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case 2:return"tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case 3:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}};se(n,{componentType:h,componentName:k,position:d,componentTitle:b.title,componentDescription:b.description,navigation:o?.activeTab}),Y(()=>{M(m)},[m]);const{theme:V="light",title:r,description:c,imageUrl:p,primaryButton:g,secondaryButton:s,imageMobileUrl:y,blockLink:v,video:f,youtubeId:B,isYouTube:x,id:e}=b,a="lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px]";return l("div",{className:P("item-wrapper cursor-pointer","text-info-primary group relative box-border w-full overflow-hidden",C(),{"rounded-box":!0,"aiui-dark":V==="dark","h-[400px]":i},"text-info-primary"),ref:n,children:[(v||s.link)&&t("a",{className:"absolute inset-0 z-10",href:_(G(v||s.link||"",o?.locale||"us"),`${h}_${k}`),"data-headless-type-name":`${h}#${k}`,"data-headless-title-desc-button":`${r}#${c}`,"data-headless-nav-position":`${o?.activeTab}#${d}`,"aria-hidden":"true",tabIndex:-1}),l("div",{className:"absolute inset-0",children:[H(p?.mimeType)?t("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:block hidden size-full overflow-hidden object-cover",children:t("source",{src:p?.url,type:"video/mp4"})}):t(z,{source:p?.url,alt:p?.alt||"",className:"tablet:block hidden h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 group-hover:scale-105 object-cover",style:{aspectRatio:`${p?.width}/${p?.height}`}}),H(y?.mimeType)?t("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:hidden block size-full overflow-hidden object-cover",children:t("source",{src:y?.url,type:"video/mp4"})}):t(z,{source:y?.url||p?.url,alt:y?.alt||p?.alt||"",className:"tablet:hidden block h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 object-cover"})]}),l("div",{className:P("pointer-events-none absolute inset-0 z-20 flex flex-col",T==="full"?"laptop:justify-center justify-end":"justify-end"),children:[l("div",{className:"laptop:p-6 desktop:p-[32px] laptop:gap-4 desktop:gap-6 pointer-events-auto flex w-fit flex-col gap-6 p-4",children:[l("div",{className:"flex flex-col gap-1",children:[t(j,{size:3,as:"h3",className:"item-title",html:r}),t(j,{as:"h4",className:"item-description desktop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px]",html:c})]}),l("div",{className:"lg-desktop:gap-3 flex gap-2",children:[s&&s.text&&l(R,{"aria-label":r??c,className:P(a,"link-left"),variant:"secondary",as:"a","data-track":`${e}-link-left`,onClick:()=>{u?.(b)},href:_(G(s.link||"",o?.locale||"us"),`${h}_${k}`),"data-headless-type-name":`${h}#${k}`,"data-headless-title-desc-button":`${r}#${c}#${s.text}`,"data-headless-nav-position":`${o?.activeTab}#${d}`,children:[s.text,t("span",{className:"sr-only",children:r??c})]}),g&&g.text&&t(R,{"aria-label":r??c,className:P(a,"link-right"),variant:"primary","data-track":`${e}-link-right`,as:"a",onClick:()=>{N?.(b)},href:_(G(g.link||"",o?.locale||"us"),`${h}_${k}`),"data-headless-type-name":`${h}#${k}`,"data-headless-title-desc-button":`${r}#${c}#${g.text}`,"data-headless-nav-position":`${o?.activeTab}#${d}`,children:g.text})]})]}),(f?.url||B)&&t("div",{className:"laptop:bottom-6 laptop:right-6 pointer-events-auto absolute bottom-4 right-4",children:t("button",{onClick:()=>{o?.onVideoPlayBtnClick?.(x&&B?B:f?.url||B,x)},className:"laptop:size-12 flex size-8 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75",children:t("svg",{width:"12",height:"14",viewBox:"0 0 12 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M12 7L0 14L0 0L12 7Z",fill:"white"})})})})]})]})},U=Q.forwardRef((b,o)=>{const{data:d,className:T,onSecondaryButtonClick:w,onPrimaryButtonClick:u,...N}=b,{sectionTitle:i,groupByTab:M=!1,items:m=[],carousel:n}=d,[C,V]=L(!1),[r,c]=L(""),[p,g]=L(""),{locale:s="us"}=oe(),y=e=>{switch(e){case"full":return 12;case"half":return 6;case"one-third":return 4}},v=m.map(e=>e.tabName).filter(Boolean).filter((e,a,A)=>A.indexOf(e)===a),f=(e,a)=>{V(!0),a?g?.(e||""):c?.(e||"")},B=(e,a)=>{switch(e){case 1:return 1;case 2:return 2;default:return a?2.3:3}},x=v.map(e=>({tabName:e,items:m.filter(a=>a.tabName===e)})).reduce((e,a)=>(e[a.tabName]=a.items,e),{});return d.mode==="carousel"&&m.length>0?t(Z,{data:d,onPrimaryButtonClick:u,onSecondaryButtonClick:w,className:T,ref:o,...N}):l("section",{"data-ui-component-id":"MultiLayoutGraphicBlock",ref:o,...N,className:P("multiLayoutGraphicBlock","text-info-primary",T),children:[i&&t(W,{data:{title:i},className:"section-title"}),M?l(X,{align:"left",defaultValue:I(v[0]),children:[t(ee,{children:v.map((e,a)=>t(te,{value:I(e),onClick:()=>{le({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:h,component_name:k,component_title:i,component_position:1,navigation:e,button_name:e}})},children:e},a))}),v.map((e,a)=>t(ae,{value:I(e),className:"desktop:mt-[36px] mt-[24px] w-full",children:l(D,{children:[t(S,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock1",data:{list:x?.[e]||[],configuration:{isTab:M,activeTab:e,title:i,num:x?.[e]?.length||0,locale:s,onVideoPlayBtnClick:f,onSecondaryButtonClick:w,onPrimaryButtonClick:u}},Slide:$,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:B(x?.[e]?.length||0,!0)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:B(x?.[e]?.length||0)}}}),n&&n?.items.length>0?t(S,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock2",data:{list:n?.items||[],configuration:{isTab:M,locale:s,onVideoPlayBtnClick:f,title:i,onSecondaryButtonClick:w,onPrimaryButtonClick:u}},Slide:$,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]})},a))]}):l(D,{children:[l(K,{className:"w-full",children:[m.map((e,a)=>t(E,{span:y(e.width??"full"),className:"laptop:block hidden",children:t($,{data:e,configuration:{locale:s,onVideoPlayBtnClick:f,title:i},jIndex:a,spanType:e.width,onSecondaryButtonClick:w,onPrimaryButtonClick:u})},`${e?.title||""}${a}`)),m.map((e,a)=>t(E,{span:y("full"),className:"laptop:hidden block",children:t($,{data:e,configuration:{locale:s,onVideoPlayBtnClick:f,title:i},jIndex:a,spanType:"full",onSecondaryButtonClick:w,onPrimaryButtonClick:u})},`${e?.title||""}${a}`))]}),n&&n?.items.length>0?t(S,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock3",data:{list:n?.items||[],configuration:{locale:s,onVideoPlayBtnClick:f,title:i,onSecondaryButtonClick:w,onPrimaryButtonClick:u}},Slide:$,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]}),C&&t(J,{visible:C,youTubeId:p,videoUrl:r,onCloseModal:()=>V(!1)})]})});U.displayName="MultiLayoutGraphicBlock";var Te=F(U,{container:{desktopSpan:12,mobileSpan:12}});export{Te as default};
|
|
1
|
+
import{Fragment as A,jsx as t,jsxs as l}from"react/jsx-runtime";import Q,{useState as L,useEffect as Y,useRef as q}from"react";import{useMediaQuery as O}from"react-responsive";import Z from"./MultiLayoutGraphicBlockCarousel.js";import{withLayout as F}from"../../shared/Styles.js";import R from"../../components/picture.js";import j from"../../components/button.js";import{Heading as E}from"../../components/heading.js";import{VideoModal as J}from"../VideoModal/index.js";import{Grid as K,GridItem as H}from"../../components/grid.js";import W from"../Title/index.js";import{cn as P,spaceToHyphen as G,getLocalizedPath as S}from"../../helpers/utils.js";import _ from"../SwiperBox/index.js";import{isVideo as U}from"../../shared/mimeType.js";import{Tabs as X,TabsList as ee,TabsTrigger as te,TabsContent as ae}from"../../components/tabs.js";import{useExposure as se}from"../../hooks/useExposure.js";import{trackUrlRef as z}from"../../shared/trackUrlRef.js";import{useAiuiContext as oe}from"../AiuiProvider/index.js";import{gaTrack as le}from"../../shared/track.js";import{useTracking as ie}from"../../hooks/useTracking.js";const b="image",w="p1_banner",N=({data:g,configuration:s,jIndex:f,spanType:B,title:y,onSecondaryButtonClick:h,onPrimaryButtonClick:C})=>{const{buildRef:o}=ie(),[x,v]=L(!1),r=O({query:"(max-width: 768px)"}),T=q(null),$=()=>{if(B)switch(B){case"full":return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case"half":return"tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case"one-third":return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}else switch(s?.num){case 1:return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case 2:return"tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case 3:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}};se(T,{componentType:b,componentName:w,position:f,componentTitle:g.title,componentDescription:g.description,navigation:s?.activeTab}),Y(()=>{v(r)},[r]);const{theme:I="light",title:c,description:d,imageUrl:p,primaryButton:i,secondaryButton:n,imageMobileUrl:u,blockLink:k,video:M,youtubeId:m,isYouTube:e,id:a}=g,V="lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px]";return l("div",{className:P("item-wrapper cursor-pointer","text-info-primary group relative box-border w-full overflow-hidden",$(),{"rounded-box":!0,"aiui-dark":I==="dark","h-[400px]":x},"text-info-primary"),ref:T,children:[(k||n.link)&&t("a",{className:"absolute inset-0 z-10",href:z(S(k||n.link||"",s?.locale||"us"),o(b,w)),"data-headless-type-name":`${b}#${w}`,"data-headless-title-desc-button":`${c}#${d}`,"data-headless-nav-position":`${s?.activeTab}#${f}`,"aria-hidden":"true",tabIndex:-1}),l("div",{className:"absolute inset-0",children:[U(p?.mimeType)?t("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:block hidden size-full overflow-hidden object-cover",children:t("source",{src:p?.url,type:"video/mp4"})}):t(R,{source:p?.url,alt:p?.alt||"",className:"tablet:block hidden h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 group-hover:scale-105 object-cover",style:{aspectRatio:`${p?.width}/${p?.height}`}}),U(u?.mimeType)?t("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:hidden block size-full overflow-hidden object-cover",children:t("source",{src:u?.url,type:"video/mp4"})}):t(R,{source:u?.url||p?.url,alt:u?.alt||p?.alt||"",className:"tablet:hidden block h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 object-cover"})]}),l("div",{className:P("pointer-events-none absolute inset-0 z-20 flex flex-col",B==="full"?"laptop:justify-center justify-end":"justify-end"),children:[l("div",{className:"laptop:p-6 desktop:p-[32px] laptop:gap-4 desktop:gap-6 pointer-events-auto flex w-fit flex-col gap-6 p-4",children:[l("div",{className:"flex flex-col gap-1",children:[t(E,{size:3,as:"h3",className:"item-title",html:c}),t(E,{as:"h4",className:"item-description desktop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px]",html:d})]}),l("div",{className:"lg-desktop:gap-3 flex gap-2",children:[n&&n.text&&l(j,{"aria-label":c??d,className:P(V,"link-left"),variant:"secondary",as:"a","data-track":`${a}-link-left`,onClick:()=>{h?.(g)},href:z(S(n.link||"",s?.locale||"us"),o(b,w)),"data-headless-type-name":`${b}#${w}`,"data-headless-title-desc-button":`${c}#${d}#${n.text}`,"data-headless-nav-position":`${s?.activeTab}#${f}`,children:[n.text,t("span",{className:"sr-only",children:c??d})]}),i&&i.text&&t(j,{"aria-label":c??d,className:P(V,"link-right"),variant:"primary","data-track":`${a}-link-right`,as:"a",onClick:()=>{C?.(g)},href:z(S(i.link||"",s?.locale||"us"),o(b,w)),"data-headless-type-name":`${b}#${w}`,"data-headless-title-desc-button":`${c}#${d}#${i.text}`,"data-headless-nav-position":`${s?.activeTab}#${f}`,children:i.text})]})]}),(M?.url||m)&&t("div",{className:"laptop:bottom-6 laptop:right-6 pointer-events-auto absolute bottom-4 right-4",children:t("button",{onClick:()=>{s?.onVideoPlayBtnClick?.(e&&m?m:M?.url||m,e)},className:"laptop:size-12 flex size-8 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75",children:t("svg",{width:"12",height:"14",viewBox:"0 0 12 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M12 7L0 14L0 0L12 7Z",fill:"white"})})})})]})]})},D=Q.forwardRef((g,s)=>{const{data:f,className:B,onSecondaryButtonClick:y,onPrimaryButtonClick:h,...C}=g,{sectionTitle:o,groupByTab:x=!1,items:v=[],carousel:r}=f,[T,$]=L(!1),[I,c]=L(""),[d,p]=L(""),{locale:i="us"}=oe(),n=e=>{switch(e){case"full":return 12;case"half":return 6;case"one-third":return 4}},u=v.map(e=>e.tabName).filter(Boolean).filter((e,a,V)=>V.indexOf(e)===a),k=(e,a)=>{$(!0),a?p?.(e||""):c?.(e||"")},M=(e,a)=>{switch(e){case 1:return 1;case 2:return 2;default:return a?2.3:3}},m=u.map(e=>({tabName:e,items:v.filter(a=>a.tabName===e)})).reduce((e,a)=>(e[a.tabName]=a.items,e),{});return f.mode==="carousel"&&v.length>0?t(Z,{data:f,onPrimaryButtonClick:h,onSecondaryButtonClick:y,className:B,ref:s,...C}):l("section",{"data-ui-component-id":"MultiLayoutGraphicBlock",ref:s,...C,className:P("multiLayoutGraphicBlock","text-info-primary",B),children:[o&&t(W,{data:{title:o},className:"section-title"}),x?l(X,{align:"left",defaultValue:G(u[0]),children:[t(ee,{children:u.map((e,a)=>t(te,{value:G(e),onClick:()=>{le({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:b,component_name:w,component_title:o,component_position:1,navigation:e,button_name:e}})},children:e},a))}),u.map((e,a)=>t(ae,{value:G(e),className:"desktop:mt-[36px] mt-[24px] w-full",children:l(A,{children:[t(_,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock1",data:{list:m?.[e]||[],configuration:{isTab:x,activeTab:e,title:o,num:m?.[e]?.length||0,locale:i,onVideoPlayBtnClick:k,onSecondaryButtonClick:y,onPrimaryButtonClick:h}},Slide:N,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:M(m?.[e]?.length||0,!0)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:M(m?.[e]?.length||0)}}}),r&&r?.items.length>0?t(_,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock2",data:{list:r?.items||[],configuration:{isTab:x,locale:i,onVideoPlayBtnClick:k,title:o,onSecondaryButtonClick:y,onPrimaryButtonClick:h}},Slide:N,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]})},a))]}):l(A,{children:[l(K,{className:"w-full",children:[v.map((e,a)=>t(H,{span:n(e.width??"full"),className:"laptop:block hidden",children:t(N,{data:e,configuration:{locale:i,onVideoPlayBtnClick:k,title:o},jIndex:a,spanType:e.width,onSecondaryButtonClick:y,onPrimaryButtonClick:h})},`${e?.title||""}${a}`)),v.map((e,a)=>t(H,{span:n("full"),className:"laptop:hidden block",children:t(N,{data:e,configuration:{locale:i,onVideoPlayBtnClick:k,title:o},jIndex:a,spanType:"full",onSecondaryButtonClick:y,onPrimaryButtonClick:h})},`${e?.title||""}${a}`))]}),r&&r?.items.length>0?t(_,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock3",data:{list:r?.items||[],configuration:{locale:i,onVideoPlayBtnClick:k,title:o,onSecondaryButtonClick:y,onPrimaryButtonClick:h}},Slide:N,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]}),T&&t(J,{visible:T,youTubeId:d,videoUrl:I,onCloseModal:()=>$(!1)})]})});D.displayName="MultiLayoutGraphicBlock";var Pe=F(D,{container:{desktopSpan:12,mobileSpan:12}});export{Pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import _,{useRef as k,useImperativeHandle as N}from"react";import{Heading as c,Button as g,Picture as v,Text as H}from"../../components/index.js";import{cn as P}from"../../helpers/utils.js";import{withLayout as T}from"../../shared/Styles.js";import{useExposure as w}from"../../hooks/useExposure.js";import{useTracking as y}from"../../hooks/useTracking.js";import{trackUrlRef as R}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as L}from"../../shared/track.js";const p="image",i="product_hero",m=_.forwardRef(({data:n,className:u},d)=>{const{title:o,subtitle:e,ctaText:r,poster:f,mobPoster:b,ctaLink:a,theme:h="light"}=n,s=k(null),{buildRef:x}=y();return w(s,{componentType:p,componentName:i,componentTitle:o,componentDescription:e}),N(d,()=>s.current),l("section",{ref:s,"data-ui-component-id":"ProductHero",className:P("product-hero text-info-primary tablet:flex-row tablet:gap-[16px] lg-desktop:gap-[64px] flex w-full flex-col items-center justify-between gap-[32px]",{"aiui-dark":h==="dark"},u),children:[l("div",{className:"product-hero__content tablet:basis-[42%] laptop:basis-[36%] flex w-full flex-col items-start gap-[24px]",children:[l("div",{className:"product-hero__text",children:[t(c,{as:"h3",size:4,html:o,className:"product-hero__title"}),t(c,{as:"h4",size:2,html:e,className:"product-hero__subtitle product-hero__subtitle--desktop laptop:mt-[12px] laptop:block desktop:mt-[16px] mt-[4px] hidden"}),t(H,{as:"p",size:2,html:e,className:"product-hero__subtitle product-hero__subtitle--mobile laptop:mt-[12px] laptop:hidden desktop:mt-[16px] mt-[4px] block"})]}),r&&t("a",{href:a?R(a,x(p,i)):void 0,className:"product-hero__cta-link",...L({interactive:!!a,componentType:p,componentName:i,title:o,description:e,buttonName:r}),children:t(g,{className:"product-hero__cta-button w-fit",children:r})})]}),t(v,{className:"product-hero__image tablet:aspect-[824/640] tablet:basis-[58%] laptop:basis-[64%] rounded-box aspect-[358/360] shrink",source:`${f?.url}, ${b?.url} 768`,imgClassName:"h-full object-cover"})]})});m.displayName="ProductHero";var I=T(m);export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o,jsxs as
|
|
1
|
+
"use client";import{jsx as o,jsxs as c}from"react/jsx-runtime";import{useState as _,useEffect as y,useCallback as q,forwardRef as U,useImperativeHandle as W,useRef as h}from"react";import{cn as $}from"../../helpers/utils.js";import{withLayout as J}from"../../shared/Styles.js";import{Button as I,Link as K,Text as A}from"../../components/index.js";import{useExposure as Q}from"../../hooks/useExposure.js";import{useTracking as X}from"../../hooks/useTracking.js";import{trackUrlRef as Z}from"../../shared/trackUrlRef.js";import{toPlainTrackingText as T}from"../../shared/track.js";import*as C from"@radix-ui/react-popover";const N="navigation",E="product_nav",P=d=>d.anchorId??d.id??"",ee=d=>o("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d,children:o("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})}),L=U(({className:d="",data:B,id:z,onAnchorClick:D,scrollOffsetExtra:R=0},j)=>{const{tabLinks:p=[],anchorList:s=[],textLink:i,buyBtn:a,theme:Y="light"}=B||{},{buildRef:F}=X(),u=(e,t,n=1)=>({href:Z(e,F(N,E)),"data-headless-type-name":`${N}#${E}`,"data-headless-title-desc-button":`##${T(t)}`,"data-headless-nav-position":`${T(t)}#${n}`}),[G,g]=_(""),f=h(null),w=h(!1),v=h(""),x=h(null),S=h(new Map);W(j,()=>f.current),Q(f,{componentType:N,componentName:E,componentTitle:[...p.map(e=>e.label),...s.map(e=>e.label)].join(" | "),componentDescription:a?.text??i?.text??""});const b=q(()=>{if(s.length===0)return;const e=window.scrollY;window.scrollTo({top:0,behavior:"instant"}),requestAnimationFrame(()=>{const t=new Map;s.forEach(n=>{const r=P(n),l=document.getElementById(r);if(l){const k=l.getBoundingClientRect();t.set(r,k.top+window.scrollY)}}),S.current=t,window.scrollTo({top:e,behavior:"instant"})})},[s]);y(()=>{if(s.length===0)return;const e=setTimeout(b,100);return()=>clearTimeout(e)},[s,b]),y(()=>{if(s.length===0)return;let e=null;const t=new ResizeObserver(()=>{e&&clearTimeout(e),e=setTimeout(b,150)});return t.observe(document.body),()=>{t.disconnect(),e&&clearTimeout(e)}},[s,b]),y(()=>{if(s.length===0)return;const e=()=>{if(w.current){x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{w.current=!1,v.current&&(g(v.current),v.current="")},100);return}const n=f.current?.offsetHeight||0,r=window.scrollY+n+R+10;let l="";const k=S.current;for(let m=s.length-1;m>=0;m--){const V=s[m],M=P(V),H=k.get(M);if(H!==void 0&&r>=H){l=M;break}}if(!l&&s.length>0){const m=k.get(P(s[0]));m!==void 0&&r<m&&(l="")}g(l)},t=setTimeout(()=>{e()},200);return window.addEventListener("scroll",e,{passive:!0}),()=>{clearTimeout(t),window.removeEventListener("scroll",e),x.current&&clearTimeout(x.current)}},[s,R]),y(()=>{const e=document.querySelectorAll(".header"),t=[];return e.forEach(n=>{const r=n;t.push({element:r,originalPosition:r.style.position||getComputedStyle(r).position}),r.style.position="relative"}),()=>{t.forEach(({element:n,originalPosition:r})=>{n.style.position=r==="static"?"":r})}},[]);const O=(e,t)=>{e.preventDefault();const n=S.current.get(t);if(n===void 0){console.warn(`Cached position for "${t}" not found`);return}g(t),v.current=t,w.current=!0;const r=f.current?.offsetHeight||0,l=n-r-R;window.scrollTo({top:l,behavior:"smooth"}),window.history.pushState(null,"",`#${t}`)};return c("div",{id:z,ref:f,className:$("product-nav text-info-primary bg-container-primary px-grid !sticky top-0 !z-[51] flex w-full justify-between overflow-hidden py-0",{"aiui-dark":Y==="dark"},d),children:[c("div",{className:"product-nav-main desktop:flex-row desktop:gap-[48px] flex w-full flex-col justify-start",children:[c("div",{className:"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] pt-[14px]",children:[c("div",{className:"product-nav-tabs flex flex-row items-center gap-[8px]",children:[p.map((e,t)=>c("div",{className:"product-nav-tab-item flex items-center gap-[8px]",children:[o("a",{...u(e.link,e.label,p.indexOf(e)+1),className:$("product-nav-tab-link hover:text-brand-color text-nowrap text-[14px] font-bold tracking-[-0.04em]",{"text-[#6D6D6F]":t!==0,"hidden desktop:block":t===1}),children:o("span",{children:e.label})}),t!==p.length-1&&o("div",{className:"product-nav-tab-divider desktop:inline-block hidden h-[14px] w-px bg-[#E4E5E6]"})]},e.link||t)),p.length>1&&c(C.Root,{children:[o(C.Trigger,{asChild:!0,children:o("button",{className:"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block","aria-label":"More products",children:o(ee,{className:"text-[#1D1D1F]"})})}),o(C.Content,{className:"product-nav-dropdown-content rounded-[6px] border border-[#E4E5E6] bg-white p-[6px] px-[8px] py-[4px]",style:{boxShadow:"0px 4px 8px 0px rgba(0,0,0,0.12)"},side:"bottom",align:"end",alignOffset:10,sideOffset:10,children:p.slice(1).map(e=>o("a",{...u(e.link,e.label,p.indexOf(e)+1),className:"product-nav-dropdown-link hover:text-brand-color text-nowrap",children:o("span",{children:e.label})},e.link))})]})]}),c("div",{className:"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]",children:[i?.link&&o("a",{...u(i.link,i.text),target:i.target||"_self",className:"product-nav-text-link hover:text-brand-color cursor-pointer",children:o(A,{size:2,className:"text-nowrap",children:i.text})}),a?.link&&o(I,{as:"a",...u(a.link,a.text),size:"sm",className:"product-nav-buy-button text-nowrap",children:a.text})]})]}),o("div",{className:"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[12px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:s.map((e,t)=>{const n=P(e);return c("a",{href:`#${n}`,className:"product-nav-anchor-link","data-headless-type-name":`${N}#${E}`,"data-headless-title-desc-button":`##${T(e.label)}`,"data-headless-nav-position":`${T(e.label)}#${t+1}`,onClick:r=>{D?(r.preventDefault(),g(n),v.current=n,w.current=!0,D(e,t)):O(r,n)},children:[o(A,{size:2,className:"product-nav-anchor-text text-nowrap",children:e.label}),o("div",{className:$("product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent",{"!bg-brand-0":G===n})})]},n)})})]}),c("div",{className:"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]",children:[i?.link&&o(K,{...u(i.link,i.text),target:i.target||"_self",className:"product-nav-text-link no-underline",children:o(A,{size:2,className:"text-nowrap",children:i.text})}),a?.link&&o(I,{as:"a",...u(a.link,a.text),size:"sm",className:"product-nav-buy-button text-nowrap",children:a.text})]})]})});L.displayName="ProductNav";var ce=J(L);export{ce as default};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Media, Theme } from '../../types/props.js';
|
|
3
|
+
import type { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical';
|
|
3
4
|
export interface PromotionalBarSemanticName {
|
|
4
5
|
root: 'root';
|
|
5
6
|
content: 'content';
|
|
@@ -27,8 +28,8 @@ export interface ResponsiveBackgroundImage {
|
|
|
27
28
|
*/
|
|
28
29
|
export interface PromotionalBarData {
|
|
29
30
|
theme: Theme;
|
|
30
|
-
/**
|
|
31
|
-
contentTitle?: string;
|
|
31
|
+
/** 组件内容标题(HTML 字符串或 CMS 的 Lexical 富文本) */
|
|
32
|
+
contentTitle?: string | SerializedEditorState;
|
|
32
33
|
/** 组件内容描述 */
|
|
33
34
|
contentDesc?: string;
|
|
34
35
|
/** 按钮文本 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a,jsxs as k}from"react/jsx-runtime";import*as m from"react";import{cn as p}from"../../helpers/index.js";import{Heading as T,Button as B,Picture as D}from"../../components/index.js";import{withLayout as P}from"../../shared/Styles.js";import{getLocalizedPath as M}from"../../helpers/index.js";import{useAiuiContext as N}from"../AiuiProvider/index.js";import{trackUrlRef as R}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as y}from"../../shared/track.js";import{useExposure as L}from"../../hooks/useExposure.js";import{useTracking as S}from"../../hooks/useTracking.js";const g="image",h="PromotionalBar",F=r=>{if(!r)return;const{mobile:t,tablet:u,laptop:d,desktop:f,lgDesktop:x}=r,e=[],l=v=>v?.url,n=l(x),i=l(f),o=l(d),s=l(u),c=l(t);return n?e.push(n):i?e.push(i):o?e.push(o):s?e.push(s):c&&e.push(c),i&&n&&e.push(`${i} 1920`),o&&(i||n)&&e.push(`${o} 1440`),s&&(o||i||n)&&e.push(`${s} 1024`),c&&(s||o||i||n)&&e.push(`${c} 768`),e.length>0?e.join(", "):void 0},b=m.forwardRef(({classNames:r,data:t,className:u,...d},f)=>{const{locale:x="us"}=N(),{buildRef:e}=S(),{backgroundImage:l,theme:n="dark"}=t,i=m.useMemo(()=>F(l),[l]),o=m.useRef(null);return m.useImperativeHandle(f,()=>o.current),L(o,{componentType:g,componentName:h,componentTitle:t.contentTitle,componentDescription:t.contentDesc}),a("div",{ref:o,...d,className:p("laptop:h-[192px] lg-desktop:h-[240px] h-[240px] text-[#080A0F]",{"text-[#F5F6F7]":n==="dark"},r?.root,u),children:k("div",{className:"promotional-bar-content rounded-card relative h-full overflow-hidden",children:[k("div",{className:p("laptop:px-8 laptop:justify-center laptop:box-content lg-desktop:max-w-[686px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4",r?.content),children:[t.contentTitle&&a(T,{className:p("line-clamp-2 ",r?.title),html:t.contentTitle,size:3}),t.contentDesc&&a("p",{className:p("laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] ",r?.description),dangerouslySetInnerHTML:{__html:t.contentDesc}}),a("div",{className:"laptop:mt-4 mt-2",children:t.buttonText&&a(B,{as:"a",variant:"link",className:p("!p-0 text-[#F5F6F7]",{"text-[#080A0F]":n==="light"},r?.button),href:R(M(t.buttonLink||"",x),e(g,h)),...y({interactive:!!t.buttonLink,componentType:g,componentName:h,title:t.contentTitle,description:t.contentDesc,buttonName:t.buttonText}),iconClassName:"size-4",children:t.buttonText})})]}),a(D,{source:i,className:"absolute inset-0 z-10 ",imgClassName:"h-full object-cover transition-transform duration-300 ease-in-out hover:scale-[1.05]"})]})})});b.displayName="PromotionalBar";var j=P(b);export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as
|
|
1
|
+
"use client";import{jsx as a,jsxs as p}from"react/jsx-runtime";import*as D from"react";import{cn as t}from"../../helpers/index.js";import{Checkbox as O,Badge as R,Heading as U,Text as d,Picture as m}from"../../components/index.js";import{useSceneShelfContext as _}from"./context.js";import{LocalizedLink as q}from"../../shared/LocalizedLink.js";import{trackUrlRef as A}from"../../shared/trackUrlRef.js";import{toPlainTrackingText as g}from"../../shared/track.js";import{useTracking as H}from"../../hooks/useTracking.js";const n="shelf",c="scene_shelf",f=D.forwardRef(({className:b,classNames:k,product:e,selected:C,onSelectChange:P,showTags:u,showOriginalPrice:N,onProductImageClick:v,...S},w)=>{const i=_(),{buildRef:y}=H(),T=u??i?.showTags??!0,z=N??i?.showOriginalPrice??!0,s=k??i?.classNames??{},r=C??(i?i.selectedIds.has(e.id):!1),h=P??i?.onSelectChange,x=v??i?.onProductImageClick,o=e.soldOut??!1,L=l=>{o||typeof l=="boolean"&&h?.(l,e)},$=()=>{o||h?.(!r,e)};return p("div",{ref:w,className:t("scene-shelf-product-card","lg-desktop:gap-2 lg-desktop:h-[362px] lg-desktop:px-6 lg-desktop:pb-6 lg-desktop:pt-4 rounded-box box-border flex h-[284px] flex-col justify-between gap-2 border-2 border-solid p-4 pb-6 transition-colors",o?"cursor-not-allowed opacity-50":"cursor-pointer",r?t("border-brand-0 bg-container-secondary-0",s?.cardSelected):t("border-lines bg-container-primary",!o&&"hover:bg-container-secondary",s?.card),b),onClick:$,"data-headless-type-name":`${n}#${c}`,"data-headless-title-desc-button":`${g(e.custom_name??e.title)}##${r?"Unselect":"Select"}`,"data-headless-sku":e.sku??e.id,...S,children:[a("div",{className:t("scene-shelf-product-card-tags","lg-desktop:left-6 lg-desktop:top-6 flex max-h-[24px] min-h-[24px] flex-wrap gap-1 overflow-visible pr-9",s?.tags),children:T&&e.tags?.map((l,j)=>a(R,{variant:l.variant||"outline",size:"sm",className:"scene-shelf-product-card-badge",children:l.label},j))}),a(O,{checked:r,disabled:o,onCheckedChange:L,onClick:l=>l.stopPropagation(),className:t("scene-shelf-product-card-checkbox","text-brand-0 border-brand-0 lg-desktop:right-6 lg-desktop:top-6 absolute right-4 top-4 size-5 shrink-0",s?.checkbox)}),a("div",{className:t("flex flex-1 grow-0 items-center justify-center",s?.image),children:x?a("a",{onClick:()=>x(e),role:"button","data-headless-type-name":`${n}#${c}`,"data-headless-title-desc-button":`${g(e.custom_name??e.title)}##image`,"data-headless-sku":e.sku??e.id,children:a(m,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):e?.href?a(q,{href:A(e.href,y(n,c)),"data-headless-type-name":`${n}#${c}`,"data-headless-title-desc-button":`${g(e.custom_name??e.title)}##image`,"data-headless-sku":e.sku??e.id,children:a(m,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):a(m,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}),p("div",{className:"flex grow flex-col justify-start gap-4",children:[a(U,{as:"h3",size:2,className:t("text-info-primary line-clamp-2",s?.title),html:e.custom_name??e.title}),p("div",{className:t("flex flex-wrap items-center gap-1",s?.priceWrapper),children:[a(d,{as:"span",size:2,className:t("text-info-primary lg-desktop:text-[24px] whitespace-nowrap text-[20px]",s?.currentPrice),children:e.currentPrice.formatted}),z&&e.originalPrice&&e.originalPrice.value>e.currentPrice.value&&a(d,{as:"span",size:2,className:t("text-info-quaternary lg-desktop:text-[24px] whitespace-nowrap text-[20px] line-through",s?.originalPrice),children:e.originalPrice.formatted})]}),e?.priceLabel&&a(d,{size:4,className:t("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",s?.productPriceLabel),children:e.priceLabel})]})]})});f.displayName="SceneShelf.ProductCard";export{f as SceneProductCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import*as r from"react";import{Swiper as X,SwiperSlide as Y}from"swiper/react";import{FreeMode as ee,Mousewheel as te}from"swiper/modules";import{cn as n}from"../../helpers/index.js";import{Heading as ae,Button as D,Text as u}from"../../components/index.js";import{buildSsrSlideCss as ne}from"../SwiperBox/buildSsrSlideCss.js";import{useSceneShelfContext as oe,useSceneShelfRootInfo as se}from"./context.js";import{toPlainTrackingText as h}from"../../shared/track.js";const re="shelf",ie="scene_shelf";import"swiper/css";const F=r.forwardRef(({title:p,totalPriceLabel:M,totalCurrentPrice:A,totalOriginalPrice:R,primaryButtonText:$,primaryButtonFun:z,secondaryButtonText:H,secondaryButtonFun:O,bundleDiscountLabel:I,className:V,children:_,...j},E)=>{const e=oe(),w=se(),a=e?.classNames,b=M??e?.totalPriceLabel??"Total Price:",c=A??e?.totalCurrentPrice,m=R??e?.totalOriginalPrice,f=$??e?.primaryButtonText??"Shop Now",T=z??e?.primaryButtonFun??"buyNow",x=H??e?.secondaryButtonText??"Add to Cart",B=O??e?.secondaryButtonFun??"addCart",d=I??e?.bundleDiscountLabel,s=e?.selectedProducts??[],q=e?.onLearnMore,G=e?.onShopNow,W=e?.onAddToCart,Z=e?.showOriginalPrice??!0,[J,K]=r.useState(!1),[Q,U]=r.useState(!1),S=r.Children.toArray(_),N=S.length,y=r.useMemo(()=>({0:{slidesPerView:1.5,spaceBetween:10},768:{slidesPerView:2.8,spaceBetween:16},1024:{slidesPerView:2.3,spaceBetween:10},1440:{slidesPerView:N<=3?3:3.2,spaceBetween:16}}),[N]),P=`swiper-ssr-${r.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,g=r.useMemo(()=>ne(`.${P}`,y),[P,y]),k=async(o,i)=>{if(!o)return;const C=i==="primary"?K:U;C(!0);try{switch(o){case"buyNow":await G?.(s);break;case"addCart":await W?.(s);break;case"learnMore":await q?.(s);break;default:break}}finally{C(!1)}},L=o=>({"data-headless-type-name":`${re}#${ie}`,"data-headless-title-desc-button":`${h(w?.title??p)}#${h(w?.subtitle)}#${h(o)}`,"data-headless-nav-position":"#1",...s.length>0?{"data-headless-sku":s.map(i=>i.sku??i.id).join(",")}:{}}),v=o=>o==="learnMore"?!1:s.length===0;return l("div",{ref:E,className:n("bg-container-primary laptop:p-6 lg-desktop:p-8 flex min-w-0 flex-1 flex-col justify-between overflow-hidden p-4",V,a?.content),...j,children:[p&&t(ae,{as:"h2",size:3,className:n("text-info-primary flex-0 mb-[16px] line-clamp-1 shrink-0",a?.title),html:p}),l("div",{className:n("lg-desktop:mb-[24px] mb-[16px] flex-1 ",a?.productList),children:[g&&t("style",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:g}}),t(X,{modules:[ee,te],freeMode:!0,mousewheel:{forceToAxis:!0},className:g?P:void 0,breakpoints:y,children:S.map((o,i)=>t(Y,{className:"h-fit shrink-0",children:o},i))})]}),l("div",{className:n("tablet:items-end tablet:flex-row flex-0 flex flex-col items-start justify-between gap-2",a?.footer),children:[l("div",{className:"flex flex-col",children:[l("div",{className:n("flex flex-wrap items-center gap-1",a?.totalPrice),children:[b&&t(u,{as:"span",size:2,className:"text-info-primary lg-desktop:text-[24px] text-[20px]",children:b}),c&&t(u,{as:"span",size:2,className:n("text-info-primary lg-desktop:text-[24px] text-[20px]",a?.currentTotalPrice),children:c.formatted}),Z&&m&&c&&m.value>c.value&&t(u,{as:"span",size:2,className:n("text-info-quaternary lg-desktop:text-[24px] text-[20px] line-through",a?.originalTotalPrice),children:m.formatted})]}),d&&t(u,{as:"span",size:2,className:n("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 text-[14px]",a?.bundleDiscountLabel),children:typeof d=="function"?d(s):d})]}),l("div",{className:n("flex items-stretch gap-3",a?.buttonGroup),children:[x&&t(D,{variant:"secondary",className:"min-w-0 whitespace-normal text-center",onClick:()=>k(B,"secondary"),...L(x),disabled:v(B),loading:Q,children:x}),f&&t(D,{variant:"primary",className:"min-w-0 whitespace-normal text-center",onClick:()=>k(T,"primary"),...L(f),disabled:v(T),loading:J,children:f})]})]})]})});F.displayName="SceneShelf.ProductsPanel";export{F as SceneShelfProductsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as i,jsxs as c}from"react/jsx-runtime";import*as r from"react";import{cn as n}from"../../helpers/index.js";import{Heading as S,Text as v}from"../../components/index.js";import{useExposure as R}from"../../hooks/useExposure.js";import{SceneShelfRootInfoContext as u}from"./context.js";const x="shelf",T="scene_shelf",a=r.forwardRef(({title:e,subtitle:o,theme:s="light",classNames:t,className:f,children:l,...p},d)=>{const m=r.useRef(null);r.useImperativeHandle(d,()=>m.current),R(m,{componentType:x,componentName:T,componentTitle:e,componentDescription:o});const h=r.useMemo(()=>({title:e,subtitle:o}),[e,o]);return i(u.Provider,{value:h,children:c("div",{ref:m,className:n("text-info-primary w-full",{"aiui-dark":s==="dark"},f,t?.root),...p,children:[(e||o)&&c("div",{className:n("mb-6",t?.header),children:[e&&i(S,{as:"h2",size:4,className:n("text-info-primary mb-2",t?.title),html:e}),o&&i(v,{as:"p",size:3,className:n("",t?.subtitle),html:o})]}),i("div",{className:n("space-y-6",t?.sceneList),children:l})]})})});a.displayName="SceneShelf.Root";export{a as SceneShelfRoot};
|
|
@@ -48,4 +48,14 @@ declare const SceneShelfContext: React.Context<SceneShelfContextValue | null>;
|
|
|
48
48
|
* @returns Context 值,如果在 Root 外使用则返回 null
|
|
49
49
|
*/
|
|
50
50
|
export declare function useSceneShelfContext(): SceneShelfContextValue | null;
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* SceneShelf Root 级信息,用于让深层按钮的点击埋点与 Root 的曝光保持一致
|
|
53
|
+
* (Root 位于 Scene Context 外层,ProductsPanel 无法直接读到 Root 的标题)
|
|
54
|
+
*/
|
|
55
|
+
export interface SceneShelfRootInfo {
|
|
56
|
+
title?: string;
|
|
57
|
+
subtitle?: string;
|
|
58
|
+
}
|
|
59
|
+
declare const SceneShelfRootInfoContext: React.Context<SceneShelfRootInfo | null>;
|
|
60
|
+
export declare function useSceneShelfRootInfo(): SceneShelfRootInfo | null;
|
|
61
|
+
export { SceneShelfContext, SceneShelfRootInfoContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";const t=e.createContext(null);function
|
|
1
|
+
"use client";import*as e from"react";const t=e.createContext(null);function n(){return e.useContext(t)}const o=e.createContext(null);function r(){return e.useContext(o)}export{t as SceneShelfContext,o as SceneShelfRootInfoContext,n as useSceneShelfContext,r as useSceneShelfRootInfo};
|