@anker-in/headless-ui 1.3.68-alpha.1789030735874 → 1.3.69

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 (65) hide show
  1. package/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +2 -39
  2. package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
  3. package/dist/cjs/biz-components/ActiveShelf/index.d.ts +1 -29
  4. package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
  5. package/dist/cjs/biz-components/ActiveShelf/types.d.ts +0 -48
  6. package/dist/cjs/biz-components/ActiveShelf/types.js +1 -1
  7. package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
  8. package/dist/cjs/biz-components/BrandEquity/BrandEquity.js +1 -1
  9. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +1 -2
  10. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js +1 -1
  11. package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
  12. package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
  13. package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
  14. package/dist/cjs/biz-components/ImageWithText/types.d.ts +2 -2
  15. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  16. package/dist/cjs/biz-components/SecondaryBanner/index.d.ts +0 -10
  17. package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
  18. package/dist/cjs/biz-components/Specs/dropdown.d.ts +1 -2
  19. package/dist/cjs/biz-components/Specs/dropdown.js +2 -2
  20. package/dist/cjs/biz-components/Specs/index.js +1 -1
  21. package/dist/cjs/components/badge.d.ts +1 -1
  22. package/dist/cjs/components/badge.js +1 -1
  23. package/dist/cjs/components/link.js +1 -1
  24. package/dist/cjs/hooks/useDraggableScroll.js +1 -1
  25. package/dist/cjs/hooks/useExposure.d.ts +1 -1
  26. package/dist/cjs/hooks/useExposure.js +1 -1
  27. package/dist/cjs/hooks/useViewItemList.d.ts +1 -1
  28. package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +2 -39
  29. package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
  30. package/dist/esm/biz-components/ActiveShelf/index.d.ts +1 -29
  31. package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
  32. package/dist/esm/biz-components/ActiveShelf/types.d.ts +0 -48
  33. package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
  34. package/dist/esm/biz-components/BrandEquity/BrandEquity.js +1 -1
  35. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +1 -2
  36. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js +1 -1
  37. package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
  38. package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
  39. package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
  40. package/dist/esm/biz-components/ImageWithText/types.d.ts +2 -2
  41. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  42. package/dist/esm/biz-components/SecondaryBanner/index.d.ts +0 -10
  43. package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
  44. package/dist/esm/biz-components/Specs/dropdown.d.ts +1 -2
  45. package/dist/esm/biz-components/Specs/dropdown.js +2 -2
  46. package/dist/esm/biz-components/Specs/index.js +1 -1
  47. package/dist/esm/components/badge.d.ts +1 -1
  48. package/dist/esm/components/badge.js +1 -1
  49. package/dist/esm/components/link.js +1 -1
  50. package/dist/esm/hooks/useDraggableScroll.js +1 -1
  51. package/dist/esm/hooks/useExposure.d.ts +1 -1
  52. package/dist/esm/hooks/useExposure.js +1 -1
  53. package/dist/esm/hooks/useViewItemList.d.ts +1 -1
  54. package/dist/tokens/oneAnker.css +0 -12
  55. package/package.json +1 -1
  56. package/style.css +2 -73
  57. package/tailwind.config.js +0 -5
  58. package/dist/cjs/biz-components/ActiveShelf/MemberLabel.d.ts +0 -40
  59. package/dist/cjs/biz-components/ActiveShelf/MemberLabel.js +0 -1
  60. package/dist/cjs/biz-components/HeaderNavigation/useNavCollapse.d.ts +0 -30
  61. package/dist/cjs/biz-components/HeaderNavigation/useNavCollapse.js +0 -1
  62. package/dist/esm/biz-components/ActiveShelf/MemberLabel.d.ts +0 -40
  63. package/dist/esm/biz-components/ActiveShelf/MemberLabel.js +0 -1
  64. package/dist/esm/biz-components/HeaderNavigation/useNavCollapse.d.ts +0 -30
  65. package/dist/esm/biz-components/HeaderNavigation/useNavCollapse.js +0 -1
@@ -1,21 +1,14 @@
1
1
  import * as React from 'react';
2
- import type { ButtonFunctionType, CopyConfig, UserType, ActivityLabel, DiscountTagStyle } from './types.js';
2
+ import type { ButtonFunctionType, CopyConfig } from './types.js';
3
3
  import type { BadgeProps } from '../../components/badge.js';
4
- import type { Img } from '../../types/props.js';
5
4
  /**
6
5
  * 语义化类名
7
6
  */
8
- export type ActiveShelfSemanticName = 'root' | 'title' | 'description' | 'tabsList' | 'promotionalBar' | 'productCard' | 'discountBadge' | 'discountBadgeText' | 'productTitle' | 'productDescription' | 'productPriceLabel' | 'productPrice' | 'originalPrice' | 'buttonGroup' | 'secondaryButton' | 'primaryButton' | 'stockTrack' | 'stockBar';
7
+ export type ActiveShelfSemanticName = 'root' | 'title' | 'description' | 'productCard' | 'productTitle' | 'productDescription' | 'productPriceLabel' | 'productPrice' | 'originalPrice' | 'buttonGroup' | 'secondaryButton' | 'primaryButton' | 'stockTrack' | 'stockBar';
9
8
  /**
10
9
  * 库存展示模式
11
10
  */
12
11
  export type StockDisplayMode = 'always' | 'never' | 'below-quantity' | 'below-percentage';
13
- interface SocialEndorsementItem {
14
- /** 图标:图片 URL 字符串,或 SVG React 节点 */
15
- icon: string | React.ReactNode;
16
- /** 无障碍标签 */
17
- label?: string;
18
- }
19
12
  /**
20
13
  * 基础产品数据接口(来自外部数据源)
21
14
  */
@@ -81,16 +74,6 @@ export interface VariantData {
81
74
  * 通用折扣数据,包括折扣title, 类型和值
82
75
  */
83
76
  coupon: any;
84
- /** 社媒背书图标(socialEndorsements: SocialEndorsementItem[] */
85
- socialEndorsements?: SocialEndorsementItem[];
86
- /** 是否有普通会员价 */
87
- hasMemberPrice?: boolean;
88
- /** 是否有付费会员价 */
89
- hasPlusMemberPrice?: boolean;
90
- /** 折扣金额(string 类型,用于左上角折扣标签展示) */
91
- discountAmount?: string;
92
- /** SKU 会员活动配置(对象数组,每项含 type 与 label) */
93
- activityLabels?: ActivityLabel[];
94
77
  }
95
78
  /**
96
79
  * 完整的产品卡片数据接口
@@ -107,10 +90,6 @@ export interface ProductCardProps {
107
90
  className?: string;
108
91
  /** 是否展示标签系统 */
109
92
  showTags?: boolean;
110
- /** 是否展示价格标签 */
111
- isShowPricesTag?: boolean;
112
- /** 是否展示会员价格 */
113
- showMemberPrice?: boolean;
114
93
  /** 库存展示模式 */
115
94
  stockDisplayMode?: StockDisplayMode;
116
95
  /** 库存阈值(当模式为 below-quantity 或 below-percentage 时使用) */
@@ -145,22 +124,6 @@ export interface ProductCardProps {
145
124
  /** 文案配置 */
146
125
  copy?: CopyConfig;
147
126
  onProductImageClick?: (product: ProductCardData) => void;
148
- /** active-shelf-items-tag(自定义标签)文案颜色。设置后会隐藏默认品牌色描边 */
149
- itemsTagTextColor?: string;
150
- /** active-shelf-items-tag 背景颜色,设置后会覆盖默认的品牌渐变背景并隐藏默认品牌色描边 */
151
- itemsTagBgColor?: string;
152
- /** 用户身份(会员标签模块) */
153
- userType?: UserType;
154
- /** 会员标签模块三种状态的装饰图 */
155
- memberImages?: Partial<Record<UserType, Img>>;
156
- /** 左上角自定义标签图标 */
157
- customTagsIcon?: Img;
158
- /** 自定义折扣标签图标样式(style1/style2/style3 为内置预设,custom 为自定义上传) */
159
- customTagStyle?: DiscountTagStyle;
160
- /** 点击会员标签模块游客副标题(注册/登录)回调 */
161
- onMemberSignUp?: () => void;
162
- /** 点击会员标签模块付费会员折扣文案(加购付费会员sku)回调 */
163
- onPlusMemberAddCart?: () => void;
164
127
  }
165
128
  /**
166
129
  * 产品卡片组件
@@ -1 +1 @@
1
- "use strict";"use client";var te=Object.create;var u=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var re=(e,a)=>{for(var s in a)u(e,s,{get:a[s],enumerable:!0})},T=(e,a,s,l)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of ie(a))!ne.call(e,o)&&o!==s&&u(e,o,{get:()=>a[o],enumerable:!(l=ae(a,o))||l.enumerable});return e};var oe=(e,a,s)=>(s=e!=null?te(se(e)):{},T(a||!e||!e.__esModule?u(s,"default",{value:e,enumerable:!0}):s,e)),le=e=>T(u({},"__esModule",{value:!0}),e);var ue={};re(ue,{ProductCard:()=>y,default:()=>be});module.exports=le(ue);var t=require("react/jsx-runtime"),p=oe(require("react")),n=require("../../helpers/index.js"),i=require("../../components/index.js"),D=require("./MemberLabel.js");const ce=5;function de(e,a,s,l){if(e===void 0)return!0;switch(e){case"always":return!0;case"never":return!1;case"below-quantity":return a===void 0?!0:s<=a;case"below-percentage":return a===void 0?!0:s/l*100<=a;default:return!0}}const me=({items:e})=>e?.length?(0,t.jsx)("div",{className:"active-shelf-display-social-endorsements desktop:gap-2 absolute right-0 top-0 z-10 flex flex-col items-center gap-1",children:e.slice(0,3).map((a,s)=>typeof a.icon=="string"?(0,t.jsx)("img",{src:a.icon,alt:a.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},s):(0,t.jsx)(i.Text,{"aria-label":a.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:a.icon},s))}):null,k={style1:{bg:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 80 83",fill:"none",className:"text-brand-0",children:(0,t.jsx)("path",{d:"M0 0H80V78.3582C80 81.1147 77.2773 83.0451 74.6762 82.1328L41.3238 70.4353C40.4669 70.1348 39.5331 70.1348 38.6762 70.4353L5.32384 82.1328C2.7227 83.0451 0 81.1147 0 78.3582L0 0Z",fill:"currentColor"})}),textClass:"aiui-dark text-info-primary"},style2:{bg:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 96 90",fill:"none",className:"text-brand-0",children:(0,t.jsx)("path",{d:"M82 0C85.3137 6.52867e-08 88 2.68629 88 6V57.5996H96L51.458 88.791C49.3923 90.2375 46.6423 90.2378 44.5762 88.792L0 57.5996H8V6C8 2.68629 10.6863 0 14 0H82Z",fill:"currentColor"})}),textClass:"aiui-dark text-info-primary"},style3:{bg:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 96 72",fill:"none",className:"text-brand-0",children:(0,t.jsx)("path",{d:"M94.4516 33.129C95.4176 34.9116 95.4179 37.0615 94.4525 38.8444L78.2019 68.8569C77.1533 70.7935 75.128 72 72.9257 72L3.40949e-06 72L0 3.0867e-06L72.927 1.44168e-07C75.1286 5.53351e-08 77.1534 1.20577 78.2023 3.14147L94.4516 33.129Z",fill:"currentColor"})}),textClass:"aiui-dark text-info-primary"}},ge=({text:e,style:a="style1",icon:s,className:l,textClassName:o})=>{if(!e)return null;const f=a==="custom"&&!!s?.url,g=a!=="custom"?k[a]:void 0;return(0,t.jsxs)("div",{className:(0,n.cn)("active-shelf-discount-badge","laptop:size-20 lg-desktop:size-24 absolute left-0 top-0 z-10 size-12",l),children:[f?(0,t.jsx)(i.Picture,{source:s.url,alt:s.alt||e,className:"block size-full",imgClassName:"block size-full object-contain"}):(g??k.style1).bg,(0,t.jsx)("span",{className:(0,n.cn)("active-shelf-discount-badge-text","tablet:text-base lg-desktop:text-2xl absolute inset-0 flex items-center justify-center text-center text-xs font-bold !leading-[1.2]",(g??k.style1).textClass,o),children:e})]})},y=p.forwardRef(({product:e,className:a,showTags:s=!0,stockDisplayMode:l,stockThresholdValue:o,onLearnMore:f,onShopNow:g,onAddToCart:M,classNames:r,secondaryButtonText:v,secondaryButtonFun:C,primaryButtonText:x,primaryButtonFun:P,showOriginalPrice:S,renderOriginalPrice:L,copy:d,onProductImageClick:N,itemsTagTextColor:m,itemsTagBgColor:h,userType:b,memberImages:I,customTagsIcon:R,customTagStyle:E,onMemberSignUp:F,onPlusMemberAddCart:_,showMemberPrice:j},q)=>{const[H,U]=p.useState(!1),[$,O]=p.useState(!1),G=!!e?.hasMemberPrice,V=!!e?.hasPlusMemberPrice,Z=e?.activityLabels??[],K=b==="guest"?"guest":"member",z=Z.find(c=>c.type===K)?.label,J=b==="guest"?d?.memberActivityLabelUnLogin:d?.memberActivityLabel,Q=!!z||!!J,W=e?.discountAmount,X=p.useMemo(()=>e?.availableForSale&&e?.quantityAvailable<=0?ce:e?.availableForSale?(e?.quantityAvailable??0)/(e?.totalInventory??1)*100:0,[e?.availableForSale,e?.quantityAvailable,e?.totalInventory]),B=async(c,w)=>{if(!c)return;const A=w==="primary"?U:O;A(!0);try{switch(c){case"buyNow":await g?.(e);break;case"addCart":await M?.(e);break;case"learnMore":await f?.(e);break;default:break}}finally{A(!1)}},Y=e.availableForSale&&e.quantityAvailable<=0,ee={...m?{color:m}:{},...h?{backgroundColor:h,backgroundImage:"none"}:{},...m||h?{outlineColor:m}:{}};return(0,t.jsxs)(i.Card,{ref:q,className:(0,n.cn)("bg-container-primary hover:bg-container-secondary-0 relative flex h-full flex-col overflow-hidden border-none",a,r?.productCard),children:[(0,t.jsx)(ge,{text:W,style:E,icon:R,className:r?.discountBadge,textClassName:r?.discountBadgeText}),(0,t.jsxs)(i.CardContent,{className:"desktop:p-6 relative flex flex-1 flex-col justify-between p-4",children:[(0,t.jsxs)("div",{className:"product-image-wrapper relative mb-4",children:[(0,t.jsx)("div",{className:"product-image lg-desktop:size-[240px] laptop::size-[180px] mx-auto size-[125px] cursor-pointer overflow-hidden",children:(0,t.jsx)("a",{onClick:()=>N?.(e),...!N&&{href:e?.listingLink},rel:"noreferrer",children:(0,t.jsx)(i.Picture,{source:e.image,alt:e.name,className:"aspect-square size-full object-contain",imgClassName:"w-full h-full object-contain"})})}),(0,t.jsx)(me,{items:e?.socialEndorsements})]}),s&&(0,t.jsx)("div",{className:"desktop:mb-2 mb-1 flex h-[24px] gap-1",children:e.tags?.map((c,w)=>c.label&&(0,t.jsx)(i.Badge,{size:"sm",variant:c.variant||"outline",className:"active-shelf-items-tag py-0",style:ee,children:c.label},w))}),(0,t.jsxs)("div",{className:"flex h-full flex-1 grow flex-col justify-between gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(i.Heading,{as:"h3",size:2,className:(0,n.cn)("text-info-primary mb-1 line-clamp-2 min-h-[2.4em]",r?.productTitle),html:e.custom_name||e.name}),e?.description&&(0,t.jsx)(i.Text,{size:2,className:(0,n.cn)("text-info-primary desktop:line-clamp-2 desktop:min-h-[2.4em] desktop:text-[16px] lg-desktop:text-[18px] line-clamp-2 min-h-[2.4em] text-[14px]",r?.productDescription),html:e.custom_description||e.description})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:(0,n.cn)(r?.productPrice),children:(0,t.jsx)("div",{className:"flex items-baseline gap-2",children:e.availableForSale?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.Heading,{size:2,className:"text-info-primary",as:"h6",children:e.price}),L?L(e,{showOriginalPrice:S}):S&&e.originalPrice&&(0,t.jsx)(i.Heading,{size:2,className:(0,n.cn)("text-info-tertiary line-through",r?.originalPrice),as:"h6",children:e.originalPrice})]}):(0,t.jsx)(i.Heading,{size:2,className:"text-info-tertiary",children:d?.outOfStockLabel??"Sold Out"})})}),e?.priceLabel&&e?.availableForSale&&(0,t.jsx)(i.Text,{size:4,className:(0,n.cn)("text-brand-0 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",r?.productPriceLabel),style:{...m?{color:m}:{}},children:e.priceLabel}),(0,t.jsxs)("div",{className:(0,n.cn)("lg-desktop:gap-3 tablet:flex-nowrap mt-2 flex flex-wrap gap-2",r?.buttonGroup),children:[v&&(0,t.jsx)(i.Button,{variant:"secondary",size:"base",className:(0,n.cn)("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",r?.secondaryButton),onClick:()=>B(C,"secondary"),disabled:!e.availableForSale&&C!=="learnMore",loading:$,"data-headless-type-name":"ActiveShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${v}`,"data-headless-sku":e.sku,children:v}),x&&(0,t.jsx)(i.Button,{variant:"primary",size:"base",className:(0,n.cn)("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",r?.primaryButton),onClick:()=>B(P,"primary"),disabled:!e.availableForSale&&P!=="learnMore",loading:H,"data-headless-type-name":"ActiveShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${x}`,"data-headless-sku":e.sku,children:x})]}),de(l,o,e?.quantityAvailable??0,e?.totalInventory??0)&&(0,t.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,t.jsx)(i.Progress,{value:X,max:100,min:0,size:"base",variant:"default","aria-label":"stock progress",classNames:{root:(0,n.cn)("bg-[var(--progress-track-bg,rgba(0,0,0,0.2))]",r?.stockTrack),progressBar:(0,n.cn)("bg-brand-0 transition-all duration-300 ease-in-out",r?.stockBar)}}),(0,t.jsx)(i.Text,{size:3,className:"text-info-tertiary text-[14px]",children:Y?d?.limitedStock:d?.stockDisplayText?.replace("{count}",`${e.availableForSale?e.quantityAvailable:0}`)})]})]})]})]}),j&&b&&(0,t.jsx)(D.MemberLabel,{userType:b,copy:d,images:I,onSignUp:F,onPlusMemberAddCart:_,hasActivity:Q,activityLabel:z,hasMemberPrice:G,hasPlusMemberPrice:V})]})});y.displayName="ActiveShelf.ProductCard";var be=y;
1
+ "use strict";"use client";var q=Object.create;var p=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var I=(e,i)=>{for(var r in i)p(e,r,{get:i[r],enumerable:!0})},C=(e,i,r,c)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of _(i))!E.call(e,s)&&s!==r&&p(e,s,{get:()=>i[s],enumerable:!(c=M(i,s))||c.enumerable});return e};var j=(e,i,r)=>(r=e!=null?q($(e)):{},C(i||!e||!e.__esModule?p(r,"default",{value:e,enumerable:!0}):r,e)),H=e=>C(p({},"__esModule",{value:!0}),e);var V={};I(V,{ProductCard:()=>u,default:()=>K});module.exports=H(V);var a=require("react/jsx-runtime"),d=j(require("react")),n=require("../../helpers/index.js"),t=require("../../components/index.js");const O=5;function G(e,i,r,c){if(e===void 0)return!0;switch(e){case"always":return!0;case"never":return!1;case"below-quantity":return i===void 0?!0:r<=i;case"below-percentage":return i===void 0?!0:r/c*100<=i;default:return!0}}const u=d.forwardRef(({product:e,className:i,showTags:r=!0,stockDisplayMode:c,stockThresholdValue:s,onLearnMore:S,onShopNow:N,onAddToCart:B,classNames:o,secondaryButtonText:b,secondaryButtonFun:y,primaryButtonText:f,primaryButtonFun:v,showOriginalPrice:x,renderOriginalPrice:k,copy:g,onProductImageClick:h},D)=>{const[L,T]=d.useState(!1),[F,z]=d.useState(!1),A=d.useMemo(()=>e?.availableForSale&&e?.quantityAvailable<=0?O:e?.availableForSale?(e?.quantityAvailable??0)/(e?.totalInventory??1)*100:0,[e?.availableForSale,e?.quantityAvailable,e?.totalInventory]),w=async(l,m)=>{if(!l)return;const P=m==="primary"?T:z;P(!0);try{switch(l){case"buyNow":await N?.(e);break;case"addCart":await B?.(e);break;case"learnMore":await S?.(e);break;default:break}}finally{P(!1)}},R=e.availableForSale&&e.quantityAvailable<=0;return(0,a.jsx)(t.Card,{ref:D,className:(0,n.cn)("bg-container-primary hover:bg-container-secondary-0 flex h-full flex-col overflow-hidden border-none",i,o?.productCard),children:(0,a.jsxs)(t.CardContent,{className:"desktop:p-6 relative flex flex-1 flex-col justify-between p-4",children:[(0,a.jsx)("div",{className:"lg-desktop:h-[28px] flex h-[24px] gap-1",children:r&&e.tags?.map((l,m)=>l.label?(0,a.jsx)(t.Badge,{size:"sm",variant:l.variant||"outline",className:(0,n.cn)(l.variant==="promotional"?"ml-2":""),promotionalType:l.promotionalType,children:l.label},m):(0,a.jsx)(d.Fragment,{children:l},m))}),(0,a.jsx)("div",{className:"product-image-wrapper lg-desktop:size-[196px] mx-auto size-[138px] cursor-pointer overflow-hidden",children:(0,a.jsx)("a",{onClick:()=>h?.(e),...!h&&{href:e?.listingLink},rel:"noreferrer",children:(0,a.jsx)(t.Picture,{source:e.image,alt:e.name,className:"aspect-square size-full object-contain",imgClassName:"w-full h-full object-contain"})})}),(0,a.jsxs)("div",{className:"flex h-full flex-1 grow flex-col justify-between",children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)(t.Heading,{as:"h3",size:2,className:(0,n.cn)("text-info-primary mb-2 line-clamp-2 min-h-[2.4em]",o?.productTitle),html:e.custom_name||e.name}),e?.description&&(0,a.jsx)(t.Text,{size:2,className:(0,n.cn)("text-info-secondary desktop:line-clamp-2 desktop:min-h-[2.4em] desktop:text-[16px] lg-desktop:text-[18px] line-clamp-2 min-h-[2.4em] text-[14px]",o?.productDescription),html:e.custom_description||e.description})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:(0,n.cn)("mb-2",o?.productPrice),children:(0,a.jsx)("div",{className:"flex items-baseline gap-2",children:e.availableForSale?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.Heading,{size:2,className:"text-info-primary",as:"h6",children:e.price}),k?k(e,{showOriginalPrice:x}):x&&e.originalPrice&&(0,a.jsx)(t.Heading,{size:2,className:(0,n.cn)("text-info-tertiary line-through",o?.originalPrice),as:"h6",children:e.originalPrice})]}):(0,a.jsx)(t.Heading,{size:2,className:"text-info-tertiary",children:g?.outOfStockLabel??"Sold Out"})})}),e?.priceLabel&&e?.availableForSale&&(0,a.jsx)(t.Text,{size:4,className:(0,n.cn)("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",o?.productPriceLabel),children:e.priceLabel}),(0,a.jsxs)("div",{className:(0,n.cn)("lg-desktop:gap-3 tablet:flex-nowrap flex flex-wrap gap-2",o?.buttonGroup),children:[b&&(0,a.jsx)(t.Button,{variant:"secondary",size:"base",className:(0,n.cn)("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",o?.secondaryButton),onClick:()=>w(y,"secondary"),disabled:!e.availableForSale&&y!=="learnMore",loading:F,"data-headless-type-name":"ActiveShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${b}`,"data-headless-sku":e.sku,children:b}),f&&(0,a.jsx)(t.Button,{variant:"primary",size:"base",className:(0,n.cn)("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",o?.primaryButton),onClick:()=>w(v,"primary"),disabled:!e.availableForSale&&v!=="learnMore",loading:L,"data-headless-type-name":"ActiveShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${f}`,"data-headless-sku":e.sku,children:f})]}),G(c,s,e?.quantityAvailable??0,e?.totalInventory??0)&&(0,a.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,a.jsx)(t.Progress,{value:A,max:100,min:0,size:"base",variant:"default","aria-label":"stock progress",classNames:{root:(0,n.cn)("bg-[var(--progress-track-bg,rgba(0,0,0,0.2))]",o?.stockTrack),progressBar:(0,n.cn)("bg-brand-0 transition-all duration-300 ease-in-out",o?.stockBar)}}),(0,a.jsx)(t.Text,{size:3,className:"text-info-tertiary text-[14px]",children:R?g?.limitedStock:g?.stockDisplayText?.replace("{count}",`${e.availableForSale?e.quantityAvailable:0}`)})]})]})]})]})})});u.displayName="ActiveShelf.ProductCard";var K=u;
@@ -1,10 +1,8 @@
1
1
  import * as React from 'react';
2
- import { type PromotionalBarProps } from '../PromotionalBar/index.js';
3
2
  import 'swiper/css';
4
3
  import 'swiper/css/navigation';
5
- import type { ButtonFunctionType, CopyConfig, UserType, DiscountTagStyle } from './types.js';
4
+ import type { ButtonFunctionType, CopyConfig } from './types.js';
6
5
  import { ProductCard, type ProductCardData, type ActiveShelfSemanticName, type StockDisplayMode } from './ProductCard.js';
7
- import type { Img } from '../../types/props.js';
8
6
  /**
9
7
  * 组件布局模式
10
8
  */
