@anker-in/headless-ui 1.3.81 → 1.3.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
- package/dist/cjs/biz-components/MiniCart/CircleProgress.d.ts +22 -1
- package/dist/cjs/biz-components/MiniCart/CircleProgress.js +2 -1
- package/dist/cjs/biz-components/MiniCart/MiniCartDialog.d.ts +4 -2
- package/dist/cjs/biz-components/MiniCart/MiniCartDialog.js +1 -1
- package/dist/cjs/biz-components/MiniCart/index.d.ts +45 -0
- package/dist/cjs/biz-components/MiniCart/index.js +1 -1
- package/dist/cjs/biz-components/index.d.ts +2 -2
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/helpers/ScrollLoadVideo.d.ts +9 -1
- package/dist/cjs/helpers/ScrollLoadVideo.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/MiniCart/CircleProgress.d.ts +22 -1
- package/dist/esm/biz-components/MiniCart/CircleProgress.js +2 -1
- package/dist/esm/biz-components/MiniCart/MiniCartDialog.d.ts +4 -2
- package/dist/esm/biz-components/MiniCart/MiniCartDialog.js +1 -1
- package/dist/esm/biz-components/MiniCart/index.d.ts +45 -0
- package/dist/esm/biz-components/MiniCart/index.js +1 -1
- package/dist/esm/biz-components/index.d.ts +2 -2
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/helpers/ScrollLoadVideo.d.ts +9 -1
- package/dist/esm/helpers/ScrollLoadVideo.js +1 -1
- package/package.json +1 -1
- package/style.css +21 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var Oe=Object.create;var M=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Je=Object.getPrototypeOf,_e=Object.prototype.hasOwnProperty;var qe=(t,p)=>{for(var o in p)M(t,o,{get:p[o],enumerable:!0})},se=(t,p,o,T)=>{if(p&&typeof p=="object"||typeof p=="function")for(let g of Ge(p))!_e.call(t,g)&&g!==o&&M(t,g,{get:()=>p[g],enumerable:!(T=Ue(p,g))||T.enumerable});return t};var H=(t,p,o)=>(o=t!=null?Oe(Je(t)):{},se(p||!t||!t.__esModule?M(o,"default",{value:t,enumerable:!0}):o,t)),Fe=t=>se(M({},"__esModule",{value:!0}),t);var $e={};qe($e,{default:()=>Xe});module.exports=Fe($e);var e=require("react/jsx-runtime"),u=H(require("react")),V=H(require("gsap")),z=require("gsap/dist/ScrollTrigger"),R=H(require("jump.js")),f=require("./mediaResolver.js"),pe=require("react-intersection-observer"),ce=H(require("../../helpers/ScrollLoadVideo.js")),l=require("../../components/index.js"),m=require("../../helpers/index.js"),I=require("class-variance-authority"),ue=require("../../shared/Styles.js"),me=require("../../hooks/useExposure.js"),k=require("../../shared/trackUrlRef.js"),v=require("../../shared/track.js"),de=require("../../helpers/utils.js"),fe=require("../AiuiProvider/index.js"),ge=require("../../components/button.js"),be=require("../VideoModal/index.js"),ve=H(require("./HeroBannerCarousel.js"));const y="hero_banner",We=(0,I.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"}}),Ye=(0,I.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"}}),Ze=(0,I.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"}}),Ke=(0,I.cva)("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),Qe=({size:t="base"})=>{const{width:p,height:o}=ge.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"})})},le=u.default.forwardRef(({data:t,className:p,classNames:o={},onSecondaryClick:T,onPrimaryClick:g,onTertiaryClick:_,jumpOptions:xe={},a11yLabels:ye,...q},F)=>{const{locale:W,pageHandle:ke}=(0,fe.useAiuiContext)(),Y=t.mode!=="single"&&!!t.items&&t.items.length>0,E={...{duration:500,offset:0},...xe},L=r=>!r||!W?r:(0,de.getLocalizedPath)(r,W),{label:Z,title:c,subtitle:a,endDate:K,endDate_tz:he,dateFormat:Te,pcImage:D,isShowVideo:Q,isVideoLoop:we=!0,primaryButton:i,secondaryButton:n,tertiaryButton:s,theme:Be="light",size:j="default",titleSize:A,caption:X=[],blockLink:S,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,u.useState)(!1),{ref:He,inView:ae}=(0,pe.useInView)(),U=(0,u.useRef)(null),G=(0,u.useRef)(null),J=(0,u.useRef)(null),B=(0,u.useRef)(null),x=(0,u.useRef)(null),b=(0,v.resolveComponentMediaType)(Q),P=(0,k.buildTrackingRef)(ke??"",b,y),h=(0,f.resolveTierMedia)(t,te,b==="video"?"video":"image")?.id||D?.id||"",Ve=c?.trim()||a?.trim()||D?.alt?.trim()||void 0,ze=c!==void 0?c?.trim()||a?.trim()||D?.alt?.trim()||void 0:a&&a.trim()||"",Ie=a&&a.trim()||"";(0,me.useExposure)(x,{componentType:b,componentName:y,componentTitle:ze,componentDescription:Ie,creativeId:h,position:1});const Le=S?(0,k.trackUrlRef)(L(S),P):void 0,Se=n?.link?(0,k.trackUrlRef)(L(n.link),P):void 0,Pe=i?.link?(0,k.trackUrlRef)(L(i.link),P):void 0,Me=s?.link?(0,k.trackUrlRef)(L(s.link),P):void 0,Re=(0,v.buildClickTrackingProps)({interactive:!!S,componentType:b,componentName:y,title:c,description:a,position:1,creativeId:h}),Ee=(0,v.buildClickTrackingProps)({interactive:!0,componentType:b,componentName:y,title:c,description:a,buttonName:"video play",position:1,creativeId:h}),De=(0,v.buildClickTrackingProps)({interactive:!!(n?.link||n?.isCustomSecondaryButton),componentType:b,componentName:y,title:c,description:a,buttonName:n?.text,position:1,creativeId:h}),je=(0,v.buildClickTrackingProps)({interactive:!!(i?.link||i?.isCustomPrimaryButton),componentType:b,componentName:y,title:c,description:a,buttonName:i?.text,position:1,creativeId:h}),Ae=(0,v.buildClickTrackingProps)({interactive:!!(s?.link||s?.isCustomTertiaryButton),componentType:b,componentName:y,title:c,description:a,buttonName:s?.text,position:1,creativeId:h});return(0,u.useImperativeHandle)(F,()=>x.current),(0,u.useEffect)(()=>{if(Y||!ee)return;V.default.registerPlugin(z.ScrollTrigger);function r(){if(!B.current)return;const d=x.current?.clientHeight||100;window.innerHeight<=d?U.current=z.ScrollTrigger.create({trigger:x.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:N=>{const C=N.progress*40-20;V.default.set(B.current,{yPercent:C})}}):(J.current=z.ScrollTrigger.create({trigger:x.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:N=>{const C=N.progress*20-20;V.default.set(B.current,{yPercent:C})}}),G.current=z.ScrollTrigger.create({trigger:x.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:N=>{const C=N.progress*20;V.default.set(B.current,{yPercent:C})}}))}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)(ve.default,{data:t,className:p,classNames:o,onPrimaryClick:g,onSecondaryClick:T,onTertiaryClick:_,a11yLabels:ye,ref:F,...q}):(0,e.jsx)("div",{...q,ref:He,"data-ui-component-id":"HeroBanner",className:(0,m.cn)(o.root),children:(0,e.jsxs)("div",{ref:x,className:(0,m.cn)(Be==="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:[S&&(0,e.jsx)("a",{className:"absolute inset-0 z-10",href:Le,tabIndex:-1,"aria-hidden":"true","aria-label":Ve,...Re}),(0,e.jsx)("div",{ref:B,className:(0,m.cn)("absolute left-0 top-0 size-full"),children:Q?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ce.default,{poster:void 0,src:Ce,className:"laptop:w-full absolute inset-0 h-full",videoClassName:"h-full object-cover",muted:!0,loop:we,playsInline:!0,onPlaying:r=>{r.currentTarget.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")}}),(0,e.jsx)("div",{"data-video-poster":"true",className:"laptop:w-full pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:(0,e.jsx)(l.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)(l.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:We({align:w}),children:[(0,e.jsxs)("div",{className:Ye({align:w}),children:[Z&&(0,e.jsx)(l.Text,{size:2,as:"p",className:(0,m.cn)("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:Z}),c&&(0,e.jsx)(l.Heading,{as:A==="4"?"h1":"h2",html:c,className:(0,m.cn)("hero-banner-title",o.title),size:A?Number(A||"5"):j==="sm"?4:5}),a&&(0,e.jsx)(l.Text,{as:"p",size:2,className:(0,m.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:a}),K&&(0,e.jsx)("div",{className:"mt-3",children:(0,e.jsx)(l.Countdown,{endDate:K,endDate_tz:he,dateFormat:Te,variant:"spacious",align:w})})]}),(0,e.jsxs)("div",{className:(0,m.cn)(Ze({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)(l.Button,{onClick:()=>oe(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...Ee,children:[n?.playVideoButtonText," ",(0,e.jsx)(Qe,{size:"lg"})]}):n?.text?(0,e.jsxs)(l.Button,{"aria-label":c??a,size:"lg",variant:"secondary",className:(0,m.cn)("hero-banner-secondary-button",o.secondaryButton),as:n?.isCustomSecondaryButton?"button":"a",href:Se,target:n?.target,rel:n?.target==="_blank"?n?.rel??"noopener noreferrer":n?.rel,onClick:r=>{if(n.link?.startsWith("#")){r.preventDefault();const d=document.querySelector(n.link);d&&(0,R.default)(d,E)}n?.isCustomSecondaryButton&&T?.(t,r,n?.customSecondaryEventId)},...De,children:[n?.text,(0,e.jsx)("span",{className:"sr-only",children:c??a})]}):null,i&&i.text&&(0,e.jsx)(l.Button,{"aria-label":c??a,size:"lg",variant:"primary",className:(0,m.cn)("hero-banner-primary-button",o.primaryButton),as:i?.isCustomPrimaryButton?"button":"a",href:Pe,target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:r=>{if(i.link?.startsWith("#")){r.preventDefault();const d=document.querySelector(i.link);d&&(0,R.default)(d,E)}i?.isCustomPrimaryButton&&g?.(t,r,i?.customPrimaryEventId)},...je,children:i.text})]}),s&&s.text&&(0,e.jsxs)(l.Button,{"aria-label":c??a,size:"lg",variant:"link",className:(0,m.cn)("hero-banner-tertiary-button w-auto p-0",o.tertiaryButton),as:s?.isCustomTertiaryButton?"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 d=document.querySelector(s.link);d&&(0,R.default)(d,E)}s?.isCustomTertiaryButton&&_?.(t,r,s?.customTertiaryEventId)},...Ae,children:[s.text,(0,e.jsx)("span",{className:"sr-only",children:c??a})]})]}),(0,e.jsx)("div",{className:Ke({align:w}),children:Ne?.map(r=>(0,e.jsx)("div",{className:"h-12",children:(0,e.jsx)(l.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,m.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,d)=>(0,e.jsxs)(u.default.Fragment,{children:[(0,e.jsx)(l.Text,{size:2,className:(0,m.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}),d<O.length-1&&(0,e.jsx)("div",{className:(0,m.cn)("bg-info-primary w-px")})]},r.title))}),ne&&(0,e.jsx)(be.VideoModal,{visible:ne,videoUrl:n?.isYoutubeVideo?void 0:n?.videoUrl?.url,youTubeId:n?.isYoutubeVideo?n?.youtubeId:void 0,onCloseModal:()=>oe(!1)})]})})});le.displayName="HeroBanner";var Xe=(0,ue.withLayout)(le);
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";"use client";var et=Object.create;var re=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var ot=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var rt=(o,c)=>{for(var f in c)re(o,f,{get:c[f],enumerable:!0})},Le=(o,c,f,H)=>{if(c&&typeof c=="object"||typeof c=="function")for(let T of nt(c))!at.call(o,T)&&T!==f&&re(o,T,{get:()=>c[T],enumerable:!(H=tt(c,T))||H.enumerable});return o};var Ve=(o,c,f)=>(f=o!=null?et(ot(o)):{},Le(c||!o||!o.__esModule?re(f,"default",{value:o,enumerable:!0}):f,o)),it=o=>Le(re({},"__esModule",{value:!0}),o);var ut={};rt(ut,{default:()=>ct});module.exports=it(ut);var n=require("react/jsx-runtime"),i=Ve(require("react")),se=require("swiper/react"),Be=Ve(require("../../helpers/ScrollLoadVideo.js")),C=require("../../helpers/index.js"),S=require("./mediaResolver.js"),p=require("../../components/index.js"),Pe=require("../../hooks/useCarouselPlayback.js"),j=require("../../shared/CarouselControls.js"),E=require("../../shared/track.js"),q=require("../../shared/trackUrlRef.js"),Ne=require("../../hooks/useExposure.js"),_e=require("../AiuiProvider/index.js"),He=require("../VideoModal/index.js"),mt=require("swiper/css");const st=({size:o="base"})=>{const c=o==="lg"?"20":o==="sm"?"16":"18";return(0,n.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,n.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"})})},ie="hero_banner",lt=({data:o,isActive:c,videoRef:f,slideIndex:H,containerSize:T="default",theme:le="light",slideLabel:de,position:J,locale:B,pageHandle:d,onPlayVideo:$,onPrimaryClick:K,onSecondaryClick:y,onTertiaryClick:ce})=>{const{pcImage:O,isVideoLoop:ue=!0,isShowVideo:A,title:w,subtitle:P,label:z,endDate:G,endDate_tz:Q,dateFormat:X,iconArray:k,caption:I,blockLink:L,primaryButton:u,secondaryButton:s,tertiaryButton:m,align:R="left",titleSize:F}=o,U=(0,S.useMediaTier)(),N=(0,S.buildPictureSource)(o),b=(0,S.resolveTierMedia)(o,"lgDesktop","image")?.alt||O?.alt||"",pe=(0,S.resolveTierMedia)(o,U,"video")?.url||"",x=!!N&&!/\.(mp4|mov|webm|m4v)(\?|$)/i.test(N),V=(0,E.resolveComponentMediaType)(A),me=(0,S.resolveTierMedia)(o,U,A?"video":"image")?.id||O?.id||"",ge=`${(0,q.buildTrackingRef)(d??"",V,ie)}_${J}`,ee=a=>a&&B?(0,C.getLocalizedPath)(a,B):a,D=a=>a?(0,q.trackUrlRef)(ee(a),ge):void 0,M=(a,l)=>(0,E.buildClickTrackingProps)({interactive:a,componentType:V,componentName:ie,title:w,description:P,buttonName:l,position:J,creativeId:me});return(0,n.jsxs)("div",{"data-ui-component-id":"HeroBannerSlide",role:"group","aria-roledescription":"slide","aria-label":de,className:(0,C.cn)("text-info-primary relative w-full overflow-hidden transition-colors duration-500",le==="dark"&&"aiui-dark",T==="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:[L&&(0,n.jsx)("a",{className:"absolute inset-0 z-10",href:D(L),tabIndex:-1,"aria-hidden":"true","aria-label":w?.trim()||P?.trim()||b||void 0,...M(!0)}),A?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Be.default,{videoRef:f,src:pe,poster:void 0,className:"absolute inset-0 size-full",videoClassName:"size-full object-cover",muted:!0,loop:ue,playsInline:!0,onPlaying:a=>{a.currentTarget.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:a=>{const l=a.currentTarget;if(l.currentTime>=.5)return;l.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),x&&(0,n.jsx)("div",{"data-video-poster":"true",className:"pointer-events-none absolute inset-0 size-full transition-opacity duration-500",children:(0,n.jsx)(p.Picture,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:H===0?"eager":"lazy",fetchPriority:H===0?"high":"auto",alt:b,source:N})})]}):(0,n.jsx)(p.Picture,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:b,source:N}),(0,n.jsxs)("div",{className:(0,C.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",R==="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,n.jsxs)("div",{className:(0,C.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",R==="center"?"text-center":"laptop:text-left"),children:[z&&(0,n.jsx)(p.Text,{size:2,as:"p",className:(0,C.cn)("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:z}),w&&(0,n.jsx)(p.Heading,{as:F==="4"?"h1":"h2",html:w,size:F?Number(F||"5"):T==="sm"?4:5}),P&&(0,n.jsx)(p.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:P}),G&&(0,n.jsx)("div",{className:"mt-3",children:(0,n.jsx)(p.Countdown,{endDate:G,endDate_tz:Q,dateFormat:X,variant:"spacious",align:R})})]}),(u?.text||s?.text||m?.text)&&(0,n.jsxs)("div",{className:(0,C.cn)("lg-desktop:gap-3 pointer-events-auto flex flex-wrap items-center gap-2",R==="center"?"justify-center":"laptop:justify-start"),children:[s?.isShowPlayVideoButton&&s?.playVideoButtonText?(0,n.jsxs)(p.Button,{size:"lg",variant:"secondary",className:"hero-banner-play-video-button",onClick:()=>$?.(),...M(!0,"video play"),children:[s.playVideoButtonText," ",(0,n.jsx)(st,{size:"lg"})]}):s?.text?(0,n.jsxs)(p.Button,{size:"lg",variant:"secondary",as:s?.isCustomSecondaryButton?"button":"a",href:D(s.link),target:s?.target,rel:s?.target==="_blank"?s?.rel??"noopener noreferrer":s?.rel,onClick:a=>s?.isCustomSecondaryButton&&y?.(o,a,s?.customSecondaryEventId),...M(!!(s.link||s.isCustomSecondaryButton),s.text),children:[s.text,(0,n.jsx)("span",{className:"sr-only",children:w??P})]}):null,u?.text&&(0,n.jsx)(p.Button,{size:"lg",variant:"primary",as:u?.isCustomPrimaryButton?"button":"a",href:D(u.link),target:u?.target,rel:u?.target==="_blank"?u?.rel??"noopener noreferrer":u?.rel,onClick:a=>u?.isCustomPrimaryButton&&K?.(o,a,u?.customPrimaryEventId),...M(!!(u.link||u.isCustomPrimaryButton),u.text),children:u.text}),m?.text&&(0,n.jsxs)(p.Button,{size:"lg",variant:"link",className:"tablet:basis-auto basis-full",as:m?.isCustomTertiaryButton?"button":"a",href:D(m.link),target:m?.target,rel:m?.target==="_blank"?m?.rel??"noopener noreferrer":m?.rel,onClick:a=>m?.isCustomTertiaryButton&&ce?.(o,a,m?.customTertiaryEventId),...M(!!(m.link||m.isCustomTertiaryButton),m.text),children:[m.text,(0,n.jsx)("span",{className:"sr-only",children:w??P})]})]}),k&&k.length>0&&(0,n.jsx)("div",{className:(0,C.cn)("flex items-center gap-2",R==="center"?"justify-center":"justify-start"),children:k.map(a=>(0,n.jsx)("div",{className:"h-12",children:(0,n.jsx)(p.Picture,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",alt:a?.pcImage?.alt||"",source:a?.pcImage?.url})},a?.pcImage?.url||a?.pcImage?.alt))})]}),I&&I.length>0&&(0,n.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:I.map((a,l)=>(0,n.jsxs)(i.default.Fragment,{children:[(0,n.jsx)(p.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:a.title}),l<I.length-1&&(0,n.jsx)("div",{className:"bg-info-primary w-px"})]},a.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"},Ee=i.default.forwardRef(({data:o,className:c,classNames:f={},a11yLabels:H,onPrimaryClick:T,onSecondaryClick:le,onTertiaryClick:de,...J},B)=>{const d=o.items||[],$=o.carousel,K=$?.size??o.size??"default",y={...dt,...H},{locale:ce,pageHandle:O,trackingData:ue}=(0,_e.useAiuiContext)(),A=(0,S.useMediaTier)(),w=(0,q.buildPageGroup)({pageHandle:O,pageGroup:ue?.pageGroup}),P=(0,i.useRef)(null),[z,G]=(0,i.useState)(null),[Q,X]=(0,i.useState)(null),[k,I]=(0,i.useState)(null),[L,u]=(0,i.useState)(null),s=(0,i.useRef)(d);(0,i.useEffect)(()=>{s.current=d});const m=e=>e!==void 0&&e!==999&&e>=5,R=e=>e!==void 0&&e!==999&&e>=1&&e<=30,F=$?.autoplaySeconds,U=e=>{const t=e?.autoplaySeconds;return R(t)?t:m(F)?F:void 0},N=d.length>1&&d.some(e=>U(e)!==void 0),b=(0,i.useRef)(d.map(()=>i.default.createRef())),pe=($?.showArrows??!0)&&d.length>1,x=(0,i.useCallback)((e,t)=>{(0,E.gaTrack)({event:"ga4Event",event_name:e,event_parameters:t})},[]),V=(0,i.useCallback)(e=>s.current[e]?.isShowVideo?"video":"image",[]),me=(0,i.useCallback)((e,t)=>{t==="swipe"&&x("hero_banner_swipe",{to_index:e}),x("hero_banner_slide_view",{index:e,total:s.current.length,media_type:V(e),trigger:t})},[x,V]),ge=(0,i.useCallback)((e,t,r,v="arrow")=>{x("hero_banner_arrow_click",{direction:e,from_index:t,to_index:r,source:v})},[x]),ee=(0,i.useCallback)((e,t)=>{x(e?"hero_banner_pause":"hero_banner_resume",{index:t,media_type:V(t)})},[x,V]),D=(0,i.useCallback)((e,t)=>{const r=s.current[t];r&&(0,E.trackComponentClick)({pageGroup:w,componentType:"video",componentName:ie,position:t+1,buttonName:e?"video pause":"video play",componentTitle:r.title,componentDescription:r.subtitle,creativeId:(0,S.resolveTierMedia)(r,A,"video")?.id||r.pcImage?.id||""})},[w,A]),M=(0,i.useCallback)(e=>{b.current.forEach((r,v)=>{v!==e&&r.current&&(r.current.pause(),r.current.currentTime=0)});const t=b.current[e];t?.current&&(t.current.currentTime=0,t.current.play()?.catch(()=>{}))},[]),{rootRef:a,activeIndex:l,playbackState:be,resetNonce:Ae,announcement:Ie,activeFrameIntervalSec:he,isTimerRunning:Re,handleSwiperInit:Me,handleSlideChange:ze,handleTransitionEnd:Fe,handleSliderFirstMove:De,goToSlide:xe,goToSlideIndex:je,handlePausePlayClick:qe,notifyVideoPlaying:Se,handleFocus:$e,handleBlur:Oe}=(0,Pe.useCarouselPlayback)({frameCount:d.length,resolveFrameIntervalSec:e=>U(d[e]),isAutoplayEnabled:N,swiperRef:P,slideStatusLabel:y.slideStatus,onSlideMediaSync:M,onSlideChange:me,onArrowNavigate:ge,delaysCountdownForVideo:e=>!!s.current[e]?.isShowVideo,onPauseToggle:(e,t)=>{ee(e,t);const r=b.current[t]?.current;r&&(e?r.pause():r.ended||r.play()?.catch(()=>{}))}}),Ge=(0,i.useCallback)(e=>{a.current=e,typeof B=="function"?B(e):B&&(B.current=e)},[B,a]),h=d[l]??d[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,S.resolveTierMedia)(h,A,h.isShowVideo?"video":"image")?.id||h.pcImage?.id)||"";(0,Ne.useExposure)(a,{componentType:Ue,componentName:ie,componentTitle:Ye,componentDescription:h?.subtitle?.trim()||"",creativeId:We,position:1}),(0,i.useEffect)(()=>{G(null),X(null);const e=s.current[l],t=b.current[l]?.current;if(!e?.isShowVideo||!t)return;const r=()=>G(t.ended?"ended":t.paused?"paused":"playing"),v=()=>X(Number.isFinite(t.duration)?t.duration:null),te=()=>{r(),Se(l)};return r(),v(),t.addEventListener("playing",te),t.addEventListener("pause",r),t.addEventListener("ended",r),t.addEventListener("loadedmetadata",v),()=>{t.removeEventListener("playing",te),t.removeEventListener("pause",r),t.removeEventListener("ended",r),t.removeEventListener("loadedmetadata",v)}},[l,Se]),(0,i.useEffect)(()=>{const e=s.current[l];if(!e?.isShowVideo||!e?.isMultiThemeEnabled)return;const t=b.current[l]?.current;if(!t)return;const r=(g,_,ae,ye)=>{if(!(!g||typeof _!="number"||typeof ae!="number"||typeof ye!="number"))return ye>=_&&ye<ae?g:void 0};let v=null;const te=g=>{v=g,I(_=>_&&_.index===l&&_.theme===g?_:{index:l,theme:g})},Ce=g=>{te(r(e.theme_1,e.star_time_1,e.end_time_1,g)??r(e.theme_2,e.star_time_2,e.end_time_2,g)??e.theme??"light")},ne=t;let W=0,Z=0;const ve=typeof ne.requestVideoFrameCallback=="function",Xe=()=>ve?Z!==0:W!==0,fe=()=>{if(!Xe())if(ve){const g=(_,ae)=>{Ce(ae.mediaTime),Z=ne.requestVideoFrameCallback(g)};Z=ne.requestVideoFrameCallback(g)}else{const g=()=>{Ce(t.currentTime),W=requestAnimationFrame(g)};W=requestAnimationFrame(g)}},oe=()=>{ve?(ne.cancelVideoFrameCallback?.(Z),Z=0):(cancelAnimationFrame(W),W=0)},we=()=>{oe(),v&&I({index:l,theme:v})};return t.addEventListener("play",fe),t.addEventListener("pause",oe),t.addEventListener("ended",we),!t.paused&&!t.ended&&fe(),()=>{oe(),t.removeEventListener("play",fe),t.removeEventListener("pause",oe),t.removeEventListener("ended",we)}},[l]),(0,i.useEffect)(()=>{b.current.forEach((e,t)=>{t!==0&&e.current&&(e.current.pause(),e.current.currentTime=0)})},[]),(0,i.useEffect)(()=>{s.current.length!==0&&x("hero_banner_slide_view",{index:0,total:s.current.length,media_type:V(0),trigger:"initial"})},[x,V]);const Ze=!!d[l]?.isShowVideo,Te=he!==void 0,Y=!Te&&Ze&&Q!==null&&Q>5&&z!=="ended"&&z!==null,Je=Te||Y,Ke=Y?z==="paused":be==="STOPPED",Qe=()=>{if(!Y){qe();return}const e=b.current[l]?.current;if(!e)return;const t=!e.paused;t?e.pause():e.play()?.catch(()=>{}),ee(t,l),D(t,l)},ke=k&&k.index===l?k.theme:d[l]?.theme;return(0,n.jsxs)("div",{ref:Ge,role:"region","aria-roledescription":"carousel","aria-label":y.carouselLabel,"data-ui-component-id":"HeroBanner",onFocus:$e,onBlur:Oe,className:(0,C.cn)("hero-banner-carousel group relative w-full overflow-hidden",K==="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),...J,children:[(0,n.jsx)(se.Swiper,{onSwiper:Me,onSlideChange:ze,onSlideChangeTransitionEnd:Fe,onSliderFirstMove:De,slidesPerView:1,loop:!0,initialSlide:0,allowTouchMove:!0,children:d.map((e,t)=>{const r=k&&k.index===t?k.theme:e.theme??"light";return(0,n.jsx)(se.SwiperSlide,{children:({isActive:v})=>(0,n.jsx)(lt,{data:e,isActive:v,slideIndex:t,slideLabel:`${y.slideStatus} ${t+1} / ${d.length}`,videoRef:b.current[t],containerSize:K,theme:r,position:t+1,locale:ce,pageHandle:O,onPlayVideo:()=>u(t),onPrimaryClick:T,onSecondaryClick:le,onTertiaryClick:de})},t)})}),pe&&(0,n.jsx)(j.CarouselArrows,{onPrev:()=>xe("prev"),onNext:()=>xe("next"),prevLabel:y.prevSlide,nextLabel:y.nextSlide}),N&&(0,n.jsx)(j.CarouselProgressControls,{frameCount:d.length,activeIndex:l,resetNonce:Ae,activeFrameIntervalSec:he,isAutoplayEnabled:N,isTimerRunning:Re,onSegmentClick:je,segmentLabel:e=>`${y.slideStatus} ${e+1} / ${d.length}`,classPrefix:"hero-banner",theme:ke}),Je&&(0,n.jsx)(j.CarouselCornerToggle,{isPaused:Ke,onToggle:Qe,pausedLabel:Y?y.playVideo:y.playAutoplay,playingLabel:Y?y.pauseVideo:y.pauseAutoplay,classPrefix:"hero-banner",theme:ke}),(0,n.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:Ie}),L!==null&&d[L]?.secondaryButton&&(0,n.jsx)(He.VideoModal,{visible:!0,videoUrl:d[L].secondaryButton?.isYoutubeVideo?void 0:d[L].secondaryButton?.videoUrl?.url,youTubeId:d[L].secondaryButton?.isYoutubeVideo?d[L].secondaryButton?.youtubeId:void 0,onCloseModal:()=>u(null)})]})});Ee.displayName="HeroBannerCarousel";var ct=Ee;
|
|
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,4 +1,5 @@
|
|
|
1
1
|
import type { Img } from '../../types/props.js';
|
|
2
|
+
export type CircleProgressSemanticName = 'root' | 'ring' | 'inner' | 'image' | 'centerText' | 'centerTextMain' | 'centerTextSub' | 'badge' | 'label';
|
|
2
3
|
export interface CircleProgressProps {
|
|
3
4
|
/** 总阶段数 (1-4) */
|
|
4
5
|
totalSteps?: 1 | 2 | 3 | 4;
|
|
@@ -22,8 +23,28 @@ export interface CircleProgressProps {
|
|
|
22
23
|
laptopSize?: number;
|
|
23
24
|
/** 段之间的间隙(像素),默认 3 */
|
|
24
25
|
gap?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 圆环中间显示的文字(如满减档位优惠 "-£10" / "10% OFF")
|
|
28
|
+
* 与 image 互斥使用:传入 image 时不渲染 centerText
|
|
29
|
+
* 含换行符时按第一行(主文案,大字)和其余行(副文案,小字)分两行展示,如 "£10\nOFF"
|
|
30
|
+
* 字号随断点变化:移动端 12px、tablet 起 16px、desktop 起 18px(副文案比主文案小一档)
|
|
31
|
+
* 可选,默认不渲染(非破坏性:不传时与旧版行为一致)
|
|
32
|
+
*/
|
|
33
|
+
centerText?: string;
|
|
34
|
+
/**
|
|
35
|
+
* 中间图片置灰(未达当前档时赠品图变灰)
|
|
36
|
+
* 可选,默认 false
|
|
37
|
+
*/
|
|
38
|
+
dimmed?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 中间图片上的售罄角标文案(如 "Sold Out")
|
|
41
|
+
* 可选,默认不渲染
|
|
42
|
+
*/
|
|
43
|
+
dimmedBadge?: string;
|
|
25
44
|
/** 自定义类名 */
|
|
26
45
|
className?: string;
|
|
46
|
+
/** 各部分的自定义样式类名,用于覆盖默认样式 */
|
|
47
|
+
classNames?: Partial<Record<CircleProgressSemanticName, string>>;
|
|
27
48
|
}
|
|
28
49
|
/**
|
|
29
50
|
* 分段式圆形进度条组件
|
|
@@ -32,7 +53,7 @@ export interface CircleProgressProps {
|
|
|
32
53
|
* 移动端默认 64px,laptop 以上默认 80px
|
|
33
54
|
*/
|
|
34
55
|
declare const CircleProgress: {
|
|
35
|
-
({ totalSteps, currentStep, image, label, progressColor, labelColor, trackColor, backgroundColor, size, laptopSize, gap, className, }: CircleProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
({ totalSteps, currentStep, image, label, progressColor, labelColor, trackColor, backgroundColor, size, laptopSize, gap, centerText, dimmed, dimmedBadge, className, classNames, }: CircleProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
36
57
|
displayName: string;
|
|
37
58
|
};
|
|
38
59
|
export default CircleProgress;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var H=Object.create;var C=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var V=(e,r)=>{for(var s in r)C(e,s,{get:r[s],enumerable:!0})},z=(e,r,s,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let c of K(r))!U.call(e,c)&&c!==s&&C(e,c,{get:()=>r[c],enumerable:!(i=J(r,c))||i.enumerable});return e};var Z=(e,r,s)=>(s=e!=null?H(Q(e)):{},z(r||!e||!e.__esModule?C(s,"default",{value:e,enumerable:!0}):s,e)),_=e=>z(C({},"__esModule",{value:!0}),e);var re={};V(re,{default:()=>te});module.exports=_(re);var t=require("react/jsx-runtime"),ee=Z(require("react")),m=require("../../components/index.js"),n=require("../../helpers/index.js");const T=({totalSteps:e=4,currentStep:r=0,image:s,label:i,progressColor:c="var(--brand-color-0)",labelColor:E="var(--marketing-color-1)",trackColor:R="#DADCE0",backgroundColor:$="#EAEAEC",size:d=64,laptopSize:g=96,gap:M=3,centerText:N,dimmed:G=!1,dimmedBadge:P,className:I,classNames:o})=>{const f=Math.max(d,g),k=6,a=(f-k)/2,p=f/2,S=ee.useMemo(()=>{const A=(M+k)/a*(180/Math.PI),W=(360-A*e)/e,v=l=>l*Math.PI/180,X=(l,u)=>{const x=l-90,y=u-90,Y=p+a*Math.cos(v(x)),F=p+a*Math.sin(v(x)),L=p+a*Math.cos(v(y)),q=p+a*Math.sin(v(y)),B=u-l>180?1:0;return`M ${Y} ${F} A ${a} ${a} 0 ${B} 1 ${L} ${q}`},w=[];let j=e===2?-45:0;for(let l=0;l<e;l++){const u=j+A/2,x=u+W,y=l<r;w.push({path:X(u,x),isCompleted:y,index:l}),j=x+A/2}return w},[e,r,M,a,p]),[D,...O]=(N||"").split(`
|
|
2
|
+
`),h=O.join(" ");return(0,t.jsxs)("div",{className:(0,n.cn)("relative inline-flex shrink-0 flex-col items-center","laptop:w-[--circle-laptop-size] w-[--circle-size]","laptop:h-[--circle-laptop-height] h-[--circle-height]",I,o?.root),style:{"--circle-size":`${d}px`,"--circle-laptop-size":`${g}px`,"--circle-height":`${i?d+8:d}px`,"--circle-laptop-height":`${i?g+8:g}px`},children:[(0,t.jsxs)("div",{className:(0,n.cn)("laptop:size-[--circle-laptop-size] relative size-[--circle-size]",o?.ring),children:[(0,t.jsxs)("svg",{viewBox:`0 0 ${f} ${f}`,className:(0,n.cn)("absolute inset-0 size-full",i?"translate-y-[-8px]":""),children:[(0,t.jsx)("circle",{cx:p,cy:p,r:a,fill:$,stroke:"none"}),S.map(b=>(0,t.jsx)("path",{d:b.path,fill:"none",stroke:b.isCompleted?c:R,strokeWidth:k,strokeLinecap:"round",style:{transition:"stroke 0.3s ease-in-out"}},b.index))]}),(0,t.jsx)("div",{className:(0,n.cn)("absolute inset-[10px] flex items-center justify-center",i?"translate-y-[-8px]":"",o?.inner),children:(0,t.jsxs)("div",{className:(0,n.cn)("flex size-full items-center justify-center overflow-hidden rounded-full",P&&"relative"),style:{backgroundColor:$},children:[s?.url&&(0,t.jsx)(m.Picture,{className:(0,n.cn)("size-full",G&&"opacity-40 grayscale",o?.image),imgClassName:"h-full object-contain",source:s.url,alt:s.alt||""}),!s?.url&&N&&(0,t.jsxs)("div",{className:(0,n.cn)("text-info-primary flex flex-col items-center justify-center text-center",h?"gap-0.5":"",o?.centerText),children:[(0,t.jsx)(m.Text,{className:(0,n.cn)("desktop:text-[18px] whitespace-nowrap text-[12px] font-semibold leading-none",h&&"font-bold",o?.centerTextMain),html:D}),h&&(0,t.jsx)(m.Text,{className:(0,n.cn)("desktop:text-[14px] whitespace-nowrap text-[10px] font-semibold uppercase leading-none",o?.centerTextSub),html:h})]}),P&&(0,t.jsx)("span",{className:(0,n.cn)("absolute inset-x-0 bottom-0 flex items-center justify-center bg-[rgba(118,120,128,0.9)] px-1 py-px",o?.badge),children:(0,t.jsx)(m.Text,{size:1,className:"text-center text-white",html:P})})]})})]}),i&&(0,t.jsx)("div",{className:(0,n.cn)("absolute bottom-0 left-1/2 flex -translate-x-1/2 items-center justify-center rounded-full px-2 py-0.5",o?.label),style:{backgroundColor:E},children:(0,t.jsx)(m.Text,{className:"text-xs font-medium text-white",html:i})})]})};T.displayName="CircleProgress";var te=T;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CartLineItem, Cart } from './index.js';
|
|
1
|
+
import type { CartLineItem, Cart, MiniCartLabelStyles } from './index.js';
|
|
2
2
|
/**
|
|
3
3
|
* 购物车数据类型 - 复用 MiniCart 的类型定义
|
|
4
4
|
*/
|
|
@@ -29,6 +29,8 @@ export interface MiniCartDialogProps {
|
|
|
29
29
|
copy?: MiniCartDialogCopy;
|
|
30
30
|
/** 各部分的自定义样式类名 */
|
|
31
31
|
classNames?: Partial<Record<MiniCartDialogSemanticName, string>>;
|
|
32
|
+
/** 商品行标签(赠品 / 不参与活动)颜色,与 MiniCart 的 labelStyles 同一结构;不传用默认色 */
|
|
33
|
+
labelStyles?: MiniCartLabelStyles;
|
|
32
34
|
/**
|
|
33
35
|
* 增加商品数量回调
|
|
34
36
|
* @param lineItemId 商品行ID
|
|
@@ -54,7 +56,7 @@ export interface MiniCartDialogProps {
|
|
|
54
56
|
* @description 用于展示购物车商品列表,支持调整商品数量
|
|
55
57
|
*/
|
|
56
58
|
declare const MiniCartDialog: {
|
|
57
|
-
({ open, onOpenChange, cart, copy, classNames, onIncreaseQuantity, onDecreaseQuantity, onQuantityChange, }: MiniCartDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
({ open, onOpenChange, cart, copy, classNames, labelStyles, onIncreaseQuantity, onDecreaseQuantity, onQuantityChange, }: MiniCartDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
58
60
|
displayName: string;
|
|
59
61
|
};
|
|
60
62
|
export default MiniCartDialog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var w=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var P=(n,e)=>{for(var s in e)w(n,s,{get:e[s],enumerable:!0})},L=(n,e,s,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of N(e))!z.call(n,r)&&r!==s&&w(n,r,{get:()=>e[r],enumerable:!(p=I(e,r))||p.enumerable});return n};var M=n=>L(w({},"__esModule",{value:!0}),n);var j={};P(j,{MiniCartDialog:()=>v,default:()=>S});module.exports=M(j);var t=require("react/jsx-runtime"),i=require("../../helpers/index.js"),o=require("../../components/index.js"),D=require("./index.js");const k=({className:n})=>(0,t.jsx)("svg",{className:n,width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M2 6H10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),q=({className:n})=>(0,t.jsx)("svg",{className:n,width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M6 2V10M2 6H10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),T=({item:n,classNames:e,labelStyles:s,onIncrease:p,onDecrease:r})=>{const{merchandise:u,quantity:m,cost:C,readonly:y,productLabel:g,labelVariant:h}=n,{image:d,title:f}=u,{totalAmount:x,subtotalAmount:c}=C,b=f||u.sku||"Product",a=x?.formattedPrice||"",l=c&&x&&parseFloat(c.amount)>parseFloat(x.amount);return(0,t.jsxs)("div",{className:(0,i.cn)("bg-container-primary rounded-box flex items-center gap-2 px-2 py-4","laptop:bg-container-primary laptop:gap-4 laptop:p-4",e?.item),children:[(0,t.jsxs)("div",{className:(0,i.cn)("rounded-box relative size-16 shrink-0 overflow-hidden","laptop:size-20",e?.itemImage),children:[d?.url&&(0,t.jsx)("img",{src:d.url,alt:d.altText||b,className:"size-full object-cover"}),g&&(0,t.jsx)("div",{className:"absolute inset-x-0 bottom-0 flex items-center justify-center px-1 py-px backdrop-blur-sm",style:(0,D.resolveCartLineLabelStyle)(h,s),children:(0,t.jsx)(o.Text,{size:1,className:"text-center text-white",html:g})})]}),(0,t.jsxs)("div",{className:(0,i.cn)("laptop:gap-4 flex flex-1 flex-col gap-2",e?.itemInfo),children:[(0,t.jsx)(o.Text,{as:"p",size:3,className:(0,i.cn)("text-info-primary laptop:text-[16px] line-clamp-2 text-[14px]",e?.itemTitle),children:b}),(0,t.jsxs)("div",{className:"laptop:flex-row laptop:items-center laptop:justify-between flex flex-col items-start gap-1",children:[(0,t.jsxs)("div",{className:(0,i.cn)("flex items-center gap-1",e?.itemPrice),children:[a&&(0,t.jsx)(o.Text,{size:4,className:(0,i.cn)("text-info-primary laptop:text-[18px] text-[16px]",e?.itemCurrentPrice),children:a}),l&&c?.formattedPrice&&(0,t.jsx)(o.Text,{size:4,className:(0,i.cn)("text-info-tertiary laptop:text-[18px] text-[16px] line-through",e?.itemOriginalPrice),children:c.formattedPrice})]}),y?(0,t.jsx)("div",{className:(0,i.cn)("flex items-center",e?.quantityControl),children:(0,t.jsxs)("span",{className:"text-info-primary text-sm font-semibold",children:["x",m]})}):(0,t.jsxs)("div",{className:(0,i.cn)("flex items-center",e?.quantityControl),children:[(0,t.jsx)("button",{type:"button",onClick:r,disabled:m<=0,className:(0,i.cn)("border-lines flex size-8 items-center justify-center border","laptop:size-10","text-info-primary hover:bg-container-secondary-0 transition-colors","disabled:cursor-not-allowed disabled:opacity-50",e?.quantityButton),"aria-label":"Decrease quantity",children:(0,t.jsx)(k,{className:"laptop:size-3 size-[10.67px]"})}),(0,t.jsx)("div",{className:(0,i.cn)("border-lines text-info-primary flex size-8 items-center justify-center border-y text-center text-sm font-semibold","laptop:size-10 laptop:text-base",e?.quantityValue),children:m}),(0,t.jsx)("button",{type:"button",onClick:p,className:(0,i.cn)("border-lines flex size-8 items-center justify-center border","laptop:size-10","text-info-primary hover:bg-container-secondary-0 transition-colors",e?.quantityButton),"aria-label":"Increase quantity",children:(0,t.jsx)(q,{className:"laptop:size-3 size-[10.67px]"})})]})]})]})]})},v=({open:n,onOpenChange:e,cart:s,copy:p,classNames:r={},labelStyles:u,onIncreaseQuantity:m,onDecreaseQuantity:C,onQuantityChange:y})=>{const g=p?.title||"Selected ({count})",h=p?.emptyText||"Your cart is empty",d=s?.lineItems?.reduce((a,l)=>a+(l?.quantity||0),0)||0,f=s?.lineItems||[],x=f.length===0,c=(a,l)=>{m?.(a,l),y?.(a,l+1)},b=(a,l)=>{l>0&&(C?.(a,l),y?.(a,l-1))};return(0,t.jsx)(o.Dialog,{open:n,onOpenChange:e,children:(0,t.jsxs)(o.DialogContent,{className:(0,i.cn)("bg-container-secondary-0 fixed left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 flex-col gap-0 overflow-hidden p-0","rounded-box max-h-[80vh] w-[calc(100%-64px)] min-w-[326px]","laptop:w-full laptop:max-w-[560px] laptop:rounded-box",r?.root),children:[(0,t.jsx)(o.DialogHeader,{className:(0,i.cn)("bg-container-secondary-0 flex flex-row items-start justify-between gap-4 px-4 pb-2 pt-4",r?.header),children:(0,t.jsx)(o.DialogTitle,{asChild:!0,children:(0,t.jsx)(o.Heading,{as:"h3",size:2,className:(0,i.cn)("text-info-primary font-bold",r?.title),children:g.replace("{count}",d.toString())})})}),(0,t.jsx)("div",{className:(0,i.cn)("bg-container-secondary-0 h- flex flex-col gap-2 overflow-y-auto px-4 py-2",r?.content),children:x?(0,t.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,t.jsx)(o.Text,{size:2,className:"text-info-tertiary",children:h})}):(0,t.jsx)("div",{className:(0,i.cn)("flex flex-col gap-2",r?.itemList),children:f.map(a=>(0,t.jsx)(T,{item:a,classNames:r,labelStyles:u,onIncrease:()=>c(a.id,a.quantity),onDecrease:()=>b(a.id,a.quantity)},a.id))})}),(0,t.jsx)("div",{className:"bg-container-secondary-0 h-8 w-full"})]})})};v.displayName="MiniCartDialog";var S=v;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Img } from '../../types/props.js';
|
|
3
|
+
import type { CircleProgressSemanticName } from './CircleProgress.js';
|
|
3
4
|
export type MiniCartSemanticName = 'root' | 'content' | 'cartInfo' | 'cartTitle' | 'cartDescription' | 'priceSection' | 'totalPrice' | 'originalPrice' | 'saveAmount' | 'actionButton' | 'itemsGrid' | 'itemGridContainer' | 'gridItem' | 'gridItemOverlay' | 'expandButton' | 'circleProgress' | 'mobileViewMoreButton';
|
|
4
5
|
/**
|
|
5
6
|
* 圆形进度条配置
|
|
@@ -23,7 +24,34 @@ export interface CircleProgressConfig {
|
|
|
23
24
|
size?: number;
|
|
24
25
|
/** laptop 以上组件尺寸,默认 80 */
|
|
25
26
|
laptopSize?: number;
|
|
27
|
+
/** 圆环中间显示的文字(如满减档位优惠),传入 image 时不渲染;字号随断点 12 / 16 / 18px */
|
|
28
|
+
centerText?: string;
|
|
29
|
+
/** 中间图片置灰(未达当前档时赠品图变灰),默认 false */
|
|
30
|
+
dimmed?: boolean;
|
|
31
|
+
/** 中间图片上的售罄角标文案(如 "Sold Out") */
|
|
32
|
+
dimmedBadge?: string;
|
|
33
|
+
/** 未完成阶段的颜色 */
|
|
34
|
+
trackColor?: string;
|
|
35
|
+
/** 圆环各部分的自定义样式类名(root / ring / inner / image / centerText / centerTextMain / centerTextSub / badge / label) */
|
|
36
|
+
classNames?: Partial<Record<CircleProgressSemanticName, string>>;
|
|
26
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* 商品行标签变体(满赠/满减场景)
|
|
40
|
+
* 不传时沿用旧版橙色内联背景(非破坏性)
|
|
41
|
+
*/
|
|
42
|
+
export type CartLineLabelVariant = 'gift' | 'notEligible';
|
|
43
|
+
/**
|
|
44
|
+
* 商品格子标签颜色配置(直接覆盖内联背景色)
|
|
45
|
+
* 不传时保持旧版颜色
|
|
46
|
+
*/
|
|
47
|
+
export interface MiniCartLabelStyles {
|
|
48
|
+
/** 赠品(Free)标签背景色,默认 rgba(251, 148, 63, 0.6) */
|
|
49
|
+
giftLabelColor?: string;
|
|
50
|
+
/** 不参与活动商品(Not Eligible)标签背景色,默认 rgba(118, 120, 128, 0.6) */
|
|
51
|
+
notEligibleLabelColor?: string;
|
|
52
|
+
}
|
|
53
|
+
/** 商品行标签背景样式:MiniCart 缩略图与 MiniCartDialog 共用,保证两处赠品/不参与标识颜色一致 */
|
|
54
|
+
export declare const resolveCartLineLabelStyle: (variant: CartLineLabelVariant | undefined, labelStyles?: MiniCartLabelStyles) => React.CSSProperties;
|
|
27
55
|
/**
|
|
28
56
|
* 文案配置
|
|
29
57
|
*/
|
|
@@ -48,6 +76,13 @@ export interface MiniCartData {
|
|
|
48
76
|
locale?: string;
|
|
49
77
|
/** 是否显示手机端查看更多按钮,默认 true */
|
|
50
78
|
showMobileViewMore?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* 数量角标显示上限:quantity 超过该值显示 "{max}+"(如 99+)
|
|
81
|
+
* 不传时显示完整数字(旧行为)
|
|
82
|
+
*/
|
|
83
|
+
maxQuantityDisplay?: number;
|
|
84
|
+
/** 标签颜色配置,通过 CSS 变量注入;不传保持旧版颜色 */
|
|
85
|
+
labelStyles?: MiniCartLabelStyles;
|
|
51
86
|
}
|
|
52
87
|
/**
|
|
53
88
|
* 购物车商品项类型
|
|
@@ -57,6 +92,16 @@ export type CartLineItem = {
|
|
|
57
92
|
quantity: number;
|
|
58
93
|
/** 商品标签,如 "Free"、"Gift" 等,显示在商品图片底部 */
|
|
59
94
|
productLabel?: string;
|
|
95
|
+
/**
|
|
96
|
+
* 标签变体:'gift' 赠品(橙色)、'notEligible' 不参与活动商品(灰色)
|
|
97
|
+
* 不传时沿用旧版橙色背景
|
|
98
|
+
*/
|
|
99
|
+
labelVariant?: CartLineLabelVariant;
|
|
100
|
+
/**
|
|
101
|
+
* 只读行:MiniCartDialog 中隐藏数量增减控件(如满赠赠品行数量由后端计算)
|
|
102
|
+
* 默认可调
|
|
103
|
+
*/
|
|
104
|
+
readonly?: boolean;
|
|
60
105
|
cost: {
|
|
61
106
|
totalAmount: {
|
|
62
107
|
amount: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var Lt=Object.create;var v=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var St=Object.getPrototypeOf,It=Object.prototype.hasOwnProperty;var Pt=(i,e)=>{for(var c in e)v(i,c,{get:e[c],enumerable:!0})},G=(i,e,c,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Nt(e))!It.call(i,a)&&a!==c&&v(i,a,{get:()=>e[a],enumerable:!(s=Mt(e,a))||s.enumerable});return i};var U=(i,e,c)=>(c=i!=null?Lt(St(i)):{},G(e||!i||!i.__esModule?v(c,"default",{value:i,enumerable:!0}):c,i)),zt=i=>G(v({},"__esModule",{value:!0}),i);var Dt={};Pt(Dt,{default:()=>Bt});module.exports=zt(Dt);var t=require("react/jsx-runtime"),l=U(require("react")),o=require("../../helpers/index.js"),F=require("../../components/index.js"),x=require("../../components/index.js"),g=require("../../components/index.js"),O=U(require("./CircleProgress.js")),Y=require("../../hooks/useExposure.js");const Tt="cart",At="mini_cart",X=l.forwardRef(({className:i,classNames:e={},data:c,cart:s,progressConfig:a,onRemoveItem:Z,onCheckout:_,onClickToView:M,...$},J)=>{const w=l.useRef(null),{copy:p,theme:N="light",locale:jt="us",showMobileViewMore:K=!0}=c||{};(0,Y.useExposure)(w,{componentType:Tt,componentName:At,componentTitle:p?.itemsInCart||"Mini Cart",componentDescription:p?.description}),l.useImperativeHandle(J,()=>w.current);const Q=p?.emptyCart||"Your Cart is Empty",S=p?.description||"",tt=p?.itemsInCart||"You have selected {count} items",et=p?.total||"Total {total}",Rt=p?.totalWithCoupon||"total: {total} ({subtotal})",I=p?.clickToView||"Click to view cart",ot=p?.buyNowText||"Buy Now",rt=p?.savingText||"Saving {amount}",u=l.useMemo(()=>s?.lineItems||[],[s?.lineItems]),P=u.reduce((r,n)=>r+(n?.quantity||0),0),nt=P===0,at=parseFloat(s?.cost?.totalAmount?.amount||"0"),it=parseFloat(s?.cost?.subtotalAmount?.amount||"0"),lt=parseFloat(s?.cost?.savingAmount?.amount||"0"),st=s?.cost?.totalAmount?.formattedPrice||"",z=it>at?s?.cost?.subtotalAmount?.formattedPrice:null,T=lt>0?s?.cost?.savingAmount?.formattedPrice:null,d=l.useRef(null),[y,ct]=l.useState(!1),[A,B]=l.useState(!1),[D,j]=l.useState(null),R=async r=>{if(!D){j(r);try{await Z?.(r,s)}finally{j(null)}}},[E,C]=l.useState(!1),[pt,dt]=l.useState(0),[ut,mt]=l.useState(0),[H,gt]=l.useState(!1),[V,ft]=l.useState(!0),h=l.useCallback(()=>{const r=d.current;if(!r)return;const{scrollLeft:n,scrollWidth:m,clientWidth:b}=r;gt(n>0),ft(n<m-b-1)},[]),xt=l.useCallback(()=>{h()},[h]);l.useEffect(()=>{h()},[u.length,h]);const ht=r=>{d.current&&(C(!0),dt(r.pageX-d.current.offsetLeft),mt(d.current.scrollLeft))},bt=r=>{if(!E||!d.current)return;r.preventDefault();const m=(r.pageX-d.current.offsetLeft-pt)*1.5;d.current.scrollLeft=ut-m},vt=()=>{C(!1)},wt=()=>{C(!1)},W=r=>{if(d.current){const n=d.current,m=100;n.scrollBy({left:r==="right"?m:-m,behavior:"smooth"})}},k=({className:r})=>(0,t.jsx)("svg",{className:r,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M6 4L10 8L6 12",stroke:"currentColor",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"})}),yt=({className:r})=>(0,t.jsx)("svg",{className:r,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M2.5 5H17.5M8.33333 9.16667V14.1667M11.6667 9.16667V14.1667M3.33333 5L4.16667 16.6667C4.16667 17.1087 4.34226 17.5326 4.65482 17.8452C4.96738 18.1577 5.39131 18.3333 5.83333 18.3333H14.1667C14.6087 18.3333 15.0326 18.1577 15.3452 17.8452C15.6577 17.5326 15.8333 17.1087 15.8333 16.6667L16.6667 5M7.5 5V2.5C7.5 2.27899 7.5878 2.06702 7.74408 1.91074C7.90036 1.75446 8.11232 1.66667 8.33333 1.66667H11.6667C11.8877 1.66667 12.0996 1.75446 12.2559 1.91074C12.4122 2.06702 12.5 2.27899 12.5 2.5V5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),Ct=r=>u.length?(0,t.jsxs)("div",{className:(0,o.cn)("laptop:bg-container-secondary-0 rounded-box-small flex gap-1 p-1",e?.itemsGrid),children:[u.length>=5&&(0,t.jsx)("button",{onClick:()=>W("left"),className:(0,o.cn)("border-border laptop:flex hover:bg-muted-foreground/10 rounded-box-small hidden w-[32px] shrink-0 items-center justify-center px-2 transition-colors",!H&&"laptop:bg-container-secondary-1 laptop:text-transparent laptop:pointer-events-none laptop:-my-1 laptop:-ml-1 laptop:py-1 laptop:pl-1 laptop:rounded-r-none",e?.expandButton,{"laptop:bg-container-secondary-0":r==="dark","laptop:bg-container-primary":r==="dark"&&!H}),"aria-label":"Scroll left to see more items",children:(0,t.jsx)(k,{className:"laptop:size-4 size-5 rotate-180"})}),(0,t.jsxs)("div",{ref:d,onMouseDown:ht,onMouseMove:bt,onMouseUp:vt,onMouseLeave:wt,onScroll:xt,className:(0,o.cn)("scrollbar-hide laptop:gap-1 laptop:w-[256px] laptop:shrink-0 flex w-full gap-1 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",E?"cursor-grabbing":"cursor-grab",e?.itemGridContainer),children:[u.filter(n=>n&&n.id).map(n=>{const b=(n.merchandise||{}).image||{},q=b.url,kt=b.altText||"Product image",L=D===n.id;return(0,t.jsxs)("div",{className:(0,o.cn)("laptop:size-12 bg-container-primary laptop:bg-white rounded-box-small group relative size-16 shrink-0 overflow-hidden",e?.gridItem),children:[q&&(0,t.jsx)("img",{src:q,alt:kt,draggable:!1,className:"rounded-box-small pointer-events-none size-full select-none object-cover"}),L&&(0,t.jsx)("div",{className:"rounded-box-small absolute inset-0 flex items-center justify-center bg-black/50",children:(0,t.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"animate-spin text-white",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",opacity:"0.3"}),(0,t.jsx)("path",{d:"M14 8a6 6 0 0 0-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),(0,t.jsx)("span",{role:"button",onClick:()=>R(n.id),className:(0,o.cn)("laptop:hidden absolute right-[2px] top-[2px] cursor-pointer",L&&"pointer-events-none opacity-0"),"aria-label":"delete",children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"pointer-events-none",children:[(0,t.jsx)("rect",{x:"1.33301",y:"1.33301",width:"13.3333",height:"13.3333",rx:"6.66667",fill:"white"}),(0,t.jsx)("path",{d:"M5.37705 5.28896C5.57234 5.09402 5.88839 5.09442 6.08347 5.28965L8.08602 7.29358L10.0906 5.28896C10.2858 5.09402 10.6026 5.09395 10.7977 5.28896C10.9928 5.48418 10.9926 5.80078 10.7977 5.99607L8.79312 8.00069L10.7964 10.0053C10.9913 10.2007 10.9909 10.5179 10.7957 10.7131C10.6005 10.908 10.2844 10.9074 10.0893 10.7124L8.08602 8.7078L6.08347 10.7103C5.88821 10.9056 5.57155 10.9057 5.37636 10.7103C5.18148 10.515 5.18132 10.1984 5.37636 10.0032L7.37891 8.00069L5.37636 5.99676C5.18119 5.80143 5.18181 5.48423 5.37705 5.28896Z",fill:"#767880"})]})}),n.productLabel&&(0,t.jsx)("div",{className:"absolute inset-x-0 bottom-0 flex items-center justify-center",children:(0,t.jsx)("div",{className:"relative flex w-full items-center justify-center rounded-b-lg px-1 py-px backdrop-blur-sm",style:{backgroundColor:"rgba(251, 148, 63, 0.60)"},children:(0,t.jsx)(x.Text,{size:1,className:"relative text-center text-white",html:n.productLabel})})}),n.quantity>1&&!n.productLabel&&(0,t.jsx)("div",{className:"mini-cart-quantity bg-brand-0 laptop:size-4 absolute bottom-0 right-0 flex size-4 items-center justify-center rounded-full text-white",children:(0,t.jsx)(x.Text,{className:"text-sm",html:String(n.quantity)})}),(0,t.jsx)("div",{role:"button",onClick:()=>R(n.id),className:(0,o.cn)("rounded-box-small absolute inset-0 hidden cursor-pointer items-center justify-center bg-black/60 transition-opacity","laptop:flex laptop:opacity-0 laptop:group-hover:opacity-100",L&&"laptop:hidden",e?.gridItemOverlay),"aria-label":"Remove item",children:(0,t.jsx)(yt,{className:"pointer-events-none size-[20px] text-white"})})]},n.id)}),K&&(0,t.jsx)("button",{onClick:()=>M?.(s),className:(0,o.cn)("bg-container-secondary-0 laptop:hidden flex size-16 shrink-0 items-center justify-center rounded-md",e?.mobileViewMoreButton),"aria-label":I,children:(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-quaternary",children:(0,t.jsx)("path",{d:"M7.5 5L12.5 10L7.5 15",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),u.length>=5&&(0,t.jsx)("button",{onClick:()=>W("right"),className:(0,o.cn)("border-border laptop:flex hover:bg-muted-foreground/10 rounded-box-small hidden w-[32px] shrink-0 items-center justify-center px-2 transition-colors",!V&&"laptop:bg-container-secondary-1 laptop:text-transparent laptop:pointer-events-none laptop:-my-1 laptop:-mr-1 laptop:py-1 laptop:pr-1 laptop:rounded-l-none",e?.expandButton,{"laptop:bg-container-secondary-0":r==="dark","laptop:bg-container-primary":r==="dark"&&!V}),"aria-label":"Scroll right to see more items",children:(0,t.jsx)(k,{className:"laptop:size-4 size-5"})})]}):null,f=!nt&&u.length>0;return(0,t.jsx)("div",{ref:w,className:(0,o.cn)("bg-container-secondary-1 text-info-primary tablet:px-6 laptop:px-12 desktop:px-12 lg-desktop:px-[128px] laptop:py-[16px] flex w-full px-4 py-[12px]","flex-col items-stretch gap-3","laptop:flex-row laptop:items-center laptop:justify-around","laptop:items-center laptop:gap-4","tablet:gap-6 laptop:gap-8",i,e?.root,{"aiui-dark bg-container-primary":N==="dark"}),...$,children:(0,t.jsxs)("div",{className:(0,o.cn)("laptop:flex-row flex w-full flex-col gap-4","laptop:flex-1 laptop:items-center laptop:justify-between","tablet:gap-6 laptop:gap-8",e?.content),children:[(0,t.jsxs)("div",{className:(0,o.cn)("relative flex shrink flex-row items-center gap-2","desktop:gap-4",a&&"laptop:pl-[104px] pl-[72px]"),children:[a&&(0,t.jsx)(O.default,{totalSteps:a.totalSteps,currentStep:a.currentStep,image:a.image,label:a.label,progressColor:a.progressColor,labelColor:a.labelColor,backgroundColor:a.backgroundColor,size:a.size,laptopSize:a.laptopSize,className:(0,o.cn)("absolute bottom-0 left-0","lg-desktop:bottom-auto lg-desktop:top-[-46px] desktop:bottom-auto desktop:top-[-52px]",e?.circleProgress)}),(0,t.jsxs)("div",{className:"laptop:flex-1 flex w-full flex-col",children:[(0,t.jsx)("div",{className:(0,o.cn)("tablet:gap-2 flex flex-col gap-1",e?.cartInfo),children:f?(0,t.jsxs)("div",{className:"flex w-full items-center gap-2",children:[(0,t.jsx)(g.Heading,{size:2,as:"h3",className:(0,o.cn)("",e?.cartTitle),html:tt.replace("{count}",`<span class="text-brand-0">${P||0}</span>`)}),(0,t.jsxs)(g.Heading,{size:1,as:"h5",onClick:()=>{window.innerWidth<1025?ct(!y):M?.(s)},className:(0,o.cn)("flex cursor-pointer items-center gap-1",e?.expandButton),children:[(0,t.jsx)(x.Text,{as:"span",size:1,className:"desktop:block hidden text-nowrap text-[16px] ",html:I}),(0,t.jsx)(k,{className:(0,o.cn)("size-4 transition-transform",y?"laptop:rotate-0 -rotate-90":"laptop:rotate-0 rotate-90")})]})]}):(0,t.jsx)(g.Heading,{as:"h3",size:2,className:(0,o.cn)("tablet:text-2xl text-xl",e?.cartTitle),html:Q})}),S&&(0,t.jsx)(x.Text,{size:2,className:(0,o.cn)("mini-cart-description text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] text-[14px]",e?.cartDescription),html:S})]})]}),f&&(0,t.jsx)("div",{className:(0,o.cn)("laptop:block laptop:shrink",y?"block":"hidden"),children:Ct(N)}),f&&(0,t.jsx)("hr",{className:"laptop:hidden border-lines w-full border-t"}),(0,t.jsxs)("div",{className:(0,o.cn)("tablet:gap-6 laptop:gap-4 laptop:justify-end flex flex-row items-stretch justify-between gap-4",e?.priceSection),children:[(0,t.jsxs)("div",{className:"flex flex-col items-end justify-center",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(g.Heading,{as:"h6",size:2,className:(0,o.cn)("whitespace-nowrap text-nowrap",e?.totalPrice),html:et.replace("{total}",st)}),z&&(0,t.jsx)(g.Heading,{as:"h6",size:2,className:(0,o.cn)("text-info-tertiary whitespace-nowrap line-through",e?.originalPrice),html:z})]}),T&&(0,t.jsx)(g.Heading,{size:2,as:"h6",className:(0,o.cn)("laptop:text-right text-marketing-1 w-full whitespace-nowrap text-nowrap text-left",e?.saveAmount),html:rt.replace("{amount}",T)})]}),(0,t.jsx)(F.Button,{disabled:!f,loading:A,onClick:async()=>{if(!A){B(!0);try{await _?.(s)}finally{B(!1)}}},className:(0,o.cn)("whitespace-nowrap",e?.actionButton),children:ot})]})]})})});X.displayName="MiniCart";var Bt=X;
|
|
1
|
+
"use strict";"use client";var Pt=Object.create;var v=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames;var zt=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty;var At=(i,e)=>{for(var c in e)v(i,c,{get:e[c],enumerable:!0})},U=(i,e,c,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Tt(e))!Bt.call(i,a)&&a!==c&&v(i,a,{get:()=>e[a],enumerable:!(s=It(e,a))||s.enumerable});return i};var X=(i,e,c)=>(c=i!=null?Pt(zt(i)):{},U(e||!i||!i.__esModule?v(c,"default",{value:i,enumerable:!0}):c,i)),Dt=i=>U(v({},"__esModule",{value:!0}),i);var Vt={};At(Vt,{default:()=>Rt,resolveCartLineLabelStyle:()=>$});module.exports=Dt(Vt);var t=require("react/jsx-runtime"),l=X(require("react")),r=require("../../helpers/index.js"),Q=require("../../components/index.js"),f=require("../../components/index.js"),g=require("../../components/index.js"),O=X(require("./CircleProgress.js")),Y=require("../../hooks/useExposure.js");const Et="cart",jt="mini_cart",$=(i,e)=>i==="notEligible"?{backgroundColor:e?.notEligibleLabelColor??"rgba(118, 120, 128, 0.60)"}:i==="gift"?{backgroundColor:e?.giftLabelColor??"rgba(251, 148, 63, 0.60)"}:{backgroundColor:"rgba(251, 148, 63, 0.60)"},F=l.forwardRef(({className:i,classNames:e={},data:c,cart:s,progressConfig:a,onRemoveItem:Z,onCheckout:_,onClickToView:S,...J},K)=>{const y=l.useRef(null),{copy:p,theme:N="light",locale:Ht="us",showMobileViewMore:tt=!0,maxQuantityDisplay:C,labelStyles:et}=c||{};(0,Y.useExposure)(y,{componentType:Et,componentName:jt,componentTitle:p?.itemsInCart||"Mini Cart",componentDescription:p?.description}),l.useImperativeHandle(K,()=>y.current);const ot=p?.emptyCart||"Your Cart is Empty",P=p?.description||"",rt=p?.itemsInCart||"You have selected {count} items",at=p?.total||"Total {total}",Wt=p?.totalWithCoupon||"total: {total} ({subtotal})",I=p?.clickToView||"Click to view cart",nt=p?.buyNowText||"Buy Now",it=p?.savingText||"Saving {amount}",m=l.useMemo(()=>s?.lineItems||[],[s?.lineItems]),T=m.reduce((o,n)=>o+(n?.quantity||0),0),lt=T===0,st=parseFloat(s?.cost?.totalAmount?.amount||"0"),ct=parseFloat(s?.cost?.subtotalAmount?.amount||"0"),pt=parseFloat(s?.cost?.savingAmount?.amount||"0"),dt=s?.cost?.totalAmount?.formattedPrice||"",z=ct>st?s?.cost?.subtotalAmount?.formattedPrice:null,B=pt>0?s?.cost?.savingAmount?.formattedPrice:null,d=l.useRef(null),[w,mt]=l.useState(!1),[A,D]=l.useState(!1),[E,j]=l.useState(null),R=async o=>{if(!E){j(o);try{await Z?.(o,s)}finally{j(null)}}},[V,k]=l.useState(!1),[ut,gt]=l.useState(0),[bt,ft]=l.useState(0),[H,xt]=l.useState(!1),[W,ht]=l.useState(!0),x=l.useCallback(()=>{const o=d.current;if(!o)return;const{scrollLeft:n,scrollWidth:u,clientWidth:h}=o;xt(n>0),ht(n<u-h-1)},[]),vt=l.useCallback(()=>{x()},[x]);l.useEffect(()=>{x()},[m.length,x]);const yt=o=>{d.current&&(k(!0),gt(o.pageX-d.current.offsetLeft),ft(d.current.scrollLeft))},Ct=o=>{if(!V||!d.current)return;o.preventDefault();const u=(o.pageX-d.current.offsetLeft-ut)*1.5;d.current.scrollLeft=bt-u},wt=()=>{k(!1)},kt=()=>{k(!1)},q=o=>{if(d.current){const n=d.current,u=100;n.scrollBy({left:o==="right"?u:-u,behavior:"smooth"})}},L=({className:o})=>(0,t.jsx)("svg",{className:o,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M6 4L10 8L6 12",stroke:"currentColor",strokeWidth:"1.33",strokeLinecap:"round",strokeLinejoin:"round"})}),Lt=({className:o})=>(0,t.jsx)("svg",{className:o,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M2.5 5H17.5M8.33333 9.16667V14.1667M11.6667 9.16667V14.1667M3.33333 5L4.16667 16.6667C4.16667 17.1087 4.34226 17.5326 4.65482 17.8452C4.96738 18.1577 5.39131 18.3333 5.83333 18.3333H14.1667C14.6087 18.3333 15.0326 18.1577 15.3452 17.8452C15.6577 17.5326 15.8333 17.1087 15.8333 16.6667L16.6667 5M7.5 5V2.5C7.5 2.27899 7.5878 2.06702 7.74408 1.91074C7.90036 1.75446 8.11232 1.66667 8.33333 1.66667H11.6667C11.8877 1.66667 12.0996 1.75446 12.2559 1.91074C12.4122 2.06702 12.5 2.27899 12.5 2.5V5",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})}),Mt=o=>m.length?(0,t.jsxs)("div",{className:(0,r.cn)("laptop:bg-container-secondary-0 rounded-box-small flex gap-1 p-1",e?.itemsGrid),children:[m.length>=5&&(0,t.jsx)("button",{onClick:()=>q("left"),className:(0,r.cn)("border-border laptop:flex hover:bg-muted-foreground/10 rounded-box-small hidden w-[32px] shrink-0 items-center justify-center px-2 transition-colors",!H&&"laptop:bg-container-secondary-1 laptop:text-transparent laptop:pointer-events-none laptop:-my-1 laptop:-ml-1 laptop:py-1 laptop:pl-1 laptop:rounded-r-none",e?.expandButton,{"laptop:bg-container-secondary-0":o==="dark","laptop:bg-container-primary":o==="dark"&&!H}),"aria-label":"Scroll left to see more items",children:(0,t.jsx)(L,{className:"laptop:size-4 size-5 rotate-180"})}),(0,t.jsxs)("div",{ref:d,onMouseDown:yt,onMouseMove:Ct,onMouseUp:wt,onMouseLeave:kt,onScroll:vt,className:(0,r.cn)("scrollbar-hide laptop:gap-1 laptop:w-[256px] laptop:shrink-0 flex w-full gap-1 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",V?"cursor-grabbing":"cursor-grab",e?.itemGridContainer),children:[m.filter(n=>n&&n.id).map(n=>{const h=(n.merchandise||{}).image||{},G=h.url,Nt=h.altText||"Product image",M=E===n.id;return(0,t.jsxs)("div",{className:(0,r.cn)("laptop:size-12 bg-container-primary laptop:bg-white rounded-box-small group relative size-16 shrink-0 overflow-hidden",e?.gridItem),children:[G&&(0,t.jsx)("img",{src:G,alt:Nt,draggable:!1,className:"rounded-box-small pointer-events-none size-full select-none object-cover"}),M&&(0,t.jsx)("div",{className:"rounded-box-small absolute inset-0 z-20 flex items-center justify-center bg-black/50",children:(0,t.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"animate-spin text-white",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",opacity:"0.3"}),(0,t.jsx)("path",{d:"M14 8a6 6 0 0 0-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),(0,t.jsx)("span",{role:"button",onClick:()=>R(n.id),className:(0,r.cn)("laptop:hidden absolute right-[2px] top-[2px] cursor-pointer",M&&"pointer-events-none opacity-0"),"aria-label":"delete",children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"pointer-events-none",children:[(0,t.jsx)("rect",{x:"1.33301",y:"1.33301",width:"13.3333",height:"13.3333",rx:"6.66667",fill:"white"}),(0,t.jsx)("path",{d:"M5.37705 5.28896C5.57234 5.09402 5.88839 5.09442 6.08347 5.28965L8.08602 7.29358L10.0906 5.28896C10.2858 5.09402 10.6026 5.09395 10.7977 5.28896C10.9928 5.48418 10.9926 5.80078 10.7977 5.99607L8.79312 8.00069L10.7964 10.0053C10.9913 10.2007 10.9909 10.5179 10.7957 10.7131C10.6005 10.908 10.2844 10.9074 10.0893 10.7124L8.08602 8.7078L6.08347 10.7103C5.88821 10.9056 5.57155 10.9057 5.37636 10.7103C5.18148 10.515 5.18132 10.1984 5.37636 10.0032L7.37891 8.00069L5.37636 5.99676C5.18119 5.80143 5.18181 5.48423 5.37705 5.28896Z",fill:"#767880"})]})}),n.productLabel&&(0,t.jsx)("div",{className:"absolute inset-x-0 bottom-0 flex items-center justify-center",children:(0,t.jsx)("div",{className:"relative flex w-full items-center justify-center rounded-b-lg px-1 py-px backdrop-blur-sm",style:$(n.labelVariant,et),children:(0,t.jsx)(f.Text,{size:1,className:"relative text-center text-white",html:n.productLabel})})}),n.quantity>1&&(0,t.jsx)("div",{className:"mini-cart-quantity bg-brand-0 laptop:size-4 absolute bottom-0 right-0 z-10 flex size-4 items-center justify-center rounded-full text-white",children:(0,t.jsx)(f.Text,{className:"text-sm",html:St(n.quantity)})}),(0,t.jsx)("div",{role:"button",onClick:()=>R(n.id),className:(0,r.cn)("rounded-box-small absolute inset-0 hidden cursor-pointer items-center justify-center bg-black/60 transition-opacity","laptop:flex laptop:opacity-0 laptop:group-hover:opacity-100",M&&"laptop:hidden",e?.gridItemOverlay),"aria-label":"Remove item",children:(0,t.jsx)(Lt,{className:"pointer-events-none size-[20px] text-white"})})]},n.id)}),tt&&(0,t.jsx)("button",{onClick:()=>S?.(s),className:(0,r.cn)("bg-container-secondary-0 laptop:hidden flex size-16 shrink-0 items-center justify-center rounded-md",e?.mobileViewMoreButton),"aria-label":I,children:(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-quaternary",children:(0,t.jsx)("path",{d:"M7.5 5L12.5 10L7.5 15",stroke:"currentColor",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),m.length>=5&&(0,t.jsx)("button",{onClick:()=>q("right"),className:(0,r.cn)("border-border laptop:flex hover:bg-muted-foreground/10 rounded-box-small hidden w-[32px] shrink-0 items-center justify-center px-2 transition-colors",!W&&"laptop:bg-container-secondary-1 laptop:text-transparent laptop:pointer-events-none laptop:-my-1 laptop:-mr-1 laptop:py-1 laptop:pr-1 laptop:rounded-l-none",e?.expandButton,{"laptop:bg-container-secondary-0":o==="dark","laptop:bg-container-primary":o==="dark"&&!W}),"aria-label":"Scroll right to see more items",children:(0,t.jsx)(L,{className:"laptop:size-4 size-5"})})]}):null,b=!lt&&m.length>0,St=o=>C!==void 0&&o>C?`${C}+`:String(o);return(0,t.jsx)("div",{ref:y,className:(0,r.cn)("bg-container-secondary-1 text-info-primary tablet:px-6 laptop:px-12 desktop:px-12 lg-desktop:px-[128px] laptop:py-[16px] flex w-full px-4 py-[12px]","flex-col items-stretch gap-3","laptop:flex-row laptop:items-center laptop:justify-around","laptop:items-center laptop:gap-4","tablet:gap-6 laptop:gap-8",i,e?.root,{"aiui-dark bg-container-primary":N==="dark"}),...J,children:(0,t.jsxs)("div",{className:(0,r.cn)("laptop:flex-row flex w-full flex-col gap-4","laptop:flex-1 laptop:items-center laptop:justify-between","tablet:gap-6 laptop:gap-8",e?.content),children:[(0,t.jsxs)("div",{className:(0,r.cn)("relative flex shrink flex-row items-center gap-2","desktop:gap-4",a&&"laptop:pl-[104px] pl-[72px]"),children:[a&&(0,t.jsx)(O.default,{totalSteps:a.totalSteps,currentStep:a.currentStep,image:a.image,label:a.label,progressColor:a.progressColor,labelColor:a.labelColor,backgroundColor:a.backgroundColor,size:a.size,laptopSize:a.laptopSize,centerText:a.centerText,dimmed:a.dimmed,dimmedBadge:a.dimmedBadge,trackColor:a.trackColor,classNames:a.classNames,className:(0,r.cn)("absolute bottom-0 left-0","lg-desktop:bottom-auto lg-desktop:top-[-46px] desktop:bottom-auto desktop:top-[-52px]",e?.circleProgress)}),(0,t.jsxs)("div",{className:"laptop:flex-1 flex w-full flex-col",children:[(0,t.jsx)("div",{className:(0,r.cn)("tablet:gap-2 flex flex-col gap-1",e?.cartInfo),children:b?(0,t.jsxs)("div",{className:"flex w-full items-center gap-2",children:[(0,t.jsx)(g.Heading,{size:2,as:"h3",className:(0,r.cn)("",e?.cartTitle),html:rt.replace("{count}",`<span class="text-brand-0">${T||0}</span>`)}),(0,t.jsxs)(g.Heading,{size:1,as:"h5",onClick:()=>{window.innerWidth<1025?mt(!w):S?.(s)},className:(0,r.cn)("flex cursor-pointer items-center gap-1",e?.expandButton),children:[(0,t.jsx)(f.Text,{as:"span",size:1,className:"desktop:block hidden text-nowrap text-[16px] ",html:I}),(0,t.jsx)(L,{className:(0,r.cn)("size-4 transition-transform",w?"laptop:rotate-0 -rotate-90":"laptop:rotate-0 rotate-90")})]})]}):(0,t.jsx)(g.Heading,{as:"h3",size:2,className:(0,r.cn)("tablet:text-2xl text-xl",e?.cartTitle),html:ot})}),P&&(0,t.jsx)(f.Text,{size:2,className:(0,r.cn)("mini-cart-description text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] text-[14px]",e?.cartDescription),html:P})]})]}),b&&(0,t.jsx)("div",{className:(0,r.cn)("laptop:block laptop:shrink",w?"block":"hidden"),children:Mt(N)}),b&&(0,t.jsx)("hr",{className:"laptop:hidden border-lines w-full border-t"}),(0,t.jsxs)("div",{className:(0,r.cn)("tablet:gap-6 laptop:gap-4 laptop:justify-end flex flex-row items-stretch justify-between gap-4",e?.priceSection),children:[(0,t.jsxs)("div",{className:"flex flex-col items-end justify-center",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(g.Heading,{as:"h6",size:2,className:(0,r.cn)("whitespace-nowrap text-nowrap",e?.totalPrice),html:at.replace("{total}",dt)}),z&&(0,t.jsx)(g.Heading,{as:"h6",size:2,className:(0,r.cn)("text-info-tertiary whitespace-nowrap line-through",e?.originalPrice),html:z})]}),B&&(0,t.jsx)(g.Heading,{size:2,as:"h6",className:(0,r.cn)("laptop:text-right text-marketing-1 w-full whitespace-nowrap text-nowrap text-left",e?.saveAmount),html:it.replace("{amount}",B)})]}),(0,t.jsx)(Q.Button,{disabled:!b,loading:A,onClick:async()=>{if(!A){D(!0);try{await _?.(s)}finally{D(!1)}}},className:(0,r.cn)("whitespace-nowrap",e?.actionButton),children:nt})]})]})})});F.displayName="MiniCart";var Rt=F;
|
|
@@ -153,9 +153,9 @@ export type { AccessoryShelfProps, AccessoryProductData, AccessoryCardSemanticNa
|
|
|
153
153
|
export { default as ImageTextOverlay } from './ImageTextOverlay/index.js';
|
|
154
154
|
export type { ImageTextOverlayProps, ImageTextOverlayData, ImageTextOverlayItem, ImageTextOverlaySemanticName, ImageTextOverlayBackgroundImage, } from './ImageTextOverlay/types.js';
|
|
155
155
|
export { default as MiniCart } from './MiniCart/index.js';
|
|
156
|
-
export type { Cart, CartLineItem, MiniCartData, MiniCartProps, CircleProgressConfig } from './MiniCart/index.js';
|
|
156
|
+
export type { Cart, CartLineItem, MiniCartData, MiniCartProps, CircleProgressConfig, MiniCartCopy, CartLineLabelVariant, MiniCartLabelStyles, } from './MiniCart/index.js';
|
|
157
157
|
export { default as MiniCartCircleProgress } from './MiniCart/CircleProgress.js';
|
|
158
|
-
export type { CircleProgressProps as MiniCartCircleProgressProps } from './MiniCart/CircleProgress.js';
|
|
158
|
+
export type { CircleProgressProps as MiniCartCircleProgressProps, CircleProgressSemanticName as MiniCartCircleProgressSemanticName, } from './MiniCart/CircleProgress.js';
|
|
159
159
|
export { default as MiniCartDialog, MiniCartDialog as MiniCartDialogComponent } from './MiniCart/MiniCartDialog.js';
|
|
160
160
|
export type { MiniCartDialogProps, MiniCartDialogCopy, MiniCartDialogSemanticName, CartData, } from './MiniCart/MiniCartDialog.js';
|
|
161
161
|
export { default as WebPushPopup } from './WebPushPopup/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var yt=Object.create;var d=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var Pt=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty;var gt=(t,o)=>{for(var i in o)d(t,i,{get:o[i],enumerable:!0})},S=(t,o,i,y)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of ht(o))!Ct.call(t,p)&&p!==i&&d(t,p,{get:()=>o[p],enumerable:!(y=St(o,p))||y.enumerable});return t};var e=(t,o,i)=>(i=t!=null?yt(Pt(t)):{},S(o||!t||!t.__esModule?d(i,"default",{value:t,enumerable:!0}):i,t)),Mt=t=>S(d({},"__esModule",{value:!0}),t);var Tt={};gt(Tt,{AccessoriesProductGrid:()=>a.AccessoriesProductGrid,AccessoryProductCard:()=>m.AccessoryProductCard,AccessoryShelf:()=>m.default,AccordionCards:()=>G.default,ActiveShelf:()=>$e.default,ActivityMechanism:()=>g.default,ActivitySchedule:()=>h.default,AddToCartSuccessPopover:()=>a.AddToCartSuccessPopover,AiuiProvider:()=>_.default,AnchorNavigation:()=>Ye.default,AplusDesc:()=>Te.default,BenefitsTab:()=>xe.default,BizProductProvider:()=>c.default,BrandCardLink:()=>De.default,BrandEquity:()=>M.default,BuyOneGetOneShelf:()=>Ze.default,CartActionButtons:()=>he.default,CartGiftSection:()=>r.CartGiftSection,CartItemRow:()=>r.CartItemRow,CartPerksSection:()=>r.CartPerksSection,CartPriceSummary:()=>r.CartPriceSummary,CartSummaryHeader:()=>r.CartSummaryHeader,CartThirdPartyBanner:()=>r.CartThirdPartyBanner,Category:()=>F.default,CreativeModule:()=>X.default,CreditCouponRedeem:()=>ye.default,CreditsProductCard:()=>n.CreditsProductCard,CreditsShelf:()=>n.default,DownLoad:()=>be.default,Evaluate:()=>D.default,EventSchedule:()=>Qe.default,Faq:()=>E.default,FeatureCards:()=>Le.default,FeatureShowcase:()=>He.default,FeaturedBlogPosts:()=>Ve.default,Features:()=>Be.default,FootCharger:()=>Ae.default,FooterNavigation:()=>z.default,GiftBox:()=>ve.default,GiftShelf:()=>P.default,GiftTierShelf:()=>C.default,Graphic:()=>O.default,GraphicAttractionBlock:()=>R.default,GraphicMore:()=>Me.default,GraphicOverlay:()=>Z.default,HeaderNavigation:()=>q.default,HeroBanner:()=>j.default,IPC_SEARCH_PAGE:()=>f.IPC_SEARCH_PAGE,IPRedirect:()=>vt,ImageOverlayShelf:()=>at.default,ImageTextFeature:()=>we.default,ImageTextOverlay:()=>it.default,ImageWithText:()=>ke.default,Ksp:()=>Oe.default,MainProductArea:()=>a.MainProductArea,Marquee:()=>k.default,MarqueeImageContent:()=>s.MarqueeImageContent,MarqueeItem:()=>s.MarqueeItem,MarqueeReview:()=>W.default,MarqueeTextContent:()=>s.MarqueeTextContent,MediaEndorsement:()=>rt.default,MediaPlayerBase:()=>w.default,MediaPlayerMulti:()=>V.default,MediaPlayerSticky:()=>L.default,MediaSceneSwitcher:()=>ze.default,MediaSceneSwitcherV2:()=>Ke.default,MediaShelf:()=>et.default,MediaTextOverlay:()=>ot.default,MemberEquity:()=>B.default,MiniCart:()=>st.default,MiniCartCircleProgress:()=>pt.default,MiniCartDialog:()=>x.default,MiniCartDialogComponent:()=>x.MiniCartDialog,ModalCoupon:()=>ut.default,ModalRegisterSubscribe:()=>nt.default,ModalSmsSubscribe:()=>mt.default,ModalSubscribeConfirm:()=>lt.default,ModalVerify:()=>xt.default,MultiLayoutGraphicBlock:()=>H.default,NotifyMeDialog:()=>Pe.NotifyMeDialog,PAYLOAD_COMPONENT_MAP:()=>Bt,PaidShipping:()=>Se.default,ProductActions:()=>re.default,ProductBanner:()=>ne.default,ProductBenefits:()=>ae.default,ProductBenefitsTabs:()=>oe.default,ProductBundle:()=>fe.default,ProductCompare:()=>Ge.default,ProductCoupon:()=>ce.default,ProductFreeGift:()=>se.default,ProductFunctionFreeGift:()=>pe.default,ProductGallery:()=>ue.default,ProductGridBox:()=>le.default,ProductHero:()=>Re.default,ProductHighlight:()=>ie.default,ProductLottery:()=>je.default,ProductNav:()=>_e.default,ProductOptions:()=>de.default,ProductPaidShipping:()=>ge.default,ProductServiceBenefits:()=>Ce.default,ProductSummary:()=>me.default,PromoBanner:()=>a.PromoBanner,PromotionalBar:()=>Je.default,PurchaseBar:()=>te.default,SceneProductCard:()=>l.SceneProductCard,SceneShelf:()=>l.default,SceneShelfV2:()=>u.default,SceneShelfV2ProductCard:()=>u.SceneShelfV2ProductCard,SceneShelfV3:()=>tt.default,SearchPage:()=>K.default,SearchPageTabType:()=>f.SearchPageTabType,SecondaryBanner:()=>Xe.default,SectionHeader:()=>a.SectionHeader,SelectStore:()=>Ie.default,ShelfDisplay:()=>b.default,ShelfDisplayHorizontal:()=>A.default,Slogan:()=>T.default,Spacer:()=>I.default,Specs:()=>$.default,SpecsComparison:()=>qe.default,SwiperBox:()=>J.default,TabGroup:()=>ee.default,TabWithImage:()=>Ee.default,Tabs:()=>Y.default,TabsWithMedia:()=>Ne.default,ThreeDCarousel:()=>Ue.default,Title:()=>v.default,VideoFeature:()=>We.default,VideoModal:()=>Q.VideoModal,WebPushPopup:()=>dt.default,WheelLottery:()=>Fe.default,WhyChoose:()=>N.default,useAiuiContext:()=>ct.useAiuiContext,useBizProductContext:()=>c.useBizProductContext,useEmarsysWebPush:()=>ft.useEmarsysWebPush,withLayout:()=>U.withLayout});module.exports=Mt(Tt);var a=require("./AccessoriesShelf/index.js"),h=e(require("./ActivitySchedule/index.js")),P=e(require("./GiftShelf/index.js")),C=e(require("./GiftTierShelf/index.js")),g=e(require("./ActivityMechanism/index.js")),M=e(require("./BrandEquity/index.js")),B=e(require("./MemberEquity/index.js")),T=e(require("./Slogan/index.js")),v=e(require("./Title/index.js")),I=e(require("./Spacer/index.js")),b=e(require("./ShelfDisplay/index.js")),A=e(require("./ShelfDisplayHorizontal/index.js")),D=e(require("./Evaluate/index.js")),F=e(require("./Category/index.js")),j=e(require("./HeroBanner/index.js")),G=e(require("./AccordionCards/index.js")),O=e(require("./Graphic/index.js")),w=e(require("./MediaPlayerBase/index.js")),L=e(require("./MediaPlayerSticky/index.js")),V=e(require("./MediaPlayerMulti/index.js")),k=e(require("./Marquee/index.js")),W=e(require("./MarqueeReview/index.js")),N=e(require("./WhyChoose/index.js")),E=e(require("./Faq/index.js")),s=require("./Marquee/index.js"),H=e(require("./MultiLayoutGraphicBlock/index.js")),R=e(require("./GraphicAttractionBlock/index.js")),q=e(require("./HeaderNavigation/index.js")),z=e(require("./FooterNavigation/index.js")),K=e(require("./SearchPage/index.js")),f=require("./SearchPage/types.js"),U=require("../shared/Styles.js"),_=e(require("./AiuiProvider/index.js")),Y=e(require("./Tabs/index.js")),J=e(require("./SwiperBox/index.js")),Q=require("./VideoModal/index.js"),X=e(require("./CreativeModule/index.js")),Z=e(require("./GraphicOverlay/index.js")),$=e(require("./Specs/index.js")),ee=e(require("./TabsGroup/index.js")),c=e(require("./Listing/BizProductProvider.js")),te=e(require("./Listing/components/PurchaseBar/index.js")),re=e(require("./Listing/components/PurchaseBar/ProductActions/index.js")),oe=e(require("./Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js")),ae=e(require("./Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js")),ie=e(require("./Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js")),se=e(require("./Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js")),pe=e(require("./Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js")),de=e(require("./Listing/components/ProductCard/ProductDetail/ProductOptions/index.js")),fe=e(require("./Listing/components/ProductCard/ProductDetail/ProductBundle/index.js")),ce=e(require("./Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js")),ne=e(require("./Listing/components/ProductCard/ProductDetail/ProductBanner/index.js")),le=e(require("./Listing/components/ProductCard/ProductGridBox.js")),ue=e(require("./Listing/components/ProductCard/ProductGallery/index.js")),me=e(require("./Listing/components/ProductCard/ProductSummary/index.js")),xe=e(require("./Listing/components/ProductCard/ProductDetail/BenefitsTab.js")),ye=e(require("./Listing/components/ProductCard/ProductDetail/CreditCouponRedeem/index.js")),Se=e(require("./Listing/components/PaidShipping/index.js")),he=e(require("./Listing/components/CartActionButtons/index.js")),Pe=require("./NotifyMeDialog/index.js"),Ce=e(require("./Listing/components/ProductCard/ProductDetail/ProductServiceBenefits/index.js")),ge=e(require("./Listing/components/ProductCard/ProductPaidShipping/index.js")),Me=e(require("./GraphicMore/index.js")),Be=e(require("./Features/index.js")),Te=e(require("./AplusDesc/index.js")),ve=e(require("./GiftBox/index.js")),Ie=e(require("./SelectStore/index.js")),be=e(require("./DownLoad/index.js")),Ae=e(require("./FootCharger/index.js")),De=e(require("./BrandCardLink/index.js")),vt=e(require("./IPRedirect/index.js")),Fe=e(require("./WheelLottery/index.js")),je=e(require("./ProductLottery/index.js")),Ge=e(require("./ProductCompare/index.js")),Oe=e(require("./Ksp/index.js")),we=e(require("./ImageTextFeature/index.js")),Le=e(require("./FeatureCards/index.js")),Ve=e(require("./FeaturedBlogPosts/index.js")),ke=e(require("./ImageWithText/index.js")),We=e(require("./VideoFeature/index.js")),Ne=e(require("./TabsWithMedia/index.js")),Ee=e(require("./TabWithImage/index.js")),He=e(require("./FeatureShowcase/index.js")),Re=e(require("./ProductHero/index.js")),qe=e(require("./SpecsComparison/index.js")),ze=e(require("./MediaSceneSwitcher/index.js")),Ke=e(require("./MediaSceneSwitcherV2/index.js")),Ue=e(require("./ThreeDCarousel/index.js")),_e=e(require("./ProductNav/index.js")),Ye=e(require("./AnchorNavigation/index.js")),Je=e(require("./PromotionalBar/index.js")),Qe=e(require("./EventSchedule/index.js")),Xe=e(require("./SecondaryBanner/index.js")),Ze=e(require("./BuyOneGetOneShelf/index.js")),$e=e(require("./ActiveShelf/index.js")),et=e(require("./MediaShelf/index.js")),n=e(require("./CreditsShelf/index.js")),l=e(require("./SceneShelf/index.js")),u=e(require("./SceneShelfV2/index.js")),tt=e(require("./SceneShelfV3/index.js")),rt=e(require("./MediaEndorsement/index.js")),ot=e(require("./MediaTextOverlay/index.js")),at=e(require("./ImageOverlayShelf/index.js")),m=e(require("./AccessoriesShelf/components/AccessoryShelf/index.js")),it=e(require("./ImageTextOverlay/index.js")),st=e(require("./MiniCart/index.js")),pt=e(require("./MiniCart/CircleProgress.js")),x=e(require("./MiniCart/MiniCartDialog.js")),dt=e(require("./WebPushPopup/index.js")),ft=require("../hooks/useEmarsysWebPush.js"),r=require("./CartDetail/index.js"),ct=require("./AiuiProvider/index.js"),nt=e(require("./ModalRegisterSubscribe/index.js")),lt=e(require("./ModalSubscribeConfirm/index.js")),ut=e(require("./ModalCoupon/index.js")),mt=e(require("./ModalSmsSubscribe/index.js")),xt=e(require("./ModalVerify/index.js"));const Bt={ActivityMechanism:"ActivityMechanism",ActivitySchedule:"ActivitySchedule",AnchorNavigation:"AnchorNavigation",EventSchedule:"EventSchedule",FeatureCards:"FeatureCards",GiftShelf:"GiftShelf",GiftTierShelf:"GiftTierShelf",ImageTextFeature:"ImageTextFeature",ImageTextOverlay:"ImageTextOverlay",ImageWithText:"ImageWithText",MarqueeReview:"MarqueeReview",MediaSceneSwitcher:"MediaSceneSwitcher",ProductCompare:"ProductCompare",ProductHero:"ProductHero",ProductNav:"ProductNav",PromotionalBar:"PromotionalBar",TabsWithMedia:"TabsWithMedia",ThreeDCarousel:"ThreeDCarousel",VideoFeature:"VideoFeature","ipc-accordioncards":"AccordionCards","ipc-active-shelf":"ActiveShelf","ipc-add-to-cart-success-popover":"AddToCartSuccessPopover","ipc-aplusdesc":"AplusDesc","ipc-banner":"HeroBanner","ipc-bogo-shelf":"BuyOneGetOneShelf","ipc-brand-card-link":"BrandCardLink","ipc-brand-equity":"BrandEquity","ipc-category":"Category","ipc-creativemodule":"CreativeModule","ipc-credits-shelf":"CreditsShelf","ipc-download":"DownLoad","ipc-evaluate":"Evaluate","ipc-faq":"Faq","ipc-features":"Features","ipc-featured-blog-posts":"FeaturedBlogPosts","ipc-footcharger":"FootCharger","ipc-ga-block":"GraphicAttractionBlock","ipc-giftbox":"GiftBox","ipc-graphic":"Graphic","ipc-graphicmore":"GraphicMore","ipc-graphicoverlay":"GraphicOverlay","ipc-image-overlay-shelf":"ImageOverlayShelf","ipc-marquee":"Marquee","ipc-media-endorsement":"MediaEndorsement","ipc-media-shelf":"MediaShelf","ipc-media-scene-switcher-v2":"MediaSceneSwitcherV2","ipc-media-text-overlay":"MediaTextOverlay","ipc-mediaplayerbase":"MediaPlayerBase","ipc-mediaplayermulti":"MediaPlayerMulti","ipc-mediaplayersticky":"MediaPlayerSticky","ipc-member-equity":"MemberEquity","ipc-mini-cart":"MiniCart","ipc-mlg-block":"MultiLayoutGraphicBlock","ipc-notify-me-dialog":"NotifyMeDialog","ipc-product-lottery":"ProductLottery","ipc-scene-shelf":"SceneShelf","ipc-scene-shelf-v2":"SceneShelfV2","ipc-scene-shelf-v3":"SceneShelfV3","ipc-search-page":"SearchPage","ipc-search-page-tabs":"SearchPage","ipc-secondary-banner":"SecondaryBanner","ipc-selectstore":"SelectStore","ipc-shelfdisplay":"ShelfDisplay","ipc-shelfdisplay-horizontal":"ShelfDisplayHorizontal","ipc-slogan":"Slogan","ipc-spacer":"Spacer","ipc-specs":"Specs","ipc-tabs":"Tabs","ipc-title":"Title","ipc-wheel-lottery":"WheelLottery","ipc-whychoose":"WhyChoose",ksp:"Ksp",modalCoupon:"ModalCoupon",modalRegisterSubscribe:"ModalRegisterSubscribe",modalSmsSubscribe:"ModalSmsSubscribe",modalSubscribeConfirm:"ModalSubscribeConfirm",modalVerify:"ModalVerify"};
|
|
1
|
+
"use strict";var yr=Object.create;var d=Object.defineProperty;var Sr=Object.getOwnPropertyDescriptor;var hr=Object.getOwnPropertyNames;var Pr=Object.getPrototypeOf,Cr=Object.prototype.hasOwnProperty;var gr=(r,o)=>{for(var i in o)d(r,i,{get:o[i],enumerable:!0})},S=(r,o,i,y)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of hr(o))!Cr.call(r,p)&&p!==i&&d(r,p,{get:()=>o[p],enumerable:!(y=Sr(o,p))||y.enumerable});return r};var e=(r,o,i)=>(i=r!=null?yr(Pr(r)):{},S(o||!r||!r.__esModule?d(i,"default",{value:r,enumerable:!0}):i,r)),Mr=r=>S(d({},"__esModule",{value:!0}),r);var Tr={};gr(Tr,{AccessoriesProductGrid:()=>a.AccessoriesProductGrid,AccessoryProductCard:()=>m.AccessoryProductCard,AccessoryShelf:()=>m.default,AccordionCards:()=>G.default,ActiveShelf:()=>$e.default,ActivityMechanism:()=>g.default,ActivitySchedule:()=>h.default,AddToCartSuccessPopover:()=>a.AddToCartSuccessPopover,AiuiProvider:()=>_.default,AnchorNavigation:()=>Ye.default,AplusDesc:()=>Te.default,BenefitsTab:()=>xe.default,BizProductProvider:()=>c.default,BrandCardLink:()=>De.default,BrandEquity:()=>M.default,BuyOneGetOneShelf:()=>Ze.default,CartActionButtons:()=>he.default,CartGiftSection:()=>t.CartGiftSection,CartItemRow:()=>t.CartItemRow,CartPerksSection:()=>t.CartPerksSection,CartPriceSummary:()=>t.CartPriceSummary,CartSummaryHeader:()=>t.CartSummaryHeader,CartThirdPartyBanner:()=>t.CartThirdPartyBanner,Category:()=>F.default,CreativeModule:()=>X.default,CreditCouponRedeem:()=>ye.default,CreditsProductCard:()=>n.CreditsProductCard,CreditsShelf:()=>n.default,DownLoad:()=>be.default,Evaluate:()=>D.default,EventSchedule:()=>Qe.default,Faq:()=>E.default,FeatureCards:()=>Ve.default,FeatureShowcase:()=>He.default,FeaturedBlogPosts:()=>we.default,Features:()=>Be.default,FootCharger:()=>Ae.default,FooterNavigation:()=>z.default,GiftBox:()=>ve.default,GiftShelf:()=>P.default,GiftTierShelf:()=>C.default,Graphic:()=>L.default,GraphicAttractionBlock:()=>R.default,GraphicMore:()=>Me.default,GraphicOverlay:()=>Z.default,HeaderNavigation:()=>q.default,HeroBanner:()=>j.default,IPC_SEARCH_PAGE:()=>f.IPC_SEARCH_PAGE,IPRedirect:()=>vr,ImageOverlayShelf:()=>ar.default,ImageTextFeature:()=>Oe.default,ImageTextOverlay:()=>ir.default,ImageWithText:()=>ke.default,Ksp:()=>Le.default,MainProductArea:()=>a.MainProductArea,Marquee:()=>k.default,MarqueeImageContent:()=>s.MarqueeImageContent,MarqueeItem:()=>s.MarqueeItem,MarqueeReview:()=>N.default,MarqueeTextContent:()=>s.MarqueeTextContent,MediaEndorsement:()=>tr.default,MediaPlayerBase:()=>O.default,MediaPlayerMulti:()=>w.default,MediaPlayerSticky:()=>V.default,MediaSceneSwitcher:()=>ze.default,MediaSceneSwitcherV2:()=>Ke.default,MediaShelf:()=>er.default,MediaTextOverlay:()=>or.default,MemberEquity:()=>B.default,MiniCart:()=>sr.default,MiniCartCircleProgress:()=>pr.default,MiniCartDialog:()=>x.default,MiniCartDialogComponent:()=>x.MiniCartDialog,ModalCoupon:()=>ur.default,ModalRegisterSubscribe:()=>nr.default,ModalSmsSubscribe:()=>mr.default,ModalSubscribeConfirm:()=>lr.default,ModalVerify:()=>xr.default,MultiLayoutGraphicBlock:()=>H.default,NotifyMeDialog:()=>Pe.NotifyMeDialog,PAYLOAD_COMPONENT_MAP:()=>Br,PaidShipping:()=>Se.default,ProductActions:()=>te.default,ProductBanner:()=>ne.default,ProductBenefits:()=>ae.default,ProductBenefitsTabs:()=>oe.default,ProductBundle:()=>fe.default,ProductCompare:()=>Ge.default,ProductCoupon:()=>ce.default,ProductFreeGift:()=>se.default,ProductFunctionFreeGift:()=>pe.default,ProductGallery:()=>ue.default,ProductGridBox:()=>le.default,ProductHero:()=>Re.default,ProductHighlight:()=>ie.default,ProductLottery:()=>je.default,ProductNav:()=>_e.default,ProductOptions:()=>de.default,ProductPaidShipping:()=>ge.default,ProductServiceBenefits:()=>Ce.default,ProductSummary:()=>me.default,PromoBanner:()=>a.PromoBanner,PromotionalBar:()=>Je.default,PurchaseBar:()=>re.default,SceneProductCard:()=>l.SceneProductCard,SceneShelf:()=>l.default,SceneShelfV2:()=>u.default,SceneShelfV2ProductCard:()=>u.SceneShelfV2ProductCard,SceneShelfV3:()=>rr.default,SearchPage:()=>K.default,SearchPageTabType:()=>f.SearchPageTabType,SecondaryBanner:()=>Xe.default,SectionHeader:()=>a.SectionHeader,SelectStore:()=>Ie.default,ShelfDisplay:()=>b.default,ShelfDisplayHorizontal:()=>A.default,Slogan:()=>T.default,Spacer:()=>I.default,Specs:()=>$.default,SpecsComparison:()=>qe.default,SwiperBox:()=>J.default,TabGroup:()=>ee.default,TabWithImage:()=>Ee.default,Tabs:()=>Y.default,TabsWithMedia:()=>We.default,ThreeDCarousel:()=>Ue.default,Title:()=>v.default,VideoFeature:()=>Ne.default,VideoModal:()=>Q.VideoModal,WebPushPopup:()=>dr.default,WheelLottery:()=>Fe.default,WhyChoose:()=>W.default,useAiuiContext:()=>cr.useAiuiContext,useBizProductContext:()=>c.useBizProductContext,useEmarsysWebPush:()=>fr.useEmarsysWebPush,withLayout:()=>U.withLayout});module.exports=Mr(Tr);var a=require("./AccessoriesShelf/index.js"),h=e(require("./ActivitySchedule/index.js")),P=e(require("./GiftShelf/index.js")),C=e(require("./GiftTierShelf/index.js")),g=e(require("./ActivityMechanism/index.js")),M=e(require("./BrandEquity/index.js")),B=e(require("./MemberEquity/index.js")),T=e(require("./Slogan/index.js")),v=e(require("./Title/index.js")),I=e(require("./Spacer/index.js")),b=e(require("./ShelfDisplay/index.js")),A=e(require("./ShelfDisplayHorizontal/index.js")),D=e(require("./Evaluate/index.js")),F=e(require("./Category/index.js")),j=e(require("./HeroBanner/index.js")),G=e(require("./AccordionCards/index.js")),L=e(require("./Graphic/index.js")),O=e(require("./MediaPlayerBase/index.js")),V=e(require("./MediaPlayerSticky/index.js")),w=e(require("./MediaPlayerMulti/index.js")),k=e(require("./Marquee/index.js")),N=e(require("./MarqueeReview/index.js")),W=e(require("./WhyChoose/index.js")),E=e(require("./Faq/index.js")),s=require("./Marquee/index.js"),H=e(require("./MultiLayoutGraphicBlock/index.js")),R=e(require("./GraphicAttractionBlock/index.js")),q=e(require("./HeaderNavigation/index.js")),z=e(require("./FooterNavigation/index.js")),K=e(require("./SearchPage/index.js")),f=require("./SearchPage/types.js"),U=require("../shared/Styles.js"),_=e(require("./AiuiProvider/index.js")),Y=e(require("./Tabs/index.js")),J=e(require("./SwiperBox/index.js")),Q=require("./VideoModal/index.js"),X=e(require("./CreativeModule/index.js")),Z=e(require("./GraphicOverlay/index.js")),$=e(require("./Specs/index.js")),ee=e(require("./TabsGroup/index.js")),c=e(require("./Listing/BizProductProvider.js")),re=e(require("./Listing/components/PurchaseBar/index.js")),te=e(require("./Listing/components/PurchaseBar/ProductActions/index.js")),oe=e(require("./Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js")),ae=e(require("./Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js")),ie=e(require("./Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js")),se=e(require("./Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js")),pe=e(require("./Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js")),de=e(require("./Listing/components/ProductCard/ProductDetail/ProductOptions/index.js")),fe=e(require("./Listing/components/ProductCard/ProductDetail/ProductBundle/index.js")),ce=e(require("./Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js")),ne=e(require("./Listing/components/ProductCard/ProductDetail/ProductBanner/index.js")),le=e(require("./Listing/components/ProductCard/ProductGridBox.js")),ue=e(require("./Listing/components/ProductCard/ProductGallery/index.js")),me=e(require("./Listing/components/ProductCard/ProductSummary/index.js")),xe=e(require("./Listing/components/ProductCard/ProductDetail/BenefitsTab.js")),ye=e(require("./Listing/components/ProductCard/ProductDetail/CreditCouponRedeem/index.js")),Se=e(require("./Listing/components/PaidShipping/index.js")),he=e(require("./Listing/components/CartActionButtons/index.js")),Pe=require("./NotifyMeDialog/index.js"),Ce=e(require("./Listing/components/ProductCard/ProductDetail/ProductServiceBenefits/index.js")),ge=e(require("./Listing/components/ProductCard/ProductPaidShipping/index.js")),Me=e(require("./GraphicMore/index.js")),Be=e(require("./Features/index.js")),Te=e(require("./AplusDesc/index.js")),ve=e(require("./GiftBox/index.js")),Ie=e(require("./SelectStore/index.js")),be=e(require("./DownLoad/index.js")),Ae=e(require("./FootCharger/index.js")),De=e(require("./BrandCardLink/index.js")),vr=e(require("./IPRedirect/index.js")),Fe=e(require("./WheelLottery/index.js")),je=e(require("./ProductLottery/index.js")),Ge=e(require("./ProductCompare/index.js")),Le=e(require("./Ksp/index.js")),Oe=e(require("./ImageTextFeature/index.js")),Ve=e(require("./FeatureCards/index.js")),we=e(require("./FeaturedBlogPosts/index.js")),ke=e(require("./ImageWithText/index.js")),Ne=e(require("./VideoFeature/index.js")),We=e(require("./TabsWithMedia/index.js")),Ee=e(require("./TabWithImage/index.js")),He=e(require("./FeatureShowcase/index.js")),Re=e(require("./ProductHero/index.js")),qe=e(require("./SpecsComparison/index.js")),ze=e(require("./MediaSceneSwitcher/index.js")),Ke=e(require("./MediaSceneSwitcherV2/index.js")),Ue=e(require("./ThreeDCarousel/index.js")),_e=e(require("./ProductNav/index.js")),Ye=e(require("./AnchorNavigation/index.js")),Je=e(require("./PromotionalBar/index.js")),Qe=e(require("./EventSchedule/index.js")),Xe=e(require("./SecondaryBanner/index.js")),Ze=e(require("./BuyOneGetOneShelf/index.js")),$e=e(require("./ActiveShelf/index.js")),er=e(require("./MediaShelf/index.js")),n=e(require("./CreditsShelf/index.js")),l=e(require("./SceneShelf/index.js")),u=e(require("./SceneShelfV2/index.js")),rr=e(require("./SceneShelfV3/index.js")),tr=e(require("./MediaEndorsement/index.js")),or=e(require("./MediaTextOverlay/index.js")),ar=e(require("./ImageOverlayShelf/index.js")),m=e(require("./AccessoriesShelf/components/AccessoryShelf/index.js")),ir=e(require("./ImageTextOverlay/index.js")),sr=e(require("./MiniCart/index.js")),pr=e(require("./MiniCart/CircleProgress.js")),x=e(require("./MiniCart/MiniCartDialog.js")),dr=e(require("./WebPushPopup/index.js")),fr=require("../hooks/useEmarsysWebPush.js"),t=require("./CartDetail/index.js"),cr=require("./AiuiProvider/index.js"),nr=e(require("./ModalRegisterSubscribe/index.js")),lr=e(require("./ModalSubscribeConfirm/index.js")),ur=e(require("./ModalCoupon/index.js")),mr=e(require("./ModalSmsSubscribe/index.js")),xr=e(require("./ModalVerify/index.js"));const Br={ActivityMechanism:"ActivityMechanism",ActivitySchedule:"ActivitySchedule",AnchorNavigation:"AnchorNavigation",EventSchedule:"EventSchedule",FeatureCards:"FeatureCards",GiftShelf:"GiftShelf",GiftTierShelf:"GiftTierShelf",ImageTextFeature:"ImageTextFeature",ImageTextOverlay:"ImageTextOverlay",ImageWithText:"ImageWithText",MarqueeReview:"MarqueeReview",MediaSceneSwitcher:"MediaSceneSwitcher",ProductCompare:"ProductCompare",ProductHero:"ProductHero",ProductNav:"ProductNav",PromotionalBar:"PromotionalBar",TabsWithMedia:"TabsWithMedia",ThreeDCarousel:"ThreeDCarousel",VideoFeature:"VideoFeature","ipc-accordioncards":"AccordionCards","ipc-active-shelf":"ActiveShelf","ipc-add-to-cart-success-popover":"AddToCartSuccessPopover","ipc-aplusdesc":"AplusDesc","ipc-banner":"HeroBanner","ipc-bogo-shelf":"BuyOneGetOneShelf","ipc-brand-card-link":"BrandCardLink","ipc-brand-equity":"BrandEquity","ipc-category":"Category","ipc-creativemodule":"CreativeModule","ipc-credits-shelf":"CreditsShelf","ipc-download":"DownLoad","ipc-evaluate":"Evaluate","ipc-faq":"Faq","ipc-features":"Features","ipc-featured-blog-posts":"FeaturedBlogPosts","ipc-footcharger":"FootCharger","ipc-ga-block":"GraphicAttractionBlock","ipc-giftbox":"GiftBox","ipc-graphic":"Graphic","ipc-graphicmore":"GraphicMore","ipc-graphicoverlay":"GraphicOverlay","ipc-image-overlay-shelf":"ImageOverlayShelf","ipc-marquee":"Marquee","ipc-media-endorsement":"MediaEndorsement","ipc-media-shelf":"MediaShelf","ipc-media-scene-switcher-v2":"MediaSceneSwitcherV2","ipc-media-text-overlay":"MediaTextOverlay","ipc-mediaplayerbase":"MediaPlayerBase","ipc-mediaplayermulti":"MediaPlayerMulti","ipc-mediaplayersticky":"MediaPlayerSticky","ipc-member-equity":"MemberEquity","ipc-mini-cart":"MiniCart","ipc-mlg-block":"MultiLayoutGraphicBlock","ipc-notify-me-dialog":"NotifyMeDialog","ipc-product-lottery":"ProductLottery","ipc-scene-shelf":"SceneShelf","ipc-scene-shelf-v2":"SceneShelfV2","ipc-scene-shelf-v3":"SceneShelfV3","ipc-search-page":"SearchPage","ipc-search-page-tabs":"SearchPage","ipc-secondary-banner":"SecondaryBanner","ipc-selectstore":"SelectStore","ipc-shelfdisplay":"ShelfDisplay","ipc-shelfdisplay-horizontal":"ShelfDisplayHorizontal","ipc-slogan":"Slogan","ipc-spacer":"Spacer","ipc-specs":"Specs","ipc-tabs":"Tabs","ipc-title":"Title","ipc-wheel-lottery":"WheelLottery","ipc-whychoose":"WhyChoose",ksp:"Ksp",modalCoupon:"ModalCoupon",modalRegisterSubscribe:"ModalRegisterSubscribe",modalSmsSubscribe:"ModalSmsSubscribe",modalSubscribeConfirm:"ModalSubscribeConfirm",modalVerify:"ModalVerify"};
|
|
@@ -5,6 +5,14 @@ interface ScrollLoadVideoProps {
|
|
|
5
5
|
eagerPoster?: boolean;
|
|
6
6
|
className?: string;
|
|
7
7
|
videoClassName?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 1490: 视频层(包裹 video 的容器 div)的初始附加类名。
|
|
10
|
+
* 传入 'opacity-0' 可让视频在真实 playing 前保持不可见——
|
|
11
|
+
* WebKit 会在 readyState≥2 时绘制视频当前帧(Chromium 不会),
|
|
12
|
+
* 未加载的 lazy 封面图是透明的,视频首帧会先闪现。
|
|
13
|
+
* 由调用方在 onPlaying/onWaiting 中增删 'opacity-0' 控制。
|
|
14
|
+
*/
|
|
15
|
+
videoLayerClassName?: string;
|
|
8
16
|
autoplay?: boolean;
|
|
9
17
|
muted?: boolean;
|
|
10
18
|
loop?: boolean;
|
|
@@ -17,5 +25,5 @@ interface ScrollLoadVideoProps {
|
|
|
17
25
|
};
|
|
18
26
|
[key: string]: any;
|
|
19
27
|
}
|
|
20
|
-
declare const ScrollLoadVideo: ({ src, poster, eagerPoster, className, videoClassName, autoplay, muted, loop, controls, playsInline, videoRef, intersectionObserverConfig, ...attr }: ScrollLoadVideoProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare const ScrollLoadVideo: ({ src, poster, eagerPoster, className, videoClassName, videoLayerClassName, autoplay, muted, loop, controls, playsInline, videoRef, intersectionObserverConfig, ...attr }: ScrollLoadVideoProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
29
|
export default ScrollLoadVideo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var
|
|
1
|
+
"use strict";var v=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var x=(s,r)=>{for(var c in r)v(s,c,{get:r[c],enumerable:!0})},z=(s,r,c,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of H(r))!O.call(s,a)&&a!==c&&v(s,a,{get:()=>r[a],enumerable:!(u=C(r,a))||u.enumerable});return s};var j=s=>z(v({},"__esModule",{value:!0}),s);var A={};x(A,{default:()=>q});module.exports=j(A);var b=require("react/jsx-runtime"),o=require("react"),m=require("../helpers/utils.js");const D=({src:s,poster:r,eagerPoster:c=!1,className:u="",videoClassName:a="",videoLayerClassName:g="",autoplay:L=!0,muted:E=!0,loop:i=!0,controls:R=!1,playsInline:P=!0,videoRef:M,intersectionObserverConfig:V={threshold:0,rootMargin:"200px"},...w})=>{const[l,I]=(0,o.useState)(!1),N=(0,o.useRef)(null),p=(0,o.useRef)(null),d=(0,o.useRef)(!1),n=M||N,{threshold:y,rootMargin:h}=V;return(0,o.useEffect)(()=>{const e=n.current;if(!e||i)return;const t=()=>{d.current=!0};return e.addEventListener("ended",t),()=>{e.removeEventListener("ended",t)}},[n,i,l]),(0,o.useEffect)(()=>{const e=n.current;if(!e||!l)return;const t=()=>{!e.paused||e.ended||!i&&d.current||(e.muted=!0,e.play().catch(()=>{}))};return e.addEventListener("canplay",t),()=>e.removeEventListener("canplay",t)},[n,l,i]),(0,o.useEffect)(()=>{const e=new IntersectionObserver(S=>{S.forEach(k=>{if(k.isIntersecting){if(l||I(!0),n.current){const f=n.current;if(!i&&d.current)return;f.muted=!0,f.currentTime=0,f.play().catch(T=>{console.warn("\u89C6\u9891\u81EA\u52A8\u64AD\u653E\u5931\u8D25:",T)})}}else n.current&&n.current.pause()})},{threshold:y,rootMargin:h}),t=p.current;return t&&e.observe(t),()=>{t&&e.unobserve(t)}},[n,i,h,l,y]),(0,b.jsx)("div",{ref:p,className:(0,m.cn)("relative size-full",u,g),children:(0,b.jsx)("video",{ref:n,src:l?s:void 0,poster:c||l?r:void 0,className:(0,m.cn)("size-full object-cover",a),loop:i,muted:E,controls:R,playsInline:P,preload:"metadata",disablePictureInPicture:!0,"webkit-playsinline":!0,autoPlay:L,...w})})};var q=D;
|