@anker-in/headless-ui 1.3.85 → 1.3.87

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.
Files changed (59) hide show
  1. package/README.md +6 -0
  2. package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
  3. package/dist/cjs/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
  4. package/dist/cjs/biz-components/Listing/BizProductProvider.d.ts +8 -2
  5. package/dist/cjs/biz-components/Listing/BizProductProvider.js +1 -1
  6. package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js +1 -1
  7. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
  8. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js +1 -1
  9. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js +1 -1
  10. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
  11. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js +1 -1
  12. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  13. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
  14. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  15. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  16. package/dist/cjs/biz-components/Listing/hooks/useBenefits.js +1 -1
  17. package/dist/cjs/biz-components/Listing/types/product.d.ts +9 -0
  18. package/dist/cjs/biz-components/Listing/types/product.js +1 -1
  19. package/dist/cjs/biz-components/Listing/types.d.ts +19 -0
  20. package/dist/cjs/biz-components/Listing/types.js +1 -1
  21. package/dist/cjs/biz-components/Listing/utils/priceCalc.d.ts +28 -0
  22. package/dist/cjs/biz-components/Listing/utils/priceCalc.js +1 -0
  23. package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
  24. package/dist/cjs/biz-components/SearchPage/index.js +1 -1
  25. package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
  26. package/dist/cjs/biz-components/index.d.ts +2 -0
  27. package/dist/cjs/biz-components/index.js +1 -1
  28. package/dist/cjs/components/container.js +1 -1
  29. package/dist/cjs/helpers/utils.js +1 -1
  30. package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
  31. package/dist/esm/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
  32. package/dist/esm/biz-components/Listing/BizProductProvider.d.ts +8 -2
  33. package/dist/esm/biz-components/Listing/BizProductProvider.js +1 -1
  34. package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js +1 -1
  35. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
  36. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js +1 -1
  37. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js +1 -1
  38. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
  39. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js +1 -1
  40. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  41. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
  42. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  43. package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  44. package/dist/esm/biz-components/Listing/hooks/useBenefits.js +1 -1
  45. package/dist/esm/biz-components/Listing/types/product.d.ts +9 -0
  46. package/dist/esm/biz-components/Listing/types.d.ts +19 -0
  47. package/dist/esm/biz-components/Listing/utils/priceCalc.d.ts +28 -0
  48. package/dist/esm/biz-components/Listing/utils/priceCalc.js +1 -0
  49. package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
  50. package/dist/esm/biz-components/SearchPage/index.js +1 -1
  51. package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
  52. package/dist/esm/biz-components/index.d.ts +2 -0
  53. package/dist/esm/biz-components/index.js +1 -1
  54. package/dist/esm/components/container.js +1 -1
  55. package/dist/esm/helpers/utils.js +1 -1
  56. package/dist/tokens/base.css +48 -0
  57. package/package.json +1 -1
  58. package/style.css +9 -12
  59. package/tailwind.config.js +3 -0
