@anker-in/headless-ui 1.3.87 → 1.3.88

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 (123) hide show
  1. package/CONTRIBUTING.md +57 -0
  2. package/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +4 -1
  3. package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
  4. package/dist/cjs/biz-components/ActiveShelf/index.d.ts +2 -2
  5. package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
  6. package/dist/cjs/biz-components/ActiveShelf/types.d.ts +12 -1
  7. package/dist/cjs/biz-components/ActiveShelf/types.js +1 -1
  8. package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
  9. package/dist/cjs/biz-components/AiuiProvider/index.d.ts +28 -0
  10. package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
  11. package/dist/cjs/biz-components/BrandEquity/BrandEquity.d.ts +2 -0
  12. package/dist/cjs/biz-components/BrandEquity/BrandEquity.js +1 -1
  13. package/dist/cjs/biz-components/BrandEquity/types.d.ts +2 -0
  14. package/dist/cjs/biz-components/BrandEquity/types.js +1 -1
  15. package/dist/cjs/biz-components/Chat/button.js +1 -1
  16. package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
  17. package/dist/cjs/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
  18. package/dist/cjs/biz-components/HeroBanner/types.d.ts +12 -6
  19. package/dist/cjs/biz-components/HeroBanner/types.js +1 -1
  20. package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
  21. package/dist/cjs/biz-components/ImageWithText/types.d.ts +8 -2
  22. package/dist/cjs/biz-components/ImageWithText/types.js +1 -1
  23. package/dist/cjs/biz-components/Ksp/index.d.ts +2 -0
  24. package/dist/cjs/biz-components/Ksp/index.js +1 -1
  25. package/dist/cjs/biz-components/MarqueeReview/index.js +1 -1
  26. package/dist/cjs/biz-components/MediaPlayerBase/index.js +1 -1
  27. package/dist/cjs/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.js +2 -2
  28. package/dist/cjs/biz-components/ProductCompare/index.d.ts +1 -1
  29. package/dist/cjs/biz-components/ProductCompare/index.js +1 -1
  30. package/dist/cjs/biz-components/ProductHero/ProductHero.js +1 -1
  31. package/dist/cjs/biz-components/ProductHero/types.d.ts +2 -0
  32. package/dist/cjs/biz-components/ProductHero/types.js +1 -1
  33. package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
  34. package/dist/cjs/biz-components/ProductNav/types.d.ts +5 -2
  35. package/dist/cjs/biz-components/ProductNav/types.js +1 -1
  36. package/dist/cjs/biz-components/SecondaryBanner/index.d.ts +5 -4
  37. package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
  38. package/dist/cjs/biz-components/Specs/dropdown.js +1 -2
  39. package/dist/cjs/biz-components/Specs/index.js +1 -1
  40. package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
  41. package/dist/cjs/biz-components/index.d.ts +1 -0
  42. package/dist/cjs/biz-components/index.js +1 -1
  43. package/dist/cjs/components/link.js +1 -1
  44. package/dist/cjs/hooks/useBoaButton.d.ts +27 -0
  45. package/dist/cjs/hooks/useBoaButton.js +1 -0
  46. package/dist/cjs/hooks/useDraggableScroll.js +1 -1
  47. package/dist/cjs/hooks/useExposure.d.ts +1 -1
  48. package/dist/cjs/hooks/useExposure.js +1 -1
  49. package/dist/cjs/hooks/useViewItemList.d.ts +1 -1
  50. package/dist/cjs/index.d.ts +10 -2
  51. package/dist/cjs/index.js +1 -1
  52. package/dist/cjs/shared/ContainerGridContext.d.ts +20 -0
  53. package/dist/cjs/shared/ContainerGridContext.js +1 -0
  54. package/dist/cjs/shared/Styles.d.ts +2 -0
  55. package/dist/cjs/shared/Styles.js +1 -1
  56. package/dist/cjs/shared/adTrack.d.ts +38 -0
  57. package/dist/cjs/shared/adTrack.js +1 -0
  58. package/dist/cjs/shared/amazonAttribution.d.ts +31 -0
  59. package/dist/cjs/shared/amazonAttribution.js +1 -0
  60. package/dist/cjs/shared/mediaGridSpec.d.ts +87 -0
  61. package/dist/cjs/shared/mediaGridSpec.js +1 -0
  62. package/dist/cjs/stories/BoaStoryProvider.d.ts +10 -0
  63. package/dist/cjs/stories/BoaStoryProvider.js +1 -0
  64. package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +4 -1
  65. package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
  66. package/dist/esm/biz-components/ActiveShelf/index.d.ts +2 -2
  67. package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
  68. package/dist/esm/biz-components/ActiveShelf/types.d.ts +12 -1
  69. package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
  70. package/dist/esm/biz-components/AiuiProvider/index.d.ts +28 -0
  71. package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
  72. package/dist/esm/biz-components/BrandEquity/BrandEquity.d.ts +2 -0
  73. package/dist/esm/biz-components/BrandEquity/BrandEquity.js +1 -1
  74. package/dist/esm/biz-components/BrandEquity/types.d.ts +2 -0
  75. package/dist/esm/biz-components/Chat/button.js +1 -1
  76. package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
  77. package/dist/esm/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
  78. package/dist/esm/biz-components/HeroBanner/types.d.ts +12 -6
  79. package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
  80. package/dist/esm/biz-components/ImageWithText/types.d.ts +8 -2
  81. package/dist/esm/biz-components/Ksp/index.d.ts +2 -0
  82. package/dist/esm/biz-components/Ksp/index.js +1 -1
  83. package/dist/esm/biz-components/MarqueeReview/index.js +1 -1
  84. package/dist/esm/biz-components/MediaPlayerBase/index.js +1 -1
  85. package/dist/esm/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.js +2 -2
  86. package/dist/esm/biz-components/ProductCompare/index.d.ts +1 -1
  87. package/dist/esm/biz-components/ProductCompare/index.js +1 -1
  88. package/dist/esm/biz-components/ProductHero/ProductHero.js +1 -1
  89. package/dist/esm/biz-components/ProductHero/types.d.ts +2 -0
  90. package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
  91. package/dist/esm/biz-components/ProductNav/types.d.ts +5 -2
  92. package/dist/esm/biz-components/SecondaryBanner/index.d.ts +5 -4
  93. package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
  94. package/dist/esm/biz-components/Specs/dropdown.js +1 -2
  95. package/dist/esm/biz-components/Specs/index.js +1 -1
  96. package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
  97. package/dist/esm/biz-components/index.d.ts +1 -0
  98. package/dist/esm/biz-components/index.js +1 -1
  99. package/dist/esm/components/link.js +1 -1
  100. package/dist/esm/hooks/useBoaButton.d.ts +27 -0
  101. package/dist/esm/hooks/useBoaButton.js +1 -0
  102. package/dist/esm/hooks/useDraggableScroll.js +1 -1
  103. package/dist/esm/hooks/useExposure.d.ts +1 -1
  104. package/dist/esm/hooks/useExposure.js +1 -1
  105. package/dist/esm/hooks/useViewItemList.d.ts +1 -1
  106. package/dist/esm/index.d.ts +10 -2
  107. package/dist/esm/index.js +1 -1
  108. package/dist/esm/shared/ContainerGridContext.d.ts +20 -0
  109. package/dist/esm/shared/ContainerGridContext.js +1 -0
  110. package/dist/esm/shared/Styles.d.ts +2 -0
  111. package/dist/esm/shared/Styles.js +1 -1
  112. package/dist/esm/shared/adTrack.d.ts +38 -0
  113. package/dist/esm/shared/adTrack.js +1 -0
  114. package/dist/esm/shared/amazonAttribution.d.ts +31 -0
  115. package/dist/esm/shared/amazonAttribution.js +1 -0
  116. package/dist/esm/shared/mediaGridSpec.d.ts +87 -0
  117. package/dist/esm/shared/mediaGridSpec.js +1 -0
  118. package/dist/esm/stories/BoaStoryProvider.d.ts +10 -0
  119. package/dist/esm/stories/BoaStoryProvider.js +1 -0
  120. package/dist/tokens/base.css +22 -1
  121. package/package.json +5 -2
  122. package/style.css +250 -136
  123. package/tailwind.config.js +5 -0
@@ -17,6 +17,8 @@ export interface ProductHeroProps {
17
17
  modelSrc?: string;
18
18
  /** 主题,默认 light */
19
19
  theme?: Theme;
20
+ /** 栅格变体:'10'(默认)内容/图片=40%/60%;'12' 内容/图片=5/12 / 7/12。决定内部比例与图片尺寸。 */
21
+ gridVariant?: '10' | '12';
20
22
  };
21
23
  /** 自定义类名 */
22
24
  className?: string;
