@anker-in/headless-ui 1.3.85 → 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/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBannerCarousel.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/ProductNav/ProductNav.js +1 -1
- package/dist/cjs/biz-components/SearchPage/index.js +1 -1
- package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/cjs/components/container.js +1 -1
- package/dist/cjs/helpers/utils.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/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/ProductNav/ProductNav.js +1 -1
- package/dist/esm/biz-components/SearchPage/index.js +1 -1
- package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/esm/components/container.js +1 -1
- package/dist/esm/helpers/utils.js +1 -1
- package/dist/tokens/base.css +48 -0
- package/package.json +1 -1
- package/style.css +9 -12
- package/tailwind.config.js +3 -0
package/README.md
CHANGED
|
@@ -46,6 +46,12 @@ import '@anker-in/headless-ui/tokens/{barnd}.css' // brand 可以是 anker, eufy
|
|
|
46
46
|
查看所有Token https://headless-ui-doc.netlify.app?path=/docs/design-token--docs
|
|
47
47
|
Tokens 支持覆盖
|
|
48
48
|
|
|
49
|
+
栅格左右边距 Token `--grid-margin`(`px-grid` 工具类使用它)定义在 `tokens/base.css`,必须引入 `base.css`,否则 `px-grid` 退回 16px。
|
|
50
|
+
|
|
51
|
+
默认是阶梯式,与升级前一致:16px、32px(≥768px)、64px(≥1025px),1440px 至 1919px 固定 64px,1920px 起为 `calc(50% - 832px)`。升级后不做任何改动,页面表现不变。
|
|
52
|
+
|
|
53
|
+
需要流式间距时主动开启:在页面最外层或 `<html>` 上声明 `data-grid="fluid"`(或 `class="grid-fluid"`),其内库组件的左右边距在 1440px 至 1920px 之间从 64px 线性过渡到 128px,消除 1920px 处的跳变。注意写死阶梯式边距的定制组件和已安装的旧副本不会跟着变,开启范围内它们与库组件的左边缘会在 1441–1919px 错开,需要先迁移到 `px-grid`。流式范围内的局部区域可以用 `data-grid="legacy"`(或 `class="grid-legacy"`)切回阶梯式。开关只覆盖变量,不改组件代码。
|
|
54
|
+
|
|
49
55
|
|
|
50
56
|
```jsx
|
|
51
57
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var Ue=Object.create;var M=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty;var Fe=(t,c)=>{for(var o in c)M(t,o,{get:c[o],enumerable:!0})},le=(t,c,o,T)=>{if(c&&typeof c=="object"||typeof c=="function")for(let g of Je(c))!qe.call(t,g)&&g!==o&&M(t,g,{get:()=>c[g],enumerable:!(T=Ge(c,g))||T.enumerable});return t};var C=(t,c,o)=>(o=t!=null?Ue(_e(t)):{},le(c||!t||!t.__esModule?M(o,"default",{value:t,enumerable:!0}):o,t)),We=t=>le(M({},"__esModule",{value:!0}),t);var et={};Fe(et,{default:()=>$e});module.exports=We(et);var e=require("react/jsx-runtime"),m=C(require("react")),L=C(require("gsap")),V=require("gsap/dist/ScrollTrigger"),P=C(require("jump.js")),f=require("./mediaResolver.js"),ce=require("react-intersection-observer"),ue=C(require("../../helpers/ScrollLoadVideo.js")),p=require("../../components/index.js"),d=require("../../helpers/index.js"),S=require("class-variance-authority"),me=require("../../shared/Styles.js"),de=require("../../hooks/useExposure.js"),k=require("../../shared/trackUrlRef.js"),v=require("../../shared/track.js"),fe=require("../../helpers/utils.js"),ge=require("../AiuiProvider/index.js"),be=require("../../components/button.js"),ve=require("../VideoModal/index.js"),ye=C(require("./HeroBannerCarousel.js"));const x="hero_banner",Ye=(0,S.cva)("hero-banner-content lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"tablet:px-[32px] laptop:top-1/2 laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] laptop:-translate-y-1/2 left-0 px-[16px]",center:"tablet:top-[84px] laptop:top-[76px] desktop:top-[176px] lg-desktop:top-[192px] left-1/2 top-[84px] -translate-x-1/2 translate-y-0 items-center text-center"}},defaultVariants:{align:"left"}}),Ze=(0,S.cva)("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),Ke=(0,S.cva)("hero-banner-button-group lg-desktop:gap-x-3 pointer-events-auto flex flex-wrap items-center gap-x-2 gap-y-3",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),Qe=(0,S.cva)("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),Xe=({size:t="base"})=>{const{width:c,height:o}=be.sizeMap[t];return(0,e.jsx)("svg",{width:c,height:o,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:(0,e.jsx)("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"})})},pe=m.default.forwardRef(({data:t,className:c,classNames:o={},onSecondaryClick:T,onPrimaryClick:g,onTertiaryClick:_,jumpOptions:xe={},a11yLabels:ke,...q},F)=>{const{locale:W,pageHandle:he}=(0,ge.useAiuiContext)(),Y=t.mode!=="single"&&!!t.items&&t.items.length>0,R={...{duration:500,offset:0},...xe},z=r=>!r||!W?r:(0,fe.getLocalizedPath)(r,W),{label:Z,title:u,subtitle:i,endDate:K,endDate_tz:Te,dateFormat:we,pcImage:D,isShowVideo:Q,isVideoLoop:Be=!0,primaryButton:s,secondaryButton:n,tertiaryButton:l,theme:He="light",size:j="default",titleSize:A,caption:X=[],blockLink:I,iconArray:$,align:w="left",enableParallax:ee=!0}=t,O=Array.isArray(X)?X:[],Ne=Array.isArray($)?$:void 0,te=(0,f.useMediaTier)(),re=(0,f.buildPictureSource)(t),Ce=(0,f.resolveTierMedia)(t,te,"video")?.url||"",[ne,oe]=(0,m.useState)(!1),{ref:Le,inView:ae}=(0,ce.useInView)(),U=(0,m.useRef)(null),G=(0,m.useRef)(null),J=(0,m.useRef)(null),B=(0,m.useRef)(null),y=(0,m.useRef)(null),b=(0,v.resolveComponentMediaType)(Q),E=(0,k.buildTrackingRef)(he??"",b,x),h=(0,f.resolveTierMedia)(t,te,b==="video"?"video":"image")?.id||D?.id||"",Ve=u?.trim()||i?.trim()||D?.alt?.trim()||void 0,Se=u!==void 0?u?.trim()||i?.trim()||D?.alt?.trim()||void 0:i&&i.trim()||"",ze=i&&i.trim()||"";(0,de.useExposure)(y,{componentType:b,componentName:x,componentTitle:Se,componentDescription:ze,creativeId:h,position:1});const Ie=I?(0,k.trackUrlRef)(z(I),E):void 0,Ee=n?.link?(0,k.trackUrlRef)(z(n.link),E):void 0,Me=s?.link?(0,k.trackUrlRef)(z(s.link),E):void 0,Pe=l?.link?(0,k.trackUrlRef)(z(l.link),E):void 0,Re=(0,v.buildClickTrackingProps)({interactive:!!I,componentType:b,componentName:x,title:u,description:i,position:1,creativeId:h}),De=(0,v.buildClickTrackingProps)({interactive:!0,componentType:b,componentName:x,title:u,description:i,buttonName:"video play",position:1,creativeId:h}),je=(0,v.buildClickTrackingProps)({interactive:!!(n?.link||n?.isCustomSecondaryButton),componentType:b,componentName:x,title:u,description:i,buttonName:n?.text,position:1,creativeId:h}),Ae=(0,v.buildClickTrackingProps)({interactive:!!(s?.link||s?.isCustomPrimaryButton),componentType:b,componentName:x,title:u,description:i,buttonName:s?.text,position:1,creativeId:h}),Oe=(0,v.buildClickTrackingProps)({interactive:!!(l?.link||l?.isCustomTertiaryButton),componentType:b,componentName:x,title:u,description:i,buttonName:l?.text,position:1,creativeId:h});return(0,m.useImperativeHandle)(F,()=>y.current),(0,m.useEffect)(()=>{if(Y||!ee)return;L.default.registerPlugin(V.ScrollTrigger);function r(){if(!B.current)return;const a=y.current?.clientHeight||100;window.innerHeight<=a?U.current=V.ScrollTrigger.create({trigger:y.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:H=>{const N=H.progress*40-20;L.default.set(B.current,{yPercent:N})}}):(J.current=V.ScrollTrigger.create({trigger:y.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:H=>{const N=H.progress*20-20;L.default.set(B.current,{yPercent:N})}}),G.current=V.ScrollTrigger.create({trigger:y.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:H=>{const N=H.progress*20;L.default.set(B.current,{yPercent:N})}}))}return ae&&r(),()=>{U.current&&U.current.kill(),J.current&&J.current.kill(),G.current&&G.current.kill()}},[ae,t.items,ee]),Y?(0,e.jsx)(ye.default,{data:t,className:c,classNames:o,onPrimaryClick:g,onSecondaryClick:T,onTertiaryClick:_,a11yLabels:ke,ref:F,...q}):(0,e.jsx)("div",{...q,ref:Le,"data-ui-component-id":"HeroBanner",className:(0,d.cn)(o.root),children:(0,e.jsxs)("div",{ref:y,className:(0,d.cn)(He==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":j==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":j==="sm"},c),children:[I&&(0,e.jsx)("a",{className:"absolute inset-0 z-10",href:Ie,tabIndex:-1,"aria-hidden":"true","aria-label":Ve,...Re}),(0,e.jsx)("div",{ref:B,className:(0,d.cn)("absolute left-0 top-0 size-full"),children:Q?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ue.default,{poster:void 0,src:Ce,className:"laptop:w-full absolute inset-0 h-full transition-opacity duration-500",videoLayerClassName:"opacity-0",videoClassName:"h-full object-cover",muted:!0,loop:Be,playsInline:!0,onPlaying:r=>{const a=r.currentTarget;a.parentElement?.classList.remove("opacity-0"),a.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:r=>{const a=r.currentTarget;if(a.currentTime>=.5)return;a.parentElement?.classList.add("opacity-0"),a.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),(0,e.jsx)("div",{"data-video-poster":"true",className:"laptop:w-full bg-container-primary pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:(0,e.jsx)(p.Picture,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:(0,f.resolveTierMedia)(t,"lgDesktop","image")?.alt||"",source:re})})]}):(0,e.jsx)(p.Picture,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:(0,f.resolveTierMedia)(t,"lgDesktop","image")?.alt||"",source:re})}),(0,e.jsxs)("div",{className:Ye({align:w}),children:[(0,e.jsxs)("div",{className:Ze({align:w}),children:[Z&&(0,e.jsx)(p.Text,{size:2,as:"p",className:(0,d.cn)("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:Z}),u&&(0,e.jsx)(p.Heading,{as:A==="4"?"h1":"h2",html:u,className:(0,d.cn)("hero-banner-title",o.title),size:A?Number(A||"5"):j==="sm"?4:5}),i&&(0,e.jsx)(p.Text,{as:"p",size:2,className:(0,d.cn)("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",o.subtitle),html:i}),K&&(0,e.jsx)("div",{className:"mt-3",children:(0,e.jsx)(p.Countdown,{endDate:K,endDate_tz:Te,dateFormat:we,variant:"spacious",align:w})})]}),(0,e.jsxs)("div",{className:(0,d.cn)(Ke({align:w}),o.buttonGroup),children:[(0,e.jsxs)("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[n?.isShowPlayVideoButton&&n?.playVideoButtonText?(0,e.jsxs)(p.Button,{onClick:()=>oe(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...De,children:[n?.playVideoButtonText," ",(0,e.jsx)(Xe,{size:"lg"})]}):n?.text?(0,e.jsxs)(p.Button,{"aria-label":u??i,size:"lg",variant:"secondary",className:(0,d.cn)("hero-banner-secondary-button",o.secondaryButton),as:n?.isCustomSecondaryButton?"button":"a",href:Ee,target:n?.target,rel:n?.target==="_blank"?n?.rel??"noopener noreferrer":n?.rel,onClick:r=>{if(n.link?.startsWith("#")){r.preventDefault();const a=document.querySelector(n.link);a&&(0,P.default)(a,R)}n?.isCustomSecondaryButton&&T?.(t,r,n?.customSecondaryEventId)},...je,children:[n?.text,(0,e.jsx)("span",{className:"sr-only",children:u??i})]}):null,s&&s.text&&(0,e.jsx)(p.Button,{"aria-label":u??i,size:"lg",variant:"primary",className:(0,d.cn)("hero-banner-primary-button",o.primaryButton),as:s?.isCustomPrimaryButton?"button":"a",href:Me,target:s?.target,rel:s?.target==="_blank"?s?.rel??"noopener noreferrer":s?.rel,onClick:r=>{if(s.link?.startsWith("#")){r.preventDefault();const a=document.querySelector(s.link);a&&(0,P.default)(a,R)}s?.isCustomPrimaryButton&&g?.(t,r,s?.customPrimaryEventId)},...Ae,children:s.text})]}),l&&l.text&&(0,e.jsxs)(p.Button,{"aria-label":u??i,size:"lg",variant:"link",className:(0,d.cn)("hero-banner-tertiary-button w-auto p-0",o.tertiaryButton),as:l?.isCustomTertiaryButton?"button":"a",href:Pe,target:l?.target,rel:l?.target==="_blank"?l?.rel??"noopener noreferrer":l?.rel,onClick:r=>{if(l.link?.startsWith("#")){r.preventDefault();const a=document.querySelector(l.link);a&&(0,P.default)(a,R)}l?.isCustomTertiaryButton&&_?.(t,r,l?.customTertiaryEventId)},...Oe,children:[l.text,(0,e.jsx)("span",{className:"sr-only",children:u??i})]})]}),(0,e.jsx)("div",{className:Qe({align:w}),children:Ne?.map(r=>(0,e.jsx)("div",{className:"h-12",children:(0,e.jsx)(p.Picture,{className:"!inline-block h-full !w-auto",imgClassName:"!w-auto h-full object-contain",loading:"eager",alt:r?.pcImage?.alt||"",source:r?.pcImage?.url})},r?.pcImage?.url||r?.pcImage?.alt))})]}),O.length>0&&(0,e.jsx)("div",{className:(0,d.cn)("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]",o.captionGroup),children:O.map((r,a)=>(0,e.jsxs)(m.default.Fragment,{children:[(0,e.jsx)(p.Text,{size:2,className:(0,d.cn)("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:r.title}),a<O.length-1&&(0,e.jsx)("div",{className:(0,d.cn)("bg-info-primary w-px")})]},r.title))}),ne&&(0,e.jsx)(ve.VideoModal,{visible:ne,videoUrl:n?.isYoutubeVideo?void 0:n?.videoUrl?.url,youTubeId:n?.isYoutubeVideo?n?.youtubeId:void 0,onCloseModal:()=>oe(!1)})]})})});pe.displayName="HeroBanner";var $e=(0,me.withLayout)(pe);
|
|
1
|
+
"use strict";"use client";var Ue=Object.create;var M=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty;var Fe=(t,p)=>{for(var o in p)M(t,o,{get:p[o],enumerable:!0})},le=(t,p,o,T)=>{if(p&&typeof p=="object"||typeof p=="function")for(let g of Je(p))!qe.call(t,g)&&g!==o&&M(t,g,{get:()=>p[g],enumerable:!(T=Ge(p,g))||T.enumerable});return t};var C=(t,p,o)=>(o=t!=null?Ue(_e(t)):{},le(p||!t||!t.__esModule?M(o,"default",{value:t,enumerable:!0}):o,t)),We=t=>le(M({},"__esModule",{value:!0}),t);var et={};Fe(et,{default:()=>$e});module.exports=We(et);var e=require("react/jsx-runtime"),m=C(require("react")),L=C(require("gsap")),V=require("gsap/dist/ScrollTrigger"),P=C(require("jump.js")),f=require("./mediaResolver.js"),pe=require("react-intersection-observer"),ue=C(require("../../helpers/ScrollLoadVideo.js")),c=require("../../components/index.js"),d=require("../../helpers/index.js"),S=require("class-variance-authority"),me=require("../../shared/Styles.js"),de=require("../../hooks/useExposure.js"),k=require("../../shared/trackUrlRef.js"),v=require("../../shared/track.js"),fe=require("../../helpers/utils.js"),ge=require("../AiuiProvider/index.js"),be=require("../../components/button.js"),ve=require("../VideoModal/index.js"),ye=C(require("./HeroBannerCarousel.js"));const x="hero_banner",Ye=(0,S.cva)("hero-banner-content lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"laptop:top-1/2 px-grid laptop:-translate-y-1/2 left-0",center:"tablet:top-[84px] laptop:top-[76px] desktop:top-[176px] lg-desktop:top-[192px] left-1/2 top-[84px] -translate-x-1/2 translate-y-0 items-center text-center"}},defaultVariants:{align:"left"}}),Ze=(0,S.cva)("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),Ke=(0,S.cva)("hero-banner-button-group lg-desktop:gap-x-3 pointer-events-auto flex flex-wrap items-center gap-x-2 gap-y-3",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),Qe=(0,S.cva)("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),Xe=({size:t="base"})=>{const{width:p,height:o}=be.sizeMap[t];return(0,e.jsx)("svg",{width:p,height:o,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:(0,e.jsx)("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"})})},ce=m.default.forwardRef(({data:t,className:p,classNames:o={},onSecondaryClick:T,onPrimaryClick:g,onTertiaryClick:_,jumpOptions:xe={},a11yLabels:ke,...q},F)=>{const{locale:W,pageHandle:he}=(0,ge.useAiuiContext)(),Y=t.mode!=="single"&&!!t.items&&t.items.length>0,R={...{duration:500,offset:0},...xe},z=r=>!r||!W?r:(0,fe.getLocalizedPath)(r,W),{label:Z,title:u,subtitle:i,endDate:K,endDate_tz:Te,dateFormat:we,pcImage:D,isShowVideo:Q,isVideoLoop:Be=!0,primaryButton:s,secondaryButton:n,tertiaryButton:l,theme:He="light",size:j="default",titleSize:A,caption:X=[],blockLink:I,iconArray:$,align:w="left",enableParallax:ee=!0}=t,O=Array.isArray(X)?X:[],Ne=Array.isArray($)?$:void 0,te=(0,f.useMediaTier)(),re=(0,f.buildPictureSource)(t),Ce=(0,f.resolveTierMedia)(t,te,"video")?.url||"",[ne,oe]=(0,m.useState)(!1),{ref:Le,inView:ae}=(0,pe.useInView)(),U=(0,m.useRef)(null),G=(0,m.useRef)(null),J=(0,m.useRef)(null),B=(0,m.useRef)(null),y=(0,m.useRef)(null),b=(0,v.resolveComponentMediaType)(Q),E=(0,k.buildTrackingRef)(he??"",b,x),h=(0,f.resolveTierMedia)(t,te,b==="video"?"video":"image")?.id||D?.id||"",Ve=u?.trim()||i?.trim()||D?.alt?.trim()||void 0,Se=u!==void 0?u?.trim()||i?.trim()||D?.alt?.trim()||void 0:i&&i.trim()||"",ze=i&&i.trim()||"";(0,de.useExposure)(y,{componentType:b,componentName:x,componentTitle:Se,componentDescription:ze,creativeId:h,position:1});const Ie=I?(0,k.trackUrlRef)(z(I),E):void 0,Ee=n?.link?(0,k.trackUrlRef)(z(n.link),E):void 0,Me=s?.link?(0,k.trackUrlRef)(z(s.link),E):void 0,Pe=l?.link?(0,k.trackUrlRef)(z(l.link),E):void 0,Re=(0,v.buildClickTrackingProps)({interactive:!!I,componentType:b,componentName:x,title:u,description:i,position:1,creativeId:h}),De=(0,v.buildClickTrackingProps)({interactive:!0,componentType:b,componentName:x,title:u,description:i,buttonName:"video play",position:1,creativeId:h}),je=(0,v.buildClickTrackingProps)({interactive:!!(n?.link||n?.isCustomSecondaryButton),componentType:b,componentName:x,title:u,description:i,buttonName:n?.text,position:1,creativeId:h}),Ae=(0,v.buildClickTrackingProps)({interactive:!!(s?.link||s?.isCustomPrimaryButton),componentType:b,componentName:x,title:u,description:i,buttonName:s?.text,position:1,creativeId:h}),Oe=(0,v.buildClickTrackingProps)({interactive:!!(l?.link||l?.isCustomTertiaryButton),componentType:b,componentName:x,title:u,description:i,buttonName:l?.text,position:1,creativeId:h});return(0,m.useImperativeHandle)(F,()=>y.current),(0,m.useEffect)(()=>{if(Y||!ee)return;L.default.registerPlugin(V.ScrollTrigger);function r(){if(!B.current)return;const a=y.current?.clientHeight||100;window.innerHeight<=a?U.current=V.ScrollTrigger.create({trigger:y.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:H=>{const N=H.progress*40-20;L.default.set(B.current,{yPercent:N})}}):(J.current=V.ScrollTrigger.create({trigger:y.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:H=>{const N=H.progress*20-20;L.default.set(B.current,{yPercent:N})}}),G.current=V.ScrollTrigger.create({trigger:y.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:H=>{const N=H.progress*20;L.default.set(B.current,{yPercent:N})}}))}return ae&&r(),()=>{U.current&&U.current.kill(),J.current&&J.current.kill(),G.current&&G.current.kill()}},[ae,t.items,ee]),Y?(0,e.jsx)(ye.default,{data:t,className:p,classNames:o,onPrimaryClick:g,onSecondaryClick:T,onTertiaryClick:_,a11yLabels:ke,ref:F,...q}):(0,e.jsx)("div",{...q,ref:Le,"data-ui-component-id":"HeroBanner",className:(0,d.cn)(o.root),children:(0,e.jsxs)("div",{ref:y,className:(0,d.cn)(He==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":j==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":j==="sm"},p),children:[I&&(0,e.jsx)("a",{className:"absolute inset-0 z-10",href:Ie,tabIndex:-1,"aria-hidden":"true","aria-label":Ve,...Re}),(0,e.jsx)("div",{ref:B,className:(0,d.cn)("absolute left-0 top-0 size-full"),children:Q?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ue.default,{poster:void 0,src:Ce,className:"laptop:w-full absolute inset-0 h-full transition-opacity duration-500",videoLayerClassName:"opacity-0",videoClassName:"h-full object-cover",muted:!0,loop:Be,playsInline:!0,onPlaying:r=>{const a=r.currentTarget;a.parentElement?.classList.remove("opacity-0"),a.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:r=>{const a=r.currentTarget;if(a.currentTime>=.5)return;a.parentElement?.classList.add("opacity-0"),a.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),(0,e.jsx)("div",{"data-video-poster":"true",className:"laptop:w-full bg-container-primary pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:(0,e.jsx)(c.Picture,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:(0,f.resolveTierMedia)(t,"lgDesktop","image")?.alt||"",source:re})})]}):(0,e.jsx)(c.Picture,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:(0,f.resolveTierMedia)(t,"lgDesktop","image")?.alt||"",source:re})}),(0,e.jsxs)("div",{className:Ye({align:w}),children:[(0,e.jsxs)("div",{className:Ze({align:w}),children:[Z&&(0,e.jsx)(c.Text,{size:2,as:"p",className:(0,d.cn)("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:Z}),u&&(0,e.jsx)(c.Heading,{as:A==="4"?"h1":"h2",html:u,className:(0,d.cn)("hero-banner-title",o.title),size:A?Number(A||"5"):j==="sm"?4:5}),i&&(0,e.jsx)(c.Text,{as:"p",size:2,className:(0,d.cn)("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",o.subtitle),html:i}),K&&(0,e.jsx)("div",{className:"mt-3",children:(0,e.jsx)(c.Countdown,{endDate:K,endDate_tz:Te,dateFormat:we,variant:"spacious",align:w})})]}),(0,e.jsxs)("div",{className:(0,d.cn)(Ke({align:w}),o.buttonGroup),children:[(0,e.jsxs)("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[n?.isShowPlayVideoButton&&n?.playVideoButtonText?(0,e.jsxs)(c.Button,{onClick:()=>oe(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...De,children:[n?.playVideoButtonText," ",(0,e.jsx)(Xe,{size:"lg"})]}):n?.text?(0,e.jsxs)(c.Button,{"aria-label":u??i,size:"lg",variant:"secondary",className:(0,d.cn)("hero-banner-secondary-button",o.secondaryButton),as:n?.isCustomSecondaryButton?"button":"a",href:Ee,target:n?.target,rel:n?.target==="_blank"?n?.rel??"noopener noreferrer":n?.rel,onClick:r=>{if(n.link?.startsWith("#")){r.preventDefault();const a=document.querySelector(n.link);a&&(0,P.default)(a,R)}n?.isCustomSecondaryButton&&T?.(t,r,n?.customSecondaryEventId)},...je,children:[n?.text,(0,e.jsx)("span",{className:"sr-only",children:u??i})]}):null,s&&s.text&&(0,e.jsx)(c.Button,{"aria-label":u??i,size:"lg",variant:"primary",className:(0,d.cn)("hero-banner-primary-button",o.primaryButton),as:s?.isCustomPrimaryButton?"button":"a",href:Me,target:s?.target,rel:s?.target==="_blank"?s?.rel??"noopener noreferrer":s?.rel,onClick:r=>{if(s.link?.startsWith("#")){r.preventDefault();const a=document.querySelector(s.link);a&&(0,P.default)(a,R)}s?.isCustomPrimaryButton&&g?.(t,r,s?.customPrimaryEventId)},...Ae,children:s.text})]}),l&&l.text&&(0,e.jsxs)(c.Button,{"aria-label":u??i,size:"lg",variant:"link",className:(0,d.cn)("hero-banner-tertiary-button w-auto p-0",o.tertiaryButton),as:l?.isCustomTertiaryButton?"button":"a",href:Pe,target:l?.target,rel:l?.target==="_blank"?l?.rel??"noopener noreferrer":l?.rel,onClick:r=>{if(l.link?.startsWith("#")){r.preventDefault();const a=document.querySelector(l.link);a&&(0,P.default)(a,R)}l?.isCustomTertiaryButton&&_?.(t,r,l?.customTertiaryEventId)},...Oe,children:[l.text,(0,e.jsx)("span",{className:"sr-only",children:u??i})]})]}),(0,e.jsx)("div",{className:Qe({align:w}),children:Ne?.map(r=>(0,e.jsx)("div",{className:"h-12",children:(0,e.jsx)(c.Picture,{className:"!inline-block h-full !w-auto",imgClassName:"!w-auto h-full object-contain",loading:"eager",alt:r?.pcImage?.alt||"",source:r?.pcImage?.url})},r?.pcImage?.url||r?.pcImage?.alt))})]}),O.length>0&&(0,e.jsx)("div",{className:(0,d.cn)("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]",o.captionGroup),children:O.map((r,a)=>(0,e.jsxs)(m.default.Fragment,{children:[(0,e.jsx)(c.Text,{size:2,className:(0,d.cn)("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:r.title}),a<O.length-1&&(0,e.jsx)("div",{className:(0,d.cn)("bg-info-primary w-px")})]},r.title))}),ne&&(0,e.jsx)(ve.VideoModal,{visible:ne,videoUrl:n?.isYoutubeVideo?void 0:n?.videoUrl?.url,youTubeId:n?.isYoutubeVideo?n?.youtubeId:void 0,onCloseModal:()=>oe(!1)})]})})});ce.displayName="HeroBanner";var $e=(0,me.withLayout)(ce);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var et=Object.create;var de=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var ot=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var rt=(a,c)=>{for(var f in c)de(a,f,{get:c[f],enumerable:!0})},Ee=(a,c,f,A)=>{if(c&&typeof c=="object"||typeof c=="function")for(let k of nt(c))!at.call(a,k)&&k!==f&&de(a,k,{get:()=>c[k],enumerable:!(A=tt(c,k))||A.enumerable});return a};var Ve=(a,c,f)=>(f=a!=null?et(ot(a)):{},Ee(c||!a||!a.__esModule?de(f,"default",{value:a,enumerable:!0}):f,a)),it=a=>Ee(de({},"__esModule",{value:!0}),a);var ut={};rt(ut,{default:()=>ct});module.exports=it(ut);var o=require("react/jsx-runtime"),i=Ve(require("react")),ue=require("swiper/react"),Pe=Ve(require("../../helpers/ScrollLoadVideo.js")),w=require("../../helpers/index.js"),T=require("./mediaResolver.js"),u=require("../../components/index.js"),Ne=require("../../hooks/useCarouselPlayback.js"),j=require("../../shared/CarouselControls.js"),E=require("../../shared/track.js"),q=require("../../shared/trackUrlRef.js"),_e=require("../../hooks/useExposure.js"),He=require("../AiuiProvider/index.js"),Ae=require("../VideoModal/index.js"),mt=require("swiper/css");const st=({size:a="base"})=>{const c=a==="lg"?"20":a==="sm"?"16":"18";return(0,o.jsx)("svg",{width:c,height:c,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,o.jsx)("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"})})},ce="hero_banner",lt=({data:a,isActive:c,isAdjacent:f=!1,videoRef:A,slideIndex:k,containerSize:Q="default",theme:pe="light",slideLabel:me,position:V,locale:s,pageHandle:$,onPlayVideo:X,onPrimaryClick:y,onSecondaryClick:ge,onTertiaryClick:ee})=>{const{pcImage:te,isVideoLoop:O=!0,isShowVideo:I,title:B,subtitle:C,label:G,endDate:U,endDate_tz:ne,dateFormat:P,iconArray:R,caption:x,blockLink:Y,primaryButton:l,secondaryButton:d,tertiaryButton:p,align:N="left",titleSize:M}=a,z=(0,T.useMediaTier)(),v=(0,T.buildPictureSource)(a),W=(0,T.resolveTierMedia)(a,"lgDesktop","image")?.alt||te?.alt||"",S=(0,T.resolveTierMedia)(a,z,"video")?.url||"",_=!!v&&!/\.(mp4|mov|webm|m4v)(\?|$)/i.test(v),oe=(0,E.resolveComponentMediaType)(I),ve=(0,T.resolveTierMedia)(a,z,I?"video":"image")?.id||te?.id||"",ae=`${(0,q.buildTrackingRef)($??"",oe,ce)}_${V}`,fe=n=>n&&s?(0,w.getLocalizedPath)(n,s):n,F=n=>n?(0,q.trackUrlRef)(fe(n),ae):void 0,L=(n,b)=>(0,E.buildClickTrackingProps)({interactive:n,componentType:oe,componentName:ce,title:B,description:C,buttonName:b,position:V,creativeId:ve});return(0,o.jsxs)("div",{"data-ui-component-id":"HeroBannerSlide",role:"group","aria-roledescription":"slide","aria-label":me,className:(0,w.cn)("text-info-primary relative w-full overflow-hidden transition-colors duration-500",pe==="dark"&&"aiui-dark",Q==="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:[Y&&(0,o.jsx)("a",{className:"absolute inset-0 z-10",href:F(Y),tabIndex:-1,"aria-hidden":"true","aria-label":B?.trim()||C?.trim()||W||void 0,...L(!0)}),I?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Pe.default,{videoRef:A,src:S,poster:void 0,className:"absolute inset-0 size-full transition-opacity duration-500",videoClassName:"size-full object-cover",videoLayerClassName:"opacity-0",muted:!0,loop:O,playsInline:!0,onPlaying:n=>{const b=n.currentTarget;b.parentElement?.classList.remove("opacity-0"),b.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:n=>{const b=n.currentTarget;if(b.currentTime>=.5)return;b.parentElement?.classList.add("opacity-0"),b.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),_&&(0,o.jsx)("div",{"data-video-poster":"true",className:"bg-container-primary pointer-events-none absolute inset-0 size-full transition-opacity duration-500",children:(0,o.jsx)(u.Picture,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:k===0||f?"eager":"lazy",fetchPriority:k===0?"high":"auto",alt:W,source:v})})]}):(0,o.jsx)(u.Picture,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:W,source:v}),(0,o.jsxs)("div",{className:(0,w.cn)("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",N==="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:[(0,o.jsxs)("div",{className:(0,w.cn)("tablet:max-w-[704px] laptop:max-w-[440px] desktop:max-w-[648px] lg-desktop:max-w-[824px] max-w-[358px] transition-colors duration-500",N==="center"?"text-center":"laptop:text-left"),children:[G&&(0,o.jsx)(u.Text,{size:2,as:"p",className:(0,w.cn)("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:G}),B&&(0,o.jsx)(u.Heading,{as:M==="4"?"h1":"h2",html:B,size:M?Number(M||"5"):Q==="sm"?4:5}),C&&(0,o.jsx)(u.Text,{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:C}),U&&(0,o.jsx)("div",{className:"mt-3",children:(0,o.jsx)(u.Countdown,{endDate:U,endDate_tz:ne,dateFormat:P,variant:"spacious",align:N})})]}),(l?.text||d?.text||p?.text)&&(0,o.jsxs)("div",{className:(0,w.cn)("lg-desktop:gap-3 pointer-events-auto flex flex-wrap items-center gap-2",N==="center"?"justify-center":"laptop:justify-start"),children:[d?.isShowPlayVideoButton&&d?.playVideoButtonText?(0,o.jsxs)(u.Button,{size:"lg",variant:"secondary",className:"hero-banner-play-video-button",onClick:()=>X?.(),...L(!0,"video play"),children:[d.playVideoButtonText," ",(0,o.jsx)(st,{size:"lg"})]}):d?.text?(0,o.jsxs)(u.Button,{size:"lg",variant:"secondary",as:d?.isCustomSecondaryButton?"button":"a",href:F(d.link),target:d?.target,rel:d?.target==="_blank"?d?.rel??"noopener noreferrer":d?.rel,onClick:n=>d?.isCustomSecondaryButton&&ge?.(a,n,d?.customSecondaryEventId),...L(!!(d.link||d.isCustomSecondaryButton),d.text),children:[d.text,(0,o.jsx)("span",{className:"sr-only",children:B??C})]}):null,l?.text&&(0,o.jsx)(u.Button,{size:"lg",variant:"primary",as:l?.isCustomPrimaryButton?"button":"a",href:F(l.link),target:l?.target,rel:l?.target==="_blank"?l?.rel??"noopener noreferrer":l?.rel,onClick:n=>l?.isCustomPrimaryButton&&y?.(a,n,l?.customPrimaryEventId),...L(!!(l.link||l.isCustomPrimaryButton),l.text),children:l.text}),p?.text&&(0,o.jsxs)(u.Button,{size:"lg",variant:"link",className:"tablet:basis-auto basis-full",as:p?.isCustomTertiaryButton?"button":"a",href:F(p.link),target:p?.target,rel:p?.target==="_blank"?p?.rel??"noopener noreferrer":p?.rel,onClick:n=>p?.isCustomTertiaryButton&&ee?.(a,n,p?.customTertiaryEventId),...L(!!(p.link||p.isCustomTertiaryButton),p.text),children:[p.text,(0,o.jsx)("span",{className:"sr-only",children:B??C})]})]}),R&&R.length>0&&(0,o.jsx)("div",{className:(0,w.cn)("flex items-center gap-2",N==="center"?"justify-center":"justify-start"),children:R.map(n=>(0,o.jsx)("div",{className:"h-12",children:(0,o.jsx)(u.Picture,{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))})]}),x&&x.length>0&&(0,o.jsx)("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:x.map((n,b)=>(0,o.jsxs)(i.default.Fragment,{children:[(0,o.jsx)(u.Text,{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}),b<x.length-1&&(0,o.jsx)("div",{className:"bg-info-primary w-px"})]},n.title))})]})},dt={prevSlide:"Previous slide",nextSlide:"Next slide",pauseAutoplay:"Pause autoplay",playAutoplay:"Play autoplay",pauseVideo:"Pause video",playVideo:"Play video",slideStatus:"Slide",carouselLabel:"Banner carousel"},Be=i.default.forwardRef(({data:a,className:c,classNames:f={},a11yLabels:A,onPrimaryClick:k,onSecondaryClick:Q,onTertiaryClick:pe,...me},V)=>{const s=a.items||[],$=a.carousel,X=$?.size??a.size??"default",y={...dt,...A},{locale:ge,pageHandle:ee,trackingData:te}=(0,He.useAiuiContext)(),O=(0,T.useMediaTier)(),I=(0,q.buildPageGroup)({pageHandle:ee,pageGroup:te?.pageGroup}),B=(0,i.useRef)(null),[C,G]=(0,i.useState)(null),[U,ne]=(0,i.useState)(null),[P,R]=(0,i.useState)(null),[x,Y]=(0,i.useState)(null),l=(0,i.useRef)(s);(0,i.useEffect)(()=>{l.current=s});const d=e=>e!==void 0&&e!==999&&e>=5,p=e=>e!==void 0&&e!==999&&e>=1&&e<=30,N=$?.autoplaySeconds,M=e=>{const t=e?.autoplaySeconds;return p(t)?t:d(N)?N:void 0},z=s.length>1&&s.some(e=>M(e)!==void 0),v=(0,i.useRef)(s.map(()=>i.default.createRef())),W=($?.showArrows??!0)&&s.length>1,S=(0,i.useCallback)((e,t)=>{(0,E.gaTrack)({event:"ga4Event",event_name:e,event_parameters:t})},[]),_=(0,i.useCallback)(e=>l.current[e]?.isShowVideo?"video":"image",[]),oe=(0,i.useCallback)((e,t)=>{t==="swipe"&&S("hero_banner_swipe",{to_index:e}),S("hero_banner_slide_view",{index:e,total:l.current.length,media_type:_(e),trigger:t})},[S,_]),ve=(0,i.useCallback)((e,t,r,g="arrow")=>{S("hero_banner_arrow_click",{direction:e,from_index:t,to_index:r,source:g})},[S]),ae=(0,i.useCallback)((e,t)=>{S(e?"hero_banner_pause":"hero_banner_resume",{index:t,media_type:_(t)})},[S,_]),fe=(0,i.useCallback)((e,t)=>{const r=l.current[t];r&&(0,E.trackComponentClick)({pageGroup:I,componentType:"video",componentName:ce,position:t+1,buttonName:e?"video pause":"video play",componentTitle:r.title,componentDescription:r.subtitle,creativeId:(0,T.resolveTierMedia)(r,O,"video")?.id||r.pcImage?.id||""})},[I,O]),F=(0,i.useCallback)(e=>{v.current.forEach((r,g)=>{g!==e&&r.current&&(r.current.pause(),r.current.currentTime=0)});const t=v.current[e];t?.current&&(t.current.currentTime=0,t.current.play()?.catch(()=>{}))},[]),{rootRef:L,activeIndex:n,playbackState:b,resetNonce:ye,announcement:Ie,activeFrameIntervalSec:Se,isTimerRunning:Re,handleSwiperInit:Me,handleSlideChange:ze,handleTransitionEnd:Fe,handleSliderFirstMove:De,goToSlide:Te,goToSlideIndex:je,handlePausePlayClick:qe,notifyVideoPlaying:ke,handleFocus:$e,handleBlur:Oe}=(0,Ne.useCarouselPlayback)({frameCount:s.length,resolveFrameIntervalSec:e=>M(s[e]),isAutoplayEnabled:z,swiperRef:B,slideStatusLabel:y.slideStatus,onSlideMediaSync:F,onSlideChange:oe,onArrowNavigate:ve,delaysCountdownForVideo:e=>!!l.current[e]?.isShowVideo,onPauseToggle:(e,t)=>{ae(e,t);const r=v.current[t]?.current;r&&(e?r.pause():r.ended||r.play()?.catch(()=>{}))}}),Ge=(0,i.useCallback)(e=>{L.current=e,typeof V=="function"?V(e):V&&(V.current=e)},[V,L]),h=s[n]??s[0],Ue=(0,E.resolveComponentMediaType)(h?.isShowVideo),Ye=h?.title!==void 0?h?.title?.trim()||h?.subtitle?.trim()||h?.pcImage?.alt?.trim()||void 0:h?.subtitle&&h.subtitle.trim()||"",We=h&&((0,T.resolveTierMedia)(h,O,h.isShowVideo?"video":"image")?.id||h.pcImage?.id)||"";(0,_e.useExposure)(L,{componentType:Ue,componentName:ce,componentTitle:Ye,componentDescription:h?.subtitle?.trim()||"",creativeId:We,position:1}),(0,i.useEffect)(()=>{G(null),ne(null);const e=l.current[n],t=v.current[n]?.current;if(!e?.isShowVideo||!t)return;const r=()=>G(t.ended?"ended":t.paused?"paused":"playing"),g=()=>ne(Number.isFinite(t.duration)?t.duration:null),D=()=>{r(),ke(n)};return r(),g(),t.addEventListener("playing",D),t.addEventListener("pause",r),t.addEventListener("ended",r),t.addEventListener("loadedmetadata",g),()=>{t.removeEventListener("playing",D),t.removeEventListener("pause",r),t.removeEventListener("ended",r),t.removeEventListener("loadedmetadata",g)}},[n,ke]),(0,i.useEffect)(()=>{const e=l.current[n];if(!e?.isShowVideo||!e?.isMultiThemeEnabled)return;const t=v.current[n]?.current;if(!t)return;const r=(m,H,le,xe)=>{if(!(!m||typeof H!="number"||typeof le!="number"||typeof xe!="number"))return xe>=H&&xe<le?m:void 0};let g=null;const D=m=>{g=m,R(H=>H&&H.index===n&&H.theme===m?H:{index:n,theme:m})},re=m=>{D(r(e.theme_1,e.star_time_1,e.end_time_1,m)??r(e.theme_2,e.star_time_2,e.end_time_2,m)??e.theme??"light")},ie=t;let J=0,K=0;const be=typeof ie.requestVideoFrameCallback=="function",Xe=()=>be?K!==0:J!==0,he=()=>{if(!Xe())if(be){const m=(H,le)=>{re(le.mediaTime),K=ie.requestVideoFrameCallback(m)};K=ie.requestVideoFrameCallback(m)}else{const m=()=>{re(t.currentTime),J=requestAnimationFrame(m)};J=requestAnimationFrame(m)}},se=()=>{be?(ie.cancelVideoFrameCallback?.(K),K=0):(cancelAnimationFrame(J),J=0)},Le=()=>{se(),g&&R({index:n,theme:g})};return t.addEventListener("play",he),t.addEventListener("pause",se),t.addEventListener("ended",Le),!t.paused&&!t.ended&&he(),()=>{se(),t.removeEventListener("play",he),t.removeEventListener("pause",se),t.removeEventListener("ended",Le)}},[n]),(0,i.useEffect)(()=>{v.current.forEach((e,t)=>{t!==0&&e.current&&(e.current.pause(),e.current.currentTime=0)})},[]),(0,i.useEffect)(()=>{l.current.length!==0&&S("hero_banner_slide_view",{index:0,total:l.current.length,media_type:_(0),trigger:"initial"})},[S,_]);const Ze=!!s[n]?.isShowVideo,Ce=Se!==void 0,Z=!Ce&&Ze&&U!==null&&U>5&&C!=="ended"&&C!==null,Je=Ce||Z,Ke=Z?C==="paused":b==="STOPPED",Qe=()=>{if(!Z){qe();return}const e=v.current[n]?.current;if(!e)return;const t=!e.paused;t?e.pause():e.play()?.catch(()=>{}),ae(t,n),fe(t,n)},we=P&&P.index===n?P.theme:s[n]?.theme;return(0,o.jsxs)("div",{ref:Ge,role:"region","aria-roledescription":"carousel","aria-label":y.carouselLabel,"data-ui-component-id":"HeroBanner",onFocus:$e,onBlur:Oe,className:(0,w.cn)("hero-banner-carousel group relative w-full overflow-hidden",X==="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]",f.root,c),...me,children:[(0,o.jsx)(ue.Swiper,{onSwiper:Me,onSlideChange:ze,onSlideChangeTransitionEnd:Fe,onSliderFirstMove:De,slidesPerView:1,loop:!0,initialSlide:0,allowTouchMove:!0,children:s.map((e,t)=>{const r=P&&P.index===t?P.theme:e.theme??"light";return(0,o.jsx)(ue.SwiperSlide,{children:({isActive:g,isPrev:D,isNext:re})=>(0,o.jsx)(lt,{data:e,isActive:g,isAdjacent:D||re,slideIndex:t,slideLabel:`${y.slideStatus} ${t+1} / ${s.length}`,videoRef:v.current[t],containerSize:X,theme:r,position:t+1,locale:ge,pageHandle:ee,onPlayVideo:()=>Y(t),onPrimaryClick:k,onSecondaryClick:Q,onTertiaryClick:pe})},t)})}),W&&(0,o.jsx)(j.CarouselArrows,{onPrev:()=>Te("prev"),onNext:()=>Te("next"),prevLabel:y.prevSlide,nextLabel:y.nextSlide}),z&&(0,o.jsx)(j.CarouselProgressControls,{frameCount:s.length,activeIndex:n,resetNonce:ye,activeFrameIntervalSec:Se,isAutoplayEnabled:z,isTimerRunning:Re,onSegmentClick:je,segmentLabel:e=>`${y.slideStatus} ${e+1} / ${s.length}`,classPrefix:"hero-banner",theme:we}),Je&&(0,o.jsx)(j.CarouselCornerToggle,{isPaused:Ke,onToggle:Qe,pausedLabel:Z?y.playVideo:y.playAutoplay,playingLabel:Z?y.pauseVideo:y.pauseAutoplay,classPrefix:"hero-banner",theme:we}),(0,o.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:Ie}),x!==null&&s[x]?.secondaryButton&&(0,o.jsx)(Ae.VideoModal,{visible:!0,videoUrl:s[x].secondaryButton?.isYoutubeVideo?void 0:s[x].secondaryButton?.videoUrl?.url,youTubeId:s[x].secondaryButton?.isYoutubeVideo?s[x].secondaryButton?.youtubeId:void 0,onCloseModal:()=>Y(null)})]})});Be.displayName="HeroBannerCarousel";var ct=Be;
|
|
1
|
+
"use strict";"use client";var et=Object.create;var de=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var ot=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var rt=(a,c)=>{for(var f in c)de(a,f,{get:c[f],enumerable:!0})},Ee=(a,c,f,A)=>{if(c&&typeof c=="object"||typeof c=="function")for(let k of nt(c))!at.call(a,k)&&k!==f&&de(a,k,{get:()=>c[k],enumerable:!(A=tt(c,k))||A.enumerable});return a};var Ve=(a,c,f)=>(f=a!=null?et(ot(a)):{},Ee(c||!a||!a.__esModule?de(f,"default",{value:a,enumerable:!0}):f,a)),it=a=>Ee(de({},"__esModule",{value:!0}),a);var ut={};rt(ut,{default:()=>ct});module.exports=it(ut);var o=require("react/jsx-runtime"),i=Ve(require("react")),ue=require("swiper/react"),Pe=Ve(require("../../helpers/ScrollLoadVideo.js")),w=require("../../helpers/index.js"),x=require("./mediaResolver.js"),u=require("../../components/index.js"),Ne=require("../../hooks/useCarouselPlayback.js"),j=require("../../shared/CarouselControls.js"),E=require("../../shared/track.js"),q=require("../../shared/trackUrlRef.js"),_e=require("../../hooks/useExposure.js"),He=require("../AiuiProvider/index.js"),Ae=require("../VideoModal/index.js"),mt=require("swiper/css");const st=({size:a="base"})=>{const c=a==="lg"?"20":a==="sm"?"16":"18";return(0,o.jsx)("svg",{width:c,height:c,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,o.jsx)("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"})})},ce="hero_banner",lt=({data:a,isActive:c,isAdjacent:f=!1,videoRef:A,slideIndex:k,containerSize:Q="default",theme:pe="light",slideLabel:me,position:V,locale:s,pageHandle:$,onPlayVideo:X,onPrimaryClick:y,onSecondaryClick:ge,onTertiaryClick:ee})=>{const{pcImage:te,isVideoLoop:O=!0,isShowVideo:I,title:B,subtitle:C,label:G,endDate:U,endDate_tz:ne,dateFormat:P,iconArray:R,caption:S,blockLink:Y,primaryButton:l,secondaryButton:d,tertiaryButton:p,align:N="left",titleSize:M}=a,z=(0,x.useMediaTier)(),v=(0,x.buildPictureSource)(a),W=(0,x.resolveTierMedia)(a,"lgDesktop","image")?.alt||te?.alt||"",T=(0,x.resolveTierMedia)(a,z,"video")?.url||"",_=!!v&&!/\.(mp4|mov|webm|m4v)(\?|$)/i.test(v),oe=(0,E.resolveComponentMediaType)(I),ve=(0,x.resolveTierMedia)(a,z,I?"video":"image")?.id||te?.id||"",ae=`${(0,q.buildTrackingRef)($??"",oe,ce)}_${V}`,fe=n=>n&&s?(0,w.getLocalizedPath)(n,s):n,F=n=>n?(0,q.trackUrlRef)(fe(n),ae):void 0,L=(n,b)=>(0,E.buildClickTrackingProps)({interactive:n,componentType:oe,componentName:ce,title:B,description:C,buttonName:b,position:V,creativeId:ve});return(0,o.jsxs)("div",{"data-ui-component-id":"HeroBannerSlide",role:"group","aria-roledescription":"slide","aria-label":me,className:(0,w.cn)("text-info-primary relative w-full overflow-hidden transition-colors duration-500",pe==="dark"&&"aiui-dark",Q==="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:[Y&&(0,o.jsx)("a",{className:"absolute inset-0 z-10",href:F(Y),tabIndex:-1,"aria-hidden":"true","aria-label":B?.trim()||C?.trim()||W||void 0,...L(!0)}),I?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Pe.default,{videoRef:A,src:T,poster:void 0,className:"absolute inset-0 size-full transition-opacity duration-500",videoClassName:"size-full object-cover",videoLayerClassName:"opacity-0",muted:!0,loop:O,playsInline:!0,onPlaying:n=>{const b=n.currentTarget;b.parentElement?.classList.remove("opacity-0"),b.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:n=>{const b=n.currentTarget;if(b.currentTime>=.5)return;b.parentElement?.classList.add("opacity-0"),b.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),_&&(0,o.jsx)("div",{"data-video-poster":"true",className:"bg-container-primary pointer-events-none absolute inset-0 size-full transition-opacity duration-500",children:(0,o.jsx)(u.Picture,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:k===0||f?"eager":"lazy",fetchPriority:k===0?"high":"auto",alt:W,source:v})})]}):(0,o.jsx)(u.Picture,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:W,source:v}),(0,o.jsxs)("div",{className:(0,w.cn)("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",N==="center"?"left-1/2 -translate-x-1/2 items-center text-center":"px-grid left-0"),children:[(0,o.jsxs)("div",{className:(0,w.cn)("tablet:max-w-[704px] laptop:max-w-[440px] desktop:max-w-[648px] lg-desktop:max-w-[824px] max-w-[358px] transition-colors duration-500",N==="center"?"text-center":"laptop:text-left"),children:[G&&(0,o.jsx)(u.Text,{size:2,as:"p",className:(0,w.cn)("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:G}),B&&(0,o.jsx)(u.Heading,{as:M==="4"?"h1":"h2",html:B,size:M?Number(M||"5"):Q==="sm"?4:5}),C&&(0,o.jsx)(u.Text,{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:C}),U&&(0,o.jsx)("div",{className:"mt-3",children:(0,o.jsx)(u.Countdown,{endDate:U,endDate_tz:ne,dateFormat:P,variant:"spacious",align:N})})]}),(l?.text||d?.text||p?.text)&&(0,o.jsxs)("div",{className:(0,w.cn)("lg-desktop:gap-3 pointer-events-auto flex flex-wrap items-center gap-2",N==="center"?"justify-center":"laptop:justify-start"),children:[d?.isShowPlayVideoButton&&d?.playVideoButtonText?(0,o.jsxs)(u.Button,{size:"lg",variant:"secondary",className:"hero-banner-play-video-button",onClick:()=>X?.(),...L(!0,"video play"),children:[d.playVideoButtonText," ",(0,o.jsx)(st,{size:"lg"})]}):d?.text?(0,o.jsxs)(u.Button,{size:"lg",variant:"secondary",as:d?.isCustomSecondaryButton?"button":"a",href:F(d.link),target:d?.target,rel:d?.target==="_blank"?d?.rel??"noopener noreferrer":d?.rel,onClick:n=>d?.isCustomSecondaryButton&&ge?.(a,n,d?.customSecondaryEventId),...L(!!(d.link||d.isCustomSecondaryButton),d.text),children:[d.text,(0,o.jsx)("span",{className:"sr-only",children:B??C})]}):null,l?.text&&(0,o.jsx)(u.Button,{size:"lg",variant:"primary",as:l?.isCustomPrimaryButton?"button":"a",href:F(l.link),target:l?.target,rel:l?.target==="_blank"?l?.rel??"noopener noreferrer":l?.rel,onClick:n=>l?.isCustomPrimaryButton&&y?.(a,n,l?.customPrimaryEventId),...L(!!(l.link||l.isCustomPrimaryButton),l.text),children:l.text}),p?.text&&(0,o.jsxs)(u.Button,{size:"lg",variant:"link",className:"tablet:basis-auto basis-full",as:p?.isCustomTertiaryButton?"button":"a",href:F(p.link),target:p?.target,rel:p?.target==="_blank"?p?.rel??"noopener noreferrer":p?.rel,onClick:n=>p?.isCustomTertiaryButton&&ee?.(a,n,p?.customTertiaryEventId),...L(!!(p.link||p.isCustomTertiaryButton),p.text),children:[p.text,(0,o.jsx)("span",{className:"sr-only",children:B??C})]})]}),R&&R.length>0&&(0,o.jsx)("div",{className:(0,w.cn)("flex items-center gap-2",N==="center"?"justify-center":"justify-start"),children:R.map(n=>(0,o.jsx)("div",{className:"h-12",children:(0,o.jsx)(u.Picture,{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))})]}),S&&S.length>0&&(0,o.jsx)("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:S.map((n,b)=>(0,o.jsxs)(i.default.Fragment,{children:[(0,o.jsx)(u.Text,{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}),b<S.length-1&&(0,o.jsx)("div",{className:"bg-info-primary w-px"})]},n.title))})]})},dt={prevSlide:"Previous slide",nextSlide:"Next slide",pauseAutoplay:"Pause autoplay",playAutoplay:"Play autoplay",pauseVideo:"Pause video",playVideo:"Play video",slideStatus:"Slide",carouselLabel:"Banner carousel"},Be=i.default.forwardRef(({data:a,className:c,classNames:f={},a11yLabels:A,onPrimaryClick:k,onSecondaryClick:Q,onTertiaryClick:pe,...me},V)=>{const s=a.items||[],$=a.carousel,X=$?.size??a.size??"default",y={...dt,...A},{locale:ge,pageHandle:ee,trackingData:te}=(0,He.useAiuiContext)(),O=(0,x.useMediaTier)(),I=(0,q.buildPageGroup)({pageHandle:ee,pageGroup:te?.pageGroup}),B=(0,i.useRef)(null),[C,G]=(0,i.useState)(null),[U,ne]=(0,i.useState)(null),[P,R]=(0,i.useState)(null),[S,Y]=(0,i.useState)(null),l=(0,i.useRef)(s);(0,i.useEffect)(()=>{l.current=s});const d=e=>e!==void 0&&e!==999&&e>=5,p=e=>e!==void 0&&e!==999&&e>=1&&e<=30,N=$?.autoplaySeconds,M=e=>{const t=e?.autoplaySeconds;return p(t)?t:d(N)?N:void 0},z=s.length>1&&s.some(e=>M(e)!==void 0),v=(0,i.useRef)(s.map(()=>i.default.createRef())),W=($?.showArrows??!0)&&s.length>1,T=(0,i.useCallback)((e,t)=>{(0,E.gaTrack)({event:"ga4Event",event_name:e,event_parameters:t})},[]),_=(0,i.useCallback)(e=>l.current[e]?.isShowVideo?"video":"image",[]),oe=(0,i.useCallback)((e,t)=>{t==="swipe"&&T("hero_banner_swipe",{to_index:e}),T("hero_banner_slide_view",{index:e,total:l.current.length,media_type:_(e),trigger:t})},[T,_]),ve=(0,i.useCallback)((e,t,r,g="arrow")=>{T("hero_banner_arrow_click",{direction:e,from_index:t,to_index:r,source:g})},[T]),ae=(0,i.useCallback)((e,t)=>{T(e?"hero_banner_pause":"hero_banner_resume",{index:t,media_type:_(t)})},[T,_]),fe=(0,i.useCallback)((e,t)=>{const r=l.current[t];r&&(0,E.trackComponentClick)({pageGroup:I,componentType:"video",componentName:ce,position:t+1,buttonName:e?"video pause":"video play",componentTitle:r.title,componentDescription:r.subtitle,creativeId:(0,x.resolveTierMedia)(r,O,"video")?.id||r.pcImage?.id||""})},[I,O]),F=(0,i.useCallback)(e=>{v.current.forEach((r,g)=>{g!==e&&r.current&&(r.current.pause(),r.current.currentTime=0)});const t=v.current[e];t?.current&&(t.current.currentTime=0,t.current.play()?.catch(()=>{}))},[]),{rootRef:L,activeIndex:n,playbackState:b,resetNonce:ye,announcement:Ie,activeFrameIntervalSec:Te,isTimerRunning:Re,handleSwiperInit:Me,handleSlideChange:ze,handleTransitionEnd:Fe,handleSliderFirstMove:De,goToSlide:xe,goToSlideIndex:je,handlePausePlayClick:qe,notifyVideoPlaying:ke,handleFocus:$e,handleBlur:Oe}=(0,Ne.useCarouselPlayback)({frameCount:s.length,resolveFrameIntervalSec:e=>M(s[e]),isAutoplayEnabled:z,swiperRef:B,slideStatusLabel:y.slideStatus,onSlideMediaSync:F,onSlideChange:oe,onArrowNavigate:ve,delaysCountdownForVideo:e=>!!l.current[e]?.isShowVideo,onPauseToggle:(e,t)=>{ae(e,t);const r=v.current[t]?.current;r&&(e?r.pause():r.ended||r.play()?.catch(()=>{}))}}),Ge=(0,i.useCallback)(e=>{L.current=e,typeof V=="function"?V(e):V&&(V.current=e)},[V,L]),h=s[n]??s[0],Ue=(0,E.resolveComponentMediaType)(h?.isShowVideo),Ye=h?.title!==void 0?h?.title?.trim()||h?.subtitle?.trim()||h?.pcImage?.alt?.trim()||void 0:h?.subtitle&&h.subtitle.trim()||"",We=h&&((0,x.resolveTierMedia)(h,O,h.isShowVideo?"video":"image")?.id||h.pcImage?.id)||"";(0,_e.useExposure)(L,{componentType:Ue,componentName:ce,componentTitle:Ye,componentDescription:h?.subtitle?.trim()||"",creativeId:We,position:1}),(0,i.useEffect)(()=>{G(null),ne(null);const e=l.current[n],t=v.current[n]?.current;if(!e?.isShowVideo||!t)return;const r=()=>G(t.ended?"ended":t.paused?"paused":"playing"),g=()=>ne(Number.isFinite(t.duration)?t.duration:null),D=()=>{r(),ke(n)};return r(),g(),t.addEventListener("playing",D),t.addEventListener("pause",r),t.addEventListener("ended",r),t.addEventListener("loadedmetadata",g),()=>{t.removeEventListener("playing",D),t.removeEventListener("pause",r),t.removeEventListener("ended",r),t.removeEventListener("loadedmetadata",g)}},[n,ke]),(0,i.useEffect)(()=>{const e=l.current[n];if(!e?.isShowVideo||!e?.isMultiThemeEnabled)return;const t=v.current[n]?.current;if(!t)return;const r=(m,H,le,Se)=>{if(!(!m||typeof H!="number"||typeof le!="number"||typeof Se!="number"))return Se>=H&&Se<le?m:void 0};let g=null;const D=m=>{g=m,R(H=>H&&H.index===n&&H.theme===m?H:{index:n,theme:m})},re=m=>{D(r(e.theme_1,e.star_time_1,e.end_time_1,m)??r(e.theme_2,e.star_time_2,e.end_time_2,m)??e.theme??"light")},ie=t;let J=0,K=0;const be=typeof ie.requestVideoFrameCallback=="function",Xe=()=>be?K!==0:J!==0,he=()=>{if(!Xe())if(be){const m=(H,le)=>{re(le.mediaTime),K=ie.requestVideoFrameCallback(m)};K=ie.requestVideoFrameCallback(m)}else{const m=()=>{re(t.currentTime),J=requestAnimationFrame(m)};J=requestAnimationFrame(m)}},se=()=>{be?(ie.cancelVideoFrameCallback?.(K),K=0):(cancelAnimationFrame(J),J=0)},Le=()=>{se(),g&&R({index:n,theme:g})};return t.addEventListener("play",he),t.addEventListener("pause",se),t.addEventListener("ended",Le),!t.paused&&!t.ended&&he(),()=>{se(),t.removeEventListener("play",he),t.removeEventListener("pause",se),t.removeEventListener("ended",Le)}},[n]),(0,i.useEffect)(()=>{v.current.forEach((e,t)=>{t!==0&&e.current&&(e.current.pause(),e.current.currentTime=0)})},[]),(0,i.useEffect)(()=>{l.current.length!==0&&T("hero_banner_slide_view",{index:0,total:l.current.length,media_type:_(0),trigger:"initial"})},[T,_]);const Ze=!!s[n]?.isShowVideo,Ce=Te!==void 0,Z=!Ce&&Ze&&U!==null&&U>5&&C!=="ended"&&C!==null,Je=Ce||Z,Ke=Z?C==="paused":b==="STOPPED",Qe=()=>{if(!Z){qe();return}const e=v.current[n]?.current;if(!e)return;const t=!e.paused;t?e.pause():e.play()?.catch(()=>{}),ae(t,n),fe(t,n)},we=P&&P.index===n?P.theme:s[n]?.theme;return(0,o.jsxs)("div",{ref:Ge,role:"region","aria-roledescription":"carousel","aria-label":y.carouselLabel,"data-ui-component-id":"HeroBanner",onFocus:$e,onBlur:Oe,className:(0,w.cn)("hero-banner-carousel group relative w-full overflow-hidden",X==="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]",f.root,c),...me,children:[(0,o.jsx)(ue.Swiper,{onSwiper:Me,onSlideChange:ze,onSlideChangeTransitionEnd:Fe,onSliderFirstMove:De,slidesPerView:1,loop:!0,initialSlide:0,allowTouchMove:!0,children:s.map((e,t)=>{const r=P&&P.index===t?P.theme:e.theme??"light";return(0,o.jsx)(ue.SwiperSlide,{children:({isActive:g,isPrev:D,isNext:re})=>(0,o.jsx)(lt,{data:e,isActive:g,isAdjacent:D||re,slideIndex:t,slideLabel:`${y.slideStatus} ${t+1} / ${s.length}`,videoRef:v.current[t],containerSize:X,theme:r,position:t+1,locale:ge,pageHandle:ee,onPlayVideo:()=>Y(t),onPrimaryClick:k,onSecondaryClick:Q,onTertiaryClick:pe})},t)})}),W&&(0,o.jsx)(j.CarouselArrows,{onPrev:()=>xe("prev"),onNext:()=>xe("next"),prevLabel:y.prevSlide,nextLabel:y.nextSlide}),z&&(0,o.jsx)(j.CarouselProgressControls,{frameCount:s.length,activeIndex:n,resetNonce:ye,activeFrameIntervalSec:Te,isAutoplayEnabled:z,isTimerRunning:Re,onSegmentClick:je,segmentLabel:e=>`${y.slideStatus} ${e+1} / ${s.length}`,classPrefix:"hero-banner",theme:we}),Je&&(0,o.jsx)(j.CarouselCornerToggle,{isPaused:Ke,onToggle:Qe,pausedLabel:Z?y.playVideo:y.playAutoplay,playingLabel:Z?y.pauseVideo:y.pauseAutoplay,classPrefix:"hero-banner",theme:we}),(0,o.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:Ie}),S!==null&&s[S]?.secondaryButton&&(0,o.jsx)(Ae.VideoModal,{visible:!0,videoUrl:s[S].secondaryButton?.isYoutubeVideo?void 0:s[S].secondaryButton?.videoUrl?.url,youTubeId:s[S].secondaryButton?.isYoutubeVideo?s[S].secondaryButton?.youtubeId:void 0,onCloseModal:()=>Y(null)})]})});Be.displayName="HeroBannerCarousel";var ct=Be;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var d=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(p,t)=>{for(var a in t)d(p,a,{get:t[a],enumerable:!0})},n=(p,t,a,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of s(t))!f.call(p,o)&&o!==a&&d(p,o,{get:()=>t[o],enumerable:!(l=r(t,o))||l.enumerable});return p};var x=p=>n(d({},"__esModule",{value:!0}),p);var G={};g(G,{default:()=>u});module.exports=x(G);var e=require("react/jsx-runtime"),m=require("react"),i=require("../../../../components/index.js"),c=require("../../hooks/useStickyFlip.js");const R=({BoxLeftGallery:p,BoxRightDetail:t,BoxBottomSummary:a})=>{const l=(0,m.useRef)(null),o=(0,m.useRef)(null);return(0,c.useStickyFlip)(l,o),(0,e.jsxs)("div",{id:"ipc-product-card",className:"laptop-md:pt-6 laptop-md:px-grid",children:[(0,e.jsxs)(i.Grid,{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:[(0,e.jsx)(i.GridItem,{ref:l,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:p}),(0,e.jsx)(i.GridItem,{ref:o,className:"ipc-box-right-grid-item laptop-md:col-start-9 laptop-md:col-span-4 col-span-12",children:t})]}),a]})};var u=R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var q=Object.create;var u=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var G=(t,o)=>{for(var e in o)u(t,e,{get:o[e],enumerable:!0})},S=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of U(o))!$.call(t,c)&&c!==e&&u(t,c,{get:()=>o[c],enumerable:!(r=z(o,c))||r.enumerable});return t};var H=(t,o,e)=>(e=t!=null?q(W(t)):{},S(o||!t||!t.__esModule?u(e,"default",{value:t,enumerable:!0}):e,t)),I=t=>S(u({},"__esModule",{value:!0}),t);var Q={};G(Q,{default:()=>K});module.exports=I(Q);var a=require("react/jsx-runtime"),l=require("../../../../../components/index.js"),P=require("../../../../AiuiProvider/index.js"),k=require("../../../BizProductProvider.js"),f=require("react"),i=require("../../../utils/index.js"),g=require("../../../utils/textFormat.js"),T=require("../../../hooks/useBenefits.js"),A=H(require("../../CartActionButtons/index.js"));const J=({totalSavingsSlot:t,renderComparePrice:o}={})=>{const{copyWriting:e,locale:r="us",trackingData:c,currencyCode:d}=(0,P.useAiuiContext)(),{variant:n,finalPrice:M,totalSavings:s,isLogin:x,comparePrice:C,onAddToCart:D,onBuyNow:B,savingDetail:b,addToCartLoading:F,buyNowLoading:R,notifyMeMode:L,onNotifyMeClick:E,discount:V,memberFunctionResult:y}=(0,k.useBizProductContext)(),O=(0,T.useBenefits)({variant:n}),{commonCoupon:p,memberDiscount:m}=O,_=c?.showComparePrice??!0,j=(0,f.useMemo)(()=>(0,g.replaceTemplate)(e?.totalSavings||"",{amount:(0,i.formatPrice)({amount:s,currencyCode:n.price.currencyCode,locale:d==="CAD"?"us":r||"us"})}),[e?.totalSavings,s,n.price.currencyCode,r]),v=(0,f.useMemo)(()=>{if(!e?.unlockedSaving)return;const h=p?.enable?Number(p?.config?.fixed_value||0):0,N=m?.enable?m.config?.amount??0:0,w=Math.round((y?.withoutCouponMaxMemberTotalSave?Math.max(N,h):N+h)*100)/100;if(!(w<=0))return(0,g.replaceTemplate)(e.unlockedSaving,{amount:(0,i.formatPrice)({amount:w,currencyCode:n.price.currencyCode,locale:d==="CAD"?"us":r||"us"})})},[e?.unlockedSaving,p?.enable,p?.config?.fixed_value,m?.enable,m?.config?.amount,y,n.price.currencyCode,r]);return(0,a.jsxs)(l.Container,{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:[n.availableForSale?(0,a.jsxs)("div",{className:"ipc-purchase-bar-price laptop-md:items-end flex flex-col justify-between",children:[(0,a.jsxs)("div",{className:"ipc-purchase-bar-price-row flex items-center gap-1",children:[(0,a.jsx)(l.Text,{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:(0,i.formatPrice)({amount:parseFloat(M.toFixed(2)),currencyCode:n.price.currencyCode,locale:d==="CAD"?"us":r||"us"})}),o?o({comparePrice:C}):_&&(s>0||b?.member>0&&x)&&(0,a.jsx)(l.Text,{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:(0,i.formatPrice)({amount:C,currencyCode:n.price.currencyCode,locale:d==="CAD"?"us":r||"us"})}),b?.member>0&&x&&(0,a.jsx)(l.Text,{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"})]}),t||(s>0||b?.member>0&&x?(0,a.jsx)(l.Text,{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:`${j}`}):v?(0,a.jsx)(l.Text,{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:v}):null)]}):(0,a.jsx)(l.Text,{className:"text-[20px] font-bold text-[#999999]",html:e?.soldOut??"Sold Out"}),(0,a.jsx)("div",{className:"tablet:mt-0 mt-2 flex items-center gap-2",children:(0,a.jsx)(A.default,{mode:L,availableForSale:n.availableForSale,addToCartText:e?.addToCart??"Add to Cart",buyNowText:e?.buyNow??"Buy Now",addToCartLoading:F,buyNowLoading:R,onAddToCart:D,onBuyNow:B,onNotifyMeClick:E,notifyMeText:e?.notifyMe,notifyMeClassName:"w-full"})})]})};var K=J;
|
|
1
|
+
"use strict";var q=Object.create;var u=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var G=(t,o)=>{for(var e in o)u(t,e,{get:o[e],enumerable:!0})},S=(t,o,e,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of U(o))!$.call(t,c)&&c!==e&&u(t,c,{get:()=>o[c],enumerable:!(r=z(o,c))||r.enumerable});return t};var H=(t,o,e)=>(e=t!=null?q(W(t)):{},S(o||!t||!t.__esModule?u(e,"default",{value:t,enumerable:!0}):e,t)),I=t=>S(u({},"__esModule",{value:!0}),t);var Q={};G(Q,{default:()=>K});module.exports=I(Q);var a=require("react/jsx-runtime"),l=require("../../../../../components/index.js"),P=require("../../../../AiuiProvider/index.js"),k=require("../../../BizProductProvider.js"),f=require("react"),i=require("../../../utils/index.js"),g=require("../../../utils/textFormat.js"),T=require("../../../hooks/useBenefits.js"),A=H(require("../../CartActionButtons/index.js"));const J=({totalSavingsSlot:t,renderComparePrice:o}={})=>{const{copyWriting:e,locale:r="us",trackingData:c,currencyCode:d}=(0,P.useAiuiContext)(),{variant:n,finalPrice:M,totalSavings:s,isLogin:x,comparePrice:C,onAddToCart:D,onBuyNow:B,savingDetail:b,addToCartLoading:F,buyNowLoading:R,notifyMeMode:L,onNotifyMeClick:E,discount:V,memberFunctionResult:y}=(0,k.useBizProductContext)(),O=(0,T.useBenefits)({variant:n}),{commonCoupon:p,memberDiscount:m}=O,_=c?.showComparePrice??!0,j=(0,f.useMemo)(()=>(0,g.replaceTemplate)(e?.totalSavings||"",{amount:(0,i.formatPrice)({amount:s,currencyCode:n.price.currencyCode,locale:d==="CAD"?"us":r||"us"})}),[e?.totalSavings,s,n.price.currencyCode,r]),v=(0,f.useMemo)(()=>{if(!e?.unlockedSaving)return;const h=p?.enable?Number(p?.config?.fixed_value||0):0,N=m?.enable?m.config?.amount??0:0,w=Math.round((y?.withoutCouponMaxMemberTotalSave?Math.max(N,h):N+h)*100)/100;if(!(w<=0))return(0,g.replaceTemplate)(e.unlockedSaving,{amount:(0,i.formatPrice)({amount:w,currencyCode:n.price.currencyCode,locale:d==="CAD"?"us":r||"us"})})},[e?.unlockedSaving,p?.enable,p?.config?.fixed_value,m?.enable,m?.config?.amount,y,n.price.currencyCode,r]);return(0,a.jsxs)(l.Container,{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:[n.availableForSale?(0,a.jsxs)("div",{className:"ipc-purchase-bar-price laptop-md:items-end flex flex-col justify-between",children:[(0,a.jsxs)("div",{className:"ipc-purchase-bar-price-row flex items-center gap-1",children:[(0,a.jsx)(l.Text,{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:(0,i.formatPrice)({amount:parseFloat(M.toFixed(2)),currencyCode:n.price.currencyCode,locale:d==="CAD"?"us":r||"us"})}),o?o({comparePrice:C}):_&&(s>0||b?.member>0&&x)&&(0,a.jsx)(l.Text,{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:(0,i.formatPrice)({amount:C,currencyCode:n.price.currencyCode,locale:d==="CAD"?"us":r||"us"})}),b?.member>0&&x&&(0,a.jsx)(l.Text,{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"})]}),t||(s>0||b?.member>0&&x?(0,a.jsx)(l.Text,{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:`${j}`}):v?(0,a.jsx)(l.Text,{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:v}):null)]}):(0,a.jsx)(l.Text,{className:"text-[20px] font-bold text-[#999999]",html:e?.soldOut??"Sold Out"}),(0,a.jsx)("div",{className:"tablet:mt-0 mt-2 flex items-center gap-2",children:(0,a.jsx)(A.default,{mode:L,availableForSale:n.availableForSale,addToCartText:e?.addToCart??"Add to Cart",buyNowText:e?.buyNow??"Buy Now",addToCartLoading:F,buyNowLoading:R,onAddToCart:D,onBuyNow:B,onNotifyMeClick:E,notifyMeText:e?.notifyMe,notifyMeClassName:"w-full"})})]})};var K=J;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var W=Object.create;var R=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Z=(n,l)=>{for(var p in l)R(n,p,{get:l[p],enumerable:!0})},L=(n,l,p,g)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of K(l))!X.call(n,d)&&d!==p&&R(n,d,{get:()=>l[d],enumerable:!(g=J(l,d))||g.enumerable});return n};var ee=(n,l,p)=>(p=n!=null?W(Q(n)):{},L(l||!n||!n.__esModule?R(p,"default",{value:n,enumerable:!0}):p,n)),te=n=>L(R({},"__esModule",{value:!0}),n);var re={};Z(re,{default:()=>ne});module.exports=te(re);var t=require("react/jsx-runtime"),s=require("react"),C=require("../../helpers/utils.js"),z=require("../../shared/Styles.js"),f=require("../../components/index.js"),j=require("../../hooks/useExposure.js"),Y=require("../../hooks/useTracking.js"),F=require("../../shared/trackUrlRef.js"),y=require("../../shared/track.js"),M=ee(require("@radix-ui/react-popover"));const S="navigation",$="product_nav",A=n=>n.anchorId??n.id??"",oe=n=>(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:(0,t.jsx)("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})}),B=(0,s.forwardRef)(({className:n="",data:l,id:p,onAnchorClick:g,scrollOffsetExtra:d=0},G)=>{const{tabLinks:v=[],anchorList:a=[],textLink:c,buyBtn:u,theme:O="light"}=l||{},{buildRef:V}=(0,Y.useTracking)(),x=(e,o,r=1)=>({href:(0,F.trackUrlRef)(e,V(S,$)),"data-headless-type-name":`${S}#${$}`,"data-headless-title-desc-button":`##${(0,y.toPlainTrackingText)(o)}`,"data-headless-nav-position":`${(0,y.toPlainTrackingText)(o)}#${r}`}),[_,T]=(0,s.useState)(""),w=(0,s.useRef)(null),N=(0,s.useRef)(!1),
|
|
1
|
+
"use strict";"use client";var W=Object.create;var R=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Z=(n,l)=>{for(var p in l)R(n,p,{get:l[p],enumerable:!0})},L=(n,l,p,g)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of K(l))!X.call(n,d)&&d!==p&&R(n,d,{get:()=>l[d],enumerable:!(g=J(l,d))||g.enumerable});return n};var ee=(n,l,p)=>(p=n!=null?W(Q(n)):{},L(l||!n||!n.__esModule?R(p,"default",{value:n,enumerable:!0}):p,n)),te=n=>L(R({},"__esModule",{value:!0}),n);var re={};Z(re,{default:()=>ne});module.exports=te(re);var t=require("react/jsx-runtime"),s=require("react"),C=require("../../helpers/utils.js"),z=require("../../shared/Styles.js"),f=require("../../components/index.js"),j=require("../../hooks/useExposure.js"),Y=require("../../hooks/useTracking.js"),F=require("../../shared/trackUrlRef.js"),y=require("../../shared/track.js"),M=ee(require("@radix-ui/react-popover"));const S="navigation",$="product_nav",A=n=>n.anchorId??n.id??"",oe=n=>(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:(0,t.jsx)("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})}),B=(0,s.forwardRef)(({className:n="",data:l,id:p,onAnchorClick:g,scrollOffsetExtra:d=0},G)=>{const{tabLinks:v=[],anchorList:a=[],textLink:c,buyBtn:u,theme:O="light"}=l||{},{buildRef:V}=(0,Y.useTracking)(),x=(e,o,r=1)=>({href:(0,F.trackUrlRef)(e,V(S,$)),"data-headless-type-name":`${S}#${$}`,"data-headless-title-desc-button":`##${(0,y.toPlainTrackingText)(o)}`,"data-headless-nav-position":`${(0,y.toPlainTrackingText)(o)}#${r}`}),[_,T]=(0,s.useState)(""),w=(0,s.useRef)(null),N=(0,s.useRef)(!1),b=(0,s.useRef)(""),k=(0,s.useRef)(null),D=(0,s.useRef)(new Map);(0,s.useImperativeHandle)(G,()=>w.current),(0,j.useExposure)(w,{componentType:S,componentName:$,componentTitle:[...v.map(e=>e.label),...a.map(e=>e.label)].join(" | "),componentDescription:u?.text??c?.text??""});const E=(0,s.useCallback)(()=>{if(a.length===0)return;const e=window.scrollY;window.scrollTo({top:0,behavior:"instant"}),requestAnimationFrame(()=>{const o=new Map;a.forEach(r=>{const i=A(r),m=document.getElementById(i);if(m){const P=m.getBoundingClientRect();o.set(i,P.top+window.scrollY)}}),D.current=o,window.scrollTo({top:e,behavior:"instant"})})},[a]);(0,s.useEffect)(()=>{if(a.length===0)return;const e=setTimeout(E,100);return()=>clearTimeout(e)},[a,E]),(0,s.useEffect)(()=>{if(a.length===0)return;let e=null;const o=new ResizeObserver(()=>{e&&clearTimeout(e),e=setTimeout(E,150)});return o.observe(document.body),()=>{o.disconnect(),e&&clearTimeout(e)}},[a,E]),(0,s.useEffect)(()=>{if(a.length===0)return;const e=()=>{if(N.current){k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{N.current=!1,b.current&&(T(b.current),b.current="")},100);return}const r=w.current?.offsetHeight||0,i=window.scrollY+r+d+10;let m="";const P=D.current;for(let h=a.length-1;h>=0;h--){const U=a[h],H=A(U),I=P.get(H);if(I!==void 0&&i>=I){m=H;break}}if(!m&&a.length>0){const h=P.get(A(a[0]));h!==void 0&&i<h&&(m="")}T(m)},o=setTimeout(()=>{e()},200);return window.addEventListener("scroll",e,{passive:!0}),()=>{clearTimeout(o),window.removeEventListener("scroll",e),k.current&&clearTimeout(k.current)}},[a,d]),(0,s.useEffect)(()=>{const e=document.querySelectorAll(".header"),o=[];return e.forEach(r=>{const i=r;o.push({element:i,originalPosition:i.style.position||getComputedStyle(i).position}),i.style.position="relative"}),()=>{o.forEach(({element:r,originalPosition:i})=>{r.style.position=i==="static"?"":i})}},[]);const q=(e,o)=>{e.preventDefault();const r=D.current.get(o);if(r===void 0){console.warn(`Cached position for "${o}" not found`);return}T(o),b.current=o,N.current=!0;const i=w.current?.offsetHeight||0,m=r-i-d;window.scrollTo({top:m,behavior:"smooth"}),window.history.pushState(null,"",`#${o}`)};return(0,t.jsxs)("div",{id:p,ref:w,className:(0,C.cn)("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":O==="dark"},n),children:[(0,t.jsxs)("div",{className:"product-nav-main desktop:flex-row desktop:gap-[48px] flex w-full flex-col justify-start",children:[(0,t.jsxs)("div",{className:"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] pt-[14px]",children:[(0,t.jsxs)("div",{className:"product-nav-tabs flex flex-row items-center gap-[8px]",children:[v.map((e,o)=>(0,t.jsxs)("div",{className:"product-nav-tab-item flex items-center gap-[8px]",children:[(0,t.jsx)("a",{...x(e.link,e.label,v.indexOf(e)+1),className:(0,C.cn)("product-nav-tab-link hover:text-brand-color text-nowrap text-[14px] font-bold tracking-[-0.04em]",{"text-[#6D6D6F]":o!==0,"hidden desktop:block":o===1}),children:(0,t.jsx)("span",{children:e.label})}),o!==v.length-1&&(0,t.jsx)("div",{className:"product-nav-tab-divider desktop:inline-block hidden h-[14px] w-px bg-[#E4E5E6]"})]},e.link||o)),v.length>1&&(0,t.jsxs)(M.Root,{children:[(0,t.jsx)(M.Trigger,{asChild:!0,children:(0,t.jsx)("button",{className:"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block","aria-label":"More products",children:(0,t.jsx)(oe,{className:"text-[#1D1D1F]"})})}),(0,t.jsx)(M.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:v.slice(1).map(e=>(0,t.jsx)("a",{...x(e.link,e.label,v.indexOf(e)+1),className:"product-nav-dropdown-link hover:text-brand-color text-nowrap",children:(0,t.jsx)("span",{children:e.label})},e.link))})]})]}),(0,t.jsxs)("div",{className:"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]",children:[c?.link&&(0,t.jsx)("a",{...x(c.link,c.text),target:c.target||"_self",className:"product-nav-text-link hover:text-brand-color cursor-pointer",children:(0,t.jsx)(f.Text,{size:2,className:"text-nowrap",children:c.text})}),u?.link&&(0,t.jsx)(f.Button,{as:"a",...x(u.link,u.text),size:"sm",className:"product-nav-buy-button text-nowrap",children:u.text})]})]}),(0,t.jsx)("div",{className:"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[12px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:a.map((e,o)=>{const r=A(e);return(0,t.jsxs)("a",{href:`#${r}`,className:"product-nav-anchor-link","data-headless-type-name":`${S}#${$}`,"data-headless-title-desc-button":`##${(0,y.toPlainTrackingText)(e.label)}`,"data-headless-nav-position":`${(0,y.toPlainTrackingText)(e.label)}#${o+1}`,onClick:i=>{g?(i.preventDefault(),T(r),b.current=r,N.current=!0,g(e,o)):q(i,r)},children:[(0,t.jsx)(f.Text,{size:2,className:"product-nav-anchor-text text-nowrap",children:e.label}),(0,t.jsx)("div",{className:(0,C.cn)("product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent",{"!bg-brand-0":_===r})})]},r)})})]}),(0,t.jsxs)("div",{className:"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]",children:[c?.link&&(0,t.jsx)(f.Link,{...x(c.link,c.text),target:c.target||"_self",className:"product-nav-text-link no-underline",children:(0,t.jsx)(f.Text,{size:2,className:"text-nowrap",children:c.text})}),u?.link&&(0,t.jsx)(f.Button,{as:"a",...x(u.link,u.text),size:"sm",className:"product-nav-buy-button text-nowrap",children:u.text})]})]})});B.displayName="ProductNav";var ne=(0,z.withLayout)(B);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var B=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var F=(t,l)=>{for(var i in l)B(t,i,{get:l[i],enumerable:!0})},U=(t,l,i,d)=>{if(l&&typeof l=="object"||typeof l=="function")for(let p of K(l))!W.call(t,p)&&p!==i&&B(t,p,{get:()=>l[p],enumerable:!(d=G(l,p))||d.enumerable});return t};var H=t=>U(B({},"__esModule",{value:!0}),t);var Y={};F(Y,{default:()=>X});module.exports=H(Y);var e=require("react/jsx-runtime"),a=require("../../components/index.js"),j=require("../HeaderNavigation/icons/index.js"),c=require("react"),n=require("../../helpers/utils.js"),S=require("../AiuiProvider/index.js"),R=require("../ShelfDisplay/shelfDisplay.js"),b=require("./types.js"),T=require("../../helpers/utils.js");const O=({product:t,onSecondaryButton:l,onPrimaryButton:i,searchValue:d,variantData:p,shopNowLoadingProductId:k,badgeVariant:x})=>{const o=(0,c.useMemo)(()=>p||t?.variants?.[0],[t,p]),{locale:v="us",copyWriting:u,currencyCode:f}=(0,S.useAiuiContext)(),h=k===t?.id,w=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/products/${t?.handle}`,v,`variant=${(0,n.atobID)(o?.id)}&ref=search_result_${d?.toLowerCase()}`),[t?.handle,o?.id,d,v]),_=o?.coupons?.[0],{price:N,basePrice:r}=(0,R.formatVariantPrice)({locale:f==="CAD"?"us":v||"us",amount:_?_.variant_price4wscode:o?.price?.amount??o?.price,baseAmount:_?o?.price?.amount??o?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),C=(0,c.useMemo)(()=>t?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return(0,e.jsx)("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?(0,e.jsxs)(a.Link,{href:(0,T.getLocalizedPath)(t?.advertisingLink,v),className:"h-full",children:[(0,e.jsx)(a.Picture,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),(0,e.jsxs)("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(a.Text,{html:t?.advertisingTitle,className:(0,n.cn)("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&(0,e.jsx)(a.Heading,{size:3,html:t?.advertisingSubtitle,className:(0,n.cn)("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):(0,e.jsxs)("a",{href:w,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[(0,e.jsx)("div",{className:"ipc_search_product_item_image",children:(0,e.jsx)(a.Picture,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:o?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),(0,e.jsxs)("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:C?.map((m,L)=>(0,e.jsx)(a.Badge,{size:"lg",variant:x,children:m},L))}),(0,e.jsx)(a.Text,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:(0,n.highlightSearchWord)(t?.title||"",d||"")}),(0,e.jsx)(a.Text,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:(0,n.highlightSearchWord)(t?.description,d||"")})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"mb-2 flex items-center",children:o?.availableForSale?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:o?.availableForSale&&N||""}),(0,e.jsx)("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:o?.availableForSale&&r||""})]}):(0,e.jsx)("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:u?.soldOutText||"Sold Out"})}),(0,e.jsxs)("div",{className:(0,n.cn)("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[u?.learnMoreText&&(0,e.jsx)(a.Button,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:m=>{m.preventDefault(),m.stopPropagation(),l?.()},children:u?.learnMoreText}),u?.shopNowText&&(0,e.jsx)(a.Button,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!o?.availableForSale,loading:h,onClick:m=>{m.preventDefault(),m.stopPropagation(),i?.()},children:u?.shopNowText})]})]})]})]})})},q=({blog:t,searchValue:l})=>{const{copyWriting:i,locale:d="us"}=(0,S.useAiuiContext)(),p=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,d),[t,d]);return(0,e.jsx)("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:(0,e.jsxs)("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[(0,e.jsx)("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),(0,e.jsxs)("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,n.highlightSearchWord)(t?.title,l)}),(0,e.jsx)(a.Text,{html:(0,n.highlightSearchWord)(t?.content,l),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"desktop:mt-6 mt-4",children:(0,e.jsx)(a.Button,{as:"a",href:p,variant:"secondary",size:"lg",children:i?.learnMoreText||"Learn More"})})]})]})})},J=({searchValue:t,page:l})=>{const{copyWriting:i,locale:d="us"}=(0,S.useAiuiContext)(),p=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/${l?.handle}`,d),[l,d]);return(0,e.jsxs)("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,n.highlightSearchWord)(l?.name,t)}),(0,e.jsx)(a.Text,{as:"p",html:(0,n.highlightSearchWord)(l?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),(0,e.jsx)(a.Button,{as:"a",href:p,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:i?.learnMoreText||"Learn More"})]})},I=({url:t,label:l})=>(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),(0,e.jsx)(a.Text,{html:l,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),D=({products:t,title:l,buildProps:i,onSecondaryButton:d,onPrimaryButton:p,badgeVariant:k})=>{const{products:x}=i||{};return console.log(x,"buildProducts"),(0,e.jsxs)("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:l}),(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((o,v)=>{const u=x?.find(h=>h.handle===o.handle);if(!u)return null;const f=u?.variants?.find(h=>h.sku===o.sku);return(0,e.jsx)(O,{product:u,variantData:f,badgeVariant:k,onSecondaryButton:()=>d?.(),onPrimaryButton:()=>p?.()},o.sku+v)})})]})},Q=({searchResult:t,searchValue:l,data:i,onSecondaryButton:d,onPrimaryButton:p,onChangeSort:k,loading:x,shopNowLoadingProductId:o,searchResultCount:v,onChangeTab:u,buildProps:f,componentOverrides:h,className:w,..._})=>{const N=h?.badge?.variant,[r,C]=(0,c.useState)(i?.tabs?.[0]),[m,L]=(0,c.useState)(!1),[z,E]=(0,c.useState)({[b.SearchPageTabType.PRODUCTS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PRODUCTS)?.sortKeys?.[0],[b.SearchPageTabType.BLOGS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.BLOGS)?.sortKeys?.[0],[b.SearchPageTabType.PAGES]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PAGES)?.sortKeys?.[0]}),P=(0,c.useMemo)(()=>t?.products||[],[t]),A=(0,c.useMemo)(()=>t?.blogs||[],[t]),M=(0,c.useMemo)(()=>t?.pages||[],[t]),$=(0,c.useMemo)(()=>Object.values(v||{}).reduce((s,g)=>s+g,0),[v]),V=(0,c.useMemo)(()=>{const s={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const y=[...P||[]];return y.length>=8?y.splice(7,0,s):y.length>0&&y.push(s),y}else return P},[r,P]);return(0,e.jsxs)("div",{..._,className:(0,n.cn)("ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",w),children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:(0,n.replaceTemplate)(i?.title,{totalCount:$?.toString(),inputValue:`"${l}"`})}),(0,e.jsx)("div",{className:"mt-6",children:(0,e.jsxs)(a.Tabs,{className:"ipc_search_page_tabs",defaultValue:"products",children:[(0,e.jsxs)("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[(0,e.jsx)(a.TabsList,{children:i?.tabs?.map(s=>(0,e.jsxs)(a.TabsTrigger,{onClick:()=>{C(s);const g=s?.sortKeys?.[0];g&&(E(y=>({...y,[s?.tabType]:g})),k?.(s?.tabType,g)),u?.(s?.tabType)},defaultValue:"products",value:s.tabType,children:[s.label," (",v?.[s.tabType],")"]},s.id))}),(0,e.jsxs)(a.DropdownMenu,{onOpenChange:L,children:[(0,e.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,e.jsxs)("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",z?.[r?.tabType]?.label," ",(0,e.jsx)(j.DownArrow,{className:(0,n.cn)("inline-block size-4",{"rotate-180":m})})]})}),(0,e.jsx)(a.DropdownMenuContent,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(s=>(0,e.jsx)(a.DropdownMenuItem,{className:(0,n.cn)("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":z?.[r?.tabType]?.value===s.value}),onClick:()=>{k?.(r?.tabType,s),E(g=>({...g,[r?.tabType]:s}))},children:s.label},s.id))})]})]}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:V?.map((s,g)=>(0,e.jsx)(O,{searchValue:l,product:s,shopNowLoadingProductId:o,badgeVariant:N,onSecondaryButton:()=>d?.(s),onPrimaryButton:()=>p?.(s)},(s.id||"")+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex w-full justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!P?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]}),(0,e.jsx)(a.TabsContent,{value:b.SearchPageTabType.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:(0,e.jsxs)("div",{children:[A?.map(s=>(0,e.jsx)(q,{blog:s,searchValue:l},s.id)),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!A?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,badgeVariant:N})]})]})}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PAGES,className:"ipc_search_page_tabs_pages_content",children:[(0,e.jsx)("div",{children:M?.map((s,g)=>(0,e.jsx)(J,{page:s,searchValue:l},(s.global_id||s.id)+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!M?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]})]})})]})};var X=Q;
|
|
1
|
+
"use strict";var B=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var F=(t,l)=>{for(var i in l)B(t,i,{get:l[i],enumerable:!0})},U=(t,l,i,d)=>{if(l&&typeof l=="object"||typeof l=="function")for(let c of K(l))!W.call(t,c)&&c!==i&&B(t,c,{get:()=>l[c],enumerable:!(d=G(l,c))||d.enumerable});return t};var H=t=>U(B({},"__esModule",{value:!0}),t);var Y={};F(Y,{default:()=>X});module.exports=H(Y);var e=require("react/jsx-runtime"),a=require("../../components/index.js"),j=require("../HeaderNavigation/icons/index.js"),p=require("react"),n=require("../../helpers/utils.js"),S=require("../AiuiProvider/index.js"),R=require("../ShelfDisplay/shelfDisplay.js"),b=require("./types.js"),T=require("../../helpers/utils.js");const O=({product:t,onSecondaryButton:l,onPrimaryButton:i,searchValue:d,variantData:c,shopNowLoadingProductId:k,badgeVariant:x})=>{const o=(0,p.useMemo)(()=>c||t?.variants?.[0],[t,c]),{locale:v="us",copyWriting:u,currencyCode:f}=(0,S.useAiuiContext)(),h=k===t?.id,w=(0,p.useMemo)(()=>(0,T.getLocalizedPath)(`/products/${t?.handle}`,v,`variant=${(0,n.atobID)(o?.id)}&ref=search_result_${d?.toLowerCase()}`),[t?.handle,o?.id,d,v]),_=o?.coupons?.[0],{price:N,basePrice:r}=(0,R.formatVariantPrice)({locale:f==="CAD"?"us":v||"us",amount:_?_.variant_price4wscode:o?.price?.amount??o?.price,baseAmount:_?o?.price?.amount??o?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),C=(0,p.useMemo)(()=>t?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return(0,e.jsx)("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?(0,e.jsxs)(a.Link,{href:(0,T.getLocalizedPath)(t?.advertisingLink,v),className:"h-full",children:[(0,e.jsx)(a.Picture,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),(0,e.jsxs)("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(a.Text,{html:t?.advertisingTitle,className:(0,n.cn)("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&(0,e.jsx)(a.Heading,{size:3,html:t?.advertisingSubtitle,className:(0,n.cn)("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):(0,e.jsxs)("a",{href:w,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[(0,e.jsx)("div",{className:"ipc_search_product_item_image",children:(0,e.jsx)(a.Picture,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:o?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),(0,e.jsxs)("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:C?.map((m,L)=>(0,e.jsx)(a.Badge,{size:"lg",variant:x,children:m},L))}),(0,e.jsx)(a.Text,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:(0,n.highlightSearchWord)(t?.title||"",d||"")}),(0,e.jsx)(a.Text,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:(0,n.highlightSearchWord)(t?.description,d||"")})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"mb-2 flex items-center",children:o?.availableForSale?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:o?.availableForSale&&N||""}),(0,e.jsx)("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:o?.availableForSale&&r||""})]}):(0,e.jsx)("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:u?.soldOutText||"Sold Out"})}),(0,e.jsxs)("div",{className:(0,n.cn)("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[u?.learnMoreText&&(0,e.jsx)(a.Button,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:m=>{m.preventDefault(),m.stopPropagation(),l?.()},children:u?.learnMoreText}),u?.shopNowText&&(0,e.jsx)(a.Button,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!o?.availableForSale,loading:h,onClick:m=>{m.preventDefault(),m.stopPropagation(),i?.()},children:u?.shopNowText})]})]})]})]})})},q=({blog:t,searchValue:l})=>{const{copyWriting:i,locale:d="us"}=(0,S.useAiuiContext)(),c=(0,p.useMemo)(()=>(0,T.getLocalizedPath)(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,d),[t,d]);return(0,e.jsx)("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:(0,e.jsxs)("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[(0,e.jsx)("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),(0,e.jsxs)("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,n.highlightSearchWord)(t?.title,l)}),(0,e.jsx)(a.Text,{html:(0,n.highlightSearchWord)(t?.content,l),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"desktop:mt-6 mt-4",children:(0,e.jsx)(a.Button,{as:"a",href:c,variant:"secondary",size:"lg",children:i?.learnMoreText||"Learn More"})})]})]})})},J=({searchValue:t,page:l})=>{const{copyWriting:i,locale:d="us"}=(0,S.useAiuiContext)(),c=(0,p.useMemo)(()=>(0,T.getLocalizedPath)(`/${l?.handle}`,d),[l,d]);return(0,e.jsxs)("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,n.highlightSearchWord)(l?.name,t)}),(0,e.jsx)(a.Text,{as:"p",html:(0,n.highlightSearchWord)(l?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),(0,e.jsx)(a.Button,{as:"a",href:c,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:i?.learnMoreText||"Learn More"})]})},I=({url:t,label:l})=>(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),(0,e.jsx)(a.Text,{html:l,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),D=({products:t,title:l,buildProps:i,onSecondaryButton:d,onPrimaryButton:c,badgeVariant:k})=>{const{products:x}=i||{};return console.log(x,"buildProducts"),(0,e.jsxs)("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:l}),(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((o,v)=>{const u=x?.find(h=>h.handle===o.handle);if(!u)return null;const f=u?.variants?.find(h=>h.sku===o.sku);return(0,e.jsx)(O,{product:u,variantData:f,badgeVariant:k,onSecondaryButton:()=>d?.(),onPrimaryButton:()=>c?.()},o.sku+v)})})]})},Q=({searchResult:t,searchValue:l,data:i,onSecondaryButton:d,onPrimaryButton:c,onChangeSort:k,loading:x,shopNowLoadingProductId:o,searchResultCount:v,onChangeTab:u,buildProps:f,componentOverrides:h,className:w,..._})=>{const N=h?.badge?.variant,[r,C]=(0,p.useState)(i?.tabs?.[0]),[m,L]=(0,p.useState)(!1),[z,E]=(0,p.useState)({[b.SearchPageTabType.PRODUCTS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PRODUCTS)?.sortKeys?.[0],[b.SearchPageTabType.BLOGS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.BLOGS)?.sortKeys?.[0],[b.SearchPageTabType.PAGES]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PAGES)?.sortKeys?.[0]}),P=(0,p.useMemo)(()=>t?.products||[],[t]),A=(0,p.useMemo)(()=>t?.blogs||[],[t]),M=(0,p.useMemo)(()=>t?.pages||[],[t]),$=(0,p.useMemo)(()=>Object.values(v||{}).reduce((s,g)=>s+g,0),[v]),V=(0,p.useMemo)(()=>{const s={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const y=[...P||[]];return y.length>=8?y.splice(7,0,s):y.length>0&&y.push(s),y}else return P},[r,P]);return(0,e.jsxs)("div",{..._,className:(0,n.cn)("ipc_search_page desktop:py-[128px] px-grid py-16",w),children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:(0,n.replaceTemplate)(i?.title,{totalCount:$?.toString(),inputValue:`"${l}"`})}),(0,e.jsx)("div",{className:"mt-6",children:(0,e.jsxs)(a.Tabs,{className:"ipc_search_page_tabs",defaultValue:"products",children:[(0,e.jsxs)("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[(0,e.jsx)(a.TabsList,{children:i?.tabs?.map(s=>(0,e.jsxs)(a.TabsTrigger,{onClick:()=>{C(s);const g=s?.sortKeys?.[0];g&&(E(y=>({...y,[s?.tabType]:g})),k?.(s?.tabType,g)),u?.(s?.tabType)},defaultValue:"products",value:s.tabType,children:[s.label," (",v?.[s.tabType],")"]},s.id))}),(0,e.jsxs)(a.DropdownMenu,{onOpenChange:L,children:[(0,e.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,e.jsxs)("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",z?.[r?.tabType]?.label," ",(0,e.jsx)(j.DownArrow,{className:(0,n.cn)("inline-block size-4",{"rotate-180":m})})]})}),(0,e.jsx)(a.DropdownMenuContent,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(s=>(0,e.jsx)(a.DropdownMenuItem,{className:(0,n.cn)("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":z?.[r?.tabType]?.value===s.value}),onClick:()=>{k?.(r?.tabType,s),E(g=>({...g,[r?.tabType]:s}))},children:s.label},s.id))})]})]}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:V?.map((s,g)=>(0,e.jsx)(O,{searchValue:l,product:s,shopNowLoadingProductId:o,badgeVariant:N,onSecondaryButton:()=>d?.(s),onPrimaryButton:()=>c?.(s)},(s.id||"")+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex w-full justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!P?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]}),(0,e.jsx)(a.TabsContent,{value:b.SearchPageTabType.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:(0,e.jsxs)("div",{children:[A?.map(s=>(0,e.jsx)(q,{blog:s,searchValue:l},s.id)),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!A?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,badgeVariant:N})]})]})}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PAGES,className:"ipc_search_page_tabs_pages_content",children:[(0,e.jsx)("div",{children:M?.map((s,g)=>(0,e.jsx)(J,{page:s,searchValue:l},(s.global_id||s.id)+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!M?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]})]})})]})};var X=Q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var he=Object.create;var
|
|
1
|
+
"use strict";"use client";var he=Object.create;var x=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var Be=Object.getPrototypeOf,Ie=Object.prototype.hasOwnProperty;var Me=(i,t)=>{for(var e in t)x(i,e,{get:t[e],enumerable:!0})},j=(i,t,e,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of ve(t))!Ie.call(i,c)&&c!==e&&x(i,c,{get:()=>t[c],enumerable:!(d=Te(t,c))||d.enumerable});return i};var h=(i,t,e)=>(e=i!=null?he(Be(i)):{},j(t||!i||!i.__esModule?x(e,"default",{value:i,enumerable:!0}):e,i)),Se=i=>j(x({},"__esModule",{value:!0}),i);var Le={};Me(Le,{default:()=>Ce,secondaryBannerVariants:()=>U});module.exports=Se(Le);var n=require("react/jsx-runtime"),u=h(require("react")),J=require("class-variance-authority"),C=require("react-responsive"),L=h(require("jump.js")),o=require("../../helpers/index.js"),a=require("../../components/index.js"),q=require("../../shared/Styles.js"),F=h(require("../Media/index.js")),W=require("../AiuiProvider/index.js"),G=require("../../hooks/useExposure.js"),g=require("../../shared/trackUrlRef.js"),b=require("../../shared/track.js"),Q=h(require("./SecondaryBannerCarousel.js"));const T="secondary_banner",U=(0,J.cva)("text-info-primary relative w-full",{variants:{size:{sm:"tablet:aspect-[768/480] laptop:aspect-[1024/480] desktop:aspect-[1440/480] lg-desktop:aspect-[1920/480] aspect-[390/480]",base:"tablet:aspect-[768/660] laptop:aspect-[1024/432] desktop:aspect-[1440/576] lg-desktop:aspect-[1920/720] aspect-[390/660]",lg:"tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660]",xlg:"tablet:aspect-[768/1320] laptop:aspect-[1024/864] desktop:aspect-[1440/1152] lg-desktop:aspect-[1920/1440] aspect-[390/1440] overflow-visible"}},defaultVariants:{size:"base"}}),$=u.forwardRef(({className:i,classNames:t={},data:e,jumpOptions:d={},isActive:c,a11yLabels:K,trackExposure:X=!0,frameIndex:v,...z},m)=>{const{pcImage:Y,padImage:Z,mobileImage:ee,isVideoLoop:te,endDate:N,endDate_tz:ne,dateFormat:ie,size:oe,iconArray:B,theme:ae,primaryButton:s,secondaryButton:r,title:y,titleTag:se}=e,re=te??!0,I=oe??"base",le=ae??"light",pe=se??"h2",{locale:R="us",pageHandle:ce}=(0,W.useAiuiContext)(),me=(0,C.useMediaQuery)({query:"(max-width: 767px)"}),de=(0,C.useMediaQuery)({query:"(min-width: 768px) and (max-width: 1024px)"}),D=me?e.mobileImage:de?e.padImage??e.pcImage:e.pcImage,f=(0,b.resolveComponentMediaType)(D?.mimeType==="video/mp4"),A=v??1,H=`${(0,g.buildTrackingRef)(ce??"",f,T)}${v===void 0?"":`_${v}`}`,M=D?.id||e.pcImage?.id||"",E=u.useRef(null),ue=u.useCallback(l=>{E.current=l,typeof m=="function"?m(l):m&&(m.current=l)},[m]),ge=u.useRef(null);(0,G.useExposure)(X?E:ge,{componentType:f,componentName:T,componentTitle:y?.trim()||"",componentDescription:e.subtitle?.trim()||"",position:1,creativeId:M});const be=!!(r?.link||typeof r?.onClick=="function"),ye=!!(s?.link||typeof s?.onClick=="function"),w=r?.link&&!r.link.startsWith("#")?(0,g.trackUrlRef)((0,o.getLocalizedPath)(r.link,R),H):void 0,O=s?.link&&!s.link.startsWith("#")?(0,g.trackUrlRef)((0,o.getLocalizedPath)(s.link,R),H):void 0,fe=(0,b.buildClickTrackingProps)({interactive:be,componentType:f,componentName:T,title:y,description:e.subtitle,buttonName:r?.text,position:A,creativeId:M}),ke=(0,b.buildClickTrackingProps)({interactive:ye,componentType:f,componentName:T,title:y,description:e.subtitle,buttonName:s?.text,position:A,creativeId:M}),P={...{duration:500,offset:0},...d},S=u.useId(),k=y?`${S}-title`:void 0,V=e.subtitle?`${S}-subtitle`:void 0,_=e.superTitle?`${S}-super-title`:void 0,xe=[_,V].filter(Boolean).join(" ")||void 0;return e.items&&e.items.length>0?(0,n.jsx)(Q.default,{data:e,className:i,classNames:t,jumpOptions:d,a11yLabels:K,ref:m,...z}):(0,n.jsxs)("section",{ref:ue,role:"banner","aria-labelledby":k,"aria-describedby":xe,className:(0,o.cn)({"aiui-dark":le==="dark"},U({size:I}),i,t?.root),...z,children:[(0,n.jsx)("div",{className:(0,o.cn)("absolute inset-0",{"h-fit":I==="xlg"}),children:(0,n.jsx)(F.default,{pcImage:Y,padImage:Z,mobileImage:ee,className:"size-full",imgClassName:"object-cover",videoClassName:"object-cover",muted:!0,loop:re,playsInline:!0,autoPlay:c??!0})}),(0,n.jsxs)("div",{className:(0,o.cn)("banner-content laptop:top-[min(50%,50vh)] laptop:-translate-y-1/2 px-grid absolute top-12 z-10 flex flex-col items-start justify-center text-left",t?.content),children:[(0,n.jsxs)("div",{className:"banner-inner-title desktop:gap-2 flex flex-col items-start gap-1",children:[e.superTitle&&(0,n.jsx)(a.Text,{as:"p",size:2,id:_,className:(0,o.cn)("banner-super-title desktop:text-[16px] lg-desktop:text-[18px]",t?.superTitle),html:e.superTitle}),e.title&&(0,n.jsx)(a.Heading,{as:pe,size:["xlg","lg"].includes(I)?5:4,id:k,className:(0,o.cn)("banner-title ",t?.title),html:e.title}),e.subtitle&&(0,n.jsx)(a.Text,{as:"p",size:3,id:V,className:(0,o.cn)("banner-subtitle desktop:text-[16px] lg-desktop:text-[18px]",t?.subtitle),html:e.subtitle})]}),N&&(0,n.jsx)("div",{className:"banner-countdown",children:(0,n.jsx)(a.Countdown,{endDate:N,endDate_tz:ne,dateFormat:ie,variant:"spacious",className:"lg-desktop:mt-8 mt-6"})}),(0,n.jsxs)("div",{className:(0,o.cn)("banner-cta-group lg-desktop:mt-[32px] lg-desktop:gap-3 mt-6 flex gap-2",t?.buttonGroup),children:[r?.text&&(0,n.jsx)(a.Button,{variant:"secondary",onClick:l=>{if(r.link?.startsWith("#")){l.preventDefault();const p=document.querySelector(r.link);p&&(0,L.default)(p,P)}r.onClick?.()},className:(0,o.cn)("",t?.secondaryButton),"aria-describedby":k,...w?{as:"a",href:w}:{},...fe,children:r.text}),s?.text&&(0,n.jsx)(a.Button,{onClick:l=>{if(s.link?.startsWith("#")){l.preventDefault();const p=document.querySelector(s.link);p&&(0,L.default)(p,P)}s.onClick?.()},className:(0,o.cn)("",t?.primaryButton),"aria-describedby":k,...O?{as:"a",href:O}:{},...ke,children:s.text})]}),Array.isArray(B)&&B.length>0&&(0,n.jsx)("div",{className:"banner-icons desktop:mt-3 lg-desktop:mt-4 mt-2 flex items-center gap-2",role:"group","aria-label":"brand icons",children:B.map((l,p)=>l.pcImage?(0,n.jsx)(a.Picture,{source:l.pcImage.url,alt:l.pcImage.alt||`icon ${p+1}`,role:"img",className:"laptop:h-auto h-[48px] max-w-none",imgClassName:"h-full"},p):null)})]})]})});$.displayName="SecondaryBanner";var Ce=(0,q.withLayout)($);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var h=Object.create;var s=Object.defineProperty;var
|
|
1
|
+
"use strict";var h=Object.create;var s=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var T=(e,o)=>{for(var t in o)s(e,t,{get:o[t],enumerable:!0})},x=(e,o,t,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of k(o))!v.call(e,p)&&p!==t&&s(e,p,{get:()=>o[p],enumerable:!(a=S(o,p))||a.enumerable});return e};var B=(e,o,t)=>(t=e!=null?h(P(e)):{},x(o||!e||!e.__esModule?s(t,"default",{value:e,enumerable:!0}):t,e)),M=e=>x(s({},"__esModule",{value:!0}),e);var w={};T(w,{Container:()=>i});module.exports=M(w);var n=require("react/jsx-runtime"),r=B(require("react")),m=require("../helpers/utils.js"),y=require("@radix-ui/react-slot");const Y=({children:e})=>(0,n.jsx)(n.Fragment,{children:e}),C=r.default.forwardRef(({...e},o)=>{const{asChild:t,children:a,className:p,childClassName:c,spaceY:l="none",spaceTop:d="none",spaceBottom:f="none",...R}=e,g=t?y.Slot:"div",u={default:"tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]",none:""},N={default:"tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",none:""},b={default:"tablet:pb-[80px] laptop:pb-[96px] desktop:pb-[112px] lg-desktop:pb-[128px] pb-[64px]",none:""};return(0,n.jsx)(g,{...R,ref:o,className:(0,m.cn)(p,"ipc_container","relative z-10 w-full"),children:(0,n.jsx)("div",{className:(0,m.cn)("lg-desktop:max-w-full px-grid mx-auto size-full",c,u?.[l]||l,N?.[d]||d,b?.[f]||f),children:a})})});C.displayName="Section";const i=r.default.forwardRef(({...e},o)=>{const{children:t,mode:a="section"}=e,c={section:C,fragment:Y}[a];return(0,n.jsx)(c,{...e,ref:o,children:t})});i.displayName="Container";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var a=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},b=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of h(e))!$.call(t,i)&&i!==r&&g(t,i,{get:()=>e[i],enumerable:!(n=d(e,i))||n.enumerable});return t};var p=t=>b(g({},"__esModule",{value:!0}),t);var T={};a(T,{atobID:()=>W,cn:()=>w,getLocalizedPath:()=>z,highlightSearchWord:()=>j,noop:()=>R,replaceTemplate:()=>S,spaceToHyphen:()=>E});module.exports=p(T);var u=require("clsx"),l=require("tailwind-merge");const y=(0,l.extendTailwindMerge)({extend:{theme:{spacing:["grid"],borderRadius:["btn","box","box-small","card","tabs","sidebar-shelf","image-text"]},classGroups:{"font-size":["text-heading-1","text-heading-2","text-heading-3","text-heading-4","text-heading-5","text-text-3","text-text-2","text-text-1"],"text-color":["text-info-primary","text-info-secondary","text-info-tertiary","text-info-quaternary","text-info-white"],leading:["leading-tight","leading-normal","leading-loose"]}}});function w(...t){return y((0,u.clsx)(t))}function R(){}function W(t){return t&&typeof t=="string"&&t.includes("/")?t.split("/").pop()?.split("?")?.shift():t}const E=t=>t?.replace(/\s+/g,"-"),c=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),S=(t,e,r="{",n="}")=>{if(!t||!e||Object.keys(e).length===0)return t;const i=c(r),o=c(n),s=new RegExp(`${i}([a-zA-Z0-9_-]+)${o}`,"g");return t.replace(s,(f,x)=>e[x]!==void 0?e[x]:f)},j=(t,e)=>{try{if(!t||!e)return t;const r=c(e),n=new RegExp(r,"gi");return t.replace(n,i=>`<span class='text-brand-0 font-bold'>${i}</span>`)}catch(r){return console.error("highlightSearchWord error:",r),t}},z=(t,e,r)=>{if(!t)return t;if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("#"))return r?t.includes("?")?`${t}&${r}`:`${t}?${r}`:t;const n=t.split("/").filter(Boolean);if(n.length===0){const s=e==="us"?"/":`/${e}`;return r?`${s}?${r}`:s}if(n[0]===e){const s=`/${n.join("/")}`;return r?`${s}?${r}`:s}const o=`${e==="us"?"":`/${e}`}/${n.join("/")}`;return r?`${o}?${r}`:o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as rt,jsx as t,jsxs as u}from"react/jsx-runtime";import pe,{useImperativeHandle as Ee,useRef as k,useState as Me,useEffect as Pe}from"react";import N from"gsap";import{ScrollTrigger as C}from"gsap/dist/ScrollTrigger";import O from"jump.js";import{buildPictureSource as Re,resolveTierMedia as L,useMediaTier as De}from"./mediaResolver.js";import{useInView as je}from"react-intersection-observer";import Ae from"../../helpers/ScrollLoadVideo.js";import{Button as V,Heading as Oe,Picture as U,Text as G,Countdown as Ue}from"../../components/index.js";import{cn as p}from"../../helpers/index.js";import{cva as S}from"class-variance-authority";import{withLayout as Ge}from"../../shared/Styles.js";import{useExposure as Je}from"../../hooks/useExposure.js";import{buildTrackingRef as _e,trackUrlRef as z}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as h,resolveComponentMediaType as qe}from"../../shared/track.js";import{getLocalizedPath as Fe}from"../../helpers/utils.js";import{useAiuiContext as We}from"../AiuiProvider/index.js";import{sizeMap as Ye}from"../../components/button.js";import{VideoModal as Ze}from"../VideoModal/index.js";import Ke from"./HeroBannerCarousel.js";const f="hero_banner",Qe=S("hero-banner-content lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"tablet:px-[32px] laptop:top-1/2 laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] laptop:-translate-y-1/2 left-0 px-[16px]",center:"tablet:top-[84px] laptop:top-[76px] desktop:top-[176px] lg-desktop:top-[192px] left-1/2 top-[84px] -translate-x-1/2 translate-y-0 items-center text-center"}},defaultVariants:{align:"left"}}),Xe=S("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),$e=S("hero-banner-button-group lg-desktop:gap-x-3 pointer-events-auto flex flex-wrap items-center gap-x-2 gap-y-3",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),et=S("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),tt=({size:s="base"})=>{const{width:T,height:c}=Ye[s];return t("svg",{width:T,height:c,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:t("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"})})},ce=pe.forwardRef(({data:s,className:T,classNames:c={},onSecondaryClick:J,onPrimaryClick:_,onTertiaryClick:q,jumpOptions:ue={},a11yLabels:me,...F},W)=>{const{locale:Y,pageHandle:de}=We(),Z=s.mode!=="single"&&!!s.items&&s.items.length>0,I={...{duration:500,offset:0},...ue},w=e=>!e||!Y?e:Fe(e,Y),{label:K,title:l,subtitle:o,endDate:Q,endDate_tz:fe,dateFormat:ge,pcImage:E,isShowVideo:X,isVideoLoop:be=!0,primaryButton:a,secondaryButton:r,tertiaryButton:i,theme:ve="light",size:M="default",titleSize:P,caption:$=[],blockLink:B,iconArray:ee,align:b="left",enableParallax:te=!0}=s,R=Array.isArray($)?$:[],ye=Array.isArray(ee)?ee:void 0,re=De(),ne=Re(s),xe=L(s,re,"video")?.url||"",[oe,ae]=Me(!1),{ref:ke,inView:ie}=je(),D=k(null),j=k(null),A=k(null),v=k(null),d=k(null),m=qe(X),H=_e(de??"",m,f),g=L(s,re,m==="video"?"video":"image")?.id||E?.id||"",he=l?.trim()||o?.trim()||E?.alt?.trim()||void 0,Te=l!==void 0?l?.trim()||o?.trim()||E?.alt?.trim()||void 0:o&&o.trim()||"",we=o&&o.trim()||"";Je(d,{componentType:m,componentName:f,componentTitle:Te,componentDescription:we,creativeId:g,position:1});const Be=B?z(w(B),H):void 0,He=r?.link?z(w(r.link),H):void 0,Ne=a?.link?z(w(a.link),H):void 0,Ce=i?.link?z(w(i.link),H):void 0,Le=h({interactive:!!B,componentType:m,componentName:f,title:l,description:o,position:1,creativeId:g}),Ve=h({interactive:!0,componentType:m,componentName:f,title:l,description:o,buttonName:"video play",position:1,creativeId:g}),Se=h({interactive:!!(r?.link||r?.isCustomSecondaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:r?.text,position:1,creativeId:g}),ze=h({interactive:!!(a?.link||a?.isCustomPrimaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:a?.text,position:1,creativeId:g}),Ie=h({interactive:!!(i?.link||i?.isCustomTertiaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:i?.text,position:1,creativeId:g});return Ee(W,()=>d.current),Pe(()=>{if(Z||!te)return;N.registerPlugin(C);function e(){if(!v.current)return;const n=d.current?.clientHeight||100;window.innerHeight<=n?D.current=C.create({trigger:d.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*40-20;N.set(v.current,{yPercent:x})}}):(A.current=C.create({trigger:d.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:y=>{const x=y.progress*20-20;N.set(v.current,{yPercent:x})}}),j.current=C.create({trigger:d.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*20;N.set(v.current,{yPercent:x})}}))}return ie&&e(),()=>{D.current&&D.current.kill(),A.current&&A.current.kill(),j.current&&j.current.kill()}},[ie,s.items,te]),Z?t(Ke,{data:s,className:T,classNames:c,onPrimaryClick:_,onSecondaryClick:J,onTertiaryClick:q,a11yLabels:me,ref:W,...F}):t("div",{...F,ref:ke,"data-ui-component-id":"HeroBanner",className:p(c.root),children:u("div",{ref:d,className:p(ve==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":M==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":M==="sm"},T),children:[B&&t("a",{className:"absolute inset-0 z-10",href:Be,tabIndex:-1,"aria-hidden":"true","aria-label":he,...Le}),t("div",{ref:v,className:p("absolute left-0 top-0 size-full"),children:X?u(rt,{children:[t(Ae,{poster:void 0,src:xe,className:"laptop:w-full absolute inset-0 h-full transition-opacity duration-500",videoLayerClassName:"opacity-0",videoClassName:"h-full object-cover",muted:!0,loop:be,playsInline:!0,onPlaying:e=>{const n=e.currentTarget;n.parentElement?.classList.remove("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:e=>{const n=e.currentTarget;if(n.currentTime>=.5)return;n.parentElement?.classList.add("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),t("div",{"data-video-poster":"true",className:"laptop:w-full bg-container-primary pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:t(U,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})})]}):t(U,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})}),u("div",{className:Qe({align:b}),children:[u("div",{className:Xe({align:b}),children:[K&&t(G,{size:2,as:"p",className:p("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:K}),l&&t(Oe,{as:P==="4"?"h1":"h2",html:l,className:p("hero-banner-title",c.title),size:P?Number(P||"5"):M==="sm"?4:5}),o&&t(G,{as:"p",size:2,className:p("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",c.subtitle),html:o}),Q&&t("div",{className:"mt-3",children:t(Ue,{endDate:Q,endDate_tz:fe,dateFormat:ge,variant:"spacious",align:b})})]}),u("div",{className:p($e({align:b}),c.buttonGroup),children:[u("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[r?.isShowPlayVideoButton&&r?.playVideoButtonText?u(V,{onClick:()=>ae(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...Ve,children:[r?.playVideoButtonText," ",t(tt,{size:"lg"})]}):r?.text?u(V,{"aria-label":l??o,size:"lg",variant:"secondary",className:p("hero-banner-secondary-button",c.secondaryButton),as:r?.isCustomSecondaryButton?"button":"a",href:He,target:r?.target,rel:r?.target==="_blank"?r?.rel??"noopener noreferrer":r?.rel,onClick:e=>{if(r.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(r.link);n&&O(n,I)}r?.isCustomSecondaryButton&&J?.(s,e,r?.customSecondaryEventId)},...Se,children:[r?.text,t("span",{className:"sr-only",children:l??o})]}):null,a&&a.text&&t(V,{"aria-label":l??o,size:"lg",variant:"primary",className:p("hero-banner-primary-button",c.primaryButton),as:a?.isCustomPrimaryButton?"button":"a",href:Ne,target:a?.target,rel:a?.target==="_blank"?a?.rel??"noopener noreferrer":a?.rel,onClick:e=>{if(a.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(a.link);n&&O(n,I)}a?.isCustomPrimaryButton&&_?.(s,e,a?.customPrimaryEventId)},...ze,children:a.text})]}),i&&i.text&&u(V,{"aria-label":l??o,size:"lg",variant:"link",className:p("hero-banner-tertiary-button w-auto p-0",c.tertiaryButton),as:i?.isCustomTertiaryButton?"button":"a",href:Ce,target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:e=>{if(i.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(i.link);n&&O(n,I)}i?.isCustomTertiaryButton&&q?.(s,e,i?.customTertiaryEventId)},...Ie,children:[i.text,t("span",{className:"sr-only",children:l??o})]})]}),t("div",{className:et({align:b}),children:ye?.map(e=>t("div",{className:"h-12",children:t(U,{className:"!inline-block h-full !w-auto",imgClassName:"!w-auto h-full object-contain",loading:"eager",alt:e?.pcImage?.alt||"",source:e?.pcImage?.url})},e?.pcImage?.url||e?.pcImage?.alt))})]}),R.length>0&&t("div",{className:p("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]",c.captionGroup),children:R.map((e,n)=>u(pe.Fragment,{children:[t(G,{size:2,className:p("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:e.title}),n<R.length-1&&t("div",{className:p("bg-info-primary w-px")})]},e.title))}),oe&&t(Ze,{visible:oe,videoUrl:r?.isYoutubeVideo?void 0:r?.videoUrl?.url,youTubeId:r?.isYoutubeVideo?r?.youtubeId:void 0,onCloseModal:()=>ae(!1)})]})})});ce.displayName="HeroBanner";var wt=Ge(ce);export{wt as default};
|
|
1
|
+
"use client";import{Fragment as rt,jsx as t,jsxs as u}from"react/jsx-runtime";import ce,{useImperativeHandle as Ee,useRef as k,useState as Me,useEffect as Pe}from"react";import N from"gsap";import{ScrollTrigger as C}from"gsap/dist/ScrollTrigger";import O from"jump.js";import{buildPictureSource as Re,resolveTierMedia as L,useMediaTier as De}from"./mediaResolver.js";import{useInView as je}from"react-intersection-observer";import Ae from"../../helpers/ScrollLoadVideo.js";import{Button as V,Heading as Oe,Picture as U,Text as G,Countdown as Ue}from"../../components/index.js";import{cn as c}from"../../helpers/index.js";import{cva as S}from"class-variance-authority";import{withLayout as Ge}from"../../shared/Styles.js";import{useExposure as Je}from"../../hooks/useExposure.js";import{buildTrackingRef as _e,trackUrlRef as z}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as h,resolveComponentMediaType as qe}from"../../shared/track.js";import{getLocalizedPath as Fe}from"../../helpers/utils.js";import{useAiuiContext as We}from"../AiuiProvider/index.js";import{sizeMap as Ye}from"../../components/button.js";import{VideoModal as Ze}from"../VideoModal/index.js";import Ke from"./HeroBannerCarousel.js";const f="hero_banner",Qe=S("hero-banner-content lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"laptop:top-1/2 px-grid laptop:-translate-y-1/2 left-0",center:"tablet:top-[84px] laptop:top-[76px] desktop:top-[176px] lg-desktop:top-[192px] left-1/2 top-[84px] -translate-x-1/2 translate-y-0 items-center text-center"}},defaultVariants:{align:"left"}}),Xe=S("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),$e=S("hero-banner-button-group lg-desktop:gap-x-3 pointer-events-auto flex flex-wrap items-center gap-x-2 gap-y-3",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),et=S("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),tt=({size:s="base"})=>{const{width:T,height:p}=Ye[s];return t("svg",{width:T,height:p,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:t("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"})})},pe=ce.forwardRef(({data:s,className:T,classNames:p={},onSecondaryClick:J,onPrimaryClick:_,onTertiaryClick:q,jumpOptions:ue={},a11yLabels:me,...F},W)=>{const{locale:Y,pageHandle:de}=We(),Z=s.mode!=="single"&&!!s.items&&s.items.length>0,I={...{duration:500,offset:0},...ue},w=e=>!e||!Y?e:Fe(e,Y),{label:K,title:l,subtitle:o,endDate:Q,endDate_tz:fe,dateFormat:ge,pcImage:E,isShowVideo:X,isVideoLoop:be=!0,primaryButton:a,secondaryButton:r,tertiaryButton:i,theme:ve="light",size:M="default",titleSize:P,caption:$=[],blockLink:B,iconArray:ee,align:b="left",enableParallax:te=!0}=s,R=Array.isArray($)?$:[],ye=Array.isArray(ee)?ee:void 0,re=De(),ne=Re(s),xe=L(s,re,"video")?.url||"",[oe,ae]=Me(!1),{ref:ke,inView:ie}=je(),D=k(null),j=k(null),A=k(null),v=k(null),d=k(null),m=qe(X),H=_e(de??"",m,f),g=L(s,re,m==="video"?"video":"image")?.id||E?.id||"",he=l?.trim()||o?.trim()||E?.alt?.trim()||void 0,Te=l!==void 0?l?.trim()||o?.trim()||E?.alt?.trim()||void 0:o&&o.trim()||"",we=o&&o.trim()||"";Je(d,{componentType:m,componentName:f,componentTitle:Te,componentDescription:we,creativeId:g,position:1});const Be=B?z(w(B),H):void 0,He=r?.link?z(w(r.link),H):void 0,Ne=a?.link?z(w(a.link),H):void 0,Ce=i?.link?z(w(i.link),H):void 0,Le=h({interactive:!!B,componentType:m,componentName:f,title:l,description:o,position:1,creativeId:g}),Ve=h({interactive:!0,componentType:m,componentName:f,title:l,description:o,buttonName:"video play",position:1,creativeId:g}),Se=h({interactive:!!(r?.link||r?.isCustomSecondaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:r?.text,position:1,creativeId:g}),ze=h({interactive:!!(a?.link||a?.isCustomPrimaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:a?.text,position:1,creativeId:g}),Ie=h({interactive:!!(i?.link||i?.isCustomTertiaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:i?.text,position:1,creativeId:g});return Ee(W,()=>d.current),Pe(()=>{if(Z||!te)return;N.registerPlugin(C);function e(){if(!v.current)return;const n=d.current?.clientHeight||100;window.innerHeight<=n?D.current=C.create({trigger:d.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*40-20;N.set(v.current,{yPercent:x})}}):(A.current=C.create({trigger:d.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:y=>{const x=y.progress*20-20;N.set(v.current,{yPercent:x})}}),j.current=C.create({trigger:d.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*20;N.set(v.current,{yPercent:x})}}))}return ie&&e(),()=>{D.current&&D.current.kill(),A.current&&A.current.kill(),j.current&&j.current.kill()}},[ie,s.items,te]),Z?t(Ke,{data:s,className:T,classNames:p,onPrimaryClick:_,onSecondaryClick:J,onTertiaryClick:q,a11yLabels:me,ref:W,...F}):t("div",{...F,ref:ke,"data-ui-component-id":"HeroBanner",className:c(p.root),children:u("div",{ref:d,className:c(ve==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":M==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":M==="sm"},T),children:[B&&t("a",{className:"absolute inset-0 z-10",href:Be,tabIndex:-1,"aria-hidden":"true","aria-label":he,...Le}),t("div",{ref:v,className:c("absolute left-0 top-0 size-full"),children:X?u(rt,{children:[t(Ae,{poster:void 0,src:xe,className:"laptop:w-full absolute inset-0 h-full transition-opacity duration-500",videoLayerClassName:"opacity-0",videoClassName:"h-full object-cover",muted:!0,loop:be,playsInline:!0,onPlaying:e=>{const n=e.currentTarget;n.parentElement?.classList.remove("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:e=>{const n=e.currentTarget;if(n.currentTime>=.5)return;n.parentElement?.classList.add("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),t("div",{"data-video-poster":"true",className:"laptop:w-full bg-container-primary pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:t(U,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})})]}):t(U,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})}),u("div",{className:Qe({align:b}),children:[u("div",{className:Xe({align:b}),children:[K&&t(G,{size:2,as:"p",className:c("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:K}),l&&t(Oe,{as:P==="4"?"h1":"h2",html:l,className:c("hero-banner-title",p.title),size:P?Number(P||"5"):M==="sm"?4:5}),o&&t(G,{as:"p",size:2,className:c("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",p.subtitle),html:o}),Q&&t("div",{className:"mt-3",children:t(Ue,{endDate:Q,endDate_tz:fe,dateFormat:ge,variant:"spacious",align:b})})]}),u("div",{className:c($e({align:b}),p.buttonGroup),children:[u("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[r?.isShowPlayVideoButton&&r?.playVideoButtonText?u(V,{onClick:()=>ae(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...Ve,children:[r?.playVideoButtonText," ",t(tt,{size:"lg"})]}):r?.text?u(V,{"aria-label":l??o,size:"lg",variant:"secondary",className:c("hero-banner-secondary-button",p.secondaryButton),as:r?.isCustomSecondaryButton?"button":"a",href:He,target:r?.target,rel:r?.target==="_blank"?r?.rel??"noopener noreferrer":r?.rel,onClick:e=>{if(r.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(r.link);n&&O(n,I)}r?.isCustomSecondaryButton&&J?.(s,e,r?.customSecondaryEventId)},...Se,children:[r?.text,t("span",{className:"sr-only",children:l??o})]}):null,a&&a.text&&t(V,{"aria-label":l??o,size:"lg",variant:"primary",className:c("hero-banner-primary-button",p.primaryButton),as:a?.isCustomPrimaryButton?"button":"a",href:Ne,target:a?.target,rel:a?.target==="_blank"?a?.rel??"noopener noreferrer":a?.rel,onClick:e=>{if(a.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(a.link);n&&O(n,I)}a?.isCustomPrimaryButton&&_?.(s,e,a?.customPrimaryEventId)},...ze,children:a.text})]}),i&&i.text&&u(V,{"aria-label":l??o,size:"lg",variant:"link",className:c("hero-banner-tertiary-button w-auto p-0",p.tertiaryButton),as:i?.isCustomTertiaryButton?"button":"a",href:Ce,target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:e=>{if(i.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(i.link);n&&O(n,I)}i?.isCustomTertiaryButton&&q?.(s,e,i?.customTertiaryEventId)},...Ie,children:[i.text,t("span",{className:"sr-only",children:l??o})]})]}),t("div",{className:et({align:b}),children:ye?.map(e=>t("div",{className:"h-12",children:t(U,{className:"!inline-block h-full !w-auto",imgClassName:"!w-auto h-full object-contain",loading:"eager",alt:e?.pcImage?.alt||"",source:e?.pcImage?.url})},e?.pcImage?.url||e?.pcImage?.alt))})]}),R.length>0&&t("div",{className:c("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]",p.captionGroup),children:R.map((e,n)=>u(ce.Fragment,{children:[t(G,{size:2,className:c("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:e.title}),n<R.length-1&&t("div",{className:c("bg-info-primary w-px")})]},e.title))}),oe&&t(Ze,{visible:oe,videoUrl:r?.isYoutubeVideo?void 0:r?.videoUrl?.url,youTubeId:r?.isYoutubeVideo?r?.youtubeId:void 0,onCloseModal:()=>ae(!1)})]})})});pe.displayName="HeroBanner";var wt=Ge(pe);export{wt as default};
|
|
@@ -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 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 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
|
|
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 +1 @@
|
|
|
1
|
-
import{Fragment as I,jsx as e,jsxs as i}from"react/jsx-runtime";import{Heading as S,Tabs as q,TabsList as J,TabsTrigger as Q,TabsContent as A,Text as N,Picture as C,Link as X,Button as L,DropdownMenu as Y,DropdownMenuTrigger as Z,DropdownMenuContent as ee,DropdownMenuItem as te,LoadingDots as M,Badge as ae}from"../../components/index.js";import{DownArrow as se}from"../HeaderNavigation/icons/index.js";import{useMemo as u,useState as O}from"react";import{cn as _,atobID as ie,highlightSearchWord as T,replaceTemplate as le}from"../../helpers/utils.js";import{useAiuiContext as j}from"../AiuiProvider/index.js";import{formatVariantPrice as oe}from"../ShelfDisplay/shelfDisplay.js";import{SearchPageTabType as v}from"./types.js";import{getLocalizedPath as B}from"../../helpers/utils.js";const F=({product:t,onSecondaryButton:o,onPrimaryButton:s,searchValue:n,variantData:m,shopNowLoadingProductId:y,badgeVariant:b})=>{const l=u(()=>m||t?.variants?.[0],[t,m]),{locale:g="us",copyWriting:c,currencyCode:x}=j(),f=y===t?.id,D=u(()=>B(`/products/${t?.handle}`,g,`variant=${ie(l?.id)}&ref=search_result_${n?.toLowerCase()}`),[t?.handle,l?.id,n,g]),P=l?.coupons?.[0],{price:k,basePrice:r}=oe({locale:x==="CAD"?"us":g||"us",amount:P?P.variant_price4wscode:l?.price?.amount??l?.price,baseAmount:P?l?.price?.amount??l?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),z=u(()=>t?.tags?.filter?.(d=>d?.startsWith?.("CLtag"))?.map?.(d=>d?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return e("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?i(X,{href:B(t?.advertisingLink,g),className:"h-full",children:[e(C,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),i("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[e(N,{html:t?.advertisingTitle,className:_("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&e(S,{size:3,html:t?.advertisingSubtitle,className:_("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):i("a",{href:D,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[e("div",{className:"ipc_search_product_item_image",children:e(C,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:l?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),i("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[i("div",{className:"flex-1",children:[e("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:z?.map((d,E)=>e(ae,{size:"lg",variant:b,children:d},E))}),e(N,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:T(t?.title||"",n||"")}),e(N,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:T(t?.description,n||"")})]}),i("div",{children:[e("div",{className:"mb-2 flex items-center",children:l?.availableForSale?i(I,{children:[e("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:l?.availableForSale&&k||""}),e("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:l?.availableForSale&&r||""})]}):e("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:c?.soldOutText||"Sold Out"})}),i("div",{className:_("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[c?.learnMoreText&&e(L,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:d=>{d.preventDefault(),d.stopPropagation(),o?.()},children:c?.learnMoreText}),c?.shopNowText&&e(L,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!l?.availableForSale,loading:f,onClick:d=>{d.preventDefault(),d.stopPropagation(),s?.()},children:c?.shopNowText})]})]})]})]})})},re=({blog:t,searchValue:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,n),[t,n]);return e("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:i("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[e("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:e(C,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),i("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[e(S,{size:3,html:T(t?.title,o)}),e(N,{html:T(t?.content,o),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),e("div",{className:"desktop:mt-6 mt-4",children:e(L,{as:"a",href:m,variant:"secondary",size:"lg",children:s?.learnMoreText||"Learn More"})})]})]})})},ne=({searchValue:t,page:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/${o?.handle}`,n),[o,n]);return i("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[e(S,{size:3,html:T(o?.name,t)}),e(N,{as:"p",html:T(o?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),e(L,{as:"a",href:m,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:s?.learnMoreText||"Learn More"})]})},R=({url:t,label:o})=>i("div",{className:"flex flex-col items-center justify-center gap-4",children:[e(C,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),e(N,{html:o,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),$=({products:t,title:o,buildProps:s,onSecondaryButton:n,onPrimaryButton:m,badgeVariant:y})=>{const{products:b}=s||{};return console.log(b,"buildProducts"),i("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[e(S,{size:4,weight:"bold",html:o}),e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((l,g)=>{const c=b?.find(f=>f.handle===l.handle);if(!c)return null;const x=c?.variants?.find(f=>f.sku===l.sku);return e(F,{product:c,variantData:x,badgeVariant:y,onSecondaryButton:()=>n?.(),onPrimaryButton:()=>m?.()},l.sku+g)})})]})},de=({searchResult:t,searchValue:o,data:s,onSecondaryButton:n,onPrimaryButton:m,onChangeSort:y,loading:b,shopNowLoadingProductId:l,searchResultCount:g,onChangeTab:c,buildProps:x,componentOverrides:f,className:D,...P})=>{const k=f?.badge?.variant,[r,z]=O(s?.tabs?.[0]),[d,E]=O(!1),[V,G]=O({[v.PRODUCTS]:s?.tabs?.find(a=>a.tabType===v.PRODUCTS)?.sortKeys?.[0],[v.BLOGS]:s?.tabs?.find(a=>a.tabType===v.BLOGS)?.sortKeys?.[0],[v.PAGES]:s?.tabs?.find(a=>a.tabType===v.PAGES)?.sortKeys?.[0]}),w=u(()=>t?.products||[],[t]),K=u(()=>t?.blogs||[],[t]),W=u(()=>t?.pages||[],[t]),U=u(()=>Object.values(g||{}).reduce((a,p)=>a+p,0),[g]),H=u(()=>{const a={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const h=[...w||[]];return h.length>=8?h.splice(7,0,a):h.length>0&&h.push(a),h}else return w},[r,w]);return i("div",{...P,className:_("ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",D),children:[e(S,{size:4,weight:"bold",html:le(s?.title,{totalCount:U?.toString(),inputValue:`"${o}"`})}),e("div",{className:"mt-6",children:i(q,{className:"ipc_search_page_tabs",defaultValue:"products",children:[i("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[e(J,{children:s?.tabs?.map(a=>i(Q,{onClick:()=>{z(a);const p=a?.sortKeys?.[0];p&&(G(h=>({...h,[a?.tabType]:p})),y?.(a?.tabType,p)),c?.(a?.tabType)},defaultValue:"products",value:a.tabType,children:[a.label," (",g?.[a.tabType],")"]},a.id))}),i(Y,{onOpenChange:E,children:[e(Z,{asChild:!0,children:i("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",V?.[r?.tabType]?.label," ",e(se,{className:_("inline-block size-4",{"rotate-180":d})})]})}),e(ee,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(a=>e(te,{className:_("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":V?.[r?.tabType]?.value===a.value}),onClick:()=>{y?.(r?.tabType,a),G(p=>({...p,[r?.tabType]:a}))},children:a.label},a.id))})]})]}),i(A,{value:v.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:H?.map((a,p)=>e(F,{searchValue:o,product:a,shopNowLoadingProductId:l,badgeVariant:k,onSecondaryButton:()=>n?.(a),onPrimaryButton:()=>m?.(a)},(a.id||"")+p))}),b?e("div",{className:"mt-6 flex w-full justify-center",children:e(M,{})}):!w?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]}),e(A,{value:v.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:i("div",{children:[K?.map(a=>e(re,{blog:a,searchValue:o},a.id)),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!K?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,badgeVariant:k})]})]})}),i(A,{value:v.PAGES,className:"ipc_search_page_tabs_pages_content",children:[e("div",{children:W?.map((a,p)=>e(ne,{page:a,searchValue:o},(a.global_id||a.id)+p))}),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!W?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]})]})})]})};var fe=de;export{fe as default};
|
|
1
|
+
import{Fragment as I,jsx as e,jsxs as i}from"react/jsx-runtime";import{Heading as S,Tabs as q,TabsList as J,TabsTrigger as Q,TabsContent as A,Text as N,Picture as C,Link as X,Button as L,DropdownMenu as Y,DropdownMenuTrigger as Z,DropdownMenuContent as ee,DropdownMenuItem as te,LoadingDots as M,Badge as ae}from"../../components/index.js";import{DownArrow as se}from"../HeaderNavigation/icons/index.js";import{useMemo as u,useState as O}from"react";import{cn as _,atobID as ie,highlightSearchWord as T,replaceTemplate as le}from"../../helpers/utils.js";import{useAiuiContext as j}from"../AiuiProvider/index.js";import{formatVariantPrice as oe}from"../ShelfDisplay/shelfDisplay.js";import{SearchPageTabType as v}from"./types.js";import{getLocalizedPath as B}from"../../helpers/utils.js";const F=({product:t,onSecondaryButton:o,onPrimaryButton:s,searchValue:n,variantData:m,shopNowLoadingProductId:y,badgeVariant:b})=>{const l=u(()=>m||t?.variants?.[0],[t,m]),{locale:g="us",copyWriting:p,currencyCode:x}=j(),f=y===t?.id,D=u(()=>B(`/products/${t?.handle}`,g,`variant=${ie(l?.id)}&ref=search_result_${n?.toLowerCase()}`),[t?.handle,l?.id,n,g]),P=l?.coupons?.[0],{price:k,basePrice:r}=oe({locale:x==="CAD"?"us":g||"us",amount:P?P.variant_price4wscode:l?.price?.amount??l?.price,baseAmount:P?l?.price?.amount??l?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),z=u(()=>t?.tags?.filter?.(d=>d?.startsWith?.("CLtag"))?.map?.(d=>d?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return e("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?i(X,{href:B(t?.advertisingLink,g),className:"h-full",children:[e(C,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),i("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[e(N,{html:t?.advertisingTitle,className:_("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&e(S,{size:3,html:t?.advertisingSubtitle,className:_("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):i("a",{href:D,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[e("div",{className:"ipc_search_product_item_image",children:e(C,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:l?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),i("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[i("div",{className:"flex-1",children:[e("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:z?.map((d,E)=>e(ae,{size:"lg",variant:b,children:d},E))}),e(N,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:T(t?.title||"",n||"")}),e(N,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:T(t?.description,n||"")})]}),i("div",{children:[e("div",{className:"mb-2 flex items-center",children:l?.availableForSale?i(I,{children:[e("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:l?.availableForSale&&k||""}),e("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:l?.availableForSale&&r||""})]}):e("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:p?.soldOutText||"Sold Out"})}),i("div",{className:_("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[p?.learnMoreText&&e(L,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:d=>{d.preventDefault(),d.stopPropagation(),o?.()},children:p?.learnMoreText}),p?.shopNowText&&e(L,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!l?.availableForSale,loading:f,onClick:d=>{d.preventDefault(),d.stopPropagation(),s?.()},children:p?.shopNowText})]})]})]})]})})},re=({blog:t,searchValue:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,n),[t,n]);return e("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:i("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[e("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:e(C,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),i("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[e(S,{size:3,html:T(t?.title,o)}),e(N,{html:T(t?.content,o),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),e("div",{className:"desktop:mt-6 mt-4",children:e(L,{as:"a",href:m,variant:"secondary",size:"lg",children:s?.learnMoreText||"Learn More"})})]})]})})},ne=({searchValue:t,page:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/${o?.handle}`,n),[o,n]);return i("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[e(S,{size:3,html:T(o?.name,t)}),e(N,{as:"p",html:T(o?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),e(L,{as:"a",href:m,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:s?.learnMoreText||"Learn More"})]})},R=({url:t,label:o})=>i("div",{className:"flex flex-col items-center justify-center gap-4",children:[e(C,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),e(N,{html:o,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),$=({products:t,title:o,buildProps:s,onSecondaryButton:n,onPrimaryButton:m,badgeVariant:y})=>{const{products:b}=s||{};return console.log(b,"buildProducts"),i("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[e(S,{size:4,weight:"bold",html:o}),e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((l,g)=>{const p=b?.find(f=>f.handle===l.handle);if(!p)return null;const x=p?.variants?.find(f=>f.sku===l.sku);return e(F,{product:p,variantData:x,badgeVariant:y,onSecondaryButton:()=>n?.(),onPrimaryButton:()=>m?.()},l.sku+g)})})]})},de=({searchResult:t,searchValue:o,data:s,onSecondaryButton:n,onPrimaryButton:m,onChangeSort:y,loading:b,shopNowLoadingProductId:l,searchResultCount:g,onChangeTab:p,buildProps:x,componentOverrides:f,className:D,...P})=>{const k=f?.badge?.variant,[r,z]=O(s?.tabs?.[0]),[d,E]=O(!1),[V,G]=O({[v.PRODUCTS]:s?.tabs?.find(a=>a.tabType===v.PRODUCTS)?.sortKeys?.[0],[v.BLOGS]:s?.tabs?.find(a=>a.tabType===v.BLOGS)?.sortKeys?.[0],[v.PAGES]:s?.tabs?.find(a=>a.tabType===v.PAGES)?.sortKeys?.[0]}),w=u(()=>t?.products||[],[t]),K=u(()=>t?.blogs||[],[t]),W=u(()=>t?.pages||[],[t]),U=u(()=>Object.values(g||{}).reduce((a,c)=>a+c,0),[g]),H=u(()=>{const a={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const h=[...w||[]];return h.length>=8?h.splice(7,0,a):h.length>0&&h.push(a),h}else return w},[r,w]);return i("div",{...P,className:_("ipc_search_page desktop:py-[128px] px-grid py-16",D),children:[e(S,{size:4,weight:"bold",html:le(s?.title,{totalCount:U?.toString(),inputValue:`"${o}"`})}),e("div",{className:"mt-6",children:i(q,{className:"ipc_search_page_tabs",defaultValue:"products",children:[i("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[e(J,{children:s?.tabs?.map(a=>i(Q,{onClick:()=>{z(a);const c=a?.sortKeys?.[0];c&&(G(h=>({...h,[a?.tabType]:c})),y?.(a?.tabType,c)),p?.(a?.tabType)},defaultValue:"products",value:a.tabType,children:[a.label," (",g?.[a.tabType],")"]},a.id))}),i(Y,{onOpenChange:E,children:[e(Z,{asChild:!0,children:i("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",V?.[r?.tabType]?.label," ",e(se,{className:_("inline-block size-4",{"rotate-180":d})})]})}),e(ee,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(a=>e(te,{className:_("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":V?.[r?.tabType]?.value===a.value}),onClick:()=>{y?.(r?.tabType,a),G(c=>({...c,[r?.tabType]:a}))},children:a.label},a.id))})]})]}),i(A,{value:v.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:H?.map((a,c)=>e(F,{searchValue:o,product:a,shopNowLoadingProductId:l,badgeVariant:k,onSecondaryButton:()=>n?.(a),onPrimaryButton:()=>m?.(a)},(a.id||"")+c))}),b?e("div",{className:"mt-6 flex w-full justify-center",children:e(M,{})}):!w?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]}),e(A,{value:v.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:i("div",{children:[K?.map(a=>e(re,{blog:a,searchValue:o},a.id)),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!K?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,badgeVariant:k})]})]})}),i(A,{value:v.PAGES,className:"ipc_search_page_tabs_pages_content",children:[e("div",{children:W?.map((a,c)=>e(ne,{page:a,searchValue:o},(a.global_id||a.id)+c))}),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!W?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]})]})})]})};var fe=de;export{fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as g}from"react/jsx-runtime";import*as p from"react";import{cva as ue}from"class-variance-authority";import{useMediaQuery as H}from"react-responsive";import E from"jump.js";import{cn as s,getLocalizedPath as w}from"../../helpers/index.js";import{Text as O,Button as P,Heading as ge,Picture as be,Countdown as ye}from"../../components/index.js";import{withLayout as fe}from"../../shared/Styles.js";import
|
|
1
|
+
"use client";import{jsx as t,jsxs as g}from"react/jsx-runtime";import*as p from"react";import{cva as ue}from"class-variance-authority";import{useMediaQuery as H}from"react-responsive";import E from"jump.js";import{cn as s,getLocalizedPath as w}from"../../helpers/index.js";import{Text as O,Button as P,Heading as ge,Picture as be,Countdown as ye}from"../../components/index.js";import{withLayout as fe}from"../../shared/Styles.js";import ke from"../Media/index.js";import{useAiuiContext as xe}from"../AiuiProvider/index.js";import{useExposure as he}from"../../hooks/useExposure.js";import{buildTrackingRef as Te,trackUrlRef as V}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as _,resolveComponentMediaType as ve}from"../../shared/track.js";import Be from"./SecondaryBannerCarousel.js";const u="secondary_banner",Ie=ue("text-info-primary relative w-full",{variants:{size:{sm:"tablet:aspect-[768/480] laptop:aspect-[1024/480] desktop:aspect-[1440/480] lg-desktop:aspect-[1920/480] aspect-[390/480]",base:"tablet:aspect-[768/660] laptop:aspect-[1024/432] desktop:aspect-[1440/576] lg-desktop:aspect-[1920/720] aspect-[390/660]",lg:"tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660]",xlg:"tablet:aspect-[768/1320] laptop:aspect-[1024/864] desktop:aspect-[1440/1152] lg-desktop:aspect-[1920/1440] aspect-[390/1440] overflow-visible"}},defaultVariants:{size:"base"}}),j=p.forwardRef(({className:h,classNames:a={},data:e,jumpOptions:T={},isActive:$,a11yLabels:J,trackExposure:q=!0,frameIndex:b,...v},l)=>{const{pcImage:F,padImage:W,mobileImage:G,isVideoLoop:Q,endDate:B,endDate_tz:U,dateFormat:K,size:X,iconArray:y,theme:Y,primaryButton:n,secondaryButton:i,title:c,titleTag:Z}=e,ee=Q??!0,f=X??"base",te=Y??"light",ne=Z??"h2",{locale:I="us",pageHandle:ie}=xe(),oe=H({query:"(max-width: 767px)"}),ae=H({query:"(min-width: 768px) and (max-width: 1024px)"}),M=oe?e.mobileImage:ae?e.padImage??e.pcImage:e.pcImage,m=ve(M?.mimeType==="video/mp4"),S=b??1,C=`${Te(ie??"",m,u)}${b===void 0?"":`_${b}`}`,k=M?.id||e.pcImage?.id||"",L=p.useRef(null),se=p.useCallback(o=>{L.current=o,typeof l=="function"?l(o):l&&(l.current=o)},[l]),re=p.useRef(null);he(q?L:re,{componentType:m,componentName:u,componentTitle:c?.trim()||"",componentDescription:e.subtitle?.trim()||"",position:1,creativeId:k});const le=!!(i?.link||typeof i?.onClick=="function"),pe=!!(n?.link||typeof n?.onClick=="function"),z=i?.link&&!i.link.startsWith("#")?V(w(i.link,I),C):void 0,N=n?.link&&!n.link.startsWith("#")?V(w(n.link,I),C):void 0,ce=_({interactive:le,componentType:m,componentName:u,title:c,description:e.subtitle,buttonName:i?.text,position:S,creativeId:k}),me=_({interactive:pe,componentType:m,componentName:u,title:c,description:e.subtitle,buttonName:n?.text,position:S,creativeId:k}),R={...{duration:500,offset:0},...T},x=p.useId(),d=c?`${x}-title`:void 0,D=e.subtitle?`${x}-subtitle`:void 0,A=e.superTitle?`${x}-super-title`:void 0,de=[A,D].filter(Boolean).join(" ")||void 0;return e.items&&e.items.length>0?t(Be,{data:e,className:h,classNames:a,jumpOptions:T,a11yLabels:J,ref:l,...v}):g("section",{ref:se,role:"banner","aria-labelledby":d,"aria-describedby":de,className:s({"aiui-dark":te==="dark"},Ie({size:f}),h,a?.root),...v,children:[t("div",{className:s("absolute inset-0",{"h-fit":f==="xlg"}),children:t(ke,{pcImage:F,padImage:W,mobileImage:G,className:"size-full",imgClassName:"object-cover",videoClassName:"object-cover",muted:!0,loop:ee,playsInline:!0,autoPlay:$??!0})}),g("div",{className:s("banner-content laptop:top-[min(50%,50vh)] laptop:-translate-y-1/2 px-grid absolute top-12 z-10 flex flex-col items-start justify-center text-left",a?.content),children:[g("div",{className:"banner-inner-title desktop:gap-2 flex flex-col items-start gap-1",children:[e.superTitle&&t(O,{as:"p",size:2,id:A,className:s("banner-super-title desktop:text-[16px] lg-desktop:text-[18px]",a?.superTitle),html:e.superTitle}),e.title&&t(ge,{as:ne,size:["xlg","lg"].includes(f)?5:4,id:d,className:s("banner-title ",a?.title),html:e.title}),e.subtitle&&t(O,{as:"p",size:3,id:D,className:s("banner-subtitle desktop:text-[16px] lg-desktop:text-[18px]",a?.subtitle),html:e.subtitle})]}),B&&t("div",{className:"banner-countdown",children:t(ye,{endDate:B,endDate_tz:U,dateFormat:K,variant:"spacious",className:"lg-desktop:mt-8 mt-6"})}),g("div",{className:s("banner-cta-group lg-desktop:mt-[32px] lg-desktop:gap-3 mt-6 flex gap-2",a?.buttonGroup),children:[i?.text&&t(P,{variant:"secondary",onClick:o=>{if(i.link?.startsWith("#")){o.preventDefault();const r=document.querySelector(i.link);r&&E(r,R)}i.onClick?.()},className:s("",a?.secondaryButton),"aria-describedby":d,...z?{as:"a",href:z}:{},...ce,children:i.text}),n?.text&&t(P,{onClick:o=>{if(n.link?.startsWith("#")){o.preventDefault();const r=document.querySelector(n.link);r&&E(r,R)}n.onClick?.()},className:s("",a?.primaryButton),"aria-describedby":d,...N?{as:"a",href:N}:{},...me,children:n.text})]}),Array.isArray(y)&&y.length>0&&t("div",{className:"banner-icons desktop:mt-3 lg-desktop:mt-4 mt-2 flex items-center gap-2",role:"group","aria-label":"brand icons",children:y.map((o,r)=>o.pcImage?t(be,{source:o.pcImage.url,alt:o.pcImage.alt||`icon ${r+1}`,role:"img",className:"laptop:h-auto h-[48px] max-w-none",imgClassName:"h-full"},r):null)})]})]})});j.displayName="SecondaryBanner";var Pe=fe(j);export{Pe as default,Ie as secondaryBannerVariants};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as b,jsx as o}from"react/jsx-runtime";import i from"react";import{cn as l}from"../helpers/utils.js";import{Slot as u}from"@radix-ui/react-slot";const N=({children:e})=>o(b,{children:e}),d=i.forwardRef(({...e},t)=>{const{asChild:p,children:n,className:s,childClassName:a,spaceY:c="none",spaceTop:r="none",spaceBottom:m="none",...x}=e,C=p?u:"div",y={default:"tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]",none:""},R={default:"tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",none:""},g={default:"tablet:pb-[80px] laptop:pb-[96px] desktop:pb-[112px] lg-desktop:pb-[128px] pb-[64px]",none:""};return o(C,{...x,ref:t,className:l(s,"ipc_container","relative z-10 w-full"),children:o("div",{className:l("lg-desktop:max-w-full px-grid mx-auto size-full",a,y?.[c]||c,R?.[r]||r,g?.[m]||m),children:n})})});d.displayName="Section";const f=i.forwardRef(({...e},t)=>{const{children:p,mode:n="section"}=e,a={section:d,fragment:N}[n];return o(a,{...e,ref:t,children:p})});f.displayName="Container";export{f as Container};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{clsx as u}from"clsx";import{extendTailwindMerge as l}from"tailwind-merge";const f=l({extend:{theme:{borderRadius:["btn","box","box-small","card","tabs","sidebar-shelf","image-text"]},classGroups:{"font-size":["text-heading-1","text-heading-2","text-heading-3","text-heading-4","text-heading-5","text-text-3","text-text-2","text-text-1"],"text-color":["text-info-primary","text-info-secondary","text-info-tertiary","text-info-quaternary","text-info-white"],leading:["leading-tight","leading-normal","leading-loose"]}}});function
|
|
1
|
+
import{clsx as u}from"clsx";import{extendTailwindMerge as l}from"tailwind-merge";const f=l({extend:{theme:{spacing:["grid"],borderRadius:["btn","box","box-small","card","tabs","sidebar-shelf","image-text"]},classGroups:{"font-size":["text-heading-1","text-heading-2","text-heading-3","text-heading-4","text-heading-5","text-text-3","text-text-2","text-text-1"],"text-color":["text-info-primary","text-info-secondary","text-info-tertiary","text-info-quaternary","text-info-white"],leading:["leading-tight","leading-normal","leading-loose"]}}});function $(...t){return f(u(t))}function a(){}function b(t){return t&&typeof t=="string"&&t.includes("/")?t.split("/").pop()?.split("?")?.shift():t}const p=t=>t?.replace(/\s+/g,"-"),g=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),y=(t,r,e="{",n="}")=>{if(!t||!r||Object.keys(r).length===0)return t;const s=g(e),o=g(n),i=new RegExp(`${s}([a-zA-Z0-9_-]+)${o}`,"g");return t.replace(i,(x,c)=>r[c]!==void 0?r[c]:x)},w=(t,r)=>{try{if(!t||!r)return t;const e=g(r),n=new RegExp(e,"gi");return t.replace(n,s=>`<span class='text-brand-0 font-bold'>${s}</span>`)}catch(e){return console.error("highlightSearchWord error:",e),t}},R=(t,r,e)=>{if(!t)return t;if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("#"))return e?t.includes("?")?`${t}&${e}`:`${t}?${e}`:t;const n=t.split("/").filter(Boolean);if(n.length===0){const i=r==="us"?"/":`/${r}`;return e?`${i}?${e}`:i}if(n[0]===r){const i=`/${n.join("/")}`;return e?`${i}?${e}`:i}const o=`${r==="us"?"":`/${r}`}/${n.join("/")}`;return e?`${o}?${e}`:o};export{b as atobID,$ as cn,R as getLocalizedPath,w as highlightSearchWord,a as noop,y as replaceTemplate,p as spaceToHyphen};
|
package/dist/tokens/base.css
CHANGED
|
@@ -117,6 +117,54 @@
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
|
|
120
|
+
:root {
|
|
121
|
+
--grid-margin: 16px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@media (min-width: 768px) {
|
|
125
|
+
:root {
|
|
126
|
+
--grid-margin: 32px;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@media (min-width: 1025px) {
|
|
131
|
+
:root {
|
|
132
|
+
--grid-margin: 64px;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@media (min-width: 1920px) {
|
|
137
|
+
:root {
|
|
138
|
+
--grid-margin: calc(50% - 832px);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* 默认是阶梯式:16 / 32 / 64px,1440 至 1919px 固定 64px,1920px 起居中 1664px。
|
|
143
|
+
流式需要主动开启:在祖先元素或 <html> 上声明 data-grid="fluid"(或 .grid-fluid),
|
|
144
|
+
其内的 px-grid 在 1440 至 1920px 之间从 64px 线性过渡到 128px。
|
|
145
|
+
data-grid="legacy"(或 .grid-legacy)用于在流式范围内的局部区域切回阶梯式。
|
|
146
|
+
选择器优先级相同,靠书写顺序生效,顺序不可调换。 */
|
|
147
|
+
@media (min-width: 1440px) {
|
|
148
|
+
[data-grid='fluid'],
|
|
149
|
+
.grid-fluid {
|
|
150
|
+
--grid-margin: clamp(64px, calc(64px + (100% - 1440px) * 64 / 480), 128px);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[data-grid='legacy'],
|
|
154
|
+
.grid-legacy {
|
|
155
|
+
--grid-margin: 64px;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (min-width: 1920px) {
|
|
160
|
+
[data-grid='fluid'],
|
|
161
|
+
.grid-fluid,
|
|
162
|
+
[data-grid='legacy'],
|
|
163
|
+
.grid-legacy {
|
|
164
|
+
--grid-margin: calc(50% - 832px);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
120
168
|
@media (min-width: 1024px) {
|
|
121
169
|
:root {
|
|
122
170
|
--card-radius: 16px;
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -4526,6 +4526,9 @@ video {
|
|
|
4526
4526
|
.scrollbar-hide::-webkit-scrollbar {
|
|
4527
4527
|
display: none;
|
|
4528
4528
|
}
|
|
4529
|
+
.px-grid {
|
|
4530
|
+
padding-inline: var(--grid-margin, 16px);
|
|
4531
|
+
}
|
|
4529
4532
|
.mask-fade-vertical {
|
|
4530
4533
|
-webkit-mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
|
|
4531
4534
|
mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
|
|
@@ -6038,10 +6041,6 @@ video {
|
|
|
6038
6041
|
padding-left: 24px;
|
|
6039
6042
|
padding-right: 24px;
|
|
6040
6043
|
}
|
|
6041
|
-
.tablet\:px-\[32px\] {
|
|
6042
|
-
padding-left: 32px;
|
|
6043
|
-
padding-right: 32px;
|
|
6044
|
-
}
|
|
6045
6044
|
.tablet\:py-3 {
|
|
6046
6045
|
padding-top: 0.75rem;
|
|
6047
6046
|
padding-bottom: 0.75rem;
|
|
@@ -7400,10 +7399,6 @@ video {
|
|
|
7400
7399
|
padding-left: 0px;
|
|
7401
7400
|
padding-right: 0px;
|
|
7402
7401
|
}
|
|
7403
|
-
.laptop-md\:px-16 {
|
|
7404
|
-
padding-left: 4rem;
|
|
7405
|
-
padding-right: 4rem;
|
|
7406
|
-
}
|
|
7407
7402
|
.laptop-md\:px-6 {
|
|
7408
7403
|
padding-left: 1.5rem;
|
|
7409
7404
|
padding-right: 1.5rem;
|
|
@@ -7446,6 +7441,9 @@ video {
|
|
|
7446
7441
|
--tw-text-opacity: 1;
|
|
7447
7442
|
color: rgb(29 29 31 / var(--tw-text-opacity, 1));
|
|
7448
7443
|
}
|
|
7444
|
+
.laptop-md\:px-grid {
|
|
7445
|
+
padding-inline: var(--grid-margin, 16px);
|
|
7446
|
+
}
|
|
7449
7447
|
}
|
|
7450
7448
|
@media (min-width: 1440px) {
|
|
7451
7449
|
.desktop\:-left-6 {
|
|
@@ -8780,10 +8778,6 @@ video {
|
|
|
8780
8778
|
padding-left: 8px;
|
|
8781
8779
|
padding-right: 8px;
|
|
8782
8780
|
}
|
|
8783
|
-
.lg-desktop\:px-\[calc\(50\%-832px\)\] {
|
|
8784
|
-
padding-left: calc(50% - 832px);
|
|
8785
|
-
padding-right: calc(50% - 832px);
|
|
8786
|
-
}
|
|
8787
8781
|
.lg-desktop\:py-4 {
|
|
8788
8782
|
padding-top: 1rem;
|
|
8789
8783
|
padding-bottom: 1rem;
|
|
@@ -8896,6 +8890,9 @@ video {
|
|
|
8896
8890
|
.lg-desktop\:leading-\[1\.2\] {
|
|
8897
8891
|
line-height: 1.2;
|
|
8898
8892
|
}
|
|
8893
|
+
.lg-desktop\:px-grid {
|
|
8894
|
+
padding-inline: var(--grid-margin, 16px);
|
|
8895
|
+
}
|
|
8899
8896
|
}
|
|
8900
8897
|
.\[\&\.swiper-slide-thumb-active\]\:rounded.swiper-slide-thumb-active {
|
|
8901
8898
|
border-radius: 0.25rem;
|