@@ -1 +1 @@
1
- "use client";import{Fragment as rt,jsx as t,jsxs as u}from"react/jsx-runtime";import pe,{useImperativeHandle as Ee,useRef as k,useState as Me,useEffect as Pe}from"react";import N from"gsap";import{ScrollTrigger as C}from"gsap/dist/ScrollTrigger";import O from"jump.js";import{buildPictureSource as Re,resolveTierMedia as L,useMediaTier as De}from"./mediaResolver.js";import{useInView as je}from"react-intersection-observer";import Ae from"../../helpers/ScrollLoadVideo.js";import{Button as V,Heading as Oe,Picture as U,Text as G,Countdown as Ue}from"../../components/index.js";import{cn as p}from"../../helpers/index.js";import{cva as S}from"class-variance-authority";import{withLayout as Ge}from"../../shared/Styles.js";import{useExposure as Je}from"../../hooks/useExposure.js";import{buildTrackingRef as _e,trackUrlRef as z}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as h,resolveComponentMediaType as qe}from"../../shared/track.js";import{getLocalizedPath as Fe}from"../../helpers/utils.js";import{useAiuiContext as We}from"../AiuiProvider/index.js";import{sizeMap as Ye}from"../../components/button.js";import{VideoModal as Ze}from"../VideoModal/index.js";import Ke from"./HeroBannerCarousel.js";const f="hero_banner",Qe=S("hero-banner-content lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"tablet:px-[32px] laptop:top-1/2 laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] laptop:-translate-y-1/2 left-0 px-[16px]",center:"tablet:top-[84px] laptop:top-[76px] desktop:top-[176px] lg-desktop:top-[192px] left-1/2 top-[84px] -translate-x-1/2 translate-y-0 items-center text-center"}},defaultVariants:{align:"left"}}),Xe=S("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),$e=S("hero-banner-button-group lg-desktop:gap-x-3 pointer-events-auto flex flex-wrap items-center gap-x-2 gap-y-3",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),et=S("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),tt=({size:s="base"})=>{const{width:T,height:c}=Ye[s];return t("svg",{width:T,height:c,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},ce=pe.forwardRef(({data:s,className:T,classNames:c={},onSecondaryClick:J,onPrimaryClick:_,onTertiaryClick:q,jumpOptions:ue={},a11yLabels:me,...F},W)=>{const{locale:Y,pageHandle:de}=We(),Z=s.mode!=="single"&&!!s.items&&s.items.length>0,I={...{duration:500,offset:0},...ue},w=e=>!e||!Y?e:Fe(e,Y),{label:K,title:l,subtitle:o,endDate:Q,endDate_tz:fe,dateFormat:ge,pcImage:E,isShowVideo:X,isVideoLoop:be=!0,primaryButton:a,secondaryButton:r,tertiaryButton:i,theme:ve="light",size:M="default",titleSize:P,caption:$=[],blockLink:B,iconArray:ee,align:b="left",enableParallax:te=!0}=s,R=Array.isArray($)?$:[],ye=Array.isArray(ee)?ee:void 0,re=De(),ne=Re(s),xe=L(s,re,"video")?.url||"",[oe,ae]=Me(!1),{ref:ke,inView:ie}=je(),D=k(null),j=k(null),A=k(null),v=k(null),d=k(null),m=qe(X),H=_e(de??"",m,f),g=L(s,re,m==="video"?"video":"image")?.id||E?.id||"",he=l?.trim()||o?.trim()||E?.alt?.trim()||void 0,Te=l!==void 0?l?.trim()||o?.trim()||E?.alt?.trim()||void 0:o&&o.trim()||"",we=o&&o.trim()||"";Je(d,{componentType:m,componentName:f,componentTitle:Te,componentDescription:we,creativeId:g,position:1});const Be=B?z(w(B),H):void 0,He=r?.link?z(w(r.link),H):void 0,Ne=a?.link?z(w(a.link),H):void 0,Ce=i?.link?z(w(i.link),H):void 0,Le=h({interactive:!!B,componentType:m,componentName:f,title:l,description:o,position:1,creativeId:g}),Ve=h({interactive:!0,componentType:m,componentName:f,title:l,description:o,buttonName:"video play",position:1,creativeId:g}),Se=h({interactive:!!(r?.link||r?.isCustomSecondaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:r?.text,position:1,creativeId:g}),ze=h({interactive:!!(a?.link||a?.isCustomPrimaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:a?.text,position:1,creativeId:g}),Ie=h({interactive:!!(i?.link||i?.isCustomTertiaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:i?.text,position:1,creativeId:g});return Ee(W,()=>d.current),Pe(()=>{if(Z||!te)return;N.registerPlugin(C);function e(){if(!v.current)return;const n=d.current?.clientHeight||100;window.innerHeight<=n?D.current=C.create({trigger:d.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*40-20;N.set(v.current,{yPercent:x})}}):(A.current=C.create({trigger:d.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:y=>{const x=y.progress*20-20;N.set(v.current,{yPercent:x})}}),j.current=C.create({trigger:d.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*20;N.set(v.current,{yPercent:x})}}))}return ie&&e(),()=>{D.current&&D.current.kill(),A.current&&A.current.kill(),j.current&&j.current.kill()}},[ie,s.items,te]),Z?t(Ke,{data:s,className:T,classNames:c,onPrimaryClick:_,onSecondaryClick:J,onTertiaryClick:q,a11yLabels:me,ref:W,...F}):t("div",{...F,ref:ke,"data-ui-component-id":"HeroBanner",className:p(c.root),children:u("div",{ref:d,className:p(ve==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":M==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":M==="sm"},T),children:[B&&t("a",{className:"absolute inset-0 z-10",href:Be,tabIndex:-1,"aria-hidden":"true","aria-label":he,...Le}),t("div",{ref:v,className:p("absolute left-0 top-0 size-full"),children:X?u(rt,{children:[t(Ae,{poster:void 0,src:xe,className:"laptop:w-full absolute inset-0 h-full transition-opacity duration-500",videoLayerClassName:"opacity-0",videoClassName:"h-full object-cover",muted:!0,loop:be,playsInline:!0,onPlaying:e=>{const n=e.currentTarget;n.parentElement?.classList.remove("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:e=>{const n=e.currentTarget;if(n.currentTime>=.5)return;n.parentElement?.classList.add("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),t("div",{"data-video-poster":"true",className:"laptop:w-full bg-container-primary pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:t(U,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})})]}):t(U,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})}),u("div",{className:Qe({align:b}),children:[u("div",{className:Xe({align:b}),children:[K&&t(G,{size:2,as:"p",className:p("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:K}),l&&t(Oe,{as:P==="4"?"h1":"h2",html:l,className:p("hero-banner-title",c.title),size:P?Number(P||"5"):M==="sm"?4:5}),o&&t(G,{as:"p",size:2,className:p("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",c.subtitle),html:o}),Q&&t("div",{className:"mt-3",children:t(Ue,{endDate:Q,endDate_tz:fe,dateFormat:ge,variant:"spacious",align:b})})]}),u("div",{className:p($e({align:b}),c.buttonGroup),children:[u("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[r?.isShowPlayVideoButton&&r?.playVideoButtonText?u(V,{onClick:()=>ae(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...Ve,children:[r?.playVideoButtonText," ",t(tt,{size:"lg"})]}):r?.text?u(V,{"aria-label":l??o,size:"lg",variant:"secondary",className:p("hero-banner-secondary-button",c.secondaryButton),as:r?.isCustomSecondaryButton?"button":"a",href:He,target:r?.target,rel:r?.target==="_blank"?r?.rel??"noopener noreferrer":r?.rel,onClick:e=>{if(r.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(r.link);n&&O(n,I)}r?.isCustomSecondaryButton&&J?.(s,e,r?.customSecondaryEventId)},...Se,children:[r?.text,t("span",{className:"sr-only",children:l??o})]}):null,a&&a.text&&t(V,{"aria-label":l??o,size:"lg",variant:"primary",className:p("hero-banner-primary-button",c.primaryButton),as:a?.isCustomPrimaryButton?"button":"a",href:Ne,target:a?.target,rel:a?.target==="_blank"?a?.rel??"noopener noreferrer":a?.rel,onClick:e=>{if(a.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(a.link);n&&O(n,I)}a?.isCustomPrimaryButton&&_?.(s,e,a?.customPrimaryEventId)},...ze,children:a.text})]}),i&&i.text&&u(V,{"aria-label":l??o,size:"lg",variant:"link",className:p("hero-banner-tertiary-button w-auto p-0",c.tertiaryButton),as:i?.isCustomTertiaryButton?"button":"a",href:Ce,target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:e=>{if(i.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(i.link);n&&O(n,I)}i?.isCustomTertiaryButton&&q?.(s,e,i?.customTertiaryEventId)},...Ie,children:[i.text,t("span",{className:"sr-only",children:l??o})]})]}),t("div",{className:et({align:b}),children:ye?.map(e=>t("div",{className:"h-12",children:t(U,{className:"!inline-block h-full !w-auto",imgClassName:"!w-auto h-full object-contain",loading:"eager",alt:e?.pcImage?.alt||"",source:e?.pcImage?.url})},e?.pcImage?.url||e?.pcImage?.alt))})]}),R.length>0&&t("div",{className:p("hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] pointer-events-none absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]",c.captionGroup),children:R.map((e,n)=>u(pe.Fragment,{children:[t(G,{size:2,className:p("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:e.title}),n<R.length-1&&t("div",{className:p("bg-info-primary w-px")})]},e.title))}),oe&&t(Ze,{visible:oe,videoUrl:r?.isYoutubeVideo?void 0:r?.videoUrl?.url,youTubeId:r?.isYoutubeVideo?r?.youtubeId:void 0,onCloseModal:()=>ae(!1)})]})})});ce.displayName="HeroBanner";var wt=Ge(ce);export{wt as default};
1
+ "use client";import{Fragment as rt,jsx as t,jsxs as u}from"react/jsx-runtime";import ce,{useImperativeHandle as Ee,useRef as k,useState as Me,useEffect as Pe}from"react";import N from"gsap";import{ScrollTrigger as C}from"gsap/dist/ScrollTrigger";import O from"jump.js";import{buildPictureSource as Re,resolveTierMedia as L,useMediaTier as De}from"./mediaResolver.js";import{useInView as je}from"react-intersection-observer";import Ae from"../../helpers/ScrollLoadVideo.js";import{Button as V,Heading as Oe,Picture as U,Text as G,Countdown as Ue}from"../../components/index.js";import{cn as c}from"../../helpers/index.js";import{cva as S}from"class-variance-authority";import{withLayout as Ge}from"../../shared/Styles.js";import{useExposure as Je}from"../../hooks/useExposure.js";import{buildTrackingRef as _e,trackUrlRef as z}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as h,resolveComponentMediaType as qe}from"../../shared/track.js";import{getLocalizedPath as Fe}from"../../helpers/utils.js";import{useAiuiContext as We}from"../AiuiProvider/index.js";import{sizeMap as Ye}from"../../components/button.js";import{VideoModal as Ze}from"../VideoModal/index.js";import Ke from"./HeroBannerCarousel.js";const f="hero_banner",Qe=S("hero-banner-content lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"laptop:top-1/2 px-grid laptop:-translate-y-1/2 left-0",center:"tablet:top-[84px] laptop:top-[76px] desktop:top-[176px] lg-desktop:top-[192px] left-1/2 top-[84px] -translate-x-1/2 translate-y-0 items-center text-center"}},defaultVariants:{align:"left"}}),Xe=S("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),$e=S("hero-banner-button-group lg-desktop:gap-x-3 pointer-events-auto flex flex-wrap items-center gap-x-2 gap-y-3",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),et=S("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),tt=({size:s="base"})=>{const{width:T,height:p}=Ye[s];return t("svg",{width:T,height:p,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},pe=ce.forwardRef(({data:s,className:T,classNames:p={},onSecondaryClick:J,onPrimaryClick:_,onTertiaryClick:q,jumpOptions:ue={},a11yLabels:me,...F},W)=>{const{locale:Y,pageHandle:de}=We(),Z=s.mode!=="single"&&!!s.items&&s.items.length>0,I={...{duration:500,offset:0},...ue},w=e=>!e||!Y?e:Fe(e,Y),{label:K,title:l,subtitle:o,endDate:Q,endDate_tz:fe,dateFormat:ge,pcImage:E,isShowVideo:X,isVideoLoop:be=!0,primaryButton:a,secondaryButton:r,tertiaryButton:i,theme:ve="light",size:M="default",titleSize:P,caption:$=[],blockLink:B,iconArray:ee,align:b="left",enableParallax:te=!0}=s,R=Array.isArray($)?$:[],ye=Array.isArray(ee)?ee:void 0,re=De(),ne=Re(s),xe=L(s,re,"video")?.url||"",[oe,ae]=Me(!1),{ref:ke,inView:ie}=je(),D=k(null),j=k(null),A=k(null),v=k(null),d=k(null),m=qe(X),H=_e(de??"",m,f),g=L(s,re,m==="video"?"video":"image")?.id||E?.id||"",he=l?.trim()||o?.trim()||E?.alt?.trim()||void 0,Te=l!==void 0?l?.trim()||o?.trim()||E?.alt?.trim()||void 0:o&&o.trim()||"",we=o&&o.trim()||"";Je(d,{componentType:m,componentName:f,componentTitle:Te,componentDescription:we,creativeId:g,position:1});const Be=B?z(w(B),H):void 0,He=r?.link?z(w(r.link),H):void 0,Ne=a?.link?z(w(a.link),H):void 0,Ce=i?.link?z(w(i.link),H):void 0,Le=h({interactive:!!B,componentType:m,componentName:f,title:l,description:o,position:1,creativeId:g}),Ve=h({interactive:!0,componentType:m,componentName:f,title:l,description:o,buttonName:"video play",position:1,creativeId:g}),Se=h({interactive:!!(r?.link||r?.isCustomSecondaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:r?.text,position:1,creativeId:g}),ze=h({interactive:!!(a?.link||a?.isCustomPrimaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:a?.text,position:1,creativeId:g}),Ie=h({interactive:!!(i?.link||i?.isCustomTertiaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:i?.text,position:1,creativeId:g});return Ee(W,()=>d.current),Pe(()=>{if(Z||!te)return;N.registerPlugin(C);function e(){if(!v.current)return;const n=d.current?.clientHeight||100;window.innerHeight<=n?D.current=C.create({trigger:d.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*40-20;N.set(v.current,{yPercent:x})}}):(A.current=C.create({trigger:d.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:y=>{const x=y.progress*20-20;N.set(v.current,{yPercent:x})}}),j.current=C.create({trigger:d.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*20;N.set(v.current,{yPercent:x})}}))}return ie&&e(),()=>{D.current&&D.current.kill(),A.current&&A.current.kill(),j.current&&j.current.kill()}},[ie,s.items,te]),Z?t(Ke,{data:s,className:T,classNames:p,onPrimaryClick:_,onSecondaryClick:J,onTertiaryClick:q,a11yLabels:me,ref:W,...F}):t("div",{...F,ref:ke,"data-ui-component-id":"HeroBanner",className:c(p.root),children:u("div",{ref:d,className:c(ve==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":M==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":M==="sm"},T),children:[B&&t("a",{className:"absolute inset-0 z-10",href:Be,tabIndex:-1,"aria-hidden":"true","aria-label":he,...Le}),t("div",{ref:v,className:c("absolute left-0 top-0 size-full"),children:X?u(rt,{children:[t(Ae,{poster:void 0,src:xe,className:"laptop:w-full absolute inset-0 h-full transition-opacity duration-500",videoLayerClassName:"opacity-0",videoClassName:"h-full object-cover",muted:!0,loop:be,playsInline:!0,onPlaying:e=>{const n=e.currentTarget;n.parentElement?.classList.remove("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:e=>{const n=e.currentTarget;if(n.currentTime>=.5)return;n.parentElement?.classList.add("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),t("div",{"data-video-poster":"true",className:"laptop:w-full bg-container-primary pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:t(U,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})})]}):t(U,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})}),u("div",{className:Qe({align:b}),children:[u("div",{className:Xe({align:b}),children:[K&&t(G,{size:2,as:"p",className:c("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:K}),l&&t(Oe,{as:P==="4"?"h1":"h2",html:l,className:c("hero-banner-title",p.title),size:P?Number(P||"5"):M==="sm"?4:5}),o&&t(G,{as:"p",size:2,className:c("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",p.subtitle),html:o}),Q&&t("div",{className:"mt-3",children:t(Ue,{endDate:Q,endDate_tz:fe,dateFormat:ge,variant:"spacious",align:b})})]}),u("div",{className:c($e({align:b}),p.buttonGroup),children:[u("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[r?.isShowPlayVideoButton&&r?.playVideoButtonText?u(V,{onClick:()=>ae(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...Ve,children:[r?.playVideoButtonText," ",t(tt,{size:"lg"})]}):r?.text?u(V,{"aria-label":l??o,size:"lg",variant:"secondary",className:c("hero-banner-secondary-button",p.secondaryButton),as:r?.isCustomSecondaryButton?"button":"a",href:He,target:r?.target,rel:r?.target==="_blank"?r?.rel??"noopener noreferrer":r?.rel,onClick:e=>{if(r.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(r.link);n&&O(n,I)}r?.isCustomSecondaryButton&&J?.(s,e,r?.customSecondaryEventId)},...Se,children:[r?.text,t("span",{className:"sr-only",children:l??o})]}):null,a&&a.text&&t(V,{"aria-label":l??o,size:"lg",variant:"primary",className:c("hero-banner-primary-button",p.primaryButton),as:a?.isCustomPrimaryButton?"button":"a",href:Ne,target:a?.target,rel:a?.target==="_blank"?a?.rel??"noopener noreferrer":a?.rel,onClick:e=>{if(a.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(a.link);n&&O(n,I)}a?.isCustomPrimaryButton&&_?.(s,e,a?.customPrimaryEventId)},...ze,children:a.text})]}),i&&i.text&&u(V,{"aria-label":l??o,size:"lg",variant:"link",className:c("hero-banner-tertiary-button w-auto p-0",p.tertiaryButton),as:i?.isCustomTertiaryButton?"button":"a",href:Ce,target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:e=>{if(i.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(i.link);n&&O(n,I)}i?.isCustomTertiaryButton&&q?.(s,e,i?.customTertiaryEventId)},...Ie,children:[i.text,t("span",{className:"sr-only",children:l??o})]})]}),t("div",{className:et({align:b}),children:ye?.map(e=>t("div",{className:"h-12",children:t(U,{className:"!inline-block h-full !w-auto",imgClassName:"!w-auto h-full object-contain",loading:"eager",alt:e?.pcImage?.alt||"",source:e?.pcImage?.url})},e?.pcImage?.url||e?.pcImage?.alt))})]}),R.length>0&&t("div",{className:c("hero-banner-caption-group laptop:gap-3 px-grid desktop:pb-[24px] pointer-events-none absolute bottom-0 z-10 flex items-stretch gap-2 pb-[16px]",p.captionGroup),children:R.map((e,n)=>u(ce.Fragment,{children:[t(G,{size:2,className:c("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:e.title}),n<R.length-1&&t("div",{className:c("bg-info-primary w-px")})]},e.title))}),oe&&t(Ze,{visible:oe,videoUrl:r?.isYoutubeVideo?void 0:r?.videoUrl?.url,youTubeId:r?.isYoutubeVideo?r?.youtubeId:void 0,onCloseModal:()=>ae(!1)})]})})});pe.displayName="HeroBanner";var wt=Ge(pe);export{wt as default};
@@ -1 +1 @@
1
- "use client";import{Fragment as xt,jsx as a,jsxs as h}from"react/jsx-runtime";import he,{useRef as xe,useEffect as G,useCallback as E,useState as re}from"react";import{Swiper as Ke,SwiperSlide as Qe}from"swiper/react";import Xe from"../../helpers/ScrollLoadVideo.js";import{cn as V,getLocalizedPath as et}from"../../helpers/index.js";import{buildPictureSource as tt,resolveTierMedia as U,useMediaTier as Be}from"./mediaResolver.js";import{Button as ie,Heading as nt,Text as Se,Countdown as ot,Picture as Te}from"../../components/index.js";import{useCarouselPlayback as at}from"../../hooks/useCarouselPlayback.js";import{CarouselArrows as rt,CarouselCornerToggle as it,CarouselProgressControls as st}from"../../shared/CarouselControls.js";import{buildClickTrackingProps as lt,gaTrack as dt,resolveComponentMediaType as Pe,trackComponentClick as ct}from"../../shared/track.js";import{buildPageGroup as ut,buildTrackingRef as pt,trackUrlRef as mt}from"../../shared/trackUrlRef.js";import{useExposure as gt}from"../../hooks/useExposure.js";import{useAiuiContext as vt}from"../AiuiProvider/index.js";import{VideoModal as ft}from"../VideoModal/index.js";import"swiper/css";const yt=({size:d="base"})=>{const I=d==="lg"?"20":d==="sm"?"16":"18";return a("svg",{width:I,height:I,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:a("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},se="hero_banner",bt=({data:d,isActive:I,isAdjacent:le=!1,videoRef:de,slideIndex:Y,containerSize:W="default",theme:ce="light",slideLabel:ue,position:S,locale:r,pageHandle:R,onPlayVideo:Z,onPrimaryClick:m,onSecondaryClick:pe,onTertiaryClick:J})=>{const{pcImage:K,isVideoLoop:M=!0,isShowVideo:B,title:T,subtitle:b,label:z,endDate:F,endDate_tz:Q,dateFormat:k,iconArray:P,caption:f,blockLink:D,primaryButton:i,secondaryButton:s,tertiaryButton:l,align:C="left",titleSize:N}=d,_=Be(),p=tt(d),j=U(d,"lgDesktop","image")?.alt||K?.alt||"",y=U(d,_,"video")?.url||"",w=!!p&&!/\.(mp4|mov|webm|m4v)(\?|$)/i.test(p),X=Pe(B),me=U(d,_,B?"video":"image")?.id||K?.id||"",ee=`${pt(R??"",X,se)}_${S}`,ge=n=>n&&r?et(n,r):n,H=n=>n?mt(ge(n),ee):void 0,x=(n,g)=>lt({interactive:n,componentType:X,componentName:se,title:T,description:b,buttonName:g,position:S,creativeId:me});return h("div",{"data-ui-component-id":"HeroBannerSlide",role:"group","aria-roledescription":"slide","aria-label":ue,className:V("text-info-primary relative w-full overflow-hidden transition-colors duration-500",ce==="dark"&&"aiui-dark",W==="default"?"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":"lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]"),children:[D&&a("a",{className:"absolute inset-0 z-10",href:H(D),tabIndex:-1,"aria-hidden":"true","aria-label":T?.trim()||b?.trim()||j||void 0,...x(!0)}),B?h(xt,{children:[a(Xe,{videoRef:de,src:y,poster:void 0,className:"absolute inset-0 size-full transition-opacity duration-500",videoClassName:"size-full object-cover",videoLayerClassName:"opacity-0",muted:!0,loop:M,playsInline:!0,onPlaying:n=>{const g=n.currentTarget;g.parentElement?.classList.remove("opacity-0"),g.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:n=>{const g=n.currentTarget;if(g.currentTime>=.5)return;g.parentElement?.classList.add("opacity-0"),g.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),w&&a("div",{"data-video-poster":"true",className:"bg-container-primary pointer-events-none absolute inset-0 size-full transition-opacity duration-500",children:a(Te,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:Y===0||le?"eager":"lazy",fetchPriority:Y===0?"high":"auto",alt:j,source:p})})]}):a(Te,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:j,source:p}),h("div",{className:V("laptop:top-1/2 laptop:-translate-y-1/2 lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px] transition-colors duration-500",C==="center"?"left-1/2 -translate-x-1/2 items-center text-center":"tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] left-0 px-[16px]"),children:[h("div",{className:V("tablet:max-w-[704px] laptop:max-w-[440px] desktop:max-w-[648px] lg-desktop:max-w-[824px] max-w-[358px] transition-colors duration-500",C==="center"?"text-center":"laptop:text-left"),children:[z&&a(Se,{size:2,as:"p",className:V("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:z}),T&&a(nt,{as:N==="4"?"h1":"h2",html:T,size:N?Number(N||"5"):W==="sm"?4:5}),b&&a(Se,{as:"p",size:2,className:"font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",html:b}),F&&a("div",{className:"mt-3",children:a(ot,{endDate:F,endDate_tz:Q,dateFormat:k,variant:"spacious",align:C})})]}),(i?.text||s?.text||l?.text)&&h("div",{className:V("lg-desktop:gap-3 pointer-events-auto flex flex-wrap items-center gap-2",C==="center"?"justify-center":"laptop:justify-start"),children:[s?.isShowPlayVideoButton&&s?.playVideoButtonText?h(ie,{size:"lg",variant:"secondary",className:"hero-banner-play-video-button",onClick:()=>Z?.(),...x(!0,"video play"),children:[s.playVideoButtonText," ",a(yt,{size:"lg"})]}):s?.text?h(ie,{size:"lg",variant:"secondary",as:s?.isCustomSecondaryButton?"button":"a",href:H(s.link),target:s?.target,rel:s?.target==="_blank"?s?.rel??"noopener noreferrer":s?.rel,onClick:n=>s?.isCustomSecondaryButton&&pe?.(d,n,s?.customSecondaryEventId),...x(!!(s.link||s.isCustomSecondaryButton),s.text),children:[s.text,a("span",{className:"sr-only",children:T??b})]}):null,i?.text&&a(ie,{size:"lg",variant:"primary",as:i?.isCustomPrimaryButton?"button":"a",href:H(i.link),target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:n=>i?.isCustomPrimaryButton&&m?.(d,n,i?.customPrimaryEventId),...x(!!(i.link||i.isCustomPrimaryButton),i.text),children:i.text}),l?.text&&h(ie,{size:"lg",variant:"link",className:"tablet:basis-auto basis-full",as:l?.isCustomTertiaryButton?"button":"a",href:H(l.link),target:l?.target,rel:l?.target==="_blank"?l?.rel??"noopener noreferrer":l?.rel,onClick:n=>l?.isCustomTertiaryButton&&J?.(d,n,l?.customTertiaryEventId),...x(!!(l.link||l.isCustomTertiaryButton),l.text),children:[l.text,a("span",{className:"sr-only",children:T??b})]})]}),P&&P.length>0&&a("div",{className:V("flex items-center gap-2",C==="center"?"justify-center":"justify-start"),children:P.map(n=>a("div",{className:"h-12",children:a(Te,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",alt:n?.pcImage?.alt||"",source:n?.pcImage?.url})},n?.pcImage?.url||n?.pcImage?.alt))})]}),f&&f.length>0&&a("div",{className:"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] pointer-events-none absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]",children:f.map((n,g)=>h(he.Fragment,{children:[a(Se,{size:2,className:"hero-banner-product-text tablet:w-[108px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]",html:n.title}),g<f.length-1&&a("div",{className:"bg-info-primary w-px"})]},n.title))})]})},ht={prevSlide:"Previous slide",nextSlide:"Next slide",pauseAutoplay:"Pause autoplay",playAutoplay:"Play autoplay",pauseVideo:"Pause video",playVideo:"Play video",slideStatus:"Slide",carouselLabel:"Banner carousel"},Ne=he.forwardRef(({data:d,className:I,classNames:le={},a11yLabels:de,onPrimaryClick:Y,onSecondaryClick:W,onTertiaryClick:ce,...ue},S)=>{const r=d.items||[],R=d.carousel,Z=R?.size??d.size??"default",m={...ht,...de},{locale:pe,pageHandle:J,trackingData:K}=vt(),M=Be(),B=ut({pageHandle:J,pageGroup:K?.pageGroup}),T=xe(null),[b,z]=re(null),[F,Q]=re(null),[k,P]=re(null),[f,D]=re(null),i=xe(r);G(()=>{i.current=r});const s=e=>e!==void 0&&e!==999&&e>=5,l=e=>e!==void 0&&e!==999&&e>=1&&e<=30,C=R?.autoplaySeconds,N=e=>{const t=e?.autoplaySeconds;return l(t)?t:s(C)?C:void 0},_=r.length>1&&r.some(e=>N(e)!==void 0),p=xe(r.map(()=>he.createRef())),j=(R?.showArrows??!0)&&r.length>1,y=E((e,t)=>{dt({event:"ga4Event",event_name:e,event_parameters:t})},[]),w=E(e=>i.current[e]?.isShowVideo?"video":"image",[]),X=E((e,t)=>{t==="swipe"&&y("hero_banner_swipe",{to_index:e}),y("hero_banner_slide_view",{index:e,total:i.current.length,media_type:w(e),trigger:t})},[y,w]),me=E((e,t,o,u="arrow")=>{y("hero_banner_arrow_click",{direction:e,from_index:t,to_index:o,source:u})},[y]),ee=E((e,t)=>{y(e?"hero_banner_pause":"hero_banner_resume",{index:t,media_type:w(t)})},[y,w]),ge=E((e,t)=>{const o=i.current[t];o&&ct({pageGroup:B,componentType:"video",componentName:se,position:t+1,buttonName:e?"video pause":"video play",componentTitle:o.title,componentDescription:o.subtitle,creativeId:U(o,M,"video")?.id||o.pcImage?.id||""})},[B,M]),H=E(e=>{p.current.forEach((o,u)=>{u!==e&&o.current&&(o.current.pause(),o.current.currentTime=0)});const t=p.current[e];t?.current&&(t.current.currentTime=0,t.current.play()?.catch(()=>{}))},[]),{rootRef:x,activeIndex:n,playbackState:g,resetNonce:ve,announcement:_e,activeFrameIntervalSec:ke,isTimerRunning:He,handleSwiperInit:Ae,handleSlideChange:Ie,handleTransitionEnd:Re,handleSliderFirstMove:Me,goToSlide:Ce,goToSlideIndex:ze,handlePausePlayClick:Fe,notifyVideoPlaying:we,handleFocus:De,handleBlur:je}=at({frameCount:r.length,resolveFrameIntervalSec:e=>N(r[e]),isAutoplayEnabled:_,swiperRef:T,slideStatusLabel:m.slideStatus,onSlideMediaSync:H,onSlideChange:X,onArrowNavigate:me,delaysCountdownForVideo:e=>!!i.current[e]?.isShowVideo,onPauseToggle:(e,t)=>{ee(e,t);const o=p.current[t]?.current;o&&(e?o.pause():o.ended||o.play()?.catch(()=>{}))}}),qe=E(e=>{x.current=e,typeof S=="function"?S(e):S&&(S.current=e)},[S,x]),v=r[n]??r[0],$e=Pe(v?.isShowVideo),Oe=v?.title!==void 0?v?.title?.trim()||v?.subtitle?.trim()||v?.pcImage?.alt?.trim()||void 0:v?.subtitle&&v.subtitle.trim()||"",Ge=v&&(U(v,M,v.isShowVideo?"video":"image")?.id||v.pcImage?.id)||"";gt(x,{componentType:$e,componentName:se,componentTitle:Oe,componentDescription:v?.subtitle?.trim()||"",creativeId:Ge,position:1}),G(()=>{z(null),Q(null);const e=i.current[n],t=p.current[n]?.current;if(!e?.isShowVideo||!t)return;const o=()=>z(t.ended?"ended":t.paused?"paused":"playing"),u=()=>Q(Number.isFinite(t.duration)?t.duration:null),A=()=>{o(),we(n)};return o(),u(),t.addEventListener("playing",A),t.addEventListener("pause",o),t.addEventListener("ended",o),t.addEventListener("loadedmetadata",u),()=>{t.removeEventListener("playing",A),t.removeEventListener("pause",o),t.removeEventListener("ended",o),t.removeEventListener("loadedmetadata",u)}},[n,we]),G(()=>{const e=i.current[n];if(!e?.isShowVideo||!e?.isMultiThemeEnabled)return;const t=p.current[n]?.current;if(!t)return;const o=(c,L,ae,be)=>{if(!(!c||typeof L!="number"||typeof ae!="number"||typeof be!="number"))return be>=L&&be<ae?c:void 0};let u=null;const A=c=>{u=c,P(L=>L&&L.index===n&&L.theme===c?L:{index:n,theme:c})},te=c=>{A(o(e.theme_1,e.star_time_1,e.end_time_1,c)??o(e.theme_2,e.star_time_2,e.end_time_2,c)??e.theme??"light")},ne=t;let $=0,O=0;const fe=typeof ne.requestVideoFrameCallback=="function",Je=()=>fe?O!==0:$!==0,ye=()=>{if(!Je())if(fe){const c=(L,ae)=>{te(ae.mediaTime),O=ne.requestVideoFrameCallback(c)};O=ne.requestVideoFrameCallback(c)}else{const c=()=>{te(t.currentTime),$=requestAnimationFrame(c)};$=requestAnimationFrame(c)}},oe=()=>{fe?(ne.cancelVideoFrameCallback?.(O),O=0):(cancelAnimationFrame($),$=0)},Ve=()=>{oe(),u&&P({index:n,theme:u})};return t.addEventListener("play",ye),t.addEventListener("pause",oe),t.addEventListener("ended",Ve),!t.paused&&!t.ended&&ye(),()=>{oe(),t.removeEventListener("play",ye),t.removeEventListener("pause",oe),t.removeEventListener("ended",Ve)}},[n]),G(()=>{p.current.forEach((e,t)=>{t!==0&&e.current&&(e.current.pause(),e.current.currentTime=0)})},[]),G(()=>{i.current.length!==0&&y("hero_banner_slide_view",{index:0,total:i.current.length,media_type:w(0),trigger:"initial"})},[y,w]);const Ue=!!r[n]?.isShowVideo,Le=ke!==void 0,q=!Le&&Ue&&F!==null&&F>5&&b!=="ended"&&b!==null,Ye=Le||q,We=q?b==="paused":g==="STOPPED",Ze=()=>{if(!q){Fe();return}const e=p.current[n]?.current;if(!e)return;const t=!e.paused;t?e.pause():e.play()?.catch(()=>{}),ee(t,n),ge(t,n)},Ee=k&&k.index===n?k.theme:r[n]?.theme;return h("div",{ref:qe,role:"region","aria-roledescription":"carousel","aria-label":m.carouselLabel,"data-ui-component-id":"HeroBanner",onFocus:De,onBlur:je,className:V("hero-banner-carousel group relative w-full overflow-hidden",Z==="default"?"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":"lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]",le.root,I),...ue,children:[a(Ke,{onSwiper:Ae,onSlideChange:Ie,onSlideChangeTransitionEnd:Re,onSliderFirstMove:Me,slidesPerView:1,loop:!0,initialSlide:0,allowTouchMove:!0,children:r.map((e,t)=>{const o=k&&k.index===t?k.theme:e.theme??"light";return a(Qe,{children:({isActive:u,isPrev:A,isNext:te})=>a(bt,{data:e,isActive:u,isAdjacent:A||te,slideIndex:t,slideLabel:`${m.slideStatus} ${t+1} / ${r.length}`,videoRef:p.current[t],containerSize:Z,theme:o,position:t+1,locale:pe,pageHandle:J,onPlayVideo:()=>D(t),onPrimaryClick:Y,onSecondaryClick:W,onTertiaryClick:ce})},t)})}),j&&a(rt,{onPrev:()=>Ce("prev"),onNext:()=>Ce("next"),prevLabel:m.prevSlide,nextLabel:m.nextSlide}),_&&a(st,{frameCount:r.length,activeIndex:n,resetNonce:ve,activeFrameIntervalSec:ke,isAutoplayEnabled:_,isTimerRunning:He,onSegmentClick:ze,segmentLabel:e=>`${m.slideStatus} ${e+1} / ${r.length}`,classPrefix:"hero-banner",theme:Ee}),Ye&&a(it,{isPaused:We,onToggle:Ze,pausedLabel:q?m.playVideo:m.playAutoplay,playingLabel:q?m.pauseVideo:m.pauseAutoplay,classPrefix:"hero-banner",theme:Ee}),a("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:_e}),f!==null&&r[f]?.secondaryButton&&a(ft,{visible:!0,videoUrl:r[f].secondaryButton?.isYoutubeVideo?void 0:r[f].secondaryButton?.videoUrl?.url,youTubeId:r[f].secondaryButton?.isYoutubeVideo?r[f].secondaryButton?.youtubeId:void 0,onCloseModal:()=>D(null)})]})});Ne.displayName="HeroBannerCarousel";var It=Ne;export{It as default};
1
+ "use client";import{Fragment as St,jsx as a,jsxs as h}from"react/jsx-runtime";import he,{useRef as Se,useEffect as G,useCallback as E,useState as re}from"react";import{Swiper as Ke,SwiperSlide as Qe}from"swiper/react";import Xe from"../../helpers/ScrollLoadVideo.js";import{cn as V,getLocalizedPath as et}from"../../helpers/index.js";import{buildPictureSource as tt,resolveTierMedia as U,useMediaTier as Be}from"./mediaResolver.js";import{Button as ie,Heading as nt,Text as Te,Countdown as ot,Picture as xe}from"../../components/index.js";import{useCarouselPlayback as at}from"../../hooks/useCarouselPlayback.js";import{CarouselArrows as rt,CarouselCornerToggle as it,CarouselProgressControls as st}from"../../shared/CarouselControls.js";import{buildClickTrackingProps as lt,gaTrack as dt,resolveComponentMediaType as Pe,trackComponentClick as ct}from"../../shared/track.js";import{buildPageGroup as ut,buildTrackingRef as pt,trackUrlRef as mt}from"../../shared/trackUrlRef.js";import{useExposure as gt}from"../../hooks/useExposure.js";import{useAiuiContext as vt}from"../AiuiProvider/index.js";import{VideoModal as ft}from"../VideoModal/index.js";import"swiper/css";const yt=({size:d="base"})=>{const I=d==="lg"?"20":d==="sm"?"16":"18";return a("svg",{width:I,height:I,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:a("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},se="hero_banner",bt=({data:d,isActive:I,isAdjacent:le=!1,videoRef:de,slideIndex:Y,containerSize:W="default",theme:ce="light",slideLabel:ue,position:T,locale:r,pageHandle:R,onPlayVideo:Z,onPrimaryClick:m,onSecondaryClick:pe,onTertiaryClick:J})=>{const{pcImage:K,isVideoLoop:M=!0,isShowVideo:B,title:x,subtitle:b,label:z,endDate:F,endDate_tz:Q,dateFormat:k,iconArray:P,caption:f,blockLink:D,primaryButton:i,secondaryButton:s,tertiaryButton:l,align:C="left",titleSize:N}=d,_=Be(),p=tt(d),j=U(d,"lgDesktop","image")?.alt||K?.alt||"",y=U(d,_,"video")?.url||"",w=!!p&&!/\.(mp4|mov|webm|m4v)(\?|$)/i.test(p),X=Pe(B),me=U(d,_,B?"video":"image")?.id||K?.id||"",ee=`${pt(R??"",X,se)}_${T}`,ge=n=>n&&r?et(n,r):n,H=n=>n?mt(ge(n),ee):void 0,S=(n,g)=>lt({interactive:n,componentType:X,componentName:se,title:x,description:b,buttonName:g,position:T,creativeId:me});return h("div",{"data-ui-component-id":"HeroBannerSlide",role:"group","aria-roledescription":"slide","aria-label":ue,className:V("text-info-primary relative w-full overflow-hidden transition-colors duration-500",ce==="dark"&&"aiui-dark",W==="default"?"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":"lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]"),children:[D&&a("a",{className:"absolute inset-0 z-10",href:H(D),tabIndex:-1,"aria-hidden":"true","aria-label":x?.trim()||b?.trim()||j||void 0,...S(!0)}),B?h(St,{children:[a(Xe,{videoRef:de,src:y,poster:void 0,className:"absolute inset-0 size-full transition-opacity duration-500",videoClassName:"size-full object-cover",videoLayerClassName:"opacity-0",muted:!0,loop:M,playsInline:!0,onPlaying:n=>{const g=n.currentTarget;g.parentElement?.classList.remove("opacity-0"),g.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:n=>{const g=n.currentTarget;if(g.currentTime>=.5)return;g.parentElement?.classList.add("opacity-0"),g.closest('[data-ui-component-id="HeroBannerSlide"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),w&&a("div",{"data-video-poster":"true",className:"bg-container-primary pointer-events-none absolute inset-0 size-full transition-opacity duration-500",children:a(xe,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:Y===0||le?"eager":"lazy",fetchPriority:Y===0?"high":"auto",alt:j,source:p})})]}):a(xe,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:j,source:p}),h("div",{className:V("laptop:top-1/2 laptop:-translate-y-1/2 lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px] transition-colors duration-500",C==="center"?"left-1/2 -translate-x-1/2 items-center text-center":"px-grid left-0"),children:[h("div",{className:V("tablet:max-w-[704px] laptop:max-w-[440px] desktop:max-w-[648px] lg-desktop:max-w-[824px] max-w-[358px] transition-colors duration-500",C==="center"?"text-center":"laptop:text-left"),children:[z&&a(Te,{size:2,as:"p",className:V("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:z}),x&&a(nt,{as:N==="4"?"h1":"h2",html:x,size:N?Number(N||"5"):W==="sm"?4:5}),b&&a(Te,{as:"p",size:2,className:"font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",html:b}),F&&a("div",{className:"mt-3",children:a(ot,{endDate:F,endDate_tz:Q,dateFormat:k,variant:"spacious",align:C})})]}),(i?.text||s?.text||l?.text)&&h("div",{className:V("lg-desktop:gap-3 pointer-events-auto flex flex-wrap items-center gap-2",C==="center"?"justify-center":"laptop:justify-start"),children:[s?.isShowPlayVideoButton&&s?.playVideoButtonText?h(ie,{size:"lg",variant:"secondary",className:"hero-banner-play-video-button",onClick:()=>Z?.(),...S(!0,"video play"),children:[s.playVideoButtonText," ",a(yt,{size:"lg"})]}):s?.text?h(ie,{size:"lg",variant:"secondary",as:s?.isCustomSecondaryButton?"button":"a",href:H(s.link),target:s?.target,rel:s?.target==="_blank"?s?.rel??"noopener noreferrer":s?.rel,onClick:n=>s?.isCustomSecondaryButton&&pe?.(d,n,s?.customSecondaryEventId),...S(!!(s.link||s.isCustomSecondaryButton),s.text),children:[s.text,a("span",{className:"sr-only",children:x??b})]}):null,i?.text&&a(ie,{size:"lg",variant:"primary",as:i?.isCustomPrimaryButton?"button":"a",href:H(i.link),target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:n=>i?.isCustomPrimaryButton&&m?.(d,n,i?.customPrimaryEventId),...S(!!(i.link||i.isCustomPrimaryButton),i.text),children:i.text}),l?.text&&h(ie,{size:"lg",variant:"link",className:"tablet:basis-auto basis-full",as:l?.isCustomTertiaryButton?"button":"a",href:H(l.link),target:l?.target,rel:l?.target==="_blank"?l?.rel??"noopener noreferrer":l?.rel,onClick:n=>l?.isCustomTertiaryButton&&J?.(d,n,l?.customTertiaryEventId),...S(!!(l.link||l.isCustomTertiaryButton),l.text),children:[l.text,a("span",{className:"sr-only",children:x??b})]})]}),P&&P.length>0&&a("div",{className:V("flex items-center gap-2",C==="center"?"justify-center":"justify-start"),children:P.map(n=>a("div",{className:"h-12",children:a(xe,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",alt:n?.pcImage?.alt||"",source:n?.pcImage?.url})},n?.pcImage?.url||n?.pcImage?.alt))})]}),f&&f.length>0&&a("div",{className:"hero-banner-caption-group laptop:gap-3 px-grid desktop:pb-[24px] pointer-events-none absolute bottom-0 z-10 flex items-stretch gap-2 pb-[16px]",children:f.map((n,g)=>h(he.Fragment,{children:[a(Te,{size:2,className:"hero-banner-product-text tablet:w-[108px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]",html:n.title}),g<f.length-1&&a("div",{className:"bg-info-primary w-px"})]},n.title))})]})},ht={prevSlide:"Previous slide",nextSlide:"Next slide",pauseAutoplay:"Pause autoplay",playAutoplay:"Play autoplay",pauseVideo:"Pause video",playVideo:"Play video",slideStatus:"Slide",carouselLabel:"Banner carousel"},Ne=he.forwardRef(({data:d,className:I,classNames:le={},a11yLabels:de,onPrimaryClick:Y,onSecondaryClick:W,onTertiaryClick:ce,...ue},T)=>{const r=d.items||[],R=d.carousel,Z=R?.size??d.size??"default",m={...ht,...de},{locale:pe,pageHandle:J,trackingData:K}=vt(),M=Be(),B=ut({pageHandle:J,pageGroup:K?.pageGroup}),x=Se(null),[b,z]=re(null),[F,Q]=re(null),[k,P]=re(null),[f,D]=re(null),i=Se(r);G(()=>{i.current=r});const s=e=>e!==void 0&&e!==999&&e>=5,l=e=>e!==void 0&&e!==999&&e>=1&&e<=30,C=R?.autoplaySeconds,N=e=>{const t=e?.autoplaySeconds;return l(t)?t:s(C)?C:void 0},_=r.length>1&&r.some(e=>N(e)!==void 0),p=Se(r.map(()=>he.createRef())),j=(R?.showArrows??!0)&&r.length>1,y=E((e,t)=>{dt({event:"ga4Event",event_name:e,event_parameters:t})},[]),w=E(e=>i.current[e]?.isShowVideo?"video":"image",[]),X=E((e,t)=>{t==="swipe"&&y("hero_banner_swipe",{to_index:e}),y("hero_banner_slide_view",{index:e,total:i.current.length,media_type:w(e),trigger:t})},[y,w]),me=E((e,t,o,u="arrow")=>{y("hero_banner_arrow_click",{direction:e,from_index:t,to_index:o,source:u})},[y]),ee=E((e,t)=>{y(e?"hero_banner_pause":"hero_banner_resume",{index:t,media_type:w(t)})},[y,w]),ge=E((e,t)=>{const o=i.current[t];o&&ct({pageGroup:B,componentType:"video",componentName:se,position:t+1,buttonName:e?"video pause":"video play",componentTitle:o.title,componentDescription:o.subtitle,creativeId:U(o,M,"video")?.id||o.pcImage?.id||""})},[B,M]),H=E(e=>{p.current.forEach((o,u)=>{u!==e&&o.current&&(o.current.pause(),o.current.currentTime=0)});const t=p.current[e];t?.current&&(t.current.currentTime=0,t.current.play()?.catch(()=>{}))},[]),{rootRef:S,activeIndex:n,playbackState:g,resetNonce:ve,announcement:_e,activeFrameIntervalSec:ke,isTimerRunning:He,handleSwiperInit:Ae,handleSlideChange:Ie,handleTransitionEnd:Re,handleSliderFirstMove:Me,goToSlide:Ce,goToSlideIndex:ze,handlePausePlayClick:Fe,notifyVideoPlaying:we,handleFocus:De,handleBlur:je}=at({frameCount:r.length,resolveFrameIntervalSec:e=>N(r[e]),isAutoplayEnabled:_,swiperRef:x,slideStatusLabel:m.slideStatus,onSlideMediaSync:H,onSlideChange:X,onArrowNavigate:me,delaysCountdownForVideo:e=>!!i.current[e]?.isShowVideo,onPauseToggle:(e,t)=>{ee(e,t);const o=p.current[t]?.current;o&&(e?o.pause():o.ended||o.play()?.catch(()=>{}))}}),qe=E(e=>{S.current=e,typeof T=="function"?T(e):T&&(T.current=e)},[T,S]),v=r[n]??r[0],$e=Pe(v?.isShowVideo),Oe=v?.title!==void 0?v?.title?.trim()||v?.subtitle?.trim()||v?.pcImage?.alt?.trim()||void 0:v?.subtitle&&v.subtitle.trim()||"",Ge=v&&(U(v,M,v.isShowVideo?"video":"image")?.id||v.pcImage?.id)||"";gt(S,{componentType:$e,componentName:se,componentTitle:Oe,componentDescription:v?.subtitle?.trim()||"",creativeId:Ge,position:1}),G(()=>{z(null),Q(null);const e=i.current[n],t=p.current[n]?.current;if(!e?.isShowVideo||!t)return;const o=()=>z(t.ended?"ended":t.paused?"paused":"playing"),u=()=>Q(Number.isFinite(t.duration)?t.duration:null),A=()=>{o(),we(n)};return o(),u(),t.addEventListener("playing",A),t.addEventListener("pause",o),t.addEventListener("ended",o),t.addEventListener("loadedmetadata",u),()=>{t.removeEventListener("playing",A),t.removeEventListener("pause",o),t.removeEventListener("ended",o),t.removeEventListener("loadedmetadata",u)}},[n,we]),G(()=>{const e=i.current[n];if(!e?.isShowVideo||!e?.isMultiThemeEnabled)return;const t=p.current[n]?.current;if(!t)return;const o=(c,L,ae,be)=>{if(!(!c||typeof L!="number"||typeof ae!="number"||typeof be!="number"))return be>=L&&be<ae?c:void 0};let u=null;const A=c=>{u=c,P(L=>L&&L.index===n&&L.theme===c?L:{index:n,theme:c})},te=c=>{A(o(e.theme_1,e.star_time_1,e.end_time_1,c)??o(e.theme_2,e.star_time_2,e.end_time_2,c)??e.theme??"light")},ne=t;let $=0,O=0;const fe=typeof ne.requestVideoFrameCallback=="function",Je=()=>fe?O!==0:$!==0,ye=()=>{if(!Je())if(fe){const c=(L,ae)=>{te(ae.mediaTime),O=ne.requestVideoFrameCallback(c)};O=ne.requestVideoFrameCallback(c)}else{const c=()=>{te(t.currentTime),$=requestAnimationFrame(c)};$=requestAnimationFrame(c)}},oe=()=>{fe?(ne.cancelVideoFrameCallback?.(O),O=0):(cancelAnimationFrame($),$=0)},Ve=()=>{oe(),u&&P({index:n,theme:u})};return t.addEventListener("play",ye),t.addEventListener("pause",oe),t.addEventListener("ended",Ve),!t.paused&&!t.ended&&ye(),()=>{oe(),t.removeEventListener("play",ye),t.removeEventListener("pause",oe),t.removeEventListener("ended",Ve)}},[n]),G(()=>{p.current.forEach((e,t)=>{t!==0&&e.current&&(e.current.pause(),e.current.currentTime=0)})},[]),G(()=>{i.current.length!==0&&y("hero_banner_slide_view",{index:0,total:i.current.length,media_type:w(0),trigger:"initial"})},[y,w]);const Ue=!!r[n]?.isShowVideo,Le=ke!==void 0,q=!Le&&Ue&&F!==null&&F>5&&b!=="ended"&&b!==null,Ye=Le||q,We=q?b==="paused":g==="STOPPED",Ze=()=>{if(!q){Fe();return}const e=p.current[n]?.current;if(!e)return;const t=!e.paused;t?e.pause():e.play()?.catch(()=>{}),ee(t,n),ge(t,n)},Ee=k&&k.index===n?k.theme:r[n]?.theme;return h("div",{ref:qe,role:"region","aria-roledescription":"carousel","aria-label":m.carouselLabel,"data-ui-component-id":"HeroBanner",onFocus:De,onBlur:je,className:V("hero-banner-carousel group relative w-full overflow-hidden",Z==="default"?"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":"lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]",le.root,I),...ue,children:[a(Ke,{onSwiper:Ae,onSlideChange:Ie,onSlideChangeTransitionEnd:Re,onSliderFirstMove:Me,slidesPerView:1,loop:!0,initialSlide:0,allowTouchMove:!0,children:r.map((e,t)=>{const o=k&&k.index===t?k.theme:e.theme??"light";return a(Qe,{children:({isActive:u,isPrev:A,isNext:te})=>a(bt,{data:e,isActive:u,isAdjacent:A||te,slideIndex:t,slideLabel:`${m.slideStatus} ${t+1} / ${r.length}`,videoRef:p.current[t],containerSize:Z,theme:o,position:t+1,locale:pe,pageHandle:J,onPlayVideo:()=>D(t),onPrimaryClick:Y,onSecondaryClick:W,onTertiaryClick:ce})},t)})}),j&&a(rt,{onPrev:()=>Ce("prev"),onNext:()=>Ce("next"),prevLabel:m.prevSlide,nextLabel:m.nextSlide}),_&&a(st,{frameCount:r.length,activeIndex:n,resetNonce:ve,activeFrameIntervalSec:ke,isAutoplayEnabled:_,isTimerRunning:He,onSegmentClick:ze,segmentLabel:e=>`${m.slideStatus} ${e+1} / ${r.length}`,classPrefix:"hero-banner",theme:Ee}),Ye&&a(it,{isPaused:We,onToggle:Ze,pausedLabel:q?m.playVideo:m.playAutoplay,playingLabel:q?m.pauseVideo:m.pauseAutoplay,classPrefix:"hero-banner",theme:Ee}),a("div",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:_e}),f!==null&&r[f]?.secondaryButton&&a(ft,{visible:!0,videoUrl:r[f].secondaryButton?.isYoutubeVideo?void 0:r[f].secondaryButton?.videoUrl?.url,youTubeId:r[f].secondaryButton?.isYoutubeVideo?r[f].secondaryButton?.youtubeId:void 0,onCloseModal:()=>D(null)})]})});Ne.displayName="HeroBannerCarousel";var It=Ne;export{It as default};
@@ -2,7 +2,7 @@ import React, { type Dispatch, type SetStateAction, type PropsWithChildren } fro
2
2
  import type { Product, ProductPrice, ProductVariant, VariantCoupon, Options, FreeGift } from './types/product';
3
3
  import type { BundleOption, ProductBundleProps } from './components/ProductCard/ProductDetail/ProductBundle/types.js';
4
4
  import type { ProductFunctionFreeGiftProps } from './components/ProductCard/ProductDetail/ProductFunctionFreeGift';
5
- import type { CompareData, DiscountData } from './types.js';
5
+ import type { CompareData, DiscountData, ListingFormattedPrices } from './types.js';
6
6
  type Country = {
7
7
  id?: number;
8
8
  name?: string;
@@ -76,6 +76,8 @@ export type JoinedRecommendBuyProducts = {
76
76
  };
77
77
  export type CreditsRedemption = {
78
78
  amount: number;
79
+ /** 宿主已格式化的积分抵现金额(含货币符号)。未传入时回退到内置 formatPrice */
80
+ formattedAmount?: string;
79
81
  availablePoints: number;
80
82
  usedPoints: number;
81
83
  skuDetails?: {
@@ -102,6 +104,10 @@ export interface ProductContextType {
102
104
  finalPrice: number;
103
105
  comparePrice: number;
104
106
  totalSavings: number;
107
+ /**
108
+ * 宿主已格式化好的价格字符串。字段缺失时对应位置回退到内置 formatPrice(已废弃,将在下个大版本移除)。
109
+ */
110
+ formattedPrices?: ListingFormattedPrices;
105
111
  selectedOptions: Options;
106
112
  setSelectedOptions: Dispatch<SetStateAction<Options>>;
107
113
  freeGift?: FreeGift;
@@ -139,5 +145,5 @@ export interface ProductContextType {
139
145
  }
140
146
  export declare const BizProductContext: React.Context<ProductContextType>;
141
147
  export declare const useBizProductContext: () => ProductContextType;
142
- declare const ProductProvider: ({ product, isLogin, profile, isMobile, isDesktop, children, renderRating, freeGift, bundle, checkedBundle, checkedGift, setCheckedBundle, setCheckedGift, functionFreeGift, checkedFunctionGifts, setCheckedFunctionGifts, variant, selectedOptions, setSelectedOptions, compareData, coupon, finalPrice, comparePrice, totalSavings, savingDetail, setSavingDetail, selectedVariants, onAddToCart, onBuyNow, creditsRedemption, memberFunctionResult, openModal, openSignInPopup, openAuthCodePopup, openSignUpPopup, renderInstallments, onUseCouponChange, onUseMemberDiscountChange, discount, buyNowLoading, addToCartLoading, notifyMeMode, onNotifyMeClick, }: PropsWithChildren<Omit<ProductContextType, "joinedRecommendBuyProducts" | "setJoinedRecommendBuyProducts" | "addOrder" | "setAddOrder" | "resolvedPayload">>) => import("react/jsx-runtime").JSX.Element;
148
+ declare const ProductProvider: ({ product, isLogin, profile, isMobile, isDesktop, children, renderRating, freeGift, bundle, checkedBundle, checkedGift, setCheckedBundle, setCheckedGift, functionFreeGift, checkedFunctionGifts, setCheckedFunctionGifts, variant, selectedOptions, setSelectedOptions, compareData, coupon, finalPrice, comparePrice, totalSavings, formattedPrices, savingDetail, setSavingDetail, selectedVariants, onAddToCart, onBuyNow, creditsRedemption, memberFunctionResult, openModal, openSignInPopup, openAuthCodePopup, openSignUpPopup, renderInstallments, onUseCouponChange, onUseMemberDiscountChange, discount, buyNowLoading, addToCartLoading, notifyMeMode, onNotifyMeClick, }: PropsWithChildren<Omit<ProductContextType, "joinedRecommendBuyProducts" | "setJoinedRecommendBuyProducts" | "addOrder" | "setAddOrder" | "resolvedPayload">>) => import("react/jsx-runtime").JSX.Element;
143
149
  export default ProductProvider;
@@ -1 +1 @@
1
- import{jsx as ae}from"react/jsx-runtime";import{createContext as te,useContext as d,useState as c,useEffect as oe,useMemo as ne}from"react";import{VARIANT_PAYLOAD_EXCLUDED_KEYS as re}from"./const.js";const n=te({}),le=()=>{if(!d(n))throw new Error("useProductContext must be used in <ProductProvider>");return d(n)},ie=({product:t,isLogin:u,profile:s,isMobile:p,isDesktop:l,children:m,renderRating:P,freeGift:b,bundle:g,checkedBundle:y,checkedGift:f,setCheckedBundle:C,setCheckedGift:h,functionFreeGift:v,checkedFunctionGifts:S,setCheckedFunctionGifts:x,variant:e,selectedOptions:D,setSelectedOptions:B,compareData:R,coupon:A,finalPrice:O,comparePrice:k,totalSavings:_,savingDetail:F,setSavingDetail:M,selectedVariants:V,onAddToCart:G,onBuyNow:T,creditsRedemption:N,memberFunctionResult:w,openModal:E,openSignInPopup:J,openAuthCodePopup:U,openSignUpPopup:L,renderInstallments:j,onUseCouponChange:W,onUseMemberDiscountChange:z,discount:I,buyNowLoading:K,addToCartLoading:Y,notifyMeMode:X,onNotifyMeClick:q})=>{const[H,r]=c({}),[Q,i]=c([]),Z=ne(()=>{const $=e?.payload?.components??[],ee=re;return $.filter(o=>{const a=o.componentKey??o.blockType??o.blockName;return a&&!ee.includes(a)}).length>0?e?.payload:t?.payload},[e?.payload,t?.payload]);return oe(()=>{e?.id&&(r({bundle:{value:void 0,canOperate:!0},gift:{value:void 0,canOperate:!0},exchange:{value:void 0,canOperate:!0}}),i([]))},[e?.id]),ae(n.Provider,{value:{product:t,variant:e,isMobile:p,isDesktop:l,isLogin:u,profile:s,coupon:A,renderRating:P,finalPrice:O,comparePrice:k,savingDetail:F,setSavingDetail:M,totalSavings:_,selectedOptions:D,setSelectedOptions:B,freeGift:b,functionFreeGift:v,checkedFunctionGifts:S,setCheckedFunctionGifts:x,checkedGift:f,setCheckedGift:h,checkedBundle:y,setCheckedBundle:C,bundle:g,compareData:R,selectedVariants:V,onAddToCart:G,onBuyNow:T,joinedRecommendBuyProducts:H,setJoinedRecommendBuyProducts:r,creditsRedemption:N,memberFunctionResult:w,openModal:E,openSignInPopup:J,openAuthCodePopup:U,openSignUpPopup:L,renderInstallments:j,onUseCouponChange:W,onUseMemberDiscountChange:z,discount:I,buyNowLoading:K,addToCartLoading:Y,notifyMeMode:X,onNotifyMeClick:q,addOrder:Q,setAddOrder:i,resolvedPayload:Z},children:m})};var me=ie;export{n as BizProductContext,me as default,le as useBizProductContext};
1
+ import{jsx as de}from"react/jsx-runtime";import{createContext as oe,useContext as d,useState as c,useEffect as ne,useMemo as re}from"react";import{VARIANT_PAYLOAD_EXCLUDED_KEYS as ie}from"./const.js";const n=oe({}),me=()=>{if(!d(n))throw new Error("useProductContext must be used in <ProductProvider>");return d(n)},ae=({product:t,isLogin:u,profile:s,isMobile:p,isDesktop:l,children:m,renderRating:P,freeGift:b,bundle:g,checkedBundle:y,checkedGift:f,setCheckedBundle:C,setCheckedGift:h,functionFreeGift:v,checkedFunctionGifts:S,setCheckedFunctionGifts:x,variant:e,selectedOptions:D,setSelectedOptions:B,compareData:R,coupon:A,finalPrice:O,comparePrice:k,totalSavings:_,formattedPrices:F,savingDetail:M,setSavingDetail:V,selectedVariants:G,onAddToCart:T,onBuyNow:N,creditsRedemption:w,memberFunctionResult:E,openModal:J,openSignInPopup:L,openAuthCodePopup:U,openSignUpPopup:j,renderInstallments:W,onUseCouponChange:z,onUseMemberDiscountChange:I,discount:K,buyNowLoading:Y,addToCartLoading:X,notifyMeMode:q,onNotifyMeClick:H})=>{const[Q,r]=c({}),[Z,i]=c([]),$=re(()=>{const ee=e?.payload?.components??[],te=ie;return ee.filter(o=>{const a=o.componentKey??o.blockType??o.blockName;return a&&!te.includes(a)}).length>0?e?.payload:t?.payload},[e?.payload,t?.payload]);return ne(()=>{e?.id&&(r({bundle:{value:void 0,canOperate:!0},gift:{value:void 0,canOperate:!0},exchange:{value:void 0,canOperate:!0}}),i([]))},[e?.id]),de(n.Provider,{value:{product:t,variant:e,isMobile:p,isDesktop:l,isLogin:u,profile:s,coupon:A,renderRating:P,finalPrice:O,comparePrice:k,formattedPrices:F,savingDetail:M,setSavingDetail:V,totalSavings:_,selectedOptions:D,setSelectedOptions:B,freeGift:b,functionFreeGift:v,checkedFunctionGifts:S,setCheckedFunctionGifts:x,checkedGift:f,setCheckedGift:h,checkedBundle:y,setCheckedBundle:C,bundle:g,compareData:R,selectedVariants:G,onAddToCart:T,onBuyNow:N,joinedRecommendBuyProducts:Q,setJoinedRecommendBuyProducts:r,creditsRedemption:w,memberFunctionResult:E,openModal:J,openSignInPopup:L,openAuthCodePopup:U,openSignUpPopup:j,renderInstallments:W,onUseCouponChange:z,onUseMemberDiscountChange:I,discount:K,buyNowLoading:Y,addToCartLoading:X,notifyMeMode:q,onNotifyMeClick:H,addOrder:Z,setAddOrder:i,resolvedPayload:$},children:m})};var Pe=ae;export{n as BizProductContext,Pe as default,me as useBizProductContext};
@@ -1 +1 @@
1
- import{jsx as o,jsxs as a}from"react/jsx-runtime";import{formatPrice as b}from"../../utils/index.js";import{useAiuiContext as f}from"../../../AiuiProvider/index.js";import{Text as r}from"../../../../components/index.js";import{cn as t}from"../../../../helpers/index.js";import{ShippingMethodMode as u}from"./type.js";const g=({item:e,index:p,active:i,toggleShipping:l,currencyCode:n,metafields:x,className:s=""})=>{const{copyWriting:m,locale:c="us"}=f();return a("div",{role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&l(e,p)},className:t("relative flex cursor-pointer justify-between gap-[16px] desktop:gap-3 lg-desktop:gap-5 overflow-hidden rounded-box border-2 border-[#E8E8E8] px-4 text-[#1F2021]",{"cursor-not-allowed opacity-60":e.disabled,"border-brand":i},s),onClick:()=>l(e,p),children:[a("div",{className:"relative flex flex-col justify-center",children:[o(r,{className:t("laptop:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold leading-[1.4]",{}),as:"p",html:e.title}),o(r,{className:t("laptop:text-[14px] lg-desktop:mt-1 text-[12px] font-bold leading-[1.4] text-[#6D6D6F]",{}),as:"p",html:e.subtitle})]}),o(r,{className:t("relative my-auto h-fit text-[18px] desktop:text-xl lg-desktop:text-2xl font-bold",{}),as:"p",html:e.price?b({amount:e.price,currencyCode:n,locale:c,removeTrailingZeros:!0}):m?.free}),e.mode!==u.FREE&&o("div",{className:t("bg-brand-0 absolute -right-px -top-px rounded-bl-[8px] rounded-tr-[8px] overflow-hidden px-[8px] py-[2px] desktop:text-[14px] text-[12px] font-bold leading-[1.4] text-white"),children:x?.memberOnly})]})};var w=g;export{w as default};
1
+ import{jsx as o,jsxs as a}from"react/jsx-runtime";import{formatPrice as f}from"../../utils/index.js";import{useAiuiContext as b}from"../../../AiuiProvider/index.js";import{Text as r}from"../../../../components/index.js";import{cn as t}from"../../../../helpers/index.js";import{ShippingMethodMode as u}from"./type.js";const g=({item:e,index:p,active:i,toggleShipping:l,currencyCode:n,metafields:x,className:s=""})=>{const{copyWriting:m,locale:c="us"}=b();return a("div",{role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&l(e,p)},className:t("relative flex cursor-pointer justify-between gap-[16px] desktop:gap-3 lg-desktop:gap-5 overflow-hidden rounded-box border-2 border-[#E8E8E8] px-4 text-[#1F2021]",{"cursor-not-allowed opacity-60":e.disabled,"border-brand":i},s),onClick:()=>l(e,p),children:[a("div",{className:"relative flex flex-col justify-center",children:[o(r,{className:t("laptop:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold leading-[1.4]",{}),as:"p",html:e.title}),o(r,{className:t("laptop:text-[14px] lg-desktop:mt-1 text-[12px] font-bold leading-[1.4] text-[#6D6D6F]",{}),as:"p",html:e.subtitle})]}),o(r,{className:t("relative my-auto h-fit text-[18px] desktop:text-xl lg-desktop:text-2xl font-bold",{}),as:"p",html:e.price?e.formattedPrice??f({amount:e.price,currencyCode:n,locale:c,removeTrailingZeros:!0}):m?.free}),e.mode!==u.FREE&&o("div",{className:t("bg-brand-0 absolute -right-px -top-px rounded-bl-[8px] rounded-tr-[8px] overflow-hidden px-[8px] py-[2px] desktop:text-[14px] text-[12px] font-bold leading-[1.4] text-white"),children:x?.memberOnly})]})};var w=g;export{w as default};
@@ -1,4 +1,4 @@
1
- import{Fragment as I,jsx as e,jsxs as a}from"react/jsx-runtime";import{Button as re,Checkbox as pe,Text as c,Picture as T,Heading as O,Link as ce}from"../../../../../components/index.js";import u from"./ProductBenefitsTabs/index.js";import{useBizProductContext as $}from"../../../BizProductProvider.js";import{useComponentData as de}from"../../../hooks/useComponentData.js";import{useBenefits as ue}from"../../../hooks/useBenefits.js";import{formatPrice as D}from"../../../utils/index.js";import{replaceTemplate as G}from"../../../utils/textFormat.js";import fe,{useEffect as W,useMemo as q,useRef as me,useState as P}from"react";import{useAiuiContext as Y}from"../../../../AiuiProvider/index.js";import be from"../../../../../hooks/useCountDown.js";import ge from"../../../hooks/useCopy.js";import{cn as y}from"../../../../../helpers/index.js";import xe from"./ProductBenefitsTabs/ModalContainer.js";import{withLayout as Ce}from"../../../../../shared/Styles.js";import he from"./CreditCouponRedeem/index.js";const ve={couponCode:"Code",copyCode:"Copy Code",copied:"Copied",expired:"Expired",offCoupon:"{discount} off coupon",offMemberOnly:"{amount} off Member Only",loginNow:"Login now",selectFreeGift:"You can select the free gift below.",bundleSaveUpTo:"Bundle purchases save extra up to",bundleOffer:"We offer {count} bundle for you",creditsTitle:"Soundcore credits for cash",creditsDesc:"100 Soundcore credits=$1",off:" off",memberBenefitsNotLogin:"You will enjoy a {amount} member discount after logging in.",memberBenefitsNotLoginText:"Sign Up to Get Benefits Below",forNewMember:"{amount} off for New Member",expressShipping:"Express Shipping Method",creditsAfterActivation:"You will get soundcoreCredits after activation. ",active:"Active",flexibleInstallment:"Flexible installment payment "},ye=fe.memo(function({endsAt:x,daysLeft:i,endsText:l,daysText:f,hurryLabel:m,expiredText:C,onOpenModal:B}){const{days:s,hours:N,minutes:d,seconds:F}=be({endTime:x});return e("button",{onClick:B,className:"lg-desktop:mt-[24px] text-brand-0 laptop-md:mt-4 lg-desktop:text-[16px] md-l:hidden mt-[14px] text-left text-[14px] font-bold text-[#1F2021]",children:Number(s)<Number(i)?a(I,{children:[a("span",{children:[l," ",s==="00"?"0":s," ",f]}),e("span",{className:"font-bold",children:` ${N.toString()}:${d.toString()}:${F.toString()}`})]}):m||C})}),Be=({item:n,textConfig:x,benefitPayloadData:i})=>{const{trackingData:l}=Y(),{copied:f,copy:m}=ge(),[C,B]=P(!1),s=l?.common?.coupon,{openModal:N}=$();return a(I,{children:[e("style",{jsx:!0,children:`
1
+ import{Fragment as F,jsx as e,jsxs as a}from"react/jsx-runtime";import{Button as re,Checkbox as pe,Text as d,Picture as D,Heading as O,Link as ce}from"../../../../../components/index.js";import m from"./ProductBenefitsTabs/index.js";import{useBizProductContext as $}from"../../../BizProductProvider.js";import{useComponentData as de}from"../../../hooks/useComponentData.js";import{useBenefits as ue}from"../../../hooks/useBenefits.js";import{formatPrice as k}from"../../../utils/index.js";import{replaceTemplate as G}from"../../../utils/textFormat.js";import fe,{useEffect as W,useMemo as q,useRef as me,useState as P}from"react";import{useAiuiContext as Y}from"../../../../AiuiProvider/index.js";import ge from"../../../../../hooks/useCountDown.js";import be from"../../../hooks/useCopy.js";import{cn as y}from"../../../../../helpers/index.js";import xe from"./ProductBenefitsTabs/ModalContainer.js";import{withLayout as Ce}from"../../../../../shared/Styles.js";import he from"./CreditCouponRedeem/index.js";const ve={couponCode:"Code",copyCode:"Copy Code",copied:"Copied",expired:"Expired",offCoupon:"{discount} off coupon",offMemberOnly:"{amount} off Member Only",loginNow:"Login now",selectFreeGift:"You can select the free gift below.",bundleSaveUpTo:"Bundle purchases save extra up to",bundleOffer:"We offer {count} bundle for you",creditsTitle:"Soundcore credits for cash",creditsDesc:"100 Soundcore credits=$1",off:" off",memberBenefitsNotLogin:"You will enjoy a {amount} member discount after logging in.",memberBenefitsNotLoginText:"Sign Up to Get Benefits Below",forNewMember:"{amount} off for New Member",expressShipping:"Express Shipping Method",creditsAfterActivation:"You will get soundcoreCredits after activation. ",active:"Active",flexibleInstallment:"Flexible installment payment "},ye=fe.memo(function({endsAt:C,daysLeft:i,endsText:l,daysText:g,hurryLabel:b,expiredText:h,onOpenModal:B}){const{days:s,hours:N,minutes:u,seconds:I}=ge({endTime:C});return e("button",{onClick:B,className:"lg-desktop:mt-[24px] text-brand-0 laptop-md:mt-4 lg-desktop:text-[16px] md-l:hidden mt-[14px] text-left text-[14px] font-bold text-[#1F2021]",children:Number(s)<Number(i)?a(F,{children:[a("span",{children:[l," ",s==="00"?"0":s," ",g]}),e("span",{className:"font-bold",children:` ${N.toString()}:${u.toString()}:${I.toString()}`})]}):b||h})}),Be=({item:n,textConfig:C,benefitPayloadData:i})=>{const{trackingData:l}=Y(),{copied:g,copy:b}=be(),[h,B]=P(!1),s=l?.common?.coupon,{openModal:N}=$();return a(F,{children:[e("style",{jsx:!0,children:`
2
2
  .coupon-card {
3
3
  /* \u4F7F\u7528mask\u521B\u5EFA\u5185\u5207\u5706\u89D2 */
4
4
  mask:
@@ -14,7 +14,7 @@ import{Fragment as I,jsx as e,jsxs as a}from"react/jsx-runtime";import{Button as
14
14
  bottom left;
15
15
  mask-repeat: no-repeat;
16
16
  }
17
- `}),a("div",{style:{background:n.couponBgColor||"white"},className:y("laptop:h-[112px] lg-desktop:h-[130px] relative h-[100px] overflow-hidden p-3",n.borderStyle==="inset"?"coupon-card ":"rounded-[8px]"),...n.useAble&&{role:"button",tabIndex:0,onClick:()=>{n?.onUseChange?.(C)!==!1&&B(!C)}},children:[n?.bgImage?.url&&e(T,{source:n.bgImage.url,alt:n.bgImage.alt,className:"absolute bottom-0 right-0 w-auto",imgClassName:"object-contain"}),a("div",{className:"z-1 relative ",children:[a("div",{className:"flex items-center justify-start",children:[n.useAble&&e(pe,{size:"lg",className:"data-[state=checked]:border-primary mr-2 rounded-full border-[1.6px] border-[#D1D1D1]",checked:n?.isAutoUse}),e(c,{html:n.title,className:"laptop:text-[20px] lg-desktop:text-[24px] text-[16px] font-bold leading-[1.2]"})]}),n.description&&e(c,{...typeof n.description=="string"?{html:n.description}:{},as:"p",className:"lg-desktop:text-[16px] mt-2 pr-8 text-[14px] font-bold text-[#3D3D3F]",children:n.description}),n.code&&a("div",{className:"laptop-md:mt-2 flex items-center gap-2",children:[e(c,{html:`${i?.couponBenefitData?.commonCoupon?.couponCode}: ${n.code}`,className:"lg-desktop:text-[16px] text-[14px] font-bold text-[#3D3D3F]"}),e(ce,{className:"lg-desktop:text-[16px] text-[14px] font-bold underline",role:"button",tabIndex:0,onClick:d=>{d.preventDefault(),d.stopPropagation(),m(n.code||"")},children:f?s?.copied||i?.couponBenefitData?.commonCoupon?.copied:s?.copy||i?.couponBenefitData?.commonCoupon?.copyCode})]}),n.ends_at&&e(ye,{endsAt:n.ends_at,daysLeft:s?.hurry?.daysLeft??0,endsText:s?.ends??"",daysText:s?.days??"",hurryLabel:s?.hurry?.label??"",expiredText:i?.couponBenefitData?.commonCoupon?.expired??"",onOpenModal:()=>{s?.modal&&N(s?.modal)}})]})]})]})},Ne=({coupons:n,className:x,textConfig:i,benefitPayloadData:l})=>e("div",{className:y("laptop:grid laptop:grid-cols-2 laptop-md:grid-cols-1 flex flex-col gap-3",x),children:n?.map((f,m)=>e(Be,{item:f,textConfig:i,benefitPayloadData:l},m))}),we=({creditCouponRedeem:n,textConfig:x})=>{const{profile:i,variant:l,renderInstallments:f,onUseCouponChange:m,onUseMemberDiscountChange:C,discount:B,savingDetail:s,openModal:N,openSignInPopup:d,openAuthCodePopup:F,openSignUpPopup:J,creditsRedemption:K}=$(),{usedPoints:Te=0,availablePoints:De=0}=K??{},[Q,A]=P(!1),b=de("ProductBenefits")??{},[X,U]=P(!1),ee=ue({variant:l}),{locale:w="us",copyWriting:te}=Y(),H=me(null),oe={...ve,...x},{activated:ne=!1}=i||{},{memberDiscount:h,commonCoupon:g,creditsRedemption:k,freeGift:Z,functionFreeGift:E,bundle:R,paidShipping:ae,fullGift:V,levelDiscount:z}=ee,t=q(()=>{const o=b?.benefitTabs?.find(p=>p?.value==="coupon")??{},r=b?.benefitTabs?.find(p=>p?.value==="membership")??{},M=b?.benefitTabs?.find(p=>p?.value==="installment")??{},L=b?.benefitTabs?.find(p=>p?.value==="pay")??{};return{couponBenefitData:o,membershipBenefitData:r,installmentBenefitData:M,payBenefitData:L}},[b]),v=[g?.enable?{...g.config,isAutoUse:s?.coupon>0,useAble:!0,borderStyle:"rounded",code:g?.config?.title??"",description:g?.config?.desc??"",onUseChange:o=>{const r=o?B?.codeSavings??0:0;m?.(r)},title:G(t?.couponBenefitData?.commonCoupon?.offCoupon,{discount:g?.config?.value_type=="percentage"?Math.abs(Number(g?.config?.value||0))+"%":D({amount:Math.abs(Number(g?.config?.fixed_value||0)),currencyCode:l.price.currencyCode,locale:w})})}:null,h.enable?{useAble:!0,isAutoUse:!!i?.email&&!!s?.member,title:G(t?.couponBenefitData?.member?.offMemberOnly,{amount:D({amount:h?.config?.amount??0,currencyCode:l.price.currencyCode,locale:w})}),description:a(I,{children:[i?.email?t?.couponBenefitData?.member?.memberDiscounts:t?.membershipBenefitData?.memberBenefitsNotLogin?.replace("{amount}",D({amount:h?.config?.amount??0,currencyCode:l.price.currencyCode,locale:w}))??""," ",i?.email?"":e("span",{role:"button",tabIndex:0,onClick:()=>d?.(),className:"underline",children:t?.couponBenefitData?.member?.loginNow})]}),borderStyle:"rounded",onUseChange:o=>{if(i?.email){const r=o?h?.config?.amount??0:0;return C?.(r),!0}else return d?.(),!1}}:null,z.enable?{title:z?.config?.title??"",description:z?.config?.tag??"",borderStyle:"inset",bgImage:{url:t?.couponBenefitData?.levelDiscount?.bgImage}}:null,E.enable?{title:E?.config?.title??"",description:t?.couponBenefitData?.freeGift?.selectFreeGift,borderStyle:"inset",bgImage:{url:t?.couponBenefitData?.freeGift?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,Z.enable?{title:Z?.config?.title??"",description:t?.couponBenefitData?.freeGift?.selectFreeGift,borderStyle:"inset",bgImage:{url:t?.couponBenefitData?.freeGift?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,R.enable?{title:`${t?.couponBenefitData?.bundle?.bundleSaveUpTo} ${R.config?.maxSavings}`,borderStyle:"inset",description:t?.couponBenefitData?.bundle?.bundleOffer.replace("{count}",R?.config?.bundleOptions?.length?.toString()??""),bgImage:{url:t?.couponBenefitData?.bundle?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,V.enable?{title:V?.config?.title??"",description:V?.config?.desc??"",borderStyle:"inset",bgImage:{url:t?.couponBenefitData?.fullGift?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,k.enable?{title:t?.couponBenefitData?.creditsRedemption?.creditsTitle,description:t?.couponBenefitData?.creditsRedemption?.creditsDesc,borderStyle:"inset",bgImage:{url:t?.couponBenefitData?.creditsRedemption?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null].filter(Boolean);W(()=>{_(v?.length?"coupon":"membership")},[v?.length]),W(()=>{A(!1)},[l?.id]);const[j,_]=P("coupon"),ie=()=>{F?.()},se=(o,r)=>{if(_(r),H.current){const M=H.current,L=o.currentTarget,p=L.offsetLeft-M.offsetWidth/2+L.offsetWidth/2;M.scrollTo({left:p,behavior:"smooth"})}},le=q(()=>b?.benefitTabs?.map(o=>o?.value==="coupon"&&!v?.length?null:o).filter(Boolean),[b,v]);return u?a(u,{className:"relative",onValueChange:o=>{_(o),A(o==="installment")},value:j,children:[e("div",{className:"absolute right-0 top-0 z-[1] h-[40px] w-[25px] rounded-xl bg-gradient-to-r from-transparent to-[#EAEAEC]"}),e(u.List,{ref:H,children:le?.map(o=>e(u.Trigger,{className:y(j===o.value&&"text-[#080A0F]"),value:o.value,onClick:r=>se(r,o?.value),children:o.label},o?.value))}),e("style",{global:!0,jsx:!0,children:`
17
+ `}),a("div",{style:{background:n.couponBgColor||"white"},className:y("laptop:h-[112px] lg-desktop:h-[130px] relative h-[100px] overflow-hidden p-3",n.borderStyle==="inset"?"coupon-card ":"rounded-[8px]"),...n.useAble&&{role:"button",tabIndex:0,onClick:()=>{n?.onUseChange?.(h)!==!1&&B(!h)}},children:[n?.bgImage?.url&&e(D,{source:n.bgImage.url,alt:n.bgImage.alt,className:"absolute bottom-0 right-0 w-auto",imgClassName:"object-contain"}),a("div",{className:"z-1 relative ",children:[a("div",{className:"flex items-center justify-start",children:[n.useAble&&e(pe,{size:"lg",className:"data-[state=checked]:border-primary mr-2 rounded-full border-[1.6px] border-[#D1D1D1]",checked:n?.isAutoUse}),e(d,{html:n.title,className:"laptop:text-[20px] lg-desktop:text-[24px] text-[16px] font-bold leading-[1.2]"})]}),n.description&&e(d,{...typeof n.description=="string"?{html:n.description}:{},as:"p",className:"lg-desktop:text-[16px] mt-2 pr-8 text-[14px] font-bold text-[#3D3D3F]",children:n.description}),n.code&&a("div",{className:"laptop-md:mt-2 flex items-center gap-2",children:[e(d,{html:`${i?.couponBenefitData?.commonCoupon?.couponCode}: ${n.code}`,className:"lg-desktop:text-[16px] text-[14px] font-bold text-[#3D3D3F]"}),e(ce,{className:"lg-desktop:text-[16px] text-[14px] font-bold underline",role:"button",tabIndex:0,onClick:u=>{u.preventDefault(),u.stopPropagation(),b(n.code||"")},children:g?s?.copied||i?.couponBenefitData?.commonCoupon?.copied:s?.copy||i?.couponBenefitData?.commonCoupon?.copyCode})]}),n.ends_at&&e(ye,{endsAt:n.ends_at,daysLeft:s?.hurry?.daysLeft??0,endsText:s?.ends??"",daysText:s?.days??"",hurryLabel:s?.hurry?.label??"",expiredText:i?.couponBenefitData?.commonCoupon?.expired??"",onOpenModal:()=>{s?.modal&&N(s?.modal)}})]})]})]})},Ne=({coupons:n,className:C,textConfig:i,benefitPayloadData:l})=>e("div",{className:y("laptop:grid laptop:grid-cols-2 laptop-md:grid-cols-1 flex flex-col gap-3",C),children:n?.map((g,b)=>e(Be,{item:g,textConfig:i,benefitPayloadData:l},b))}),we=({creditCouponRedeem:n,textConfig:C})=>{const{profile:i,variant:l,renderInstallments:g,onUseCouponChange:b,onUseMemberDiscountChange:h,discount:B,savingDetail:s,openModal:N,openSignInPopup:u,openAuthCodePopup:I,openSignUpPopup:J,creditsRedemption:K}=$(),{usedPoints:Te=0,availablePoints:De=0}=K??{},[Q,A]=P(!1),x=de("ProductBenefits")??{},[X,U]=P(!1),ee=ue({variant:l}),{locale:w="us",copyWriting:te}=Y(),H=me(null),oe={...ve,...C},{activated:ne=!1}=i||{},{memberDiscount:p,commonCoupon:f,creditsRedemption:T,freeGift:Z,functionFreeGift:E,bundle:V,paidShipping:ae,fullGift:R,levelDiscount:z}=ee,t=q(()=>{const o=x?.benefitTabs?.find(c=>c?.value==="coupon")??{},r=x?.benefitTabs?.find(c=>c?.value==="membership")??{},M=x?.benefitTabs?.find(c=>c?.value==="installment")??{},L=x?.benefitTabs?.find(c=>c?.value==="pay")??{};return{couponBenefitData:o,membershipBenefitData:r,installmentBenefitData:M,payBenefitData:L}},[x]),v=[f?.enable?{...f.config,isAutoUse:s?.coupon>0,useAble:!0,borderStyle:"rounded",code:f?.config?.title??"",description:f?.config?.desc??"",onUseChange:o=>{const r=o?B?.codeSavings??0:0;b?.(r)},title:G(t?.couponBenefitData?.commonCoupon?.offCoupon,{discount:f?.config?.value_type=="percentage"?Math.abs(Number(f?.config?.value||0))+"%":f?.config?.formattedFixedValue??k({amount:Math.abs(Number(f?.config?.fixed_value||0)),currencyCode:l.price.currencyCode,locale:w})})}:null,p.enable?{useAble:!0,isAutoUse:!!i?.email&&!!s?.member,title:G(t?.couponBenefitData?.member?.offMemberOnly,{amount:p?.config?.formattedAmount??k({amount:p?.config?.amount??0,currencyCode:l.price.currencyCode,locale:w})}),description:a(F,{children:[i?.email?t?.couponBenefitData?.member?.memberDiscounts:t?.membershipBenefitData?.memberBenefitsNotLogin?.replace("{amount}",p?.config?.formattedAmount??k({amount:p?.config?.amount??0,currencyCode:l.price.currencyCode,locale:w}))??""," ",i?.email?"":e("span",{role:"button",tabIndex:0,onClick:()=>u?.(),className:"underline",children:t?.couponBenefitData?.member?.loginNow})]}),borderStyle:"rounded",onUseChange:o=>{if(i?.email){const r=o?p?.config?.amount??0:0;return h?.(r),!0}else return u?.(),!1}}:null,z.enable?{title:z?.config?.title??"",description:z?.config?.tag??"",borderStyle:"inset",bgImage:{url:t?.couponBenefitData?.levelDiscount?.bgImage}}:null,E.enable?{title:E?.config?.title??"",description:t?.couponBenefitData?.freeGift?.selectFreeGift,borderStyle:"inset",bgImage:{url:t?.couponBenefitData?.freeGift?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,Z.enable?{title:Z?.config?.title??"",description:t?.couponBenefitData?.freeGift?.selectFreeGift,borderStyle:"inset",bgImage:{url:t?.couponBenefitData?.freeGift?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,V.enable?{title:`${t?.couponBenefitData?.bundle?.bundleSaveUpTo} ${V.config?.maxSavings}`,borderStyle:"inset",description:t?.couponBenefitData?.bundle?.bundleOffer.replace("{count}",V?.config?.bundleOptions?.length?.toString()??""),bgImage:{url:t?.couponBenefitData?.bundle?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,R.enable?{title:R?.config?.title??"",description:R?.config?.desc??"",borderStyle:"inset",bgImage:{url:t?.couponBenefitData?.fullGift?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null,T.enable?{title:t?.couponBenefitData?.creditsRedemption?.creditsTitle,description:t?.couponBenefitData?.creditsRedemption?.creditsDesc,borderStyle:"inset",bgImage:{url:t?.couponBenefitData?.creditsRedemption?.bgImage},couponBgColor:"linear-gradient(94deg, rgba(215, 245, 254, 0.24) 4.2%, rgba(215, 245, 254, 0.80) 99.11%), #FFF"}:null].filter(Boolean);W(()=>{_(v?.length?"coupon":"membership")},[v?.length]),W(()=>{A(!1)},[l?.id]);const[j,_]=P("coupon"),ie=()=>{I?.()},se=(o,r)=>{if(_(r),H.current){const M=H.current,L=o.currentTarget,c=L.offsetLeft-M.offsetWidth/2+L.offsetWidth/2;M.scrollTo({left:c,behavior:"smooth"})}},le=q(()=>x?.benefitTabs?.map(o=>o?.value==="coupon"&&!v?.length?null:o).filter(Boolean),[x,v]);return m?a(m,{className:"relative",onValueChange:o=>{_(o),A(o==="installment")},value:j,children:[e("div",{className:"absolute right-0 top-0 z-[1] h-[40px] w-[25px] rounded-xl bg-gradient-to-r from-transparent to-[#EAEAEC]"}),e(m.List,{ref:H,children:le?.map(o=>e(m.Trigger,{className:y(j===o.value&&"text-[#080A0F]"),value:o.value,onClick:r=>se(r,o?.value),children:o.label},o?.value))}),e("style",{global:!0,jsx:!0,children:`
18
18
  .benefits-tabs-content::-webkit-scrollbar {
19
19
  width: 4px; /* \u6EDA\u52A8\u6761\u5BBD\u5EA6 */
20
20
  height: 64px; /* \u6A2A\u5411\u6EDA\u52A8\u6761\u9AD8\u5EA6 */
@@ -32,7 +32,7 @@ import{Fragment as I,jsx as e,jsxs as a}from"react/jsx-runtime";import{Button as
32
32
  .benefits-tabs-content::-webkit-scrollbar-thumb:hover {
33
33
  background-color: rgba(100, 100, 100, 0.6);
34
34
  }
35
- `}),v?.length?e(u.Content,{value:"coupon",className:"benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto",children:e("div",{className:"lg-desktop:p-4 p-3",children:e(Ne,{coupons:v,textConfig:oe,benefitPayloadData:t})})}):null,e(u.Content,{value:"membership",className:y("benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto"),children:a("div",{className:"lg-desktop:p-4 p-3",children:[n&&e("div",{className:"laptop-md:mb-4 mb-2",children:e(he,{...n})}),a("div",{className:y("rounded-lg",{"benefits-tabs-content lg-desktop:h-[calc(240px-100px)] laptop-md:h-[calc(196px-80px)] laptop:h-[calc(220px-72px)] h-[calc(180px-73px)] overflow-y-auto":!i?.email}),children:[!i?.email&&e("h3",{className:"laptop-md:mb-2 mb-1 text-left text-lg font-bold !leading-[1.3]",children:t?.membershipBenefitData?.memberBenefitsNotLoginText}),a("ul",{className:`laptop-md:[&_li]:py-4 list-none
35
+ `}),v?.length?e(m.Content,{value:"coupon",className:"benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto",children:e("div",{className:"lg-desktop:p-4 p-3",children:e(Ne,{coupons:v,textConfig:oe,benefitPayloadData:t})})}):null,e(m.Content,{value:"membership",className:y("benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto"),children:a("div",{className:"lg-desktop:p-4 p-3",children:[n&&e("div",{className:"laptop-md:mb-4 mb-2",children:e(he,{...n})}),a("div",{className:y("rounded-lg",{"benefits-tabs-content lg-desktop:h-[calc(240px-100px)] laptop-md:h-[calc(196px-80px)] laptop:h-[calc(220px-72px)] h-[calc(180px-73px)] overflow-y-auto":!i?.email}),children:[!i?.email&&e("h3",{className:"laptop-md:mb-2 mb-1 text-left text-lg font-bold !leading-[1.3]",children:t?.membershipBenefitData?.memberBenefitsNotLoginText}),a("ul",{className:`laptop-md:[&_li]:py-4 list-none
36
36
  [&_li:first-child]:rounded-t-lg [&_li:last-child]:rounded-b-lg [&_li:last-child]:last:border-b-0 [&_li]:flex
37
37
  [&_li]:items-center [&_li]:gap-2 [&_li]:border-b [&_li]:border-b-[#E4E5E6] [&_li]:bg-white [&_li]:px-4 [&_li]:py-[10px]
38
- [&_li]:text-left`,children:[k.enable?a("li",{children:[e("svg",{className:"laptop-md:size-6 size-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM17 13C17.5523 13 18 13.4477 18 14C18 14.5523 17.5523 15 17 15H9.41406L9.70703 15.293C10.0976 15.6835 10.0976 16.3165 9.70703 16.707C9.31651 17.0976 8.68349 17.0976 8.29297 16.707L6.29297 14.707C6.00697 14.421 5.92139 13.9909 6.07617 13.6172C6.23098 13.2436 6.59558 13 7 13H17ZM14.293 7.29297C14.6835 6.90244 15.3165 6.90244 15.707 7.29297L17.707 9.29297C17.993 9.57897 18.0786 10.0091 17.9238 10.3828C17.769 10.7564 17.4044 11 17 11H7C6.44772 11 6 10.5523 6 10C6 9.44771 6.44772 9 7 9H14.5859L14.293 8.70703C13.9024 8.31651 13.9024 7.68349 14.293 7.29297Z",fill:"#1D1D1F"})}),e(c,{as:"p",className:"x:text-[14px] text-left text-[16px] font-bold",children:!ne&&i?.email?a(I,{children:[t?.membershipBenefitData?.creditsAfterActivation,e("span",{role:"button",tabIndex:0,onClick:()=>ie(),className:"underline",children:t?.membershipBenefitData?.active})]}):k?.config?.label?.replace("{{amount}}",D({amount:k?.config?.amount??0,currencyCode:l.price.currencyCode,locale:w}))})]}):null,h.enable&&a("li",{className:"justify-between",children:[a("div",{className:"flex gap-2",children:[e("svg",{xmlns:"http://www.w3.org/2000/svg",className:"laptop-md:size-6 size-4",viewBox:"0 0 24 24",fill:"none",children:e("path",{d:"M20 3.5C21.6569 3.5 23 4.84315 23 6.5V9.65625C23 10.0791 22.7342 10.4566 22.3359 10.5986C21.6665 10.8372 21.1816 11.4844 21.1816 12.25C21.1816 13.0156 21.6665 13.6628 22.3359 13.9014C22.7342 14.0434 23 14.4209 23 14.8438V18C23 19.6569 21.6569 21 20 21H4C2.34315 21 1 19.6569 1 18V14.8438L1.01172 14.6875C1.06803 14.3301 1.31557 14.0256 1.66406 13.9014C2.33345 13.6628 2.81836 13.0156 2.81836 12.25C2.81836 11.4844 2.33345 10.8372 1.66406 10.5986C1.26583 10.4566 1 10.0791 1 9.65625V6.5C1 4.84315 2.34315 3.5 4 3.5H20ZM4 5.5C3.44772 5.5 3 5.94772 3 6.5V9.03125C4.08987 9.68678 4.81836 10.8833 4.81836 12.25C4.81836 13.6165 4.08963 14.8122 3 15.4678V18C3 18.5523 3.44772 19 4 19H20C20.5523 19 21 18.5523 21 18V15.4678C19.9104 14.8122 19.1816 13.6165 19.1816 12.25C19.1816 10.8833 19.9101 9.68677 21 9.03125V6.5C21 5.94772 20.5523 5.5 20 5.5H4ZM15.793 6.79297C16.1835 6.40244 16.8165 6.40244 17.207 6.79297C17.5976 7.18349 17.5976 7.81651 17.207 8.20703L8.20703 17.207C7.81651 17.5976 7.18349 17.5976 6.79297 17.207C6.40244 16.8165 6.40244 16.1835 6.79297 15.793L15.793 6.79297ZM15.25 13.25C16.3546 13.25 17.25 14.1454 17.25 15.25C17.25 16.3546 16.3546 17.25 15.25 17.25C14.1454 17.25 13.25 16.3546 13.25 15.25C13.25 14.1454 14.1454 13.25 15.25 13.25ZM15.25 14.75C14.9739 14.75 14.75 14.9739 14.75 15.25C14.75 15.5261 14.9739 15.75 15.25 15.75C15.5261 15.75 15.75 15.5261 15.75 15.25C15.75 14.9739 15.5261 14.75 15.25 14.75ZM8.75 6.75C9.85457 6.75 10.75 7.64543 10.75 8.75C10.75 9.85457 9.85457 10.75 8.75 10.75C7.64543 10.75 6.75 9.85457 6.75 8.75C6.75 7.64543 7.64543 6.75 8.75 6.75ZM8.75 8.25C8.47386 8.25 8.25 8.47386 8.25 8.75C8.25 9.02614 8.47386 9.25 8.75 9.25C9.02614 9.25 9.25 9.02614 9.25 8.75C9.25 8.47386 9.02614 8.25 8.75 8.25Z",fill:"#1D1D1F"})}),e(c,{as:"p",className:"x:text-[14px] text-left text-[16px] font-bold",children:G(t?.membershipBenefitData?.forNewMember,{amount:D({amount:h?.config?.amount??0,currencyCode:l.price.currencyCode,locale:w})})})]}),!!i?.email&&e(S,{})]}),t?.membershipBenefitData?.equities?.map((o,r)=>o.modalText?a("li",{className:"justify-between gap-2",children:[a("button",{onClick:()=>N?.({title:o.label,content:o.modalText}),className:"flex justify-between",children:[e(T,{source:o.icon,alt:o.text,className:"laptop-md:size-6 size-4 shrink-0"}),e(c,{className:"x:text-[14px] text-wrap text-left text-[16px] font-bold",children:o.text})]},r),!!i?.email&&e(S,{})]},r):a("li",{className:"justify-between",children:[a("div",{className:"flex items-center gap-2",children:[e(T,{source:o.icon,alt:o.text,className:"laptop-md:size-6 size-4 shrink-0"}),e(c,{as:"p",className:"x:text-[14px] text-wrap text-left text-[16px] font-bold",children:o.label})]}),!!i?.email&&e(S,{})]},r)),ae.enable?a("li",{className:"justify-between",children:[a("div",{className:"flex gap-2",children:[e("svg",{className:"laptop-md:size-6 size-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M19 3C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H10V16H21C21.5523 16 22 16.4477 22 17C22 17.5523 21.5523 18 21 18H19.9961C19.9961 19.6559 18.6547 21 16.998 21C15.3414 21 14 19.6559 14 18H10C10 19.6568 8.65684 21 7 21C5.34317 21 4 19.6568 4 18H2C1.44772 18 1 17.5523 1 17V10.6738L1.00488 10.5771C1.02632 10.3554 1.12145 10.146 1.27637 9.9834L4.77637 6.31055L4.84961 6.24023C5.02993 6.08586 5.26042 6 5.5 6H8V5C8 3.89544 8.89541 3 10 3H19ZM6.00488 18.1025C6.05622 18.6067 6.48234 19 7 19C7.51766 19 7.94378 18.6067 7.99512 18.1025L8 18H6L6.00488 18.1025ZM16.0049 18.1025C16.0561 18.6074 16.4823 19 16.998 19C17.5138 19 17.94 18.6074 17.9912 18.1025L17.9961 18H16L16.0049 18.1025ZM3 11.0723V16H8V8H5.92773L3 11.0723ZM21.6621 6.8252C22.0348 6.41765 22.6676 6.38902 23.0752 6.76172C23.4827 7.13443 23.5104 7.76725 23.1377 8.1748L18.0518 13.7363C17.6625 14.162 17.003 14.1954 16.5732 13.8105L13.333 10.9092C12.9216 10.5408 12.8865 9.90853 13.2549 9.49707C13.6232 9.08565 14.2555 9.05066 14.667 9.41895L17.208 11.6943L21.6621 6.8252Z",fill:"#1D1D1F"})}),e(c,{as:"p",className:"x:text-[14px] text-left text-[16px] font-bold",children:t?.membershipBenefitData?.expressShipping})]}),!!i?.email&&e(S,{})]}):null]})]}),!i?.email&&e("div",{className:"laptop-md:pt-4 pt-2",children:e(re,{variant:"primary",className:"w-full",onClick:()=>J?.(),children:te?.signUp})})]})}),a(u.Content,{value:"pay",className:"benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto ",children:[a("div",{className:"lg-desktop:p-4 p-3",children:[e(O,{size:2,className:"mb-2 text-left text-lg font-bold",children:t?.payBenefitData?.payMethod}),a("div",{className:"lg-desktop:p-4 flex items-center justify-between gap-2 rounded-lg bg-white p-3",children:[a("div",{className:"flex items-center gap-2",children:[e(T,{source:t?.payBenefitData?.icon,className:"laptop-md:size-[70px] laptop-md:h-[34px] size-[40px] h-[20px] shrink-0"}),e(c,{as:"p",className:"x:text-[14px] text-left text-[16px] font-bold",html:t?.payBenefitData?.withCheckout})]}),e("button",{className:"hover:text-brand-0 laptop-md:text-[16px] whitespace-nowrap text-sm font-bold underline",onClick:()=>U(!0),children:t?.payBenefitData?.learnMore})]})]}),e(xe,{showModal:X,closeModal:()=>U(!1),children:e(T,{source:t?.payBenefitData?.payImage})})]}),e(u.Content,{value:"installment",forceMount:!0,className:y("benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto ",Q?"block":"hidden"),children:a("div",{className:"lg-desktop:p-4 p-3",children:[e(O,{size:2,className:"mb-2 text-left text-lg font-bold",children:t?.installmentBenefitData?.flexibleInstallment}),e("div",{className:"lg-desktop:p-4 overflow-hidden rounded-lg bg-white p-3",children:f})]})})]}):null},S=n=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...n,children:e("path",{d:"M4 9.19472L8.51935 13.667L16.2668 6.00024",stroke:"#2BBC4F",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});var Ze=Ce(we);export{Ze as default};
38
+ [&_li]:text-left`,children:[T.enable?a("li",{children:[e("svg",{className:"laptop-md:size-6 size-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM17 13C17.5523 13 18 13.4477 18 14C18 14.5523 17.5523 15 17 15H9.41406L9.70703 15.293C10.0976 15.6835 10.0976 16.3165 9.70703 16.707C9.31651 17.0976 8.68349 17.0976 8.29297 16.707L6.29297 14.707C6.00697 14.421 5.92139 13.9909 6.07617 13.6172C6.23098 13.2436 6.59558 13 7 13H17ZM14.293 7.29297C14.6835 6.90244 15.3165 6.90244 15.707 7.29297L17.707 9.29297C17.993 9.57897 18.0786 10.0091 17.9238 10.3828C17.769 10.7564 17.4044 11 17 11H7C6.44772 11 6 10.5523 6 10C6 9.44771 6.44772 9 7 9H14.5859L14.293 8.70703C13.9024 8.31651 13.9024 7.68349 14.293 7.29297Z",fill:"#1D1D1F"})}),e(d,{as:"p",className:"x:text-[14px] text-left text-[16px] font-bold",children:!ne&&i?.email?a(F,{children:[t?.membershipBenefitData?.creditsAfterActivation,e("span",{role:"button",tabIndex:0,onClick:()=>ie(),className:"underline",children:t?.membershipBenefitData?.active})]}):T?.config?.label?.replace("{{amount}}",T?.config?.formattedAmount??k({amount:T?.config?.amount??0,currencyCode:l.price.currencyCode,locale:w}))})]}):null,p.enable&&a("li",{className:"justify-between",children:[a("div",{className:"flex gap-2",children:[e("svg",{xmlns:"http://www.w3.org/2000/svg",className:"laptop-md:size-6 size-4",viewBox:"0 0 24 24",fill:"none",children:e("path",{d:"M20 3.5C21.6569 3.5 23 4.84315 23 6.5V9.65625C23 10.0791 22.7342 10.4566 22.3359 10.5986C21.6665 10.8372 21.1816 11.4844 21.1816 12.25C21.1816 13.0156 21.6665 13.6628 22.3359 13.9014C22.7342 14.0434 23 14.4209 23 14.8438V18C23 19.6569 21.6569 21 20 21H4C2.34315 21 1 19.6569 1 18V14.8438L1.01172 14.6875C1.06803 14.3301 1.31557 14.0256 1.66406 13.9014C2.33345 13.6628 2.81836 13.0156 2.81836 12.25C2.81836 11.4844 2.33345 10.8372 1.66406 10.5986C1.26583 10.4566 1 10.0791 1 9.65625V6.5C1 4.84315 2.34315 3.5 4 3.5H20ZM4 5.5C3.44772 5.5 3 5.94772 3 6.5V9.03125C4.08987 9.68678 4.81836 10.8833 4.81836 12.25C4.81836 13.6165 4.08963 14.8122 3 15.4678V18C3 18.5523 3.44772 19 4 19H20C20.5523 19 21 18.5523 21 18V15.4678C19.9104 14.8122 19.1816 13.6165 19.1816 12.25C19.1816 10.8833 19.9101 9.68677 21 9.03125V6.5C21 5.94772 20.5523 5.5 20 5.5H4ZM15.793 6.79297C16.1835 6.40244 16.8165 6.40244 17.207 6.79297C17.5976 7.18349 17.5976 7.81651 17.207 8.20703L8.20703 17.207C7.81651 17.5976 7.18349 17.5976 6.79297 17.207C6.40244 16.8165 6.40244 16.1835 6.79297 15.793L15.793 6.79297ZM15.25 13.25C16.3546 13.25 17.25 14.1454 17.25 15.25C17.25 16.3546 16.3546 17.25 15.25 17.25C14.1454 17.25 13.25 16.3546 13.25 15.25C13.25 14.1454 14.1454 13.25 15.25 13.25ZM15.25 14.75C14.9739 14.75 14.75 14.9739 14.75 15.25C14.75 15.5261 14.9739 15.75 15.25 15.75C15.5261 15.75 15.75 15.5261 15.75 15.25C15.75 14.9739 15.5261 14.75 15.25 14.75ZM8.75 6.75C9.85457 6.75 10.75 7.64543 10.75 8.75C10.75 9.85457 9.85457 10.75 8.75 10.75C7.64543 10.75 6.75 9.85457 6.75 8.75C6.75 7.64543 7.64543 6.75 8.75 6.75ZM8.75 8.25C8.47386 8.25 8.25 8.47386 8.25 8.75C8.25 9.02614 8.47386 9.25 8.75 9.25C9.02614 9.25 9.25 9.02614 9.25 8.75C9.25 8.47386 9.02614 8.25 8.75 8.25Z",fill:"#1D1D1F"})}),e(d,{as:"p",className:"x:text-[14px] text-left text-[16px] font-bold",children:G(t?.membershipBenefitData?.forNewMember,{amount:p?.config?.formattedAmount??k({amount:p?.config?.amount??0,currencyCode:l.price.currencyCode,locale:w})})})]}),!!i?.email&&e(S,{})]}),t?.membershipBenefitData?.equities?.map((o,r)=>o.modalText?a("li",{className:"justify-between gap-2",children:[a("button",{onClick:()=>N?.({title:o.label,content:o.modalText}),className:"flex justify-between",children:[e(D,{source:o.icon,alt:o.text,className:"laptop-md:size-6 size-4 shrink-0"}),e(d,{className:"x:text-[14px] text-wrap text-left text-[16px] font-bold",children:o.text})]},r),!!i?.email&&e(S,{})]},r):a("li",{className:"justify-between",children:[a("div",{className:"flex items-center gap-2",children:[e(D,{source:o.icon,alt:o.text,className:"laptop-md:size-6 size-4 shrink-0"}),e(d,{as:"p",className:"x:text-[14px] text-wrap text-left text-[16px] font-bold",children:o.label})]}),!!i?.email&&e(S,{})]},r)),ae.enable?a("li",{className:"justify-between",children:[a("div",{className:"flex gap-2",children:[e("svg",{className:"laptop-md:size-6 size-4",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M19 3C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H10V16H21C21.5523 16 22 16.4477 22 17C22 17.5523 21.5523 18 21 18H19.9961C19.9961 19.6559 18.6547 21 16.998 21C15.3414 21 14 19.6559 14 18H10C10 19.6568 8.65684 21 7 21C5.34317 21 4 19.6568 4 18H2C1.44772 18 1 17.5523 1 17V10.6738L1.00488 10.5771C1.02632 10.3554 1.12145 10.146 1.27637 9.9834L4.77637 6.31055L4.84961 6.24023C5.02993 6.08586 5.26042 6 5.5 6H8V5C8 3.89544 8.89541 3 10 3H19ZM6.00488 18.1025C6.05622 18.6067 6.48234 19 7 19C7.51766 19 7.94378 18.6067 7.99512 18.1025L8 18H6L6.00488 18.1025ZM16.0049 18.1025C16.0561 18.6074 16.4823 19 16.998 19C17.5138 19 17.94 18.6074 17.9912 18.1025L17.9961 18H16L16.0049 18.1025ZM3 11.0723V16H8V8H5.92773L3 11.0723ZM21.6621 6.8252C22.0348 6.41765 22.6676 6.38902 23.0752 6.76172C23.4827 7.13443 23.5104 7.76725 23.1377 8.1748L18.0518 13.7363C17.6625 14.162 17.003 14.1954 16.5732 13.8105L13.333 10.9092C12.9216 10.5408 12.8865 9.90853 13.2549 9.49707C13.6232 9.08565 14.2555 9.05066 14.667 9.41895L17.208 11.6943L21.6621 6.8252Z",fill:"#1D1D1F"})}),e(d,{as:"p",className:"x:text-[14px] text-left text-[16px] font-bold",children:t?.membershipBenefitData?.expressShipping})]}),!!i?.email&&e(S,{})]}):null]})]}),!i?.email&&e("div",{className:"laptop-md:pt-4 pt-2",children:e(re,{variant:"primary",className:"w-full",onClick:()=>J?.(),children:te?.signUp})})]})}),a(m.Content,{value:"pay",className:"benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto ",children:[a("div",{className:"lg-desktop:p-4 p-3",children:[e(O,{size:2,className:"mb-2 text-left text-lg font-bold",children:t?.payBenefitData?.payMethod}),a("div",{className:"lg-desktop:p-4 flex items-center justify-between gap-2 rounded-lg bg-white p-3",children:[a("div",{className:"flex items-center gap-2",children:[e(D,{source:t?.payBenefitData?.icon,className:"laptop-md:size-[70px] laptop-md:h-[34px] size-[40px] h-[20px] shrink-0"}),e(d,{as:"p",className:"x:text-[14px] text-left text-[16px] font-bold",html:t?.payBenefitData?.withCheckout})]}),e("button",{className:"hover:text-brand-0 laptop-md:text-[16px] whitespace-nowrap text-sm font-bold underline",onClick:()=>U(!0),children:t?.payBenefitData?.learnMore})]})]}),e(xe,{showModal:X,closeModal:()=>U(!1),children:e(D,{source:t?.payBenefitData?.payImage})})]}),e(m.Content,{value:"installment",forceMount:!0,className:y("benefits-tabs-content lg-desktop:h-[240px] laptop-md:h-[196px] laptop:h-[220px] h-[180px] overflow-y-auto ",Q?"block":"hidden"),children:a("div",{className:"lg-desktop:p-4 p-3",children:[e(O,{size:2,className:"mb-2 text-left text-lg font-bold",children:t?.installmentBenefitData?.flexibleInstallment}),e("div",{className:"lg-desktop:p-4 overflow-hidden rounded-lg bg-white p-3",children:g})]})})]}):null},S=n=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",...n,children:e("path",{d:"M4 9.19472L8.51935 13.667L16.2668 6.00024",stroke:"#2BBC4F",strokeWidth:"1.67",strokeLinecap:"round",strokeLinejoin:"round"})});var Ze=Ce(we);export{Ze as default};
@@ -1 +1 @@
1
- import{Fragment as V,jsx as e,jsxs as i}from"react/jsx-runtime";import{Text as n,Picture as g}from"../../../../../../components/index.js";import{useBizProductContext as S}from"../../../../BizProductProvider.js";import{useComponentData as R}from"../../../../hooks/useComponentData.js";import{useBenefits as _}from"../../../../hooks/useBenefits.js";import{formatPrice as G}from"../../../../utils/index.js";import{replaceTemplate as b}from"../../../../utils/textFormat.js";import{useEffect as U,useState as d}from"react";import{useAiuiContext as O}from"../../../../../AiuiProvider/index.js";import{cn as E}from"../../../../../../helpers/index.js";import j from"./../ProductBenefitsTabs/ModalContainer.js";import W from"../ProductServiceBenefits/index.js";import N from"../../../SlideUpModal/index.js";const q=({showServiceBenefits:s=!0}={})=>{const{profile:a,variant:r,renderInstallments:c,savingDetail:B,openSignInPopup:k,openAuthCodePopup:y,product:t1}=S(),{activated:z=!1}=a||{},[u,F]=d(c);U(()=>{c&&F(c),typeof window<"u"&&window.affirm?.ui?.refresh&&window.affirm.ui.refresh()},[c,r.id]);const t=R("ProductBenefits")??{},[A,h]=d(!1),[I,v]=d(!1),[P,x]=d(!1),T=_({variant:r}),{locale:D="us",copyWriting:l1}=O(),{creditsRedemption:C,freeGift:M,functionFreeGift:w,bundle:p,fullGift:m,levelDiscount:f}=T,L=[C.enable?{title:t?.creditsRedemption?.creditsTitle,description:t?.creditsRedemption?.creditsDesc,icon:e(H,{className:"desktop:size-6 size-5"})}:null,C.enable?{title:e(V,{children:!z&&a?.email?i(V,{children:[t?.creditsRedemption?.creditsAfterActivation,e("span",{role:"button",tabIndex:0,onClick:()=>y?.(),className:"underline",children:t?.creditsRedemption?.active})]}):C?.config?.label?.replace("{{amount}}",G({amount:C?.config?.amount??0,currencyCode:r.price.currencyCode,locale:D}))}),icon:e(H,{className:"desktop:size-6 size-5"})}:null,f.enable?{title:f?.config?.title??"",description:f?.config?.tag??"",icon:e(K,{className:"desktop:size-6 size-5"})}:null,m.enable?{title:m?.config?.title??"",description:m?.config?.desc??"",icon:e(X,{className:"desktop:size-6 size-5"})}:null,M.enable?{title:M?.config?.title??"",icon:e(Z,{className:"desktop:size-6 size-5"})}:null,w.enable?{title:w?.config?.title??"",icon:e(Z,{className:"desktop:size-6 size-5"})}:null,p.enable?{title:b(t?.bundle?.bundleSaveUpTo,{count:p?.config?.maxSavings||""}),description:b(t?.bundle?.bundleOffer,{count:p?.config?.bundleOptions?.length?.toString()||""}),icon:e(Q,{className:"desktop:size-6 size-5"})}:null,t?.paymentMethod?.title?{title:t?.paymentMethod?.title,image:t?.paymentMethod?.image,icon:e($,{className:"desktop:size-6 size-5"}),event:()=>h(!0)}:null,{useAble:!0,isAutoUse:!!a?.email&&!!B?.member,title:a?.email?t?.member?.loginTitle:i("div",{children:[e("span",{className:"mr-2 desktop:mr-3",dangerouslySetInnerHTML:{__html:t?.member?.unloginTitle}}),e("span",{role:"button",tabIndex:0,onClick:l=>{l?.stopPropagation(),k?.()},className:"underline text-nowrap",dangerouslySetInnerHTML:{__html:t?.member?.loginNow}})]}),icon:e(J,{className:"desktop:size-6 size-5"}),event:()=>v(!0)},u?{customRenderTitle:u,icon:e(Y,{className:"desktop:size-6 size-5"})}:null,t?.priceMatch?{title:t?.priceMatch?.title,icon:t?.priceMatch?.icon,event:()=>x(!0)}:null].filter(Boolean);return i("div",{children:[t?.benefitTitle&&e(n,{as:"div",html:t?.benefitTitle,className:"text-sm mb-3 lg-desktop:mb-4 lg-desktop:text-base font-bold leading-[1.2]"}),i("ul",{className:"desktop:px-4 px-3 rounded-box bg-[#F5F6F7]",children:[L?.map((l,o)=>i("li",{children:[i("div",{className:"flex gap-3 items-start py-3 laptop:py-4",children:[e("div",{className:"shrink-0",children:typeof l?.icon=="string"?e(g,{source:l?.icon,className:"desktop:size-6 size-5"}):l?.icon}),i("div",{onClick:l?.event,className:E("flex flex-1 items-center gap-1 desktop:gap-2",l?.event&&"cursor-pointer justify-between"),children:[i("div",{children:[l?.customRenderTitle?e("div",{children:l?.customRenderTitle}):i("div",{className:"flex items-center gap-2 desktop:gap-3 text-[14px] laptop:text-base font-bold leading-[1.2]",children:[l?.title,l?.image&&e(g,{source:l?.image,className:"w-[40px] h-[20px] shrink-0"})]}),l?.description&&e(n,{...typeof l.description=="string"?{html:l.description}:{},as:"p",className:"laptop:text-[14px] text-[12px] font-bold text-[#2A2C32]",children:l.description})]}),l?.event&&e(e1,{className:"size-4 desktop:size-6"})]})]}),o!=L?.length-1&&e("div",{className:"bg-[#DADCE0] h-[1px]"})]},o)),s&&e(W,{className:"desktop:px-0 px-0"})]}),e(j,{showModal:A,closeModal:()=>h(!1),children:e(g,{source:t?.paymentMethod?.payImage})}),t?.priceMatch?.modal&&e(N,{title:t?.priceMatch?.modal?.title??t?.priceMatch?.title,showModal:P,closeModal:()=>x(!1),children:e("ul",{className:"list-disc list-outside flex flex-col gap-3 px-8 tablet:px-12 pb-6 tablet:py-8",children:(t?.priceMatch?.modal?.list??[]).map((l,o)=>e("li",{children:e(n,{html:l.desc,className:"text-[14px] tablet:text-[16px] leading-[1.6] text-[#6D6D6F]"})},o))})}),t?.member?.modelBenefits&&e(N,{title:t?.member?.modelTitle,showModal:I,closeModal:()=>v(!1),children:e("ul",{className:"flex flex-col overflow-y-auto tablet:max-h-[calc(80vh-52px)] tablet:py-8 gap-5 pb-6 tablet:pb-8 tablet:gap-8 px-4 tablet:px-8",children:t?.member?.modelBenefits?.map((l,o)=>i("li",{className:"flex flex-col gap-1",children:[e(n,{html:l?.title,className:"text-[16px] tablet:text-[18px] font-bold leading-[1.4]"}),e(n,{html:l?.desc,className:"text-[14px] text-[#1D1D1F] tablet:text-[16px] font-bold leading-[1.4] opacity-75"})]},o))})})]})},H=({className:s})=>e("svg",{className:s,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM17 13C17.5523 13 18 13.4477 18 14C18 14.5523 17.5523 15 17 15H9.41406L9.70703 15.293C10.0976 15.6835 10.0976 16.3165 9.70703 16.707C9.31651 17.0976 8.68349 17.0976 8.29297 16.707L6.29297 14.707C6.00697 14.421 5.92139 13.9909 6.07617 13.6172C6.23098 13.2436 6.59558 13 7 13H17ZM14.293 7.29297C14.6835 6.90244 15.3165 6.90244 15.707 7.29297L17.707 9.29297C17.993 9.57897 18.0786 10.0091 17.9238 10.3828C17.769 10.7564 17.4044 11 17 11H7C6.44772 11 6 10.5523 6 10C6 9.44771 6.44772 9 7 9H14.5859L14.293 8.70703C13.9024 8.31651 13.9024 7.68349 14.293 7.29297Z",fill:"#1D1D1F"})}),J=({className:s})=>e("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.4294 1.58368C15.0354 1.5838 15.6026 1.88286 15.944 2.38348L19.4997 7.5993C19.9918 8.32123 19.9058 9.29041 19.2946 9.91473L11.8571 17.5104C10.8453 18.5435 9.18314 18.5447 8.16961 17.5134L0.696949 9.90692C0.0916662 9.29063 -0.000821769 8.3354 0.474293 7.61395L3.90203 2.4079C4.24121 1.89312 4.81678 1.58368 5.43328 1.58368H14.4294ZM2.00457 8.62177L9.47722 16.2292C9.77143 16.5282 10.2539 16.5278 10.5475 16.2282L17.9841 8.63153L14.4294 3.41669H5.43328L2.00457 8.62177ZM13.5759 7.74481C13.9008 7.41946 14.4279 7.41834 14.7536 7.74286C15.0792 8.06792 15.0804 8.59584 14.7555 8.92157L10.6247 13.0593C10.2833 13.401 9.72933 13.4013 9.38738 13.0602L5.24382 8.92352C4.91829 8.59852 4.9172 8.07056 5.24187 7.74481C5.56689 7.41925 6.09484 7.41813 6.42058 7.74286L10.0046 11.321L13.5759 7.74481Z",fill:"#080A0F"})}),K=({className:s})=>i("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[e("path",{d:"M13.1615 5.66083C13.4869 5.33539 14.0144 5.33539 14.3398 5.66083C14.6653 5.98626 14.6653 6.51378 14.3398 6.83921L6.83984 14.3392C6.51441 14.6646 5.98689 14.6646 5.66146 14.3392C5.33602 14.0138 5.33602 13.4863 5.66146 13.1608L13.1615 5.66083Z",fill:"#080A0F"}),e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.709 11.0417C13.6295 11.0417 14.3756 11.7879 14.3756 12.7084C14.3756 13.6288 13.6295 14.375 12.709 14.375C11.7885 14.375 11.0423 13.6288 11.0423 12.7084C11.0423 11.7879 11.7885 11.0417 12.709 11.0417ZM12.709 12.2917C12.4789 12.2917 12.2923 12.4782 12.2923 12.7084C12.2923 12.9385 12.4789 13.125 12.709 13.125C12.9391 13.125 13.1256 12.9385 13.1256 12.7084C13.1256 12.4782 12.9391 12.2917 12.709 12.2917Z",fill:"#080A0F"}),e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.29232 5.62502C8.21279 5.62502 8.95898 6.37121 8.95898 7.29169C8.95898 8.21216 8.21279 8.95835 7.29232 8.95835C6.37184 8.95835 5.62565 8.21216 5.62565 7.29169C5.62565 6.37121 6.37184 5.62502 7.29232 5.62502ZM7.29232 6.87502C7.0622 6.87502 6.87565 7.06157 6.87565 7.29169C6.87565 7.52181 7.0622 7.70835 7.29232 7.70835C7.52244 7.70835 7.70898 7.52181 7.70898 7.29169C7.70898 7.06157 7.52244 6.87502 7.29232 6.87502Z",fill:"#080A0F"}),e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.6673 2.91669C18.048 2.91669 19.1673 4.03597 19.1673 5.41669V8.0469C19.1673 8.39923 18.9458 8.71388 18.6139 8.83221C18.0561 9.03101 17.652 9.57037 17.652 10.2084C17.652 10.8463 18.0561 11.3857 18.6139 11.5845C18.9458 11.7028 19.1673 12.0175 19.1673 12.3698V15C19.1673 16.3807 18.048 17.5 16.6673 17.5H3.33398C1.95327 17.5 0.833984 16.3807 0.833984 15V12.3698L0.84375 12.2396C0.890672 11.9418 1.09696 11.688 1.38737 11.5845C1.94519 11.3857 2.34928 10.8463 2.34928 10.2084C2.34928 9.57036 1.94519 9.03101 1.38737 8.83221C1.05551 8.71388 0.833984 8.39923 0.833984 8.0469V5.41669C0.833985 4.03598 1.95327 2.91669 3.33398 2.91669H16.6673ZM3.33398 4.58335C2.87375 4.58335 2.50065 4.95645 2.50065 5.41669V7.52606C3.40888 8.07233 4.01595 9.06946 4.01595 10.2084C4.01595 11.3471 3.40868 12.3435 2.50065 12.8898V15C2.50065 15.4603 2.87375 15.8334 3.33398 15.8334H16.6673C17.1276 15.8334 17.5006 15.4603 17.5006 15V12.8898C16.5926 12.3435 15.9853 11.3471 15.9853 10.2084C15.9853 9.06945 16.5924 8.07233 17.5006 7.52606V5.41669C17.5006 4.95645 17.1276 4.58335 16.6673 4.58335H3.33398Z",fill:"#080A0F"})]}),Z=({className:s})=>e("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.4951 1.47201C12.791 1.17663 13.2707 1.17634 13.5664 1.47201C13.862 1.76788 13.8622 2.24851 13.5664 2.54428L11.8301 4.2806H17.5752C17.9935 4.28073 18.333 4.62012 18.333 5.03842V8.06869C18.333 8.48701 17.9935 8.82638 17.5752 8.8265H17.1982V17.1595C17.198 17.5776 16.8585 17.9171 16.4404 17.9173H3.56152C3.14327 17.9173 2.80394 17.5777 2.80371 17.1595V8.8265H2.42383C2.00543 8.8265 1.66602 8.48709 1.66602 8.06869V5.03842C1.66605 4.62005 2.00545 4.2806 2.42383 4.2806H8.16992L6.43359 2.54428C6.13775 2.24843 6.13776 1.76786 6.43359 1.47201C6.72945 1.17616 7.21001 1.17616 7.50586 1.47201L10 3.96615L12.4951 1.47201ZM4.31934 16.4017H9.24219V8.8265H4.31934V16.4017ZM10.7578 16.4017H15.6826V8.8265H10.7578V16.4017ZM3.18164 7.31088H16.8174V5.79623H3.18164V7.31088Z",fill:"#080A0F"})}),Q=({className:s})=>e("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e("path",{d:"M14.1152 1.18357L14.2551 1.26642L18.4546 3.9088C18.8514 4.15858 19.178 4.50301 19.4043 4.91029C19.6306 5.31758 19.7492 5.77458 19.7493 6.23909V16.0194C19.7495 16.3825 19.6772 16.742 19.5366 17.0775C19.396 17.413 19.1898 17.7179 18.9298 17.9747C18.6697 18.2315 18.361 18.4352 18.0212 18.5742C17.6814 18.7132 17.3172 18.7847 16.9494 18.7847H8.55091C8.1623 18.7852 7.77786 18.7056 7.42219 18.5511C7.06652 18.3965 6.74745 18.1704 6.48539 17.8871L1.61712 16.3743C1.35494 16.2904 1.11208 16.1563 0.902404 15.9797C0.692732 15.8031 0.520358 15.5875 0.395126 15.3451C0.269895 15.1027 0.194259 14.8384 0.172541 14.5672C0.150822 14.296 0.183446 14.0232 0.268548 13.7644L3.25386 4.69868C3.36315 4.36757 3.55522 4.06899 3.81232 3.83053C4.06942 3.59207 4.38326 3.42141 4.72484 3.33434L9.66236 2.26275L11.246 1.26642C11.6722 0.998206 12.1641 0.848941 12.6694 0.834475C13.1747 0.820008 13.6746 0.94088 14.1159 1.18426L14.1152 1.18357ZM11.9979 2.44503L7.79829 5.08741C7.59979 5.21229 7.43639 5.38454 7.32319 5.58825C7.20998 5.79196 7.15061 6.02055 7.15058 6.2529V16.0201C7.15058 16.7838 7.7773 17.4024 8.55021 17.4024H16.9494C17.1333 17.4025 17.3155 17.3668 17.4855 17.2974C17.6555 17.228 17.8099 17.1261 17.94 16.9978C18.0701 16.8694 18.1733 16.717 18.2438 16.5492C18.3142 16.3815 18.3504 16.2017 18.3504 16.0201V6.2529C18.3504 5.78063 18.1056 5.3415 17.7027 5.08741L13.5031 2.44503C13.2784 2.30354 13.0174 2.22837 12.7508 2.22837C12.4843 2.22837 12.2233 2.30354 11.9986 2.44503H11.9979ZM6.49449 4.36243L5.07457 4.67106C4.96068 4.70009 4.85604 4.757 4.77033 4.83654C4.68463 4.91607 4.62062 5.01565 4.58425 5.12608L1.59823 14.1911C1.56987 14.2774 1.559 14.3683 1.56626 14.4587C1.57351 14.5491 1.59875 14.6373 1.64051 14.7181C1.68228 14.7988 1.73976 14.8707 1.80968 14.9296C1.87959 14.9884 1.96057 15.0331 2.04799 15.0611L5.76005 16.2459C5.75394 16.1708 5.75091 16.0955 5.75095 16.0201V6.23978C5.75095 5.53552 6.02235 4.86715 6.49518 4.36243H6.49449ZM15.4938 11.8801C15.909 11.8803 16.3148 12.0019 16.6599 12.2297C17.005 12.4575 17.2739 12.7812 17.4327 13.1599C17.5914 13.5386 17.6329 13.9552 17.5517 14.3571C17.4706 14.759 17.2706 15.1282 16.9769 15.4178C16.6832 15.7075 16.3091 15.9048 15.9019 15.9846C15.4947 16.0644 15.0727 16.0232 14.6892 15.8663C14.3057 15.7093 13.9779 15.4436 13.7474 15.1028C13.5168 14.762 13.3939 14.3613 13.394 13.9515C13.394 12.8074 14.3341 11.8801 15.4938 11.8801ZM10.0995 13.5124L15.0489 8.63015C15.1753 8.50803 15.3437 8.4376 15.5204 8.43301C15.6972 8.42841 15.8691 8.48998 16.0018 8.60536C16.1344 8.72074 16.2179 8.88139 16.2355 9.05504C16.2532 9.22869 16.2036 9.40249 16.0967 9.54155L16.0387 9.60645L11.0893 14.4887C10.963 14.6108 10.7945 14.6812 10.6178 14.6858C10.4411 14.6904 10.2691 14.6288 10.1365 14.5135C10.0038 14.3981 9.92029 14.2374 9.90267 14.0638C9.88506 13.8901 9.93464 13.7163 10.0415 13.5773L10.0995 13.5124ZM15.4938 13.261C15.3083 13.261 15.1304 13.3338 14.9992 13.4633C14.868 13.5928 14.7943 13.7684 14.7943 13.9515C14.7943 14.1346 14.868 14.3102 14.9992 14.4397C15.1304 14.5692 15.3083 14.642 15.4938 14.642C15.6793 14.642 15.8572 14.5692 15.9884 14.4397C16.1196 14.3102 16.1933 14.1346 16.1933 13.9515C16.1933 13.7684 16.1196 13.5928 15.9884 13.4633C15.8572 13.3338 15.6793 13.261 15.4938 13.261ZM10.5947 7.04693C11.0099 7.04706 11.4157 7.16872 11.7608 7.39652C12.1059 7.62431 12.3749 7.94801 12.5336 8.32668C12.6924 8.70536 12.7338 9.12199 12.6527 9.5239C12.5715 9.92582 12.3715 10.295 12.0778 10.5846C11.7842 10.8743 11.4101 11.0716 11.0029 11.1514C10.5957 11.2312 10.1736 11.19 9.79012 11.0331C9.40661 10.8761 9.07886 10.6104 8.84833 10.2696C8.61779 9.92877 8.49482 9.52811 8.49496 9.1183C8.49496 7.97421 9.43504 7.04693 10.5947 7.04693ZM10.5947 8.42784C10.5029 8.4278 10.4119 8.44561 10.327 8.48027C10.2422 8.51492 10.165 8.56574 10.1 8.62983C9.96881 8.75925 9.89503 8.93483 9.89493 9.11795C9.89484 9.30107 9.96845 9.47673 10.0996 9.60628C10.2307 9.73583 10.4085 9.80866 10.594 9.80876C10.7796 9.80876 10.9575 9.73601 11.0886 9.60653C11.2198 9.47704 11.2935 9.30142 11.2935 9.1183C11.2935 8.93518 11.2198 8.75956 11.0886 8.63007C10.9575 8.50059 10.7796 8.42784 10.594 8.42784H10.5947Z",fill:"#080A0F",stroke:"#080A0F","stroke-width":"0.166667"})}),X=({className:s})=>i("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.45492 6.28808C6.43123 5.31177 8.01457 5.31177 8.99089 6.28808C9.96696 7.26431 9.96685 8.84695 8.99089 9.82324C8.01457 10.7996 6.43123 10.7996 5.45492 9.82324C4.47891 8.84694 4.4788 7.26431 5.45492 6.28808ZM8.04769 7.23047C7.59205 6.77513 6.85282 6.77495 6.3973 7.23047C5.94188 7.686 5.94199 8.42526 6.3973 8.88086C6.85287 9.33643 7.59207 9.33636 8.04769 8.88086C8.5033 8.42525 8.5033 7.68608 8.04769 7.23047Z",fill:"#080A0F"}),e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9.07715 1.95703C9.58012 1.90116 10.0815 2.07705 10.4395 2.43473L18.1234 10.1187C18.7739 10.7695 18.7741 11.8246 18.1234 12.4754L11.6414 18.9574C10.9907 19.6081 9.93555 19.6079 9.28467 18.9574L1.60075 11.2734C1.28783 10.9603 1.11442 10.5376 1.11328 10.0999L1.12305 9.91113L1.77165 4.0778C1.85775 3.30308 2.46909 2.69171 3.24381 2.60563L9.07715 1.95703ZM3.42773 4.26172L2.77913 10.095L10.4631 17.779L16.945 11.297L9.26107 3.61312L3.42773 4.26172Z",fill:"#080A0F"})]}),Y=({className:s})=>i("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[e("g",{"clip-path":"url(#clip0_8416_45916)",children:e("path",{d:"M12.0391 0.392503C13.014 -0.174504 14.2592 0.162733 14.8206 1.14283L14.8223 1.14608L16.974 5.01978C18.2095 5.17141 19.1663 6.22452 19.1663 7.50106V16.6677C19.1661 18.0483 18.0469 19.1677 16.6663 19.1677H3.33301C1.95242 19.1677 0.833208 18.0483 0.833008 16.6677V7.50106C0.833008 6.12035 1.9523 5.00106 3.33301 5.00106H4.12077L12.0391 0.392503ZM3.33301 6.66773C2.87277 6.66773 2.49967 7.04083 2.49967 7.50106V16.6677C2.49987 17.1278 2.87289 17.5011 3.33301 17.5011H16.6663C17.1265 17.5011 17.4995 17.1278 17.4997 16.6677V15.8344H13.7497C11.6787 15.8344 9.99987 14.1553 9.99967 12.0844C9.99967 10.0133 11.6786 8.3344 13.7497 8.3344H17.4997V7.50106C17.4997 7.04083 17.1266 6.66773 16.6663 6.66773H3.33301ZM13.7497 10.0011C12.5991 10.0011 11.6663 10.9338 11.6663 12.0844C11.6665 13.2348 12.5992 14.1677 13.7497 14.1677H17.4997V10.0011H13.7497ZM13.333 11.2511C13.7932 11.2511 14.1663 11.6242 14.1663 12.0844C14.1661 12.5445 13.7931 12.9177 13.333 12.9177C12.8729 12.9177 12.4999 12.5445 12.4997 12.0844C12.4997 11.6242 12.8728 11.2511 13.333 11.2511ZM13.473 1.80526C13.3156 1.62235 13.0553 1.56238 12.8341 1.66122L12.7682 1.6954L7.08952 5.00106H9.0459L13.7708 2.32121L13.5348 1.89234L13.473 1.80526ZM11.5801 5.00106H15.2495L14.3747 3.41578L11.5801 5.00106Z",fill:"#080A0F"})}),e("defs",{children:e("clipPath",{id:"clip0_8416_45916",children:e("rect",{width:"20",height:"20",fill:"white"})})})]}),$=({className:s})=>e("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e("path",{d:"M16.667 2.49915C18.0476 2.49915 19.1668 3.61858 19.167 4.99915V14.9991C19.1668 16.3797 18.0476 17.4991 16.667 17.4991H3.33398C1.95353 17.499 0.834161 16.3796 0.833984 14.9991V4.99915C0.83416 3.61869 1.95353 2.49932 3.33398 2.49915H16.667ZM2.5 14.9991C2.50018 15.4591 2.87401 15.832 3.33398 15.8322H16.667C17.1271 15.8322 17.4998 15.4592 17.5 14.9991V8.33215H2.50098L2.5 8.33118V14.9991ZM10.001 12.5333C10.4426 12.5335 10.8007 12.8915 10.8008 13.3331C10.8008 13.7748 10.4427 14.1328 10.001 14.1329H5.00098C4.55915 14.1329 4.20117 13.775 4.20117 13.3331C4.20126 12.8914 4.5592 12.5333 5.00098 12.5333H10.001ZM3.33398 4.16516C2.874 4.16534 2.50018 4.53917 2.5 4.99915V6.66614H17.5V4.99915C17.4998 4.53906 17.1271 4.16516 16.667 4.16516H3.33398Z",fill:"#080A0F"})}),e1=({className:s})=>e("svg",{className:s,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M6.91058 4.4108C7.23602 4.08536 7.76353 4.08536 8.08897 4.4108L13.089 9.41079C13.4144 9.73623 13.4144 10.2637 13.089 10.5892L8.08897 15.5892C7.76353 15.9146 7.23602 15.9146 6.91058 15.5892C6.58515 15.2637 6.58514 14.7362 6.91058 14.4108L11.3214 9.99999L6.91058 5.58918C6.58514 5.26374 6.58514 4.73623 6.91058 4.4108Z",fill:"#080A0F"})});var h1=q;import{default as M1}from"../ProductServiceBenefits/index.js";export{M1 as ProductServiceBenefits,h1 as default};
1
+ import{Fragment as V,jsx as e,jsxs as i}from"react/jsx-runtime";import{Text as a,Picture as g}from"../../../../../../components/index.js";import{useBizProductContext as S}from"../../../../BizProductProvider.js";import{useComponentData as R}from"../../../../hooks/useComponentData.js";import{useBenefits as _}from"../../../../hooks/useBenefits.js";import{formatPrice as G}from"../../../../utils/index.js";import{replaceTemplate as b}from"../../../../utils/textFormat.js";import{useEffect as U,useState as d}from"react";import{useAiuiContext as O}from"../../../../../AiuiProvider/index.js";import{cn as E}from"../../../../../../helpers/index.js";import j from"./../ProductBenefitsTabs/ModalContainer.js";import W from"../ProductServiceBenefits/index.js";import N from"../../../SlideUpModal/index.js";const q=({showServiceBenefits:s=!0}={})=>{const{profile:c,variant:r,renderInstallments:C,savingDetail:B,openSignInPopup:k,openAuthCodePopup:y,product:t1}=S(),{activated:z=!1}=c||{},[u,A]=d(C);U(()=>{C&&A(C),typeof window<"u"&&window.affirm?.ui?.refresh&&window.affirm.ui.refresh()},[C,r.id]);const t=R("ProductBenefits")??{},[F,h]=d(!1),[I,v]=d(!1),[P,x]=d(!1),T=_({variant:r}),{locale:D="us",copyWriting:l1}=O(),{creditsRedemption:n,freeGift:M,functionFreeGift:w,bundle:p,fullGift:m,levelDiscount:f}=T,L=[n.enable?{title:t?.creditsRedemption?.creditsTitle,description:t?.creditsRedemption?.creditsDesc,icon:e(H,{className:"desktop:size-6 size-5"})}:null,n.enable?{title:e(V,{children:!z&&c?.email?i(V,{children:[t?.creditsRedemption?.creditsAfterActivation,e("span",{role:"button",tabIndex:0,onClick:()=>y?.(),className:"underline",children:t?.creditsRedemption?.active})]}):n?.config?.label?.replace("{{amount}}",n?.config?.formattedAmount??G({amount:n?.config?.amount??0,currencyCode:r.price.currencyCode,locale:D}))}),icon:e(H,{className:"desktop:size-6 size-5"})}:null,f.enable?{title:f?.config?.title??"",description:f?.config?.tag??"",icon:e(K,{className:"desktop:size-6 size-5"})}:null,m.enable?{title:m?.config?.title??"",description:m?.config?.desc??"",icon:e(X,{className:"desktop:size-6 size-5"})}:null,M.enable?{title:M?.config?.title??"",icon:e(Z,{className:"desktop:size-6 size-5"})}:null,w.enable?{title:w?.config?.title??"",icon:e(Z,{className:"desktop:size-6 size-5"})}:null,p.enable?{title:b(t?.bundle?.bundleSaveUpTo,{count:p?.config?.maxSavings||""}),description:b(t?.bundle?.bundleOffer,{count:p?.config?.bundleOptions?.length?.toString()||""}),icon:e(Q,{className:"desktop:size-6 size-5"})}:null,t?.paymentMethod?.title?{title:t?.paymentMethod?.title,image:t?.paymentMethod?.image,icon:e($,{className:"desktop:size-6 size-5"}),event:()=>h(!0)}:null,{useAble:!0,isAutoUse:!!c?.email&&!!B?.member,title:c?.email?t?.member?.loginTitle:i("div",{children:[e("span",{className:"mr-2 desktop:mr-3",dangerouslySetInnerHTML:{__html:t?.member?.unloginTitle}}),e("span",{role:"button",tabIndex:0,onClick:l=>{l?.stopPropagation(),k?.()},className:"underline text-nowrap",dangerouslySetInnerHTML:{__html:t?.member?.loginNow}})]}),icon:e(J,{className:"desktop:size-6 size-5"}),event:()=>v(!0)},u?{customRenderTitle:u,icon:e(Y,{className:"desktop:size-6 size-5"})}:null,t?.priceMatch?{title:t?.priceMatch?.title,icon:t?.priceMatch?.icon,event:()=>x(!0)}:null].filter(Boolean);return i("div",{children:[t?.benefitTitle&&e(a,{as:"div",html:t?.benefitTitle,className:"text-sm mb-3 lg-desktop:mb-4 lg-desktop:text-base font-bold leading-[1.2]"}),i("ul",{className:"desktop:px-4 px-3 rounded-box bg-[#F5F6F7]",children:[L?.map((l,o)=>i("li",{children:[i("div",{className:"flex gap-3 items-start py-3 laptop:py-4",children:[e("div",{className:"shrink-0",children:typeof l?.icon=="string"?e(g,{source:l?.icon,className:"desktop:size-6 size-5"}):l?.icon}),i("div",{onClick:l?.event,className:E("flex flex-1 items-center gap-1 desktop:gap-2",l?.event&&"cursor-pointer justify-between"),children:[i("div",{children:[l?.customRenderTitle?e("div",{children:l?.customRenderTitle}):i("div",{className:"flex items-center gap-2 desktop:gap-3 text-[14px] laptop:text-base font-bold leading-[1.2]",children:[l?.title,l?.image&&e(g,{source:l?.image,className:"w-[40px] h-[20px] shrink-0"})]}),l?.description&&e(a,{...typeof l.description=="string"?{html:l.description}:{},as:"p",className:"laptop:text-[14px] text-[12px] font-bold text-[#2A2C32]",children:l.description})]}),l?.event&&e(e1,{className:"size-4 desktop:size-6"})]})]}),o!=L?.length-1&&e("div",{className:"bg-[#DADCE0] h-[1px]"})]},o)),s&&e(W,{className:"desktop:px-0 px-0"})]}),e(j,{showModal:F,closeModal:()=>h(!1),children:e(g,{source:t?.paymentMethod?.payImage})}),t?.priceMatch?.modal&&e(N,{title:t?.priceMatch?.modal?.title??t?.priceMatch?.title,showModal:P,closeModal:()=>x(!1),children:e("ul",{className:"list-disc list-outside flex flex-col gap-3 px-8 tablet:px-12 pb-6 tablet:py-8",children:(t?.priceMatch?.modal?.list??[]).map((l,o)=>e("li",{children:e(a,{html:l.desc,className:"text-[14px] tablet:text-[16px] leading-[1.6] text-[#6D6D6F]"})},o))})}),t?.member?.modelBenefits&&e(N,{title:t?.member?.modelTitle,showModal:I,closeModal:()=>v(!1),children:e("ul",{className:"flex flex-col overflow-y-auto tablet:max-h-[calc(80vh-52px)] tablet:py-8 gap-5 pb-6 tablet:pb-8 tablet:gap-8 px-4 tablet:px-8",children:t?.member?.modelBenefits?.map((l,o)=>i("li",{className:"flex flex-col gap-1",children:[e(a,{html:l?.title,className:"text-[16px] tablet:text-[18px] font-bold leading-[1.4]"}),e(a,{html:l?.desc,className:"text-[14px] text-[#1D1D1F] tablet:text-[16px] font-bold leading-[1.4] opacity-75"})]},o))})})]})},H=({className:s})=>e("svg",{className:s,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1ZM12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM17 13C17.5523 13 18 13.4477 18 14C18 14.5523 17.5523 15 17 15H9.41406L9.70703 15.293C10.0976 15.6835 10.0976 16.3165 9.70703 16.707C9.31651 17.0976 8.68349 17.0976 8.29297 16.707L6.29297 14.707C6.00697 14.421 5.92139 13.9909 6.07617 13.6172C6.23098 13.2436 6.59558 13 7 13H17ZM14.293 7.29297C14.6835 6.90244 15.3165 6.90244 15.707 7.29297L17.707 9.29297C17.993 9.57897 18.0786 10.0091 17.9238 10.3828C17.769 10.7564 17.4044 11 17 11H7C6.44772 11 6 10.5523 6 10C6 9.44771 6.44772 9 7 9H14.5859L14.293 8.70703C13.9024 8.31651 13.9024 7.68349 14.293 7.29297Z",fill:"#1D1D1F"})}),J=({className:s})=>e("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.4294 1.58368C15.0354 1.5838 15.6026 1.88286 15.944 2.38348L19.4997 7.5993C19.9918 8.32123 19.9058 9.29041 19.2946 9.91473L11.8571 17.5104C10.8453 18.5435 9.18314 18.5447 8.16961 17.5134L0.696949 9.90692C0.0916662 9.29063 -0.000821769 8.3354 0.474293 7.61395L3.90203 2.4079C4.24121 1.89312 4.81678 1.58368 5.43328 1.58368H14.4294ZM2.00457 8.62177L9.47722 16.2292C9.77143 16.5282 10.2539 16.5278 10.5475 16.2282L17.9841 8.63153L14.4294 3.41669H5.43328L2.00457 8.62177ZM13.5759 7.74481C13.9008 7.41946 14.4279 7.41834 14.7536 7.74286C15.0792 8.06792 15.0804 8.59584 14.7555 8.92157L10.6247 13.0593C10.2833 13.401 9.72933 13.4013 9.38738 13.0602L5.24382 8.92352C4.91829 8.59852 4.9172 8.07056 5.24187 7.74481C5.56689 7.41925 6.09484 7.41813 6.42058 7.74286L10.0046 11.321L13.5759 7.74481Z",fill:"#080A0F"})}),K=({className:s})=>i("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[e("path",{d:"M13.1615 5.66083C13.4869 5.33539 14.0144 5.33539 14.3398 5.66083C14.6653 5.98626 14.6653 6.51378 14.3398 6.83921L6.83984 14.3392C6.51441 14.6646 5.98689 14.6646 5.66146 14.3392C5.33602 14.0138 5.33602 13.4863 5.66146 13.1608L13.1615 5.66083Z",fill:"#080A0F"}),e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.709 11.0417C13.6295 11.0417 14.3756 11.7879 14.3756 12.7084C14.3756 13.6288 13.6295 14.375 12.709 14.375C11.7885 14.375 11.0423 13.6288 11.0423 12.7084C11.0423 11.7879 11.7885 11.0417 12.709 11.0417ZM12.709 12.2917C12.4789 12.2917 12.2923 12.4782 12.2923 12.7084C12.2923 12.9385 12.4789 13.125 12.709 13.125C12.9391 13.125 13.1256 12.9385 13.1256 12.7084C13.1256 12.4782 12.9391 12.2917 12.709 12.2917Z",fill:"#080A0F"}),e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.29232 5.62502C8.21279 5.62502 8.95898 6.37121 8.95898 7.29169C8.95898 8.21216 8.21279 8.95835 7.29232 8.95835C6.37184 8.95835 5.62565 8.21216 5.62565 7.29169C5.62565 6.37121 6.37184 5.62502 7.29232 5.62502ZM7.29232 6.87502C7.0622 6.87502 6.87565 7.06157 6.87565 7.29169C6.87565 7.52181 7.0622 7.70835 7.29232 7.70835C7.52244 7.70835 7.70898 7.52181 7.70898 7.29169C7.70898 7.06157 7.52244 6.87502 7.29232 6.87502Z",fill:"#080A0F"}),e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.6673 2.91669C18.048 2.91669 19.1673 4.03597 19.1673 5.41669V8.0469C19.1673 8.39923 18.9458 8.71388 18.6139 8.83221C18.0561 9.03101 17.652 9.57037 17.652 10.2084C17.652 10.8463 18.0561 11.3857 18.6139 11.5845C18.9458 11.7028 19.1673 12.0175 19.1673 12.3698V15C19.1673 16.3807 18.048 17.5 16.6673 17.5H3.33398C1.95327 17.5 0.833984 16.3807 0.833984 15V12.3698L0.84375 12.2396C0.890672 11.9418 1.09696 11.688 1.38737 11.5845C1.94519 11.3857 2.34928 10.8463 2.34928 10.2084C2.34928 9.57036 1.94519 9.03101 1.38737 8.83221C1.05551 8.71388 0.833984 8.39923 0.833984 8.0469V5.41669C0.833985 4.03598 1.95327 2.91669 3.33398 2.91669H16.6673ZM3.33398 4.58335C2.87375 4.58335 2.50065 4.95645 2.50065 5.41669V7.52606C3.40888 8.07233 4.01595 9.06946 4.01595 10.2084C4.01595 11.3471 3.40868 12.3435 2.50065 12.8898V15C2.50065 15.4603 2.87375 15.8334 3.33398 15.8334H16.6673C17.1276 15.8334 17.5006 15.4603 17.5006 15V12.8898C16.5926 12.3435 15.9853 11.3471 15.9853 10.2084C15.9853 9.06945 16.5924 8.07233 17.5006 7.52606V5.41669C17.5006 4.95645 17.1276 4.58335 16.6673 4.58335H3.33398Z",fill:"#080A0F"})]}),Z=({className:s})=>e("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.4951 1.47201C12.791 1.17663 13.2707 1.17634 13.5664 1.47201C13.862 1.76788 13.8622 2.24851 13.5664 2.54428L11.8301 4.2806H17.5752C17.9935 4.28073 18.333 4.62012 18.333 5.03842V8.06869C18.333 8.48701 17.9935 8.82638 17.5752 8.8265H17.1982V17.1595C17.198 17.5776 16.8585 17.9171 16.4404 17.9173H3.56152C3.14327 17.9173 2.80394 17.5777 2.80371 17.1595V8.8265H2.42383C2.00543 8.8265 1.66602 8.48709 1.66602 8.06869V5.03842C1.66605 4.62005 2.00545 4.2806 2.42383 4.2806H8.16992L6.43359 2.54428C6.13775 2.24843 6.13776 1.76786 6.43359 1.47201C6.72945 1.17616 7.21001 1.17616 7.50586 1.47201L10 3.96615L12.4951 1.47201ZM4.31934 16.4017H9.24219V8.8265H4.31934V16.4017ZM10.7578 16.4017H15.6826V8.8265H10.7578V16.4017ZM3.18164 7.31088H16.8174V5.79623H3.18164V7.31088Z",fill:"#080A0F"})}),Q=({className:s})=>e("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e("path",{d:"M14.1152 1.18357L14.2551 1.26642L18.4546 3.9088C18.8514 4.15858 19.178 4.50301 19.4043 4.91029C19.6306 5.31758 19.7492 5.77458 19.7493 6.23909V16.0194C19.7495 16.3825 19.6772 16.742 19.5366 17.0775C19.396 17.413 19.1898 17.7179 18.9298 17.9747C18.6697 18.2315 18.361 18.4352 18.0212 18.5742C17.6814 18.7132 17.3172 18.7847 16.9494 18.7847H8.55091C8.1623 18.7852 7.77786 18.7056 7.42219 18.5511C7.06652 18.3965 6.74745 18.1704 6.48539 17.8871L1.61712 16.3743C1.35494 16.2904 1.11208 16.1563 0.902404 15.9797C0.692732 15.8031 0.520358 15.5875 0.395126 15.3451C0.269895 15.1027 0.194259 14.8384 0.172541 14.5672C0.150822 14.296 0.183446 14.0232 0.268548 13.7644L3.25386 4.69868C3.36315 4.36757 3.55522 4.06899 3.81232 3.83053C4.06942 3.59207 4.38326 3.42141 4.72484 3.33434L9.66236 2.26275L11.246 1.26642C11.6722 0.998206 12.1641 0.848941 12.6694 0.834475C13.1747 0.820008 13.6746 0.94088 14.1159 1.18426L14.1152 1.18357ZM11.9979 2.44503L7.79829 5.08741C7.59979 5.21229 7.43639 5.38454 7.32319 5.58825C7.20998 5.79196 7.15061 6.02055 7.15058 6.2529V16.0201C7.15058 16.7838 7.7773 17.4024 8.55021 17.4024H16.9494C17.1333 17.4025 17.3155 17.3668 17.4855 17.2974C17.6555 17.228 17.8099 17.1261 17.94 16.9978C18.0701 16.8694 18.1733 16.717 18.2438 16.5492C18.3142 16.3815 18.3504 16.2017 18.3504 16.0201V6.2529C18.3504 5.78063 18.1056 5.3415 17.7027 5.08741L13.5031 2.44503C13.2784 2.30354 13.0174 2.22837 12.7508 2.22837C12.4843 2.22837 12.2233 2.30354 11.9986 2.44503H11.9979ZM6.49449 4.36243L5.07457 4.67106C4.96068 4.70009 4.85604 4.757 4.77033 4.83654C4.68463 4.91607 4.62062 5.01565 4.58425 5.12608L1.59823 14.1911C1.56987 14.2774 1.559 14.3683 1.56626 14.4587C1.57351 14.5491 1.59875 14.6373 1.64051 14.7181C1.68228 14.7988 1.73976 14.8707 1.80968 14.9296C1.87959 14.9884 1.96057 15.0331 2.04799 15.0611L5.76005 16.2459C5.75394 16.1708 5.75091 16.0955 5.75095 16.0201V6.23978C5.75095 5.53552 6.02235 4.86715 6.49518 4.36243H6.49449ZM15.4938 11.8801C15.909 11.8803 16.3148 12.0019 16.6599 12.2297C17.005 12.4575 17.2739 12.7812 17.4327 13.1599C17.5914 13.5386 17.6329 13.9552 17.5517 14.3571C17.4706 14.759 17.2706 15.1282 16.9769 15.4178C16.6832 15.7075 16.3091 15.9048 15.9019 15.9846C15.4947 16.0644 15.0727 16.0232 14.6892 15.8663C14.3057 15.7093 13.9779 15.4436 13.7474 15.1028C13.5168 14.762 13.3939 14.3613 13.394 13.9515C13.394 12.8074 14.3341 11.8801 15.4938 11.8801ZM10.0995 13.5124L15.0489 8.63015C15.1753 8.50803 15.3437 8.4376 15.5204 8.43301C15.6972 8.42841 15.8691 8.48998 16.0018 8.60536C16.1344 8.72074 16.2179 8.88139 16.2355 9.05504C16.2532 9.22869 16.2036 9.40249 16.0967 9.54155L16.0387 9.60645L11.0893 14.4887C10.963 14.6108 10.7945 14.6812 10.6178 14.6858C10.4411 14.6904 10.2691 14.6288 10.1365 14.5135C10.0038 14.3981 9.92029 14.2374 9.90267 14.0638C9.88506 13.8901 9.93464 13.7163 10.0415 13.5773L10.0995 13.5124ZM15.4938 13.261C15.3083 13.261 15.1304 13.3338 14.9992 13.4633C14.868 13.5928 14.7943 13.7684 14.7943 13.9515C14.7943 14.1346 14.868 14.3102 14.9992 14.4397C15.1304 14.5692 15.3083 14.642 15.4938 14.642C15.6793 14.642 15.8572 14.5692 15.9884 14.4397C16.1196 14.3102 16.1933 14.1346 16.1933 13.9515C16.1933 13.7684 16.1196 13.5928 15.9884 13.4633C15.8572 13.3338 15.6793 13.261 15.4938 13.261ZM10.5947 7.04693C11.0099 7.04706 11.4157 7.16872 11.7608 7.39652C12.1059 7.62431 12.3749 7.94801 12.5336 8.32668C12.6924 8.70536 12.7338 9.12199 12.6527 9.5239C12.5715 9.92582 12.3715 10.295 12.0778 10.5846C11.7842 10.8743 11.4101 11.0716 11.0029 11.1514C10.5957 11.2312 10.1736 11.19 9.79012 11.0331C9.40661 10.8761 9.07886 10.6104 8.84833 10.2696C8.61779 9.92877 8.49482 9.52811 8.49496 9.1183C8.49496 7.97421 9.43504 7.04693 10.5947 7.04693ZM10.5947 8.42784C10.5029 8.4278 10.4119 8.44561 10.327 8.48027C10.2422 8.51492 10.165 8.56574 10.1 8.62983C9.96881 8.75925 9.89503 8.93483 9.89493 9.11795C9.89484 9.30107 9.96845 9.47673 10.0996 9.60628C10.2307 9.73583 10.4085 9.80866 10.594 9.80876C10.7796 9.80876 10.9575 9.73601 11.0886 9.60653C11.2198 9.47704 11.2935 9.30142 11.2935 9.1183C11.2935 8.93518 11.2198 8.75956 11.0886 8.63007C10.9575 8.50059 10.7796 8.42784 10.594 8.42784H10.5947Z",fill:"#080A0F",stroke:"#080A0F","stroke-width":"0.166667"})}),X=({className:s})=>i("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.45492 6.28808C6.43123 5.31177 8.01457 5.31177 8.99089 6.28808C9.96696 7.26431 9.96685 8.84695 8.99089 9.82324C8.01457 10.7996 6.43123 10.7996 5.45492 9.82324C4.47891 8.84694 4.4788 7.26431 5.45492 6.28808ZM8.04769 7.23047C7.59205 6.77513 6.85282 6.77495 6.3973 7.23047C5.94188 7.686 5.94199 8.42526 6.3973 8.88086C6.85287 9.33643 7.59207 9.33636 8.04769 8.88086C8.5033 8.42525 8.5033 7.68608 8.04769 7.23047Z",fill:"#080A0F"}),e("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9.07715 1.95703C9.58012 1.90116 10.0815 2.07705 10.4395 2.43473L18.1234 10.1187C18.7739 10.7695 18.7741 11.8246 18.1234 12.4754L11.6414 18.9574C10.9907 19.6081 9.93555 19.6079 9.28467 18.9574L1.60075 11.2734C1.28783 10.9603 1.11442 10.5376 1.11328 10.0999L1.12305 9.91113L1.77165 4.0778C1.85775 3.30308 2.46909 2.69171 3.24381 2.60563L9.07715 1.95703ZM3.42773 4.26172L2.77913 10.095L10.4631 17.779L16.945 11.297L9.26107 3.61312L3.42773 4.26172Z",fill:"#080A0F"})]}),Y=({className:s})=>i("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:[e("g",{"clip-path":"url(#clip0_8416_45916)",children:e("path",{d:"M12.0391 0.392503C13.014 -0.174504 14.2592 0.162733 14.8206 1.14283L14.8223 1.14608L16.974 5.01978C18.2095 5.17141 19.1663 6.22452 19.1663 7.50106V16.6677C19.1661 18.0483 18.0469 19.1677 16.6663 19.1677H3.33301C1.95242 19.1677 0.833208 18.0483 0.833008 16.6677V7.50106C0.833008 6.12035 1.9523 5.00106 3.33301 5.00106H4.12077L12.0391 0.392503ZM3.33301 6.66773C2.87277 6.66773 2.49967 7.04083 2.49967 7.50106V16.6677C2.49987 17.1278 2.87289 17.5011 3.33301 17.5011H16.6663C17.1265 17.5011 17.4995 17.1278 17.4997 16.6677V15.8344H13.7497C11.6787 15.8344 9.99987 14.1553 9.99967 12.0844C9.99967 10.0133 11.6786 8.3344 13.7497 8.3344H17.4997V7.50106C17.4997 7.04083 17.1266 6.66773 16.6663 6.66773H3.33301ZM13.7497 10.0011C12.5991 10.0011 11.6663 10.9338 11.6663 12.0844C11.6665 13.2348 12.5992 14.1677 13.7497 14.1677H17.4997V10.0011H13.7497ZM13.333 11.2511C13.7932 11.2511 14.1663 11.6242 14.1663 12.0844C14.1661 12.5445 13.7931 12.9177 13.333 12.9177C12.8729 12.9177 12.4999 12.5445 12.4997 12.0844C12.4997 11.6242 12.8728 11.2511 13.333 11.2511ZM13.473 1.80526C13.3156 1.62235 13.0553 1.56238 12.8341 1.66122L12.7682 1.6954L7.08952 5.00106H9.0459L13.7708 2.32121L13.5348 1.89234L13.473 1.80526ZM11.5801 5.00106H15.2495L14.3747 3.41578L11.5801 5.00106Z",fill:"#080A0F"})}),e("defs",{children:e("clipPath",{id:"clip0_8416_45916",children:e("rect",{width:"20",height:"20",fill:"white"})})})]}),$=({className:s})=>e("svg",{className:s,xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:e("path",{d:"M16.667 2.49915C18.0476 2.49915 19.1668 3.61858 19.167 4.99915V14.9991C19.1668 16.3797 18.0476 17.4991 16.667 17.4991H3.33398C1.95353 17.499 0.834161 16.3796 0.833984 14.9991V4.99915C0.83416 3.61869 1.95353 2.49932 3.33398 2.49915H16.667ZM2.5 14.9991C2.50018 15.4591 2.87401 15.832 3.33398 15.8322H16.667C17.1271 15.8322 17.4998 15.4592 17.5 14.9991V8.33215H2.50098L2.5 8.33118V14.9991ZM10.001 12.5333C10.4426 12.5335 10.8007 12.8915 10.8008 13.3331C10.8008 13.7748 10.4427 14.1328 10.001 14.1329H5.00098C4.55915 14.1329 4.20117 13.775 4.20117 13.3331C4.20126 12.8914 4.5592 12.5333 5.00098 12.5333H10.001ZM3.33398 4.16516C2.874 4.16534 2.50018 4.53917 2.5 4.99915V6.66614H17.5V4.99915C17.4998 4.53906 17.1271 4.16516 16.667 4.16516H3.33398Z",fill:"#080A0F"})}),e1=({className:s})=>e("svg",{className:s,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M6.91058 4.4108C7.23602 4.08536 7.76353 4.08536 8.08897 4.4108L13.089 9.41079C13.4144 9.73623 13.4144 10.2637 13.089 10.5892L8.08897 15.5892C7.76353 15.9146 7.23602 15.9146 6.91058 15.5892C6.58515 15.2637 6.58514 14.7362 6.91058 14.4108L11.3214 9.99999L6.91058 5.58918C6.58514 5.26374 6.58514 4.73623 6.91058 4.4108Z",fill:"#080A0F"})});var h1=q;import{default as M1}from"../ProductServiceBenefits/index.js";export{M1 as ProductServiceBenefits,h1 as default};
@@ -1 +1 @@
1
- "use client";import{Fragment as P,jsx as e,jsxs as r}from"react/jsx-runtime";import w from"react";import{cn as k,formatPrice as y}from"../../../../../../helpers/index.js";import{Text as p,Link as F,Checkbox as N}from"../../../../../../components/index.js";import M from"../../../../hooks/useCopy.js";import{useBenefits as I}from"../../../../hooks/useBenefits.js";import{useBizProductContext as _}from"../../../../BizProductProvider.js";import{useComponentData as S}from"../../../../hooks/useComponentData.js";import{replaceTemplate as g}from"../../../../utils/textFormat.js";import{useAiuiContext as B}from"../../../../../AiuiProvider/index.js";import R from"../../../../../../hooks/useCountDown.js";const L=w.memo(function({endTime:a,template:t}){const{days:c,hours:i,minutes:s,seconds:m}=R({endTime:a});return e(P,{children:g(t,{countdown:`${c}:${i}:${s}:${m}`})})}),h=({checked:d,discountText:a,codeText:t,code:c,countdownText:i,copyText:s,copiedText:m,onClick:l,className:x})=>{const{copied:b,copy:C}=M();return e("div",{className:k("flex flex-col gap-3 rounded-box overflow-hidden",x),role:"button",tabIndex:0,onClick:l,children:r("div",{className:"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4",children:[r("div",{className:"flex flex-col gap-1",children:[r("div",{className:"flex items-center gap-1",children:[e(N,{size:"lg",className:"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary",checked:d}),e(p,{className:"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]",children:a})]}),r("div",{className:"flex w-full items-center gap-2",children:[e("div",{className:"flex shrink-0 flex-col items-start",children:e(p,{className:"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px]",children:t})}),e(F,{className:"lg-desktop:text-[16px] text-[14px] font-bold underline",role:"button",tabIndex:0,onClick:o=>{o.preventDefault(),o.stopPropagation(),C(c)},children:b?m:s})]})]}),i&&e(p,{className:"text-brand-0 text-sm lg-desktop:text-base font-bold leading-[1.4] tracking-[-0.28px]",children:i})]})})};h.displayName="CouponCard";const T=({checked:d,discountText:a,description:t,onClick:c,className:i})=>e("div",{className:k("flex flex-col gap-3 rounded-box overflow-hidden",i),role:"button",tabIndex:0,onClick:c,children:e("div",{className:"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4",children:r("div",{className:"flex flex-col gap-1",children:[r("div",{className:"flex items-center gap-1",children:[e(N,{size:"lg",className:"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary",checked:d}),e(p,{className:"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]",children:a})]}),t&&e(p,{className:"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px] pl-8",children:t})]})})});T.displayName="MemberDiscountCard";const D=({className:d})=>{const{profile:a,variant:t,onUseCouponChange:c,onUseMemberDiscountChange:i,openSignInPopup:s,discount:m,savingDetail:l}=_(),{locale:x="us",trackingData:b}=B(),C=I({variant:t}),{commonCoupon:o,memberDiscount:f}=C,v=b?.common?.coupon,n=S("ProductCoupon")??{};return!o?.enable&&!f?.enable||!t?.availableForSale?null:r("div",{className:k("ipc-product-detail-product-coupon flex flex-col gap-3 lg-desktop:gap-4",d),children:[n?.title&&e(p,{className:"text-info-primary text-[14px] lg-desktop:text-[16px] font-bold leading-[1.2] tracking-[-0.56px]",children:n.title}),o?.enable&&e(h,{checked:l?.coupon>0,discountText:g(n?.common?.offCoupon,{discount:o?.config?.value_type=="percentage"?Math.abs(Number(o?.config?.value||0))+"%":y({amount:Math.abs(Number(o?.config?.fixed_value||0)),currencyCode:t.price.currencyCode,locale:x})||""}),codeText:g(n?.common?.withCode,{code:o?.config?.title??""}),code:o?.config?.title??"",countdownText:o?.config?.ends_at?e(L,{endTime:o.config.ends_at,template:n?.common?.endsIn??""}):void 0,copyText:v?.copy||n?.copyCode,copiedText:v?.copied||n?.copied,onClick:()=>{const u=l?.coupon?0:m?.codeSavings??0;c?.(u)}}),f?.enable&&e(T,{checked:!!a?.email&&!!l?.member,discountText:g(n?.member?.offMember,{discount:y({amount:f?.config?.amount??0,currencyCode:t.price.currencyCode,locale:x})||""}),description:a?.email?n?.member?.loginDesc:r(P,{children:[e("span",{className:"mr-2",dangerouslySetInnerHTML:{__html:n?.member?.unloginDesc}}),e("span",{role:"button",tabIndex:0,onClick:u=>{u?.stopPropagation(),s?.()},className:"underline text-nowrap",dangerouslySetInnerHTML:{__html:n?.member?.login}})]}),onClick:()=>{if(!a?.email){s?.();return}const u=l?.member?0:f?.config?.amount??0;i?.(u)}})]})};D.displayName="ProductCoupon";var O=D;export{h as CouponCard,T as MemberDiscountCard,O as default};
1
+ "use client";import{Fragment as P,jsx as e,jsxs as r}from"react/jsx-runtime";import w from"react";import{cn as k,formatPrice as y}from"../../../../../../helpers/index.js";import{Text as p,Link as F,Checkbox as N}from"../../../../../../components/index.js";import M from"../../../../hooks/useCopy.js";import{useBenefits as I}from"../../../../hooks/useBenefits.js";import{useBizProductContext as _}from"../../../../BizProductProvider.js";import{useComponentData as S}from"../../../../hooks/useComponentData.js";import{replaceTemplate as g}from"../../../../utils/textFormat.js";import{useAiuiContext as B}from"../../../../../AiuiProvider/index.js";import R from"../../../../../../hooks/useCountDown.js";const L=w.memo(function({endTime:a,template:t}){const{days:c,hours:i,minutes:l,seconds:m}=R({endTime:a});return e(P,{children:g(t,{countdown:`${c}:${i}:${l}:${m}`})})}),h=({checked:d,discountText:a,codeText:t,code:c,countdownText:i,copyText:l,copiedText:m,onClick:s,className:f})=>{const{copied:b,copy:C}=M();return e("div",{className:k("flex flex-col gap-3 rounded-box overflow-hidden",f),role:"button",tabIndex:0,onClick:s,children:r("div",{className:"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4",children:[r("div",{className:"flex flex-col gap-1",children:[r("div",{className:"flex items-center gap-1",children:[e(N,{size:"lg",className:"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary",checked:d}),e(p,{className:"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]",children:a})]}),r("div",{className:"flex w-full items-center gap-2",children:[e("div",{className:"flex shrink-0 flex-col items-start",children:e(p,{className:"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px]",children:t})}),e(F,{className:"lg-desktop:text-[16px] text-[14px] font-bold underline",role:"button",tabIndex:0,onClick:o=>{o.preventDefault(),o.stopPropagation(),C(c)},children:b?m:l})]})]}),i&&e(p,{className:"text-brand-0 text-sm lg-desktop:text-base font-bold leading-[1.4] tracking-[-0.28px]",children:i})]})})};h.displayName="CouponCard";const T=({checked:d,discountText:a,description:t,onClick:c,className:i})=>e("div",{className:k("flex flex-col gap-3 rounded-box overflow-hidden",i),role:"button",tabIndex:0,onClick:c,children:e("div",{className:"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4",children:r("div",{className:"flex flex-col gap-1",children:[r("div",{className:"flex items-center gap-1",children:[e(N,{size:"lg",className:"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary",checked:d}),e(p,{className:"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]",children:a})]}),t&&e(p,{className:"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px] pl-8",children:t})]})})});T.displayName="MemberDiscountCard";const D=({className:d})=>{const{profile:a,variant:t,onUseCouponChange:c,onUseMemberDiscountChange:i,openSignInPopup:l,discount:m,savingDetail:s}=_(),{locale:f="us",trackingData:b}=B(),C=I({variant:t}),{commonCoupon:o,memberDiscount:u}=C,v=b?.common?.coupon,n=S("ProductCoupon")??{};return!o?.enable&&!u?.enable||!t?.availableForSale?null:r("div",{className:k("ipc-product-detail-product-coupon flex flex-col gap-3 lg-desktop:gap-4",d),children:[n?.title&&e(p,{className:"text-info-primary text-[14px] lg-desktop:text-[16px] font-bold leading-[1.2] tracking-[-0.56px]",children:n.title}),o?.enable&&e(h,{checked:s?.coupon>0,discountText:g(n?.common?.offCoupon,{discount:o?.config?.value_type=="percentage"?Math.abs(Number(o?.config?.value||0))+"%":(o?.config?.formattedFixedValue??y({amount:Math.abs(Number(o?.config?.fixed_value||0)),currencyCode:t.price.currencyCode,locale:f}))||""}),codeText:g(n?.common?.withCode,{code:o?.config?.title??""}),code:o?.config?.title??"",countdownText:o?.config?.ends_at?e(L,{endTime:o.config.ends_at,template:n?.common?.endsIn??""}):void 0,copyText:v?.copy||n?.copyCode,copiedText:v?.copied||n?.copied,onClick:()=>{const x=s?.coupon?0:m?.codeSavings??0;c?.(x)}}),u?.enable&&e(T,{checked:!!a?.email&&!!s?.member,discountText:g(n?.member?.offMember,{discount:(u?.config?.formattedAmount??y({amount:u?.config?.amount??0,currencyCode:t.price.currencyCode,locale:f}))||""}),description:a?.email?n?.member?.loginDesc:r(P,{children:[e("span",{className:"mr-2",dangerouslySetInnerHTML:{__html:n?.member?.unloginDesc}}),e("span",{role:"button",tabIndex:0,onClick:x=>{x?.stopPropagation(),l?.()},className:"underline text-nowrap",dangerouslySetInnerHTML:{__html:n?.member?.login}})]}),onClick:()=>{if(!a?.email){l?.();return}const x=s?.member?0:u?.config?.amount??0;i?.(x)}})]})};D.displayName="ProductCoupon";var K=D;export{h as CouponCard,T as MemberDiscountCard,K as default};
@@ -1 +1 @@
1
- import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Text as r,Picture as P,Checkbox as E}from"../../../../../../components/index.js";import{cn as f}from"../../../../../../helpers/index.js";import{useMemo as w}from"react";import{useBizProductContext as F}from"../../../../BizProductProvider.js";import{formatPrice as G}from"../../../../utils/index.js";import{useAiuiContext as B}from"../../../../../AiuiProvider/index.js";import{withLayout as D}from"../../../../../../shared/Styles.js";import{useFollowTooltip as T,FollowTooltip as z}from"../../../../hooks/useFollowTooltip.js";const L=()=>{const{locale:u="us"}=B(),{tooltip:x,getTooltipProps:b}=T(),{freeGift:h,checkedGift:l,setCheckedGift:i,setCheckedBundle:O,setSavingDetail:g,savingDetail:k,setJoinedRecommendBuyProducts:a,joinedRecommendBuyProducts:s,setAddOrder:c}=F(),{title:v,giftList:p=[],freeLabel:C}=h||{},n=w(()=>p?.filter(e=>e.availableForSale),[p]),N=e=>{l?.id===e.id?(i?.(void 0),g?.({...k,freeGift:0}),a?.({...s,gift:{value:void 0,canOperate:!0}}),c?.(d=>d.filter(m=>m!=="gift"))):(i?.(e),a?.({...s,gift:{value:e,canOperate:!1}}),c?.(d=>[...d.filter(y=>y!=="gift"),"gift"]))};return n?.length?o("div",{className:"ipc-product-detail-free-gift",children:[t(r,{className:"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]",html:v}),t("div",{className:"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3",children:n.map(e=>o("div",{className:f("rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold",{"border-brand":l?.id===e.id}),children:[t(E,{onCheckedChange:()=>N(e),size:"lg",className:f("rounded-full border-2 border-[#E4E5E6]",{"border-brand-0 data-[state=checked]:bg-brand-0":l?.id===e.id}),id:e.id,checked:l?.id===e.id,value:e.id}),o("label",{htmlFor:e.id,className:"flex w-full cursor-pointer items-center justify-between gap-4 py-4 lg-desktop:py-6",children:[o("div",{className:"flex items-center gap-2",children:[t(P,{source:e.image?.url,className:"size-12 shrink-0",imgClassName:"h-full"}),t(r,{...b(e.product.title),className:"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold",html:e.product.title}),t(z,{...x})]}),o("div",{className:"tablet:flex-row flex shrink-0 flex-col items-center gap-1",children:[t(r,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold !leading-[1.2]",html:C}),t(r,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold text-[#6D6D6F] line-through !leading-[1.2]",html:G({amount:e.price.amount,locale:u,currencyCode:e.price.currencyCode})})]})]})]},e.id))})]}):null};var I=D(L);export{I as default};
1
+ import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Text as r,Picture as P,Checkbox as E}from"../../../../../../components/index.js";import{cn as f}from"../../../../../../helpers/index.js";import{useMemo as w}from"react";import{useBizProductContext as F}from"../../../../BizProductProvider.js";import{formatPrice as G}from"../../../../utils/index.js";import{useAiuiContext as B}from"../../../../../AiuiProvider/index.js";import{withLayout as D}from"../../../../../../shared/Styles.js";import{useFollowTooltip as T,FollowTooltip as z}from"../../../../hooks/useFollowTooltip.js";const A=()=>{const{locale:u="us"}=B(),{tooltip:x,getTooltipProps:b}=T(),{freeGift:h,checkedGift:l,setCheckedGift:i,setCheckedBundle:L,setSavingDetail:g,savingDetail:k,setJoinedRecommendBuyProducts:a,joinedRecommendBuyProducts:s,setAddOrder:c}=F(),{title:v,giftList:p=[],freeLabel:C}=h||{},n=w(()=>p?.filter(e=>e.availableForSale),[p]),N=e=>{l?.id===e.id?(i?.(void 0),g?.({...k,freeGift:0}),a?.({...s,gift:{value:void 0,canOperate:!0}}),c?.(d=>d.filter(m=>m!=="gift"))):(i?.(e),a?.({...s,gift:{value:e,canOperate:!1}}),c?.(d=>[...d.filter(y=>y!=="gift"),"gift"]))};return n?.length?o("div",{className:"ipc-product-detail-free-gift",children:[t(r,{className:"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]",html:v}),t("div",{className:"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3",children:n.map(e=>o("div",{className:f("rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold",{"border-brand":l?.id===e.id}),children:[t(E,{onCheckedChange:()=>N(e),size:"lg",className:f("rounded-full border-2 border-[#E4E5E6]",{"border-brand-0 data-[state=checked]:bg-brand-0":l?.id===e.id}),id:e.id,checked:l?.id===e.id,value:e.id}),o("label",{htmlFor:e.id,className:"flex w-full cursor-pointer items-center justify-between gap-4 py-4 lg-desktop:py-6",children:[o("div",{className:"flex items-center gap-2",children:[t(P,{source:e.image?.url,className:"size-12 shrink-0",imgClassName:"h-full"}),t(r,{...b(e.product.title),className:"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold",html:e.product.title}),t(z,{...x})]}),o("div",{className:"tablet:flex-row flex shrink-0 flex-col items-center gap-1",children:[t(r,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold !leading-[1.2]",html:C}),t(r,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold text-[#6D6D6F] line-through !leading-[1.2]",html:e.price.formattedAmount??G({amount:e.price.amount,locale:u,currencyCode:e.price.currencyCode})})]})]})]},e.id))})]}):null};var I=D(A);export{I as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useEffect as N,useState as y}from"react";import{Dialog as D,DialogTrigger as C,DialogContent as h,DialogHeader as E,DialogTitle as G,Grid as c,GridItem as o,Text as f}from"../../../../../../components/index.js";import{useBizProductContext as w}from"../../../../BizProductProvider.js";import I from"./Select.js";import{useAiuiContext as k}from"../../../../../AiuiProvider/index.js";import{formatPrice as g}from"../../../../utils/index.js";import{ShopifyColorOption as z}from"./ShopifyColorOption.js";const P=()=>{const{locale:x="us",copyWriting:n}=k(),{compareData:l,product:b}=w(),[m,u]=y();N(()=>{u(l?.availableCompareList[0]?.handle)},[l?.availableCompareList]);const d=[l?.currentProductCompareData?.product,l?.availableCompareList.find(t=>t.handle===m)?.product].filter(Boolean);return l?.specificationKeys?r(D,{children:[e(C,{className:"text-base font-bold leading-[1.4]",children:n?.compare}),r(h,{overlayClassName:"z-[100]",className:"rounded-box bg-white [&_.dialog-close-icon]:laptop:size-6 laptop:p-0 laptop:w-[896px] z-[110] max-h-[80vh] max-w-[90vw] gap-0 overflow-hidden !py-0 [&_.dialog-close-button]:focus:!ring-0 [&_.dialog-close-icon]:size-4 [&_.dialog-close-icon]:text-[#6D6D6F]",children:[e(E,{className:"laptop:pt-4 laptop:pb-3 laptop:px-8 px-4 pb-2 pt-4",children:e(G,{className:"laptop:text-[24px] text-left text-[20px] font-bold",children:n?.compare})}),r("div",{className:"laptop:px-8 h-[calc(80vh-64px)] overflow-y-auto px-4",children:[r(c,{className:"laptop:py-3 grid-cols-3 items-center gap-[40px] py-4",children:[e(o,{span:1,children:e("div",{className:"text-[16px] font-bold text-[#595959]",children:n?.product||"Product"})}),e(o,{span:1,children:e(f,{as:"div",className:"rounded-btn flex h-[48px] w-full items-center border border-[#E8E8E8] px-4 text-[16px] font-bold",html:l.currentProductCompareData?.shortName||b.title})}),m&&e(o,{span:1,children:e(I,{className:"rounded-btn h-[48px] px-4",value:m,onChange:t=>{u(t)},list:l.options})})]}),r(c,{className:"laptop:gap-8 laptop:py-3 grid-cols-3 py-4",children:[e(o,{span:1}),d.map((t,p)=>e(o,{span:1,className:"flex items-center",children:e("img",{src:t.images[0].url,alt:t.title,className:"size-[100px]",role:"presentation"})},p))]}),r(c,{className:"laptop:py-6 grid-cols-3 items-center gap-[40px] border-b border-[#E8E8E8] py-4",children:[e(o,{span:1}),d.map((t,p)=>{const a=t.variants[0];return e(o,{span:1,className:"flex h-full",children:e("div",{className:"flex flex-col gap-[8px]",children:a.price.amount<9999999&&e("div",{className:"flex items-center gap-[8px]",children:r("div",{className:"flex items-center gap-[6px]",children:[e("span",{className:"text-[18px] font-bold",children:g({locale:x,amount:a?.coupons?.[0]?.variant_price4wscode||a.price.amount,currencyCode:a.price.currencyCode})}),Number(a?.coupons?.[0]?.variant_price4wscode)>0&&e("span",{className:"text-[18px] font-bold text-[#6D6D6F] line-through",children:g({locale:x,amount:a.price.amount,currencyCode:a.price.currencyCode})})]})})})},p)})]}),r(c,{className:"laptop:py-6 grid-cols-3 items-center gap-[40px] border-b border-[#E8E8E8] py-4",children:[e(o,{span:1,children:e("div",{className:"text-[16px] font-bold text-[#6D6D6F]",children:n?.color||"Color"})}),d.map((t,p)=>{const a=t.options?.find(s=>["color","colour","couleur"].find(i=>s.name.toLowerCase().includes(i)))?.values.map(s=>s.label);return e(o,{span:1,className:"flex h-full",children:a?.length&&e("div",{className:"flex items-center gap-4",children:a.map(s=>e(z,{label:s,className:"size-6"},s))})},p)})]}),e(c,{className:"laptop:gap-0 grid-cols-12 items-center gap-0 border-b border-[#E8E8E8]",children:l.specificationKeys?.map(t=>r(o,{span:12,className:"laptop:py-6 laptop:gap-4 grid grid-cols-3 items-center gap-[40px] border-b border-[#E8E8E8] py-4",children:[e("div",{className:"text-[16px] font-bold text-[#6D6D6F]",children:t}),d.map((p,a)=>{let i=p.metafields?.global?.specifications?.find(v=>v?.key===t)?.value||"";switch(i.trim().toLowerCase()){case"true":i="\u2714\uFE0F";break;case"false":i="\u274C";break;default:break}return e("div",{className:"flex items-center",children:e(f,{className:"text-[16px] font-bold text-[#1D1D1F]",html:i})},a)})]},t))})]})]})]}):null};var A=P;export{A as default};
1
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useEffect as N,useState as y}from"react";import{Dialog as D,DialogTrigger as C,DialogContent as h,DialogHeader as E,DialogTitle as G,Grid as c,GridItem as o,Text as f}from"../../../../../../components/index.js";import{useBizProductContext as w}from"../../../../BizProductProvider.js";import I from"./Select.js";import{useAiuiContext as k}from"../../../../../AiuiProvider/index.js";import{formatPrice as g}from"../../../../utils/index.js";import{ShopifyColorOption as P}from"./ShopifyColorOption.js";const z=()=>{const{locale:u="us",copyWriting:n}=k(),{compareData:p,product:b}=w(),[m,x]=y();N(()=>{x(p?.availableCompareList[0]?.handle)},[p?.availableCompareList]);const d=[p?.currentProductCompareData?.product,p?.availableCompareList.find(a=>a.handle===m)?.product].filter(Boolean);return p?.specificationKeys?r(D,{children:[e(C,{className:"text-base font-bold leading-[1.4]",children:n?.compare}),r(h,{overlayClassName:"z-[100]",className:"rounded-box bg-white [&_.dialog-close-icon]:laptop:size-6 laptop:p-0 laptop:w-[896px] z-[110] max-h-[80vh] max-w-[90vw] gap-0 overflow-hidden !py-0 [&_.dialog-close-button]:focus:!ring-0 [&_.dialog-close-icon]:size-4 [&_.dialog-close-icon]:text-[#6D6D6F]",children:[e(E,{className:"laptop:pt-4 laptop:pb-3 laptop:px-8 px-4 pb-2 pt-4",children:e(G,{className:"laptop:text-[24px] text-left text-[20px] font-bold",children:n?.compare})}),r("div",{className:"laptop:px-8 h-[calc(80vh-64px)] overflow-y-auto px-4",children:[r(c,{className:"laptop:py-3 grid-cols-3 items-center gap-[40px] py-4",children:[e(o,{span:1,children:e("div",{className:"text-[16px] font-bold text-[#595959]",children:n?.product||"Product"})}),e(o,{span:1,children:e(f,{as:"div",className:"rounded-btn flex h-[48px] w-full items-center border border-[#E8E8E8] px-4 text-[16px] font-bold",html:p.currentProductCompareData?.shortName||b.title})}),m&&e(o,{span:1,children:e(I,{className:"rounded-btn h-[48px] px-4",value:m,onChange:a=>{x(a)},list:p.options})})]}),r(c,{className:"laptop:gap-8 laptop:py-3 grid-cols-3 py-4",children:[e(o,{span:1}),d.map((a,s)=>e(o,{span:1,className:"flex items-center",children:e("img",{src:a.images[0].url,alt:a.title,className:"size-[100px]",role:"presentation"})},s))]}),r(c,{className:"laptop:py-6 grid-cols-3 items-center gap-[40px] border-b border-[#E8E8E8] py-4",children:[e(o,{span:1}),d.map((a,s)=>{const t=a.variants[0];return e(o,{span:1,className:"flex h-full",children:e("div",{className:"flex flex-col gap-[8px]",children:t.price.amount<9999999&&e("div",{className:"flex items-center gap-[8px]",children:r("div",{className:"flex items-center gap-[6px]",children:[e("span",{className:"text-[18px] font-bold",children:(t?.coupons?.[0]?.variant_price4wscode?t.coupons[0].formattedVariantPrice4wscode:t.price.formattedAmount)??g({locale:u,amount:t?.coupons?.[0]?.variant_price4wscode||t.price.amount,currencyCode:t.price.currencyCode})}),Number(t?.coupons?.[0]?.variant_price4wscode)>0&&e("span",{className:"text-[18px] font-bold text-[#6D6D6F] line-through",children:t.price.formattedAmount??g({locale:u,amount:t.price.amount,currencyCode:t.price.currencyCode})})]})})})},s)})]}),r(c,{className:"laptop:py-6 grid-cols-3 items-center gap-[40px] border-b border-[#E8E8E8] py-4",children:[e(o,{span:1,children:e("div",{className:"text-[16px] font-bold text-[#6D6D6F]",children:n?.color||"Color"})}),d.map((a,s)=>{const t=a.options?.find(l=>["color","colour","couleur"].find(i=>l.name.toLowerCase().includes(i)))?.values.map(l=>l.label);return e(o,{span:1,className:"flex h-full",children:t?.length&&e("div",{className:"flex items-center gap-4",children:t.map(l=>e(P,{label:l,className:"size-6"},l))})},s)})]}),e(c,{className:"laptop:gap-0 grid-cols-12 items-center gap-0 border-b border-[#E8E8E8]",children:p.specificationKeys?.map(a=>r(o,{span:12,className:"laptop:py-6 laptop:gap-4 grid grid-cols-3 items-center gap-[40px] border-b border-[#E8E8E8] py-4",children:[e("div",{className:"text-[16px] font-bold text-[#6D6D6F]",children:a}),d.map((s,t)=>{let i=s.metafields?.global?.specifications?.find(v=>v?.key===a)?.value||"";switch(i.trim().toLowerCase()){case"true":i="\u2714\uFE0F";break;case"false":i="\u274C";break;default:break}return e("div",{className:"flex items-center",children:e(f,{className:"text-[16px] font-bold text-[#1D1D1F]",html:i})},t)})]},a))})]})]})]}):null};var K=z;export{K as default};