@@ -23,11 +21,6 @@ export interface ProductTab {
23
21
  tab: string;
24
22
  /** 该分组下的产品数据 */
25
23
  data: ProductCardData[];
26
- /** 资源块(如 PromotionalBar) */
27
- resourceBlocks?: Array<PromotionalBarProps['data'] & {
28
- blockType: string;
29
- display: 'visible' | 'hidden';
30
- }>;
31
24
  }
32
25
  /**
33
26
  * ActiveShelf 业务组件数据接口
@@ -70,23 +63,6 @@ export interface ActiveShelfData {
70
63
  showOriginalPrice?: boolean;
71
64
  /** 文案配置 */
72
65
  copy?: CopyConfig;
73
- /** active-shelf-items-tag(自定义标签)文案颜色。设置后会隐藏默认品牌色描边 */
74
- itemsTagTextColor?: string;
75
- /** active-shelf-items-tag 背景颜色,设置后会覆盖默认的品牌渐变背景并隐藏默认品牌色描边 */
76
- itemsTagBgColor?: string;
77
- /** 用户身份(会员标签模块) */
78
- userType?: UserType;
79
- /** 会员标签模块三种状态的装饰图 */
80
- memberImages?: Partial<Record<UserType, Img>>;
81
- /** 左上角自定义标签图标 */
82
- customTagsIcon?: Img;
83
- /** 自定义折扣标签图标样式(style1/style2/style3 为内置预设,custom 为自定义上传) */
84
- customTagStyle?: DiscountTagStyle;
85
- tileMaxRows?: number;
86
- /** 平铺布局折叠时「展开」按钮文案,默认 'Show more' */
87
- tileExpandText?: string;
88
- /** 平铺布局展开后「收起」按钮文案,默认 'Show less' */
89
- tileCollapseText?: string;
90
66
  /**
91
67
  * 产品列表(当不使用 Tab 分组时可直接传入产品列表)
92
68
  */
