@anker-in/headless-ui 1.1.28 → 1.1.30

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 (143) hide show
  1. package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.d.ts +6 -0
  2. package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js +2 -0
  3. package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js.map +7 -0
  4. package/dist/cjs/biz-components/BrandCardLink/index.d.ts +1 -0
  5. package/dist/cjs/biz-components/BrandCardLink/index.js +2 -0
  6. package/dist/cjs/biz-components/BrandCardLink/index.js.map +7 -0
  7. package/dist/cjs/biz-components/BrandCardLink/types.d.ts +19 -0
  8. package/dist/cjs/biz-components/BrandCardLink/types.js +2 -0
  9. package/dist/cjs/biz-components/BrandCardLink/types.js.map +7 -0
  10. package/dist/cjs/biz-components/Evaluate/index.js +1 -1
  11. package/dist/cjs/biz-components/Evaluate/index.js.map +2 -2
  12. package/dist/cjs/biz-components/Graphic/index.js +1 -1
  13. package/dist/cjs/biz-components/Graphic/index.js.map +2 -2
  14. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +25 -0
  15. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js +2 -0
  16. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js.map +7 -0
  17. package/dist/cjs/biz-components/HeaderNavigation/MobileMulticolMenu.d.ts +7 -0
  18. package/dist/cjs/biz-components/HeaderNavigation/MobileMulticolMenu.js +2 -0
  19. package/dist/cjs/biz-components/HeaderNavigation/MobileMulticolMenu.js.map +7 -0
  20. package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.d.ts +9 -0
  21. package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +2 -0
  22. package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js.map +7 -0
  23. package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.d.ts +9 -0
  24. package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.js +2 -0
  25. package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.js.map +7 -0
  26. package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.d.ts +7 -0
  27. package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.js +2 -0
  28. package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.js.map +7 -0
  29. package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.d.ts +15 -0
  30. package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.js +2 -0
  31. package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.js.map +7 -0
  32. package/dist/cjs/biz-components/HeaderNavigation/NavProvider.d.ts +2 -0
  33. package/dist/cjs/biz-components/HeaderNavigation/NavProvider.js +1 -1
  34. package/dist/cjs/biz-components/HeaderNavigation/NavProvider.js.map +3 -3
  35. package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.d.ts +20 -0
  36. package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.js +2 -0
  37. package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.js.map +7 -0
  38. package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.d.ts +9 -0
  39. package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +2 -0
  40. package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.js.map +7 -0
  41. package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.d.ts +18 -0
  42. package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js +2 -0
  43. package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js.map +7 -0
  44. package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.d.ts +9 -0
  45. package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.js +2 -0
  46. package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.js.map +7 -0
  47. package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
  48. package/dist/cjs/biz-components/HeaderNavigation/index.js.map +3 -3
  49. package/dist/cjs/biz-components/HeaderNavigation/types.d.ts +2 -1
  50. package/dist/cjs/biz-components/HeaderNavigation/types.js +1 -1
  51. package/dist/cjs/biz-components/HeaderNavigation/types.js.map +2 -2
  52. package/dist/cjs/biz-components/HeaderNavigation/withCategory.d.ts +1 -0
  53. package/dist/cjs/biz-components/HeaderNavigation/withCategory.js +1 -1
  54. package/dist/cjs/biz-components/HeaderNavigation/withCategory.js.map +3 -3
  55. package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
  56. package/dist/cjs/biz-components/HeroBanner/HeroBanner.js.map +3 -3
  57. package/dist/cjs/biz-components/HeroBanner/types.d.ts +4 -0
  58. package/dist/cjs/biz-components/HeroBanner/types.js +1 -1
  59. package/dist/cjs/biz-components/HeroBanner/types.js.map +1 -1
  60. package/dist/cjs/biz-components/ImageTextFeature/types.d.ts +1 -0
  61. package/dist/cjs/biz-components/ImageTextFeature/types.js +1 -1
  62. package/dist/cjs/biz-components/ImageTextFeature/types.js.map +1 -1
  63. package/dist/cjs/biz-components/SearchPage/index.js +1 -1
  64. package/dist/cjs/biz-components/SearchPage/index.js.map +2 -2
  65. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +4 -4
  66. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
  67. package/dist/cjs/biz-components/Tabs/Tabs.js +1 -1
  68. package/dist/cjs/biz-components/Tabs/Tabs.js.map +3 -3
  69. package/dist/cjs/biz-components/Tabs/types.d.ts +9 -0
  70. package/dist/cjs/biz-components/Tabs/types.js +1 -1
  71. package/dist/cjs/biz-components/Tabs/types.js.map +1 -1
  72. package/dist/cjs/biz-components/index.d.ts +2 -0
  73. package/dist/cjs/biz-components/index.js +1 -1
  74. package/dist/cjs/biz-components/index.js.map +3 -3
  75. package/dist/esm/biz-components/BrandCardLink/BrandCardLink.d.ts +6 -0
  76. package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js +2 -0
  77. package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js.map +7 -0
  78. package/dist/esm/biz-components/BrandCardLink/index.d.ts +1 -0
  79. package/dist/esm/biz-components/BrandCardLink/index.js +2 -0
  80. package/dist/esm/biz-components/BrandCardLink/index.js.map +7 -0
  81. package/dist/esm/biz-components/BrandCardLink/types.d.ts +19 -0
  82. package/dist/esm/biz-components/BrandCardLink/types.js +1 -0
  83. package/dist/esm/biz-components/BrandCardLink/types.js.map +7 -0
  84. package/dist/esm/biz-components/Evaluate/index.js +1 -1
  85. package/dist/esm/biz-components/Evaluate/index.js.map +2 -2
  86. package/dist/esm/biz-components/Graphic/index.js +1 -1
  87. package/dist/esm/biz-components/Graphic/index.js.map +2 -2
  88. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +25 -0
  89. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js +2 -0
  90. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js.map +7 -0
  91. package/dist/esm/biz-components/HeaderNavigation/MobileMulticolMenu.d.ts +7 -0
  92. package/dist/esm/biz-components/HeaderNavigation/MobileMulticolMenu.js +2 -0
  93. package/dist/esm/biz-components/HeaderNavigation/MobileMulticolMenu.js.map +7 -0
  94. package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.d.ts +9 -0
  95. package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +2 -0
  96. package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js.map +7 -0
  97. package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.d.ts +9 -0
  98. package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.js +2 -0
  99. package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.js.map +7 -0
  100. package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.d.ts +7 -0
  101. package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.js +2 -0
  102. package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.js.map +7 -0
  103. package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.d.ts +15 -0
  104. package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.js +2 -0
  105. package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.js.map +7 -0
  106. package/dist/esm/biz-components/HeaderNavigation/NavProvider.d.ts +2 -0
  107. package/dist/esm/biz-components/HeaderNavigation/NavProvider.js +1 -1
  108. package/dist/esm/biz-components/HeaderNavigation/NavProvider.js.map +3 -3
  109. package/dist/esm/biz-components/HeaderNavigation/ResourceItem.d.ts +20 -0
  110. package/dist/esm/biz-components/HeaderNavigation/ResourceItem.js +2 -0
  111. package/dist/esm/biz-components/HeaderNavigation/ResourceItem.js.map +7 -0
  112. package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.d.ts +9 -0
  113. package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +2 -0
  114. package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.js.map +7 -0
  115. package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.d.ts +18 -0
  116. package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js +2 -0
  117. package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js.map +7 -0
  118. package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.d.ts +9 -0
  119. package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.js +2 -0
  120. package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.js.map +7 -0
  121. package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
  122. package/dist/esm/biz-components/HeaderNavigation/index.js.map +3 -3
  123. package/dist/esm/biz-components/HeaderNavigation/types.d.ts +2 -1
  124. package/dist/esm/biz-components/HeaderNavigation/types.js +1 -1
  125. package/dist/esm/biz-components/HeaderNavigation/types.js.map +2 -2
  126. package/dist/esm/biz-components/HeaderNavigation/withCategory.d.ts +1 -0
  127. package/dist/esm/biz-components/HeaderNavigation/withCategory.js +1 -1
  128. package/dist/esm/biz-components/HeaderNavigation/withCategory.js.map +3 -3
  129. package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
  130. package/dist/esm/biz-components/HeroBanner/HeroBanner.js.map +3 -3
  131. package/dist/esm/biz-components/HeroBanner/types.d.ts +4 -0
  132. package/dist/esm/biz-components/ImageTextFeature/types.d.ts +1 -0
  133. package/dist/esm/biz-components/SearchPage/index.js +1 -1
  134. package/dist/esm/biz-components/SearchPage/index.js.map +2 -2
  135. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +5 -5
  136. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
  137. package/dist/esm/biz-components/Tabs/Tabs.js +1 -1
  138. package/dist/esm/biz-components/Tabs/Tabs.js.map +3 -3
  139. package/dist/esm/biz-components/Tabs/types.d.ts +9 -0
  140. package/dist/esm/biz-components/index.d.ts +2 -0
  141. package/dist/esm/biz-components/index.js +1 -1
  142. package/dist/esm/biz-components/index.js.map +2 -2
  143. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as e,jsxs as p}from"react/jsx-runtime";import F,{useImperativeHandle as ee,useRef as b,useState as te,useEffect as ae}from"react";import f from"gsap";import{ScrollTrigger as h}from"gsap/dist/ScrollTrigger";import{useMediaQuery as q}from"react-responsive";import{useInView as re}from"react-intersection-observer";import oe from"../../helpers/ScrollLoadVideo.js";import{Button as H,Heading as V,Picture as A,Text as le}from"../../components/index.js";import se from"./Countdown.js";import{cn as n}from"../../helpers/index.js";import{withLayout as ne}from"../../shared/Styles.js";import{useExposure as pe}from"../../hooks/useExposure.js";import{trackUrlRef as I}from"../../shared/trackUrlRef.js";import{sizeMap as ie}from"../../components/button.js";import{VideoModal as ce}from"../VideoModal/index.js";const o="image",l="hero_banner",de=({size:v="base"})=>{const{width:y,height:w}=ie[v];return e("svg",{width:y,height:w,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:e("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"})})},Q=F.forwardRef(({data:v,className:y},w)=>{const{label:R,title:t,subtitle:a,endDate:P,endDate_tz:Z,dateFormat:G,pcImage:k,padImage:M,mobileImage:x,pcVideo:J,padVideo:K,mobileVideo:C,isShowVideo:O,primaryButton:d,secondaryButton:r,theme:W="light",size:$="default",caption:N=[],blockLink:L,iconArray:X}=v,D=q({query:"(max-width: 768px)"}),S=q({query:"(max-width: 1024px)"}),[E,U]=te(!1),{ref:Y,inView:_}=re(),T=b(null),B=b(null),z=b(null),u=b(null),s=b(null);return pe(s,{componentType:o,componentName:l,componentTitle:t,componentDescription:a}),ee(w,()=>s.current),ae(()=>{f.registerPlugin(h);function i(){if(!u.current)return;const c=s.current?.clientHeight||100;window.innerHeight<=c?T.current=h.create({trigger:s.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:m=>{const g=m.progress*40-20;f.set(u.current,{yPercent:g})}}):(z.current=h.create({trigger:s.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:m=>{const g=m.progress*20-20;f.set(u.current,{yPercent:g})}}),B.current=h.create({trigger:s.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:m=>{const g=m.progress*20;f.set(u.current,{yPercent:g})}}))}return _&&i(),()=>{T.current&&T.current.kill(),z.current&&z.current.kill(),B.current&&B.current.kill()}},[_]),e("div",{ref:Y,"data-ui-component-id":"HeroBanner",children:p("div",{ref:s,className:n(W==="dark"?"aiui-dark":""," tablet:aspect-[768/660] text-info-primary relative aspect-[390/660] w-full overflow-hidden",{"lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520]":$==="default","lg-desktop:aspect-[1920/720] desktop:aspect-[1440/576] laptop:aspect-[1024/432]":$==="sm"},y),children:[L&&e("a",{className:"absolute inset-0 z-10",href:I(L,`${o}_${l}`),"data-headless-type-name":`${o}#${l}`,"data-headless-title-desc-button":`${t}#${a}`,tabIndex:-1,"aria-hidden":"true","aria-label":t}),e("div",{ref:u,className:n("absolute left-0 top-0 size-full"),children:O?e(oe,{poster:D?x?.url:S?M?.url||x?.url:k?.url,src:D?C?.url:S?K?.url||C?.url:J?.url,className:"laptop:w-full h-full",videoClassName:"h-full object-cover",muted:!0,loop:!0,playsInline:!0}):e(A,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:k?.alt||"",source:`${k?.url||""} , ${M?.url??(x?.url||"")} 1024, ${x?.url||""} 767`})}),p("div",{className:"hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] lg-desktop:gap-[32px] absolute top-24 z-10 flex flex-col gap-[24px] px-[16px]",children:[p("div",{className:"laptop:text-left hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",children:[R&&e(V,{as:"h3",className:n("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:R}),t&&e(V,{as:"h2",size:$==="sm"?4:5,className:n("hero-banner-title"),html:t}),a&&e(V,{as:"h3",className:n("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm"),html:a}),P&&e("div",{className:"mt-3",children:e(se,{endDate:P,endDate_tz:Z,dateFormat:G})})]}),p("div",{className:"hero-banner-button-group laptop:justify-start lg-desktop:gap-3 flex items-center gap-2",children:[r?.isShowPlayVideoButton&&r?.playVideoButtonText?p(H,{onClick:()=>U(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button","data-headless-type-name":`${o}#${l}`,"data-headless-title-desc-button":`${t}#${a}#${r?.playVideoButtonText}`,children:[r?.playVideoButtonText," ",e(de,{size:"lg"})]}):r?.text?p(H,{"aria-label":t??a,size:"lg",variant:"secondary",className:"hero-banner-secondary-button",as:"a",href:I(r?.link,`${o}_${l}`),"data-headless-type-name":`${o}#${l}`,"data-headless-title-desc-button":`${t}#${a}#${r?.text}`,children:[r?.text,e("span",{className:"sr-only",children:t??a})]}):null,d&&d.text&&e(H,{"aria-label":t??a,size:"lg",variant:"primary",className:"hero-banner-primary-button",as:"a",href:I(d.link,`${o}_${l}`),"data-headless-type-name":`${o}#${l}`,"data-headless-title-desc-button":`${t}#${a}#${d?.text}`,children:d.text})]}),e("div",{className:"hero-banner-icon-group flex items-center gap-2",children:X?.map((i,c)=>e("div",{className:"h-12",children:e(A,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",alt:i?.pcImage?.alt||"",source:i?.pcImage?.url})},c))})]}),N.length>0&&e("div",{className:"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]",children:N.map((i,c)=>p(F.Fragment,{children:[e(le,{size:2,className:n("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:i.title}),c<N.length-1&&e("div",{className:n("bg-info-primary w-px")})]},c))}),E&&e(ce,{visible:E,videoUrl:r?.videoUrl?.url,youTubeId:r?.youtubeId,onCloseModal:()=>U(!1)})]})})});Q.displayName="HeroBanner";var ze=ne(Q);export{ze as default};