@@ -1 +1 @@
1
- "use client";import{jsx as o,jsxs as c}from"react/jsx-runtime";import{useState as _,useEffect as y,useCallback as q,forwardRef as U,useImperativeHandle as W,useRef as h}from"react";import{cn as $}from"../../helpers/utils.js";import{withLayout as J}from"../../shared/Styles.js";import{Button as I,Link as K,Text as A}from"../../components/index.js";import{useExposure as Q}from"../../hooks/useExposure.js";import{useTracking as X}from"../../hooks/useTracking.js";import{trackUrlRef as Z}from"../../shared/trackUrlRef.js";import{toPlainTrackingText as T}from"../../shared/track.js";import*as C from"@radix-ui/react-popover";const N="navigation",E="product_nav",P=d=>d.anchorId??d.id??"",ee=d=>o("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d,children:o("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})}),L=U(({className:d="",data:B,id:z,onAnchorClick:D,scrollOffsetExtra:R=0},j)=>{const{tabLinks:p=[],anchorList:s=[],textLink:i,buyBtn:a,theme:Y="light"}=B||{},{buildRef:F}=X(),u=(e,t,n=1)=>({href:Z(e,F(N,E)),"data-headless-type-name":`${N}#${E}`,"data-headless-title-desc-button":`##${T(t)}`,"data-headless-nav-position":`${T(t)}#${n}`}),[G,g]=_(""),f=h(null),w=h(!1),v=h(""),x=h(null),S=h(new Map);W(j,()=>f.current),Q(f,{componentType:N,componentName:E,componentTitle:[...p.map(e=>e.label),...s.map(e=>e.label)].join(" | "),componentDescription:a?.text??i?.text??""});const b=q(()=>{if(s.length===0)return;const e=window.scrollY;window.scrollTo({top:0,behavior:"instant"}),requestAnimationFrame(()=>{const t=new Map;s.forEach(n=>{const r=P(n),l=document.getElementById(r);if(l){const k=l.getBoundingClientRect();t.set(r,k.top+window.scrollY)}}),S.current=t,window.scrollTo({top:e,behavior:"instant"})})},[s]);y(()=>{if(s.length===0)return;const e=setTimeout(b,100);return()=>clearTimeout(e)},[s,b]),y(()=>{if(s.length===0)return;let e=null;const t=new ResizeObserver(()=>{e&&clearTimeout(e),e=setTimeout(b,150)});return t.observe(document.body),()=>{t.disconnect(),e&&clearTimeout(e)}},[s,b]),y(()=>{if(s.length===0)return;const e=()=>{if(w.current){x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{w.current=!1,v.current&&(g(v.current),v.current="")},100);return}const n=f.current?.offsetHeight||0,r=window.scrollY+n+R+10;let l="";const k=S.current;for(let m=s.length-1;m>=0;m--){const V=s[m],M=P(V),H=k.get(M);if(H!==void 0&&r>=H){l=M;break}}if(!l&&s.length>0){const m=k.get(P(s[0]));m!==void 0&&r<m&&(l="")}g(l)},t=setTimeout(()=>{e()},200);return window.addEventListener("scroll",e,{passive:!0}),()=>{clearTimeout(t),window.removeEventListener("scroll",e),x.current&&clearTimeout(x.current)}},[s,R]),y(()=>{const e=document.querySelectorAll(".header"),t=[];return e.forEach(n=>{const r=n;t.push({element:r,originalPosition:r.style.position||getComputedStyle(r).position}),r.style.position="relative"}),()=>{t.forEach(({element:n,originalPosition:r})=>{n.style.position=r==="static"?"":r})}},[]);const O=(e,t)=>{e.preventDefault();const n=S.current.get(t);if(n===void 0){console.warn(`Cached position for "${t}" not found`);return}g(t),v.current=t,w.current=!0;const r=f.current?.offsetHeight||0,l=n-r-R;window.scrollTo({top:l,behavior:"smooth"}),window.history.pushState(null,"",`#${t}`)};return c("div",{id:z,ref:f,className:$("product-nav text-info-primary bg-container-primary px-grid !sticky top-0 !z-[51] flex w-full justify-between overflow-hidden py-0",{"aiui-dark":Y==="dark"},d),children:[c("div",{className:"product-nav-main desktop:flex-row desktop:gap-[48px] flex w-full flex-col justify-start",children:[c("div",{className:"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] pt-[14px]",children:[c("div",{className:"product-nav-tabs flex flex-row items-center gap-[8px]",children:[p.map((e,t)=>c("div",{className:"product-nav-tab-item flex items-center gap-[8px]",children:[o("a",{...u(e.link,e.label,p.indexOf(e)+1),className:$("product-nav-tab-link hover:text-brand-color text-nowrap text-[14px] font-bold tracking-[-0.04em]",{"text-[#6D6D6F]":t!==0,"hidden desktop:block":t===1}),children:o("span",{children:e.label})}),t!==p.length-1&&o("div",{className:"product-nav-tab-divider desktop:inline-block hidden h-[14px] w-px bg-[#E4E5E6]"})]},e.link||t)),p.length>1&&c(C.Root,{children:[o(C.Trigger,{asChild:!0,children:o("button",{className:"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block","aria-label":"More products",children:o(ee,{className:"text-[#1D1D1F]"})})}),o(C.Content,{className:"product-nav-dropdown-content rounded-[6px] border border-[#E4E5E6] bg-white p-[6px] px-[8px] py-[4px]",style:{boxShadow:"0px 4px 8px 0px rgba(0,0,0,0.12)"},side:"bottom",align:"end",alignOffset:10,sideOffset:10,children:p.slice(1).map(e=>o("a",{...u(e.link,e.label,p.indexOf(e)+1),className:"product-nav-dropdown-link hover:text-brand-color text-nowrap",children:o("span",{children:e.label})},e.link))})]})]}),c("div",{className:"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]",children:[i?.link&&o("a",{...u(i.link,i.text),target:i.target||"_self",className:"product-nav-text-link hover:text-brand-color cursor-pointer",children:o(A,{size:2,className:"text-nowrap",children:i.text})}),a?.link&&o(I,{as:"a",...u(a.link,a.text),size:"sm",className:"product-nav-buy-button text-nowrap",children:a.text})]})]}),o("div",{className:"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[12px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:s.map((e,t)=>{const n=P(e);return c("a",{href:`#${n}`,className:"product-nav-anchor-link","data-headless-type-name":`${N}#${E}`,"data-headless-title-desc-button":`##${T(e.label)}`,"data-headless-nav-position":`${T(e.label)}#${t+1}`,onClick:r=>{D?(r.preventDefault(),g(n),v.current=n,w.current=!0,D(e,t)):O(r,n)},children:[o(A,{size:2,className:"product-nav-anchor-text text-nowrap",children:e.label}),o("div",{className:$("product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent",{"!bg-brand-0":G===n})})]},n)})})]}),c("div",{className:"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]",children:[i?.link&&o(K,{...u(i.link,i.text),target:i.target||"_self",className:"product-nav-text-link no-underline",children:o(A,{size:2,className:"text-nowrap",children:i.text})}),a?.link&&o(I,{as:"a",...u(a.link,a.text),size:"sm",className:"product-nav-buy-button text-nowrap",children:a.text})]})]})});L.displayName="ProductNav";var ce=J(L);export{ce as default};
1
+ "use client";import{jsx as n,jsxs as d}from"react/jsx-runtime";import{useState as ae,useEffect as B,useCallback as se,forwardRef as ie,useImperativeHandle as le,useRef as w}from"react";import{cn as I}from"../../helpers/utils.js";import{withLayout as ce}from"../../shared/Styles.js";import{Button as K,Text as D}from"../../components/index.js";import{useExposure as de}from"../../hooks/useExposure.js";import{useBoaButton as pe}from"../../hooks/useBoaButton.js";import{useTracking as ue}from"../../hooks/useTracking.js";import{trackUrlRef as _}from"../../shared/trackUrlRef.js";import{toPlainTrackingText as P}from"../../shared/track.js";import*as j from"@radix-ui/react-popover";const v="navigation",p="product_nav",R=m=>m.anchorId??m.id??"",me=m=>n("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...m,children:n("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})}),Q=ie(({className:m="",data:X,id:Z,onAnchorClick:Y,scrollOffsetExtra:C=0},ee)=>{const{tabLinks:u=[],anchorList:i=[],textLink:a,buyBtn:s,theme:te="light"}=X||{},{buildRef:E}=ue(),f=(e,t,o=1)=>({href:_(e,E(v,p)),"data-headless-type-name":`${v}#${p}`,"data-headless-title-desc-button":`##${P(t)}`,"data-headless-nav-position":`${P(t)}#${o}`}),[ne,y]=ae(""),k=w(null),T=w(!1),g=w(""),b=w(null),S=w(new Map);le(ee,()=>k.current);const{resolveLink:G,trackAd:O,hasAdTrack:N}=pe(),l=G(a?.link,a),h=G(s?.link,s),L=l.isAmazon?l.href:_(l.href,E(v,p)),$=h.isAmazon?h.href:_(h.href,E(v,p)),H=a?.target??(l.isAmazon?"_blank":"_self"),M=s?.target??(h.isAmazon?"_blank":void 0),V=M==="_blank"?"noopener noreferrer":void 0,q=l.isAmazon&&H==="_blank"?"noopener noreferrer":void 0,F=()=>O(a,{componentName:p,buttonPosition:"text_link",buttonText:a?.text,href:L}),U=()=>O(s,{componentName:p,buttonPosition:"buy",buttonText:s?.text,href:$});de(k,{componentType:v,componentName:p,componentTitle:[...u.map(e=>e.label),...i.map(e=>e.label)].join(" | "),componentDescription:s?.text??a?.text??""});const z=se(()=>{if(i.length===0)return;const e=window.scrollY;window.scrollTo({top:0,behavior:"instant"}),requestAnimationFrame(()=>{const t=new Map;i.forEach(o=>{const r=R(o),c=document.getElementById(r);if(c){const A=c.getBoundingClientRect();t.set(r,A.top+window.scrollY)}}),S.current=t,window.scrollTo({top:e,behavior:"instant"})})},[i]);B(()=>{if(i.length===0)return;const e=setTimeout(z,100);return()=>clearTimeout(e)},[i,z]),B(()=>{if(i.length===0)return;let e=null;const t=new ResizeObserver(()=>{e&&clearTimeout(e),e=setTimeout(z,150)});return t.observe(document.body),()=>{t.disconnect(),e&&clearTimeout(e)}},[i,z]),B(()=>{if(i.length===0)return;const e=()=>{if(T.current){b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{T.current=!1,g.current&&(y(g.current),g.current="")},100);return}const o=k.current?.offsetHeight||0,r=window.scrollY+o+C+10;let c="";const A=S.current;for(let x=i.length-1;x>=0;x--){const re=i[x],W=R(re),J=A.get(W);if(J!==void 0&&r>=J){c=W;break}}if(!c&&i.length>0){const x=A.get(R(i[0]));x!==void 0&&r<x&&(c="")}y(c)},t=setTimeout(()=>{e()},200);return window.addEventListener("scroll",e,{passive:!0}),()=>{clearTimeout(t),window.removeEventListener("scroll",e),b.current&&clearTimeout(b.current)}},[i,C]),B(()=>{const e=document.querySelectorAll(".header"),t=[];return e.forEach(o=>{const r=o;t.push({element:r,originalPosition:r.style.position||getComputedStyle(r).position}),r.style.position="relative"}),()=>{t.forEach(({element:o,originalPosition:r})=>{o.style.position=r==="static"?"":r})}},[]);const oe=(e,t)=>{e.preventDefault();const o=S.current.get(t);if(o===void 0){console.warn(`Cached position for "${t}" not found`);return}y(t),g.current=t,T.current=!0;const r=k.current?.offsetHeight||0,c=o-r-C;window.scrollTo({top:c,behavior:"smooth"}),window.history.pushState(null,"",`#${t}`)};return d("div",{id:Z,ref:k,className:I("product-nav text-info-primary bg-info-white px-grid !sticky top-0 !z-[51] flex w-full justify-between overflow-hidden py-0",{"aiui-dark":te==="dark"},m),children:[d("div",{className:"product-nav-main desktop:flex-row desktop:gap-[32px] lg-desktop:gap-[48px] flex w-full flex-col justify-start",children:[d("div",{className:"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] py-[6px]",children:[d("div",{className:"product-nav-tabs flex flex-row items-center gap-[8px]",children:[u.map((e,t)=>d("div",{className:"product-nav-tab-item flex items-center gap-[8px]",children:[n("a",{...f(e.link,e.label,u.indexOf(e)+1),className:I("product-nav-tab-link hover:text-brand-color desktop:text-[16px] lg-desktop:text-[18px] text-nowrap text-[14px] font-bold tracking-[-0.04em]",{"text-info-tertiary":t!==0,"hidden desktop:block":t===1}),children:n("span",{children:e.label})}),t!==u.length-1&&n("div",{className:"product-nav-tab-divider desktop:inline-block bg-lines hidden h-[14px] w-px"})]},e.link||t)),u.length>1&&d(j.Root,{children:[n(j.Trigger,{asChild:!0,children:n("button",{className:"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block","aria-label":"More products",children:n(me,{className:"text-info-primary"})})}),n(j.Content,{className:"product-nav-dropdown-content border-lines bg-info-white rounded-[6px] border p-[6px] px-[8px] py-[4px]",style:{boxShadow:"0px 4px 8px 0px rgba(0,0,0,0.12)"},side:"bottom",align:"end",alignOffset:10,sideOffset:10,children:u.slice(1).map(e=>n("a",{...f(e.link,e.label,u.indexOf(e)+1),className:"product-nav-dropdown-link hover:text-brand-color text-nowrap",children:n("span",{children:e.label})},e.link))})]})]}),d("div",{className:"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]",children:[a?.link&&n("a",{...f(a.link,a.text),href:L,target:H,rel:q,onClick:F,"data-headless-ad-track":N(a)?"true":void 0,"data-headless-amazon":l.isAmazon?"true":void 0,"data-headless-amazon-style":l.isAmazon?"link":void 0,className:"product-nav-text-link hover:text-brand-color cursor-pointer",children:n(D,{size:2,className:"text-nowrap",children:a.text})}),s?.link&&n(K,{as:"a",...f(s.link,s.text),href:$,target:M,rel:V,onClick:U,"data-headless-ad-track":N(s)?"true":void 0,"data-headless-amazon":h.isAmazon?"true":void 0,size:"sm",className:"product-nav-buy-button text-nowrap",children:s.text})]})]}),n("div",{className:"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[6px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:i.map((e,t)=>{const o=R(e);return d("a",{href:`#${o}`,className:"product-nav-anchor-link","data-headless-type-name":`${v}#${p}`,"data-headless-title-desc-button":`##${P(e.label)}`,"data-headless-nav-position":`${P(e.label)}#${t+1}`,onClick:r=>{Y?(r.preventDefault(),y(o),g.current=o,T.current=!0,Y(e,t)):oe(r,o)},children:[n(D,{size:2,className:"product-nav-anchor-text text-nowrap",children:e.label}),n("div",{className:I("product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent",{"!bg-brand-0":ne===o})})]},o)})})]}),d("div",{className:"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]",children:[a?.link&&n("a",{...f(a.link,a.text),href:L,target:H,rel:q,onClick:F,"data-headless-ad-track":N(a)?"true":void 0,"data-headless-amazon":l.isAmazon?"true":void 0,"data-headless-amazon-style":l.isAmazon?"link":void 0,className:"product-nav-text-link hover:text-brand-color text-info-primary cursor-pointer",children:n(D,{size:2,className:"text-nowrap",children:a.text})}),s?.link&&n(K,{as:"a",...f(s.link,s.text),href:$,target:M,rel:V,onClick:U,"data-headless-ad-track":N(s)?"true":void 0,"data-headless-amazon":h.isAmazon?"true":void 0,size:"sm",className:"product-nav-buy-button text-nowrap",children:s.text})]})]})});Q.displayName="ProductNav";var Te=ce(Q);export{Te as default};
@@ -1,4 +1,5 @@
1
1
  import type { ComponentCommonProps, Theme } from '../../types/props.js';
2
+ import type { BoaButtonFields } from '../../hooks/useBoaButton.js';
2
3
  export interface TabLink {
3
4
  link: string;
4
5
  label: string;
@@ -9,11 +10,13 @@ export interface AnchorItem {
9
10
  anchorId?: string;
10
11
  label: string;
11
12
  }
12
- export interface BuyButton {
13
+ export interface BuyButton extends BoaButtonFields {
13
14
  link: string;
14
15
  text: string;
16
+ /** 打开方式,亚马逊链接默认新窗口 */
17
+ target?: '_self' | '_blank';
15
18
  }
16
- export interface TextLink {
19
+ export interface TextLink extends BoaButtonFields {
17
20
  /** 链接地址 */
18
21
  link: string;
19
22
  /** 链接文字 */
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import type { Media as MediaType, Theme } from '../../types/props.js';
3
3
  import type { ButtonProps } from '../../components/button.js';
4
+ import { type BoaButtonFields } from '../../hooks/useBoaButton.js';
4
5
  export type SecondaryBannerSemanticName = 'root' | 'title' | 'superTitle' | 'subtitle' | 'content' | 'buttonGroup' | 'primaryButton' | 'secondaryButton';
5
6
  /**
6
7
  * Accessibility label overrides for the SecondaryBanner carousel controls.
@@ -80,12 +81,12 @@ export interface SecondaryBannerSlideData {
80
81
  text: string;
81
82
  link?: string;
82
83
  onClick?: () => void;
83
- } & Omit<ButtonProps, 'children'>;
84
+ } & BoaButtonFields & Omit<ButtonProps, 'children'>;
84
85
  secondaryButton?: {
85
86
  text: string;
86
87
  link?: string;
87
88
  onClick?: () => void;
88
- } & Omit<ButtonProps, 'children'>;
89
+ } & BoaButtonFields & Omit<ButtonProps, 'children'>;
89
90
  iconArray?: Array<{
90
91
  pcImage: MediaType;
91
92
  }>;
@@ -157,13 +158,13 @@ export interface SecondaryBannerData {
157
158
  text: string;
158
159
  link?: string;
159
160
  onClick?: () => void;
160
- } & Omit<ButtonProps, 'children'>;
161
+ } & BoaButtonFields & Omit<ButtonProps, 'children'>;
161
162
  /** 次级按钮配置 */
162
163
  secondaryButton?: {
163
164
  text: string;
164
165
  link?: string;
165
166
  onClick?: () => void;
166
- } & Omit<ButtonProps, 'children'>;
167
+ } & BoaButtonFields & Omit<ButtonProps, 'children'>;
167
168
  iconArray?: Array<{
168
169
  pcImage: MediaType;
169
170
  }>;
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as g}from"react/jsx-runtime";import*as p from"react";import{cva as ue}from"class-variance-authority";import{useMediaQuery as H}from"react-responsive";import E from"jump.js";import{cn as s,getLocalizedPath as w}from"../../helpers/index.js";import{Text as O,Button as P,Heading as ge,Picture as be,Countdown as ye}from"../../components/index.js";import{withLayout as fe}from"../../shared/Styles.js";import ke from"../Media/index.js";import{useAiuiContext as xe}from"../AiuiProvider/index.js";import{useExposure as he}from"../../hooks/useExposure.js";import{buildTrackingRef as Te,trackUrlRef as V}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as _,resolveComponentMediaType as ve}from"../../shared/track.js";import Be from"./SecondaryBannerCarousel.js";const u="secondary_banner",Ie=ue("text-info-primary relative w-full",{variants:{size:{sm:"tablet:aspect-[768/480] laptop:aspect-[1024/480] desktop:aspect-[1440/480] lg-desktop:aspect-[1920/480] aspect-[390/480]",base:"tablet:aspect-[768/660] laptop:aspect-[1024/432] desktop:aspect-[1440/576] lg-desktop:aspect-[1920/720] aspect-[390/660]",lg:"tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660]",xlg:"tablet:aspect-[768/1320] laptop:aspect-[1024/864] desktop:aspect-[1440/1152] lg-desktop:aspect-[1920/1440] aspect-[390/1440] overflow-visible"}},defaultVariants:{size:"base"}}),j=p.forwardRef(({className:h,classNames:a={},data:e,jumpOptions:T={},isActive:$,a11yLabels:J,trackExposure:q=!0,frameIndex:b,...v},l)=>{const{pcImage:F,padImage:W,mobileImage:G,isVideoLoop:Q,endDate:B,endDate_tz:U,dateFormat:K,size:X,iconArray:y,theme:Y,primaryButton:n,secondaryButton:i,title:c,titleTag:Z}=e,ee=Q??!0,f=X??"base",te=Y??"light",ne=Z??"h2",{locale:I="us",pageHandle:ie}=xe(),oe=H({query:"(max-width: 767px)"}),ae=H({query:"(min-width: 768px) and (max-width: 1024px)"}),M=oe?e.mobileImage:ae?e.padImage??e.pcImage:e.pcImage,m=ve(M?.mimeType==="video/mp4"),S=b??1,C=`${Te(ie??"",m,u)}${b===void 0?"":`_${b}`}`,k=M?.id||e.pcImage?.id||"",L=p.useRef(null),se=p.useCallback(o=>{L.current=o,typeof l=="function"?l(o):l&&(l.current=o)},[l]),re=p.useRef(null);he(q?L:re,{componentType:m,componentName:u,componentTitle:c?.trim()||"",componentDescription:e.subtitle?.trim()||"",position:1,creativeId:k});const le=!!(i?.link||typeof i?.onClick=="function"),pe=!!(n?.link||typeof n?.onClick=="function"),z=i?.link&&!i.link.startsWith("#")?V(w(i.link,I),C):void 0,N=n?.link&&!n.link.startsWith("#")?V(w(n.link,I),C):void 0,ce=_({interactive:le,componentType:m,componentName:u,title:c,description:e.subtitle,buttonName:i?.text,position:S,creativeId:k}),me=_({interactive:pe,componentType:m,componentName:u,title:c,description:e.subtitle,buttonName:n?.text,position:S,creativeId:k}),R={...{duration:500,offset:0},...T},x=p.useId(),d=c?`${x}-title`:void 0,D=e.subtitle?`${x}-subtitle`:void 0,A=e.superTitle?`${x}-super-title`:void 0,de=[A,D].filter(Boolean).join(" ")||void 0;return e.items&&e.items.length>0?t(Be,{data:e,className:h,classNames:a,jumpOptions:T,a11yLabels:J,ref:l,...v}):g("section",{ref:se,role:"banner","aria-labelledby":d,"aria-describedby":de,className:s({"aiui-dark":te==="dark"},Ie({size:f}),h,a?.root),...v,children:[t("div",{className:s("absolute inset-0",{"h-fit":f==="xlg"}),children:t(ke,{pcImage:F,padImage:W,mobileImage:G,className:"size-full",imgClassName:"object-cover",videoClassName:"object-cover",muted:!0,loop:ee,playsInline:!0,autoPlay:$??!0})}),g("div",{className:s("banner-content laptop:top-[min(50%,50vh)] laptop:-translate-y-1/2 px-grid absolute top-12 z-10 flex flex-col items-start justify-center text-left",a?.content),children:[g("div",{className:"banner-inner-title desktop:gap-2 flex flex-col items-start gap-1",children:[e.superTitle&&t(O,{as:"p",size:2,id:A,className:s("banner-super-title desktop:text-[16px] lg-desktop:text-[18px]",a?.superTitle),html:e.superTitle}),e.title&&t(ge,{as:ne,size:["xlg","lg"].includes(f)?5:4,id:d,className:s("banner-title ",a?.title),html:e.title}),e.subtitle&&t(O,{as:"p",size:3,id:D,className:s("banner-subtitle desktop:text-[16px] lg-desktop:text-[18px]",a?.subtitle),html:e.subtitle})]}),B&&t("div",{className:"banner-countdown",children:t(ye,{endDate:B,endDate_tz:U,dateFormat:K,variant:"spacious",className:"lg-desktop:mt-8 mt-6"})}),g("div",{className:s("banner-cta-group lg-desktop:mt-[32px] lg-desktop:gap-3 mt-6 flex gap-2",a?.buttonGroup),children:[i?.text&&t(P,{variant:"secondary",onClick:o=>{if(i.link?.startsWith("#")){o.preventDefault();const r=document.querySelector(i.link);r&&E(r,R)}i.onClick?.()},className:s("",a?.secondaryButton),"aria-describedby":d,...z?{as:"a",href:z}:{},...ce,children:i.text}),n?.text&&t(P,{onClick:o=>{if(n.link?.startsWith("#")){o.preventDefault();const r=document.querySelector(n.link);r&&E(r,R)}n.onClick?.()},className:s("",a?.primaryButton),"aria-describedby":d,...N?{as:"a",href:N}:{},...me,children:n.text})]}),Array.isArray(y)&&y.length>0&&t("div",{className:"banner-icons desktop:mt-3 lg-desktop:mt-4 mt-2 flex items-center gap-2",role:"group","aria-label":"brand icons",children:y.map((o,r)=>o.pcImage?t(be,{source:o.pcImage.url,alt:o.pcImage.alt||`icon ${r+1}`,role:"img",className:"laptop:h-auto h-[48px] max-w-none",imgClassName:"h-full"},r):null)})]})]})});j.displayName="SecondaryBanner";var Pe=fe(j);export{Pe as default,Ie as secondaryBannerVariants};
1
+ "use client";import{jsx as a,jsxs as f}from"react/jsx-runtime";import*as p from"react";import{cva as xe}from"class-variance-authority";import{useMediaQuery as O}from"react-responsive";import P from"jump.js";import{cn as s,getLocalizedPath as he}from"../../helpers/index.js";import{Text as F,Button as V,Heading as Be,Picture as Te,Countdown as ve}from"../../components/index.js";import{withLayout as Ie}from"../../shared/Styles.js";import Me from"../Media/index.js";import{useAiuiContext as Le}from"../AiuiProvider/index.js";import{useExposure as ze}from"../../hooks/useExposure.js";import{buildTrackingRef as Se,trackUrlRef as Ce}from"../../shared/trackUrlRef.js";import{useBoaButton as Ae}from"../../hooks/useBoaButton.js";import{buildClickTrackingProps as j,resolveComponentMediaType as Ne}from"../../shared/track.js";import Re from"./SecondaryBannerCarousel.js";const c="secondary_banner",_e=xe("text-info-primary relative w-full",{variants:{size:{sm:"tablet:aspect-[768/480] laptop:aspect-[1024/480] desktop:aspect-[1440/480] lg-desktop:aspect-[1920/480] aspect-[390/480]",base:"tablet:aspect-[768/660] laptop:aspect-[1024/432] desktop:aspect-[1440/576] lg-desktop:aspect-[1920/720] aspect-[390/660]",lg:"tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660]",xlg:"tablet:aspect-[768/1320] laptop:aspect-[1024/864] desktop:aspect-[1440/1152] lg-desktop:aspect-[1920/1440] aspect-[390/1440] overflow-visible"}},defaultVariants:{size:"base"}}),$=p.forwardRef(({className:L,classNames:r={},data:t,jumpOptions:z={},isActive:J,a11yLabels:q,trackExposure:W=!0,frameIndex:b,...S},l)=>{const{pcImage:G,padImage:Q,mobileImage:U,isVideoLoop:K,endDate:C,endDate_tz:X,dateFormat:Y,size:Z,iconArray:y,theme:ee,primaryButton:n,secondaryButton:o,title:d,titleTag:te}=t,ne=K??!0,k=Z??"base",oe=ee??"light",ie=te??"h2",{locale:ae="us",pageHandle:re}=Le(),{resolveLink:x,hasAdTrack:m,trackAd:se}=Ae(),le=O({query:"(max-width: 767px)"}),pe=O({query:"(min-width: 768px) and (max-width: 1024px)"}),A=le?t.mobileImage:pe?t.padImage??t.pcImage:t.pcImage,u=Ne(A?.mimeType==="video/mp4"),N=b??1,ce=`${Se(re??"",u,c)}${b===void 0?"":`_${b}`}`,h=A?.id||t.pcImage?.id||"",R=p.useRef(null),de=p.useCallback(e=>{R.current=e,typeof l=="function"?l(e):l&&(l.current=e)},[l]),me=p.useRef(null);ze(W?R:me,{componentType:u,componentName:c,componentTitle:d?.trim()||"",componentDescription:t.subtitle?.trim()||"",position:1,creativeId:h});const ue=!!(o?.link||typeof o?.onClick=="function"||m(o)),ge=!!(n?.link||typeof n?.onClick=="function"||m(n)),_=e=>{if(!e?.link||e.link.startsWith("#"))return{href:void 0,target:void 0};const i=x(e.link,e);return i.isAmazon?{href:i.href,target:e.target??"_blank"}:{href:Ce(he(e.link,ae),ce),target:void 0}},B=_(o),T=_(n),v=B.href,I=T.href,D=(e,i,ke)=>se(e,{componentName:c,buttonPosition:i,buttonText:e?.text,href:ke}),fe=j({interactive:ue,componentType:u,componentName:c,title:d,description:t.subtitle,buttonName:o?.text,position:N,creativeId:h}),be=j({interactive:ge,componentType:u,componentName:c,title:d,description:t.subtitle,buttonName:n?.text,position:N,creativeId:h}),H={...{duration:500,offset:0},...z},M=p.useId(),g=d?`${M}-title`:void 0,E=t.subtitle?`${M}-subtitle`:void 0,w=t.superTitle?`${M}-super-title`:void 0,ye=[w,E].filter(Boolean).join(" ")||void 0;return t.items&&t.items.length>0?a(Re,{data:t,className:L,classNames:r,jumpOptions:z,a11yLabels:q,ref:l,...S}):f("section",{ref:de,role:"banner","aria-labelledby":g,"aria-describedby":ye,className:s({"aiui-dark":oe==="dark"},_e({size:k}),L,r?.root),...S,children:[a("div",{className:s("absolute inset-0",{"h-fit":k==="xlg"}),children:a(Me,{pcImage:G,padImage:Q,mobileImage:U,className:"size-full",imgClassName:"object-cover",videoClassName:"object-cover",muted:!0,loop:ne,playsInline:!0,autoPlay:J??!0})}),f("div",{className:s("banner-content laptop:top-[min(50%,50vh)] laptop:-translate-y-1/2 px-grid absolute top-12 z-10 flex flex-col items-start justify-center text-left",r?.content),children:[f("div",{className:"banner-inner-title desktop:gap-2 flex flex-col items-start gap-1",children:[t.superTitle&&a(F,{as:"p",size:2,id:w,className:s("banner-super-title desktop:text-[16px] lg-desktop:text-[18px]",r?.superTitle),html:t.superTitle}),t.title&&a(Be,{as:ie,size:["xlg","lg"].includes(k)?5:4,id:g,className:s("banner-title ",r?.title),html:t.title}),t.subtitle&&a(F,{as:"p",size:2,id:E,className:s("banner-subtitle desktop:text-[16px] lg-desktop:text-[18px]",r?.subtitle),html:t.subtitle})]}),C&&a("div",{className:"banner-countdown",children:a(ve,{endDate:C,endDate_tz:X,dateFormat:Y,variant:"spacious",className:"lg-desktop:mt-8 lg-desktop:[&_.time-block]:size-12 lg-desktop:[&_.time-block]:p-1 lg-desktop:[&_.separator]:text-2xl mt-6 [&_.separator]:text-xl [&_.time-block]:size-10 [&_.time-block]:p-[2px]"})}),f("div",{className:s("banner-cta-group lg-desktop:mt-[32px] lg-desktop:gap-3 mt-6 flex gap-2",r?.buttonGroup),children:[o?.text&&a(V,{variant:"secondary","data-headless-ad-track":m(o)?"true":void 0,"data-headless-amazon":x(o.link,o).isAmazon?"true":void 0,onClick:e=>{if(D(o,"secondary",v),o.link?.startsWith("#")){e.preventDefault();const i=document.querySelector(o.link);i&&P(i,H)}o.onClick?.()},className:s("",r?.secondaryButton),"aria-describedby":g,...v?{as:"a",href:v,...B.target?{target:B.target,rel:o.rel??"noopener noreferrer"}:{}}:{},...fe,children:o.text}),n?.text&&a(V,{onClick:e=>{if(D(n,"primary",I),n.link?.startsWith("#")){e.preventDefault();const i=document.querySelector(n.link);i&&P(i,H)}n.onClick?.()},className:s("",r?.primaryButton),"data-headless-ad-track":m(n)?"true":void 0,"data-headless-amazon":x(n.link,n).isAmazon?"true":void 0,"aria-describedby":g,...I?{as:"a",href:I,...T.target?{target:T.target,rel:n.rel??"noopener noreferrer"}:{}}:{},...be,children:n.text})]}),Array.isArray(y)&&y.length>0&&a("div",{className:"banner-icons desktop:mt-3 lg-desktop:mt-4 mt-2 flex items-center gap-2",role:"group","aria-label":"brand icons",children:y.map((e,i)=>e.pcImage?a(Te,{source:e.pcImage.url,alt:e.pcImage.alt||`icon ${i+1}`,role:"img",className:"lg-desktop:h-auto h-[48px] max-w-none",imgClassName:"h-full"},i):null)})]})]})});$.displayName="SecondaryBanner";var Qe=Ie($);export{Qe as default,_e as secondaryBannerVariants};
@@ -1,2 +1 @@
1
- import{jsx as s}from"react/jsx-runtime";import{useEffect as f,useRef as b}from"react";const m="openDropDown",v=({index:n,active:a,list:u,setActive:p,setVisible:d,visible:l,resolveName:c})=>{const i=b(null);return f(()=>{const e=o=>{const t=o?.target?.getAttribute?.("class");!i?.current?.contains(o?.target)&&!t?.includes(m)&&d({...l,[n]:!1})};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),s("div",{ref:i,className:`absolute left-0 top-[104%] z-30 box-border max-h-[340px] w-full overflow-auto rounded-lg bg-white ${l?.[n]?"block":"hidden"}`,children:s("div",{className:"dropdown-wrapper m-0 box-border h-full flex-1 overflow-hidden p-0 [&:last-child]:border-r-0",children:u?.map((e,o)=>{const t=e?.sku||e?.variants?.[0]?.sku,r=c?c(e,t):e?.name||e?.title;return s("div",{onClick:()=>{p({...a,[n]:{sku:t,name:r,handle:e?.handle}}),d({...l,[n]:!1})},title:r,className:`openDropDown min-xl:text-lg min-xxl:text-lg box-border cursor-pointer truncate px-6 py-4 text-base font-bold [&:hover]:bg-[#EAEAEC]
2
- ${e?.handle===a?.handle?"bg-[#EAEAEC]":""}`,children:r},o)})})})};var k=v;export{k as default};
1
+ import{jsx as s}from"react/jsx-runtime";import{useEffect as m,useRef as y}from"react";import{cn as p}from"../../helpers/index.js";const b="openDropDown",v=({index:e,active:l,list:u,setActive:f,setVisible:c,visible:a,resolveName:i})=>{const d=y(null);return m(()=>{const n=o=>{const r=o?.target?.getAttribute?.("class");!d?.current?.contains(o?.target)&&!r?.includes(b)&&c({...a,[e]:!1})};return document.addEventListener("click",n),()=>document.removeEventListener("click",n)},[]),s("div",{ref:d,className:p("specs-dropdown-panel rounded-box-small bg-container-secondary-1 text-info-primary absolute left-0 top-[calc(100%+8px)] z-30 box-border max-h-[340px] w-full overflow-y-auto",a?.[e]?"block":"hidden"),children:s("div",{className:"dropdown-wrapper m-0 box-border h-full flex-1 overflow-hidden p-0 [&:last-child]:border-r-0",children:u?.map((n,o)=>{const r=n?.sku||n?.variants?.[0]?.sku,t=i?i(n,r):n?.name||n?.title;return s("div",{onClick:()=>{f({...l,[e]:{sku:r,name:t,handle:n?.handle}}),c({...a,[e]:!1})},title:t,className:p("openDropDown specs-dropdown-option text-info-primary box-border cursor-pointer truncate px-6 py-4 text-base font-bold","[&:hover]:bg-container-primary",n?.handle===l?.handle?"bg-container-primary":""),children:t},o)})})})};var k=v;export{k as default};
@@ -1 +1 @@
1
- "use client";import{Fragment as P,jsx as n,jsxs as i}from"react/jsx-runtime";import X from"./dropdown.js";import{useAiuiContext as Y}from"../AiuiProvider/index.js";import{useMediaQuery as Z}from"react-responsive";import{useMemo as j,useState as b,useEffect as H,useCallback as ee}from"react";import{withLayout as te}from"../../shared/Styles.js";import{formatVariantPrice as se}from"../ShelfDisplay/shelfDisplay.js";import{Picture as C,Text as ne,Button as oe,Heading as M}from"../../components/index.js";import{cn as ae}from"../../helpers/index.js";import re,{useImperativeHandle as le,useRef as ce}from"react";const F=re.forwardRef(({data:u,buildData:d,onChange:R,onSecondaryChange:ie,className:_,...I},$)=>{const m=Z({query:"(max-width: 768px)"}),[l,g]=b({}),[h,O]=b([]),[S,L]=b(!1),[v,D]=b({}),A=ce(null),{locale:U="us",currencyDisplay:V,trackingData:B,currencyCode:z}=Y(),q=B?.showComparePrice??!0,{LeftMenu:E,RightMenu:y,DefaultSelectMenu:x}=j(()=>u?.data||{},[u?.data]),w=j(()=>{const e={};return(Array.isArray(u?.items)?u?.items:[]).forEach(t=>{t?.custom_name&&(t?.sku&&(e[t.sku]=t.custom_name),t?.handle&&(e[t.handle]=t.custom_name))}),e},[u?.items]),k=ee((e,s)=>w[s||""]||w[e?.handle||""]||e?.name||e?.title||"",[w]),Q=e=>{try{const t=new URL(e).pathname.toLowerCase();return/\.(jpeg|jpg|gif|png|webp|bmp|svg|tiff)$/.test(t)}catch{return/\.(jpeg|jpg|gif|png|webp|bmp|svg|tiff)$/i.test(e)}},W=(e,s)=>{const t=e?.variants?.find?.(c=>c?.sku===e?.sku),o=t?.coupons?.[0],{price:a,basePrice:r}=se({locale:z==="CAD"?"us":U||"us",amount:o?o?.variant_price4wscode:t?.price,baseAmount:o?t?.price:0,currencyDisplay:V,currencyCode:e?.price?.currencyCode||"USD"}),p=typeof x?.buttonText=="string"?x?.buttonText:x?.buttonText?.[String(s)]||"";return i("div",{className:"specs-sku-node-wrap box-border",children:[i(ne,{as:"div",className:"md-tablet:p-2 l-tablet:mb-4 l-tablet:text-sm desktop:px-6 lg-desktop:mb-8 lg-desktop:text-lg openDropDown specs-sku-node-text relative mb-6 box-border block rounded-[50px] border border-[#E4E5E6] bg-[#F5F5F7] px-6 py-4 text-base font-bold",onClick:()=>{if(h?.length<=1)return null;D({...v,[s]:!v?.[s]})},children:[i("div",{className:"flex items-center justify-between overflow-hidden",children:[n("div",{className:"openDropDown md-tablet:text-sm lg-desktop:text-lg specs-sku-node-title flex-1 truncate text-base",title:l?.[s]?.name||"",children:l?.[s]?.name||""}),h?.length>1?n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",className:"openDropDown",children:n("path",{d:"M6 9.5L12 15.5L18 9.5",stroke:"#1D1D1F",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),n(X,{index:s,list:h,active:l,setActive:g,visible:v,setVisible:D,resolveName:k})]}),n("div",{className:"lg-desktop:max-h-[196px] lg-desktop:max-w-[196px] max-h-[138px] max-w-[138px]",children:n(C,{source:t?.image?.url||"",className:"aspect-h-[280] aspect-w-[280]",imgClassName:"w-full h-full object-cover hover:scale-105 transition-all duration-300"})}),n("div",{className:"lg-desktop:text-2xl mb-2 mt-6 text-xl font-bold",children:n("div",{className:"lg-desktop:min-h-[32px] flex min-h-[28px] flex-wrap items-center gap-1",children:t?.availableForSale?i(P,{children:[n("div",{className:"specs-sku-node-price whitespace-nowrap text-[#080A0F]",children:a||""}),q&&r&&n("div",{className:"lg-desktop:text-2xl specs-sku-node-base-price whitespace-nowrap text-xl text-[#86868C] line-through",children:r})]}):null})}),p?n(oe,{onClick:()=>{R?.(e,s)},className:"specs-sku-node-button",children:p}):null]})},G=e=>e&&typeof e!="string"?i("div",{className:"size-full",children:[n("p",{className:"min-xxl:text-lg specs-normal-node-text text-base font-bold text-[#080A0F] md:text-sm",dangerouslySetInnerHTML:{__html:e?.text||""}}),n(C,{source:e?.imgUrl,className:"l:max-h-[174px] l:max-w-[174px] m-auto max-h-[360px] max-w-[360px]",imgClassName:"w-full h-full object-cover"})]}):n("div",{className:"break-all",children:Q(e)?n(C,{source:e,className:"l:max-h-[174px] l:max-w-[174px] m-auto max-h-[360px] max-w-[360px]",imgClassName:"w-full h-full object-cover"}):n("p",{className:"min-xxl:text-lg specs-normal-node-text text-base font-bold text-[#080A0F] md:text-sm",dangerouslySetInnerHTML:{__html:e||""}})}),T=e=>e.map((s,t)=>{const o=t===0;return i("div",{className:"l-tablet:flex l-tablet:flex-col box-border grid w-full cursor-pointer grid-cols-3 overflow-hidden border-t border-t-[#E4E5E6] specs-product-node-wrap",children:[n(M,{as:"h3",html:s||"",className:"tablet:py-6 l-tablet:text-[#86868C] desktop:p-6 lg-desktop:text-lg specs-product-node-title mr-4 flex-1 pt-4 text-base font-bold md:text-sm"}),n("div",{className:`l-tablet:w-full l-tablet:gap-4 laptop:gap-8 desktop:gap-12 desktop:p-6 lg-desktop:gap-16 grid-cols-${S?3:2} specs-product-node-body col-span-2 grid flex-1 py-6`,children:Object.keys(l)?.map?.(a=>{const r=l?.[a],p=y?.menus?.find?.(c=>c?.handle===r?.handle)?.subTitle;return G(p?.[s])})})]},s)}),J=e=>{if(!l)return;const{subTitle:s,isProduct:t}=e;return t?i(P,{children:[i("div",{className:"l-tablet:flex l-tablet:flex-col specs-content-item-product box-border grid w-full cursor-pointer grid-cols-3 border-t-0 border-t-[#E4E5E6]",children:[e?.title&&n(M,{as:"h3",html:e?.title||"",className:"lg-desktop:text-lg desktop:px-6 specs-product-node-title l:hidden specs-item-product-title py-4 text-base font-bold md:text-sm"}),n("div",{className:`l-tablet:w-full l-tablet:gap-4 laptop:gap-8 desktop:gap-12 desktop:px-6 desktop:pb-6 lg-desktop:gap-16 grid-cols-${S?3:2} specs-item-product-body col-span-2 grid flex-1 pb-4 pr-0`,children:Object.keys(l)?.map((o,a)=>{const r=l?.[o],p=d?.products?.find?.(c=>c?.handle===r?.handle);return n("div",{children:W({...p,item:o,sku:r?.sku},a)},o)})})]}),e?.categoryLabel&&n(M,{size:2,as:"h4",html:e?.categoryLabel||"",className:"desktop:p-6 specs-item-product-category py-6"}),s?.length?T(s):null]}):T(s)};return le($,()=>A.current),H(()=>{if(!d?.products?.length)return;const e=x?.sku?.split?.(",")||[],s=m&&e?.length>2?e?.slice(0,2):e;let t={};s?.forEach?.((a,r)=>{const c=y?.menus?.find?.(f=>f?.sku===a)?.handle,N=c?d?.products?.find?.(f=>f?.handle===c):d?.products?.find?.(f=>{if(f?.variants?.find?.(K=>K?.sku===a))return!0});N&&(t={...t,[r]:{sku:a,name:k(N,a),handle:N?.handle}})});const o=d?.products?.filter(a=>y?.menus?.find(r=>r?.handle===a?.handle));g(t),O(o),L(e?.length>2&&!m)},[d,m,k]),H(()=>{if(m){const e=Object.keys(l||{});if(e?.length>2){const s=e?.slice?.(0,2);let t={};s?.forEach?.(o=>{t={...t,[o]:l?.[o]}}),L(!1),g(t)}}},[m]),n("div",{...I,className:ae("specs-wrapper w-full overflow-hidden",_),ref:A,children:E?.data?n("div",{className:"specs-wrapper-content box-border w-full overflow-hidden",children:E?.data?.map?.((e,s)=>n("div",{className:"specs-wrapper-content-item w-full overflow-hidden pt-10 [&:first-child]:pt-0",children:J(e)},s))}):null})});F.displayName="Specs";var ye=te(F);export{ye as default};
1
+ "use client";import{Fragment as _,jsx as o,jsxs as i}from"react/jsx-runtime";import Y from"./dropdown.js";import{useAiuiContext as Z}from"../AiuiProvider/index.js";import{useMediaQuery as ee}from"react-responsive";import{useMemo as H,useState as h,useEffect as E,useCallback as te}from"react";import{withLayout as se}from"../../shared/Styles.js";import{formatVariantPrice as oe}from"../ShelfDisplay/shelfDisplay.js";import{Picture as S,Text as ne,Button as re,Heading as C}from"../../components/index.js";import{cn as P}from"../../helpers/index.js";import ae,{useImperativeHandle as le,useRef as ie}from"react";const R=ae.forwardRef(({data:d,buildData:p,onChange:$,onSecondaryChange:ce,className:I,...O},U)=>{const u=ee({query:"(max-width: 768px)"}),[l,v]=h({}),[y,V]=h([]),[g,L]=h(!1),[b,D]=h({}),T=ie(null),{locale:q="us",currencyDisplay:B,trackingData:z,currencyCode:F}=Z(),Q=z?.showComparePrice??!0,{LeftMenu:A,RightMenu:k,DefaultSelectMenu:x}=H(()=>d?.data||{},[d?.data]),w=H(()=>{const e={};return(Array.isArray(d?.items)?d?.items:[]).forEach(t=>{t?.custom_name&&(t?.sku&&(e[t.sku]=t.custom_name),t?.handle&&(e[t.handle]=t.custom_name))}),e},[d?.items]),N=te((e,s)=>w[s||""]||w[e?.handle||""]||e?.name||e?.title||"",[w]),W=e=>{try{const t=new URL(e).pathname.toLowerCase();return/\.(jpeg|jpg|gif|png|webp|bmp|svg|tiff)$/.test(t)}catch{return/\.(jpeg|jpg|gif|png|webp|bmp|svg|tiff)$/i.test(e)}},G=(e,s)=>{const t=e?.variants?.find?.(c=>c?.sku===e?.sku),n=t?.coupons?.[0],{price:r,basePrice:a}=oe({locale:F==="CAD"?"us":q||"us",amount:n?n?.variant_price4wscode:t?.price,baseAmount:n?t?.price:0,currencyDisplay:B,currencyCode:e?.price?.currencyCode||"USD"}),m=typeof x?.buttonText=="string"?x?.buttonText:x?.buttonText?.[String(s)]||"";return i("div",{className:"specs-sku-node-wrap box-border",children:[i(ne,{as:"div",className:"md-tablet:px-4 md-tablet:py-2.5 md-tablet:text-sm l-tablet:mb-4 l-tablet:text-sm laptop:flex laptop:h-[54px] laptop:flex-col laptop:justify-center laptop:py-0 desktop:px-6 lg-desktop:mb-8 lg-desktop:text-lg openDropDown specs-sku-node-text rounded-box-small border-lines bg-container-secondary-0 text-info-primary relative mb-4 box-border block border px-4 py-3 text-base font-bold",onClick:()=>{if(y?.length<=1)return null;D({...b,[s]:!b?.[s]})},children:[i("div",{className:"flex items-center justify-between overflow-hidden",children:[o("div",{className:"openDropDown md-tablet:text-sm lg-desktop:text-lg specs-sku-node-title text-info-primary flex-1 truncate text-base",title:l?.[s]?.name||"",children:l?.[s]?.name||""}),y?.length>1?o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",className:P("openDropDown specs-sku-node-chevron shrink-0 transition-transform duration-300",b?.[s]?"rotate-180":""),children:o("path",{d:"M6 9.5L12 15.5L18 9.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}):null]}),o(Y,{index:s,list:y,active:l,setActive:v,visible:b,setVisible:D,resolveName:N})]}),o("div",{className:"lg-desktop:max-h-[196px] lg-desktop:max-w-[196px] max-h-[138px] max-w-[138px]",children:o(S,{source:t?.image?.url||"",className:"aspect-h-[280] aspect-w-[280]",imgClassName:"w-full h-full object-cover hover:scale-105 transition-all duration-300"})}),o("div",{className:"lg-desktop:text-2xl mb-2 mt-6 text-xl font-bold tracking-[-0.04em]",children:o("div",{className:"lg-desktop:min-h-[32px] flex min-h-[28px] items-center",children:t?.availableForSale?i(_,{children:[o("div",{className:"specs-sku-node-price text-info-primary",children:r||""}),Q&&a&&o("div",{className:"lg-desktop:text-2xl specs-sku-node-base-price text-info-quaternary ml-1 text-xl line-through",children:a})]}):null})}),m?o(re,{onClick:()=>{$?.(e,s)},className:"specs-sku-node-button hover:text-info-primary",children:m}):null]})},J=e=>e&&typeof e!="string"?i("div",{className:"size-full",children:[o("p",{className:"desktop:text-base lg-desktop:text-lg specs-normal-node-text text-info-primary text-sm font-bold",dangerouslySetInnerHTML:{__html:e?.text||""}}),o(S,{source:e?.imgUrl,className:"m-auto max-h-[360px] max-w-[360px]",imgClassName:"w-full h-full object-cover"})]}):o("div",{className:"break-all",children:W(e)?o(S,{source:e,className:"m-auto max-h-[360px] max-w-[360px]",imgClassName:"w-full h-full object-cover"}):o("p",{className:"desktop:text-base lg-desktop:text-lg specs-normal-node-text text-info-primary text-sm font-bold",dangerouslySetInnerHTML:{__html:e||""}})}),j=e=>e.map(s=>i("div",{className:`l-tablet:flex l-tablet:flex-col border-t-lines specs-product-node-wrap box-border grid w-full cursor-pointer overflow-hidden border-t ${g?"grid-cols-4":"grid-cols-3"}`,children:[o(C,{as:"h3",html:s||"",className:"l-tablet:text-info-quaternary tablet:py-4 laptop:py-6 desktop:p-6 lg-desktop:text-lg specs-product-node-title desktop:text-base mr-2 flex-1 pt-4 text-sm font-bold"}),o("div",{className:`l-tablet:w-full l-tablet:gap-4 laptop:gap-8 desktop:gap-12 desktop:p-6 lg-desktop:gap-16 specs-product-node-body grid flex-1 py-4 ${g?"col-span-3 grid-cols-3":"col-span-2 grid-cols-2"}`,children:Object.keys(l)?.map?.(t=>{const n=l?.[t],r=k?.menus?.find?.(a=>a?.handle===n?.handle)?.subTitle;return J(r?.[s])})})]},s)),K=e=>{if(!l)return;const{subTitle:s,isProduct:t}=e;return t?i(_,{children:[i("div",{className:`l-tablet:flex l-tablet:flex-col specs-content-item-product border-t-lines box-border grid w-full cursor-pointer border-t-0 ${g?"grid-cols-4":"grid-cols-3"}`,children:[e?.title&&o(C,{as:"h3",html:e?.title||"",className:"l-tablet:hidden lg-desktop:text-lg specs-product-node-title specs-item-product-title desktop:text-base text-sm font-bold"}),o("div",{className:`l-tablet:w-full l-tablet:gap-4 laptop:gap-8 desktop:gap-12 desktop:p-6 lg-desktop:gap-16 specs-item-product-body grid flex-1 pb-4 pr-0 ${g?"col-span-3 grid-cols-3":"col-span-2 grid-cols-2"}`,children:Object.keys(l)?.map((n,r)=>{const a=l?.[n],m=p?.products?.find?.(c=>c?.handle===a?.handle);return o("div",{children:G({...m,item:n,sku:a?.sku},r)},n)})})]}),e?.categoryLabel&&o(C,{size:2,as:"h4",html:e?.categoryLabel||"",className:"desktop:p-6 specs-item-product-category py-6"}),s?.length?j(s):null]}):j(s)};return le(U,()=>T.current),E(()=>{if(!p?.products?.length)return;const e=x?.sku?.split?.(",")||[],s=u&&e?.length>2?e?.slice(0,2):e;let t={};s?.forEach?.((r,a)=>{const c=k?.menus?.find?.(f=>f?.sku===r)?.handle,M=c?p?.products?.find?.(f=>f?.handle===c):p?.products?.find?.(f=>{if(f?.variants?.find?.(X=>X?.sku===r))return!0});M&&(t={...t,[a]:{sku:r,name:N(M,r),handle:c||M?.handle}})});const n=p?.products?.filter(r=>k?.menus?.find(a=>a?.handle===r?.handle));v(t),V(n),L(e?.length>2&&!u)},[p,u,N]),E(()=>{if(u){const e=Object.keys(l||{});if(e?.length>2){const s=e?.slice?.(0,2);let t={};s?.forEach?.(n=>{t={...t,[n]:l?.[n]}}),L(!1),v(t)}}},[u]),o("div",{...O,className:P("specs-wrapper w-full overflow-hidden",I),ref:T,children:A?.data?o("div",{className:"specs-wrapper-content box-border w-full overflow-hidden",children:A?.data?.map?.((e,s)=>o("div",{className:"specs-wrapper-content-item w-full overflow-hidden pt-10 [&:first-child]:pt-0",children:K(e)},s))}):null})});R.displayName="Specs";var ye=se(R);export{ye as default};
@@ -1 +1 @@
1
- "use client";import{Fragment as G,jsx as t,jsxs as o}from"react/jsx-runtime";import c,{useRef as d,useImperativeHandle as M}from"react";import{Button as k,Heading as p,Picture as y,Text as N}from"../../components/index.js";import{cn as i,getLocalizedPath as T}from"../../helpers/utils.js";import{withLayout as I}from"../../shared/Styles.js";import{useExposure as U}from"../../hooks/useExposure.js";import{useAiuiContext as $}from"../AiuiProvider/index.js";import{useTracking as O}from"../../hooks/useTracking.js";import{trackUrlRef as V}from"../../shared/trackUrlRef.js";import{toPlainTrackingText as u}from"../../shared/track.js";import{Swiper as S,SwiperSlide as C}from"swiper/react";import{Navigation as W,EffectCoverflow as A}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import"swiper/css/pagination";import"swiper/css/effect-coverflow";const m="carousel",f="three_d_carousel",q=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]",children:[t("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),t("path",{d:"M32 20L24 28L32 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),F=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]",children:[t("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),t("path",{d:"M24 20L32 28L24 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),L=c.forwardRef(({data:z,className:E},R)=>{const{title:h,items:s=[],titleTag:D}=z,v=s.length<4?[...s,...s]:s,r=d(null),n=d(null),x=d(null),[P,j]=c.useState(180),{locale:w="us"}=$(),{buildRef:B}=O(),b=e=>e?V(T(e,w),B(m,f)):T("",w),g=e=>e.buttonLink?{"data-headless-type-name":`${m}#${f}`,"data-headless-title-desc-button":`${u(e.title)}#${u(e.description)}#${u(e.buttonText)}`,"data-headless-nav-position":`#${s.indexOf(e)+1}`}:{};return U(n,{componentType:m,componentName:f,componentTitle:h}),M(R,()=>n.current),c.useEffect(()=>{const e=x.current;if(!e)return;const l=()=>{const H=e.offsetWidth,_=Math.round(H*.125);j(_),r.current?.params?.coverflowEffect&&(r.current.params.coverflowEffect.stretch=_,r.current.update())};l();const a=new ResizeObserver(l);return a.observe(e),()=>a.disconnect()},[]),o("section",{ref:n,"data-ui-component-id":"ThreeDCarousel",className:i("three-d-carousel laptop:overflow-hidden w-full overflow-visible",E),children:[t(p,{as:D??"h2",size:4,html:h,className:"three-d-carousel__title laptop:text-center text-left"}),o("div",{ref:x,className:"three-d-carousel__desktop laptop:block relative mx-auto mt-[24px] hidden w-full",children:[t(S,{onSwiper:e=>r.current=e,centeredSlides:!0,initialSlide:0,loop:!0,slidesPerView:"auto",spaceBetween:0,grabCursor:!0,modules:[A,W],slideToClickedSlide:!0,className:"three-d-carousel__swiper rounded-box relative aspect-[1386/502] overflow-visible",effect:"coverflow",coverflowEffect:{rotate:0,stretch:P,depth:300,modifier:1,slideShadows:!0},children:v.map((e,l)=>t(C,{className:"three-d-carousel__slide relative !w-1/2 cursor-grab overflow-hidden opacity-0 [.swiper-slide-active&]:opacity-100 [.swiper-slide-next&]:opacity-100 [.swiper-slide-prev&]:opacity-100",children:({isActive:a})=>o(G,{children:[t(y,{source:e.imageUrl?.url||"",alt:e.imageUrl?.alt||e.title,className:i("three-d-carousel__image rounded-box mx-auto h-full overflow-hidden"),imgClassName:"h-full object-cover",style:{filter:a?"":"brightness(50%) contrast(120%)"}}),o("div",{className:i("three-d-carousel__image-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 box-border flex size-full flex-col justify-end gap-1 p-[16px]",{"aiui-dark":e.theme==="dark","opacity-0":!a}),children:[t(p,{as:"h2",size:2,html:e.title}),t(N,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-description lg-desktop:text-[18px] desktop:text-[16px] text-[14px]"}),e.buttonText&&t("a",{href:b(e.buttonLink),...g(e),className:"three-d-carousel__image-link ",children:t(k,{size:"base",variant:"secondary",className:"three-d-carousel__image-button desktop:mt-6 mt-4",children:e.buttonText})})]})]})},l))}),o("div",{className:"three-d-carousel__nav-controls laptop:px-[64px] desktop:px-[140px] lg-desktop:px-[200px] absolute left-1/2 top-1/2 z-20 flex w-full -translate-x-1/2 -translate-y-1/2 justify-between",children:[t("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--prev",onClick:()=>r.current?.slidePrev(),"aria-label":"Previous slide",children:t(q,{})}),t("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--next",onClick:()=>r.current?.slideNext(),"aria-label":"Next slide",children:t(F,{})})]})]}),t("div",{className:"three-d-carousel__mobile laptop:hidden mt-[24px] block w-full overflow-visible",children:t(S,{loop:!0,loopAdditionalSlides:1,slidesPerView:"auto",spaceBetween:12,grabCursor:!0,className:"three-d-carousel__swiper-mobile relative w-full !overflow-visible",children:v.map((e,l)=>o(C,{className:"three-d-carousel__slide-mobile relative !h-[360px] !w-[296px] cursor-grab overflow-hidden",children:[t(y,{source:e.mobImageUrl?.url||e.imageUrl?.url||"",alt:e.mobImageUrl?.alt||e.title,className:"three-d-carousel__image-mobile rounded-box mx-auto h-full overflow-hidden",imgClassName:"h-full object-cover"}),o("div",{className:i("three-d-carousel__image-mobile-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 flex size-full flex-col justify-end gap-1 p-[16px]",{"aiui-dark":e.theme==="dark"}),children:[t(p,{as:"h2",size:2,html:e.title}),t(N,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-mobile-description text-[14px]"}),e.buttonText&&t("a",{href:b(e.buttonLink),...g(e),className:"three-d-carousel__image-mobile-link ",children:t(k,{size:"base",variant:"secondary",className:"three-d-carousel__image-mobile-button mt-3",children:e.buttonText})})]})]},l))})})]})});L.displayName="ThreeDCarousel";var ce=I(L,{style:"overflow: hidden;"});export{ce as default};
1
+ "use client";import{Fragment as G,jsx as t,jsxs as o}from"react/jsx-runtime";import c,{useRef as d,useImperativeHandle as j}from"react";import{Button as k,Heading as u,Picture as y,Text as N}from"../../components/index.js";import{cn as i,getLocalizedPath as T}from"../../helpers/utils.js";import{withLayout as I}from"../../shared/Styles.js";import{useExposure as U}from"../../hooks/useExposure.js";import{useAiuiContext as $}from"../AiuiProvider/index.js";import{useTracking as O}from"../../hooks/useTracking.js";import{trackUrlRef as V}from"../../shared/trackUrlRef.js";import{toPlainTrackingText as p}from"../../shared/track.js";import{Swiper as S,SwiperSlide as C}from"swiper/react";import{Navigation as W,EffectCoverflow as A}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import"swiper/css/pagination";import"swiper/css/effect-coverflow";const m="carousel",h="three_d_carousel",q=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"three-d-carousel__nav-icon lg-desktop:scale-100 hover:text-info-primary scale-[70%] text-white",children:[t("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),t("path",{d:"M32 20L24 28L32 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),F=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"three-d-carousel__nav-icon lg-desktop:scale-100 hover:text-info-primary scale-[70%] text-white",children:[t("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),t("path",{d:"M24 20L32 28L24 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),L=c.forwardRef(({data:z,className:E},R)=>{const{title:f,items:s=[],titleTag:D}=z,v=s.length<6?[...s,...s]:s,r=d(null),n=d(null),b=d(null),[P,B]=c.useState(180),{locale:w="us"}=$(),{buildRef:H}=O(),x=e=>e?V(T(e,w),H(m,h)):T("",w),g=e=>e.buttonLink?{"data-headless-type-name":`${m}#${h}`,"data-headless-title-desc-button":`${p(e.title)}#${p(e.description)}#${p(e.buttonText)}`,"data-headless-nav-position":`#${s.indexOf(e)+1}`}:{};return U(n,{componentType:m,componentName:h,componentTitle:f}),j(R,()=>n.current),c.useEffect(()=>{const e=b.current;if(!e)return;const l=()=>{const M=e.offsetWidth,_=Math.round(M*.125);B(_),r.current?.params?.coverflowEffect&&(r.current.params.coverflowEffect.stretch=_,r.current.update())};l();const a=new ResizeObserver(l);return a.observe(e),()=>a.disconnect()},[]),o("section",{ref:n,"data-ui-component-id":"ThreeDCarousel",className:i("three-d-carousel laptop:overflow-hidden w-full overflow-visible",E),children:[t(u,{as:D??"h2",size:4,html:f,className:"three-d-carousel__title laptop:text-center text-left"}),o("div",{ref:b,className:"three-d-carousel__desktop laptop:block lg-desktop:max-w-[1648px] relative mx-auto mt-[24px] hidden w-full",children:[t(S,{onSwiper:e=>r.current=e,centeredSlides:!0,initialSlide:0,loop:!0,loopAdditionalSlides:2,slidesPerView:"auto",spaceBetween:0,grabCursor:!0,modules:[A,W],slideToClickedSlide:!0,className:"three-d-carousel__swiper rounded-box relative aspect-[103/30] overflow-visible",effect:"coverflow",coverflowEffect:{rotate:0,stretch:P,depth:300,modifier:1,slideShadows:!0},children:v.map((e,l)=>t(C,{className:"three-d-carousel__slide relative !w-1/2 cursor-grab overflow-hidden opacity-0 [.swiper-slide-next&]:opacity-100 [.swiper-slide-prev&]:opacity-100 [.swiper-slide-visible&]:opacity-100",children:({isActive:a})=>o(G,{children:[t(y,{source:e.imageUrl?.url||"",alt:e.imageUrl?.alt||e.title,className:i("three-d-carousel__image rounded-box mx-auto h-full overflow-hidden"),imgClassName:"h-full object-cover",style:{filter:a?"":"brightness(50%) contrast(120%)"}}),o("div",{className:i("three-d-carousel__image-content tablet:p-[24px] desktop:p-[24px] lg-desktop:p-[32px] text-info-primary absolute left-0 top-0 box-border flex size-full flex-col justify-end gap-1 p-[16px]",{"aiui-dark":e.theme==="dark","opacity-0":!a}),children:[t(u,{as:"h3",size:3,html:e.title}),t(N,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-description lg-desktop:text-[18px] desktop:text-[16px] text-[14px]"}),e.buttonText&&t("a",{href:x(e.buttonLink),...g(e),className:"three-d-carousel__image-link ",children:t(k,{size:"base",variant:"secondary",className:"three-d-carousel__image-button desktop:mt-6 mt-4",children:e.buttonText})})]})]})},l))}),o("div",{className:"three-d-carousel__nav-controls pointer-events-none absolute inset-0 z-20",children:[t("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--prev pointer-events-auto absolute left-[calc(25%-24px)] top-1/2 -translate-x-full -translate-y-1/2",onClick:()=>r.current?.slidePrev(),"aria-label":"Previous slide",children:t(q,{})}),t("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--next pointer-events-auto absolute right-[calc(25%-24px)] top-1/2 -translate-y-1/2 translate-x-full",onClick:()=>r.current?.slideNext(),"aria-label":"Next slide",children:t(F,{})})]})]}),t("div",{className:"three-d-carousel__mobile laptop:hidden mt-[24px] block w-full overflow-visible",children:t(S,{loop:!0,slidesPerView:"auto",spaceBetween:12,grabCursor:!0,className:"three-d-carousel__swiper-mobile relative w-full !overflow-visible",children:v.map((e,l)=>o(C,{className:"three-d-carousel__slide-mobile relative !h-[360px] !w-[296px] cursor-grab overflow-hidden",children:[t(y,{source:e.mobImageUrl?.url||e.imageUrl?.url||"",alt:e.mobImageUrl?.alt||e.title,className:"three-d-carousel__image-mobile rounded-box mx-auto h-full overflow-hidden",imgClassName:"h-full object-cover"}),o("div",{className:i("three-d-carousel__image-mobile-content text-info-primary absolute left-0 top-0 flex size-full flex-col justify-end gap-1 p-[16px]",{"aiui-dark":e.theme==="dark"}),children:[t(u,{as:"h3",size:3,html:e.title}),t(N,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-mobile-description text-[14px]"}),e.buttonText&&t("a",{href:x(e.buttonLink),...g(e),className:"three-d-carousel__image-mobile-link ",children:t(k,{size:"base",variant:"secondary",className:"three-d-carousel__image-mobile-button mt-3",children:e.buttonText})})]})]},l))})})]})});L.displayName="ThreeDCarousel";var ce=I(L,{style:"overflow: hidden;"});export{ce as default};
@@ -251,6 +251,7 @@ export declare const PAYLOAD_COMPONENT_MAP: {
251
251
  export { CartSummaryHeader, CartItemRow, CartGiftSection, CartPerksSection, CartThirdPartyBanner, CartPriceSummary, } from './CartDetail/index.js';
252
252
  export type { CartSummaryHeaderProps, CartItemRowProps, CartGiftSectionProps, CartPerksSectionProps, CartPerk, CartThirdPartyProps, GiftOption, GiftSlotConfig, CartPriceSummaryProps, } from './CartDetail/index.js';
253
253
  export { useAiuiContext } from './AiuiProvider/index.js';
254
+ export type { AdTrackEvent, AdTrackContext, OnAdTrackCallback } from '../shared/adTrack.js';
254
255
  export type { ContainerProps } from '../shared/Styles.js';
255
256
  export { default as ModalRegisterSubscribe } from './ModalRegisterSubscribe/index.js';
256
257
  export { default as ModalSubscribeConfirm } from './ModalSubscribeConfirm/index.js';
@@ -1 +1 @@
1
- import{AccessoriesProductGrid as o,SectionHeader as a,PromoBanner as i,MainProductArea as s,AddToCartSuccessPopover as p}from"./AccessoriesShelf/index.js";import{default as f}from"./ActivitySchedule/index.js";import{default as n}from"./GiftShelf/index.js";import{default as u}from"./GiftTierShelf/index.js";import{default as x}from"./ActivityMechanism/index.js";import{default as S}from"./BrandEquity/index.js";import{default as P}from"./MemberEquity/index.js";import{default as g}from"./Slogan/index.js";import{default as B}from"./Title/index.js";import{default as T}from"./Spacer/index.js";import{default as b}from"./ShelfDisplay/index.js";import{default as D}from"./ShelfDisplayHorizontal/index.js";import{default as j}from"./Evaluate/index.js";import{default as L}from"./Category/index.js";import{default as V}from"./HeroBanner/index.js";import{default as k}from"./AccordionCards/index.js";import{default as W}from"./Graphic/index.js";import{default as H}from"./MediaPlayerBase/index.js";import{default as q}from"./MediaPlayerSticky/index.js";import{default as K}from"./MediaPlayerMulti/index.js";import{default as _}from"./Marquee/index.js";import{default as J}from"./MarqueeReview/index.js";import{default as X}from"./WhyChoose/index.js";import{default as $}from"./Faq/index.js";import{MarqueeItem as re,MarqueeImageContent as te,MarqueeTextContent as oe}from"./Marquee/index.js";import{default as ie}from"./MultiLayoutGraphicBlock/index.js";import{default as pe}from"./GraphicAttractionBlock/index.js";import{default as fe}from"./HeaderNavigation/index.js";import{default as ne}from"./FooterNavigation/index.js";import{default as ue}from"./SearchPage/index.js";import{IPC_SEARCH_PAGE as xe,SearchPageTabType as ye}from"./SearchPage/types.js";import{withLayout as he}from"../shared/Styles.js";import{default as Ce}from"./AiuiProvider/index.js";import{default as Me}from"./Tabs/index.js";import{default as ve}from"./SwiperBox/index.js";import{VideoModal as Ie}from"./VideoModal/index.js";import{default as Ae}from"./CreativeModule/index.js";import{default as Fe}from"./GraphicOverlay/index.js";import{default as Ge}from"./Specs/index.js";import{default as Oe}from"./TabsGroup/index.js";import{default as we,useBizProductContext as ke}from"./Listing/BizProductProvider.js";import{calcSummaryFinalPrice as We,calcUnlockedSaving as Ee}from"./Listing/utils/priceCalc.js";import{default as Re}from"./Listing/components/PurchaseBar/index.js";import{default as ze}from"./Listing/components/PurchaseBar/ProductActions/index.js";import{default as Ue}from"./Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js";import{default as Ye}from"./Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js";import{default as Qe}from"./Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js";import{default as Ze}from"./Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js";import{default as er}from"./Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js";import{default as tr}from"./Listing/components/ProductCard/ProductDetail/ProductOptions/index.js";import{default as ar}from"./Listing/components/ProductCard/ProductDetail/ProductBundle/index.js";import{default as sr}from"./Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js";import{default as dr}from"./Listing/components/ProductCard/ProductDetail/ProductBanner/index.js";import{default as cr}from"./Listing/components/ProductCard/ProductGridBox.js";import{default as lr}from"./Listing/components/ProductCard/ProductGallery/index.js";import{default as mr}from"./Listing/components/ProductCard/ProductSummary/index.js";import{default as yr}from"./Listing/components/ProductCard/ProductDetail/BenefitsTab.js";import{default as hr}from"./Listing/components/ProductCard/ProductDetail/CreditCouponRedeem/index.js";import{default as Cr}from"./Listing/components/PaidShipping/index.js";import{default as Mr}from"./Listing/components/CartActionButtons/index.js";import{NotifyMeDialog as vr}from"./NotifyMeDialog/index.js";import{default as Ir}from"./Listing/components/ProductCard/ProductDetail/ProductServiceBenefits/index.js";import{default as Ar}from"./Listing/components/ProductCard/ProductPaidShipping/index.js";import{default as Fr}from"./GraphicMore/index.js";import{default as Gr}from"./Features/index.js";import{default as Or}from"./AplusDesc/index.js";import{default as wr}from"./GiftBox/index.js";import{default as Nr}from"./SelectStore/index.js";import{default as Er}from"./DownLoad/index.js";import{default as Rr}from"./FootCharger/index.js";import{default as zr}from"./BrandCardLink/index.js";import*as Kr from"./IPRedirect/index.js";import{default as _r}from"./WheelLottery/index.js";import{default as Jr}from"./ProductLottery/index.js";import{default as Xr}from"./ProductCompare/index.js";import{default as $r}from"./Ksp/index.js";import{default as rt}from"./ImageTextFeature/index.js";import{default as ot}from"./FeatureCards/index.js";import{default as it}from"./FeaturedBlogPosts/index.js";import{default as pt}from"./ImageWithText/index.js";import{default as ft}from"./VideoFeature/index.js";import{default as nt}from"./TabsWithMedia/index.js";import{default as ut}from"./TabWithImage/index.js";import{default as xt}from"./FeatureShowcase/index.js";import{default as St}from"./ProductHero/index.js";import{default as Pt}from"./SpecsComparison/index.js";import{default as gt}from"./MediaSceneSwitcher/index.js";import{default as Bt}from"./MediaSceneSwitcherV2/index.js";import{default as Tt}from"./ThreeDCarousel/index.js";import{default as bt}from"./ProductNav/index.js";import{default as Dt}from"./AnchorNavigation/index.js";import{default as jt}from"./PromotionalBar/index.js";import{default as Lt}from"./EventSchedule/index.js";import{default as Vt}from"./SecondaryBanner/index.js";import{default as kt}from"./BuyOneGetOneShelf/index.js";import{default as Wt}from"./ActiveShelf/index.js";import{default as Ht}from"./MediaShelf/index.js";import{default as qt,CreditsProductCard as zt}from"./CreditsShelf/index.js";import{default as Ut,SceneProductCard as _t}from"./SceneShelf/index.js";import{default as Jt,SceneShelfV2ProductCard as Qt}from"./SceneShelfV2/index.js";import{default as Zt}from"./SceneShelfV3/index.js";import{default as eo}from"./MediaEndorsement/index.js";import{default as to}from"./MediaTextOverlay/index.js";import{default as ao}from"./ImageOverlayShelf/index.js";import{default as so,AccessoryProductCard as po}from"./AccessoriesShelf/components/AccessoryShelf/index.js";import{default as co}from"./ImageTextOverlay/index.js";import{default as lo}from"./MiniCart/index.js";import{default as mo}from"./MiniCart/CircleProgress.js";import{default as yo,MiniCartDialog as So}from"./MiniCart/MiniCartDialog.js";import{default as Po}from"./WebPushPopup/index.js";import{useEmarsysWebPush as go}from"../hooks/useEmarsysWebPush.js";const e={ActivityMechanism:"ActivityMechanism",ActivitySchedule:"ActivitySchedule",AnchorNavigation:"AnchorNavigation",EventSchedule:"EventSchedule",FeatureCards:"FeatureCards",GiftShelf:"GiftShelf",GiftTierShelf:"GiftTierShelf",ImageTextFeature:"ImageTextFeature",ImageTextOverlay:"ImageTextOverlay",ImageWithText:"ImageWithText",MarqueeReview:"MarqueeReview",MediaSceneSwitcher:"MediaSceneSwitcher",ProductCompare:"ProductCompare",ProductHero:"ProductHero",ProductNav:"ProductNav",PromotionalBar:"PromotionalBar",TabsWithMedia:"TabsWithMedia",ThreeDCarousel:"ThreeDCarousel",VideoFeature:"VideoFeature","ipc-accordioncards":"AccordionCards","ipc-active-shelf":"ActiveShelf","ipc-add-to-cart-success-popover":"AddToCartSuccessPopover","ipc-aplusdesc":"AplusDesc","ipc-banner":"HeroBanner","ipc-bogo-shelf":"BuyOneGetOneShelf","ipc-brand-card-link":"BrandCardLink","ipc-brand-equity":"BrandEquity","ipc-category":"Category","ipc-creativemodule":"CreativeModule","ipc-credits-shelf":"CreditsShelf","ipc-download":"DownLoad","ipc-evaluate":"Evaluate","ipc-faq":"Faq","ipc-features":"Features","ipc-featured-blog-posts":"FeaturedBlogPosts","ipc-footcharger":"FootCharger","ipc-ga-block":"GraphicAttractionBlock","ipc-giftbox":"GiftBox","ipc-graphic":"Graphic","ipc-graphicmore":"GraphicMore","ipc-graphicoverlay":"GraphicOverlay","ipc-image-overlay-shelf":"ImageOverlayShelf","ipc-marquee":"Marquee","ipc-media-endorsement":"MediaEndorsement","ipc-media-shelf":"MediaShelf","ipc-media-scene-switcher-v2":"MediaSceneSwitcherV2","ipc-media-text-overlay":"MediaTextOverlay","ipc-mediaplayerbase":"MediaPlayerBase","ipc-mediaplayermulti":"MediaPlayerMulti","ipc-mediaplayersticky":"MediaPlayerSticky","ipc-member-equity":"MemberEquity","ipc-mini-cart":"MiniCart","ipc-mlg-block":"MultiLayoutGraphicBlock","ipc-notify-me-dialog":"NotifyMeDialog","ipc-product-lottery":"ProductLottery","ipc-scene-shelf":"SceneShelf","ipc-scene-shelf-v2":"SceneShelfV2","ipc-scene-shelf-v3":"SceneShelfV3","ipc-search-page":"SearchPage","ipc-search-page-tabs":"SearchPage","ipc-secondary-banner":"SecondaryBanner","ipc-selectstore":"SelectStore","ipc-shelfdisplay":"ShelfDisplay","ipc-shelfdisplay-horizontal":"ShelfDisplayHorizontal","ipc-slogan":"Slogan","ipc-spacer":"Spacer","ipc-specs":"Specs","ipc-tabs":"Tabs","ipc-title":"Title","ipc-wheel-lottery":"WheelLottery","ipc-whychoose":"WhyChoose",ksp:"Ksp",modalCoupon:"ModalCoupon",modalRegisterSubscribe:"ModalRegisterSubscribe",modalSmsSubscribe:"ModalSmsSubscribe",modalSubscribeConfirm:"ModalSubscribeConfirm",modalVerify:"ModalVerify"};import{CartSummaryHeader as Bo,CartItemRow as vo,CartGiftSection as To,CartPerksSection as Io,CartThirdPartyBanner as bo,CartPriceSummary as Ao}from"./CartDetail/index.js";import{useAiuiContext as Fo}from"./AiuiProvider/index.js";import{default as Go}from"./ModalRegisterSubscribe/index.js";import{default as Oo}from"./ModalSubscribeConfirm/index.js";import{default as wo}from"./ModalCoupon/index.js";import{default as No}from"./ModalSmsSubscribe/index.js";import{default as Eo}from"./ModalVerify/index.js";export{o as AccessoriesProductGrid,po as AccessoryProductCard,so as AccessoryShelf,k as AccordionCards,Wt as ActiveShelf,x as ActivityMechanism,f as ActivitySchedule,p as AddToCartSuccessPopover,Ce as AiuiProvider,Dt as AnchorNavigation,Or as AplusDesc,yr as BenefitsTab,we as BizProductProvider,zr as BrandCardLink,S as BrandEquity,kt as BuyOneGetOneShelf,Mr as CartActionButtons,To as CartGiftSection,vo as CartItemRow,Io as CartPerksSection,Ao as CartPriceSummary,Bo as CartSummaryHeader,bo as CartThirdPartyBanner,L as Category,Ae as CreativeModule,hr as CreditCouponRedeem,zt as CreditsProductCard,qt as CreditsShelf,Er as DownLoad,j as Evaluate,Lt as EventSchedule,$ as Faq,ot as FeatureCards,xt as FeatureShowcase,it as FeaturedBlogPosts,Gr as Features,Rr as FootCharger,ne as FooterNavigation,wr as GiftBox,n as GiftShelf,u as GiftTierShelf,W as Graphic,pe as GraphicAttractionBlock,Fr as GraphicMore,Fe as GraphicOverlay,fe as HeaderNavigation,V as HeroBanner,xe as IPC_SEARCH_PAGE,Kr as IPRedirect,ao as ImageOverlayShelf,rt as ImageTextFeature,co as ImageTextOverlay,pt as ImageWithText,$r as Ksp,s as MainProductArea,_ as Marquee,te as MarqueeImageContent,re as MarqueeItem,J as MarqueeReview,oe as MarqueeTextContent,eo as MediaEndorsement,H as MediaPlayerBase,K as MediaPlayerMulti,q as MediaPlayerSticky,gt as MediaSceneSwitcher,Bt as MediaSceneSwitcherV2,Ht as MediaShelf,to as MediaTextOverlay,P as MemberEquity,lo as MiniCart,mo as MiniCartCircleProgress,yo as MiniCartDialog,So as MiniCartDialogComponent,wo as ModalCoupon,Go as ModalRegisterSubscribe,No as ModalSmsSubscribe,Oo as ModalSubscribeConfirm,Eo as ModalVerify,ie as MultiLayoutGraphicBlock,vr as NotifyMeDialog,e as PAYLOAD_COMPONENT_MAP,Cr as PaidShipping,ze as ProductActions,dr as ProductBanner,Ye as ProductBenefits,Ue as ProductBenefitsTabs,ar as ProductBundle,Xr as ProductCompare,sr as ProductCoupon,Ze as ProductFreeGift,er as ProductFunctionFreeGift,lr as ProductGallery,cr as ProductGridBox,St as ProductHero,Qe as ProductHighlight,Jr as ProductLottery,bt as ProductNav,tr as ProductOptions,Ar as ProductPaidShipping,Ir as ProductServiceBenefits,mr as ProductSummary,i as PromoBanner,jt as PromotionalBar,Re as PurchaseBar,_t as SceneProductCard,Ut as SceneShelf,Jt as SceneShelfV2,Qt as SceneShelfV2ProductCard,Zt as SceneShelfV3,ue as SearchPage,ye as SearchPageTabType,Vt as SecondaryBanner,a as SectionHeader,Nr as SelectStore,b as ShelfDisplay,D as ShelfDisplayHorizontal,g as Slogan,T as Spacer,Ge as Specs,Pt as SpecsComparison,ve as SwiperBox,Oe as TabGroup,ut as TabWithImage,Me as Tabs,nt as TabsWithMedia,Tt as ThreeDCarousel,B as Title,ft as VideoFeature,Ie as VideoModal,Po as WebPushPopup,_r as WheelLottery,X as WhyChoose,We as calcSummaryFinalPrice,Ee as calcUnlockedSaving,Fo as useAiuiContext,ke as useBizProductContext,go as useEmarsysWebPush,he as withLayout};
1
+ import{AccessoriesProductGrid as o,SectionHeader as a,PromoBanner as i,MainProductArea as s,AddToCartSuccessPopover as p}from"./AccessoriesShelf/index.js";import{default as f}from"./ActivitySchedule/index.js";import{default as n}from"./GiftShelf/index.js";import{default as u}from"./GiftTierShelf/index.js";import{default as x}from"./ActivityMechanism/index.js";import{default as S}from"./BrandEquity/index.js";import{default as P}from"./MemberEquity/index.js";import{default as g}from"./Slogan/index.js";import{default as T}from"./Title/index.js";import{default as B}from"./Spacer/index.js";import{default as b}from"./ShelfDisplay/index.js";import{default as D}from"./ShelfDisplayHorizontal/index.js";import{default as j}from"./Evaluate/index.js";import{default as L}from"./Category/index.js";import{default as k}from"./HeroBanner/index.js";import{default as w}from"./AccordionCards/index.js";import{default as W}from"./Graphic/index.js";import{default as H}from"./MediaPlayerBase/index.js";import{default as q}from"./MediaPlayerSticky/index.js";import{default as K}from"./MediaPlayerMulti/index.js";import{default as _}from"./Marquee/index.js";import{default as J}from"./MarqueeReview/index.js";import{default as X}from"./WhyChoose/index.js";import{default as $}from"./Faq/index.js";import{MarqueeItem as re,MarqueeImageContent as te,MarqueeTextContent as oe}from"./Marquee/index.js";import{default as ie}from"./MultiLayoutGraphicBlock/index.js";import{default as pe}from"./GraphicAttractionBlock/index.js";import{default as fe}from"./HeaderNavigation/index.js";import{default as ne}from"./FooterNavigation/index.js";import{default as ue}from"./SearchPage/index.js";import{IPC_SEARCH_PAGE as xe,SearchPageTabType as ye}from"./SearchPage/types.js";import{withLayout as he}from"../shared/Styles.js";import{default as Ce}from"./AiuiProvider/index.js";import{default as Me}from"./Tabs/index.js";import{default as ve}from"./SwiperBox/index.js";import{VideoModal as Ie}from"./VideoModal/index.js";import{default as Ae}from"./CreativeModule/index.js";import{default as Fe}from"./GraphicOverlay/index.js";import{default as Ge}from"./Specs/index.js";import{default as Oe}from"./TabsGroup/index.js";import{default as Ve,useBizProductContext as we}from"./Listing/BizProductProvider.js";import{calcSummaryFinalPrice as We,calcUnlockedSaving as Ee}from"./Listing/utils/priceCalc.js";import{default as Re}from"./Listing/components/PurchaseBar/index.js";import{default as ze}from"./Listing/components/PurchaseBar/ProductActions/index.js";import{default as Ue}from"./Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js";import{default as Ye}from"./Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js";import{default as Qe}from"./Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js";import{default as Ze}from"./Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js";import{default as er}from"./Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js";import{default as tr}from"./Listing/components/ProductCard/ProductDetail/ProductOptions/index.js";import{default as ar}from"./Listing/components/ProductCard/ProductDetail/ProductBundle/index.js";import{default as sr}from"./Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js";import{default as dr}from"./Listing/components/ProductCard/ProductDetail/ProductBanner/index.js";import{default as cr}from"./Listing/components/ProductCard/ProductGridBox.js";import{default as lr}from"./Listing/components/ProductCard/ProductGallery/index.js";import{default as mr}from"./Listing/components/ProductCard/ProductSummary/index.js";import{default as yr}from"./Listing/components/ProductCard/ProductDetail/BenefitsTab.js";import{default as hr}from"./Listing/components/ProductCard/ProductDetail/CreditCouponRedeem/index.js";import{default as Cr}from"./Listing/components/PaidShipping/index.js";import{default as Mr}from"./Listing/components/CartActionButtons/index.js";import{NotifyMeDialog as vr}from"./NotifyMeDialog/index.js";import{default as Ir}from"./Listing/components/ProductCard/ProductDetail/ProductServiceBenefits/index.js";import{default as Ar}from"./Listing/components/ProductCard/ProductPaidShipping/index.js";import{default as Fr}from"./GraphicMore/index.js";import{default as Gr}from"./Features/index.js";import{default as Or}from"./AplusDesc/index.js";import{default as Vr}from"./GiftBox/index.js";import{default as Nr}from"./SelectStore/index.js";import{default as Er}from"./DownLoad/index.js";import{default as Rr}from"./FootCharger/index.js";import{default as zr}from"./BrandCardLink/index.js";import*as Kr from"./IPRedirect/index.js";import{default as _r}from"./WheelLottery/index.js";import{default as Jr}from"./ProductLottery/index.js";import{default as Xr}from"./ProductCompare/index.js";import{default as $r}from"./Ksp/index.js";import{default as rt}from"./ImageTextFeature/index.js";import{default as ot}from"./FeatureCards/index.js";import{default as it}from"./FeaturedBlogPosts/index.js";import{default as pt}from"./ImageWithText/index.js";import{default as ft}from"./VideoFeature/index.js";import{default as nt}from"./TabsWithMedia/index.js";import{default as ut}from"./TabWithImage/index.js";import{default as xt}from"./FeatureShowcase/index.js";import{default as St}from"./ProductHero/index.js";import{default as Pt}from"./SpecsComparison/index.js";import{default as gt}from"./MediaSceneSwitcher/index.js";import{default as Tt}from"./MediaSceneSwitcherV2/index.js";import{default as Bt}from"./ThreeDCarousel/index.js";import{default as bt}from"./ProductNav/index.js";import{default as Dt}from"./AnchorNavigation/index.js";import{default as jt}from"./PromotionalBar/index.js";import{default as Lt}from"./EventSchedule/index.js";import{default as kt}from"./SecondaryBanner/index.js";import{default as wt}from"./BuyOneGetOneShelf/index.js";import{default as Wt}from"./ActiveShelf/index.js";import{default as Ht}from"./MediaShelf/index.js";import{default as qt,CreditsProductCard as zt}from"./CreditsShelf/index.js";import{default as Ut,SceneProductCard as _t}from"./SceneShelf/index.js";import{default as Jt,SceneShelfV2ProductCard as Qt}from"./SceneShelfV2/index.js";import{default as Zt}from"./SceneShelfV3/index.js";import{default as eo}from"./MediaEndorsement/index.js";import{default as to}from"./MediaTextOverlay/index.js";import{default as ao}from"./ImageOverlayShelf/index.js";import{default as so,AccessoryProductCard as po}from"./AccessoriesShelf/components/AccessoryShelf/index.js";import{default as co}from"./ImageTextOverlay/index.js";import{default as lo}from"./MiniCart/index.js";import{default as mo}from"./MiniCart/CircleProgress.js";import{default as yo,MiniCartDialog as So}from"./MiniCart/MiniCartDialog.js";import{default as Po}from"./WebPushPopup/index.js";import{useEmarsysWebPush as go}from"../hooks/useEmarsysWebPush.js";const e={ActivityMechanism:"ActivityMechanism",ActivitySchedule:"ActivitySchedule",AnchorNavigation:"AnchorNavigation",EventSchedule:"EventSchedule",FeatureCards:"FeatureCards",GiftShelf:"GiftShelf",GiftTierShelf:"GiftTierShelf",ImageTextFeature:"ImageTextFeature",ImageTextOverlay:"ImageTextOverlay",ImageWithText:"ImageWithText",MarqueeReview:"MarqueeReview",MediaSceneSwitcher:"MediaSceneSwitcher",ProductCompare:"ProductCompare",ProductHero:"ProductHero",ProductNav:"ProductNav",PromotionalBar:"PromotionalBar",TabsWithMedia:"TabsWithMedia",ThreeDCarousel:"ThreeDCarousel",VideoFeature:"VideoFeature","ipc-accordioncards":"AccordionCards","ipc-active-shelf":"ActiveShelf","ipc-add-to-cart-success-popover":"AddToCartSuccessPopover","ipc-aplusdesc":"AplusDesc","ipc-banner":"HeroBanner","ipc-bogo-shelf":"BuyOneGetOneShelf","ipc-brand-card-link":"BrandCardLink","ipc-brand-equity":"BrandEquity","ipc-category":"Category","ipc-creativemodule":"CreativeModule","ipc-credits-shelf":"CreditsShelf","ipc-download":"DownLoad","ipc-evaluate":"Evaluate","ipc-faq":"Faq","ipc-features":"Features","ipc-featured-blog-posts":"FeaturedBlogPosts","ipc-footcharger":"FootCharger","ipc-ga-block":"GraphicAttractionBlock","ipc-giftbox":"GiftBox","ipc-graphic":"Graphic","ipc-graphicmore":"GraphicMore","ipc-graphicoverlay":"GraphicOverlay","ipc-image-overlay-shelf":"ImageOverlayShelf","ipc-marquee":"Marquee","ipc-media-endorsement":"MediaEndorsement","ipc-media-shelf":"MediaShelf","ipc-media-scene-switcher-v2":"MediaSceneSwitcherV2","ipc-media-text-overlay":"MediaTextOverlay","ipc-mediaplayerbase":"MediaPlayerBase","ipc-mediaplayermulti":"MediaPlayerMulti","ipc-mediaplayersticky":"MediaPlayerSticky","ipc-member-equity":"MemberEquity","ipc-mini-cart":"MiniCart","ipc-mlg-block":"MultiLayoutGraphicBlock","ipc-notify-me-dialog":"NotifyMeDialog","ipc-product-lottery":"ProductLottery","ipc-scene-shelf":"SceneShelf","ipc-scene-shelf-v2":"SceneShelfV2","ipc-scene-shelf-v3":"SceneShelfV3","ipc-search-page":"SearchPage","ipc-search-page-tabs":"SearchPage","ipc-secondary-banner":"SecondaryBanner","ipc-selectstore":"SelectStore","ipc-shelfdisplay":"ShelfDisplay","ipc-shelfdisplay-horizontal":"ShelfDisplayHorizontal","ipc-slogan":"Slogan","ipc-spacer":"Spacer","ipc-specs":"Specs","ipc-tabs":"Tabs","ipc-title":"Title","ipc-wheel-lottery":"WheelLottery","ipc-whychoose":"WhyChoose",ksp:"Ksp",modalCoupon:"ModalCoupon",modalRegisterSubscribe:"ModalRegisterSubscribe",modalSmsSubscribe:"ModalSmsSubscribe",modalSubscribeConfirm:"ModalSubscribeConfirm",modalVerify:"ModalVerify"};import{CartSummaryHeader as To,CartItemRow as vo,CartGiftSection as Bo,CartPerksSection as Io,CartThirdPartyBanner as bo,CartPriceSummary as Ao}from"./CartDetail/index.js";import{useAiuiContext as Fo}from"./AiuiProvider/index.js";import{default as Go}from"./ModalRegisterSubscribe/index.js";import{default as Oo}from"./ModalSubscribeConfirm/index.js";import{default as Vo}from"./ModalCoupon/index.js";import{default as No}from"./ModalSmsSubscribe/index.js";import{default as Eo}from"./ModalVerify/index.js";export{o as AccessoriesProductGrid,po as AccessoryProductCard,so as AccessoryShelf,w as AccordionCards,Wt as ActiveShelf,x as ActivityMechanism,f as ActivitySchedule,p as AddToCartSuccessPopover,Ce as AiuiProvider,Dt as AnchorNavigation,Or as AplusDesc,yr as BenefitsTab,Ve as BizProductProvider,zr as BrandCardLink,S as BrandEquity,wt as BuyOneGetOneShelf,Mr as CartActionButtons,Bo as CartGiftSection,vo as CartItemRow,Io as CartPerksSection,Ao as CartPriceSummary,To as CartSummaryHeader,bo as CartThirdPartyBanner,L as Category,Ae as CreativeModule,hr as CreditCouponRedeem,zt as CreditsProductCard,qt as CreditsShelf,Er as DownLoad,j as Evaluate,Lt as EventSchedule,$ as Faq,ot as FeatureCards,xt as FeatureShowcase,it as FeaturedBlogPosts,Gr as Features,Rr as FootCharger,ne as FooterNavigation,Vr as GiftBox,n as GiftShelf,u as GiftTierShelf,W as Graphic,pe as GraphicAttractionBlock,Fr as GraphicMore,Fe as GraphicOverlay,fe as HeaderNavigation,k as HeroBanner,xe as IPC_SEARCH_PAGE,Kr as IPRedirect,ao as ImageOverlayShelf,rt as ImageTextFeature,co as ImageTextOverlay,pt as ImageWithText,$r as Ksp,s as MainProductArea,_ as Marquee,te as MarqueeImageContent,re as MarqueeItem,J as MarqueeReview,oe as MarqueeTextContent,eo as MediaEndorsement,H as MediaPlayerBase,K as MediaPlayerMulti,q as MediaPlayerSticky,gt as MediaSceneSwitcher,Tt as MediaSceneSwitcherV2,Ht as MediaShelf,to as MediaTextOverlay,P as MemberEquity,lo as MiniCart,mo as MiniCartCircleProgress,yo as MiniCartDialog,So as MiniCartDialogComponent,Vo as ModalCoupon,Go as ModalRegisterSubscribe,No as ModalSmsSubscribe,Oo as ModalSubscribeConfirm,Eo as ModalVerify,ie as MultiLayoutGraphicBlock,vr as NotifyMeDialog,e as PAYLOAD_COMPONENT_MAP,Cr as PaidShipping,ze as ProductActions,dr as ProductBanner,Ye as ProductBenefits,Ue as ProductBenefitsTabs,ar as ProductBundle,Xr as ProductCompare,sr as ProductCoupon,Ze as ProductFreeGift,er as ProductFunctionFreeGift,lr as ProductGallery,cr as ProductGridBox,St as ProductHero,Qe as ProductHighlight,Jr as ProductLottery,bt as ProductNav,tr as ProductOptions,Ar as ProductPaidShipping,Ir as ProductServiceBenefits,mr as ProductSummary,i as PromoBanner,jt as PromotionalBar,Re as PurchaseBar,_t as SceneProductCard,Ut as SceneShelf,Jt as SceneShelfV2,Qt as SceneShelfV2ProductCard,Zt as SceneShelfV3,ue as SearchPage,ye as SearchPageTabType,kt as SecondaryBanner,a as SectionHeader,Nr as SelectStore,b as ShelfDisplay,D as ShelfDisplayHorizontal,g as Slogan,B as Spacer,Ge as Specs,Pt as SpecsComparison,ve as SwiperBox,Oe as TabGroup,ut as TabWithImage,Me as Tabs,nt as TabsWithMedia,Bt as ThreeDCarousel,T as Title,ft as VideoFeature,Ie as VideoModal,Po as WebPushPopup,_r as WheelLottery,X as WhyChoose,We as calcSummaryFinalPrice,Ee as calcUnlockedSaving,Fo as useAiuiContext,we as useBizProductContext,go as useEmarsysWebPush,he as withLayout};
@@ -1 +1 @@
1
- "use client";import{Fragment as h,jsx as s,jsxs as C}from"react/jsx-runtime";import u from"react";import{Slot as x}from"@radix-ui/react-slot";import{cn as d}from"../helpers/index.js";import{cva as v}from"class-variance-authority";const P=v("tracking hover:text-brand-0 font-bold underline transition-colors",{variants:{size:{base:"text-text-2",lg:"text-text-3"},variant:{secondary:"text-info-secondary hover:text-info-primary",primary:"text-info-primary hover:text-brand-0"}}}),p=u.forwardRef(({children:o,size:m="base",variant:l="primary",className:c,asChild:r=!1,href:n,style:a,disabled:e=!1,suffixIcon:t,onClick:f,...y},k)=>s(r?x:"a",{ref:k,onClick:i=>{if(!e&&f?.(i),e||!n){i.preventDefault();return}},href:e?void 0:n,className:d(P({size:m,variant:l}),c,{"flex items-center":t,"cursor-pointer":!e,"text-info-quaternary cursor-not-allowed hover:text-info-quaternary":e}),...a?{style:a}:null,...y,children:r?o:C(h,{children:[o,t&&s("span",{className:"svg",children:t})]})}));p.displayName="Link";var V=p;export{V as default};
1
+ "use client";import{Fragment as h,jsx as l,jsxs as R}from"react/jsx-runtime";import s from"react";import{Slot as x}from"@radix-ui/react-slot";import{cn as v}from"../helpers/index.js";import{cva as C}from"class-variance-authority";const P=C("tracking hover:text-brand-0 font-bold underline transition-colors",{variants:{size:{base:"text-text-2",lg:"text-text-3"},variant:{secondary:"text-info-secondary hover:text-info-primary",primary:"text-info-primary hover:text-brand-0"}}}),p=s.forwardRef(({children:t,size:m="base",variant:c="primary",className:f,asChild:y=!1,href:r,style:n,disabled:e=!1,suffixIcon:o,onClick:k,...u},d)=>{const a=y&&s.isValidElement(t);return l(a?x:"a",{ref:d,onClick:i=>{if(!e&&k?.(i),e||!r){i.preventDefault();return}},href:e?void 0:r,className:v(P({size:m,variant:c}),f,{"flex items-center":o,"cursor-pointer":!e,"text-info-quaternary cursor-not-allowed hover:text-info-quaternary":e}),...n?{style:n}:null,...u,children:a?t:R(h,{children:[t,o&&l("span",{className:"svg",children:o})]})})});p.displayName="Link";var S=p;export{S as default};
@@ -0,0 +1,27 @@
1
+ import { type AmazonLinkFields } from '../shared/amazonAttribution.js';
2
+ import { type AdTrackContext, type AdTrackFields } from '../shared/adTrack.js';
3
+ export type BoaButtonFields = AmazonLinkFields & AdTrackFields;
4
+ export interface ResolvedBoaLink {
5
+ /** 最终链接。非亚马逊链接、开关关闭、服务端渲染阶段都返回原链接 */
6
+ href: string | undefined;
7
+ /** 是否按亚马逊链接处理(开关打开且按钮已勾选) */
8
+ isAmazon: boolean;
9
+ }
10
+ export interface UseBoaButtonResult {
11
+ /** 页面级开关是否打开 */
12
+ enabled: boolean;
13
+ /** 按按钮配置解析链接,亚马逊链接补全归因参数 */
14
+ resolveLink: (href: string | undefined, fields?: AmazonLinkFields) => ResolvedBoaLink;
15
+ /** 该按钮是否有可交接的有效埋点事件 */
16
+ hasAdTrack: (fields?: AdTrackFields) => boolean;
17
+ /** 按钮被点击时,把有效埋点事件交给业务端。业务端未接入时静默跳过 */
18
+ trackAd: (fields: AdTrackFields | undefined, context: AdTrackContext) => void;
19
+ }
20
+ /**
21
+ * BOA 按钮能力:亚马逊链接归因参数拼接 + 广告埋点数据交接。
22
+ *
23
+ * - 服务端渲染输出原链接;挂载后再带上访客落地页的 utm 参数写入完整链接
24
+ * - 页面级开关(AiuiProvider.componentBoaEnabled)关闭时,链接保持原样
25
+ * - 埋点不依赖「自定义按钮事件」,只看按钮自己的 hasTrack 与 trackEvents
26
+ */
27
+ export declare const useBoaButton: () => UseBoaButtonResult;
@@ -0,0 +1 @@
1
+ import{useCallback as r,useEffect as p,useState as B}from"react";import{useAiuiContext as T}from"../biz-components/AiuiProvider/index.js";import{buildAmazonUrl as g}from"../shared/amazonAttribution.js";import{getValidAdTrackEvents as l}from"../shared/adTrack.js";const C=()=>{const{componentBoaEnabled:u,amazonAttribution:i,onAdTrack:o}=T(),[a,k]=B(void 0);p(()=>{k(window.location.search)},[]);const s=!!u,d=i?.adCampaign,c=i?.maas,A=r((e,t)=>{const n=s&&!!t?.isAmazonlink;return!n||!e?{href:e,isAmazon:n}:a===void 0?{href:e,isAmazon:n}:{href:g(e,{buttonAdCampaign:t?.adCampaign,pageAdCampaign:d,maas:c,search:a}),isAmazon:n}},[s,c,d,a]),f=r(e=>l(e).length>0,[]),m=r((e,t)=>{if(typeof o!="function")return;const n=l(e);if(n.length!==0)try{o(n,t)}catch{typeof process<"u"}},[o]);return{enabled:s,resolveLink:A,hasAdTrack:f,trackAd:m}};export{C as useBoaButton};
@@ -1 +1 @@
1
- import{useRef as R,useState as l,useEffect as L}from"react";function T(i={}){const{dragSpeed:v=1,enableMomentum:p=!0,dragElastic:D=.1}=i,o=R(null),[g,M]=l(!1),[u,f]=l(0),[m,b]=l(!1),[S,h]=l(!1),n=()=>{const r=o.current;if(!r)return;const{scrollLeft:e,scrollWidth:t,clientWidth:s}=r,a=t-s,d=a>0?e/a*100:0;f(Math.min(100,Math.max(0,d))),b(e>0),h(e<a-1)};L(()=>{const r=o.current;if(!r)return;n(),r.addEventListener("scroll",n);const e=new ResizeObserver(n);return e.observe(r),()=>{r.removeEventListener("scroll",n),e.disconnect()}},[]);const c=(r,e=!0)=>{const t=o.current;t&&t.scrollTo({left:r,behavior:e?"smooth":"auto"})};return{containerRef:o,isDragging:g,scrollProgress:u,canScrollLeft:m,canScrollRight:S,scrollTo:c,scrollLeft:(r=300)=>{const e=o.current;if(!e)return;const t=Math.max(0,e.scrollLeft-r);c(t)},scrollRight:(r=300)=>{const e=o.current;if(!e)return;const t=e.scrollWidth-e.clientWidth,s=Math.min(t,e.scrollLeft+r);c(s)}}}export{T as useDraggableScroll};
1
+ import{useRef as d,useState as l,useEffect as L}from"react";function T(i={}){const{dragSpeed:v=1,enableMomentum:p=!0,dragElastic:D=.1}=i,o=d(null),[g,M]=l(!1),[u,f]=l(0),[m,b]=l(!1),[S,h]=l(!1),n=()=>{const r=o.current;if(!r)return;const{scrollLeft:e,scrollWidth:t,clientWidth:s}=r,a=t-s,R=a>0?e/a*100:0;f(Math.min(100,Math.max(0,R))),b(e>0),h(e<a-1)};L(()=>{const r=o.current;if(!r)return;n(),r.addEventListener("scroll",n);const e=new ResizeObserver(n);return e.observe(r),()=>{r.removeEventListener("scroll",n),e.disconnect()}},[]);const c=(r,e=!0)=>{const t=o.current;t&&t.scrollTo({left:r,behavior:e?"smooth":"auto"})};return{containerRef:o,isDragging:g,scrollProgress:u,canScrollLeft:m,canScrollRight:S,scrollTo:c,scrollLeft:(r=300)=>{const e=o.current;if(!e)return;const t=Math.max(0,e.scrollLeft-r);c(t)},scrollRight:(r=300)=>{const e=o.current;if(!e)return;const t=e.scrollWidth-e.clientWidth,s=Math.min(t,e.scrollLeft+r);c(s)}}}export{T as useDraggableScroll};
@@ -15,5 +15,5 @@ interface ExposureOptions {
15
15
  /** 创意 ID(图片/视频媒体 ID),用于区分轮播中的具体创意 → creative_id */
16
16
  creativeId?: string;
17
17
  }
18
- export declare const useExposure: (ref: RefObject<HTMLElement>, { componentType, componentName, componentTitle, componentDescription, navigation, position, pageGroup: explicitPageGroup, category, creativeId, }: ExposureOptions) => void;
18
+ export declare const useExposure: (ref: RefObject<HTMLElement | null>, { componentType, componentName, componentTitle, componentDescription, navigation, position, pageGroup: explicitPageGroup, category, creativeId, }: ExposureOptions) => void;
19
19
  export {};
@@ -1 +1 @@
1
- import{useMemo as o}from"react";import{gaTrack as b,toPlainTrackingText as y}from"../shared/track.js";import{buildPageGroup as v}from"../shared/trackUrlRef.js";import{useIntersectionObserverDelay as G}from"./useIntersectionObserver.js";import{useAiuiContext as S}from"../biz-components/AiuiProvider/index.js";import{convertLexicalToPlaintext as E}from"@payloadcms/richtext-lexical/plaintext";const H=(_,{componentType:n,componentName:i,componentTitle:t,componentDescription:r,navigation:a="",position:p=1,pageGroup:s,category:c,creativeId:l=""})=>{const{trackingData:g,onExposure:m,pageHandle:u}=S(),d=o(()=>c||v({pageHandle:u,pageGroup:s||g.pageGroup}),[c,s,u,g.pageGroup]),f=o(()=>{const e=typeof t=="object"&&t!==null?E({data:t}):t;return typeof e=="string"?y(e):e},[t]),x=o(()=>{const e=typeof r=="object"&&r!==null?E({data:r}):r;return typeof e=="string"?y(e):e},[r]);G(_,{once:!0,threshold:.5,delay:2e3,callback:()=>{m?m({componentType:n,componentName:i,componentTitle:f,componentDescription:x,navigation:a,pageGroup:d,position:p,creativeId:l}):b({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:d,component_type:n,component_name:i,position:p,creative_id:l,component_title:f,component_description:x,navigation:a}})}})};export{H as useExposure};
1
+ import{useMemo as o}from"react";import{gaTrack as b,toPlainTrackingText as y}from"../shared/track.js";import{buildPageGroup as v}from"../shared/trackUrlRef.js";import{useIntersectionObserverDelay as G}from"./useIntersectionObserver.js";import{useAiuiContext as S}from"../biz-components/AiuiProvider/index.js";import{convertLexicalToPlaintext as E}from"@payloadcms/richtext-lexical/plaintext";const H=(_,{componentType:n,componentName:i,componentTitle:t,componentDescription:r,navigation:a="",position:p=1,pageGroup:s,category:l,creativeId:c=""})=>{const{trackingData:g,onExposure:u,pageHandle:m}=S(),d=o(()=>l||v({pageHandle:m,pageGroup:s||g.pageGroup}),[l,s,m,g.pageGroup]),f=o(()=>{const e=typeof t=="object"&&t!==null?E({data:t}):t;return typeof e=="string"?y(e):e},[t]),x=o(()=>{const e=typeof r=="object"&&r!==null?E({data:r}):r;return typeof e=="string"?y(e):e},[r]);G(_,{once:!0,threshold:.5,delay:2e3,callback:()=>{u?u({componentType:n,componentName:i,componentTitle:f,componentDescription:x,navigation:a,pageGroup:d,position:p,creativeId:c}):b({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:d,component_type:n,component_name:i,position:p,creative_id:c,component_title:f,component_description:x,navigation:a}})}})};export{H as useExposure};
@@ -27,5 +27,5 @@ interface ViewItemListOptions {
27
27
  itemListName?: string;
28
28
  items?: ViewItemListProduct[];
29
29
  }
30
- export declare const useViewItemList: (ref: RefObject<HTMLElement>, { componentType, componentName, componentTitle, componentDescription, navigation, position, itemListName, itemListId, items, tabName, pageGroup: explicitPageGroup, category, currency, }: ViewItemListOptions) => void;
30
+ export declare const useViewItemList: (ref: RefObject<HTMLElement | null>, { componentType, componentName, componentTitle, componentDescription, navigation, position, itemListName, itemListId, items, tabName, pageGroup: explicitPageGroup, category, currency, }: ViewItemListOptions) => void;
31
31
  export {};
@@ -3,6 +3,12 @@ export { gaTrack, trackSelectItem, buildClickTrackingProps, resolveComponentMedi
3
3
  export type { SelectItemProduct, TrackSelectItemOptions, ComponentMediaType, ClickTrackingPropsInput, TrackComponentClickOptions, } from './shared/track.js';
4
4
  export { trackUrlRef, buildTrackingRef, buildPageGroup } from './shared/trackUrlRef.js';
5
5
  export type { BuildPageGroupOptions } from './shared/trackUrlRef.js';
6
+ export { buildAmazonUrl, extractAmazonAsin } from './shared/amazonAttribution.js';
7
+ export type { AmazonLinkFields, BuildAmazonUrlOptions } from './shared/amazonAttribution.js';
8
+ export { getValidAdTrackEvents } from './shared/adTrack.js';
9
+ export type { AdTrackChannel, AdTrackEvent, AdTrackFields, AdTrackContext, OnAdTrackCallback, } from './shared/adTrack.js';
10
+ export { useBoaButton } from './hooks/useBoaButton.js';
11
+ export type { BoaButtonFields, ResolvedBoaLink, UseBoaButtonResult } from './hooks/useBoaButton.js';
6
12
  export type { ExposureParams, OnExposureCallback } from './biz-components/AiuiProvider/index.js';
7
13
  export type { Media, Theme, Img, Video, ContainerProps, ComponentCommonProps, ResponsiveMedia, Shape, Align, CurrencyDisplayType, } from './types/props.js';
8
14
  export { default as useCountDown } from './hooks/useCountDown.js';
@@ -18,7 +24,9 @@ export type { UseTrackingOptions, UseTrackingResult } from './hooks/useTracking.
18
24
  export { useCarouselPlayback } from './hooks/useCarouselPlayback.js';
19
25
  export type { CarouselPlaybackState, CarouselSlideTrigger, UseCarouselPlaybackOptions, UseCarouselPlaybackResult, } from './hooks/useCarouselPlayback.js';
20
26
  export { cn, getLocalizedPath, noop } from './helpers/index.js';
21
- export { formatPrice, languageTerritory, PRICE_SYMBOL } from './helpers/index.js';
27
+ export { formatPrice, languageTerritory, PRICE_SYMBOL, extendLocaleMap } from './helpers/index.js';
22
28
  export { LocalizedLink, type LocalizedLinkProps } from './shared/LocalizedLink.js';
23
- export { CarouselArrows, CarouselProgressControls } from './shared/CarouselControls.js';
29
+ export { CarouselArrows, CarouselCornerToggle, CarouselProgressControls } from './shared/CarouselControls.js';
24
30
  export type { CarouselArrowsProps, CarouselProgressControlsProps } from './shared/CarouselControls.js';
31
+ export { MEDIA_GRID_SPEC, resolveMediaGridSpec, mediaGridSpecToCssVars, type GridColumns, type MediaMode, type BreakpointSpec, type MediaGridSpec, } from './shared/mediaGridSpec.js';
32
+ export { ContainerGridContext, useContainerGrid, type ContainerGridInfo } from './shared/ContainerGridContext.js';
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- export*from"./components/index.js";import{gaTrack as t,trackSelectItem as s,buildClickTrackingProps as a,resolveComponentMediaType as p,trackComponentClick as i,toPlainTrackingText as l}from"./shared/track.js";import{trackUrlRef as u,buildTrackingRef as m,buildPageGroup as c}from"./shared/trackUrlRef.js";import{default as C}from"./hooks/useCountDown.js";import{useDraggableScroll as x}from"./hooks/useDraggableScroll.js";import{useExposure as d}from"./hooks/useExposure.js";import{useGridRowCount as y}from"./hooks/useGridRowCount.js";import{useIntersectionObserverDelay as b}from"./hooks/useIntersectionObserver.js";import{useRollout as h}from"./hooks/useRollout.js";import{useViewItemList as R}from"./hooks/useViewItemList.js";import{useTracking as O}from"./hooks/useTracking.js";import{useCarouselPlayback as w}from"./hooks/useCarouselPlayback.js";import{cn as M,getLocalizedPath as v,noop as z}from"./helpers/index.js";import{formatPrice as D,languageTerritory as E,PRICE_SYMBOL as V}from"./helpers/index.js";import{LocalizedLink as B}from"./shared/LocalizedLink.js";import{CarouselArrows as _,CarouselProgressControls as q}from"./shared/CarouselControls.js";export{_ as CarouselArrows,q as CarouselProgressControls,B as LocalizedLink,V as PRICE_SYMBOL,a as buildClickTrackingProps,c as buildPageGroup,m as buildTrackingRef,M as cn,D as formatPrice,t as gaTrack,v as getLocalizedPath,E as languageTerritory,z as noop,p as resolveComponentMediaType,l as toPlainTrackingText,i as trackComponentClick,s as trackSelectItem,u as trackUrlRef,w as useCarouselPlayback,C as useCountDown,x as useDraggableScroll,d as useExposure,y as useGridRowCount,b as useIntersectionObserverDelay,h as useRollout,O as useTracking,R as useViewItemList};
1
+ export*from"./components/index.js";import{gaTrack as t,trackSelectItem as a,buildClickTrackingProps as s,resolveComponentMediaType as p,trackComponentClick as i,toPlainTrackingText as n}from"./shared/track.js";import{trackUrlRef as m,buildTrackingRef as u,buildPageGroup as c}from"./shared/trackUrlRef.js";import{buildAmazonUrl as k,extractAmazonAsin as C}from"./shared/amazonAttribution.js";import{getValidAdTrackEvents as f}from"./shared/adTrack.js";import{useBoaButton as T}from"./hooks/useBoaButton.js";import{default as P}from"./hooks/useCountDown.js";import{useDraggableScroll as b}from"./hooks/useDraggableScroll.js";import{useExposure as B}from"./hooks/useExposure.js";import{useGridRowCount as S}from"./hooks/useGridRowCount.js";import{useIntersectionObserverDelay as R}from"./hooks/useIntersectionObserver.js";import{useRollout as G}from"./hooks/useRollout.js";import{useViewItemList as O}from"./hooks/useViewItemList.js";import{useTracking as U}from"./hooks/useTracking.js";import{useCarouselPlayback as E}from"./hooks/useCarouselPlayback.js";import{cn as D,getLocalizedPath as V,noop as F}from"./helpers/index.js";import{formatPrice as Y,languageTerritory as q,PRICE_SYMBOL as H,extendLocaleMap as J}from"./helpers/index.js";import{LocalizedLink as N}from"./shared/LocalizedLink.js";import{CarouselArrows as W,CarouselCornerToggle as X,CarouselProgressControls as Z}from"./shared/CarouselControls.js";import{MEDIA_GRID_SPEC as ee,resolveMediaGridSpec as oe,mediaGridSpecToCssVars as re}from"./shared/mediaGridSpec.js";import{ContainerGridContext as ae,useContainerGrid as se}from"./shared/ContainerGridContext.js";export{W as CarouselArrows,X as CarouselCornerToggle,Z as CarouselProgressControls,ae as ContainerGridContext,N as LocalizedLink,ee as MEDIA_GRID_SPEC,H as PRICE_SYMBOL,k as buildAmazonUrl,s as buildClickTrackingProps,c as buildPageGroup,u as buildTrackingRef,D as cn,J as extendLocaleMap,C as extractAmazonAsin,Y as formatPrice,t as gaTrack,V as getLocalizedPath,f as getValidAdTrackEvents,q as languageTerritory,re as mediaGridSpecToCssVars,F as noop,p as resolveComponentMediaType,oe as resolveMediaGridSpec,n as toPlainTrackingText,i as trackComponentClick,a as trackSelectItem,m as trackUrlRef,T as useBoaButton,E as useCarouselPlayback,se as useContainerGrid,P as useCountDown,b as useDraggableScroll,B as useExposure,S as useGridRowCount,R as useIntersectionObserverDelay,G as useRollout,U as useTracking,O as useViewItemList};
@@ -0,0 +1,20 @@
1
+ import type { GridColumns } from './mediaGridSpec.js';
2
+ /**
3
+ * withLayout container 布局的栅格信息(由 withContainerLayout 注入)
4
+ */
5
+ export interface ContainerGridInfo {
6
+ /** 组件在 12 列页面栅格中占据的列数(来自 container.desktopSpan,默认 12) */
7
+ gridColumns: GridColumns;
8
+ /** 移动端栅格跨度(来自 container.mobileSpan,可选) */
9
+ mobileSpan?: number;
10
+ /** 平板档(768–1024px)栅格跨度(来自 container.tabletSpan,可选;缺省时 tablet 档沿用 desktopSpan) */
11
+ tabletSpan?: number;
12
+ }
13
+ export declare const ContainerGridContext: import("react").Context<ContainerGridInfo | null>;
14
+ /**
15
+ * 读取当前组件所处的 container 栅格信息
16
+ *
17
+ * @returns 无 provider(组件未通过 withLayout container 布局包裹)时返回
18
+ * `null`,调用方应回退到 legacy aspect-ratio 类名
19
+ */
20
+ export declare function useContainerGrid(): ContainerGridInfo | null;
@@ -0,0 +1 @@
1
+ "use client";import{createContext as n,useContext as e}from"react";const r=n(null);function o(){return e(r)}export{r as ContainerGridContext,o as useContainerGrid};
@@ -3,6 +3,8 @@ export interface ContainerProps {
3
3
  container?: {
4
4
  desktopSpan: number;
5
5
  mobileSpan: number;
6
+ /** 平板档(768–1024px)栅格跨度;缺省时保持 legacy 行为(desktopSpan 在 ≥768 生效) */
7
+ tabletSpan?: number;
6
8
  };
7
9
  }
8
10
  export interface StylesProps {
@@ -1 +1 @@
1
- import{Fragment as O,jsx as s,jsxs as G}from"react/jsx-runtime";import m,{useMemo as y}from"react";import{simpleHash as R}from"./simpleHash.js";import S from"./getKeyPropsString.js";import{Grid as g,GridItem as b}from"../components/grid.js";import{Container as w}from"../components/container.js";import T from"./ErrorBoundary.js";const N={12:"col-start-1 col-end-13",10:"col-start-2 col-end-12",8:"col-start-3 col-end-11",6:"col-start-4 col-end-10",4:"col-start-5 col-end-9"},I={12:"tablet:col-start-1 tablet:col-end-13",10:"tablet:col-start-2 tablet:col-end-12",8:"tablet:col-start-3 tablet:col-end-11",6:"tablet:col-start-4 tablet:col-end-10",4:"tablet:col-start-5 tablet:col-end-9"},d=t=>{const n=S(t);return`style_${R(n)}`},k=t=>{const{style:n,uid:e,disabled:o,containerClassName:r}=t;return{style:n,uid:e,disabled:o,containerClassName:r}},h=({style:t,uid:n=d({}),disabled:e=!1})=>!t||e?null:s("style",{suppressHydrationWarning:!0,"data-style-id":n,dangerouslySetInnerHTML:{__html:`.block-${n} { ${t} }`}}),$=(t,n)=>{const e=y(()=>t?.uid||d({...t,...n??{}}),[n,t]),o=y(()=>s(h,{...t,uid:e}),[t,e]);return{className:`block-${e} `,StyleComponent:o,uid:e,idx:n?.idx!=null?String(n.idx):void 0}},x=t=>{const{desktopSpan:n,mobileSpan:e}=t||{},o=e?N[e]:"",r=n?I[n]:"";return`${o} ${r}`.trim()},j=t=>t?typeof t=="string"?t:typeof t=="object"&&Object.entries(t).length<=0?"":Object.entries(t).map(([n,e])=>`${n.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${e}`).join("; ")+";":"",L=(t,n)=>[t,n].map(j).filter(e=>!!e).map(e=>e.trim().endsWith(";")?e:`${e};`).join(" ");function E(t,n){const e=m.forwardRef((o,r)=>{const{container:a,containerClassName:i,className:c,...l}=o;if(!a||Reflect.ownKeys(a).length===0)return s(t,{...l,className:c,ref:r});const p=[n,i,c].filter(Boolean).join(" ").trim();return s(w,{className:p,children:s(g,{className:"container_grid",children:s(b,{className:x(a),children:s(t,{...l,ref:r})})})})});return e.displayName=`WithContainerLayout(${t.displayName||t.name||"Component"})`,e}function B(t,n){const e=m.forwardRef((o,r)=>{const a=k(o),i=L(n?.style,a.style),c={...n,...a,...i&&{style:i}},{className:l,StyleComponent:p,idx:u}=$(c,o.data),{style:A,uid:F,disabled:K,className:C,...f}=o;return G(O,{children:[p,s(t,{...u?{id:u}:{},...f,className:[l,C].filter(Boolean).join(" ").trim(),ref:r})]})});return e.displayName=`WithStyleInjection(${t.displayName||t.name||"Component"})`,e}function _(t){const n=m.forwardRef((e,o)=>s(T,{children:s(t,{...e,ref:o})}));return n.displayName=`WithErrorBoundary(${t.displayName||t.name||"Component"})`,n}const P=new WeakMap;function q(t,n){if(P.has(t))return t;const e=_(B(E(t,n?.containerClassName),n));e.displayName=`WithLayout(${t.displayName||t.name||"Component"})`,P.set(t,!0);const o=e;return Object.getOwnPropertyNames(t).forEach(r=>{!(r in o)&&r!=="arguments"&&r!=="caller"&&r!=="length"&&r!=="name"&&(o[r]=t[r])}),o}export{k as getStylesProps,$ as useStyles,q as withLayout};
1
+ import{Fragment as K,jsx as s,jsxs as M}from"react/jsx-runtime";import u,{useMemo as y}from"react";import{simpleHash as g}from"./simpleHash.js";import b from"./getKeyPropsString.js";import{Grid as w,GridItem as N}from"../components/grid.js";import{Container as T}from"../components/container.js";import I from"./ErrorBoundary.js";import{ContainerGridContext as k}from"./ContainerGridContext.js";const $=[12,10,8,6,4],h=t=>{const e=typeof t=="string"?Number.parseInt(t,10):t;return $.includes(e??12)?e??12:12},x={12:"col-start-1 col-end-13",10:"col-start-2 col-end-12",8:"col-start-3 col-end-11",6:"col-start-4 col-end-10",4:"col-start-5 col-end-9"},C={12:"tablet:col-start-1 tablet:col-end-13",10:"tablet:col-start-2 tablet:col-end-12",8:"tablet:col-start-3 tablet:col-end-11",6:"tablet:col-start-4 tablet:col-end-10",4:"tablet:col-start-5 tablet:col-end-9"},G={12:"laptop:col-start-1 laptop:col-end-13",10:"laptop:col-start-2 laptop:col-end-12",8:"laptop:col-start-3 laptop:col-end-11",6:"laptop:col-start-4 laptop:col-end-10",4:"laptop:col-start-5 laptop:col-end-9"},P=t=>{const e=b(t);return`style_${g(e)}`},L=t=>{const{style:e,uid:n,disabled:o,containerClassName:r}=t;return{style:e,uid:n,disabled:o,containerClassName:r}},j=({style:t,uid:e=P({}),disabled:n=!1})=>!t||n?null:s("style",{suppressHydrationWarning:!0,"data-style-id":e,dangerouslySetInnerHTML:{__html:`.block-${e} { ${t} }`}}),_=(t,e)=>{const n=y(()=>t?.uid||P({...t,...e??{}}),[e,t]),o=y(()=>s(j,{...t,uid:n}),[t,n]);return{className:`block-${n} `,StyleComponent:o,uid:n,idx:e?.idx!=null?String(e.idx):void 0}},E=t=>{const{desktopSpan:e,mobileSpan:n,tabletSpan:o}=t||{},r=n?x[n]:"";if(!o){const c=e?C[e]:"";return`${r} ${c}`.trim()}const a=C[o]??"",l=e?G[e]:"";return`${r} ${a} ${l}`.trim()},B=t=>t?typeof t=="string"?t:typeof t=="object"&&Object.entries(t).length<=0?"":Object.entries(t).map(([e,n])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${n}`).join("; ")+";":"",O=(t,e)=>[t,e].map(B).filter(n=>!!n).map(n=>n.trim().endsWith(";")?n:`${n};`).join(" ");function v(t,e){const n=u.forwardRef((o,r)=>{const{container:a,containerClassName:l,className:c,...p}=o;if(!a||Reflect.ownKeys(a).length===0)return s(t,{...p,className:c,ref:r});const m=[e,l,c].filter(Boolean).join(" ").trim(),i=a,d={gridColumns:h(i?.desktopSpan),mobileSpan:i?.mobileSpan,tabletSpan:i?.tabletSpan};return s(T,{className:m,children:s(w,{className:"container_grid",children:s(N,{className:E(i),children:s(k.Provider,{value:d,children:s(t,{...p,ref:r})})})})})});return n.displayName=`WithContainerLayout(${t.displayName||t.name||"Component"})`,n}function A(t,e){const n=u.forwardRef((o,r)=>{const a=L(o),l=O(e?.style,a.style),c={...e,...a,...l&&{style:l}},{className:p,StyleComponent:m,idx:i}=_(c,o.data),{style:d,uid:H,disabled:D,className:S,...R}=o;return M(K,{children:[m,s(t,{...i?{id:i}:{},...R,className:[p,S].filter(Boolean).join(" ").trim(),ref:r})]})});return n.displayName=`WithStyleInjection(${t.displayName||t.name||"Component"})`,n}function F(t){const e=u.forwardRef((n,o)=>s(I,{children:s(t,{...n,ref:o})}));return e.displayName=`WithErrorBoundary(${t.displayName||t.name||"Component"})`,e}const f=new WeakMap;function X(t,e){if(f.has(t))return t;const n=F(A(v(t,e?.containerClassName),e));n.displayName=`WithLayout(${t.displayName||t.name||"Component"})`,f.set(t,!0);const o=n;return Object.getOwnPropertyNames(t).forEach(r=>{!(r in o)&&r!=="arguments"&&r!=="caller"&&r!=="length"&&r!=="name"&&(o[r]=t[r])}),o}export{L as getStylesProps,_ as useStyles,X as withLayout};