@@ -101,10 +77,6 @@ export interface ActiveShelfProps extends React.HTMLAttributes<HTMLDivElement> {
101
77
  onShopNow?: (product: ProductCardData) => void;
102
78
  /** 点击加入购物车回调 */
103
79
  onAddToCart?: (product: ProductCardData) => void;
104
- /** 点击会员标签模块游客副标题(注册/登录)回调 */
105
- onMemberSignUp?: () => void;
106
- /** 点击会员标签模块付费会员折扣文案(加购付费会员sku)回调 */
107
- onPlusMemberAddCart?: () => void;
108
80
  /** 语义化类名 */
109
81
  classNames?: Partial<Record<ActiveShelfSemanticName, string>>;
110
82
  /**
@@ -1 +1 @@
1
- "use strict";"use client";var ue=Object.create;var q=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var ye=(i,o)=>{for(var r in o)q(i,r,{get:o[r],enumerable:!0})},ee=(i,o,r,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of ge(o))!Te.call(i,l)&&l!==r&&q(i,l,{get:()=>o[l],enumerable:!(c=me(o,l))||c.enumerable});return i};var te=(i,o,r)=>(r=i!=null?ue(he(i)):{},ee(o||!i||!i.__esModule?q(r,"default",{value:i,enumerable:!0}):r,i)),fe=i=>ee(q({},"__esModule",{value:!0}),i);var Pe={};ye(Pe,{default:()=>Se});module.exports=fe(Pe);var e=require("react/jsx-runtime"),a=te(require("react")),T=require("../../helpers/index.js"),se=require("../../shared/Styles.js"),n=require("../../components/index.js"),ae=te(require("../PromotionalBar/index.js")),J=require("swiper/react"),ne=require("swiper/modules"),ke=require("swiper/css"),Le=require("swiper/css/navigation"),G=require("./ProductCard.js"),le=require("../../hooks/useExposure.js");const be="shelf",we="active_shelf",Ce=({disabled:i})=>(0,e.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]",children:[(0,e.jsx)("path",{d:"M0 28C0 43.464 12.536 56 28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28Z",fill:"currentColor",fillOpacity:i?"0.2":"0.6"}),(0,e.jsx)("path",{d:"M31 22L25 28L31 34",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),xe=({disabled:i})=>(0,e.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]",children:[(0,e.jsx)("path",{d:"M0 28C0 12.536 12.536 0 28 0C43.464 0 56 12.536 56 28C56 43.464 43.464 56 28 56C12.536 56 0 43.464 0 28Z",fill:"currentColor",fillOpacity:i?"0.2":"0.6"}),(0,e.jsx)("path",{d:"M25 22L31 28L25 34",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function oe(){return typeof window>"u"?2:window.matchMedia("(min-width: 1920px)").matches?3:window.matchMedia("(min-width: 1440px)").matches?4:window.matchMedia("(min-width: 768px)").matches?3:2}const K=a.forwardRef(({products:i,layoutMode:o,className:r,copy:c,showTags:l,stockDisplayMode:y,stockThresholdValue:f,onLearnMore:d,onShopNow:b,onAddToCart:H,classNames:O,secondaryButtonText:m,secondaryButtonFun:w,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:S,itemsTagBgColor:P,itemsTagTextColor:B,userType:M,memberImages:k,customTagsIcon:L,customTagStyle:U,onMemberSignUp:D,onPlusMemberAddCart:E,tileMaxRows:g,tileExpandText:$,tileCollapseText:V,showMemberPrice:N},j)=>{const A=a.useId().replace(/:/g,""),R=`swiper-button-next-custom-${A}`,I=`swiper-button-prev-custom-${A}`,[p,u]=a.useState({isBeginning:!0,isEnd:!1}),W=a.useRef(null),h=a.useCallback(()=>{const t=W.current;if(!t?.slides||t.slides.length===0)return;t.slides.forEach(z=>{z.style.height="auto"});const F=Array.from(t.slides).map(z=>z.scrollHeight),Y=Math.max(...F);Y>0&&t.slides.forEach(z=>{z.style.height=`${Y}px`})},[]);a.useEffect(()=>{const t=()=>{requestAnimationFrame(h)};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[h]);const[s,_]=a.useState(!1),[Z,ce]=a.useState(()=>oe());a.useEffect(()=>{const t=()=>ce(oe());return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);const Q=o==="flex"&&!!g&&g>0,X=g?g*Z:i.length,de=Q&&i.length>X,pe=Q&&!s?i.slice(0,X):i;return i?.length===0?null:(0,e.jsx)("div",{ref:j,className:r,children:o==="flex"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"lg-desktop:gap-4 tablet:grid-cols-3 desktop:grid-cols-4 lg-desktop:grid-cols-3 grid grid-cols-2 justify-start gap-4",children:pe.map((t,F)=>(0,e.jsx)(G.ProductCard,{product:t,className:"shrink-0",showTags:l,stockDisplayMode:y,stockThresholdValue:f,onLearnMore:d,onShopNow:b,onAddToCart:H,classNames:O,secondaryButtonText:m,secondaryButtonFun:w,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:S,itemsTagBgColor:P,itemsTagTextColor:B,copy:c,userType:M,memberImages:k,customTagsIcon:L,customTagStyle:U,onMemberSignUp:D,onPlusMemberAddCart:E,showMemberPrice:N},t.shopify_id+"-"+t.sku||F))}),de&&(0,e.jsxs)("div",{className:"hover:text-brand-0 text-info-primary mt-6 flex items-center justify-center",children:[(0,e.jsx)("button",{className:"laptop:text-base text-sm font-bold",onClick:()=>_(t=>!t),children:s?V??"Show less":$??"Show more"}),(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:(0,T.cn)("laptop:size-5 size-4",s&&"rotate-180"),width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:(0,e.jsx)("path",{d:"M17.2929 8.29302C17.6834 7.90249 18.3164 7.90249 18.707 8.29302C19.0975 8.68354 19.0975 9.31655 18.707 9.70708L12.707 15.7071C12.3164 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70708C4.90237 9.31655 4.90237 8.68354 5.29289 8.29302C5.68342 7.90249 6.31643 7.90249 6.70696 8.29302L11.9999 13.586L17.2929 8.29302Z",fill:"currentColor"})})]})]}):(0,e.jsxs)("div",{className:"group relative",children:[(0,e.jsx)(J.Swiper,{modules:[ne.Navigation],spaceBetween:16,slidesPerView:"auto",navigation:{nextEl:`.${R}`,prevEl:`.${I}`},onSwiper:t=>{W.current=t,u({isBeginning:t.isBeginning,isEnd:t.isEnd}),setTimeout(h,100)},onReachEnd:()=>{u(t=>({...t,isEnd:!0}))},onReachBeginning:()=>{u(t=>({...t,isBeginning:!0}))},onFromEdge:()=>{u({isBeginning:!1,isEnd:!1})},className:"!overflow-visible [&_.swiper-wrapper]:items-start",children:i.map((t,F)=>(0,e.jsx)(J.SwiperSlide,{className:"tablet:!w-[288px] desktop:!w-[316px] lg-desktop:!w-[404px] !h-auto !w-[296px] overflow-hidden",children:(0,e.jsx)(G.ProductCard,{product:t,className:"w-full max-w-full",showTags:l,stockDisplayMode:y,stockThresholdValue:f,onLearnMore:d,onShopNow:b,onAddToCart:H,classNames:O,secondaryButtonText:m,secondaryButtonFun:w,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:S,itemsTagBgColor:P,itemsTagTextColor:B,copy:c,userType:M,memberImages:k,customTagsIcon:L,customTagStyle:U,onMemberSignUp:D,onPlusMemberAddCart:E,showMemberPrice:N})},t.shopify_id+"-"+t.sku||F))}),(0,e.jsx)("button",{className:`${I} tablet:block absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 transition-opacity ${p.isBeginning?"pointer-events-none opacity-0":"opacity-0 group-hover:opacity-100"}`,"aria-label":c?.previousSlideLabel,children:(0,e.jsx)(Ce,{disabled:p.isBeginning})}),(0,e.jsx)("button",{className:`${R} tablet:block absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 transition-opacity ${p.isEnd?"pointer-events-none opacity-0":"opacity-0 group-hover:opacity-100"}`,"aria-label":c?.nextSlideLabel,children:(0,e.jsx)(xe,{disabled:p.isEnd})})]})})});K.displayName="ProductsList";const ie=a.forwardRef(({className:i,data:o,onLearnMore:r,onShopNow:c,onAddToCart:l,onMemberSignUp:y,onPlusMemberAddCart:f,classNames:d,renderOriginalPrice:b,...H},O)=>{const m=a.useRef(null);(0,le.useExposure)(m,{componentType:be,componentName:we,componentTitle:o.title,componentDescription:o.description}),a.useImperativeHandle(O,()=>m.current);const{theme:w="light",layoutMode:C="flex",showTags:x=!0,stockDisplayMode:v,stockThresholdValue:S,showOriginalPrice:P,secondaryButtonText:B,primaryButtonText:M,secondaryButtonFun:k,primaryButtonFun:L,isShowTab:U=!0,itemsTagBgColor:D,itemsTagTextColor:E,copy:g,userType:$,memberImages:V,customTagsIcon:N,customTagStyle:j,showMemberPrice:A,tileMaxRows:R,tileExpandText:I,tileCollapseText:p}=o,u=g||{},W=o.productsTab&&o.productsTab.length>0,h=U&&W;return(0,e.jsxs)("div",{ref:m,className:(0,T.cn)("w-full",{"aiui-dark":w==="dark"},i,d?.root),style:{"--progress-track-bg":w==="dark"?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)"},...H,children:[o.title&&(0,e.jsx)(n.Heading,{as:"h2",html:o.title,size:4,className:(0,T.cn)("text-info-primary mb-4",d?.title)}),o.description&&(0,e.jsx)(n.Text,{size:3,as:"p",html:o.description,className:(0,T.cn)("text-info-primary mb-6",d?.description)}),(0,e.jsxs)(n.Tabs,{defaultValue:o.productsTab?.[0]?.id,className:"w-full",children:[h&&(0,e.jsx)(n.TabsList,{className:"mb-6",children:o.productsTab?.map(s=>(0,e.jsx)(n.TabsTrigger,{value:s.id,children:s.tab},"tab-"+s.id))}),h?o.productsTab?.map(s=>{const _=s.resourceBlocks?.find(Z=>Z.blockType==="PromotionalBar"&&Z.display==="visible");return(0,e.jsxs)(n.TabsContent,{value:s.id,children:[_&&(0,e.jsx)(ae.default,{data:_,className:(0,T.cn)("laptop:mb-4 mb-3",d?.promotionalBar)}),(0,e.jsx)(K,{products:s.data,layoutMode:C,copy:u,showTags:x,stockDisplayMode:v,stockThresholdValue:S,onLearnMore:r,onShopNow:c,onAddToCart:l,classNames:d,secondaryButtonText:B,secondaryButtonFun:k,primaryButtonText:M,primaryButtonFun:L,showOriginalPrice:P,renderOriginalPrice:b,itemsTagBgColor:D,itemsTagTextColor:E,userType:$,memberImages:V,customTagsIcon:N,customTagStyle:j,onMemberSignUp:y,onPlusMemberAddCart:f,showMemberPrice:A,tileMaxRows:R,tileExpandText:I,tileCollapseText:p})]},"tab-content-"+s.id)}):(0,e.jsx)(K,{products:o.productsCard,layoutMode:C,copy:u,showTags:x,stockDisplayMode:v,stockThresholdValue:S,onLearnMore:r,onShopNow:c,onAddToCart:l,classNames:d,secondaryButtonText:B,secondaryButtonFun:k,primaryButtonText:M,primaryButtonFun:L,showOriginalPrice:P,renderOriginalPrice:b,itemsTagBgColor:D,itemsTagTextColor:E,userType:$,memberImages:V,customTagsIcon:N,customTagStyle:j,onMemberSignUp:y,onPlusMemberAddCart:f,showMemberPrice:A,tileMaxRows:R,tileExpandText:I,tileCollapseText:p})]})]})});ie.displayName="ActiveShelf";const re=ie;re.ProductCard=G.ProductCard;const ve=(0,se.withLayout)(re);var Se=ve;
1
+ "use strict";"use client";var j=Object.create;var N=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var J=(i,o)=>{for(var r in o)N(i,r,{get:o[r],enumerable:!0})},O=(i,o,r,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of q(o))!G.call(i,n)&&n!==r&&N(i,n,{get:()=>o[n],enumerable:!(s=_(o,n))||s.enumerable});return i};var K=(i,o,r)=>(r=i!=null?j(Z(i)):{},O(o||!i||!i.__esModule?N(r,"default",{value:i,enumerable:!0}):r,i)),Q=i=>O(N({},"__esModule",{value:!0}),i);var ie={};J(ie,{default:()=>oe});module.exports=Q(ie);var t=require("react/jsx-runtime"),l=K(require("react")),E=require("../../helpers/index.js"),V=require("../../shared/Styles.js"),a=require("../../components/index.js"),R=require("swiper/react"),I=require("swiper/modules"),ae=require("swiper/css"),ne=require("swiper/css/navigation"),A=require("./ProductCard.js"),W=require("../../hooks/useExposure.js");const U="shelf",X="active_shelf",Y=({disabled:i})=>(0,t.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]",children:[(0,t.jsx)("path",{d:"M0 28C0 43.464 12.536 56 28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28Z",fill:"currentColor",fillOpacity:i?"0.2":"0.6"}),(0,t.jsx)("path",{d:"M31 22L25 28L31 34",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),ee=({disabled:i})=>(0,t.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-primary laptop:block lg-desktop:size-[56px] hidden size-[40px]",children:[(0,t.jsx)("path",{d:"M0 28C0 12.536 12.536 0 28 0C43.464 0 56 12.536 56 28C56 43.464 43.464 56 28 56C12.536 56 0 43.464 0 28Z",fill:"currentColor",fillOpacity:i?"0.2":"0.6"}),(0,t.jsx)("path",{d:"M25 22L31 28L25 34",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),F=l.forwardRef(({products:i,layoutMode:o,className:r,copy:s,showTags:n,stockDisplayMode:c,stockThresholdValue:m,onLearnMore:P,onShopNow:B,onAddToCart:p,classNames:g,secondaryButtonText:y,secondaryButtonFun:f,primaryButtonText:T,primaryButtonFun:b,showOriginalPrice:v,renderOriginalPrice:w},M)=>{const C=l.useId().replace(/:/g,""),x=`swiper-button-next-custom-${C}`,L=`swiper-button-prev-custom-${C}`,[u,d]=l.useState({isBeginning:!0,isEnd:!1}),D=l.useRef(null),h=l.useCallback(()=>{const e=D.current;if(!e?.slides||e.slides.length===0)return;e.slides.forEach(k=>{k.style.height="auto"});const S=Array.from(e.slides).map(k=>k.scrollHeight),H=Math.max(...S);H>0&&e.slides.forEach(k=>{k.style.height=`${H}px`})},[]);return l.useEffect(()=>{const e=()=>{requestAnimationFrame(h)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[h]),i?.length===0?null:(0,t.jsx)("div",{ref:M,className:r,children:o==="flex"?(0,t.jsx)("div",{className:"lg-desktop:gap-4 tablet:grid-cols-2 laptop:grid-cols-3 desktop:grid-cols-4 laptop:gap-4 grid grid-cols-1 justify-start gap-3",children:i.map((e,S)=>(0,t.jsx)(A.ProductCard,{product:e,className:"shrink-0",showTags:n,stockDisplayMode:c,stockThresholdValue:m,onLearnMore:P,onShopNow:B,onAddToCart:p,classNames:g,secondaryButtonText:y,secondaryButtonFun:f,primaryButtonText:T,primaryButtonFun:b,showOriginalPrice:v,renderOriginalPrice:w,copy:s},e.shopify_id+"-"+e.sku||S))}):(0,t.jsxs)("div",{className:"group relative",children:[(0,t.jsx)(R.Swiper,{modules:[I.Navigation],spaceBetween:16,slidesPerView:"auto",navigation:{nextEl:`.${x}`,prevEl:`.${L}`},onSwiper:e=>{D.current=e,d({isBeginning:e.isBeginning,isEnd:e.isEnd}),setTimeout(h,100)},onReachEnd:()=>{d(e=>({...e,isEnd:!0}))},onReachBeginning:()=>{d(e=>({...e,isBeginning:!0}))},onFromEdge:()=>{d({isBeginning:!1,isEnd:!1})},className:"!overflow-visible",children:i.map((e,S)=>(0,t.jsx)(R.SwiperSlide,{className:"tablet:!w-[288px] desktop:!w-[316px] lg-desktop:!w-[404px] !w-[296px] overflow-hidden",children:(0,t.jsx)(A.ProductCard,{product:e,className:"w-full max-w-full",showTags:n,stockDisplayMode:c,stockThresholdValue:m,onLearnMore:P,onShopNow:B,onAddToCart:p,classNames:g,secondaryButtonText:y,secondaryButtonFun:f,primaryButtonText:T,primaryButtonFun:b,showOriginalPrice:v,renderOriginalPrice:w,copy:s})},e.shopify_id+"-"+e.sku||S))}),(0,t.jsx)("button",{className:`${L} tablet:block absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 transition-opacity ${u.isBeginning?"pointer-events-none opacity-0":"opacity-0 group-hover:opacity-100"}`,"aria-label":s?.previousSlideLabel,children:(0,t.jsx)(Y,{disabled:u.isBeginning})}),(0,t.jsx)("button",{className:`${x} tablet:block absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 transition-opacity ${u.isEnd?"pointer-events-none opacity-0":"opacity-0 group-hover:opacity-100"}`,"aria-label":s?.nextSlideLabel,children:(0,t.jsx)(ee,{disabled:u.isEnd})})]})})});F.displayName="ProductsList";const z=l.forwardRef(({className:i,data:o,onLearnMore:r,onShopNow:s,onAddToCart:n,classNames:c,renderOriginalPrice:m,...P},B)=>{const p=l.useRef(null);(0,W.useExposure)(p,{componentType:U,componentName:X,componentTitle:o.title,componentDescription:o.description}),l.useImperativeHandle(B,()=>p.current);const{theme:g="light",layoutMode:y="flex",showTags:f=!0,stockDisplayMode:T,stockThresholdValue:b,showOriginalPrice:v=!0,secondaryButtonText:w,primaryButtonText:M,secondaryButtonFun:C,primaryButtonFun:x,isShowTab:L=!0,copy:u}=o,d=u||{},D=o.productsTab&&o.productsTab.length>0,h=L&&D;return(0,t.jsxs)("div",{ref:p,className:(0,E.cn)("w-full",{"aiui-dark":g==="dark"},i,c?.root),style:{"--progress-track-bg":g==="dark"?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)"},...P,children:[o.title&&(0,t.jsx)(a.Heading,{as:"h2",html:o.title,size:4,className:(0,E.cn)("text-info-primary mb-4",c?.title)}),o.description&&(0,t.jsx)(a.Text,{size:3,as:"p",html:o.description,className:(0,E.cn)("text-info-primary mb-6",c?.description)}),(0,t.jsxs)(a.Tabs,{defaultValue:o.productsTab?.[0]?.id,className:"w-full",children:[h&&(0,t.jsx)(a.TabsList,{className:"mb-6",children:o.productsTab?.map(e=>(0,t.jsx)(a.TabsTrigger,{value:e.id,children:e.tab},"tab-"+e.id))}),h?o.productsTab?.map(e=>(0,t.jsx)(a.TabsContent,{value:e.id,children:(0,t.jsx)(F,{products:e.data,layoutMode:y,copy:d,showTags:f,stockDisplayMode:T,stockThresholdValue:b,onLearnMore:r,onShopNow:s,onAddToCart:n,classNames:c,secondaryButtonText:w,secondaryButtonFun:C,primaryButtonText:M,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:m})},"tab-content-"+e.id)):(0,t.jsx)(F,{products:o.productsCard,layoutMode:y,copy:d,showTags:f,stockDisplayMode:T,stockThresholdValue:b,onLearnMore:r,onShopNow:s,onAddToCart:n,classNames:c,secondaryButtonText:w,secondaryButtonFun:C,primaryButtonText:M,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:m})]})]})});z.displayName="ActiveShelf";const $=z;$.ProductCard=A.ProductCard;const te=(0,V.withLayout)($);var oe=te;
@@ -2,30 +2,6 @@
2
2
  * 按钮功能类型
3
3
  */
4
4
  export type ButtonFunctionType = 'buyNow' | 'addCart' | 'learnMore';
5
- /**
6
- * 自定义折扣标签图标样式
7
- * style1/style2/style3 为内置预设样式(写死在组件中),custom 为自定义上传图标
8
- */
9
- export type DiscountTagStyle = 'style1' | 'style2' | 'style3' | 'custom';
10
- /**
11
- * 用户身份类型
12
- */
13
- export type UserType = 'guest' | 'member' | 'plus-member';
14
- /**
15
- * SKU 会员活动标签类型
16
- * guest=会员模块游客态活动文案,member=会员模块会员态活动文案(普通会员/付费会员共用)
17
- */
18
- export type ActivityLabelType = 'guest' | 'member';
19
- /**
20
- * SKU 会员活动配置项
21
- * 依据飞书规则矩阵:activityLabels 为对象数组,每项含 type 与 label
22
- */
23
- export interface ActivityLabel {
24
- /** 标签类型:guest=游客态活动,member=会员态活动(普通/付费共用) */
25
- type: ActivityLabelType;
26
- /** 标签文案 */
27
- label: string;
28
- }
29
5
  /**
30
6
  * ActiveShelf 文案配置接口
31
7
  * 注意:secondaryButtonText 和 shopNowText 作为高频属性保持在 data 的直接属性中
@@ -45,28 +21,4 @@ export interface CopyConfig {
45
21
  outOfStockLabel?: string;
46
22
  limitedStock?: string;
47
23
  couponTag?: string;
48
- /** 会员模块游客状态标题文案 */
49
- memberTitleLabelUpgrade?: string;
50
- /** 会员模块普通会员状态标题文案 */
51
- memberTitleLabel?: string;
52
- /** 会员模块付费会员状态标题文案 */
53
- plusmemberTitleLabel?: string;
54
- /** 会员模块游客状态副标题文案 */
55
- memberSubtitleLabelUpgrade?: string;
56
- /** 会员模块普通会员状态副标题文案 */
57
- memberSubtitleLabel?: string;
58
- /** 会员模块付费会员状态副标题文案 */
59
- plusmemberSubtitleLabel?: string;
60
- /** 会员模块游客态活动文案 */
61
- memberActivityLabelUnLogin?: string;
62
- /** 会员模块会员态活动文案(普通会员/付费会员) */
63
- memberActivityLabel?: string;
64
- /** 会员模块游客态产品活动文案 */
65
- productActivityLabelUnLogin?: string;
66
- /** 会员模块会员态产品活动文案(普通会员/付费会员) */
67
- productActivityLabel?: string;
68
- /** 会员模块普通会员折扣文案 */
69
- memberDiscountLabel?: string;
70
- /** 会员模块付费会员折扣文案 */
71
- plusMemberDiscountLabel?: string;
72
24
  }
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var g=(t,e,b,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of n(e))!a.call(t,i)&&i!==b&&l(t,i,{get:()=>e[i],enumerable:!(r=s(e,i))||r.enumerable});return t};var m=t=>g(l({},"__esModule",{value:!0}),t);var o={};module.exports=m(o);
1
+ "use strict";var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var g=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of a(e))!l.call(t,i)&&i!==o&&n(t,i,{get:()=>e[i],enumerable:!(r=s(e,i))||r.enumerable});return t};var b=t=>g(n({},"__esModule",{value:!0}),t);var c={};module.exports=b(c);
@@ -1 +1 @@
1
- "use strict";"use client";var C=Object.create;var p=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var a in t)p(e,a,{get:t[a],enumerable:!0})},w=(e,t,a,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of V(t))!I.call(e,s)&&s!==a&&p(e,s,{get:()=>t[s],enumerable:!(c=P(t,s))||c.enumerable});return e};var L=(e,t,a)=>(a=e!=null?C(z(e)):{},w(t||!e||!e.__esModule?p(a,"default",{value:e,enumerable:!0}):a,e)),E=e=>w(p({},"__esModule",{value:!0}),e);var R={};B(R,{default:()=>M});module.exports=E(R);var i=require("react/jsx-runtime"),v=L(require("react")),d=require("../../helpers/index.js"),l=require("../../components/index.js"),f=require("class-variance-authority"),h=require("swiper/react"),y=require("../../shared/Styles.js");const j=(0,f.cva)("rounded-card laptop:px-6 laptop:py-4 relative flex min-w-0 flex-col justify-between gap-2 overflow-hidden px-4 py-3",{variants:{state:{"active-light":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","active-dark":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","inactive-light":"bg-[#EAEAEC]","inactive-dark":"bg-[#1E2024]"},size:{small:"laptop:h-[160px] h-[120px]",large:"laptop:h-[240px] h-[200px]"}},defaultVariants:{state:"inactive-light",size:"small"}}),u=(0,f.cva)("font-bold leading-[1.2]",{variants:{state:{"active-light":"text-white","active-dark":"text-white","inactive-light":"text-[#080A0F]","inactive-dark":"text-white"}},defaultVariants:{state:"inactive-light"}}),g=v.memo(({item:e,theme:t="light",className:a,size:c})=>{const s=e.isActive||!1,o=`${s?"active":"inactive"}-${t}`;return(0,i.jsx)("div",{className:(0,d.cn)(j({state:o,size:c}),a),"data-ui-component-id":"ActivityScheduleCard",children:(0,i.jsxs)(l.Link,{asChild:!e?.link,href:e?.link,className:"size-full no-underline hover:text-current",children:[(s?e.activeIcon:e.inactiveIcon)&&(0,i.jsx)("div",{className:"laptop:w-[160px] aspect-1 absolute right-0 top-0 z-10 w-[120px]",children:(0,i.jsx)(l.Picture,{source:s?e.activeIcon.url:e.inactiveIcon.url,alt:s?e.activeIcon.alt:e.inactiveIcon.alt,className:"aspect-square"})}),(0,i.jsxs)("div",{className:"relative z-20 flex h-full flex-col justify-between",children:[(0,i.jsx)(l.Heading,{as:"h3",size:3,html:e.title,className:(0,d.cn)(u({state:o}))}),(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,i.jsx)("div",{className:"flex flex-col justify-end overflow-hidden",children:(0,i.jsx)(l.Heading,{as:"h4",size:2,html:e.subtitle,className:(0,d.cn)(" line-clamp-2",u({state:o}))})}),c==="large"&&e.description&&(0,i.jsx)(l.Text,{html:e.description,className:(0,d.cn)("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-3 text-[14px] leading-[1.4]",u({state:o}))})]})]})]})})});g.displayName="ActivityScheduleCard";const x=v.forwardRef(({classNames:e={},data:t,...a},c)=>{const s=t.theme||"light",o=t.size||"small",r=v.useMemo(()=>t?.scheduleList?.length||2,[t?.scheduleList]),k=v.useMemo(()=>{const n=N=>{switch(N){case"mobile":return{slidesPerView:1.17,spaceBetween:12};case"tablet":return r===2?{slidesPerView:2,spaceBetween:12}:{slidesPerView:2.4,spaceBetween:12};case"laptop":return r===2?{}:r===4?{slidesPerView:3.2,spaceBetween:16}:{slidesPerView:r,spaceBetween:16};case"desktop":return r===2?{slidesPerView:2,spaceBetween:16}:{slidesPerView:r,spaceBetween:16}}},m=n("mobile"),S=n("tablet"),b=n("laptop"),A=n("desktop");return{0:m,768:S,1024:b,1440:A}},[r]);return(0,i.jsx)(l.Container,{ref:c,className:(0,d.cn)(e?.root),childClassName:"overflow-hidden","data-ui-component-id":"ActivitySchedule",...a,children:(0,i.jsx)(h.Swiper,{breakpoints:k,className:"w-full !overflow-visible",children:t.scheduleList.map((n,m)=>(0,i.jsx)(h.SwiperSlide,{children:(0,i.jsx)(g,{item:n,theme:s,size:o,className:e?.card})},"activityScheduleCardItem"+m))})})});x.displayName="ActivitySchedule";var M=(0,y.withLayout)(x);
1
+ "use strict";"use client";var C=Object.create;var p=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var a in t)p(e,a,{get:t[a],enumerable:!0})},g=(e,t,a,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of V(t))!I.call(e,s)&&s!==a&&p(e,s,{get:()=>t[s],enumerable:!(c=P(t,s))||c.enumerable});return e};var L=(e,t,a)=>(a=e!=null?C(z(e)):{},g(t||!e||!e.__esModule?p(a,"default",{value:e,enumerable:!0}):a,e)),E=e=>g(p({},"__esModule",{value:!0}),e);var R={};B(R,{default:()=>M});module.exports=E(R);var i=require("react/jsx-runtime"),v=L(require("react")),d=require("../../helpers/index.js"),l=require("../../components/index.js"),f=require("class-variance-authority"),h=require("swiper/react"),y=require("../../shared/Styles.js");const j=(0,f.cva)("rounded-card laptop:px-6 laptop:py-4 relative flex min-w-0 flex-col justify-between gap-2 overflow-hidden px-4 py-3",{variants:{state:{"active-light":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","active-dark":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","inactive-light":"bg-[#EAEAEC]","inactive-dark":"bg-[#1E2024]"},size:{small:"laptop:h-[160px] h-[120px]",large:"laptop:h-[240px] h-[200px]"}},defaultVariants:{state:"inactive-light",size:"small"}}),m=(0,f.cva)("font-bold leading-[1.2]",{variants:{state:{"active-light":"text-white","active-dark":"text-white","inactive-light":"text-[#080A0F]","inactive-dark":"text-white"}},defaultVariants:{state:"inactive-light"}}),w=v.memo(({item:e,theme:t="light",className:a,size:c})=>{const s=e.isActive||!1,o=`${s?"active":"inactive"}-${t}`;return(0,i.jsx)("div",{className:(0,d.cn)(j({state:o,size:c}),a),"data-ui-component-id":"ActivityScheduleCard",children:(0,i.jsxs)(l.Link,{asChild:!e?.link,href:e?.link,className:"size-full no-underline hover:text-current",children:[(s?e.activeIcon:e.inactiveIcon)&&(0,i.jsx)("div",{className:"laptop:w-[160px] aspect-1 absolute right-0 top-0 z-10 w-[120px]",children:(0,i.jsx)(l.Picture,{source:s?e.activeIcon.url:e.inactiveIcon.url,alt:s?e.activeIcon.alt:e.inactiveIcon.alt,className:"aspect-square"})}),(0,i.jsxs)("div",{className:"relative z-20 flex h-full flex-col justify-between",children:[(0,i.jsx)(l.Heading,{as:"h3",size:3,html:e.title,className:(0,d.cn)(m({state:o}))}),(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,i.jsx)("div",{className:"flex flex-col justify-end overflow-hidden",children:(0,i.jsx)(l.Heading,{as:"h4",size:2,html:e.subtitle,className:(0,d.cn)(" line-clamp-2",m({state:o}))})}),c==="large"&&e.description&&(0,i.jsx)(l.Text,{html:e.description,className:(0,d.cn)("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-3 text-[14px] leading-[1.4]",m({state:o}))})]})]})]})})});w.displayName="ActivityScheduleCard";const x=v.forwardRef(({classNames:e={},data:t,...a},c)=>{const s=t.theme||"light",o=t.size||"large",r=v.useMemo(()=>t?.scheduleList?.length||2,[t?.scheduleList]),k=v.useMemo(()=>{const n=N=>{switch(N){case"mobile":return{slidesPerView:1.17,spaceBetween:12};case"tablet":return r===2?{slidesPerView:2,spaceBetween:12}:{slidesPerView:2.4,spaceBetween:12};case"laptop":return r===2?{}:r===4?{slidesPerView:3.2,spaceBetween:16}:{slidesPerView:r,spaceBetween:16};case"desktop":return r===2?{slidesPerView:2,spaceBetween:16}:{slidesPerView:r,spaceBetween:16}}},u=n("mobile"),S=n("tablet"),b=n("laptop"),A=n("desktop");return{0:u,768:S,1024:b,1440:A}},[r]);return(0,i.jsx)(l.Container,{ref:c,className:(0,d.cn)(e?.root),childClassName:"overflow-hidden","data-ui-component-id":"ActivitySchedule",...a,children:(0,i.jsx)(h.Swiper,{breakpoints:k,className:"w-full !overflow-visible",children:t.scheduleList.map((n,u)=>(0,i.jsx)(h.SwiperSlide,{children:(0,i.jsx)(w,{item:n,theme:s,size:o,className:e?.card})},"activityScheduleCardItem"+u))})})});x.displayName="ActivitySchedule";var M=(0,y.withLayout)(x);
@@ -1 +1 @@
1
- "use strict";"use client";var j=Object.create;var d=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var H=(e,r)=>{for(var a in r)d(e,a,{get:r[a],enumerable:!0})},k=(e,r,a,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of L(r))!A.call(e,o)&&o!==a&&d(e,o,{get:()=>r[o],enumerable:!(i=P(r,o))||i.enumerable});return e};var N=(e,r,a)=>(a=e!=null?j(z(e)):{},k(r||!e||!e.__esModule?d(a,"default",{value:e,enumerable:!0}):a,e)),D=e=>k(d({},"__esModule",{value:!0}),e);var F={};H(F,{default:()=>C});module.exports=D(F);var t=require("react/jsx-runtime"),s=require("react"),l=require("../../helpers/utils.js"),y=N(require("../../components/picture.js")),E=require("../../shared/Styles.js"),S=require("react-responsive"),M=require("../../hooks/useExposure.js"),c=require("swiper/react"),p=require("swiper/modules"),B=N(require("../Title/index.js"));const R="copy",Q="store_benefits",$=(e,r)=>{const a=[];for(let i=0;i<e.length;i+=r)a.push(e.slice(i,i+r));return a},w=(0,s.forwardRef)(({data:{items:e=[],itemShape:r,title:a,theme:i},className:o},u)=>{const[x,T]=(0,s.useState)(!1),v=(0,S.useMediaQuery)({query:"(max-width: 768px)"}),b=(0,s.useRef)(null),f=(0,s.useRef)(null);(0,s.useImperativeHandle)(u,()=>f.current),(0,M.useExposure)(f,{componentType:R,componentName:Q}),(0,s.useEffect)(()=>{T(v)},[v]);const I=x?$(e,3):e;return(0,t.jsxs)("div",{ref:f,className:(0,l.cn)("brand-equity-wrapper w-full",{"aiui-dark":i==="dark"},o),children:[a&&(0,t.jsx)(B.default,{data:{title:a}}),x?(0,t.jsxs)(c.Swiper,{className:(0,l.cn)(o),modules:[p.FreeMode,p.Mousewheel,p.Pagination],freeMode:!0,mousewheel:{forceToAxis:!0},pagination:{clickable:!0,el:b.current},breakpoints:{0:{spaceBetween:12}},children:[I?.map((n,m)=>(0,t.jsx)(c.SwiperSlide,{className:"!flex flex-col gap-3",children:Array.isArray(n)&&n?.map((g,h)=>(0,t.jsx)(q,{data:g,itemShape:r,index:h,theme:g.theme??i},h))},"SwiperSlide"+m)),(0,t.jsx)("div",{ref:b,className:"mt-3 flex justify-center"})]}):(0,t.jsx)("div",{className:(0,l.cn)("grid grid-cols-1 gap-3","tablet:grid-cols-2","laptop:gap-4 laptop:grid-cols-10"),children:e.map((n,m)=>(0,t.jsx)(q,{data:n,itemShape:r,index:m,theme:n.theme??i},m))})]})}),q=({data:e,itemShape:r,index:a,theme:i})=>(0,t.jsxs)("div",{className:(0,l.cn)("brand-equity-item",`brand-equity-item-${a+1}`,e.containerName?`brand-equity-item--${e.containerName}`:void 0,"bg-container-secondary-1 box-border flex w-full flex-col p-4","desktop:p-6 justify-between","laptop:col-span-3 lg-desktop:p-8","laptop:h-[192px] lg-desktop:h-[240px] h-[160px]",{"laptop:col-span-4":[0,5,6,11].includes(a),"bg-container-primary":i==="dark"},"rounded-box",e.className),children:[(0,t.jsxs)("div",{className:"lg-desktop:h-[36px] flex h-[30px] items-center justify-between gap-3",children:[(0,t.jsx)("h3",{className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary text-[14px] font-bold leading-[1.2] tracking-[-0.02em]",children:e.title}),e.type==="avatar"?(0,t.jsx)("div",{className:"flex shrink-0 -space-x-2",children:e?.avatarList?.map((o,u)=>(0,t.jsx)("div",{className:(0,l.cn)("border-container-primary size-[30px] overflow-hidden rounded-full border-2","relative inline-block shrink-0","lg-desktop:size-[36px]"),children:(0,t.jsx)(y.default,{source:o.avatar?.url,alt:o.avatar?.alt,className:"size-full object-cover"})},u))}):(0,t.jsx)("div",{className:"lg-desktop:size-[36px] size-[30px] shrink-0",children:(0,t.jsx)(y.default,{className:"size-full object-cover",source:e.icon?.url,alt:e.icon?.alt,imgClassName:"w-full h-full object-cover"})})]}),(0,t.jsx)("p",{className:"lg-desktop:text-[24px] text-info-primary line-clamp-3 text-[20px] font-bold leading-[1.2] tracking-[-0.04em]",children:e.description})]});w.displayName="BrandEquity";var C=(0,E.withLayout)(w);
1
+ "use strict";"use client";var j=Object.create;var d=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var H=(e,r)=>{for(var i in r)d(e,i,{get:r[i],enumerable:!0})},h=(e,r,i,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of L(r))!A.call(e,o)&&o!==i&&d(e,o,{get:()=>r[o],enumerable:!(a=P(r,o))||a.enumerable});return e};var k=(e,r,i)=>(i=e!=null?j(z(e)):{},h(r||!e||!e.__esModule?d(i,"default",{value:e,enumerable:!0}):i,e)),D=e=>h(d({},"__esModule",{value:!0}),e);var F={};H(F,{default:()=>C});module.exports=D(F);var t=require("react/jsx-runtime"),s=require("react"),l=require("../../helpers/utils.js"),y=k(require("../../components/picture.js")),q=require("../../shared/Styles.js"),E=require("react-responsive"),S=require("../../hooks/useExposure.js"),c=require("swiper/react"),p=require("swiper/modules"),M=k(require("../Title/index.js"));const R="copy",Q="store_benefits",$=(e,r)=>{const i=[];for(let a=0;a<e.length;a+=r)i.push(e.slice(a,a+r));return i},N=(0,s.forwardRef)(({data:{items:e=[],itemShape:r,title:i,theme:a},className:o},u)=>{const[x,B]=(0,s.useState)(!1),v=(0,E.useMediaQuery)({query:"(max-width: 768px)"}),b=(0,s.useRef)(null),f=(0,s.useRef)(null);(0,s.useImperativeHandle)(u,()=>f.current),(0,S.useExposure)(f,{componentType:R,componentName:Q}),(0,s.useEffect)(()=>{B(v)},[v]);const T=x?$(e,3):e;return(0,t.jsxs)("div",{ref:f,className:(0,l.cn)("brand-equity-wrapper w-full",{"aiui-dark":a==="dark"},o),children:[i&&(0,t.jsx)(M.default,{data:{title:i}}),x?(0,t.jsxs)(c.Swiper,{className:(0,l.cn)(o),modules:[p.FreeMode,p.Mousewheel,p.Pagination],freeMode:!0,mousewheel:{forceToAxis:!0},pagination:{clickable:!0,el:b.current},breakpoints:{0:{spaceBetween:12}},children:[T?.map((n,m)=>(0,t.jsx)(c.SwiperSlide,{className:"!flex flex-col gap-3",children:Array.isArray(n)&&n?.map((I,g)=>(0,t.jsx)(w,{data:I,itemShape:r,index:g,theme:a},g))},"SwiperSlide"+m)),(0,t.jsx)("div",{ref:b,className:"mt-3 flex justify-center"})]}):(0,t.jsx)("div",{className:(0,l.cn)("grid grid-cols-1 gap-3","tablet:grid-cols-2","laptop:gap-4 laptop:grid-cols-10"),children:e.map((n,m)=>(0,t.jsx)(w,{data:n,itemShape:r,index:m,theme:a},m))})]})}),w=({data:e,itemShape:r,index:i,theme:a})=>(0,t.jsxs)("div",{className:(0,l.cn)("brand-equity-item",`brand-equity-item-${i+1}`,e.containerName?`brand-equity-item--${e.containerName}`:void 0,"bg-container-secondary-1 box-border flex w-full flex-col p-4","desktop:p-6 justify-between","laptop:col-span-3 lg-desktop:p-8","laptop:h-[192px] lg-desktop:h-[240px] h-[160px]",{"laptop:col-span-4":[0,5,6,11].includes(i),"bg-container-primary":a==="dark"},"rounded-box",e.className),children:[(0,t.jsxs)("div",{className:"lg-desktop:h-[36px] flex h-[30px] items-center justify-between gap-3",children:[(0,t.jsx)("h3",{className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary text-[14px] font-bold leading-[1.2] tracking-[-0.02em]",children:e.title}),e.type==="avatar"?(0,t.jsx)("div",{className:"flex shrink-0 -space-x-2",children:e?.avatarList?.map((o,u)=>(0,t.jsx)("div",{className:(0,l.cn)("border-container-primary size-[30px] overflow-hidden rounded-full border-2","relative inline-block shrink-0","lg-desktop:size-[36px]"),children:(0,t.jsx)(y.default,{source:o.avatar?.url,alt:o.avatar?.alt,className:"size-full object-cover"})},u))}):(0,t.jsx)("div",{className:"lg-desktop:size-[36px] size-[30px] shrink-0",children:(0,t.jsx)(y.default,{className:"size-full object-cover",source:e.icon?.url,alt:e.icon?.alt,imgClassName:"w-full h-full object-cover"})})]}),(0,t.jsx)("p",{className:"lg-desktop:text-[24px] text-info-primary line-clamp-3 text-[20px] font-bold leading-[1.2] tracking-[-0.04em]",children:e.description})]});N.displayName="BrandEquity";var C=(0,q.withLayout)(N);
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * 移动端菜单项
3
3
  */
4
- export declare const MenuItem: ({ label, href, target, onClick, active, icon, className, }: {
4
+ export declare const MenuItem: ({ label, href, onClick, active, icon, className, }: {
5
5
  label: string;
6
6
  href?: string;
7
- target?: string;
8
7
  onClick?: () => void;
9
8
  active?: boolean;
10
9
  icon?: string;
@@ -1 +1 @@
1
- "use strict";var b=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var v=(t,n)=>{for(var l in n)b(t,l,{get:n[l],enumerable:!0})},h=(t,n,l,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of g(n))!x.call(t,i)&&i!==l&&b(t,i,{get:()=>n[i],enumerable:!(r=f(n,i))||r.enumerable});return t};var N=t=>h(b({},"__esModule",{value:!0}),t);var C={};v(C,{MenuItem:()=>k,SubSubCategoryContentComp:()=>w,SubSubCategoryItemComp:()=>y});module.exports=N(C);var e=require("react/jsx-runtime"),$=require("react"),o=require("../../components/index.js"),s=require("../../helpers/utils.js"),c=require("./icons/index.js"),d=require("./SidebarDropdown.js"),u=require("../AiuiProvider/index.js");const k=({label:t,href:n,target:l,onClick:r,active:i,icon:a,className:m})=>{const p=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(o.Text,{html:t,className:(0,s.cn)("text-sm font-bold leading-[1.4]",{underline:a})}),a&&(0,e.jsx)(o.Text,{html:a,"aria-hidden":"true"})]}),(0,e.jsx)("svg",{className:`size-5 ${i?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M9 5L16 12L9 19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});return n?(0,e.jsx)(o.Link,{href:n,target:l,rel:l==="_blank"?"noopener noreferrer":void 0,className:(0,s.cn)("flex cursor-pointer items-center justify-between py-4 no-underline",m),onClick:r,children:p}):(0,e.jsx)("button",{onClick:r,className:(0,s.cn)("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",m),"aria-expanded":i,children:p})},y=({matchSeriesMetadata:t,onSubSubCategoryItemClick:n,expanded:l})=>{const r=(0,e.jsxs)(e.Fragment,{children:[t?.label&&(0,e.jsx)(o.Text,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),n&&(0,e.jsx)(c.DownArrow,{"aria-hidden":"true",className:(0,s.cn)("size-5",{"rotate-180":l})})]});return n?(0,e.jsx)("button",{className:"tablet:pt-0 flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:n,"aria-expanded":l,children:r}):(0,e.jsx)("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:r})},w=({matchSeriesMetadata:t})=>{const{locale:n="us"}=(0,u.useAiuiContext)();return(0,e.jsx)("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!t?.series?.length&&t?.series?.map((l,r)=>(0,e.jsxs)("div",{children:[l.label&&(0,e.jsx)(o.Text,{html:l.label,as:"p",className:"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]"}),(0,e.jsxs)("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!t?.banner&&(0,e.jsx)(o.Link,{asChild:!t?.banner?.href,href:(0,s.getLocalizedPath)(t?.banner?.href,n),children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(o.Picture,{source:t?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(o.Heading,{size:2,html:t?.banner?.title||"Buy in Guide",className:(0,s.cn)("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),(0,e.jsx)(o.Text,{html:t?.banner?.desc||"20.000mAh",className:(0,s.cn)("text-sm font-bold text-white",{"text-black":t?.banner?.theme==="dark"})})]})]})}),l.products?.map((i,a)=>(0,e.jsx)(d.SeriesProductItem,{position:a,product:i,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${l?.label||""}-${r}-${a}`))]})]},`seriesItem-${l?.label||""}-${r}`))})};
1
+ "use strict";var b=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var x=(t,l)=>{for(var n in l)b(t,n,{get:l[n],enumerable:!0})},v=(t,l,n,r)=>{if(l&&typeof l=="object"||typeof l=="function")for(let i of f(l))!g.call(t,i)&&i!==n&&b(t,i,{get:()=>l[i],enumerable:!(r=u(l,i))||r.enumerable});return t};var h=t=>v(b({},"__esModule",{value:!0}),t);var w={};x(w,{MenuItem:()=>N,SubSubCategoryContentComp:()=>k,SubSubCategoryItemComp:()=>y});module.exports=h(w);var e=require("react/jsx-runtime"),L=require("react"),o=require("../../components/index.js"),s=require("../../helpers/utils.js"),p=require("./icons/index.js"),c=require("./SidebarDropdown.js"),d=require("../AiuiProvider/index.js");const N=({label:t,href:l,onClick:n,active:r,icon:i,className:a})=>{const m=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(o.Text,{html:t,className:(0,s.cn)("text-sm font-bold leading-[1.4]",{underline:i})}),i&&(0,e.jsx)(o.Text,{html:i,"aria-hidden":"true"})]}),(0,e.jsx)("svg",{className:`size-5 ${r?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M9 5L16 12L9 19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});return l?(0,e.jsx)(o.Link,{href:l,className:(0,s.cn)("flex cursor-pointer items-center justify-between py-4 no-underline",a),onClick:n,children:m}):(0,e.jsx)("button",{onClick:n,className:(0,s.cn)("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",a),"aria-expanded":r,children:m})},y=({matchSeriesMetadata:t,onSubSubCategoryItemClick:l,expanded:n})=>{const r=(0,e.jsxs)(e.Fragment,{children:[t?.label&&(0,e.jsx)(o.Text,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),l&&(0,e.jsx)(p.DownArrow,{"aria-hidden":"true",className:(0,s.cn)("size-5",{"rotate-180":n})})]});return l?(0,e.jsx)("button",{className:"tablet:pt-0 flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:l,"aria-expanded":n,children:r}):(0,e.jsx)("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:r})},k=({matchSeriesMetadata:t})=>{const{locale:l="us"}=(0,d.useAiuiContext)();return(0,e.jsx)("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!t?.series?.length&&t?.series?.map((n,r)=>(0,e.jsxs)("div",{children:[n.label&&(0,e.jsx)(o.Text,{html:n.label,as:"p",className:"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]"}),(0,e.jsxs)("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!t?.banner&&(0,e.jsx)(o.Link,{asChild:!t?.banner?.href,href:(0,s.getLocalizedPath)(t?.banner?.href,l),children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(o.Picture,{source:t?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(o.Heading,{size:2,html:t?.banner?.title||"Buy in Guide",className:(0,s.cn)("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),(0,e.jsx)(o.Text,{html:t?.banner?.desc||"20.000mAh",className:(0,s.cn)("text-sm font-bold text-white",{"text-black":t?.banner?.theme==="dark"})})]})]})}),n.products?.map((i,a)=>(0,e.jsx)(c.SeriesProductItem,{position:a,product:i,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${n?.label||""}-${r}-${a}`))]})]},`seriesItem-${n?.label||""}-${r}`))})};
@@ -1 +1 @@
1
- "use strict";var A=Object.create;var C=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var R=(t,i)=>{for(var m in i)C(t,m,{get:i[m],enumerable:!0})},L=(t,i,m,y)=>{if(i&&typeof i=="object"||typeof i=="function")for(let p of B(i))!O.call(t,p)&&p!==m&&C(t,p,{get:()=>i[p],enumerable:!(y=j(i,p))||y.enumerable});return t};var V=(t,i,m)=>(m=t!=null?A(E(t)):{},L(i||!t||!t.__esModule?C(m,"default",{value:t,enumerable:!0}):m,t)),W=t=>L(C({},"__esModule",{value:!0}),t);var H={};R(H,{SeriesProductItem:()=>_,SidebarDropdown:()=>P});module.exports=W(H);var e=require("react/jsx-runtime"),c=V(require("react")),n=require("../../components/index.js"),b=require("../../helpers/utils.js"),D=require("./icons/index.js"),$=require("./NavProvider.js"),F=require("../AiuiProvider/index.js");const P=c.default.memo(({sidebarCategoriesMetadata:t,seriesMetadata:i})=>{const{buildProps:m,onSidebarNavClick:y}=(0,$.useNavContext)(),{locale:p="us"}=(0,F.useAiuiContext)(),[v,N]=(0,c.useState)([]),[h,S]=(0,c.useState)(-1),g=(0,c.useRef)(null),x=(0,c.useRef)(null),k=(0,c.useCallback)(()=>{const a=t?.subcategories;if(!a?.length)return;const o=a.findIndex(u=>!!u?.subSubCategories),l=a.findIndex(u=>!u?.subSubCategories),r=a.map((u,d)=>({index:d,open:o===d||l===d}));N(r)},[t]);(0,c.useEffect)(()=>{k()},[k]);const s=(0,c.useMemo)(()=>{const a=t?.subcategories?.[v?.find(l=>l.open)?.index||0],o=i?.find(l=>l?.label?.toLowerCase()===a?.label?.toLowerCase())||{};if(a?.collections){const l=m?.categories?.[a?.collections]||{};return{label:o?.label,isCollection:!0,banner:o?.banner,primary:o?.primary,series:[{products:l?.products}]}}else if(a?.subSubCategories){const l=a?.subSubCategories?.[h],r=i?.find(u=>u?.label?.toLowerCase()===l?.label?.toLowerCase())||{};if(l?.collections){const u=m?.categories?.[l?.collections]||{};return{label:r?.label,isCollection:!0,banner:r?.banner,primary:r?.primary,series:[{products:u?.products}]}}else return r}else return o},[t,v,h,i,m]),f=(0,c.useCallback)((a,o)=>{const l=o?.subSubCategories?.length>0;S(l?0:-1);const r=x.current;N(u=>u.map((d,z)=>z===a?{...d,open:!d.open}:l?{...d,open:!1}:!r&&h===-1?{...d,open:!1}:r&&!r.hasSubSubCategories&&!l&&h===-1?{...d,open:!1}:d)),x.current={index:a,hasSubSubCategories:l}},[h]),w=(a,o)=>{N(l=>l.map(r=>r.index===a?{...r,open:!0}:{...r,open:!1})),S(o)};return(0,e.jsxs)(n.Container,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[(0,e.jsxs)("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:g,children:[(0,e.jsx)("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((a,o)=>{const l=Array.isArray(a?.subSubCategories)&&a?.subSubCategories?.length>0,r=v?.find(u=>u.index===o)?.open;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{className:(0,b.cn)("rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!l&&r}),onClick:()=>{f(o,a),y?.(a,o)},"aria-expanded":l?r:void 0,"aria-haspopup":l?"true":void 0,children:[(0,e.jsx)(n.Text,{html:a.label,className:"p-4 text-sm font-bold leading-[1.4]"}),l&&(0,e.jsx)(D.DownArrow,{"aria-hidden":"true",className:(0,b.cn)("size-4",{"rotate-180":r})})]}),r&&(0,e.jsx)("div",{className:"flex flex-col",role:"menu",children:a.subSubCategories?.map((u,d)=>(0,e.jsx)("button",{onClick:()=>{w(o,d),y?.(u,d)},className:(0,b.cn)("rounded-sidebar-shelf w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left leading-none hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":h===d}),role:"menuitem","aria-label":u.label,children:(0,e.jsx)(n.Text,{html:u.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${o}-${d}`))})]},`${a?.label||""}subcategoryItem-${o}`)})}),t&&(0,e.jsx)("div",{className:"flex",children:(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[t?.primary&&(0,e.jsx)(n.Button,{as:"a",href:`${(0,b.getLocalizedPath)(t?.primary?.url,p)}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:t?.primary?.label}),t?.secondary&&(0,e.jsx)(n.Button,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",iconClassName:"size-4",className:"lg-desktop:text-base justify-start !p-0 text-sm",children:t?.secondary?.label})]})})]}),(0,e.jsxs)("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(s).length>0&&(0,e.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(()=>{const a=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.Text,{html:s?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),s?.primary&&!s?.primary?.hide&&(0,e.jsx)(n.Text,{className:"lg-desktop:text-base text-sm font-bold leading-[1.2]",html:s?.primary?.label})]});return s?.primary?.url?(0,e.jsx)(n.Button,{as:"a",href:`${(0,b.getLocalizedPath)(s?.primary?.url,p)}?ref=${s?.label}_viewmore`,variant:"link",size:"lg",iconClassName:"size-4",className:"flex items-center justify-start gap-2 !p-0 no-underline",children:a}):(0,e.jsx)("div",{className:"flex items-center gap-2",children:a})})(),t?.guide?.label&&(0,e.jsx)(n.Link,{href:(0,b.getLocalizedPath)(t?.guide?.url,p),className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:t?.guide?.label})]}),(0,e.jsx)("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:s?.series?.map((a,o)=>(0,e.jsxs)("div",{children:[a.label&&(0,e.jsx)(n.Text,{html:a.label,as:"p",className:"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[!!s?.banner&&(0,e.jsx)(n.Link,{asChild:!s?.banner?.href,href:(0,b.getLocalizedPath)(s?.banner?.href,p),children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(n.Picture,{source:s?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(n.Heading,{size:2,html:s?.banner?.title||"Buy in Guide",className:(0,b.cn)("font-bold text-white",{"text-black":s?.banner?.theme==="dark"})}),(0,e.jsx)(n.Text,{html:s?.banner?.desc||"20.000mAh",className:(0,b.cn)("text-sm font-bold text-white",{"text-black":s?.banner?.theme==="dark"})})]})]})}),a.products?.map((l,r)=>(0,e.jsx)(_,{seriesLabel:s?.label,product:l,isCollection:s?.isCollection},`seriesProductItem-${a?.label||""}-${o}-${r}`))]})]},`seriesItem-${a?.label||""}-${o}`))})]})]})});P.displayName="SidebarDropdown";const _=({product:t,isCollection:i,position:m,seriesLabel:y})=>{const{locale:p="us"}=(0,F.useAiuiContext)(),{buildProps:v,onSeriesProductClick:N,componentOverrides:h}=(0,$.useNavContext)(),S=h?.badge?.variant;let g=i?t:v?.products?.find(f=>f.handle===t.handle);const x=g?.variants?.find(f=>f.sku===t.sku)||g?.variants?.[0],k=(0,c.useMemo)(()=>`${(0,b.getLocalizedPath)(`/products/${g?.handle}`,p)}?variant=${(0,b.atobID)(x?.id)}`,[g?.handle,x?.id,p]),s=(0,c.useMemo)(()=>g?.tags?.filter?.(f=>f?.startsWith?.("CLtag"))?.map?.(f=>f?.replace?.("CLtag:",""))?.slice?.(0,2),[g?.tags]);return x?.availableForSale?(0,e.jsx)(n.Link,{href:k,onClick:f=>{f.preventDefault(),window.open(k,"_self"),N?.(g,m||0,y)},className:"no-underline hover:text-current",children:(0,e.jsxs)("div",{className:"rounded-sidebar-shelf relative flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110 [&_img]:hover:duration-500",children:[(0,e.jsx)("div",{className:"shrink-0",children:(0,e.jsx)("img",{src:`${x?.image?.url||t?.images?.[0]?.url}&width=200`,loading:"lazy",alt:g?.title||t?.name,width:90,height:90,className:"size-[96px] object-contain"})}),Array.isArray(s)&&s?.length>0&&(0,e.jsx)("div",{className:"absolute right-1 top-1 flex gap-1",children:s?.map((f,w)=>(0,e.jsx)(n.Badge,{size:"xs",variant:S,className:"whitespace-nowrap",children:f},w))}),(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col justify-center",children:[(0,e.jsx)(n.Text,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:t?.custom_name||x?.metafields?.infos?.page_short_title||g?.title}),t?.desc&&(0,e.jsx)(n.Text,{as:"p",html:t?.desc,className:"lg-desktop:text-sm mt-1 line-clamp-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]"})]})]})}):null};
1
+ "use strict";var A=Object.create;var C=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var R=(t,i)=>{for(var m in i)C(t,m,{get:i[m],enumerable:!0})},L=(t,i,m,x)=>{if(i&&typeof i=="object"||typeof i=="function")for(let p of j(i))!O.call(t,p)&&p!==m&&C(t,p,{get:()=>i[p],enumerable:!(x=B(i,p))||x.enumerable});return t};var V=(t,i,m)=>(m=t!=null?A(E(t)):{},L(i||!t||!t.__esModule?C(m,"default",{value:t,enumerable:!0}):m,t)),W=t=>L(C({},"__esModule",{value:!0}),t);var H={};R(H,{SeriesProductItem:()=>_,SidebarDropdown:()=>P});module.exports=W(H);var e=require("react/jsx-runtime"),c=V(require("react")),n=require("../../components/index.js"),b=require("../../helpers/utils.js"),D=require("./icons/index.js"),$=require("./NavProvider.js"),F=require("../AiuiProvider/index.js");const P=c.default.memo(({sidebarCategoriesMetadata:t,seriesMetadata:i})=>{const{buildProps:m,onSidebarNavClick:x}=(0,$.useNavContext)(),{locale:p="us"}=(0,F.useAiuiContext)(),[v,N]=(0,c.useState)([]),[h,S]=(0,c.useState)(-1),g=(0,c.useRef)(null),y=(0,c.useRef)(null),k=(0,c.useCallback)(()=>{const a=t?.subcategories;if(!a?.length)return;const o=a.findIndex(u=>!!u?.subSubCategories),l=a.findIndex(u=>!u?.subSubCategories),r=a.map((u,d)=>({index:d,open:o===d||l===d}));N(r)},[t]);(0,c.useEffect)(()=>{k()},[k]);const s=(0,c.useMemo)(()=>{const a=t?.subcategories?.[v?.find(l=>l.open)?.index||0],o=i?.find(l=>l?.label?.toLowerCase()===a?.label?.toLowerCase())||{};if(a?.collections){const l=m?.categories?.[a?.collections]||{};return{label:o?.label,isCollection:!0,banner:o?.banner,primary:o?.primary,series:[{products:l?.products}]}}else if(a?.subSubCategories){const l=a?.subSubCategories?.[h],r=i?.find(u=>u?.label?.toLowerCase()===l?.label?.toLowerCase())||{};if(l?.collections){const u=m?.categories?.[l?.collections]||{};return{label:r?.label,isCollection:!0,banner:r?.banner,primary:r?.primary,series:[{products:u?.products}]}}else return r}else return o},[t,v,h,i,m]),f=(0,c.useCallback)((a,o)=>{const l=o?.subSubCategories?.length>0;S(l?0:-1);const r=y.current;N(u=>u.map((d,z)=>z===a?{...d,open:!d.open}:l?{...d,open:!1}:!r&&h===-1?{...d,open:!1}:r&&!r.hasSubSubCategories&&!l&&h===-1?{...d,open:!1}:d)),y.current={index:a,hasSubSubCategories:l}},[h]),w=(a,o)=>{N(l=>l.map(r=>r.index===a?{...r,open:!0}:{...r,open:!1})),S(o)};return(0,e.jsxs)(n.Container,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[(0,e.jsxs)("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:g,children:[(0,e.jsx)("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:t?.subcategories?.map((a,o)=>{const l=Array.isArray(a?.subSubCategories)&&a?.subSubCategories?.length>0,r=v?.find(u=>u.index===o)?.open;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{className:(0,b.cn)("rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!l&&r}),onClick:()=>{f(o,a),x?.(a,o)},"aria-expanded":l?r:void 0,"aria-haspopup":l?"true":void 0,children:[(0,e.jsx)(n.Text,{html:a.label,className:"p-4 text-sm font-bold leading-[1.4]"}),l&&(0,e.jsx)(D.DownArrow,{"aria-hidden":"true",className:(0,b.cn)("size-4",{"rotate-180":r})})]}),r&&(0,e.jsx)("div",{className:"flex flex-col",role:"menu",children:a.subSubCategories?.map((u,d)=>(0,e.jsx)("button",{onClick:()=>{w(o,d),x?.(u,d)},className:(0,b.cn)("rounded-sidebar-shelf w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left leading-none hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":h===d}),role:"menuitem","aria-label":u.label,children:(0,e.jsx)(n.Text,{html:u.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${o}-${d}`))})]},`${a?.label||""}subcategoryItem-${o}`)})}),t&&(0,e.jsx)("div",{className:"flex",children:(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[t?.primary&&(0,e.jsx)(n.Button,{as:"a",href:`${(0,b.getLocalizedPath)(t?.primary?.url,p)}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:t?.primary?.label}),t?.secondary&&(0,e.jsx)(n.Button,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",iconClassName:"size-4",className:"lg-desktop:text-base justify-start !p-0 text-sm",children:t?.secondary?.label})]})})]}),(0,e.jsxs)("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(s).length>0&&(0,e.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[(()=>{const a=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.Text,{html:s?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),s?.primary&&!s?.primary?.hide&&(0,e.jsx)(n.Text,{className:"lg-desktop:text-base text-sm font-bold leading-[1.2]",html:s?.primary?.label})]});return s?.primary?.url?(0,e.jsx)(n.Button,{as:"a",href:`${(0,b.getLocalizedPath)(s?.primary?.url,p)}?ref=${s?.label}_viewmore`,variant:"link",size:"lg",iconClassName:"size-4",className:"flex items-center justify-start gap-2 !p-0 no-underline",children:a}):(0,e.jsx)("div",{className:"flex items-center gap-2",children:a})})(),t?.guide?.label&&(0,e.jsx)(n.Link,{href:(0,b.getLocalizedPath)(t?.guide?.url,p),className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:t?.guide?.label})]}),(0,e.jsx)("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:s?.series?.map((a,o)=>(0,e.jsxs)("div",{children:[a.label&&(0,e.jsx)(n.Text,{html:a.label,as:"p",className:"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsxs)("div",{className:"grid grid-cols-3 gap-4",children:[!!s?.banner&&(0,e.jsx)(n.Link,{asChild:!s?.banner?.href,href:(0,b.getLocalizedPath)(s?.banner?.href,p),children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(n.Picture,{source:s?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(n.Heading,{size:2,html:s?.banner?.title||"Buy in Guide",className:(0,b.cn)("font-bold text-white",{"text-black":s?.banner?.theme==="dark"})}),(0,e.jsx)(n.Text,{html:s?.banner?.desc||"20.000mAh",className:(0,b.cn)("text-sm font-bold text-white",{"text-black":s?.banner?.theme==="dark"})})]})]})}),a.products?.map((l,r)=>(0,e.jsx)(_,{seriesLabel:s?.label,product:l,isCollection:s?.isCollection},`seriesProductItem-${a?.label||""}-${o}-${r}`))]})]},`seriesItem-${a?.label||""}-${o}`))})]})]})});P.displayName="SidebarDropdown";const _=({product:t,isCollection:i,position:m,seriesLabel:x})=>{const{locale:p="us"}=(0,F.useAiuiContext)(),{buildProps:v,onSeriesProductClick:N,componentOverrides:h}=(0,$.useNavContext)(),S=h?.badge?.variant;let g=i?t:v?.products?.find(f=>f.handle===t.handle);const y=g?.variants?.find(f=>f.sku===t.sku)||g?.variants?.[0],k=(0,c.useMemo)(()=>`${(0,b.getLocalizedPath)(`/products/${g?.handle}`,p)}?variant=${(0,b.atobID)(y?.id)}`,[g?.handle,y?.id,p]),s=(0,c.useMemo)(()=>g?.tags?.filter?.(f=>f?.startsWith?.("CLtag"))?.map?.(f=>f?.replace?.("CLtag:",""))?.slice?.(0,2),[g?.tags]);return y?.availableForSale?(0,e.jsx)(n.Link,{href:k,onClick:f=>{f.preventDefault(),window.open(k,"_self"),N?.(g,m||0,x)},className:"no-underline hover:text-current",children:(0,e.jsxs)("div",{className:"rounded-sidebar-shelf flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110 [&_img]:hover:duration-500",children:[(0,e.jsx)("div",{className:"shrink-0",children:(0,e.jsx)("img",{src:`${y?.image?.url||t?.images?.[0]?.url}&width=200`,loading:"lazy",alt:g?.title||t?.name,width:90,height:90,className:"size-[96px] object-contain"})}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("div",{className:"flex gap-1",children:Array.isArray(s)&&s?.map((f,w)=>(0,e.jsx)(n.Badge,{size:"sm",variant:S,className:"mb-1 whitespace-nowrap",children:f},w))}),(0,e.jsx)(n.Text,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:t?.custom_name||y?.metafields?.infos?.page_short_title||g?.title}),t?.desc&&(0,e.jsx)(n.Text,{as:"p",html:t?.desc,className:"lg-desktop:text-sm mt-1 line-clamp-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]"})]})]})}):null};
@@ -1 +1 @@
1
- "use strict";"use client";var Le=Object.create;var re=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var Re=Object.getOwnPropertyNames;var Be=Object.getPrototypeOf,ze=Object.prototype.hasOwnProperty;var Ie=(n,o)=>{for(var i in o)re(n,i,{get:o[i],enumerable:!0})},me=(n,o,i,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of Re(o))!ze.call(n,c)&&c!==i&&re(n,c,{get:()=>o[c],enumerable:!(s=He(o,c))||s.enumerable});return n};var oe=(n,o,i)=>(i=n!=null?Le(Be(n)):{},me(o||!n||!n.__esModule?re(i,"default",{value:n,enumerable:!0}):i,n)),Ae=n=>me(re({},"__esModule",{value:!0}),n);var Ke={};Ie(Ke,{default:()=>$e});module.exports=Ae(Ke);var e=require("react/jsx-runtime"),t=require("react"),l=require("../../components/index.js"),he=require("../../shared/Styles.js"),N=require("../../helpers/utils.js"),$=oe(require("./NavProvider.js")),r=require("./types.js"),ye=oe(require("jump.js")),ie=require("@gsap/react"),X=require("gsap"),M=require("./withCategory.js"),S=require("./icons/index.js"),Ne=oe(require("../NavigationSearch/index.js")),ke=require("./ResourceSidebarDropdown.js"),Ce=require("./MobileResourceSidebarMenu.js"),xe=require("./SidebarDropdown.js"),le=require("./useScrollLock.js"),we=require("./MulticolDropdown.js"),Me=require("./SupportsDropdown.js"),Se=require("./MobileSidebarMenu.js"),Te=require("./MobileSupportMenu.js"),De=require("./MobileMulticolMenu.js"),se=require("./MobileMenuComponents.js"),Z=require("../AiuiProvider/index.js"),de=oe(require("../../shared/throttle.js")),Pe=require("./useNavCollapse.js");const pe=(0,t.forwardRef)((n,o)=>{const{data:{header:i}={},buildProps:s,event:c,profile:E,theme:d="light",isTop:m=!1,searchResult:p,onSearch:v,isSearching:f,keywords:H,onPrimaryNavClick:k,onSeriesProductClick:y,onSidebarNavClick:T,onMobileMenuToggle:K,headerId:D,cartCount:R,menuData:B,render:z,componentOverrides:W,...F}=n,[C,I]=(0,t.useState)(!1),[g,A]=(0,t.useState)(!1),[U,O]=(0,t.useState)(!1),P=(0,t.useRef)(null),u=(0,t.useRef)(null),j=(0,Pe.useNavCollapse)(u);(0,t.useImperativeHandle)(o,()=>u.current),(0,t.useEffect)(()=>{u.current&&m&&(0,ye.default)(u.current,{duration:0,offset:u.current?.getBoundingClientRect()?.bottom||0})},[m]),(0,t.useEffect)(()=>{if(m){A(!1),O(!1);return}let x=0,J=0,Y=0;const te=()=>document?.documentElement?.scrollTop||document?.body?.scrollTop||0,q=te();x=q,A(q>300),O(q>30);const ae=(0,de.default)(()=>{const _=te(),L=_-x;O(_>30),L>0?(J=0,Y+=L,Y>=300&&_>300&&A(!0)):L<0&&(Y=0,J+=Math.abs(L),J>=300&&(A(!1),J=0)),x=_},100);return window.addEventListener("scroll",ae,{passive:!0}),()=>window.removeEventListener("scroll",ae)},[m]),(0,t.useEffect)(()=>{c&&(c.search=()=>I(!0))},[c]),(0,ie.useGSAP)(()=>{P?.current&&C&&X.gsap.fromTo(P.current,{height:0},{height:"auto",duration:.3})},[C]),(0,le.useScrollLock)(C);const G=(0,t.useMemo)(()=>i?.bar?.actions?.find(x=>x?.blockType===r.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[i]),ee=z?.mobileHeaderNavigation;return(0,e.jsx)($.default,{buildProps:s,profile:E,isMobile:j,event:c,payloadData:i,onSidebarNavClick:T,onSeriesProductClick:y,cartCount:R,componentOverrides:W,children:(0,e.jsx)("header",{...F,id:D||"header","data-ui-component-id":"HeaderNavigation",className:m?"relative z-[100] bg-white":(0,N.cn)("sticky top-0 z-[100] transition-transform duration-500 ease-in-out",{"translate-y-[-100%]":g}),ref:u,children:(0,e.jsxs)("div",{className:(0,N.cn)("hover:bg-white hover:text-black",d==="light"?"text-black":"text-white",{"!bg-white transition-all duration-500 ease-in-out":!m&&U},{"hover:!text-black":d==="dark","!text-black":!m&&U}),onClick:()=>!m&&O(!0),children:[j?ee?(0,e.jsx)(ee,{menuData:B,data:i,onPrimaryNavClick:k}):(0,e.jsx)(be,{menuData:B,data:i,onPrimaryNavClick:k,onMobileMenuToggle:K,className:"!bg-white"}):(0,e.jsx)(fe,{data:i,theme:d,onNavItemClick:()=>!m&&O(!0),onPrimaryNavClick:k,className:"!bg-white"}),C&&(0,e.jsxs)("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${u?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[(0,e.jsx)("div",{ref:P,className:(0,N.cn)("overflow-y-auto",{}),children:(0,e.jsx)(Ne.default,{data:G,keywords:H,isSearching:f,searchResult:p,onSearch:x=>{v?.(x)},onClose:()=>{v?.(),I(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>I(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:x=>{(x.key==="Enter"||x.key===" "||x.key==="Escape")&&(x.preventDefault(),I(!1))}})]})]})})})}),fe=(0,t.forwardRef)((n,o)=>{const{data:i,onNavItemClick:s,className:c,theme:E,onPrimaryNavClick:d}=n,{event:m,profile:p}=(0,$.useNavContext)(),[v,f]=(0,t.useState)(!1),{locale:H="us"}=(0,Z.useAiuiContext)(),k=(0,t.useMemo)(()=>(0,M.WithGroupCategory)(i?.categories?.filter(a=>a?.pcShow)),[i]),[y,T]=(0,t.useState)(null),[K,D]=(0,t.useState)([]),R=(0,t.useRef)(null),[B,z]=(0,t.useState)(!1),W=(0,t.useRef)(null),F=(0,t.useRef)(null),C=(0,t.useRef)(null),I=(0,t.useRef)(k.map(a=>Array(a?.length||0).fill(null)));(0,t.useEffect)(()=>{k?.length&&D(k?.map((a,h)=>a?.map((b,w)=>({groupIndex:h,index:w,open:!1}))))},[k]);const g=(0,t.useMemo)(()=>{let a=null;for(const h of K){for(const b of h)if(b.open){a=b;break}if(a)break}return a},[K]);(0,le.useScrollLock)(!!g?.open||B);const A=(a,h)=>{z(!1),s?.();const b=k?.flat()||[],w=b?.findIndex(Q=>Q?.id===k[a][h]?.id);d?.(b[w],w)},U=(a,h)=>{const b=k[a][h],w=b?.components?.[0];w&&w?.blockType!==r.HeaderNavigationBlockType.Links&&(T(b),D(V=>V.map(Ee=>Ee.map(ne=>ne.groupIndex===a&&ne.index===h?{...ne,open:!0}:{...ne,open:!1}))))},O=(a,h,b)=>{a.key==="Escape"&&g?.groupIndex===h&&g?.index===b&&(a.preventDefault(),P())},P=()=>{D(a=>a.map(h=>h.map(b=>({...b,open:!1}))))},u=()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{P()},200)},j=()=>{C.current&&clearTimeout(C.current)},G=()=>{C.current&&clearTimeout(C.current)},ee=()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{P()},200)},x=(0,t.useMemo)(()=>{if(y)return y?.components?.[0]?.blockType},[y]),J=(0,M.WithSidebar)(xe.SidebarDropdown,y),Y=(0,M.WithResource)(ke.ResourceSidebarDropdown,y),te=(0,M.WithMulticol)(we.MulticolDropdown,y),q=(0,M.WithSupports)(Me.SupportsDropdown,{categoriesItem:y,currentNavItemRef:I.current?.[g?.groupIndex||0]?.[g?.index||0]}),ae=(0,t.useMemo)(()=>{switch(x){case r.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(J,{});case r.HeaderNavigationBlockType.Resource:return(0,e.jsx)(Y,{});case r.HeaderNavigationBlockType.Supports:return(0,e.jsx)(q,{});case r.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(te,{});default:return null}},[x,y]),_=(0,t.useMemo)(()=>i?.bar?.actions?.filter(a=>a?.pcShow),[i]),L=(0,t.useMemo)(()=>_?.find(a=>a?.blockType===r.HeaderNavigationActionBlockType.Profile),[_]),ce=(0,t.useCallback)(()=>{z(a=>!a)},[]);return(0,t.useEffect)(()=>{if(R?.current){const a=R.current;return a.addEventListener("click",ce),()=>{a.removeEventListener("click",ce)}}},[ce]),(0,ie.useGSAP)(()=>{g?.open&&X.gsap.fromTo(F?.current,{height:0},{height:"auto"})},[g?.open]),(0,e.jsxs)(l.Container,{className:(0,N.cn)("relative h-[92px]",c),children:[(0,e.jsxs)("div",{ref:W,onClick:P,className:"flex h-full flex-col justify-end gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(ve,{}),(0,e.jsx)(ue,{ref:R,actions:_,activeStatus:B})]}),(0,e.jsx)("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",onMouseEnter:j,onMouseLeave:u,children:k?.map((a,h)=>(0,e.jsx)("div",{className:"flex gap-3","data-nav-item":!0,children:a?.map((b,w)=>{const Q=g?.groupIndex===h&&g?.index===w;return(0,e.jsx)("div",{ref:V=>{I.current[h][w]=V},className:"group",onMouseEnter:()=>U(h,w),children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("a",{href:(0,N.getLocalizedPath)(b.url,H),...b.target?{target:b.target}:{},rel:b.target==="_blank"?"noopener noreferrer":void 0,className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4 no-underline",onClick:()=>A(h,w),onKeyDown:V=>O(V,h,w),"aria-expanded":Q,"aria-haspopup":"true","aria-label":b.text,children:[(0,e.jsx)(l.Text,{html:b.text,"data-nav-item-label":!0,className:"whitespace-nowrap text-sm font-bold leading-[1.4]"}),(0,e.jsx)(S.DownArrow,{className:(0,N.cn)("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":g?.groupIndex===h&&g?.index===w,"opacity-100":v&&g?.groupIndex===h&&g?.index===w,invisible:!b?.components?.length||b?.components?.[0]?.blockType===r.HeaderNavigationBlockType.Links})})]}),(0,e.jsx)("div",{className:(0,N.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":Q},E==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},b.id)})},`groupCategory-${h}`))})]}),(0,e.jsxs)("div",{role:"menu","aria-hidden":!(g?.open&&y),className:(0,N.cn)("absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black",{hidden:!(g?.open&&y)}),style:{height:`calc(100dvh - ${W?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:F,className:(0,N.cn)("relative z-50",{"overflow-hidden":x!==r.HeaderNavigationBlockType.Supports}),onMouseEnter:()=>{G(),f(!0)},onMouseLeave:()=>{ee(),f(!1)},children:ae}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:P,onMouseEnter:P,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),P())}})]}),B&&(0,e.jsxs)("div",{className:"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70",role:"dialog","aria-modal":"true","aria-label":"User profile menu",children:[(0,e.jsx)("div",{className:"rounded-box absolute w-[272px] overflow-hidden bg-white p-4",style:{right:`calc(100% - ${R?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:p?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:p?.nick_name||L?.welcome,className:"text-sm font-bold"}),(0,e.jsx)("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),(0,e.jsx)("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:L?.profiles?.map(a=>(0,e.jsx)(se.MenuItem,{className:"py-2",label:a?.title,href:(0,N.getLocalizedPath)(a?.url,H)},a.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(S.Polygon,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),(0,e.jsx)(l.Text,{html:L?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:L?.benefits?.map(a=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:a.benefitIcon?.url,className:"size-4 shrink-0",alt:a.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:a.benefit,className:"text-sm font-bold leading-[1.4]"})]},a.id))}),(0,e.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,e.jsx)(l.Button,{className:"grow",variant:"secondary",size:"lg",onClick:()=>m?.join?.(),children:(0,e.jsx)(l.Text,{html:L?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{className:"grow",variant:"primary",size:"lg",onClick:()=>m?.login?.(),children:(0,e.jsx)(l.Text,{html:L?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>z(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),z(!1))}})]})]})}),be=(0,t.forwardRef)(({data:n,menuData:o,className:i,onPrimaryNavClick:s,onMobileMenuToggle:c},E)=>{const d=(0,t.useMemo)(()=>(0,M.WithGroupCategory)(n?.categories?.filter(u=>u?.mobileShow)),[n]),{currentMenu:m,setCurrentMenu:p,subSubCategory:v}=(0,$.useNavContext)(),[f,H]=(0,t.useState)(!1),[k,y]=(0,t.useState)(0),[T,K]=(0,t.useState)(null),D=(0,t.useRef)(null),R=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(D?.current&&f){const u=D?.current?.getBoundingClientRect();y(window?.innerHeight-(u?.top||0))}c?.({open:f})},[f,c]),(0,t.useEffect)(()=>{if(!f)return;const u=(0,de.default)(()=>{if(D?.current){const j=D.current.getBoundingClientRect();R.current=!0,y(window?.innerHeight-(j?.top||0))}},100);return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[f]),(0,ie.useGSAP)(()=>{if(R.current){X.gsap.set(D.current,{height:k}),R.current=!1;return}X.gsap.fromTo(D.current,{height:0},{height:k,duration:.3})},[k]),(0,le.useScrollLock)(f);const B=(0,t.useMemo)(()=>T?.components?.[0]?.blockType,[T]),z=(0,M.WithSupports)(Te.MobileSupportMenu,{categoriesItem:T}),W=(0,M.WithSidebar)(Se.MobileSidebarMenu,T),F=(0,M.WithResource)(Ce.MobileResourceSidebarMenu,T),C=(0,M.WithMulticol)(De.MobileMulticolMenu,T),I=(0,t.useMemo)(()=>{switch(B){case r.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(W,{});case r.HeaderNavigationBlockType.Resource:return(0,e.jsx)(F,{});case r.HeaderNavigationBlockType.Supports:return(0,e.jsx)(z,{});case r.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(C,{});default:return null}},[B,T,z]),g=(0,t.useCallback)(()=>{H(!1),y(0),p&&p(r.HeaderNavigationMenu.Primary)},[H,y,p]),A=(0,t.useMemo)(()=>n?.bar?.actions?.filter(u=>u?.mobileShow&&u?.blockType!==r.HeaderNavigationActionBlockType.Profile),[n]),U=(0,t.useMemo)(()=>n?.bar?.actions?.find(u=>u?.mobileShow&&u?.blockType===r.HeaderNavigationActionBlockType.Profile)||{},[n]),O=(0,t.useMemo)(()=>{switch(m){case r.HeaderNavigationMenu.Primary:return(0,e.jsx)(_e,{actions:A,menuOpen:f,onMenuOpenClose:()=>{H(!1),y(0)},onMenuOpenClick:()=>H(!0)});case r.HeaderNavigationMenu.Secondary:return(0,e.jsx)(ge,{title:T?.text,onMenuOpenClose:g,onMenuBackClick:()=>p?.(r.HeaderNavigationMenu.Primary)});case r.HeaderNavigationMenu.Third:return(0,e.jsx)(ge,{title:v?.label,onMenuOpenClose:g,onMenuBackClick:()=>p?.(r.HeaderNavigationMenu.Secondary)});default:return null}},[f,m,p,T,A,v,g]),P=(0,t.useCallback)((u,j)=>{const G=Array.isArray(d)?Array.isArray(d[u])?d[u][j]:{}:{};G?.components?.[0]?.blockType!==r.HeaderNavigationBlockType.Links&&(K(G),p?.(r.HeaderNavigationMenu.Secondary))},[d,p]);return(0,e.jsxs)(l.Container,{className:(0,N.cn)("relative h-[56px]",i),children:[O,f&&(0,e.jsxs)("nav",{ref:D,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:k},role:"navigation","aria-label":"Mobile navigation menu",children:[m===r.HeaderNavigationMenu.Primary&&o?(0,e.jsx)("div",{className:"pt-4",children:(0,e.jsx)(l.BrandStrip,{data:o})}):null,m===r.HeaderNavigationMenu.Primary?(0,e.jsx)(Oe,{categories:d,onPrimaryMenuClick:P,onPrimaryNavClick:s,profileAction:U,menuData:o}):I]})]})}),Oe=({categories:n,onPrimaryMenuClick:o,profileAction:i,onPrimaryNavClick:s,menuData:c})=>{const{locale:E="us"}=(0,Z.useAiuiContext)();return(0,e.jsxs)("div",{className:"flex h-full flex-col justify-between",children:[(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:n?.map((d,m)=>(0,e.jsxs)("div",{className:"",children:[m>0||c?(0,e.jsx)("div",{className:(0,N.cn)("my-2 h-px w-full bg-[#E5E5E7]")}):null,d?.map((p,v)=>{const f=p.components?.[0]?.blockType===r.HeaderNavigationBlockType.Links;return(0,e.jsx)(se.MenuItem,{label:p.text,href:f?(0,N.getLocalizedPath)(p.url,E):void 0,target:f?p.target:void 0,onClick:()=>{const k=(n?.flat()||[])?.findIndex(y=>y?.id===n[m][v]?.id);o(m,v),s?.(p,k)},icon:p.components?.[0]?.icon},p.id)})]},`groupCategory-${m}`))}),(0,e.jsx)(je,{profileAction:i})]})},je=({profileAction:n})=>{const[o,i]=(0,t.useState)(!1),{profile:s,event:c}=(0,$.useNavContext)(),{locale:E="us"}=(0,Z.useAiuiContext)();return(0,e.jsxs)("div",{className:(0,N.cn)("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":o}),children:[(0,e.jsxs)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>i(!o),"aria-expanded":o,"aria-label":s?.nick_name||n?.welcome,children:[(0,e.jsxs)("div",{className:"flex items-center gap-[14px]",children:[(0,e.jsx)("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:(0,e.jsx)(S.User,{"aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:s?.nick_name||n?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!s?.email&&(0,e.jsx)(S.DownArrow,{"aria-hidden":"true",className:(0,N.cn)("laptop:size-4 size-5",{"rotate-180":o})})]}),s?.email&&(0,e.jsx)("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:n?.profiles?.map(d=>(0,e.jsx)(se.MenuItem,{label:d?.title,href:(0,N.getLocalizedPath)(d?.url,E)},d.id))}),o&&!s?.email&&(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsx)(l.Text,{html:n?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:n?.benefits?.map(d=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:d.benefitIcon?.url,className:"size-4",alt:d.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:d.benefit,className:"text-sm font-bold leading-[1.4]"})]},d.id))})]}),!s?.email&&(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>c?.join?.(),children:(0,e.jsx)(l.Text,{html:n?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>c?.login?.(),children:(0,e.jsx)(l.Text,{html:n?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},_e=({menuOpen:n,onMenuOpenClose:o,onMenuOpenClick:i,actions:s})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(ve,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(ue,{actions:s}),n?(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>o(),"aria-label":"Close menu","aria-expanded":"true",children:(0,e.jsx)(S.Close,{className:"size-5","aria-hidden":"true"})}):(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:(0,e.jsx)(S.Menu,{className:"size-5","aria-hidden":"true"})})]})]}),ve=()=>{const{payloadData:n,isMobile:o}=(0,$.useNavContext)(),{locale:i="us"}=(0,Z.useAiuiContext)();return(0,e.jsx)("a",{href:(0,N.getLocalizedPath)("/",i),className:"hover:text-[#00CBEB] [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:o?n?.bar?.mobileLogo:n?.bar?.desktopLogo}})},ue=(0,t.forwardRef)(({actions:n,activeStatus:o=!1},i)=>{const{event:s,cartCount:c}=(0,$.useNavContext)(),[E,d]=(0,t.useState)(null),m=v=>{switch(v){case r.HeaderNavigationActionBlockType.Search:return"Search";case r.HeaderNavigationActionBlockType.Cart:return`Shopping cart${c>0?` (${c} items)`:""}`;case r.HeaderNavigationActionBlockType.Profile:return"User profile";case r.HeaderNavigationActionBlockType.Livestream:return"Livestream";default:return"Action"}},p=(0,t.useCallback)((v,f)=>{switch(d(f),v?.blockType){case r.HeaderNavigationActionBlockType.Search:s?.search?.();break;case r.HeaderNavigationActionBlockType.Cart:s?.cart?.();break;case r.HeaderNavigationActionBlockType.Profile:s?.profile?.();break;case r.HeaderNavigationActionBlockType.Livestream:s?.livestream?.();break;default:return()=>{}}},[s]);return(0,e.jsx)("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(n)&&n?.map((v,f)=>(0,e.jsxs)("button",{className:"relative cursor-pointer border-0 bg-transparent p-0","data-tag":v?.tag||"",ref:v.blockType===r.HeaderNavigationActionBlockType.Profile?i:null,onClick:()=>p(v,f),"aria-label":m(v.blockType),"aria-pressed":o&&E===f,children:[(0,e.jsx)(l.Text,{html:v.icon,className:(0,N.cn)("size-5",{"text-brand-0":o&&E===f}),"aria-hidden":"true"}),v.blockType===r.HeaderNavigationActionBlockType.Cart&&c>0&&(0,e.jsx)("div",{className:"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]","aria-hidden":"true",children:(0,e.jsx)(l.Text,{html:c?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},v.id))})}),ge=({title:n,onMenuOpenClose:o,onMenuBackClick:i})=>(0,e.jsxs)("div",{className:"flex h-full items-center gap-3",children:[(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Back to previous menu",children:(0,e.jsx)(S.LeftArrow,{className:"size-5","aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:n,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>o(),"aria-label":"Close menu",children:(0,e.jsx)(S.Close,{className:"size-5","aria-hidden":"true"})})]});be.displayName="MobileNavigation",ue.displayName="Actions",pe.displayName="HeaderNavigation",fe.displayName="DesktopNavigation";var $e=(0,he.withLayout)(pe);
1
+ "use strict";"use client";var Me=Object.create;var Z=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Ee=Object.prototype.hasOwnProperty;var Te=(n,r)=>{for(var i in r)Z(n,i,{get:r[i],enumerable:!0})},le=(n,r,i,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of Pe(r))!Ee.call(n,u)&&u!==i&&Z(n,u,{get:()=>r[u],enumerable:!(c=Se(r,u))||c.enumerable});return n};var ee=(n,r,i)=>(i=n!=null?Me(De(n)):{},le(r||!n||!n.__esModule?Z(i,"default",{value:n,enumerable:!0}):i,n)),He=n=>le(Z({},"__esModule",{value:!0}),n);var Ie={};Te(Ie,{default:()=>Re});module.exports=He(Ie);var e=require("react/jsx-runtime"),t=require("react"),l=require("../../components/index.js"),pe=require("../../shared/Styles.js"),k=require("../../helpers/utils.js"),F=ee(require("./NavProvider.js")),o=require("./types.js"),fe=ee(require("jump.js")),te=require("@gsap/react"),X=require("gsap"),C=require("./withCategory.js"),S=require("./icons/index.js"),be=ee(require("../NavigationSearch/index.js")),ve=require("./ResourceSidebarDropdown.js"),ge=require("./MobileResourceSidebarMenu.js"),he=require("./SidebarDropdown.js"),ae=require("./useScrollLock.js"),ye=require("./MulticolDropdown.js"),Ne=require("./SupportsDropdown.js"),ke=require("./MobileSidebarMenu.js"),we=require("./MobileSupportMenu.js"),xe=require("./MobileMulticolMenu.js"),ne=require("./MobileMenuComponents.js"),oe=require("../AiuiProvider/index.js"),ie=ee(require("../../shared/throttle.js"));const se=(0,t.forwardRef)((n,r)=>{const{data:{header:i}={},buildProps:c,event:u,profile:P,theme:s="light",isTop:m=!1,searchResult:x,onSearch:b,isSearching:p,keywords:_,onPrimaryNavClick:w,onSeriesProductClick:h,onSidebarNavClick:D,onMobileMenuToggle:U,headerId:E,cartCount:L,menuData:z,render:B,componentOverrides:G,...J}=n,[R,f]=(0,t.useState)(!1),[W,I]=(0,t.useState)(!1),[A,H]=(0,t.useState)(!1),[Y,g]=(0,t.useState)(!1),O=(0,t.useRef)(null),M=(0,t.useRef)(null),q=()=>{const y=document?.querySelector("body")?.offsetWidth||0;g(y<=1440)};(0,t.useEffect)(()=>(q(),window.addEventListener("resize",q),()=>{window.removeEventListener("resize",q)}),[]),(0,t.useImperativeHandle)(r,()=>M.current),(0,t.useEffect)(()=>{M.current&&m&&(0,fe.default)(M.current,{duration:0,offset:M.current?.getBoundingClientRect()?.bottom||0})},[m]),(0,t.useEffect)(()=>{if(m){I(!1),H(!1);return}let y=0,a=0,d=0;const v=()=>document?.documentElement?.scrollTop||document?.body?.scrollTop||0,N=v();y=N,I(N>300),H(N>30);const $=(0,ie.default)(()=>{const T=v(),K=T-y;H(T>30),K>0?(a=0,d+=K,d>=300&&T>300&&I(!0)):K<0&&(d=0,a+=Math.abs(K),a>=300&&(I(!1),a=0)),y=T},100);return window.addEventListener("scroll",$,{passive:!0}),()=>window.removeEventListener("scroll",$)},[m]),(0,t.useEffect)(()=>{u&&(u.search=()=>f(!0))},[u]),(0,te.useGSAP)(()=>{O?.current&&R&&X.gsap.fromTo(O.current,{height:0},{height:"auto",duration:.3})},[R]),(0,ae.useScrollLock)(R);const Q=(0,t.useMemo)(()=>i?.bar?.actions?.find(y=>y?.blockType===o.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[i]),j=B?.mobileHeaderNavigation;return(0,e.jsx)(F.default,{buildProps:c,profile:P,isMobile:Y,event:u,payloadData:i,onSidebarNavClick:D,onSeriesProductClick:h,cartCount:L,componentOverrides:G,children:(0,e.jsx)("header",{...J,id:E||"header","data-ui-component-id":"HeaderNavigation",className:m?"relative z-[100] bg-white":(0,k.cn)("sticky top-0 z-[100] transition-transform duration-500 ease-in-out",{"translate-y-[-100%]":W}),ref:M,children:(0,e.jsxs)("div",{className:(0,k.cn)("hover:bg-white hover:text-black",s==="light"?"text-black":"text-white",{"!bg-white transition-all duration-500 ease-in-out":!m&&A},{"hover:!text-black":s==="dark","!text-black":!m&&A}),onClick:()=>!m&&H(!0),children:[(0,e.jsx)(ce,{data:i,className:"desktop:block hidden !bg-white",theme:s,onNavItemClick:()=>!m&&H(!0),onPrimaryNavClick:w}),j?(0,e.jsx)(j,{className:"desktop:hidden block !bg-white",menuData:z,data:i,onPrimaryNavClick:w}):(0,e.jsx)(ue,{menuData:z,data:i,className:"desktop:hidden block !bg-white",onPrimaryNavClick:w,onMobileMenuToggle:U}),R&&(0,e.jsxs)("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${M?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[(0,e.jsx)("div",{ref:O,className:(0,k.cn)("overflow-y-auto",{}),children:(0,e.jsx)(be.default,{data:Q,keywords:_,isSearching:p,searchResult:x,onSearch:y=>{b?.(y)},onClose:()=>{b?.(),f(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>f(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:y=>{(y.key==="Enter"||y.key===" "||y.key==="Escape")&&(y.preventDefault(),f(!1))}})]})]})})})}),ce=(0,t.forwardRef)((n,r)=>{const{data:i,onNavItemClick:c,className:u,theme:P,onPrimaryNavClick:s}=n,{event:m,profile:x}=(0,F.useNavContext)(),[b,p]=(0,t.useState)(!1),{locale:_="us"}=(0,oe.useAiuiContext)(),w=(0,t.useMemo)(()=>(0,C.WithGroupCategory)(i?.categories?.filter(a=>a?.pcShow)),[i]),[h,D]=(0,t.useState)(null),[U,E]=(0,t.useState)([]),L=(0,t.useRef)(null),[z,B]=(0,t.useState)(!1),G=(0,t.useRef)(null),J=(0,t.useRef)(null),R=(0,t.useRef)(w.map(a=>Array(a?.length||0).fill(null)));(0,t.useEffect)(()=>{w?.length&&E(w?.map((a,d)=>a?.map((v,N)=>({groupIndex:d,index:N,open:!1}))))},[w]);const f=(0,t.useMemo)(()=>{let a=null;for(const d of U){for(const v of d)if(v.open){a=v;break}if(a)break}return a},[U]);(0,ae.useScrollLock)(!!f?.open||z);const W=(a,d,v)=>{B(!1);const N=w[d][v];if(N?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links)N?.components?.[0]?.url&&window.open(N?.components?.[0]?.url,N?.components?.[0]?.target??"_blank");else{const $=w?.flat()||[],T=$?.findIndex(K=>K?.id===w[d][v]?.id);a.stopPropagation(),c?.(),s?.($[T],T),D(N),E(K=>K.map(Ce=>Ce.map(V=>V.groupIndex===d&&V.index===v?{...V,open:!V.open}:{...V,open:!1})))}},I=(a,d,v)=>{a.key==="Enter"||a.key===" "?(a.preventDefault(),W(a,d,v)):a.key==="Escape"&&f?.groupIndex===d&&f?.index===v&&(a.preventDefault(),A())},A=()=>{E(a=>a.map(d=>d.map(v=>({...v,open:!1}))))},H=(0,t.useMemo)(()=>{if(h)return h?.components?.[0]?.blockType},[h]),Y=(0,C.WithSidebar)(he.SidebarDropdown,h),g=(0,C.WithResource)(ve.ResourceSidebarDropdown,h),O=(0,C.WithMulticol)(ye.MulticolDropdown,h),M=(0,C.WithSupports)(Ne.SupportsDropdown,{categoriesItem:h,currentNavItemRef:R.current?.[f?.groupIndex||0]?.[f?.index||0]}),q=(0,t.useMemo)(()=>{switch(H){case o.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(Y,{});case o.HeaderNavigationBlockType.Resource:return(0,e.jsx)(g,{});case o.HeaderNavigationBlockType.Supports:return(0,e.jsx)(M,{});case o.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(O,{});default:return null}},[H,h]),Q=(0,t.useMemo)(()=>i?.bar?.actions?.filter(a=>a?.pcShow),[i]),j=(0,t.useMemo)(()=>Q?.find(a=>a?.blockType===o.HeaderNavigationActionBlockType.Profile),[Q]),y=(0,t.useCallback)(()=>{B(a=>!a)},[]);return(0,t.useEffect)(()=>{if(L?.current){const a=L.current;return a.addEventListener("click",y),()=>{a.removeEventListener("click",y)}}},[y]),(0,te.useGSAP)(()=>{f?.open&&X.gsap.fromTo(J?.current,{height:0},{height:"auto"})},[f?.open]),(0,e.jsxs)(l.Container,{className:(0,k.cn)("relative h-[92px]",u),children:[(0,e.jsxs)("div",{ref:G,onClick:A,className:"flex h-full flex-col justify-end gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(de,{}),(0,e.jsx)(re,{ref:L,actions:Q,activeStatus:z})]}),(0,e.jsx)("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:w?.map((a,d)=>(0,e.jsx)("div",{className:"flex gap-3",children:a?.map((v,N)=>{const $=f?.groupIndex===d&&f?.index===N;return(0,e.jsx)("div",{ref:T=>{R.current[d][N]=T},className:"group",children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("button",{className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4",onClick:T=>W(T,d,N),onKeyDown:T=>I(T,d,N),"aria-expanded":$,"aria-haspopup":"true","aria-label":v.text,children:[(0,e.jsx)(l.Text,{html:v.text,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)(S.DownArrow,{className:(0,k.cn)("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":f?.groupIndex===d&&f?.index===N,"opacity-100":b&&f?.groupIndex===d&&f?.index===N,invisible:!v?.components?.length||v?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links})})]}),(0,e.jsx)("div",{className:(0,k.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":$},P==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},v.id)})},`groupCategory-${d}`))})]}),(0,e.jsxs)("div",{role:"menu","aria-hidden":!(f?.open&&h),className:(0,k.cn)("absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black",{hidden:!(f?.open&&h)}),onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{height:`calc(100dvh - ${G?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:J,className:(0,k.cn)("relative z-50",{"overflow-hidden":H!==o.HeaderNavigationBlockType.Supports}),children:q}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:A,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),A())}})]}),z&&(0,e.jsxs)("div",{className:"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70",role:"dialog","aria-modal":"true","aria-label":"User profile menu",children:[(0,e.jsx)("div",{className:"rounded-box absolute w-[272px] overflow-hidden bg-white p-4",style:{right:`calc(100% - ${L?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:x?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:x?.nick_name||j?.welcome,className:"text-sm font-bold"}),(0,e.jsx)("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),(0,e.jsx)("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:j?.profiles?.map(a=>(0,e.jsx)(ne.MenuItem,{className:"py-2",label:a?.title,href:(0,k.getLocalizedPath)(a?.url,_)},a.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(S.Polygon,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),(0,e.jsx)(l.Text,{html:j?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:j?.benefits?.map(a=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:a.benefitIcon?.url,className:"size-4 shrink-0",alt:a.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:a.benefit,className:"text-sm font-bold leading-[1.4]"})]},a.id))}),(0,e.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,e.jsx)(l.Button,{className:"grow",variant:"secondary",size:"lg",onClick:()=>m?.join?.(),children:(0,e.jsx)(l.Text,{html:j?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{className:"grow",variant:"primary",size:"lg",onClick:()=>m?.login?.(),children:(0,e.jsx)(l.Text,{html:j?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>B(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),B(!1))}})]})]})}),ue=(0,t.forwardRef)(({data:n,menuData:r,className:i,onPrimaryNavClick:c,onMobileMenuToggle:u},P)=>{const s=(0,t.useMemo)(()=>(0,C.WithGroupCategory)(n?.categories?.filter(g=>g?.mobileShow)),[n]),{currentMenu:m,setCurrentMenu:x,subSubCategory:b}=(0,F.useNavContext)(),[p,_]=(0,t.useState)(!1),[w,h]=(0,t.useState)(0),[D,U]=(0,t.useState)(null),E=(0,t.useRef)(null),L=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(E?.current&&p){const g=E?.current?.getBoundingClientRect();h(window?.innerHeight-(g?.top||0))}u?.({open:p})},[p,u]),(0,t.useEffect)(()=>{if(!p)return;const g=(0,ie.default)(()=>{if(E?.current){const O=E.current.getBoundingClientRect();L.current=!0,h(window?.innerHeight-(O?.top||0))}},100);return window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[p]),(0,te.useGSAP)(()=>{if(L.current){X.gsap.set(E.current,{height:w}),L.current=!1;return}X.gsap.fromTo(E.current,{height:0},{height:w,duration:.3})},[w]),(0,ae.useScrollLock)(p);const z=(0,t.useMemo)(()=>D?.components?.[0]?.blockType,[D]),B=(0,C.WithSupports)(we.MobileSupportMenu,{categoriesItem:D}),G=(0,C.WithSidebar)(ke.MobileSidebarMenu,D),J=(0,C.WithResource)(ge.MobileResourceSidebarMenu,D),R=(0,C.WithMulticol)(xe.MobileMulticolMenu,D),f=(0,t.useMemo)(()=>{switch(z){case o.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(G,{});case o.HeaderNavigationBlockType.Resource:return(0,e.jsx)(J,{});case o.HeaderNavigationBlockType.Supports:return(0,e.jsx)(B,{});case o.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(R,{});default:return null}},[z,D,B]),W=(0,t.useCallback)(()=>{_(!1),h(0),x&&x(o.HeaderNavigationMenu.Primary)},[_,h,x]),I=(0,t.useMemo)(()=>n?.bar?.actions?.filter(g=>g?.mobileShow&&g?.blockType!==o.HeaderNavigationActionBlockType.Profile),[n]),A=(0,t.useMemo)(()=>n?.bar?.actions?.find(g=>g?.mobileShow&&g?.blockType===o.HeaderNavigationActionBlockType.Profile)||{},[n]),H=(0,t.useMemo)(()=>{switch(m){case o.HeaderNavigationMenu.Primary:return(0,e.jsx)(Be,{actions:I,menuOpen:p,onMenuOpenClose:()=>{_(!1),h(0)},onMenuOpenClick:()=>_(!0)});case o.HeaderNavigationMenu.Secondary:return(0,e.jsx)(me,{title:D?.text,onMenuOpenClose:W,onMenuBackClick:()=>x?.(o.HeaderNavigationMenu.Primary)});case o.HeaderNavigationMenu.Third:return(0,e.jsx)(me,{title:b?.label,onMenuOpenClose:W,onMenuBackClick:()=>x?.(o.HeaderNavigationMenu.Secondary)});default:return null}},[p,m,x,D,I,b,W]),Y=(0,t.useCallback)((g,O)=>{const M=Array.isArray(s)?Array.isArray(s[g])?s[g][O]:{}:{};U(M),M?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links?M?.components?.[0]?.url&&window.open(M?.components?.[0]?.url,M?.components?.[0]?.target??"_blank"):x?.(o.HeaderNavigationMenu.Secondary)},[s,x]);return(0,e.jsxs)(l.Container,{className:(0,k.cn)("relative h-[56px]",i),children:[H,p&&(0,e.jsxs)("nav",{ref:E,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:w},role:"navigation","aria-label":"Mobile navigation menu",children:[m===o.HeaderNavigationMenu.Primary&&r?(0,e.jsx)("div",{className:"pt-4",children:(0,e.jsx)(l.BrandStrip,{data:r})}):null,m===o.HeaderNavigationMenu.Primary?(0,e.jsx)(Le,{categories:s,onPrimaryMenuClick:Y,onPrimaryNavClick:c,profileAction:A}):f]})]})}),Le=({categories:n,onPrimaryMenuClick:r,profileAction:i,onPrimaryNavClick:c})=>(0,e.jsxs)("div",{className:"flex h-full flex-col justify-between",children:[(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:n?.map((u,P)=>(0,e.jsxs)("div",{className:"",children:[(0,e.jsx)("div",{className:(0,k.cn)("my-2 h-px w-full bg-[#E5E5E7]")}),u?.map((s,m)=>(0,e.jsx)(ne.MenuItem,{label:s.text,onClick:()=>{const b=(n?.flat()||[])?.findIndex(p=>p?.id===n[P][m]?.id);r(P,m),c?.(s,b)},icon:s.components?.[0]?.icon},s.id))]},`groupCategory-${P}`))}),(0,e.jsx)(ze,{profileAction:i})]}),ze=({profileAction:n})=>{const[r,i]=(0,t.useState)(!1),{profile:c,event:u}=(0,F.useNavContext)(),{locale:P="us"}=(0,oe.useAiuiContext)();return(0,e.jsxs)("div",{className:(0,k.cn)("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":r}),children:[(0,e.jsxs)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>i(!r),"aria-expanded":r,"aria-label":c?.nick_name||n?.welcome,children:[(0,e.jsxs)("div",{className:"flex items-center gap-[14px]",children:[(0,e.jsx)("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:(0,e.jsx)(S.User,{"aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:c?.nick_name||n?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!c?.email&&(0,e.jsx)(S.DownArrow,{"aria-hidden":"true",className:(0,k.cn)("laptop:size-4 size-5",{"rotate-180":r})})]}),c?.email&&(0,e.jsx)("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:n?.profiles?.map(s=>(0,e.jsx)(ne.MenuItem,{label:s?.title,href:(0,k.getLocalizedPath)(s?.url,P)},s.id))}),r&&!c?.email&&(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsx)(l.Text,{html:n?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:n?.benefits?.map(s=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:s.benefitIcon?.url,className:"size-4",alt:s.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:s.benefit,className:"text-sm font-bold leading-[1.4]"})]},s.id))})]}),!c?.email&&(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>u?.join?.(),children:(0,e.jsx)(l.Text,{html:n?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>u?.login?.(),children:(0,e.jsx)(l.Text,{html:n?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},Be=({menuOpen:n,onMenuOpenClose:r,onMenuOpenClick:i,actions:c})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(de,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(re,{actions:c}),n?(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>r(),"aria-label":"Close menu","aria-expanded":"true",children:(0,e.jsx)(S.Close,{className:"size-5","aria-hidden":"true"})}):(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:(0,e.jsx)(S.Menu,{className:"size-5","aria-hidden":"true"})})]})]}),de=()=>{const{payloadData:n,isMobile:r}=(0,F.useNavContext)(),{locale:i="us"}=(0,oe.useAiuiContext)();return(0,e.jsx)("a",{href:(0,k.getLocalizedPath)("/",i),className:"hover:text-[#00CBEB] [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:r?n?.bar?.mobileLogo:n?.bar?.desktopLogo}})},re=(0,t.forwardRef)(({actions:n,activeStatus:r=!1},i)=>{const{event:c,cartCount:u}=(0,F.useNavContext)(),[P,s]=(0,t.useState)(null),m=b=>{switch(b){case o.HeaderNavigationActionBlockType.Search:return"Search";case o.HeaderNavigationActionBlockType.Cart:return`Shopping cart${u>0?` (${u} items)`:""}`;case o.HeaderNavigationActionBlockType.Profile:return"User profile";case o.HeaderNavigationActionBlockType.Livestream:return"Livestream";default:return"Action"}},x=(0,t.useCallback)((b,p)=>{switch(s(p),b?.blockType){case o.HeaderNavigationActionBlockType.Search:c?.search?.();break;case o.HeaderNavigationActionBlockType.Cart:c?.cart?.();break;case o.HeaderNavigationActionBlockType.Profile:c?.profile?.();break;case o.HeaderNavigationActionBlockType.Livestream:c?.livestream?.();break;default:return()=>{}}},[c]);return(0,e.jsx)("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(n)&&n?.map((b,p)=>(0,e.jsxs)("button",{className:"relative cursor-pointer border-0 bg-transparent p-0","data-tag":b?.tag||"",ref:b.blockType===o.HeaderNavigationActionBlockType.Profile?i:null,onClick:()=>x(b,p),"aria-label":m(b.blockType),"aria-pressed":r&&P===p,children:[(0,e.jsx)(l.Text,{html:b.icon,className:(0,k.cn)("size-5",{"text-brand-0":r&&P===p}),"aria-hidden":"true"}),b.blockType===o.HeaderNavigationActionBlockType.Cart&&u>0&&(0,e.jsx)("div",{className:"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]","aria-hidden":"true",children:(0,e.jsx)(l.Text,{html:u?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},b.id))})}),me=({title:n,onMenuOpenClose:r,onMenuBackClick:i})=>(0,e.jsxs)("div",{className:"flex h-full items-center gap-3",children:[(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Back to previous menu",children:(0,e.jsx)(S.LeftArrow,{className:"size-5","aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:n,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>r(),"aria-label":"Close menu",children:(0,e.jsx)(S.Close,{className:"size-5","aria-hidden":"true"})})]});ue.displayName="MobileNavigation",re.displayName="Actions",se.displayName="HeaderNavigation",ce.displayName="DesktopNavigation";var Re=(0,pe.withLayout)(se);