1
+ "use client";import{jsx as e,jsxs as c}from"react/jsx-runtime";import F,{useImperativeHandle as ae,useRef as x,useState as oe,useEffect as re}from"react";import h from"gsap";import{ScrollTrigger as y}from"gsap/dist/ScrollTrigger";import{useMediaQuery as q}from"react-responsive";import{useInView as le}from"react-intersection-observer";import se from"../../helpers/ScrollLoadVideo.js";import{Button as H,Heading as C,Picture as A,Text as ne}from"../../components/index.js";import ie from"./Countdown.js";import{cn as p}from"../../helpers/index.js";import{withLayout as pe}from"../../shared/Styles.js";import{useExposure as ce}from"../../hooks/useExposure.js";import{trackUrlRef as V}from"../../shared/trackUrlRef.js";import{sizeMap as ue}from"../../components/button.js";import{VideoModal as me}from"../VideoModal/index.js";const l="image",s="hero_banner",de=({size:m="base"})=>{const{width:v,height:w}=ue[m];return e("svg",{width:v,height:w,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:e("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"})})},Q=F.forwardRef(({data:m,className:v,onSecondaryClick:w,onPrimaryClick:Z},G)=>{const{label:I,title:a,subtitle:o,endDate:P,endDate_tz:J,dateFormat:K,pcImage:k,padImage:R,mobileImage:f,pcVideo:O,padVideo:W,mobileVideo:M,isShowVideo:X,primaryButton:n,secondaryButton:t,theme:Y="light",size:$="default",caption:N=[],blockLink:S,iconArray:ee}=m,L=q({query:"(max-width: 768px)"}),D=q({query:"(max-width: 1024px)"}),[E,U]=oe(!1),{ref:te,inView:_}=le(),B=x(null),T=x(null),z=x(null),d=x(null),i=x(null);return ce(i,{componentType:l,componentName:s,componentTitle:a,componentDescription:o}),ae(G,()=>i.current),re(()=>{h.registerPlugin(y);function r(){if(!d.current)return;const u=i.current?.clientHeight||100;window.innerHeight<=u?B.current=y.create({trigger:i.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:g=>{const b=g.progress*40-20;h.set(d.current,{yPercent:b})}}):(z.current=y.create({trigger:i.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:g=>{const b=g.progress*20-20;h.set(d.current,{yPercent:b})}}),T.current=y.create({trigger:i.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:g=>{const b=g.progress*20;h.set(d.current,{yPercent:b})}}))}return _&&r(),()=>{B.current&&B.current.kill(),z.current&&z.current.kill(),T.current&&T.current.kill()}},[_]),e("div",{ref:te,"data-ui-component-id":"HeroBanner",children:c("div",{ref:i,className:p(Y==="dark"?"aiui-dark":""," tablet:aspect-[768/660] text-info-primary relative aspect-[390/660] w-full overflow-hidden",{"lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520]":$==="default","lg-desktop:aspect-[1920/720] desktop:aspect-[1440/576] laptop:aspect-[1024/432]":$==="sm"},v),children:[S&&e("a",{className:"absolute inset-0 z-10",href:V(S,`${l}_${s}`),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${a}#${o}`,tabIndex:-1,"aria-hidden":"true","aria-label":a}),e("div",{ref:d,className:p("absolute left-0 top-0 size-full"),children:X?e(se,{poster:L?f?.url:D?R?.url||f?.url:k?.url,src:L?M?.url:D?W?.url||M?.url:O?.url,className:"laptop:w-full h-full",videoClassName:"h-full object-cover",muted:!0,loop:!0,playsInline:!0}):e(A,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:k?.alt||"",source:`${k?.url||""} , ${R?.url??(f?.url||"")} 1024, ${f?.url||""} 767`})}),c("div",{className:"hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] lg-desktop:gap-[32px] absolute top-24 z-10 flex flex-col gap-[24px] px-[16px]",children:[c("div",{className:"laptop:text-left hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",children:[I&&e(C,{as:"h3",className:p("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:I}),a&&e(C,{as:"h2",size:$==="sm"?4:5,className:p("hero-banner-title"),html:a}),o&&e(C,{as:"h3",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"),html:o}),P&&e("div",{className:"mt-3",children:e(ie,{endDate:P,endDate_tz:J,dateFormat:K})})]}),c("div",{className:"hero-banner-button-group laptop:justify-start lg-desktop:gap-3 flex items-center gap-2",children:[t?.isShowPlayVideoButton&&t?.playVideoButtonText?c(H,{onClick:()=>U(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button","data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${a}#${o}#${t?.playVideoButtonText}`,children:[t?.playVideoButtonText," ",e(de,{size:"lg"})]}):t?.text?c(H,{"aria-label":a??o,size:"lg",variant:"secondary",className:"hero-banner-secondary-button",as:t?.isCustomSecondaryButton?"button":"a",href:V(t?.link,`${l}_${s}`),onClick:r=>t?.isCustomSecondaryButton&&w?.(m,r),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${a}#${o}#${t?.text}`,children:[t?.text,e("span",{className:"sr-only",children:a??o})]}):null,n&&n.text&&e(H,{"aria-label":a??o,size:"lg",variant:"primary",className:"hero-banner-primary-button",as:n?.isCustomPrimaryButton?"button":"a",href:V(n.link,`${l}_${s}`),onClick:r=>n?.isCustomPrimaryButton&&Z?.(m,r),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${a}#${o}#${n?.text}`,children:n.text})]}),e("div",{className:"hero-banner-icon-group flex items-center gap-2",children:ee?.map((r,u)=>e("div",{className:"h-12",children:e(A,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",alt:r?.pcImage?.alt||"",source:r?.pcImage?.url})},u))})]}),N.length>0&&e("div",{className:"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]",children:N.map((r,u)=>c(F.Fragment,{children:[e(ne,{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:r.title}),u<N.length-1&&e("div",{className:p("bg-info-primary w-px")})]},u))}),E&&e(me,{visible:E,videoUrl:t?.videoUrl?.url,youTubeId:t?.youtubeId,onCloseModal:()=>U(!1)})]})})});Q.displayName="HeroBanner";var Ce=pe(Q);export{Ce as default};
2
2
  //# sourceMappingURL=HeroBanner.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/HeroBanner/HeroBanner.tsx"],
4
- "sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef, useState, useEffect } from 'react'\nimport gsap from 'gsap'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport type { HeroBannerProps } from './types.js'\nimport { useMediaQuery } from 'react-responsive'\nimport { useInView } from 'react-intersection-observer'\nimport ScrollLoadVideo from '../../helpers/ScrollLoadVideo.js'\nimport { Button, Heading, Picture, Text } from '../../components/index.js'\nimport Countdown from './Countdown.js'\nimport { cn } from '../../helpers/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { sizeMap } from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\n\nconst componentType = 'image'\nconst componentName = 'hero_banner'\n\nconst PlayButtonAppendIcon = ({ size = 'base' }: { size: 'base' | 'lg' | 'sm' }) => {\n const { width, height } = sizeMap[size]\n return (\n <svg width={width} height={height} viewBox=\"0 0 20 20\" fill=\"currentcolor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n 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\"\n fill=\"currentcolor\"\n />\n </svg>\n )\n}\n\nconst HeroBanner = React.forwardRef<HTMLDivElement, HeroBannerProps>(({ data, className }, ref) => {\n const {\n label,\n title,\n subtitle,\n endDate,\n endDate_tz,\n dateFormat,\n pcImage,\n padImage,\n mobileImage,\n pcVideo,\n padVideo,\n mobileVideo,\n isShowVideo,\n primaryButton,\n secondaryButton,\n theme = 'light',\n size = 'default',\n caption = [],\n blockLink,\n iconArray,\n } = data\n\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const isPad = useMediaQuery({ query: '(max-width: 1024px)' })\n const [visible, setVisible] = useState<boolean>(false)\n const { ref: inViewRef, inView } = useInView()\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n const bgTriggerRef = useRef<ScrollTrigger | null>(null)\n const boxTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const bgRef = useRef<HTMLImageElement>(null)\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subtitle,\n })\n\n useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n useEffect(() => {\n gsap.registerPlugin(ScrollTrigger)\n function gsapResize() {\n if (!bgRef.current) return\n const clientHeight = boxRef.current?.clientHeight || 100\n const screenHeight = window.innerHeight\n\n if (screenHeight <= clientHeight) {\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 40\n const value = self.progress * base - base / 2\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n } else {\n boxTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom bottom',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base - base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n bgTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top top',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n }\n }\n if (inView) gsapResize()\n return () => {\n // ScrollTrigger.getAll().forEach((t: any) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n boxTriggerRef.current && boxTriggerRef.current.kill()\n bgTriggerRef.current && bgTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n <div ref={inViewRef} data-ui-component-id=\"HeroBanner\">\n <div\n ref={boxRef}\n className={cn(\n theme === 'dark' ? 'aiui-dark' : '',\n ' tablet:aspect-[768/660] text-info-primary relative aspect-[390/660] w-full overflow-hidden',\n {\n 'lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520]': size === 'default',\n 'lg-desktop:aspect-[1920/720] desktop:aspect-[1440/576] laptop:aspect-[1024/432]': size === 'sm',\n },\n className\n )}\n >\n {blockLink && (\n <a\n className=\"absolute inset-0 z-10\"\n href={trackUrlRef(blockLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}`}\n tabIndex={-1}\n aria-hidden=\"true\"\n aria-label={title}\n ></a>\n )}\n <div ref={bgRef} className={cn('absolute left-0 top-0 size-full')}>\n {isShowVideo ? (\n <ScrollLoadVideo\n poster={isMobile ? mobileImage?.url : isPad ? padImage?.url || mobileImage?.url : pcImage?.url}\n src={\n isMobile\n ? (mobileVideo?.url as string)\n : isPad\n ? (padVideo?.url as string) || (mobileVideo?.url as string)\n : (pcVideo?.url as string)\n }\n className=\"laptop:w-full h-full\"\n videoClassName=\"h-full object-cover\"\n muted\n loop\n playsInline\n />\n ) : (\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n fetchPriority=\"high\"\n alt={pcImage?.alt || ''}\n source={`${pcImage?.url || ''} , ${padImage?.url ?? (mobileImage?.url || '')} 1024, ${mobileImage?.url || ''} 767`}\n />\n )}\n </div>\n\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] lg-desktop:gap-[32px] absolute top-24 z-10 flex flex-col gap-[24px] px-[16px]\">\n <div className=\"laptop:text-left hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]\">\n {label && (\n <Heading\n as=\"h3\"\n className={cn('hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm')}\n html={label}\n />\n )}\n {title && <Heading as=\"h2\" size={size === 'sm' ? 4 : 5} className={cn('hero-banner-title')} html={title} />}\n {subtitle && (\n <Heading\n as=\"h3\"\n className={cn(\n 'hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm'\n )}\n html={subtitle}\n />\n )}\n {endDate && (\n <div className=\"mt-3\">\n <Countdown endDate={endDate} endDate_tz={endDate_tz} dateFormat={dateFormat} />\n </div>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"hero-banner-button-group laptop:justify-start lg-desktop:gap-3 flex items-center gap-2\">\n {secondaryButton?.isShowPlayVideoButton && secondaryButton?.playVideoButtonText ? (\n <Button\n onClick={() => setVisible(true)}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-play-video-button\"\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.playVideoButtonText}`}\n >\n {secondaryButton?.playVideoButtonText} <PlayButtonAppendIcon size=\"lg\" />\n </Button>\n ) : secondaryButton?.text ? (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-secondary-button\"\n as=\"a\"\n href={trackUrlRef(secondaryButton?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.text}`}\n >\n {secondaryButton?.text}\n <span className=\"sr-only\">{title ?? subtitle}</span>\n </Button>\n ) : null}\n {primaryButton && primaryButton.text && (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"primary\"\n className=\"hero-banner-primary-button\"\n as=\"a\"\n href={trackUrlRef(primaryButton.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${primaryButton?.text}`}\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n <div className=\"hero-banner-icon-group flex items-center gap-2\">\n {iconArray?.map((icon, index) => (\n <div key={index} className=\"h-12\">\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n alt={icon?.pcImage?.alt || ''}\n source={icon?.pcImage?.url}\n />\n </div>\n ))}\n </div>\n </div>\n\n {/* \u5E95\u90E8\u4EA7\u54C1\u5217\u8868 */}\n {caption.length > 0 && (\n <div className=\"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]\">\n {caption.map((c, index) => (\n <React.Fragment key={index}>\n <Text\n size={2}\n className={cn(\n 'hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]'\n )}\n html={c.title}\n />\n {index < caption.length - 1 && <div className={cn('bg-info-primary w-px')} />}\n </React.Fragment>\n ))}\n </div>\n )}\n\n {/* \u89C6\u9891\u5F39\u7A97 */}\n {visible && (\n <VideoModal\n visible={visible}\n videoUrl={secondaryButton?.videoUrl?.url}\n youTubeId={secondaryButton?.youtubeId}\n onCloseModal={() => setVisible(false)}\n />\n )}\n </div>\n </div>\n )\n})\n\nHeroBanner.displayName = 'HeroBanner'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UACR,UAAU,6BACV,GAAG,IACH,KAAMf,EAAY0B,EAAc,KAAM,GAAGvB,CAAa,IAAIC,CAAa,EAAE,EACzE,0BAAyB,GAAGD,CAAa,IAAIC,CAAa,GAC1D,kCAAiC,GAAGU,CAAK,IAAIC,CAAQ,IAAIW,GAAe,IAAI,GAE3E,SAAAA,EAAc,KACjB,GAEJ,EACA9C,EAAC,OAAI,UAAU,iDACZ,SAAAmD,GAAW,IAAI,CAACgB,EAAMC,IACrBpE,EAAC,OAAgB,UAAU,OACzB,SAAAA,EAACc,EAAA,CACC,UAAU,uBACV,aAAa,sBACb,QAAQ,QACR,IAAKqD,GAAM,SAAS,KAAO,GAC3B,OAAQA,GAAM,SAAS,IACzB,GAPQC,CAQV,CACD,EACH,GACF,EAGCnB,EAAQ,OAAS,GAChBjD,EAAC,OAAI,UAAU,iMACZ,SAAAiD,EAAQ,IAAI,CAACoB,EAAGD,IACfnE,EAACC,EAAM,SAAN,CACC,UAAAF,EAACe,GAAA,CACC,KAAM,EACN,UAAWE,EACT,yIACF,EACA,KAAMoD,EAAE,MACV,EACCD,EAAQnB,EAAQ,OAAS,GAAKjD,EAAC,OAAI,UAAWiB,EAAG,sBAAsB,EAAG,IARxDmD,CASrB,CACD,EACH,EAIDd,GACCtD,EAACsB,GAAA,CACC,QAASgC,EACT,SAAUP,GAAiB,UAAU,IACrC,UAAWA,GAAiB,UAC5B,aAAc,IAAMQ,EAAW,EAAK,EACtC,GAEJ,EACF,CAEJ,CAAC,EAED1B,EAAW,YAAc,aAEzB,IAAOyC,GAAQpD,GAAWW,CAAU",
6
- "names": ["jsx", "jsxs", "React", "useImperativeHandle", "useRef", "useState", "useEffect", "gsap", "ScrollTrigger", "useMediaQuery", "useInView", "ScrollLoadVideo", "Button", "Heading", "Picture", "Text", "Countdown", "cn", "withLayout", "useExposure", "trackUrlRef", "sizeMap", "VideoModal", "componentType", "componentName", "PlayButtonAppendIcon", "size", "width", "height", "HeroBanner", "data", "className", "ref", "label", "title", "subtitle", "endDate", "endDate_tz", "dateFormat", "pcImage", "padImage", "mobileImage", "pcVideo", "padVideo", "mobileVideo", "isShowVideo", "primaryButton", "secondaryButton", "theme", "caption", "blockLink", "iconArray", "isMobile", "isPad", "visible", "setVisible", "inViewRef", "inView", "scrollTriggerRef", "bgTriggerRef", "boxTriggerRef", "bgRef", "boxRef", "gsapResize", "clientHeight", "self", "value", "icon", "index", "c", "HeroBanner_default"]
4
+ "sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef, useState, useEffect } from 'react'\nimport gsap from 'gsap'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport type { HeroBannerProps } from './types.js'\nimport { useMediaQuery } from 'react-responsive'\nimport { useInView } from 'react-intersection-observer'\nimport ScrollLoadVideo from '../../helpers/ScrollLoadVideo.js'\nimport { Button, Heading, Picture, Text } from '../../components/index.js'\nimport Countdown from './Countdown.js'\nimport { cn } from '../../helpers/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { sizeMap } from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\n\nconst componentType = 'image'\nconst componentName = 'hero_banner'\n\nconst PlayButtonAppendIcon = ({ size = 'base' }: { size: 'base' | 'lg' | 'sm' }) => {\n const { width, height } = sizeMap[size]\n return (\n <svg width={width} height={height} viewBox=\"0 0 20 20\" fill=\"currentcolor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n 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\"\n fill=\"currentcolor\"\n />\n </svg>\n )\n}\n\nconst HeroBanner = React.forwardRef<HTMLDivElement, HeroBannerProps>(\n ({ data, className, onSecondaryClick, onPrimaryClick }, ref) => {\n const {\n label,\n title,\n subtitle,\n endDate,\n endDate_tz,\n dateFormat,\n pcImage,\n padImage,\n mobileImage,\n pcVideo,\n padVideo,\n mobileVideo,\n isShowVideo,\n primaryButton,\n secondaryButton,\n theme = 'light',\n size = 'default',\n caption = [],\n blockLink,\n iconArray,\n } = data\n\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const isPad = useMediaQuery({ query: '(max-width: 1024px)' })\n const [visible, setVisible] = useState<boolean>(false)\n const { ref: inViewRef, inView } = useInView()\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n const bgTriggerRef = useRef<ScrollTrigger | null>(null)\n const boxTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const bgRef = useRef<HTMLImageElement>(null)\n const boxRef = useRef<HTMLDivElement>(null)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subtitle,\n })\n\n useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n useEffect(() => {\n gsap.registerPlugin(ScrollTrigger)\n function gsapResize() {\n if (!bgRef.current) return\n const clientHeight = boxRef.current?.clientHeight || 100\n const screenHeight = window.innerHeight\n\n if (screenHeight <= clientHeight) {\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 40\n const value = self.progress * base - base / 2\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n } else {\n boxTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top bottom',\n end: 'bottom bottom',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base - base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n bgTriggerRef.current = ScrollTrigger.create({\n trigger: boxRef.current,\n start: 'top top',\n end: 'bottom top',\n scrub: true,\n onUpdate: (self: any) => {\n const base = 20\n const value = self.progress * base\n gsap.set(bgRef.current, { yPercent: value })\n },\n })\n }\n }\n if (inView) gsapResize()\n return () => {\n // ScrollTrigger.getAll().forEach((t: any) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n boxTriggerRef.current && boxTriggerRef.current.kill()\n bgTriggerRef.current && bgTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n <div ref={inViewRef} data-ui-component-id=\"HeroBanner\">\n <div\n ref={boxRef}\n className={cn(\n theme === 'dark' ? 'aiui-dark' : '',\n ' tablet:aspect-[768/660] text-info-primary relative aspect-[390/660] w-full overflow-hidden',\n {\n 'lg-desktop:aspect-[1920/930] desktop:aspect-[1440/700] laptop:aspect-[1024/520]': size === 'default',\n 'lg-desktop:aspect-[1920/720] desktop:aspect-[1440/576] laptop:aspect-[1024/432]': size === 'sm',\n },\n className\n )}\n >\n {blockLink && (\n <a\n className=\"absolute inset-0 z-10\"\n href={trackUrlRef(blockLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}`}\n tabIndex={-1}\n aria-hidden=\"true\"\n aria-label={title}\n ></a>\n )}\n <div ref={bgRef} className={cn('absolute left-0 top-0 size-full')}>\n {isShowVideo ? (\n <ScrollLoadVideo\n poster={isMobile ? mobileImage?.url : isPad ? padImage?.url || mobileImage?.url : pcImage?.url}\n src={\n isMobile\n ? (mobileVideo?.url as string)\n : isPad\n ? (padVideo?.url as string) || (mobileVideo?.url as string)\n : (pcVideo?.url as string)\n }\n className=\"laptop:w-full h-full\"\n videoClassName=\"h-full object-cover\"\n muted\n loop\n playsInline\n />\n ) : (\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n fetchPriority=\"high\"\n alt={pcImage?.alt || ''}\n source={`${pcImage?.url || ''} , ${padImage?.url ?? (mobileImage?.url || '')} 1024, ${mobileImage?.url || ''} 767`}\n />\n )}\n </div>\n\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"hero-banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] lg-desktop:gap-[32px] absolute top-24 z-10 flex flex-col gap-[24px] px-[16px]\">\n <div className=\"laptop:text-left hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]\">\n {label && (\n <Heading\n as=\"h3\"\n className={cn('hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm')}\n html={label}\n />\n )}\n {title && (\n <Heading as=\"h2\" size={size === 'sm' ? 4 : 5} className={cn('hero-banner-title')} html={title} />\n )}\n {subtitle && (\n <Heading\n as=\"h3\"\n className={cn(\n 'hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm'\n )}\n html={subtitle}\n />\n )}\n {endDate && (\n <div className=\"mt-3\">\n <Countdown endDate={endDate} endDate_tz={endDate_tz} dateFormat={dateFormat} />\n </div>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"hero-banner-button-group laptop:justify-start lg-desktop:gap-3 flex items-center gap-2\">\n {secondaryButton?.isShowPlayVideoButton && secondaryButton?.playVideoButtonText ? (\n <Button\n onClick={() => setVisible(true)}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-play-video-button\"\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.playVideoButtonText}`}\n >\n {secondaryButton?.playVideoButtonText} <PlayButtonAppendIcon size=\"lg\" />\n </Button>\n ) : secondaryButton?.text ? (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"secondary\"\n className=\"hero-banner-secondary-button\"\n as={secondaryButton?.isCustomSecondaryButton ? 'button' : 'a'}\n href={trackUrlRef(secondaryButton?.link, `${componentType}_${componentName}`)}\n onClick={e => secondaryButton?.isCustomSecondaryButton && onSecondaryClick?.(data, e)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${secondaryButton?.text}`}\n >\n {secondaryButton?.text}\n <span className=\"sr-only\">{title ?? subtitle}</span>\n </Button>\n ) : null}\n {primaryButton && primaryButton.text && (\n <Button\n aria-label={title ?? subtitle}\n size=\"lg\"\n variant=\"primary\"\n className=\"hero-banner-primary-button\"\n as={primaryButton?.isCustomPrimaryButton ? 'button' : 'a'}\n href={trackUrlRef(primaryButton.link, `${componentType}_${componentName}`)}\n onClick={e => primaryButton?.isCustomPrimaryButton && onPrimaryClick?.(data, e)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${subtitle}#${primaryButton?.text}`}\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n <div className=\"hero-banner-icon-group flex items-center gap-2\">\n {iconArray?.map((icon, index) => (\n <div key={index} className=\"h-12\">\n <Picture\n className=\"laptop:w-full h-full\"\n imgClassName=\"h-full object-cover\"\n loading=\"eager\"\n alt={icon?.pcImage?.alt || ''}\n source={icon?.pcImage?.url}\n />\n </div>\n ))}\n </div>\n </div>\n\n {/* \u5E95\u90E8\u4EA7\u54C1\u5217\u8868 */}\n {caption.length > 0 && (\n <div className=\"hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]\">\n {caption.map((c, index) => (\n <React.Fragment key={index}>\n <Text\n size={2}\n className={cn(\n 'hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]'\n )}\n html={c.title}\n />\n {index < caption.length - 1 && <div className={cn('bg-info-primary w-px')} />}\n </React.Fragment>\n ))}\n </div>\n )}\n\n {/* \u89C6\u9891\u5F39\u7A97 */}\n {visible && (\n <VideoModal\n visible={visible}\n videoUrl={secondaryButton?.videoUrl?.url}\n youTubeId={secondaryButton?.youtubeId}\n onCloseMod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EzB,IAAO4C,GAAQvD,GAAWW,CAAU",
6
+ "names": ["jsx", "jsxs", "React", "useImperativeHandle", "useRef", "useState", "useEffect", "gsap", "ScrollTrigger", "useMediaQuery", "useInView", "ScrollLoadVideo", "Button", "Heading", "Picture", "Text", "Countdown", "cn", "withLayout", "useExposure", "trackUrlRef", "sizeMap", "VideoModal", "componentType", "componentName", "PlayButtonAppendIcon", "size", "width", "height", "HeroBanner", "data", "className", "onSecondaryClick", "onPrimaryClick", "ref", "label", "title", "subtitle", "endDate", "endDate_tz", "dateFormat", "pcImage", "padImage", "mobileImage", "pcVideo", "padVideo", "mobileVideo", "isShowVideo", "primaryButton", "secondaryButton", "theme", "caption", "blockLink", "iconArray", "isMobile", "isPad", "visible", "setVisible", "inViewRef", "inView", "scrollTriggerRef", "bgTriggerRef", "boxTriggerRef", "bgRef", "boxRef", "gsapResize", "clientHeight", "self", "value", "e", "icon", "index", "c", "HeroBanner_default"]
7
7
  }
@@ -27,6 +27,7 @@ export interface HeroBannerProps {
27
27
  primaryButton?: {
28
28
  text: string;
29
29
  link?: string;
30
+ isCustomPrimaryButton?: boolean;
30
31
  } & Omit<ButtonProps, 'children'>;
31
32
  /** 次要按钮文本和配置 */
32
33
  secondaryButton?: {
@@ -37,6 +38,7 @@ export interface HeroBannerProps {
37
38
  playIcon?: boolean;
38
39
  videoUrl?: Media;
39
40
  youtubeId?: string;
41
+ isCustomSecondaryButton?: boolean;
40
42
  } & Omit<ButtonProps, 'children'>;
41
43
  /** 主题 */
42
44
  theme?: Theme;
@@ -49,4 +51,6 @@ export interface HeroBannerProps {
49
51
  };
50
52
  /** 自定义类名 */
51
53
  className?: string;
54
+ onSecondaryClick?: (data: any, e: any) => void;
55
+ onPrimaryClick?: (data: any, e: any) => void;
52
56
  }
@@ -28,4 +28,5 @@ export interface ImageTextFeatureProps {
28
28
  };
29
29
  /** 自定义类名 */
30
30
  className?: string;
31
+ isHorizontal?: boolean;
31
32
  }
@@ -1,2 +1,2 @@
1
- import{Fragment as C,jsx as e,jsxs as l}from"react/jsx-runtime";import{Heading as _,Tabs as W,TabsList as U,TabsTrigger as H,TabsContent as B,Text as h,Picture as S,Link as q,Button as w,DropdownMenu as J,DropdownMenuTrigger as Q,DropdownMenuContent as X,DropdownMenuItem as Y,LoadingDots as E}from"../../components/index.js";import{DownArrow as Z}from"../HeaderNavigation/icons/index.js";import{useMemo as u,useRef as V,useState as z}from"react";import{cn as T,atobID as ee,highlightSearchWord as k}from"../../helpers/utils.js";import{useAiuiContext as D}from"../AiuiProvider/index.js";import{formatVariantPrice as te}from"../ShelfDisplay/shelfDisplay.js";import{SearchPageTabType as v}from"./types.js";const j=({product:t,onSecondaryButton:i,onPrimaryButton:a,searchValue:r,variantData:m,shopNowLoadingProductId:y})=>{const o=u(()=>m||t?.variants?.[0],[t,m]),{locale:g="us",copyWriting:c}=D(),N=y===t?.id,x=u(()=>`${g==="us"?"":"/"+g}/products/${t?.handle}?variant=${ee(o?.id)}?ref=search_result_${r?.toLowerCase()}`,[t?.handle,o?.id,r,g]),n=o?.coupons?.[0],{price:L,basePrice:b}=te({locale:g,amount:n?n.variant_price4wscode:o?.price,baseAmount:n?o?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),I=u(()=>t?.tags?.filter?.(p=>p?.startsWith?.("CLtag"))?.map?.(p=>p?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return e("div",{className:"ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto",children:t?.type==="advertising"&&t?.advertisingLink?l(q,{href:t?.advertisingLink,className:"h-full",children:[e(S,{source:t?.advertisingBgImg?.url,className:"size-full",imgClassName:"size-full object-cover"}),l("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[e(h,{html:t?.advertisingTitle,className:T("desktop:text-[18px] text-sm font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&e(_,{size:3,html:t?.advertisingSubtitle,className:T("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):l("a",{href:x,className:" tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[e("div",{className:"ipc_search_product_item_image",children:e(S,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:`${o?.image?.url||t?.images?.[0]?.url}}`,alt:t?.title,imgClassName:"object-cover size-full"})}),l("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[l("div",{className:"flex-1",children:[e("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:I?.map((p,P)=>e(h,{as:"p",html:p,className:"text-brand-0 lg-desktop:px-2 lg-desktop:!leading-[28px] h-full rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-sm font-bold !leading-[22px]"},P))}),e(h,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:k(t?.title||"",r||"")}),e(h,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:k(t?.description,r||"")})]}),l("div",{children:[e("div",{className:"mb-2 flex items-center",children:o?.availableForSale?l(C,{children:[e("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:o?.availableForSale&&L||""}),e("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:o?.availableForSale&&b||""})]}):e("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:c?.soldOutText||"Sold Out"})}),l("div",{className:T("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[c?.learnMoreText&&e(w,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",disabled:!o?.availableForSale,onClick:p=>{p.preventDefault(),p.stopPropagation(),i?.()},children:c?.learnMoreText}),c?.shopNowText&&e(w,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!o?.availableForSale,loading:N,onClick:p=>{p.preventDefault(),p.stopPropagation(),a?.()},children:c?.shopNowText})]})]})]})]})})},se=({blog:t,searchValue:i})=>{const{copyWriting:a,locale:r}=D(),m=u(()=>`${r==="us"?"":"/"+r}/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,[t,r]);return e("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:l("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[e("div",{className:"laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px]",children:e(S,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),l("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[e(_,{size:3,html:k(t?.title,i)}),e(h,{html:k(t?.content,i),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),e("div",{className:"desktop:mt-6 mt-4",children:e(w,{as:"a",href:m,variant:"secondary",size:"lg",children:a?.learnMoreText||"Learn More"})})]})]})})},ae=({searchValue:t,page:i})=>{const{copyWriting:a,locale:r="us"}=D(),m=u(()=>`${r==="us"?"":`/${r}`}/${i?.handle}`,[i,r]);return l("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[e(_,{size:3,html:k(i?.name,t)}),e(h,{as:"p",html:k(i?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),e(w,{as:"a",href:m,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:a?.learnMoreText||"Learn More"})]})},A=({url:t,label:i})=>l("div",{className:"flex flex-col items-center justify-center gap-4",children:[e(S,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),e(h,{html:i,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),M=({products:t,title:i,buildProps:a,onSecondaryButton:r,onPrimaryButton:m})=>{const{products:y}=a||{};return l("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[e(_,{size:4,weight:"bold",html:i}),e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((o,g)=>{const c=y?.find(x=>x.handle===o.handle),N=c?.variants?.find(x=>x.sku===o.sku);return e(j,{product:c,variantData:N,onSecondaryButton:()=>r?.(),onPrimaryButton:()=>m?.()},o.sku+g)})})]})},le=({searchResult:t,searchValue:i,data:a,onSecondaryButton:r,onPrimaryButton:m,onChangeSort:y,loading:o,shopNowLoadingProductId:g,searchResultCount:c,onChangeTab:N,buildProps:x})=>{const[n,L]=z(a?.tabs?.[0]),b=V(!1),[I,p]=z(!1),[P,$]=z({[v.PRODUCTS]:a?.tabs?.find(s=>s.tabType===v.PRODUCTS)?.sortKeys?.[0],[v.BLOGS]:a?.tabs?.find(s=>s.tabType===v.BLOGS)?.sortKeys?.[0],[v.PAGES]:a?.tabs?.find(s=>s.tabType===v.PAGES)?.sortKeys?.[0]}),f=u(()=>t?.products||[],[t]),O=u(()=>t?.blogs||[],[t]),R=u(()=>t?.pages||[],[t]),F=u(()=>Object.values(c||{}).reduce((s,d)=>s+d,0),[c]),G=u(()=>{const s={advertisingBgImg:n?.advertisingBgImg,advertisingTitle:n?.advertisingTitle,advertisingSubtitle:n?.advertisingSubtitle,advertisingLink:n?.advertisingLink,advertisingTheme:n?.advertisingTheme,type:"advertising"};return!b.current&&f?.length&&(f?.length>=8?(f?.splice(7,0,s),b.current=!0):(f?.push(s),b.current=!0)),f},[n,f]);return l("div",{className:"ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",children:[e(_,{size:4,weight:"bold",html:a?.title?.replace("$totalCount",F?.toString())?.replace("$inputValue",`"${i}"`)}),e("div",{className:"mt-6",children:l(W,{className:"ipc_search_page_tabs",defaultValue:"products",children:[l("div",{className:"desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[e(U,{children:a?.tabs?.map(s=>l(H,{onClick:()=>{L(s),b.current=!1;const d=s?.sortKeys?.[0];d&&($(K=>({...K,[s?.tabType]:d})),y?.(s?.tabType,d)),N?.(s?.tabType)},defaultValue:"products",value:s.tabType,children:[s.label," (",c?.[s.tabType],")"]},s.id))}),l(J,{onOpenChange:p,children:[e(Q,{asChild:!0,children:l("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2]",children:[n?.sortLabel," ",P?.[n?.tabType]?.label," ",e(Z,{className:T("inline-block size-4",{"rotate-180":I})})]})}),e(X,{align:"start",sideOffset:8,className:"rounded-none bg-white !px-0 py-2",children:n?.sortKeys?.map(s=>e(Y,{className:T("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current",{"bg-[#EAEAEC]":P?.[n?.tabType]?.value===s.value}),onClick:()=>{b.current=!1,y?.(n?.tabType,s),$(d=>({...d,[n?.tabType]:s}))},children:s.label},s.id))})]})]}),l(B,{value:v.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[e("div",{className:"tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:G?.map((s,d)=>e(j,{searchValue:i,product:s,shopNowLoadingProductId:g,onSecondaryButton:()=>r?.(s),onPrimaryButton:()=>m?.(s)},(s.id||"")+d))}),o?e("div",{className:"mt-6 flex w-full justify-center",children:e(E,{})}):!f?.length&&l(C,{children:[e(A,{url:a?.noResultImage?.url,label:a?.noResultLabel}),e(M,{products:a?.recommendProducts||[],buildProps:x,title:a?.recommendProductsTitle,shopNowLoadingProductId:g})]})]}),e(B,{value:v.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:l("div",{children:[O?.map(s=>e(se,{blog:s,searchValue:i},s.id)),o?e("div",{className:"mt-6 flex justify-center",children:e(E,{})}):!O?.length&&l(C,{children:[e(A,{url:a?.noResultImage?.url,label:a?.noResultLabel}),e(M,{products:a?.recommendProducts||[],buildProps:x,title:a?.recommendProductsTitle})]})]})}),l(B,{value:v.PAGES,className:"ipc_search_page_tabs_pages_content",children:[e("div",{children:R?.map((s,d)=>e(ae,{page:s,searchValue:i},(s.global_id||s.id)+d))}),o?e("div",{className:"mt-6 flex justify-center",children:e(E,{})}):!R?.length&&l(C,{children:[e(A,{url:a?.noResultImage?.url,label:a?.noResultLabel}),e(M,{products:a?.recommendProducts||[],buildProps:x,title:a?.recommendProductsTitle,shopNowLoadingProductId:g})]})]})]})})]})};var me=le;export{me as default};
1
+ import{Fragment as C,jsx as e,jsxs as l}from"react/jsx-runtime";import{Heading as _,Tabs as W,TabsList as U,TabsTrigger as H,TabsContent as B,Text as h,Picture as S,Link as q,Button as w,DropdownMenu as J,DropdownMenuTrigger as Q,DropdownMenuContent as X,DropdownMenuItem as Y,LoadingDots as E}from"../../components/index.js";import{DownArrow as Z}from"../HeaderNavigation/icons/index.js";import{useMemo as u,useRef as V,useState as z}from"react";import{cn as T,atobID as ee,highlightSearchWord as k}from"../../helpers/utils.js";import{useAiuiContext as D}from"../AiuiProvider/index.js";import{formatVariantPrice as te}from"../ShelfDisplay/shelfDisplay.js";import{SearchPageTabType as v}from"./types.js";const j=({product:t,onSecondaryButton:i,onPrimaryButton:a,searchValue:r,variantData:m,shopNowLoadingProductId:y})=>{const o=u(()=>m||t?.variants?.[0],[t,m]),{locale:g="us",copyWriting:p}=D(),N=y===t?.id,x=u(()=>`${g==="us"?"":"/"+g}/products/${t?.handle}?variant=${ee(o?.id)}?ref=search_result_${r?.toLowerCase()}`,[t?.handle,o?.id,r,g]),n=o?.coupons?.[0],{price:L,basePrice:b}=te({locale:g,amount:n?n.variant_price4wscode:o?.price,baseAmount:n?o?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),I=u(()=>t?.tags?.filter?.(c=>c?.startsWith?.("CLtag"))?.map?.(c=>c?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return e("div",{className:"ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto",children:t?.type==="advertising"&&t?.advertisingLink?l(q,{href:t?.advertisingLink,className:"h-full",children:[e(S,{source:t?.advertisingBgImg?.url,className:"size-full",imgClassName:"size-full object-cover"}),l("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[e(h,{html:t?.advertisingTitle,className:T("desktop:text-[18px] text-sm font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&e(_,{size:3,html:t?.advertisingSubtitle,className:T("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):l("a",{href:x,className:" tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[e("div",{className:"ipc_search_product_item_image",children:e(S,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:`${o?.image?.url||t?.images?.[0]?.url}}`,alt:t?.title,imgClassName:"object-cover size-full"})}),l("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[l("div",{className:"flex-1",children:[e("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:I?.map((c,P)=>e(h,{as:"p",html:c,className:"text-brand-0 lg-desktop:px-2 lg-desktop:!leading-[28px] h-full rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-sm font-bold !leading-[22px]"},P))}),e(h,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:k(t?.title||"",r||"")}),e(h,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:k(t?.description,r||"")})]}),l("div",{children:[e("div",{className:"mb-2 flex items-center",children:o?.availableForSale?l(C,{children:[e("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:o?.availableForSale&&L||""}),e("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:o?.availableForSale&&b||""})]}):e("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:p?.soldOutText||"Sold Out"})}),l("div",{className:T("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[p?.learnMoreText&&e(w,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",disabled:!o?.availableForSale,onClick:c=>{c.preventDefault(),c.stopPropagation(),i?.()},children:p?.learnMoreText}),p?.shopNowText&&e(w,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!o?.availableForSale,loading:N,onClick:c=>{c.preventDefault(),c.stopPropagation(),a?.()},children:p?.shopNowText})]})]})]})]})})},se=({blog:t,searchValue:i})=>{const{copyWriting:a,locale:r}=D(),m=u(()=>`${r==="us"?"":"/"+r}/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,[t,r]);return e("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:l("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[e("div",{className:"laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px]",children:e(S,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),l("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[e(_,{size:3,html:k(t?.title,i)}),e(h,{html:k(t?.content,i),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),e("div",{className:"desktop:mt-6 mt-4",children:e(w,{as:"a",href:m,variant:"secondary",size:"lg",children:a?.learnMoreText||"Learn More"})})]})]})})},ae=({searchValue:t,page:i})=>{const{copyWriting:a,locale:r="us"}=D(),m=u(()=>`${r==="us"?"":`/${r}`}/${i?.handle}`,[i,r]);return l("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[e(_,{size:3,html:k(i?.name,t)}),e(h,{as:"p",html:k(i?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),e(w,{as:"a",href:m,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:a?.learnMoreText||"Learn More"})]})},A=({url:t,label:i})=>l("div",{className:"flex flex-col items-center justify-center gap-4",children:[e(S,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),e(h,{html:i,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),M=({products:t,title:i,buildProps:a,onSecondaryButton:r,onPrimaryButton:m})=>{const{products:y}=a||{};return l("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[e(_,{size:4,weight:"bold",html:i}),e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((o,g)=>{const p=y?.find(x=>x.handle===o.handle);if(!p)return null;const N=p?.variants?.find(x=>x.sku===o.sku);return e(j,{product:p,variantData:N,onSecondaryButton:()=>r?.(),onPrimaryButton:()=>m?.()},o.sku+g)})})]})},le=({searchResult:t,searchValue:i,data:a,onSecondaryButton:r,onPrimaryButton:m,onChangeSort:y,loading:o,shopNowLoadingProductId:g,searchResultCount:p,onChangeTab:N,buildProps:x})=>{const[n,L]=z(a?.tabs?.[0]),b=V(!1),[I,c]=z(!1),[P,$]=z({[v.PRODUCTS]:a?.tabs?.find(s=>s.tabType===v.PRODUCTS)?.sortKeys?.[0],[v.BLOGS]:a?.tabs?.find(s=>s.tabType===v.BLOGS)?.sortKeys?.[0],[v.PAGES]:a?.tabs?.find(s=>s.tabType===v.PAGES)?.sortKeys?.[0]}),f=u(()=>t?.products||[],[t]),O=u(()=>t?.blogs||[],[t]),R=u(()=>t?.pages||[],[t]),F=u(()=>Object.values(p||{}).reduce((s,d)=>s+d,0),[p]),G=u(()=>{const s={advertisingBgImg:n?.advertisingBgImg,advertisingTitle:n?.advertisingTitle,advertisingSubtitle:n?.advertisingSubtitle,advertisingLink:n?.advertisingLink,advertisingTheme:n?.advertisingTheme,type:"advertising"};return!b.current&&f?.length&&(f?.length>=8?(f?.splice(7,0,s),b.current=!0):(f?.push(s),b.current=!0)),f},[n,f]);return l("div",{className:"ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",children:[e(_,{size:4,weight:"bold",html:a?.title?.replace("$totalCount",F?.toString())?.replace("$inputValue",`"${i}"`)}),e("div",{className:"mt-6",children:l(W,{className:"ipc_search_page_tabs",defaultValue:"products",children:[l("div",{className:"desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[e(U,{children:a?.tabs?.map(s=>l(H,{onClick:()=>{L(s),b.current=!1;const d=s?.sortKeys?.[0];d&&($(K=>({...K,[s?.tabType]:d})),y?.(s?.tabType,d)),N?.(s?.tabType)},defaultValue:"products",value:s.tabType,children:[s.label," (",p?.[s.tabType],")"]},s.id))}),l(J,{onOpenChange:c,children:[e(Q,{asChild:!0,children:l("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2]",children:[n?.sortLabel," ",P?.[n?.tabType]?.label," ",e(Z,{className:T("inline-block size-4",{"rotate-180":I})})]})}),e(X,{align:"start",sideOffset:8,className:"rounded-none bg-white !px-0 py-2",children:n?.sortKeys?.map(s=>e(Y,{className:T("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current",{"bg-[#EAEAEC]":P?.[n?.tabType]?.value===s.value}),onClick:()=>{b.current=!1,y?.(n?.tabType,s),$(d=>({...d,[n?.tabType]:s}))},children:s.label},s.id))})]})]}),l(B,{value:v.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[e("div",{className:"tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:G?.map((s,d)=>e(j,{searchValue:i,product:s,shopNowLoadingProductId:g,onSecondaryButton:()=>r?.(s),onPrimaryButton:()=>m?.(s)},(s.id||"")+d))}),o?e("div",{className:"mt-6 flex w-full justify-center",children:e(E,{})}):!f?.length&&l(C,{children:[e(A,{url:a?.noResultImage?.url,label:a?.noResultLabel}),e(M,{products:a?.recommendProducts||[],buildProps:x,title:a?.recommendProductsTitle,shopNowLoadingProductId:g})]})]}),e(B,{value:v.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:l("div",{children:[O?.map(s=>e(se,{blog:s,searchValue:i},s.id)),o?e("div",{className:"mt-6 flex justify-center",children:e(E,{})}):!O?.length&&l(C,{children:[e(A,{url:a?.noResultImage?.url,label:a?.noResultLabel}),e(M,{products:a?.recommendProducts||[],buildProps:x,title:a?.recommendProductsTitle})]})]})}),l(B,{value:v.PAGES,className:"ipc_search_page_tabs_pages_content",children:[e("div",{children:R?.map((s,d)=>e(ae,{page:s,searchValue:i},(s.global_id||s.id)+d))}),o?e("div",{className:"mt-6 flex justify-center",children:e(E,{})}):!R?.length&&l(C,{children:[e(A,{url:a?.noResultImage?.url,label:a?.noResultLabel}),e(M,{products:a?.recommendProducts||[],buildProps:x,title:a?.recommendProductsTitle,shopNowLoadingProductId:g})]})]})]})})]})};var me=le;export{me as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/SearchPage/index.tsx"],
4
- "sourcesContent": ["import {\n Heading,\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n Text,\n Picture,\n Link,\n Button,\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n LoadingDots,\n} from '../../components/index.js'\nimport { DownArrow } from '../HeaderNavigation/icons/index.js'\nimport { useMemo, useRef, useState } from 'react'\nimport { cn, atobID, highlightSearchWord } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { formatVariantPrice } from '../ShelfDisplay/shelfDisplay.js'\nimport type {\n SearchPageProps,\n SortKey,\n SearchProductItemProps,\n SearchBlogItemProps,\n SearchPageItemProps,\n SearchRecommendProductsProps,\n} from './types'\nimport { SearchPageTabType } from './types.js'\n\n/**\n * \u641C\u7D22\u5546\u54C1\n */\nconst SearchProductItem = ({\n product,\n onSecondaryButton,\n onPrimaryButton,\n searchValue,\n variantData,\n shopNowLoadingProductId,\n}: SearchProductItemProps) => {\n const variant = useMemo(() => variantData || product?.variants?.[0], [product, variantData])\n const { locale = 'us', copyWriting } = useAiuiContext()\n\n // \u5224\u65AD\u5F53\u524D\u4EA7\u54C1\u662F\u5426\u5728\u52A0\u8F7D\u4E2D\n const isCurrentProductLoading = shopNowLoadingProductId === product?.id\n\n const listingLink = useMemo(() => {\n return `${locale === 'us' ? '' : '/' + locale}/products/${product?.handle}?variant=${atobID(variant?.id as string)}?ref=search_result_${searchValue?.toLowerCase()}`\n }, [product?.handle, variant?.id, searchValue, locale])\n\n const coupon = variant?.coupons?.[0]\n\n const { price, basePrice } = formatVariantPrice({\n locale: locale,\n amount: coupon ? coupon.variant_price4wscode : variant?.price,\n baseAmount: coupon ? variant?.price : 0,\n currencyCode: product?.price?.currencyCode || 'USD',\n })\n\n const tags = useMemo(() => {\n return product?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n }, [product?.tags])\n\n return (\n <div className=\"ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto\">\n {product?.type === 'advertising' && product?.advertisingLink ? (\n <Link href={product?.advertisingLink} className=\"h-full\">\n <Picture\n source={product?.advertisingBgImg?.url}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n />\n <div className=\"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500\">\n <Text\n html={product?.advertisingTitle}\n className={cn('desktop:text-[18px] text-sm font-bold', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n {product?.advertisingSubtitle && (\n <Heading\n size={3}\n html={product?.advertisingSubtitle}\n className={cn('laptop:line-clamp-3 mt-2 line-clamp-4 font-bold', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n )}\n </div>\n </Link>\n ) : (\n <a\n href={listingLink}\n className=\" tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300\"\n >\n <div className=\"ipc_search_product_item_image\">\n <Picture\n className=\"lg-desktop:size-[196px] mx-auto size-[138px]\"\n source={`${variant?.image?.url || product?.images?.[0]?.url}}`}\n alt={product?.title}\n imgClassName=\"object-cover size-full\"\n />\n </div>\n <div className=\"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4\">\n <div className=\"flex-1\">\n <div className=\"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2\">\n {tags?.map((tag: string, index: number) => (\n <Text\n key={index}\n as=\"p\"\n html={tag}\n className=\"text-brand-0 lg-desktop:px-2 lg-desktop:!leading-[28px] h-full rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-sm font-bold !leading-[22px]\"\n />\n ))}\n </div>\n <Text\n className=\"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]\"\n weight=\"bold\"\n html={highlightSearchWord(product?.title || '', searchValue || '')}\n />\n <Text\n as=\"p\"\n className=\"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold\"\n html={highlightSearchWord(product?.description, searchValue || '')}\n />\n </div>\n <div>\n <div className=\"mb-2 flex items-center\">\n {!variant?.availableForSale ? (\n <div className=\"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {copyWriting?.soldOutText || 'Sold Out'}\n </div>\n ) : (\n <>\n <div className=\"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {variant?.availableForSale ? price || '' : ''}\n </div>\n <div className=\"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through\">\n {variant?.availableForSale ? basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n <div\n className={cn(\n 'ipc_search_product_item_button_group',\n 'lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2'\n )}\n >\n {copyWriting?.learnMoreText && (\n <Button\n variant=\"secondary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n disabled={!variant?.availableForSale}\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onSecondaryButton?.()\n }}\n >\n {copyWriting?.learnMoreText}\n </Button>\n )}\n {copyWriting?.shopNowText && (\n <Button\n variant=\"primary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n disabled={!variant?.availableForSale}\n loading={isCurrentProductLoading}\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onPrimaryButton?.()\n }}\n >\n {copyWriting?.shopNowText}\n </Button>\n )}\n </div>\n </div>\n </div>\n </a>\n )}\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u6587\u7AE0\n */\nconst SearchBlogItem = ({ blog, searchValue }: SearchBlogItemProps) => {\n const { copyWriting, locale } = useAiuiContext()\n\n const articleLink = useMemo(\n () =>\n `${locale === 'us' ? '' : '/' + locale}/blogs/${blog?.blog?.handle}/${blog?.handle.replace('storefront-', '')}`,\n [blog, locale]\n )\n\n return (\n <div className=\"ipc_search_blog_item border-b border-[#E4E5E6] py-6\">\n <div className=\"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4\">\n <div className=\"laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px]\">\n <Picture\n source={blog?.image?.url}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n alt={blog?.title}\n />\n </div>\n <div className=\"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center\">\n <Heading size={3} html={highlightSearchWord(blog?.title, searchValue)} />\n <Text\n html={highlightSearchWord(blog?.content, searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]\"\n />\n <div className=\"desktop:mt-6 mt-4\">\n <Button as=\"a\" href={articleLink} variant=\"secondary\" size=\"lg\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPageItem = ({ searchValue, page }: SearchPageItemProps) => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n const pageLink = useMemo(() => `${locale === 'us' ? '' : `/${locale}`}/${page?.handle}`, [page, locale])\n return (\n <div className=\"ipc_search_page_items border-b border-[#E4E5E6] py-6\">\n <Heading size={3} html={highlightSearchWord(page?.name, searchValue)} />\n <Text\n as=\"p\"\n html={highlightSearchWord(page?.bodySummary || '', searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]\"\n />\n <Button as=\"a\" href={pageLink} variant=\"secondary\" size=\"lg\" className=\"desktop:mt-6 mt-4\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u7ED3\u679C\u4E3A\u7A7A\n */\nconst SearchPageNoResult = ({ url, label }: { url: string; label: string }) => {\n return (\n <div className=\"flex flex-col items-center justify-center gap-4\">\n <Picture source={url} className=\"h-[180px] w-[240px]\" imgClassName=\"object-cover\" />\n <Text html={label} className=\"desktop:text-[18px] text-sm font-bold leading-[1.4]\" />\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u63A8\u8350\u5546\u54C1\n */\nconst SearchRecommendProducts = ({\n products,\n title,\n buildProps,\n onSecondaryButton,\n onPrimaryButton,\n}: SearchRecommendProductsProps) => {\n const { products: buildProducts } = buildProps || {}\n return (\n <div className=\"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]\">\n <Heading size={4} weight=\"bold\" html={title} />\n <div className=\" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4\">\n {products?.map((product: any, index: number) => {\n const buildProduct = buildProducts?.find((buildProduct: any) => buildProduct.handle === product.handle)\n const variant = buildProduct?.variants?.find((variant: any) => variant.sku === product.sku)\n return (\n <SearchProductItem\n product={buildProduct}\n variantData={variant}\n key={product.sku + index}\n onSecondaryButton={() => onSecondaryButton?.()}\n onPrimaryButton={() => onPrimaryButton?.()}\n />\n )\n })}\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPage = ({\n searchResult,\n searchValue,\n data,\n onSecondaryButton,\n onPrimaryButton,\n // loadMore,\n onChangeSort,\n loading,\n shopNowLoadingProductId,\n searchResultCount,\n onChangeTab,\n buildProps,\n}: SearchPageProps) => {\n const [currentTab, setCurrentTab] = useState<any>(data?.tabs?.[0])\n const isInsertAdvertising = useRef(false)\n const [isOpenSort, setIsOpenSort] = useState(false)\n const [currentSortKey, setCurrentSortKey] = useState<any>({\n [SearchPageTabType.PRODUCTS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PRODUCTS)\n ?.sortKeys?.[0],\n [SearchPageTabType.BLOGS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.BLOGS)?.sortKeys?.[0],\n [SearchPageTabType.PAGES]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PAGES)?.sortKeys?.[0],\n })\n\n const searchProductsResult = useMemo(() => {\n return searchResult?.products || []\n }, [searchResult])\n\n const searchBlogsResult = useMemo(() => {\n return searchResult?.blogs || []\n }, [searchResult])\n\n const searchPagesResult = useMemo(() => {\n return searchResult?.pages || []\n }, [searchResult])\n\n const totalCount = useMemo(() => {\n return Object.values(searchResultCount || {}).reduce((acc, curr) => acc + curr, 0)\n }, [searchResultCount])\n\n const searchProductsResultWithAdvertising = useMemo(() => {\n const advertisingData = {\n advertisingBgImg: currentTab?.advertisingBgImg,\n advertisingTitle: currentTab?.advertisingTitle,\n advertisingSubtitle: currentTab?.advertisingSubtitle,\n advertisingLink: currentTab?.advertisingLink,\n advertisingTheme: currentTab?.advertisingTheme,\n type: 'advertising',\n }\n if (!isInsertAdvertising.current && !!searchProductsResult?.length) {\n if (searchProductsResult?.length >= 8) {\n searchProductsResult?.splice(7, 0, advertisingData)\n isInsertAdvertising.current = true\n } else {\n searchProductsResult?.push(advertisingData)\n isInsertAdvertising.current = true\n }\n }\n return searchProductsResult\n }, [currentTab, searchProductsResult])\n\n return (\n <div className=\"ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16\">\n <Heading\n size={4}\n weight=\"bold\"\n html={data?.title?.replace('$totalCount', totalCount?.toString())?.replace('$inputValue', `\"${searchValue}\"`)}\n />\n <div className=\"mt-6\">\n <Tabs className=\"ipc_search_page_tabs\" defaultValue=\"products\">\n <div className=\"desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between\">\n <TabsList>\n {data?.tabs?.map((tab: any) => (\n <TabsTrigger\n onClick={() => {\n setCurrentTab(tab)\n isInsertAdvertising.current = false\n // \u5207\u6362tab\u65F6\uFF0C\u91CD\u7F6E\u8BE5tab\u7684\u6392\u5E8F\u503C\u4E3A\u9ED8\u8BA4\u503C\uFF08\u7B2C\u4E00\u4E2AsortKey\uFF09\n const defaultSortKey = tab?.sortKeys?.[0]\n if (defaultSortKey) {\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [tab?.tabType]: defaultSortKey,\n }))\n onChangeSort?.(tab?.tabType, defaultSortKey)\n }\n onChangeTab?.(tab?.tabType)\n }}\n key={tab.id}\n defaultValue=\"products\"\n value={tab.tabType}\n >\n {tab.label} ({searchResultCount?.[tab.tabType as keyof typeof searchResultCount]})\n </TabsTrigger>\n ))}\n </TabsList>\n <DropdownMenu onOpenChange={setIsOpenSort}>\n <DropdownMenuTrigger asChild>\n <button className=\"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2]\">\n {currentTab?.sortLabel} {currentSortKey?.[currentTab?.tabType]?.label}{' '}\n <DownArrow\n className={cn('inline-block size-4', {\n 'rotate-180': isOpenSort,\n })}\n />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" sideOffset={8} className=\"rounded-none bg-white !px-0 py-2\">\n {currentTab?.sortKeys?.map((sortKey: SortKey) => {\n return (\n <DropdownMenuItem\n className={cn(\n 'laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current',\n {\n 'bg-[#EAEAEC]': currentSortKey?.[currentTab?.tabType]?.value === sortKey.value,\n }\n )}\n onClick={() => {\n isInsertAdvertising.current = false\n onChangeSort?.(currentTab?.tabType, sortKey)\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [currentTab?.tabType]: sortKey,\n }))\n }}\n key={sortKey.id}\n >\n {sortKey.label}\n </DropdownMenuItem>\n )\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n <TabsContent value={SearchPageTabType.PRODUCTS} className=\"ipc_search_page_tabs_products_content mt-6\">\n <div className=\"tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4\">\n {searchProductsResultWithAdvertising?.map((product: any, index: number) => (\n <SearchProductItem\n searchValue={searchValue}\n key={(product.id || '') + index}\n product={product}\n shopNowLoadingProductId={shopNowLoadingProductId}\n onSecondaryButton={() => onSecondaryButton?.(product)}\n onPrimaryButton={() => onPrimaryButton?.(product)}\n />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex w-full justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchProductsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n />\n </>\n )\n )}\n </TabsContent>\n <TabsContent value={SearchPageTabType.BLOGS} className=\"ipc_search_page_tabs_blogs_content\">\n <div>\n {searchBlogsResult?.map((blog: any) => (\n <SearchBlogItem key={blog.id} blog={blog} searchValue={searchValue} />\n ))}\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchBlogsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n />\n </>\n )\n )}\n </div>\n </TabsContent>\n <TabsContent value={SearchPageTabType.PAGES} className=\"ipc_search_page_tabs_pages_content\">\n <div>\n {searchPagesResult?.map((page: any, index: number) => (\n <SearchPageItem key={(page.global_id || page.id) + index} page={page} searchValue={searchValue} />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchPagesResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n />\n </>\n )\n )}\n </TabsContent>\n </Tabs>\n </div>\n </div>\n )\n}\n\nexport default SearchPage\n"],
5
- "mappings": "AAwEU,OAoEQ,YAAAA,EApER,OAAAC,EAKA,QAAAC,MALA,oBAxEV,OACE,WAAAC,EACA,QAAAC,EACA,YAAAC,EACA,eAAAC,EACA,eAAAC,EACA,QAAAC,EACA,WAAAC,EACA,QAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,uBAAAC,EACA,uBAAAC,EACA,oBAAAC,EACA,eAAAC,MACK,4BACP,OAAS,aAAAC,MAAiB,qCAC1B,OAAS,WAAAC,EAAS,UAAAC,EAAQ,YAAAC,MAAgB,QAC1C,OAAS,MAAAC,EAAI,UAAAC,GAAQ,uBAAAC,MAA2B,yBAChD,OAAS,kBAAAC,MAAsB,2BAC/B,OAAS,sBAAAC,OAA0B,kCASnC,OAAS,qBAAAC,MAAyB,aAKlC,MAAMC,EAAoB,CAAC,CACzB,QAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,YAAAC,EACA,YAAAC,EACA,wBAAAC,CACF,IAA8B,CAC5B,MAAMC,EAAUhB,EAAQ,IAAMc,GAAeJ,GAAS,WAAW,CAAC,EAAG,CAACA,EAASI,CAAW,CAAC,EACrF,CAAE,OAAAG,EAAS,KAAM,YAAAC,CAAY,EAAIZ,EAAe,EAGhDa,EAA0BJ,IAA4BL,GAAS,GAE/DU,EA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EACCjE,EAAC,OAAI,UAAU,2BACb,SAAAA,EAACe,EAAA,EAAY,EACf,EAEA,CAAC8D,GAAmB,QAClB5E,EAAAF,EAAA,CACE,UAAAC,EAACoD,EAAA,CAAmB,IAAKW,GAAM,eAAe,IAAK,MAAOA,GAAM,cAAe,EAC/E/D,EAACuD,EAAA,CACC,SAAUQ,GAAM,mBAAqB,CAAC,EACtC,WAAYL,EACZ,MAAOK,GAAM,uBACf,GACF,GAGN,EACF,EACA9D,EAACK,EAAA,CAAY,MAAOmB,EAAkB,MAAO,UAAU,qCACrD,UAAAzB,EAAC,OACE,SAAA8E,GAAmB,IAAI,CAAC5B,EAAWN,IAClC5C,EAACiD,GAAA,CAAyD,KAAMC,EAAM,YAAapB,IAA7DoB,EAAK,WAAaA,EAAK,IAAMN,CAA6C,CACjG,EACH,EACCqB,EACCjE,EAAC,OAAI,UAAU,2BACb,SAAAA,EAACe,EAAA,EAAY,EACf,EAEA,CAAC+D,GAAmB,QAClB7E,EAAAF,EAAA,CACE,UAAAC,EAACoD,EAAA,CAAmB,IAAKW,GAAM,eAAe,IAAK,MAAOA,GAAM,cAAe,EAC/E/D,EAACuD,EAAA,CACC,SAAUQ,GAAM,mBAAqB,CAAC,EACtC,WAAYL,EACZ,MAAOK,GAAM,uBACb,wBAAyB/B,EAC3B,GACF,GAGN,GACF,EACF,GACF,CAEJ,EAEA,IAAOuD,GAAQ1B",
4
+ "sourcesContent": ["import {\n Heading,\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n Text,\n Picture,\n Link,\n Button,\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n LoadingDots,\n} from '../../components/index.js'\nimport { DownArrow } from '../HeaderNavigation/icons/index.js'\nimport { useMemo, useRef, useState } from 'react'\nimport { cn, atobID, highlightSearchWord } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { formatVariantPrice } from '../ShelfDisplay/shelfDisplay.js'\nimport type {\n SearchPageProps,\n SortKey,\n SearchProductItemProps,\n SearchBlogItemProps,\n SearchPageItemProps,\n SearchRecommendProductsProps,\n} from './types'\nimport { SearchPageTabType } from './types.js'\n\n/**\n * \u641C\u7D22\u5546\u54C1\n */\nconst SearchProductItem = ({\n product,\n onSecondaryButton,\n onPrimaryButton,\n searchValue,\n variantData,\n shopNowLoadingProductId,\n}: SearchProductItemProps) => {\n const variant = useMemo(() => variantData || product?.variants?.[0], [product, variantData])\n const { locale = 'us', copyWriting } = useAiuiContext()\n\n // \u5224\u65AD\u5F53\u524D\u4EA7\u54C1\u662F\u5426\u5728\u52A0\u8F7D\u4E2D\n const isCurrentProductLoading = shopNowLoadingProductId === product?.id\n\n const listingLink = useMemo(() => {\n return `${locale === 'us' ? '' : '/' + locale}/products/${product?.handle}?variant=${atobID(variant?.id as string)}?ref=search_result_${searchValue?.toLowerCase()}`\n }, [product?.handle, variant?.id, searchValue, locale])\n\n const coupon = variant?.coupons?.[0]\n\n const { price, basePrice } = formatVariantPrice({\n locale: locale,\n amount: coupon ? coupon.variant_price4wscode : variant?.price,\n baseAmount: coupon ? variant?.price : 0,\n currencyCode: product?.price?.currencyCode || 'USD',\n })\n\n const tags = useMemo(() => {\n return product?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n }, [product?.tags])\n\n return (\n <div className=\"ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto\">\n {product?.type === 'advertising' && product?.advertisingLink ? (\n <Link href={product?.advertisingLink} className=\"h-full\">\n <Picture\n source={product?.advertisingBgImg?.url}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n />\n <div className=\"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500\">\n <Text\n html={product?.advertisingTitle}\n className={cn('desktop:text-[18px] text-sm font-bold', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n {product?.advertisingSubtitle && (\n <Heading\n size={3}\n html={product?.advertisingSubtitle}\n className={cn('laptop:line-clamp-3 mt-2 line-clamp-4 font-bold', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n )}\n </div>\n </Link>\n ) : (\n <a\n href={listingLink}\n className=\" tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300\"\n >\n <div className=\"ipc_search_product_item_image\">\n <Picture\n className=\"lg-desktop:size-[196px] mx-auto size-[138px]\"\n source={`${variant?.image?.url || product?.images?.[0]?.url}}`}\n alt={product?.title}\n imgClassName=\"object-cover size-full\"\n />\n </div>\n <div className=\"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4\">\n <div className=\"flex-1\">\n <div className=\"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2\">\n {tags?.map((tag: string, index: number) => (\n <Text\n key={index}\n as=\"p\"\n html={tag}\n className=\"text-brand-0 lg-desktop:px-2 lg-desktop:!leading-[28px] h-full rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-sm font-bold !leading-[22px]\"\n />\n ))}\n </div>\n <Text\n className=\"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]\"\n weight=\"bold\"\n html={highlightSearchWord(product?.title || '', searchValue || '')}\n />\n <Text\n as=\"p\"\n className=\"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold\"\n html={highlightSearchWord(product?.description, searchValue || '')}\n />\n </div>\n <div>\n <div className=\"mb-2 flex items-center\">\n {!variant?.availableForSale ? (\n <div className=\"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {copyWriting?.soldOutText || 'Sold Out'}\n </div>\n ) : (\n <>\n <div className=\"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {variant?.availableForSale ? price || '' : ''}\n </div>\n <div className=\"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through\">\n {variant?.availableForSale ? basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n <div\n className={cn(\n 'ipc_search_product_item_button_group',\n 'lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2'\n )}\n >\n {copyWriting?.learnMoreText && (\n <Button\n variant=\"secondary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n disabled={!variant?.availableForSale}\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onSecondaryButton?.()\n }}\n >\n {copyWriting?.learnMoreText}\n </Button>\n )}\n {copyWriting?.shopNowText && (\n <Button\n variant=\"primary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n disabled={!variant?.availableForSale}\n loading={isCurrentProductLoading}\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onPrimaryButton?.()\n }}\n >\n {copyWriting?.shopNowText}\n </Button>\n )}\n </div>\n </div>\n </div>\n </a>\n )}\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u6587\u7AE0\n */\nconst SearchBlogItem = ({ blog, searchValue }: SearchBlogItemProps) => {\n const { copyWriting, locale } = useAiuiContext()\n\n const articleLink = useMemo(\n () =>\n `${locale === 'us' ? '' : '/' + locale}/blogs/${blog?.blog?.handle}/${blog?.handle.replace('storefront-', '')}`,\n [blog, locale]\n )\n\n return (\n <div className=\"ipc_search_blog_item border-b border-[#E4E5E6] py-6\">\n <div className=\"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4\">\n <div className=\"laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px]\">\n <Picture\n source={blog?.image?.url}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n alt={blog?.title}\n />\n </div>\n <div className=\"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center\">\n <Heading size={3} html={highlightSearchWord(blog?.title, searchValue)} />\n <Text\n html={highlightSearchWord(blog?.content, searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]\"\n />\n <div className=\"desktop:mt-6 mt-4\">\n <Button as=\"a\" href={articleLink} variant=\"secondary\" size=\"lg\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPageItem = ({ searchValue, page }: SearchPageItemProps) => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n const pageLink = useMemo(() => `${locale === 'us' ? '' : `/${locale}`}/${page?.handle}`, [page, locale])\n return (\n <div className=\"ipc_search_page_items border-b border-[#E4E5E6] py-6\">\n <Heading size={3} html={highlightSearchWord(page?.name, searchValue)} />\n <Text\n as=\"p\"\n html={highlightSearchWord(page?.bodySummary || '', searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]\"\n />\n <Button as=\"a\" href={pageLink} variant=\"secondary\" size=\"lg\" className=\"desktop:mt-6 mt-4\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u7ED3\u679C\u4E3A\u7A7A\n */\nconst SearchPageNoResult = ({ url, label }: { url: string; label: string }) => {\n return (\n <div className=\"flex flex-col items-center justify-center gap-4\">\n <Picture source={url} className=\"h-[180px] w-[240px]\" imgClassName=\"object-cover\" />\n <Text html={label} className=\"desktop:text-[18px] text-sm font-bold leading-[1.4]\" />\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u63A8\u8350\u5546\u54C1\n */\nconst SearchRecommendProducts = ({\n products,\n title,\n buildProps,\n onSecondaryButton,\n onPrimaryButton,\n}: SearchRecommendProductsProps) => {\n const { products: buildProducts } = buildProps || {}\n return (\n <div className=\"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]\">\n <Heading size={4} weight=\"bold\" html={title} />\n <div className=\" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4\">\n {products?.map((product: any, index: number) => {\n const buildProduct = buildProducts?.find((buildProduct: any) => buildProduct.handle === product.handle)\n if (!buildProduct) return null\n const variant = buildProduct?.variants?.find((variant: any) => variant.sku === product.sku)\n return (\n <SearchProductItem\n product={buildProduct}\n variantData={variant}\n key={product.sku + index}\n onSecondaryButton={() => onSecondaryButton?.()}\n onPrimaryButton={() => onPrimaryButton?.()}\n />\n )\n })}\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPage = ({\n searchResult,\n searchValue,\n data,\n onSecondaryButton,\n onPrimaryButton,\n // loadMore,\n onChangeSort,\n loading,\n shopNowLoadingProductId,\n searchResultCount,\n onChangeTab,\n buildProps,\n}: SearchPageProps) => {\n const [currentTab, setCurrentTab] = useState<any>(data?.tabs?.[0])\n const isInsertAdvertising = useRef(false)\n const [isOpenSort, setIsOpenSort] = useState(false)\n const [currentSortKey, setCurrentSortKey] = useState<any>({\n [SearchPageTabType.PRODUCTS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PRODUCTS)\n ?.sortKeys?.[0],\n [SearchPageTabType.BLOGS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.BLOGS)?.sortKeys?.[0],\n [SearchPageTabType.PAGES]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PAGES)?.sortKeys?.[0],\n })\n\n const searchProductsResult = useMemo(() => {\n return searchResult?.products || []\n }, [searchResult])\n\n const searchBlogsResult = useMemo(() => {\n return searchResult?.blogs || []\n }, [searchResult])\n\n const searchPagesResult = useMemo(() => {\n return searchResult?.pages || []\n }, [searchResult])\n\n const totalCount = useMemo(() => {\n return Object.values(searchResultCount || {}).reduce((acc, curr) => acc + curr, 0)\n }, [searchResultCount])\n\n const searchProductsResultWithAdvertising = useMemo(() => {\n const advertisingData = {\n advertisingBgImg: currentTab?.advertisingBgImg,\n advertisingTitle: currentTab?.advertisingTitle,\n advertisingSubtitle: currentTab?.advertisingSubtitle,\n advertisingLink: currentTab?.advertisingLink,\n advertisingTheme: currentTab?.advertisingTheme,\n type: 'advertising',\n }\n if (!isInsertAdvertising.current && !!searchProductsResult?.length) {\n if (searchProductsResult?.length >= 8) {\n searchProductsResult?.splice(7, 0, advertisingData)\n isInsertAdvertising.current = true\n } else {\n searchProductsResult?.push(advertisingData)\n isInsertAdvertising.current = true\n }\n }\n return searchProductsResult\n }, [currentTab, searchProductsResult])\n\n return (\n <div className=\"ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16\">\n <Heading\n size={4}\n weight=\"bold\"\n html={data?.title?.replace('$totalCount', totalCount?.toString())?.replace('$inputValue', `\"${searchValue}\"`)}\n />\n <div className=\"mt-6\">\n <Tabs className=\"ipc_search_page_tabs\" defaultValue=\"products\">\n <div className=\"desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between\">\n <TabsList>\n {data?.tabs?.map((tab: any) => (\n <TabsTrigger\n onClick={() => {\n setCurrentTab(tab)\n isInsertAdvertising.current = false\n // \u5207\u6362tab\u65F6\uFF0C\u91CD\u7F6E\u8BE5tab\u7684\u6392\u5E8F\u503C\u4E3A\u9ED8\u8BA4\u503C\uFF08\u7B2C\u4E00\u4E2AsortKey\uFF09\n const defaultSortKey = tab?.sortKeys?.[0]\n if (defaultSortKey) {\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [tab?.tabType]: defaultSortKey,\n }))\n onChangeSort?.(tab?.tabType, defaultSortKey)\n }\n onChangeTab?.(tab?.tabType)\n }}\n key={tab.id}\n defaultValue=\"products\"\n value={tab.tabType}\n >\n {tab.label} ({searchResultCount?.[tab.tabType as keyof typeof searchResultCount]})\n </TabsTrigger>\n ))}\n </TabsList>\n <DropdownMenu onOpenChange={setIsOpenSort}>\n <DropdownMenuTrigger asChild>\n <button className=\"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2]\">\n {currentTab?.sortLabel} {currentSortKey?.[currentTab?.tabType]?.label}{' '}\n <DownArrow\n className={cn('inline-block size-4', {\n 'rotate-180': isOpenSort,\n })}\n />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" sideOffset={8} className=\"rounded-none bg-white !px-0 py-2\">\n {currentTab?.sortKeys?.map((sortKey: SortKey) => {\n return (\n <DropdownMenuItem\n className={cn(\n 'laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current',\n {\n 'bg-[#EAEAEC]': currentSortKey?.[currentTab?.tabType]?.value === sortKey.value,\n }\n )}\n onClick={() => {\n isInsertAdvertising.current = false\n onChangeSort?.(currentTab?.tabType, sortKey)\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [currentTab?.tabType]: sortKey,\n }))\n }}\n key={sortKey.id}\n >\n {sortKey.label}\n </DropdownMenuItem>\n )\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n <TabsContent value={SearchPageTabType.PRODUCTS} className=\"ipc_search_page_tabs_products_content mt-6\">\n <div className=\"tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4\">\n {searchProductsResultWithAdvertising?.map((product: any, index: number) => (\n <SearchProductItem\n searchValue={searchValue}\n key={(product.id || '') + index}\n product={product}\n shopNowLoadingProductId={shopNowLoadingProductId}\n onSecondaryButton={() => onSecondaryButton?.(product)}\n onPrimaryButton={() => onPrimaryButton?.(product)}\n />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex w-full justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchProductsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n />\n </>\n )\n )}\n </TabsContent>\n <TabsContent value={SearchPageTabType.BLOGS} className=\"ipc_search_page_tabs_blogs_content\">\n <div>\n {searchBlogsResult?.map((blog: any) => (\n <SearchBlogItem key={blog.id} blog={blog} searchValue={searchValue} />\n ))}\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchBlogsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n />\n </>\n )\n )}\n </div>\n </TabsContent>\n <TabsContent value={SearchPageTabType.PAGES} className=\"ipc_search_page_tabs_pages_content\">\n <div>\n {searchPagesResult?.map((page: any, index: number) => (\n <SearchPageItem key={(page.global_id || page.id) + index} page={page} searchValue={searchValue} />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchPagesResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n />\n </>\n )\n )}\n </TabsContent>\n </Tabs>\n </div>\n </div>\n )\n}\n\nexport default SearchPage\n"],
5
+ "mappings": "AAwEU,OAoEQ,YAAAA,EApER,OAAAC,EAKA,QAAAC,MALA,oBAxEV,OACE,WAAAC,EACA,QAAAC,EACA,YAAAC,EACA,eAAAC,EACA,eAAAC,EACA,QAAAC,EACA,WAAAC,EACA,QAAAC,EACA,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,EACf,EAEA,CAAC+D,GAAmB,QAClB7E,EAAAF,EAAA,CACE,UAAAC,EAACoD,EAAA,CAAmB,IAAKW,GAAM,eAAe,IAAK,MAAOA,GAAM,cAAe,EAC/E/D,EAACuD,EAAA,CACC,SAAUQ,GAAM,mBAAqB,CAAC,EACtC,WAAYL,EACZ,MAAOK,GAAM,uBACb,wBAAyB/B,EAC3B,GACF,GAGN,GACF,EACF,GACF,CAEJ,EAEA,IAAOuD,GAAQ1B",
6
6
  "names": ["Fragment", "jsx", "jsxs", "Heading", "Tabs", "TabsList", "TabsTrigger", "TabsContent", "Text", "Picture", "Link", "Button", "DropdownMenu", "DropdownMenuTrigger", "DropdownMenuContent", "DropdownMenuItem", "LoadingDots", "DownArrow", "useMemo", "useRef", "useState", "cn", "atobID", "highlightSearchWord", "useAiuiContext", "formatVariantPrice", "SearchPageTabType", "SearchProductItem", "product", "onSecondaryButton", "onPrimaryButton", "searchValue", "variantData", "shopNowLoadingProductId", "variant", "locale", "copyWriting", "isCurrentProductLoading", "listingLink", "coupon", "price", "basePrice", "tags", "item", "tag", "index", "e", "SearchBlogItem", "blog", "articleLink", "SearchPageItem", "page", "pageLink", "SearchPageNoResult", "url", "label", "SearchRecommendProducts", "products", "title", "buildProps", "buildProducts", "buildProduct", "SearchPage", "searchResult", "data", "onChangeSort", "loading", "searchResultCount", "onChangeTab", "currentTab", "setCurrentTab", "isInsertAdvertising", "isOpenSort", "setIsOpenSort", "currentSortKey", "setCurrentSortKey", "tab", "searchProductsResult", "searchBlogsResult", "searchPagesResult", "totalCount", "acc", "curr", "searchProductsResultWithAdvertising", "advertisingData", "defaultSortKey", "prev", "sortKey", "SearchPage_default"]
7
7
  }
@@ -1,10 +1,10 @@
1
- import{Fragment as ee,jsx as s,jsxs as u}from"react/jsx-runtime";import{useAiuiContext as te}from"../AiuiProvider/index.js";import{formatVariantPrice as se}from"./shelfDisplay.js";import X from"../../components/picture.js";import Y from"../../components/badge.js";import{cn as f}from"../../helpers/utils.js";import{Text as le}from"../../components/text.js";import E from"../../components/button.js";import{gaTrack as oe}from"../../shared/track.js";import{trackUrlRef as ie}from"../../shared/trackUrlRef.js";import{Heading as ae}from"../../components/heading.js";import{useExposure as ne}from"../../hooks/useExposure.js";import{useRef as re,useEffect as ce,useMemo as F,useState as Z}from"react";const M="image",R="product_shelf",V=999999999e-2,pe=e=>{const t=e?.sku,h=e?.variants,v=h?.find(k=>k?.sku===t),$=v?.image?.url||h?.[0]?.image?.url||"",w=v?.image?.altText||h?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:$,altText:w}},Se=({data:e,configuration:t})=>{const{isDisplayBackImage:h=!1,itemShape:v,metafields:$,isTopTag:w=!1,isShowTag:k,isShowOriginalPrice:g}=t||{},{locale:y="es",copyWriting:q,currencyDisplay:O}=te(),{discounts:U,discountsCopy:B}=$||{},z=re(null),[A,a]=Z([]),[D,G]=Z(""),H=(l,o,c,p)=>t?.event?.primaryButton?.(l,o+1,c,p),J=(l,o,c,p)=>t?.event?.secondaryButton?.(l,o+1,c,p),n=F(()=>{const l=e?.variants||[];if(l.length)return e?.sku?l?.find?.(o=>o?.sku===e?.sku)||l[0]:l?.[0]},[e?.sku,e?.variants]),m=n?.id?.split?.("/")||[],C=m?.[m?.length-1],I=!n?.availableForSale||n?.price?.amount===V||n?.price===V,x=n?.coupons?.[0],P=!!(g&&x),L=e?.price?.currencyCode||"USD",_=F(()=>se({locale:y,amount:P?x?.variant_price4wscode:n?.price,baseAmount:P?n?.price:0,currencyCode:L,currencyDisplay:O}),[L,y,P,x?.variant_price4wscode,n]),{price:j,basePrice:K,discount:S,discountAmount:d}=_,{imageUrl:N,altText:T}=pe(e),b=e?.custom_name||e?.title,W=e?.custom_description||e?.description,i=()=>{if(x?.value_type==="fixed_amount"){const l=d||"",o=l.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(o){const[,c,p,me]=o;let Q=p;return p.endsWith(".00")?Q=p.replace(/\.00$/,""):p.endsWith(",00")&&(Q=p.replace(/,00$/,"")),`${c}${Q}${me}`}return l}return S||""};ce(()=>{let l=[];if(S||d){const c=`${i()} ${U?.off||B?.off||""}`;G(c),l.push(c)}const o=e?.tags?.filter?.(c=>c?.startsWith?.("CLtag"))?.map?.(c=>c?.replace?.("CLtag:",""))?.slice?.(0,S?1:2);a(l.concat(o))},[e?.tags,S,d,U?.off,B?.off]),ne(z,{componentType:M,componentName:R,componentTitle:b,componentDescription:W,position:t?.index+1});const r=()=>u(ee,{children:[k&&A?.length>0?s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:A?.map?.((l,o)=>s(Y,{className:"shelf-items-tag",children:l},o))}):null,b?s(ae,{as:"h3",title:b||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] line-clamp-2 h-[48px]",html:b||""}):null,W?s(le,{size:2,className:"lg-desktop:text-lg desktop:text-base shelf-display-product-description line-clamp-1 text-sm",html:W||""}):null,s("div",{className:"mb-2 mt-4 flex items-center",children:I?s("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:q?.soldOutText}):u(ee,{children:[s("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:n?.availableForSale&&j||""}),s("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:n?.availableForSale&&K||""})]})}),u("div",{className:f("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?s(E,{variant:"secondary",onClick:()=>J(e,t?.index,t,x),className:`
1
+ import{Fragment as se,jsx as s,jsxs as d}from"react/jsx-runtime";import{useAiuiContext as le}from"../AiuiProvider/index.js";import{formatVariantPrice as oe}from"./shelfDisplay.js";import Z from"../../components/picture.js";import ee from"../../components/badge.js";import{cn as h}from"../../helpers/utils.js";import{Text as ie}from"../../components/text.js";import M from"../../components/button.js";import{gaTrack as ae}from"../../shared/track.js";import{trackUrlRef as ne}from"../../shared/trackUrlRef.js";import{Heading as re}from"../../components/heading.js";import{useExposure as ce}from"../../hooks/useExposure.js";import{useRef as pe,useEffect as me,useMemo as R,useState as te}from"react";const V="image",q="product_shelf",G=999999999e-2,de=e=>{const t=e?.sku,v=e?.variants,g=v?.find(w=>w?.sku===t),N=g?.image?.url||v?.[0]?.image?.url||"",$=g?.image?.altText||v?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:N,altText:$}},Ne=({data:e,configuration:t})=>{const{isDisplayBackImage:v=!1,itemShape:g,metafields:N,isTopTag:$=!1,isShowTag:w,isShowOriginalPrice:U,isShowShortTitle:y=!1}=t||{},{locale:b="es",copyWriting:J,currencyDisplay:z}=le(),{discounts:A,discountsCopy:B}=N||{},H=pe(null),[L,a]=te([]),[D,K]=te(""),E=(l,o,c,p)=>t?.event?.primaryButton?.(l,o+1,c,p),Q=(l,o,c,p)=>t?.event?.secondaryButton?.(l,o+1,c,p),n=R(()=>{const l=e?.variants||[];if(l.length)return e?.sku?l?.find?.(o=>o?.sku===e?.sku)||l[0]:l?.[0]},[e?.sku,e?.variants]),m=n?.id?.split?.("/")||[],C=m?.[m?.length-1],I=!n?.availableForSale||n?.price?.amount===G||n?.price===G,u=n?.coupons?.[0],P=!!(U&&u),F=e?.price?.currencyCode||"USD",k=R(()=>oe({locale:b,amount:P?u?.variant_price4wscode:n?.price,baseAmount:P?n?.price:0,currencyCode:F,currencyDisplay:z}),[F,b,P,u?.variant_price4wscode,n]),{price:j,basePrice:X,discount:_,discountAmount:f}=k,{imageUrl:S,altText:T}=de(e),x=e?.custom_name||e?.title,W=y&&n?.metafields?.infos?.page_short_title||x,O=e?.custom_description||e?.description,i=()=>{if(u?.value_type==="fixed_amount"){const l=f||"",o=l.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(o){const[,c,p,ue]=o;let Y=p;return p.endsWith(".00")?Y=p.replace(/\.00$/,""):p.endsWith(",00")&&(Y=p.replace(/,00$/,"")),`${c}${Y}${ue}`}return l}return _||""};me(()=>{let l=[];if(_||f){const c=`${i()} ${A?.off||B?.off||""}`;K(c),l.push(c)}const o=e?.tags?.filter?.(c=>c?.startsWith?.("CLtag"))?.map?.(c=>c?.replace?.("CLtag:",""))?.slice?.(0,_?1:2);a(l.concat(o))},[e?.tags,_,f,A?.off,B?.off]),ce(H,{componentType:V,componentName:q,componentTitle:x,componentDescription:O,position:t?.index+1});const r=()=>d(se,{children:[w&&L?.length>0?s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:L?.map?.((l,o)=>s(ee,{className:"shelf-items-tag",children:l},o))}):null,W?s(re,{as:"h3",title:W||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] line-clamp-2 h-12",html:W||""}):null,O?s(ie,{size:2,className:"lg-desktop:text-lg desktop:text-base shelf-display-product-description line-clamp-1 text-sm",html:O||""}):null,s("div",{className:"mb-2 mt-4 flex items-center",children:I?s("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:J?.soldOutText}):d(se,{children:[s("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:n?.availableForSale&&j||""}),s("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:n?.availableForSale&&X||""})]})}),d("div",{className:h("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?s(M,{variant:"secondary",onClick:()=>Q(e,t?.index,t,u),className:`
2
2
  ${t.direction==="vertical"?"w-full":""}
3
- `,children:t?.secondaryButton||""}):null,t?.primaryButton?s(E,{disabled:I,variant:"primary",onClick:()=>H(e,t?.index,t,x),className:`
3
+ `,children:t?.secondaryButton||""}):null,t?.primaryButton?s(M,{disabled:I,variant:"primary",onClick:()=>E(e,t?.index,t,u),className:`
4
4
  ${t.direction==="vertical"?"w-full":""}
5
- `,children:t?.primaryButton||""}):null]})]});return s("div",{ref:z,className:f("bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300",v==="round"?"rounded-2xl":"rounded-none","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]","laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative","md-tablet:h-[360px] shelf-display-item"),children:h?s("div",{className:"absolute inset-0 box-border overflow-hidden",children:u("div",{className:"relative inset-0 size-full",children:[s(X,{source:N,alt:T,className:"flex h-full justify-center object-cover [&_img]:w-auto"}),s("div",{className:"desktop:p-6 absolute inset-x-0 bottom-0 box-border overflow-hidden p-4",children:r()})]})}):u("div",{className:"desktop:p-6 absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4",children:[D&&w&&s(Y,{className:"shelf-prices-tag absolute left-4 top-4 z-10",children:D||""}),s("div",{className:f("lg-desktop:h-[195px] shelf-display-item-image relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden"),children:s("a",{"aria-label":b,target:t?.target,href:ie(`${y==="us"||!y?"":`/${y}`}/products/${e?.handle}?variant=${C}`,`${M}_${R}`),onClick:()=>{oe({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||n?.sku,item_name:e?.name,item_variant:n?.name,price:n?.price,index:t?.index+1}]}})},children:s(X,{source:N,alt:T,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),r()]})},e?.id||e?.handle)},Ne=({data:e,configuration:t})=>{const{itemShape:h,itemLength:v,metafields:$}=t||{},{discounts:w,discountsCopy:k}=$||{},{locale:g="us",copyWriting:y,currencyDisplay:q}=te(),[O,U]=Z([]),B=re(null),z=(i,r,l,o)=>t?.event?.primaryButton?.(i,r+1,l,o),A=(i,r,l,o)=>t?.event?.secondaryButton?.(i,r+1,l,o),a=F(()=>{const i=e?.variants||[];if(i.length)return e?.sku&&i.find(r=>r?.sku===e?.sku)||i[0]},[e?.sku,e?.variants]),D=a?.id?.split?.("/")||[],G=D?.[D?.length-1],H=!a?.availableForSale||a?.price?.amount===V||a?.price===V,J=t?.isShowTag,n=t?.isShowOriginalPrice,m=a?.coupons?.[0],C=!!(n&&m),I=e?.price?.currencyCode||"USD",x=F(()=>se({locale:g,amount:C?m?.variant_price4wscode:a?.price,baseAmount:C?a?.price:0,currencyCode:I,currencyDisplay:q}),[I,g,C,m?.variant_price4wscode,a]),{price:P,basePrice:L,discount:_,discountAmount:j}=x,{imageUrl:K,altText:S}=pe(e),d=e?.custom_name||e?.title,N=e?.custom_description||e?.description;ne(B,{componentType:M,componentName:R,componentTitle:d,componentDescription:N,position:t?.index+1});const T=()=>v>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},b=()=>v>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col",W=()=>{if(m?.value_type==="fixed_amount"){const i=j||"",r=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(r){const[,l,o,c]=r;let p=o;return o.endsWith(".00")?p=o.replace(/\.00$/,""):o.endsWith(",00")&&(p=o.replace(/,00$/,"")),`${l}${p}${c}`}return i}return _||""};return ce(()=>{let i=[];if(_||j){const l=`${W()} ${w?.off||k?.off||""}`;i.push(l)}const r=e?.tags?.filter?.(l=>l?.startsWith?.("CLtag"))?.map?.(l=>l?.replace?.("CLtag:",""))?.slice?.(0,_?1:2);U(i.concat(r))},[e?.tags,_,j,w?.off,k?.off]),s("div",{ref:B,className:f(T().wrap,h==="round"?"rounded-2xl":"rounded-none","shelf-display-item","bg-container-secondary-1 tablet:hover:bg-info-white gap-6 duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden"),children:u("div",{className:f(b(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[s("div",{className:f(T().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden"),children:s("a",{"aria-label":d,target:t?.target,href:ie(`${g==="us"||!g?"":`/${g}`}/products/${e?.handle}?variant=${G}`,`${M}_${R}`),onClick:()=>{oe({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||a?.sku,item_name:e?.name,item_variant:a?.name,price:a?.price,index:t?.index+1}]}})},children:s(X,{source:K,alt:S,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),u("div",{className:f("flex flex-col items-start justify-center",T().boxItem),children:[J&&s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:O?.length>0&&O?.map?.((i,r)=>s(Y,{className:"shelf-items-tag",children:i},r))}),d?s(ae,{as:"h3",title:d||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] mb-1 line-clamp-2 h-[48px]",html:d||""}):null,N?s(le,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description line-clamp-1 h-5 text-sm",html:N||""}):null,s("div",{className:"mb-2 mt-5 flex items-center",children:H?s("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:y?.soldOutText}):u(ee,{children:[s("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:a?.availableForSale&&P||""}),s("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:a?.availableForSale&&L||""})]})}),u("div",{className:f("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?s(E,{variant:"secondary",onClick:()=>A(e,t?.index,t,m),className:`
5
+ `,children:t?.primaryButton||""}):null]})]});return s("div",{ref:H,className:h("bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300",g==="round"?"rounded-2xl":"rounded-none","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]","laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative","md-tablet:h-[360px] shelf-display-item"),children:v?s("div",{className:"absolute inset-0 box-border overflow-hidden",children:d("div",{className:"relative inset-0 size-full",children:[s(Z,{source:S,alt:T,className:"flex h-full justify-center object-cover [&_img]:w-auto"}),s("div",{className:"desktop:p-6 absolute inset-x-0 bottom-0 box-border overflow-hidden p-4",children:r()})]})}):d("div",{className:"desktop:p-6 absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4",children:[D&&$&&s(ee,{className:"shelf-prices-tag absolute left-4 top-4 z-10",children:D||""}),s("div",{className:h("lg-desktop:h-[195px] shelf-display-item-image relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden"),children:s("a",{"aria-label":x,target:t?.target,href:ne(`${b==="us"||!b?"":`/${b}`}/products/${e?.handle}?variant=${C}`,`${V}_${q}`),onClick:()=>{ae({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||n?.sku,item_name:e?.name,item_variant:n?.name,price:n?.price,index:t?.index+1}]}})},children:s(Z,{source:S,alt:T,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),r()]})},e?.id||e?.handle)},$e=({data:e,configuration:t})=>{const{itemShape:v,itemLength:g,metafields:N,isShowShortTitle:$}=t||{},{discounts:w,discountsCopy:U}=N||{},{locale:y="us",copyWriting:b,currencyDisplay:J}=le(),[z,A]=te([]),B=pe(null),H=(i,r,l,o)=>t?.event?.primaryButton?.(i,r+1,l,o),L=(i,r,l,o)=>t?.event?.secondaryButton?.(i,r+1,l,o),a=R(()=>{const i=e?.variants||[];if(i.length)return e?.sku&&i.find(r=>r?.sku===e?.sku)||i[0]},[e?.sku,e?.variants]),D=a?.id?.split?.("/")||[],K=D?.[D?.length-1],E=!a?.availableForSale||a?.price?.amount===G||a?.price===G,Q=t?.isShowTag,n=t?.isShowOriginalPrice,m=a?.coupons?.[0],C=!!(n&&m),I=e?.price?.currencyCode||"USD",u=R(()=>oe({locale:y,amount:C?m?.variant_price4wscode:a?.price,baseAmount:C?a?.price:0,currencyCode:I,currencyDisplay:J}),[I,y,C,m?.variant_price4wscode,a]),{price:P,basePrice:F,discount:k,discountAmount:j}=u,{imageUrl:X,altText:_}=de(e),f=e?.custom_name||e?.title,S=$&&a?.metafields?.infos?.page_short_title||f,T=e?.custom_description||e?.description;ce(B,{componentType:V,componentName:q,componentTitle:f,componentDescription:T,position:t?.index+1});const x=()=>g>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},W=()=>g>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col",O=()=>{if(m?.value_type==="fixed_amount"){const i=j||"",r=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(r){const[,l,o,c]=r;let p=o;return o.endsWith(".00")?p=o.replace(/\.00$/,""):o.endsWith(",00")&&(p=o.replace(/,00$/,"")),`${l}${p}${c}`}return i}return k||""};return me(()=>{let i=[];if(k||j){const l=`${O()} ${w?.off||U?.off||""}`;i.push(l)}const r=e?.tags?.filter?.(l=>l?.startsWith?.("CLtag"))?.map?.(l=>l?.replace?.("CLtag:",""))?.slice?.(0,k?1:2);A(i.concat(r))},[e?.tags,k,j,w?.off,U?.off]),s("div",{ref:B,className:h(x().wrap,v==="round"?"rounded-2xl":"rounded-none","shelf-display-item","bg-container-secondary-1 tablet:hover:bg-info-white gap-6 duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden"),children:d("div",{className:h(W(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[s("div",{className:h(x().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden"),children:s("a",{"aria-label":f,target:t?.target,href:ne(`${y==="us"||!y?"":`/${y}`}/products/${e?.handle}?variant=${K}`,`${V}_${q}`),onClick:()=>{ae({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||a?.sku,item_name:e?.name,item_variant:a?.name,price:a?.price,index:t?.index+1}]}})},children:s(Z,{source:X,alt:_,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),d("div",{className:h("flex flex-col items-start justify-center",x().boxItem),children:[Q&&s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:z?.length>0&&z?.map?.((i,r)=>s(ee,{className:"shelf-items-tag",children:i},r))}),S?s(re,{as:"h3",title:S||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] mb-1 line-clamp-2 h-[48px]",html:S||""}):null,T?s(ie,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description line-clamp-1 h-5 text-sm",html:T||""}):null,s("div",{className:"mb-2 mt-5 flex items-center",children:E?s("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:b?.soldOutText}):d(se,{children:[s("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:a?.availableForSale&&P||""}),s("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:a?.availableForSale&&F||""})]})}),d("div",{className:h("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?s(M,{variant:"secondary",onClick:()=>L(e,t?.index,t,m),className:`
6
6
  ${t.direction==="vertical"?"w-full":""}
7
- `,children:t?.secondaryButton||""}):null,t?.primaryButton?s(E,{disabled:H,variant:"primary",onClick:()=>z(e,t?.index,t,m),className:`
7
+ `,children:t?.secondaryButton||""}):null,t?.primaryButton?s(M,{disabled:E,variant:"primary",onClick:()=>H(e,t?.index,t,m),className:`
8
8
  ${t.direction==="vertical"?"w-full":""}
9
- `,children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};export{Ne as ShelfDisplayHorizontalItem,Se as ShelfDisplayWrapItem,pe as getProductImage};
9
+ `,children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};export{$e as ShelfDisplayHorizontalItem,Ne as ShelfDisplayWrapItem,de as getProductImage};
10
10
  //# sourceMappingURL=shelfDisplayItem.js.map