@anker-in/headless-ui 1.3.73 → 1.3.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/biz-components/AiuiProvider/index.d.ts +9 -0
- package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/CreditsShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/FooterNavigation/index.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +2 -1
- package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.d.ts +2 -1
- package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/types.d.ts +1 -0
- package/dist/cjs/biz-components/HeaderNavigation/types.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/useNavCollapse.d.ts +30 -0
- package/dist/cjs/biz-components/HeaderNavigation/useNavCollapse.js +1 -0
- package/dist/cjs/biz-components/HeaderNavigation/useScrollLock.d.ts +2 -1
- package/dist/cjs/biz-components/HeaderNavigation/useScrollLock.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/withCategory.js +1 -1
- package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/SceneShelfV3/ProductCard.js +1 -1
- package/dist/cjs/biz-components/SearchPage/index.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplayHorizontal/shelfDisplayHorizontalItem.js +1 -1
- package/dist/cjs/biz-components/Specs/dropdown.d.ts +2 -1
- package/dist/cjs/biz-components/Specs/dropdown.js +2 -2
- package/dist/cjs/biz-components/Specs/index.js +1 -1
- package/dist/cjs/components/badge.d.ts +1 -1
- package/dist/cjs/components/badge.js +1 -1
- package/dist/cjs/components/board.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.d.ts +9 -0
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/CreditsShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/FooterNavigation/index.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +2 -1
- package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/ResourceItem.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.d.ts +2 -1
- package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/types.d.ts +1 -0
- package/dist/esm/biz-components/HeaderNavigation/useNavCollapse.d.ts +30 -0
- package/dist/esm/biz-components/HeaderNavigation/useNavCollapse.js +1 -0
- package/dist/esm/biz-components/HeaderNavigation/useScrollLock.d.ts +2 -1
- package/dist/esm/biz-components/HeaderNavigation/useScrollLock.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/withCategory.js +1 -1
- package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/SceneShelfV3/ProductCard.js +1 -1
- package/dist/esm/biz-components/SearchPage/index.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/esm/biz-components/ShelfDisplayHorizontal/shelfDisplayHorizontalItem.js +1 -1
- package/dist/esm/biz-components/Specs/dropdown.d.ts +2 -1
- package/dist/esm/biz-components/Specs/dropdown.js +2 -2
- package/dist/esm/biz-components/Specs/index.js +1 -1
- package/dist/esm/components/badge.d.ts +1 -1
- package/dist/esm/components/badge.js +1 -1
- package/dist/esm/components/board.js +1 -1
- package/dist/tokens/oneAnker.css +22 -0
- package/package.json +1 -1
- package/style.css +29 -2
- package/tailwind.config.js +5 -0
|
@@ -81,6 +81,15 @@ interface AiuiContextType {
|
|
|
81
81
|
* @example { 'eu-pl': 'pl-PL', 'eu-pt': 'pt-PT' }
|
|
82
82
|
*/
|
|
83
83
|
localeMap?: Record<string, string>;
|
|
84
|
+
/**
|
|
85
|
+
* 导航折叠状态(HeaderNavigation 内容驱动测量结果),供 Board 等兄弟组件视觉联动。
|
|
86
|
+
* HeaderNavigation 在内部测量后写入,Board 读取以控制 leftIcon 显隐。
|
|
87
|
+
*/
|
|
88
|
+
navCollapsed?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* 设置导航折叠状态。仅供 HeaderNavigation 内部写入,消费方无需关心。
|
|
91
|
+
*/
|
|
92
|
+
setNavCollapsed?: (_collapsed: boolean) => void;
|
|
84
93
|
}
|
|
85
94
|
export declare const AiuiContext: React.Context<AiuiContextType>;
|
|
86
95
|
export declare const useAiuiContext: () => AiuiContextType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";"use client";var d=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var M=(a,e)=>{for(var i in e)d(a,i,{get:e[i],enumerable:!0})},P=(a,e,i,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of T(e))!_.call(a,o)&&o!==i&&d(a,o,{get:()=>e[o],enumerable:!(c=D(e,o))||c.enumerable});return a};var R=a=>P(d({},"__esModule",{value:!0}),a);var S={};M(S,{AiuiContext:()=>m,default:()=>O,useAiuiContext:()=>L});module.exports=R(S);var g=require("react/jsx-runtime"),h=require("../../shared/track.js"),t=require("react"),k=require("../../helpers/index.js");const m=(0,t.createContext)({trackingData:{},locale:void 0,copyWriting:{}}),L=()=>{const a=(0,t.useContext)(m);if(!a)throw new Error("useAiui must be used in <AiuiProvider>");return a},N=({children:a,...e})=>{const i=(0,t.useRef)(null),c=(0,t.useRef)(e?.trackingData),[o,x]=(0,t.useState)(!1);(0,t.useEffect)(()=>{e.localeMap&&Object.keys(e.localeMap).length>0&&(0,k.extendLocaleMap)(e.localeMap)},[e.localeMap]),(0,t.useEffect)(()=>{c.current=e?.trackingData},[e?.trackingData]),(0,t.useEffect)(()=>{const p=i.current;if(!p)return;const y=(n,r)=>{const s={};if(!r||!r.attributes)return s;for(const E of Array.from(r.attributes)){const u=E?.name;u?.startsWith("data-headless-")&&(s[u]=r.getAttribute(u))}const A=s?.["data-headless-sku"],b=s?.["data-headless-type-name"]?.split?.("#"),l=s?.["data-headless-title-desc-button"]?.split?.("#"),f=s?.["data-headless-nav-position"]?.split?.("#");(0,h.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:c.current?.pageGroup||"Home Page",component_type:b?.[0]||"",component_name:b?.[1]||"",position:f?.[1]||"",navigation:f?.[0]||"",button_name:l?.[2]||"",SKU:A||"",component_title:l?.[0]||"",component_description:l?.[1]||""}})},v=new MutationObserver(()=>{p.querySelectorAll("[data-headless-type-name]").forEach(n=>{n.hasAttribute("data-headless-track-bound")||(n.addEventListener("click",r=>y(r,n)),n.setAttribute("data-headless-track-bound","true"))})});return v.observe(p,{childList:!0,subtree:!0}),p.querySelectorAll("[data-headless-type-name]").forEach(n=>{n.hasAttribute("data-headless-track-bound")||(n.addEventListener("click",r=>y(r,n)),n.setAttribute("data-headless-track-bound","true"))}),()=>v.disconnect()},[]);const C=(0,t.useMemo)(()=>({...e,navCollapsed:o,setNavCollapsed:x}),[e,o]);return(0,g.jsx)(m.Provider,{value:C,children:(0,g.jsx)("div",{ref:i,children:a})})};var O=N;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var Z=Object.create;var u=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var V=(e,o)=>{for(var i in o)u(e,i,{get:o[i],enumerable:!0})},N=(e,o,i,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of K(o))!U.call(e,c)&&c!==i&&u(e,c,{get:()=>o[c],enumerable:!(m=J(o,c))||m.enumerable});return e};var W=(e,o,i)=>(i=e!=null?Z(Q(e)):{},N(o||!e||!e.__esModule?u(i,"default",{value:e,enumerable:!0}):i,e)),X=e=>N(u({},"__esModule",{value:!0}),e);var ae={};V(ae,{CreditsProductCard:()=>g,default:()=>ee});module.exports=X(ae);var a=require("react/jsx-runtime"),d=W(require("react")),s=require("../../helpers/index.js"),t=require("../../components/index.js"),k=require("./context.js");const Y=()=>(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{d:"M8 1L10.163 5.279L15 6.001L11.5 9.409L12.326 14.226L8 11.97L3.674 14.226L4.5 9.409L1 6.001L5.837 5.279L8 1Z",fill:"currentColor"})}),g=d.forwardRef(({product:e,className:o,showTags:i,onLearnMore:m,onShopNow:c,onAddToCart:P,classNames:T,secondaryButtonText:B,secondaryButtonFun:L,primaryButtonText:S,primaryButtonFun:F,showOriginalPrice:z,copy:M,onProductImageClick:D},A)=>{const n=(0,k.useCreditsShelfContext)(),O=i??n?.showTags??!0,$=z??n?.showOriginalPrice??!0,f=M??n?.copy,r=T??n?.classNames,y=B??n?.secondaryButtonText,h=L??n?.secondaryButtonFun,x=S??n?.primaryButtonText,C=F??n?.primaryButtonFun,j=m??n?.onLearnMore,H=c??n?.onShopNow,I=P??n?.onAddToCart,
|
|
1
|
+
"use strict";"use client";var Z=Object.create;var u=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var V=(e,o)=>{for(var i in o)u(e,i,{get:o[i],enumerable:!0})},N=(e,o,i,m)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of K(o))!U.call(e,c)&&c!==i&&u(e,c,{get:()=>o[c],enumerable:!(m=J(o,c))||m.enumerable});return e};var W=(e,o,i)=>(i=e!=null?Z(Q(e)):{},N(o||!e||!e.__esModule?u(i,"default",{value:e,enumerable:!0}):i,e)),X=e=>N(u({},"__esModule",{value:!0}),e);var ae={};V(ae,{CreditsProductCard:()=>g,default:()=>ee});module.exports=X(ae);var a=require("react/jsx-runtime"),d=W(require("react")),s=require("../../helpers/index.js"),t=require("../../components/index.js"),k=require("./context.js");const Y=()=>(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,a.jsx)("path",{d:"M8 1L10.163 5.279L15 6.001L11.5 9.409L12.326 14.226L8 11.97L3.674 14.226L4.5 9.409L1 6.001L5.837 5.279L8 1Z",fill:"currentColor"})}),g=d.forwardRef(({product:e,className:o,showTags:i,onLearnMore:m,onShopNow:c,onAddToCart:P,classNames:T,secondaryButtonText:B,secondaryButtonFun:L,primaryButtonText:S,primaryButtonFun:F,showOriginalPrice:z,copy:M,onProductImageClick:D},A)=>{const n=(0,k.useCreditsShelfContext)(),O=i??n?.showTags??!0,$=z??n?.showOriginalPrice??!0,f=M??n?.copy,r=T??n?.classNames,y=B??n?.secondaryButtonText,h=L??n?.secondaryButtonFun,x=S??n?.primaryButtonText,C=F??n?.primaryButtonFun,j=m??n?.onLearnMore,H=c??n?.onShopNow,I=P??n?.onAddToCart,w=D??n?.onProductImageClick,[R,_]=d.useState(!1),[q,E]=d.useState(!1),v=async(l,p)=>{if(!l)return;const b=p==="primary"?_:E;b(!0);try{switch(l){case"buyNow":await H?.(e);break;case"addCart":await I?.(e);break;case"learnMore":await j?.(e);break;default:break}}finally{b(!1)}},G=d.useMemo(()=>e.creditSavingAmount?(f?.creditsSavingLabel??"Save up to {amount} with Credits").replace("{amount}",e.creditSavingAmount):null,[e.creditSavingAmount,f?.creditsSavingLabel]);return(0,a.jsxs)(t.Card,{ref:A,className:(0,s.cn)("bg-container-primary hover:bg-container-secondary-0 box-border flex h-full flex-col overflow-hidden border-none",o,r?.productCard),children:[(0,a.jsxs)(t.CardContent,{className:"lg-desktop:gap-[10px] lg-desktop:px-6 lg-desktop:py-4 relative flex flex-1 flex-col gap-2 p-4",children:[(0,a.jsx)("div",{className:"lg-desktop:h-[28px] flex h-[24px] gap-1",children:O&&e.tags?.map((l,p)=>l.label?(0,a.jsx)(t.Badge,{size:"sm",variant:l.variant||"outline",className:(0,s.cn)(l.variant==="promotional"?"ml-2":""),promotionalType:l.promotionalType,children:l.label},p):(0,a.jsx)(d.Fragment,{children:l},p))}),(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:()=>w?.(e),...!w&&{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:"lg-desktop:gap-6 flex flex-1 grow flex-col justify-between gap-4",children:[(0,a.jsxs)("div",{className:"lg-desktop:gap-1 flex flex-col gap-0.5",children:[(0,a.jsx)(t.Heading,{as:"h3",size:2,className:(0,s.cn)("text-info-primary line-clamp-2 min-h-[2.4em]",r?.productTitle),html:e.custom_name||e.name}),e?.description&&(0,a.jsx)(t.Text,{size:2,className:(0,s.cn)("text-info-secondary desktop:line-clamp-2 desktop:min-h-[2.4em] line-clamp-2 min-h-[2.4em]",r?.productDescription),html:e.custom_description||e.description})]}),(0,a.jsxs)("div",{className:"lg-desktop:gap-2 flex flex-col gap-1.5",children:[(0,a.jsx)("div",{className:(0,s.cn)(r?.productPrice),children:(0,a.jsx)("div",{className:"flex flex-wrap items-baseline gap-1",children:e.availableForSale?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.Heading,{size:2,className:"text-info-primary whitespace-nowrap",as:"h6",children:e.price}),$&&e.originalPrice&&(0,a.jsx)(t.Heading,{size:2,className:(0,s.cn)("text-info-tertiary whitespace-nowrap line-through",r?.originalPrice),as:"h6",children:e.originalPrice})]}):(0,a.jsx)(t.Heading,{size:2,className:"text-info-tertiary",children:f?.outOfStockLabel??"Sold Out"})})}),e?.priceLabel&&(0,a.jsx)(t.Text,{size:4,className:(0,s.cn)("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] text-[14px]",r?.productPriceLabel),children:e.priceLabel}),(0,a.jsxs)("div",{className:(0,s.cn)("lg-desktop:gap-3 tablet:flex-nowrap flex flex-wrap gap-2",r?.buttonGroup),children:[y&&(0,a.jsx)(t.Button,{variant:"secondary",size:"base",className:(0,s.cn)("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",r?.secondaryButton),onClick:()=>v(h,"secondary"),disabled:!e.availableForSale&&h!=="learnMore",loading:q,"data-headless-type-name":"CreditsShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${y}`,"data-headless-sku":e.sku,children:y}),x&&(0,a.jsx)(t.Button,{variant:"primary",size:"base",className:(0,s.cn)("tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center w-full whitespace-nowrap",r?.primaryButton),onClick:()=>v(C,"primary"),disabled:!e.availableForSale&&C!=="learnMore",loading:R,"data-headless-type-name":"CreditsShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${x}`,"data-headless-sku":e.sku,children:x})]})]})]})]}),(0,a.jsxs)("div",{className:(0,s.cn)("bg-container-secondary-0 lg-desktop:px-6 lg-desktop:py-4 flex items-center justify-center gap-1 px-4 py-3",r?.creditTip),children:[(0,a.jsx)("div",{className:"bg-info-primary flex size-6 items-center justify-center rounded-full p-1",children:(0,a.jsx)("span",{className:"text-info-white",children:(0,a.jsx)(Y,{})})}),(0,a.jsx)(t.Text,{size:2,className:"text-info-primary",children:G})]})]})});g.displayName="CreditsShelf.ProductCard";var ee=g;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var L=Object.create;var y=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var E=(t,l)=>{for(var s in l)y(t,s,{get:l[s],enumerable:!0})},w=(t,l,s,p)=>{if(l&&typeof l=="object"||typeof l=="function")for(let i of S(l))!A.call(t,i)&&i!==s&&y(t,i,{get:()=>l[i],enumerable:!(p=D(l,i))||p.enumerable});return t};var T=(t,l,s)=>(s=t!=null?L(z(t)):{},w(l||!t||!t.__esModule?y(s,"default",{value:t,enumerable:!0}):s,t)),P=t=>w(y({},"__esModule",{value:!0}),t);var R={};E(R,{default:()=>q});module.exports=P(R);var e=require("react/jsx-runtime"),m=require("react"),o=require("../../components/index.js"),M=T(require("../Subscribe/index.js")),k=require("./types.js"),x=require("./icons/index.js"),N=require("react-responsive"),d=require("../../helpers/utils.js"),b=require("../AiuiProvider/index.js"),F=require("../../shared/Styles.js");const $=({data:{footer:t}={},currentCountry:l,event:s,subscribeLoading:p,classNames:i,className:n,moduleIds:r,...u})=>{const[f,c]=(0,m.useState)(!1),g=(0,N.useMediaQuery)({query:"(max-width: 1439px)"});(0,m.useEffect)(()=>{c(g)},[g]);const h=(0,m.useMemo)(()=>t?.blocks?.find(a=>a?.blockType===k.FooterNavigationBlockType.Brand)?.country||{},[t]);return(0,e.jsx)("footer",{...u,className:(0,d.cn)(i?.root,n),children:(0,e.jsxs)(o.Container,{className:(0,d.cn)(i?.child),childClassName:(0,d.cn)("laptop:py-16 desktop:gap-16 flex flex-col gap-8 bg-black py-8"),children:[(0,e.jsx)(o.Text,{html:t?.story,className:"desktop:text-sm text-xs font-bold text-[#6D6D6F]"}),t?.blocks?.map(a=>{if(a?.blockType===k.FooterNavigationBlockType.Signup)return(0,e.jsx)(O,{subscribeLoading:p,data:a,onSubmit:s?.signup,id:r?.marketingConversion},a.id);if(a?.blockType===k.FooterNavigationBlockType.Brand)return(0,e.jsx)(Q,{data:a,isMobile:f,event:s,currentCountry:l,id:r?.footerBrand},a?.id);if(a?.blockType===k.FooterNavigationBlockType.Main)return(0,e.jsx)(j,{data:{...a,country:h},event:s,isMobile:f,currentCountry:l,id:r?.mainServices},a.id)})]})})},O=({data:t,onSubmit:l,subscribeLoading:s,id:p="footer-marketing-conversion"})=>{const{locale:i="us"}=(0,b.useAiuiContext)();return(0,e.jsxs)("div",{id:p,className:"desktop:py-16 desktop:gap-16 laptop:px-8 desktop:flex-row rounded-btn flex flex-col gap-8 bg-[#1E2024] px-4 py-8",children:[(0,e.jsx)(M.default,{subscribeMetadata:t?.signup,className:"desktop:flex-[744]",onSubmit:l,loading:s}),(0,e.jsx)("div",{className:"desktop:hidden h-px w-full bg-[#3D3E3F]"}),(0,e.jsxs)("div",{className:"desktop:gap-6 laptop:flex-row desktop:flex-[792] flex flex-col gap-4",children:[(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)(o.Text,{html:t?.enjoy?.title,className:" text-xl font-bold leading-[1.2] text-white"}),(0,e.jsx)("div",{className:"mt-4 flex flex-col gap-2",children:t?.enjoy?.enjoys?.map(n=>(0,e.jsxs)("div",{className:"flex-start flex gap-2",children:[(0,e.jsx)("img",{src:n?.icon?.url,loading:"lazy",alt:n?.icon?.alt||"",className:"size-5 shrink-0"}),(0,e.jsx)(o.Text,{html:n?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA]"})]},n?.id))})]}),(0,e.jsx)("div",{className:"desktop:block hidden w-px bg-[#3D3E3F]"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)(o.Text,{html:t?.benefit?.title,className:"text-xl font-bold leading-[1.2] text-white"}),(0,e.jsx)("div",{className:"mt-4 flex flex-col gap-2",children:t?.benefit?.benefits?.map(n=>(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(n?.link,i,"ref=footer"),asChild:!n?.link,className:"no-underline",children:(0,e.jsx)(o.Text,{html:n?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] hover:text-white"})},n?.id))})]})]})]})},j=({data:t,event:l,isMobile:s,currentCountry:p,id:i="footer-main-services"})=>{const{locale:n="us"}=(0,b.useAiuiContext)(),[r,u]=(0,m.useState)(!1),{services:f,mainNav:c,country:g}=t,h="contact-section";return(0,e.jsxs)("nav",{id:i,className:"flex flex-col gap-8","aria-label":"Main navigation",children:[(0,e.jsxs)("div",{className:(0,d.cn)({"desktop:gap-16 flex":f?.download?.title}),children:[(0,e.jsxs)("div",{className:(0,d.cn)("w-full",{"desktop:flex-[1260]":f?.download?.title}),children:[(0,e.jsx)(o.Text,{html:f?.storeBenefits?.title,className:" text-xl font-bold leading-[1.2] text-white"}),(0,e.jsx)("div",{className:(0,d.cn)("laptop:flex-row desktop:gap-4 laptop:flex-wrap mt-4 flex flex-col gap-2",{"desktop:max-w-[648px]":f?.download?.title}),children:f?.storeBenefits?.reasons?.map(a=>(0,e.jsxs)("div",{className:"desktop:min-w-[288px] flex flex-1 shrink-0 items-center gap-2",children:[(0,e.jsx)("img",{src:a?.icon?.url,loading:"lazy",alt:a?.icon?.alt||"",className:"size-5 shrink-0"}),(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(a?.link,n,"ref=footer"),asChild:!a?.link,className:"no-underline",children:(0,e.jsx)(o.Text,{html:a?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA]"})})]},a?.id))})]}),(0,e.jsx)(B,{className:(0,d.cn)({"desktop:flex-[404] hidden desktop:block":f?.download?.title}),title:f?.download?.title,apps:f?.download?.apps})]}),(0,e.jsx)("div",{className:"desktop:block hidden h-px bg-[#3D3E3F]","aria-hidden":"true"}),(0,e.jsxs)("div",{className:"desktop:grid grid-cols-4 gap-4",children:[(0,e.jsx)(v,{title:c?.products?.title,lists:c?.products?.products}),(0,e.jsx)(v,{title:c?.explore?.title,lists:c?.explore?.explores}),(0,e.jsx)(v,{title:c?.support?.title,lists:c?.support?.supports}),(0,e.jsxs)("div",{className:"desktop:py-0 desktop:border-none border-t border-[#3D3E3F] pt-4",children:[(0,e.jsxs)("div",{className:"desktop:pb-0 flex items-center justify-between pb-4",children:[(0,e.jsx)(o.Text,{as:"p",html:c?.contact?.title,className:"text-xl font-bold leading-[1.2] text-white",id:h}),s&&(0,e.jsx)("button",{onClick:()=>u(!r),"aria-expanded":r,"aria-controls":h,"aria-label":r?"Collapse contact section":"Expand contact section",children:r?(0,e.jsx)(x.SubtractIcon,{width:20,height:20}):(0,e.jsx)(x.AddIcon,{width:20,height:20})})]}),(r&&s||!s)&&(0,e.jsx)("div",{className:"desktop:mt-4 desktop:mb-0 mb-4 flex flex-col gap-2",role:"region","aria-labelledby":h,children:c?.contact?.contacts?.map(a=>(0,e.jsxs)(o.Link,{href:a?.link,className:"group flex items-start gap-2 no-underline",children:[(0,e.jsx)("img",{src:a?.icon?.url,loading:"lazy",alt:a?.icon?.alt,className:"size-5 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"}),(0,e.jsx)(o.Text,{html:a?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] transition-colors duration-200 group-hover:text-white"})]},a?.id))}),(0,e.jsx)(C,{country:p||g,className:"desktop:hidden border-b border-[#3D3E3F]",isMobile:s,onChangeCountry:l?.country}),(0,e.jsx)("div",{className:"desktop:hidden mt-8",children:(0,e.jsx)(B,{title:f?.download?.title,apps:f?.download?.apps})}),!!c?.socials?.length&&(0,e.jsx)("div",{className:"mt-8 flex items-center gap-2",role:"list","aria-label":"Social media links",children:c?.socials?.map(a=>(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(a?.link,n,"ref=footer"),className:"group",role:"listitem","aria-label":a?.icon?.alt||"Social media",children:(0,e.jsx)("img",{src:a?.icon?.url,loading:"lazy",alt:a?.icon?.alt,className:"size-8 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"})},a?.id))}),(0,e.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",role:"list","aria-label":"Payment methods",children:c?.payment?.map(a=>(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(a?.link,n),asChild:!a?.link,role:"listitem","aria-label":a?.icon?.alt||"Payment method",children:(0,e.jsx)("img",{src:a?.icon?.url,loading:"lazy",alt:a?.icon?.alt||"",className:"h-[28px] w-[44px] shrink-0"})},a?.id))})]})]})]})},Q=({data:t,isMobile:l,event:s,currentCountry:p,id:i="footer-brand"})=>{const{locale:n="us"}=(0,b.useAiuiContext)();return(0,e.jsxs)("div",{id:i,className:"flex flex-col gap-4",children:[(0,e.jsxs)("div",{className:"desktop:items-center desktop:flex desktop:gap-4",children:[(0,e.jsx)("div",{className:"laptop:flex-row aiui-dark laptop:items-center desktop:flex-[980] flex flex-col items-start gap-3",children:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,e.jsx)(o.Link,{variant:"secondary",href:(0,d.getLocalizedPath)(t?.brand?.link,n,"ref=footer"),asChild:!t?.brand?.link,children:(0,e.jsx)(o.Text,{html:t?.brand?.currentBrand,"aria-hidden":"true"})}),!!t?.brand?.brands?.length&&t?.brand?.brands?.map((r,u)=>(0,e.jsxs)(m.Fragment,{children:[u<=0&&(0,e.jsx)("span",{className:"bg-lines h-3 w-px","aria-hidden":"true"}),(0,e.jsx)(o.Link,{variant:"secondary",href:(0,d.getLocalizedPath)(r?.link,n,"ref=footer"),className:"text-base leading-normal no-underline",children:(0,e.jsx)(o.Text,{html:r?.icon,"aria-hidden":"true"})},r?.id)]},u))]})}),(0,e.jsx)(C,{country:p||t?.country,className:"desktop:flex-[316] desktop:block hidden",isMobile:l,onChangeCountry:s?.country})]}),(0,e.jsx)("div",{className:"h-px bg-[#3D3E3F]"}),(0,e.jsxs)("div",{className:"laptop:flex-row desktop:gap-4 desktop:items-center flex flex-col items-start gap-1",children:[(0,e.jsx)(o.Text,{html:t?.copyright?.label,className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[t?.policy?.policies?.map(r=>(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(r?.link,n,"ref=footer"),className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#B6B6BA] no-underline hover:text-white",children:r?.label},r?.id)),t?.policy?.cookies&&(0,e.jsx)("button",{"data-cc":"show-preferencesModal",onClick:s?.cookiesSet,className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#B6B6BA] no-underline hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black","aria-label":`Cookie preferences: ${t?.policy?.cookies}`,children:t?.policy?.cookies})]})]})]})},v=({title:t,lists:l,className:s})=>{const{locale:p="us"}=(0,b.useAiuiContext)(),[i,n]=(0,m.useState)(!1),[r,u]=(0,m.useState)(!1),f=(0,N.useMediaQuery)({query:"(max-width: 1439px)"});(0,m.useEffect)(()=>{u(f)},[f]);const c=`nav-section-${t?.replace(/\s+/g,"-").toLowerCase()}`;return(0,e.jsxs)("div",{className:(0,d.cn)("desktop:py-0 desktop:border-none border-t border-[#3D3E3F] py-4",s),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(o.Text,{as:"p",html:t,className:"text-xl font-bold leading-[1.2] text-white",id:c}),r&&(0,e.jsx)("button",{onClick:()=>n(!i),"aria-expanded":i,"aria-controls":c,"aria-label":i?`Collapse ${t}`:`Expand ${t}`,className:"focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black",children:i?(0,e.jsx)(x.SubtractIcon,{width:20,height:20}):(0,e.jsx)(x.AddIcon,{width:20,height:20})})]}),(i&&r||!r)&&(0,e.jsx)("nav",{className:"mt-4 flex flex-col gap-2",role:"region","aria-labelledby":c,children:l?.map(g=>(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(g?.link,p,"ref=footer"),className:"no-underline",children:(0,e.jsx)(o.Text,{html:g?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] hover:text-white"})},g?.id))})]})},B=({title:t,apps:l,className:s})=>{const{locale:p="us"}=(0,b.useAiuiContext)();return l?.length?(0,e.jsxs)("div",{className:s,children:[(0,e.jsx)(o.Text,{html:t,className:" text-xl font-bold leading-[1.2] text-white"}),(0,e.jsx)("div",{className:"mt-4 flex items-center gap-4",role:"list","aria-label":"Download apps",children:l?.map(i=>(0,e.jsxs)(o.Link,{href:(0,d.getLocalizedPath)(i?.link,p),className:"group flex flex-col items-center gap-[6px]",role:"listitem","aria-label":i?.icon?.alt||i?.label||"Download app",children:[(0,e.jsx)("img",{src:i?.icon?.url,loading:"lazy",alt:i?.icon?.alt,className:"size-10 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"}),i?.label&&(0,e.jsx)(o.Text,{html:i?.label,className:"text-xs font-bold text-[#999999] transition-colors duration-200 group-hover:text-white"})]},i?.id))})]}):null},C=({country:t,isMobile:l,className:s,onChangeCountry:p})=>(0,e.jsx)("div",{className:(0,d.cn)("desktop:py-0 desktop:border-none border-t border-[#3D3E3F] py-4",s),children:(0,e.jsxs)("button",{onClick:()=>p?.(),className:"flex w-full items-center justify-between focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black","aria-label":`Change country/region, current: ${t?.countryName||t?.country}`,children:[(0,e.jsxs)("div",{className:"group flex items-center gap-2",children:[(0,e.jsx)(x.CountryIcon,{width:20,height:20,className:"shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100","aria-hidden":"true"}),(0,e.jsx)(o.Text,{as:"span",html:t?.countryName||t?.country,className:"desktop:text-[#B6B6BA] desktop:group-hover:text-white text-base font-bold leading-[1.4] text-white transition-colors duration-200"})]}),l&&(0,e.jsx)(x.ArrowRightIcon,{width:20,height:20,"aria-hidden":"true"})]})});var q=(0,F.withLayout)($);
|
|
1
|
+
"use strict";var L=Object.create;var y=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var E=(t,l)=>{for(var s in l)y(t,s,{get:l[s],enumerable:!0})},w=(t,l,s,p)=>{if(l&&typeof l=="object"||typeof l=="function")for(let i of S(l))!A.call(t,i)&&i!==s&&y(t,i,{get:()=>l[i],enumerable:!(p=D(l,i))||p.enumerable});return t};var T=(t,l,s)=>(s=t!=null?L(z(t)):{},w(l||!t||!t.__esModule?y(s,"default",{value:t,enumerable:!0}):s,t)),P=t=>w(y({},"__esModule",{value:!0}),t);var R={};E(R,{default:()=>q});module.exports=P(R);var e=require("react/jsx-runtime"),m=require("react"),o=require("../../components/index.js"),M=T(require("../Subscribe/index.js")),k=require("./types.js"),x=require("./icons/index.js"),N=require("react-responsive"),d=require("../../helpers/utils.js"),b=require("../AiuiProvider/index.js"),F=require("../../shared/Styles.js");const $=({data:{footer:t}={},currentCountry:l,event:s,subscribeLoading:p,classNames:i,className:n,moduleIds:r,...u})=>{const[f,c]=(0,m.useState)(!1),g=(0,N.useMediaQuery)({query:"(max-width: 1439px)"});(0,m.useEffect)(()=>{c(g)},[g]);const h=(0,m.useMemo)(()=>t?.blocks?.find(a=>a?.blockType===k.FooterNavigationBlockType.Brand)?.country||{},[t]);return(0,e.jsx)("footer",{...u,className:(0,d.cn)(i?.root,n),children:(0,e.jsxs)(o.Container,{className:(0,d.cn)(i?.child),childClassName:(0,d.cn)("laptop:py-16 desktop:gap-16 flex flex-col gap-8 bg-black py-8"),children:[(0,e.jsx)(o.Text,{html:t?.story,className:"desktop:text-sm text-xs font-bold text-[#6D6D6F]"}),t?.blocks?.map(a=>{if(a?.blockType===k.FooterNavigationBlockType.Signup)return(0,e.jsx)(O,{subscribeLoading:p,data:a,onSubmit:s?.signup,id:r?.marketingConversion},a.id);if(a?.blockType===k.FooterNavigationBlockType.Brand)return(0,e.jsx)(Q,{data:a,isMobile:f,event:s,currentCountry:l,id:r?.footerBrand},a?.id);if(a?.blockType===k.FooterNavigationBlockType.Main)return(0,e.jsx)(j,{data:{...a,country:h},event:s,isMobile:f,currentCountry:l,id:r?.mainServices},a.id)})]})})},O=({data:t,onSubmit:l,subscribeLoading:s,id:p="footer-marketing-conversion"})=>{const{locale:i="us"}=(0,b.useAiuiContext)();return(0,e.jsxs)("div",{id:p,className:"desktop:py-16 desktop:gap-16 laptop:px-8 desktop:flex-row rounded-btn flex flex-col gap-8 bg-[#1E2024] px-4 py-8",children:[(0,e.jsx)(M.default,{subscribeMetadata:t?.signup,className:"desktop:flex-[744]",onSubmit:l,loading:s}),(0,e.jsx)("div",{className:"desktop:hidden h-px w-full bg-[#3D3E3F]"}),(0,e.jsxs)("div",{className:"desktop:gap-6 laptop:flex-row desktop:flex-[792] flex flex-col gap-4",children:[(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)(o.Text,{html:t?.enjoy?.title,className:" text-xl font-bold leading-[1.2] text-white"}),(0,e.jsx)("div",{className:"mt-4 flex flex-col gap-2",children:t?.enjoy?.enjoys?.map(n=>(0,e.jsxs)("div",{className:"flex-start flex gap-2",children:[(0,e.jsx)("img",{src:n?.icon?.url,loading:"lazy",alt:n?.icon?.alt||"",className:"size-5 shrink-0"}),(0,e.jsx)(o.Text,{html:n?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA]"})]},n?.id))})]}),(0,e.jsx)("div",{className:"desktop:block hidden w-px bg-[#3D3E3F]"}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)(o.Text,{html:t?.benefit?.title,className:"text-xl font-bold leading-[1.2] text-white"}),(0,e.jsx)("div",{className:"mt-4 flex flex-col gap-2",children:t?.benefit?.benefits?.map(n=>(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(n?.link,i,"ref=footer"),asChild:!n?.link,className:"no-underline",children:(0,e.jsx)(o.Text,{html:n?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] hover:text-white"})},n?.id))})]})]})]})},j=({data:t,event:l,isMobile:s,currentCountry:p,id:i="footer-main-services"})=>{const{locale:n="us"}=(0,b.useAiuiContext)(),[r,u]=(0,m.useState)(!1),{services:f,mainNav:c,country:g}=t,h="contact-section";return(0,e.jsxs)("nav",{id:i,className:"flex flex-col gap-8","aria-label":"Main navigation",children:[(0,e.jsxs)("div",{className:(0,d.cn)({"desktop:gap-16 flex":f?.download?.title}),children:[(0,e.jsxs)("div",{className:(0,d.cn)("w-full",{"desktop:flex-[1260]":f?.download?.title}),children:[(0,e.jsx)(o.Text,{html:f?.storeBenefits?.title,className:" text-xl font-bold leading-[1.2] text-white"}),(0,e.jsx)("div",{className:(0,d.cn)("laptop:flex-row desktop:gap-4 laptop:flex-wrap mt-4 flex flex-col gap-2",{"desktop:max-w-[648px]":f?.download?.title}),children:f?.storeBenefits?.reasons?.map(a=>(0,e.jsxs)("div",{className:"desktop:min-w-[288px] flex flex-1 shrink-0 items-center gap-2",children:[(0,e.jsx)("img",{src:a?.icon?.url,loading:"lazy",alt:a?.icon?.alt||"",className:"size-5 shrink-0"}),(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(a?.link,n,"ref=footer"),asChild:!a?.link,className:"no-underline",children:(0,e.jsx)(o.Text,{html:a?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA]"})})]},a?.id))})]}),(0,e.jsx)(B,{className:(0,d.cn)({"desktop:flex-[404] hidden desktop:block":f?.download?.title}),title:f?.download?.title,apps:f?.download?.apps})]}),(0,e.jsx)("div",{className:"desktop:block hidden h-px bg-[#3D3E3F]","aria-hidden":"true"}),(0,e.jsxs)("div",{className:"desktop:grid grid-cols-4 gap-4",children:[(0,e.jsx)(v,{title:c?.products?.title,lists:c?.products?.products}),(0,e.jsx)(v,{title:c?.explore?.title,lists:c?.explore?.explores}),(0,e.jsx)(v,{title:c?.support?.title,lists:c?.support?.supports}),(0,e.jsxs)("div",{className:"desktop:py-0 desktop:border-none border-t border-[#3D3E3F] pt-4",children:[(0,e.jsxs)("div",{className:"desktop:pb-0 flex items-center justify-between pb-4",children:[(0,e.jsx)(o.Text,{as:"p",html:c?.contact?.title,className:"text-xl font-bold leading-[1.2] text-white",id:h}),s&&(0,e.jsx)("button",{onClick:()=>u(!r),"aria-expanded":r,"aria-controls":h,"aria-label":r?"Collapse contact section":"Expand contact section",children:r?(0,e.jsx)(x.SubtractIcon,{width:20,height:20}):(0,e.jsx)(x.AddIcon,{width:20,height:20})})]}),(r&&s||!s)&&(0,e.jsx)("div",{className:"desktop:mt-4 desktop:mb-0 mb-4 flex flex-col gap-2",role:"region","aria-labelledby":h,children:c?.contact?.contacts?.map(a=>(0,e.jsxs)(o.Link,{href:a?.link,className:"group flex items-start gap-2 no-underline",children:[(0,e.jsx)("img",{src:a?.icon?.url,loading:"lazy",alt:a?.icon?.alt,className:"size-5 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"}),(0,e.jsx)(o.Text,{html:a?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] transition-colors duration-200 group-hover:text-white"})]},a?.id))}),(0,e.jsx)(C,{country:p||g,className:"desktop:hidden border-b border-[#3D3E3F]",isMobile:s,onChangeCountry:l?.country}),(0,e.jsx)("div",{className:"desktop:hidden mt-8",children:(0,e.jsx)(B,{title:f?.download?.title,apps:f?.download?.apps})}),!!c?.socials?.length&&(0,e.jsx)("div",{className:"mt-8 flex items-center gap-2",role:"list","aria-label":"Social media links",children:c?.socials?.map(a=>(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(a?.link,n,"ref=footer"),className:"group",role:"listitem","aria-label":a?.icon?.alt||"Social media",children:(0,e.jsx)("img",{src:a?.icon?.url,loading:"lazy",alt:a?.icon?.alt,className:"size-8 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"})},a?.id))}),(0,e.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",role:"list","aria-label":"Payment methods",children:c?.payment?.map(a=>(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(a?.link,n,"ref=footer"),asChild:!a?.link,role:"listitem","aria-label":a?.icon?.alt||"Payment method",children:(0,e.jsx)("img",{src:a?.icon?.url,loading:"lazy",alt:a?.icon?.alt||"",className:"h-[28px] w-[44px] shrink-0"})},a?.id))})]})]})]})},Q=({data:t,isMobile:l,event:s,currentCountry:p,id:i="footer-brand"})=>{const{locale:n="us"}=(0,b.useAiuiContext)();return(0,e.jsxs)("div",{id:i,className:"flex flex-col gap-4",children:[(0,e.jsxs)("div",{className:"desktop:items-center desktop:flex desktop:gap-4",children:[(0,e.jsx)("div",{className:"laptop:flex-row aiui-dark laptop:items-center desktop:flex-[980] flex flex-col items-start gap-3",children:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,e.jsx)(o.Link,{variant:"secondary",href:(0,d.getLocalizedPath)(t?.brand?.link,n,"ref=footer"),asChild:!t?.brand?.link,children:(0,e.jsx)(o.Text,{html:t?.brand?.currentBrand,"aria-hidden":"true"})}),!!t?.brand?.brands?.length&&t?.brand?.brands?.map((r,u)=>(0,e.jsxs)(m.Fragment,{children:[u<=0&&(0,e.jsx)("span",{className:"bg-lines h-3 w-px","aria-hidden":"true"}),(0,e.jsx)(o.Link,{variant:"secondary",href:(0,d.getLocalizedPath)(r?.link,n,"ref=footer"),className:"text-base leading-normal no-underline",children:(0,e.jsx)(o.Text,{html:r?.icon,"aria-hidden":"true"})},r?.id)]},u))]})}),(0,e.jsx)(C,{country:p||t?.country,className:"desktop:flex-[316] desktop:block hidden",isMobile:l,onChangeCountry:s?.country})]}),(0,e.jsx)("div",{className:"h-px bg-[#3D3E3F]"}),(0,e.jsxs)("div",{className:"laptop:flex-row desktop:gap-4 desktop:items-center flex flex-col items-start gap-1",children:[(0,e.jsx)(o.Text,{html:t?.copyright?.label,className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#6D6D6F]"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[t?.policy?.policies?.map(r=>(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(r?.link,n,"ref=footer"),className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#B6B6BA] no-underline hover:text-white",children:r?.label},r?.id)),t?.policy?.cookies&&(0,e.jsx)("button",{"data-cc":"show-preferencesModal",onClick:s?.cookiesSet,className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#B6B6BA] no-underline hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black","aria-label":`Cookie preferences: ${t?.policy?.cookies}`,children:t?.policy?.cookies})]})]})]})},v=({title:t,lists:l,className:s})=>{const{locale:p="us"}=(0,b.useAiuiContext)(),[i,n]=(0,m.useState)(!1),[r,u]=(0,m.useState)(!1),f=(0,N.useMediaQuery)({query:"(max-width: 1439px)"});(0,m.useEffect)(()=>{u(f)},[f]);const c=`nav-section-${t?.replace(/\s+/g,"-").toLowerCase()}`;return(0,e.jsxs)("div",{className:(0,d.cn)("desktop:py-0 desktop:border-none border-t border-[#3D3E3F] py-4",s),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(o.Text,{as:"p",html:t,className:"text-xl font-bold leading-[1.2] text-white",id:c}),r&&(0,e.jsx)("button",{onClick:()=>n(!i),"aria-expanded":i,"aria-controls":c,"aria-label":i?`Collapse ${t}`:`Expand ${t}`,className:"focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black",children:i?(0,e.jsx)(x.SubtractIcon,{width:20,height:20}):(0,e.jsx)(x.AddIcon,{width:20,height:20})})]}),(i&&r||!r)&&(0,e.jsx)("nav",{className:"mt-4 flex flex-col gap-2",role:"region","aria-labelledby":c,children:l?.map(g=>(0,e.jsx)(o.Link,{href:(0,d.getLocalizedPath)(g?.link,p,"ref=footer"),className:"no-underline",children:(0,e.jsx)(o.Text,{html:g?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] hover:text-white"})},g?.id))})]})},B=({title:t,apps:l,className:s})=>{const{locale:p="us"}=(0,b.useAiuiContext)();return l?.length?(0,e.jsxs)("div",{className:s,children:[(0,e.jsx)(o.Text,{html:t,className:" text-xl font-bold leading-[1.2] text-white"}),(0,e.jsx)("div",{className:"mt-4 flex items-center gap-4",role:"list","aria-label":"Download apps",children:l?.map(i=>(0,e.jsxs)(o.Link,{href:(0,d.getLocalizedPath)(i?.link,p,"ref=footer"),className:"group flex flex-col items-center gap-[6px]",role:"listitem","aria-label":i?.icon?.alt||i?.label||"Download app",children:[(0,e.jsx)("img",{src:i?.icon?.url,loading:"lazy",alt:i?.icon?.alt,className:"size-10 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"}),i?.label&&(0,e.jsx)(o.Text,{html:i?.label,className:"text-xs font-bold text-[#999999] transition-colors duration-200 group-hover:text-white"})]},i?.id))})]}):null},C=({country:t,isMobile:l,className:s,onChangeCountry:p})=>(0,e.jsx)("div",{className:(0,d.cn)("desktop:py-0 desktop:border-none border-t border-[#3D3E3F] py-4",s),children:(0,e.jsxs)("button",{onClick:()=>p?.(),className:"flex w-full items-center justify-between focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black","aria-label":`Change country/region, current: ${t?.countryName||t?.country}`,children:[(0,e.jsxs)("div",{className:"group flex items-center gap-2",children:[(0,e.jsx)(x.CountryIcon,{width:20,height:20,className:"shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100","aria-hidden":"true"}),(0,e.jsx)(o.Text,{as:"span",html:t?.countryName||t?.country,className:"desktop:text-[#B6B6BA] desktop:group-hover:text-white text-base font-bold leading-[1.4] text-white transition-colors duration-200"})]}),l&&(0,e.jsx)(x.ArrowRightIcon,{width:20,height:20,"aria-hidden":"true"})]})});var q=(0,F.withLayout)($);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 移动端菜单项
|
|
3
3
|
*/
|
|
4
|
-
export declare const MenuItem: ({ label, href, onClick, active, icon, className, }: {
|
|
4
|
+
export declare const MenuItem: ({ label, href, target, onClick, active, icon, className, }: {
|
|
5
5
|
label: string;
|
|
6
6
|
href?: string;
|
|
7
|
+
target?: string;
|
|
7
8
|
onClick?: () => void;
|
|
8
9
|
active?: boolean;
|
|
9
10
|
icon?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var b=Object.defineProperty;var
|
|
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:()=>y,SubSubCategoryItemComp:()=>w});module.exports=N(C);var e=require("react/jsx-runtime"),$=require("react"),o=require("../../components/index.js"),s=require("../../helpers/utils.js"),p=require("./icons/index.js"),c=require("./SidebarDropdown.js"),u=require("../AiuiProvider/index.js");const k=({label:t,href:n,target:l,onClick:r,active:i,icon:a,className:d})=>{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: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",d),onClick:r,children:m}):(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",d),"aria-expanded":i,children:m})},w=({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)(p.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})},y=({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,"ref=navMenu"),children:(0,e.jsxs)("div",{className:"rounded-sidebar-shelf relative overflow-hidden [&_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)(c.SeriesProductItem,{position:a,product:i,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${l?.label||""}-${r}-${a}`))]})]},`seriesItem-${l?.label||""}-${r}`))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var C=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var _=(a,n)=>{for(var r in n)C(a,r,{get:n[r],enumerable:!0})},A=(a,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of B(n))!E.call(a,l)&&l!==r&&C(a,l,{get:()=>n[l],enumerable:!(i=z(n,l))||i.enumerable});return a};var I=a=>A(C({},"__esModule",{value:!0}),a);var F={};_(F,{MobileResourceSidebarMenu:()=>T});module.exports=I(F);var e=require("react/jsx-runtime"),s=require("react"),x=require("../../components/index.js"),m=require("./types.js"),k=require("./NavProvider.js"),b=require("./ResourceItem.js"),M=require("../AiuiProvider/index.js"),h=require("../../helpers/utils.js");const K=({label:a,onClick:n,active:r})=>(0,e.jsxs)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:n,"aria-expanded":r,children:[(0,e.jsx)("div",{className:"flex items-center gap-1",children:(0,e.jsx)("span",{className:"text-sm font-bold leading-[1.4]",children:a})}),(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:"M6.91009 4.41009C7.23553 4.08466 7.76304 4.08466 8.08848 4.41009L13.0885 9.41009C13.4139 9.73553 13.4139 10.263 13.0885 10.5885L8.08848 15.5885C7.76304 15.9139 7.23553 15.9139 6.91009 15.5885C6.58466 15.263 6.58466 14.7355 6.91009 14.4101L11.3209 9.99929L6.91009 5.58848C6.58466 5.26304 6.58466 4.73553 6.91009 4.41009Z",fill:"#080A0F"})})]}),T=({resourceCategoriesMetadata:a,resourcesMetadata:n})=>{const{currentMenu:r,setCurrentMenu:i,subSubCategory:l,setSubSubCategory:S,onSidebarNavClick:d,currentResourceMetadata:p,setCurrentResourceMetadata:f}=(0,k.useNavContext)(),{locale:y="us"}=(0,M.useAiuiContext)(),[w,L]=(0,s.useState)([]),[
|
|
1
|
+
"use strict";var C=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var _=(a,n)=>{for(var r in n)C(a,r,{get:n[r],enumerable:!0})},A=(a,n,r,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of B(n))!E.call(a,l)&&l!==r&&C(a,l,{get:()=>n[l],enumerable:!(i=z(n,l))||i.enumerable});return a};var I=a=>A(C({},"__esModule",{value:!0}),a);var F={};_(F,{MobileResourceSidebarMenu:()=>T});module.exports=I(F);var e=require("react/jsx-runtime"),s=require("react"),x=require("../../components/index.js"),m=require("./types.js"),k=require("./NavProvider.js"),b=require("./ResourceItem.js"),M=require("../AiuiProvider/index.js"),h=require("../../helpers/utils.js");const K=({label:a,onClick:n,active:r})=>(0,e.jsxs)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:n,"aria-expanded":r,children:[(0,e.jsx)("div",{className:"flex items-center gap-1",children:(0,e.jsx)("span",{className:"text-sm font-bold leading-[1.4]",children:a})}),(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:"M6.91009 4.41009C7.23553 4.08466 7.76304 4.08466 8.08848 4.41009L13.0885 9.41009C13.4139 9.73553 13.4139 10.263 13.0885 10.5885L8.08848 15.5885C7.76304 15.9139 7.23553 15.9139 6.91009 15.5885C6.58466 15.263 6.58466 14.7355 6.91009 14.4101L11.3209 9.99929L6.91009 5.58848C6.58466 5.26304 6.58466 4.73553 6.91009 4.41009Z",fill:"#080A0F"})})]}),T=({resourceCategoriesMetadata:a,resourcesMetadata:n})=>{const{currentMenu:r,setCurrentMenu:i,subSubCategory:l,setSubSubCategory:S,onSidebarNavClick:d,currentResourceMetadata:p,setCurrentResourceMetadata:f}=(0,k.useNavContext)(),{locale:y="us"}=(0,M.useAiuiContext)(),[w,L]=(0,s.useState)([]),[v,R]=(0,s.useState)([]);(0,s.useEffect)(()=>{a?.subcategories?.length&&L(a?.subcategories?.map((o,t)=>({index:t,open:!1})))},[a]),(0,s.useEffect)(()=>{l?.subSubCategories?.length&&R(l?.subSubCategories?.map((o,t)=>({index:t,open:t===0})))},[l]);const N=(0,s.useCallback)(o=>{S?.(o);const t=n?.find(c=>o?.label?.toLowerCase()===c.label?.toLowerCase())||{};i&&i(m.HeaderNavigationMenu.Third),f&&f(t)},[n,i,S,f]);return(0,s.useMemo)(()=>{switch(r){case m.HeaderNavigationMenu.Secondary:return(0,e.jsxs)("div",{className:"tablet:px-8 laptop:px-16 flex h-full flex-col gap-8 p-4",children:[(0,e.jsx)("div",{children:a?.subcategories?.map((o,t)=>(0,e.jsx)("div",{children:(0,e.jsx)(K,{label:o?.label,active:w.find(c=>c.index===t)?.open,onClick:()=>{N(o),d?.(o,t)}})},`${o.label}-${t}`))}),(0,e.jsxs)("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[a?.primary&&(0,e.jsx)(x.Button,{as:"a",href:(0,h.getLocalizedPath)(a?.primary?.url,y,`ref=${a?.primary?.label}_shopall`),variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:a?.primary?.label}),a?.secondary&&(0,e.jsx)(x.Button,{as:"a",href:(0,h.getLocalizedPath)(a?.secondary?.url,y,"ref=navMenu"),variant:"link",size:"lg",className:"link-btn tablet:w-auto tablet:px-0 w-full py-0 text-base",children:a?.secondary?.label})]})]});case m.HeaderNavigationMenu.Third:return(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:l?.subSubCategories?l?.subSubCategories?.map((o,t)=>{const c=n?.find(u=>u.label.toLowerCase()===o?.label?.toLowerCase())||{};return(0,e.jsxs)("div",{children:[Reflect.ownKeys(o).length>0&&(0,e.jsx)(b.ResourceSubSubCategoryItemComp,{matchResourcesMetadata:c,onSubSubCategoryItemClick:()=>{d?.(o,t),R(u=>u.map((g,$)=>({...g,open:$===t?!g.open:g.open})))},expanded:!!v?.find(u=>u.index===t)?.open}),v?.find(u=>u.index===t)?.open&&(0,e.jsx)(b.ResourceSubSubCategoryContentComp,{matchResourcesMetadata:c})]},`${o.label}-${t}`)}):(0,e.jsxs)(e.Fragment,{children:[Reflect.ownKeys(p).length>0&&(0,e.jsx)(b.ResourceSubSubCategoryItemComp,{matchResourcesMetadata:p}),(0,e.jsx)(b.ResourceSubSubCategoryContentComp,{matchResourcesMetadata:p})]})});default:return null}},[r,a,n,w,v,l,p,N,d,y])};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var D=(a,
|
|
1
|
+
"use strict";var w=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var D=(a,r)=>{for(var m in r)w(a,m,{get:r[m],enumerable:!0})},K=(a,r,m,d)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of R(r))!T.call(a,t)&&t!==m&&w(a,t,{get:()=>r[t],enumerable:!(d=E(r,t))||d.enumerable});return a};var P=a=>K(w({},"__esModule",{value:!0}),a);var F={};D(F,{MobileSidebarMenu:()=>A});module.exports=P(F);var e=require("react/jsx-runtime"),i=require("react"),c=require("../../components/index.js"),S=require("./types.js"),$=require("./NavProvider.js"),b=require("./MobileMenuComponents.js"),z=require("../AiuiProvider/index.js"),f=require("../../helpers/utils.js");const A=({sidebarCategoriesMetadata:a,seriesMetadata:r})=>{const{currentMenu:m,setCurrentMenu:d,subSubCategory:t,setSubSubCategory:N,setCurrentSeriesMetadata:g,currentSeriesMetadata:p,buildProps:v,onSidebarNavClick:h}=(0,$.useNavContext)(),{locale:y="us"}=(0,z.useAiuiContext)(),[k,B]=(0,i.useState)([]),[x,L]=(0,i.useState)([]);(0,i.useEffect)(()=>{a?.subcategories?.length&&B(a?.subcategories?.map((l,n)=>({index:n,open:!1})))},[a]),(0,i.useEffect)(()=>{t?.subSubCategories?.length&&L(t?.subSubCategories?.map((l,n)=>({index:n,open:n===0})))},[t]);const M=(0,i.useCallback)((l,n)=>{d&&d(S.HeaderNavigationMenu.Third),N?.(l);const s=r?.find(o=>n!==void 0?l?.subSubCategories?.[n]?.label?.toLowerCase()===o.label?.toLowerCase():l?.label?.toLowerCase()===o.label?.toLowerCase())||{};if(l?.collections){const o=v?.categories?.[l?.collections]||{};g?.({label:s?.label,isCollection:!0,banner:s?.banner,primary:s?.primary,series:[{products:o?.products}]})}else g?.(s)},[r,d,N,g,v?.categories]);return(0,i.useMemo)(()=>{switch(m){case S.HeaderNavigationMenu.Secondary:return(0,e.jsxs)("div",{className:"tablet:px-8 laptop:px-16 flex h-full flex-col gap-8 p-4",children:[(0,e.jsxs)("div",{children:[a?.subcategories?.map((l,n)=>(0,e.jsx)("div",{children:(0,e.jsx)(b.MenuItem,{label:l?.label,active:k.find(s=>s.index===n)?.open,onClick:()=>{M(l),h?.(l,n)}})},`${l.label}-${n}`)),a?.guide?.label&&(0,e.jsx)(c.Link,{href:(0,f.getLocalizedPath)(a?.guide?.url,y,"ref=navMenu"),children:(0,e.jsx)("div",{className:"mt-4",children:(0,e.jsx)(c.Text,{html:a?.guide?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]}),(0,e.jsxs)("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[a?.primary&&(0,e.jsx)(c.Button,{as:"a",href:(0,f.getLocalizedPath)(a?.primary?.url,y,`ref=${a?.primary?.label}_shopall`),variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:a?.primary?.label}),a?.secondary&&(0,e.jsx)(c.Button,{as:"a",href:(0,f.getLocalizedPath)(a?.secondary?.url,y,"ref=navMenu"),variant:"link",size:"lg",className:"link-btn tablet:w-auto tablet:px-0 w-full py-0 text-base",children:a?.secondary?.label})]})]});case S.HeaderNavigationMenu.Third:return(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.subSubCategories?t?.subSubCategories?.map((l,n)=>{const s=r?.find(u=>u.label.toLowerCase()===l?.label?.toLowerCase())||{};let o={};if(l?.collections){const u=v?.categories?.[l?.collections]||{};o={label:s?.label,isCollection:!0,banner:s?.banner,primary:s?.primary,series:[{products:u?.products}]}}else o=s;return(0,e.jsxs)("div",{children:[Reflect.ownKeys(l).length>0&&(0,e.jsx)(b.SubSubCategoryItemComp,{matchSeriesMetadata:o,onSubSubCategoryItemClick:()=>{h?.(l,n),L(u=>u.map((C,_)=>({...C,open:_===n?!C.open:C.open})))},expanded:!!x?.find(u=>u.index===n)?.open}),x?.find(u=>u.index===n)?.open&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b.SubSubCategoryContentComp,{matchSeriesMetadata:o}),o?.primary&&(0,e.jsx)("div",{className:"my-4 text-center",children:(0,e.jsx)(c.Button,{as:"a",href:(0,f.getLocalizedPath)(o?.primary?.url,y,"ref=navMenu"),className:"text-base leading-[1.2] no-underline",variant:"secondary",size:"base",children:o?.primary?.label})})]})]},`${l.label}-${n}`)}):(0,e.jsxs)(e.Fragment,{children:[Reflect.ownKeys(p).length>0&&(0,e.jsx)(b.SubSubCategoryItemComp,{matchSeriesMetadata:p}),(0,e.jsx)(b.SubSubCategoryContentComp,{matchSeriesMetadata:p}),p?.primary&&(0,e.jsx)("div",{className:"my-4 text-center ",children:(0,e.jsx)(c.Button,{as:"a",href:(0,f.getLocalizedPath)(p?.primary?.url,y,`ref=${p?.label}_viewmore`),variant:"secondary",size:"base",className:"text-base leading-[1.2] no-underline",children:p?.primary?.label})})]})});default:return null}},[m,a,r,k,x,t,p,v?.categories,M,h,y])};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var
|
|
1
|
+
"use strict";var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var d=(o,e)=>{for(var a in e)l(o,a,{get:e[a],enumerable:!0})},s=(o,e,a,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of c(e))!f.call(o,t)&&t!==a&&l(o,t,{get:()=>e[t],enumerable:!(i=u(e,t))||i.enumerable});return o};var M=o=>s(l({},"__esModule",{value:!0}),o);var v={};d(v,{MobileSupportMenu:()=>b});module.exports=M(v);var r=require("react/jsx-runtime"),y=require("react"),p=require("./MobileMenuComponents.js"),n=require("../AiuiProvider/index.js"),m=require("../../helpers/utils.js");const b=({supportsMetadata:o})=>{const{locale:e="us"}=(0,n.useAiuiContext)();return(0,r.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:o?.map(a=>(0,r.jsx)(p.MenuItem,{href:(0,m.getLocalizedPath)(a.url,e,"ref=navMenu"),label:a.label,onClick:()=>{}},a.id))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var b=Object.create;var d=Object.defineProperty;var
|
|
1
|
+
"use strict";var b=Object.create;var d=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var k=(e,l)=>{for(var o in l)d(e,o,{get:l[o],enumerable:!0})},m=(e,l,o,r)=>{if(l&&typeof l=="object"||typeof l=="function")for(let s of v(l))!N.call(e,s)&&s!==o&&d(e,s,{get:()=>l[s],enumerable:!(r=h(l,s))||r.enumerable});return e};var w=(e,l,o)=>(o=e!=null?b(g(e)):{},m(l||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e)),y=e=>m(d({},"__esModule",{value:!0}),e);var z={};k(z,{MulticolDropdown:()=>C,MulticolItem:()=>f});module.exports=y(z);var a=require("react/jsx-runtime"),p=require("react"),t=require("../../components/index.js"),c=w(require("./CompanyStatsBanner/index.js")),n=require("../../helpers/utils.js"),x=require("../AiuiProvider/index.js"),u=require("./NavProvider.js");const C=({multicolMetadata:e,showStatsBanner:l,statsBannerData:o})=>{const r=(0,p.useRef)(null);return(0,a.jsx)("div",{ref:r,className:"bg-white py-4",children:(0,a.jsx)(t.Container,{childClassName:"bg-white",className:"h-full",children:(0,a.jsxs)("div",{className:"laptop:gap-4 flex flex-col gap-3",children:[l&&(0,a.jsx)(c.default,{data:o}),(0,a.jsx)("div",{className:"flex gap-4",children:e?.map((s,i)=>(0,a.jsx)("div",{className:"w-1/4",children:(0,a.jsx)(f,{item:s})},`multicolItem-${s?.label}-${i}`))})]})})})},f=({item:e,allPicture:l})=>{const{locale:o="us"}=(0,x.useAiuiContext)(),{componentOverrides:r}=(0,u.useNavContext)(),s=r?.badge?.variant;return(0,a.jsxs)(a.Fragment,{children:[e?.columns&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.Text,{html:e.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),(0,a.jsx)("div",{className:"mt-2 flex flex-col",children:e.columns?.map(i=>(0,a.jsxs)("div",{className:"flex items-center gap-1 py-2",children:[(0,a.jsx)(t.Link,{href:(0,n.getLocalizedPath)(i.url,o,"ref=navMenu"),asChild:!i.url,className:"text-sm font-bold leading-[1.4] no-underline",children:i.label}),i?.badge&&(0,a.jsx)(t.Badge,{size:"xs",variant:s,children:i?.badge||"badge"})]},i.label))})]}),e?.imageUrl&&(0,a.jsx)("div",{className:(0,n.cn)("rounded-image-text laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-[346px] laptop:max-w-[440px] desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",{"tablet:max-w-none laptop:max-w-none":l}),children:(0,a.jsx)(t.Link,{href:(0,n.getLocalizedPath)(e.url,o,"ref=navMenu"),asChild:!e.url,children:(0,a.jsxs)("div",{className:"size-full",children:[(0,a.jsx)(t.Picture,{source:e.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),(0,a.jsxs)("div",{className:(0,n.cn)("absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",{"aiui-dark":e?.theme==="light"}),children:[(0,a.jsx)(t.Text,{html:e.title,className:(0,n.cn)("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":e?.theme==="dark"})}),e.subtitle&&(0,a.jsx)(t.Text,{html:e.subtitle,className:(0,n.cn)("text-sm font-bold leading-[1.4] text-white",{"text-black":e?.theme==="dark"})}),e?.primary?.label&&(0,a.jsx)(t.Button,{as:"a",href:(0,n.getLocalizedPath)(e?.primary?.url,o,"ref=navMenu"),variant:"link",size:"lg",iconClassName:"size-4 lg-desktop:size-5",className:(0,n.cn)("link-btn mr-auto !p-0 text-sm font-bold leading-[1.4] text-white",{"text-black":e?.theme==="dark"}),children:e?.primary?.label||"more"})]})]})})})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var x=(t,a)=>{for(var l in a)d(t,l,{get:a[l],enumerable:!0})},v=(t,a,l,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of h(a))!c.call(t,n)&&n!==l&&d(t,n,{get:()=>a[n],enumerable:!(o=m(a,n))||o.enumerable});return t};var p=t=>v(d({},"__esModule",{value:!0}),t);var g={};x(g,{ResourceItem:()=>f,ResourceSubSubCategoryContentComp:()=>u,ResourceSubSubCategoryItemComp:()=>b});module.exports=p(g);var e=require("react/jsx-runtime"),i=require("../../components/index.js"),s=require("../../helpers/utils.js"),r=require("../AiuiProvider/index.js");const f=({resource:t})=>{const{locale:a="us"}=(0,r.useAiuiContext)();return(0,e.jsx)("div",{className:"laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-none desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",children:(0,e.jsx)(i.Link,{href:(0,s.getLocalizedPath)(t?.href,a,"ref=navMenu"),className:"no-underline hover:text-current",children:(0,e.jsxs)("div",{className:"relative h-full overflow-hidden [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(i.Picture,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(i.Text,{as:"p",html:t?.title,className:(0,s.cn)("text-xl font-bold leading-[1.2]",{"text-white":t?.theme!=="dark","text-black":t?.theme==="dark"})}),t?.desc&&(0,e.jsx)(i.Text,{html:t?.desc,className:(0,s.cn)("text-sm font-bold leading-[1.4]",{"text-white":t?.theme!=="dark","text-black":t?.theme==="dark"})})]})]})})})},b=({matchResourcesMetadata:t,onSubSubCategoryItemClick:a,expanded:l})=>{const o=(0,e.jsxs)(e.Fragment,{children:[t?.label&&(0,e.jsx)(i.Text,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),a&&(0,e.jsx)("svg",{className:(0,s.cn)("size-5",{"rotate-180":l}),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M6.91009 4.41009C7.23553 4.08466 7.76304 4.08466 8.08848 4.41009L13.0885 9.41009C13.4139 9.73553 13.4139 10.263 13.0885 10.5885L8.08848 15.5885C7.76304 15.9139 7.23553 15.9139 6.91009 15.5885C6.58466 15.263 6.58466 14.7355 6.91009 14.4101L11.3209 9.99929L6.91009 5.58848C6.58466 5.26304 6.58466 4.73553 6.91009 4.41009Z",fill:"#080A0F"})})]});return a?(0,e.jsx)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:a,"aria-expanded":l,children:o}):(0,e.jsx)("div",{className:"flex items-center justify-between py-4",children:o})},u=({matchResourcesMetadata:t})=>{const{locale:a="us"}=(0,r.useAiuiContext)();return(0,e.jsx)("div",{className:"tablet:grid tablet:grid-cols-2 flex grid-cols-1 flex-col gap-4",children:!!t?.resources?.length&&t?.resources?.map((l,o)=>(0,e.jsx)(i.Link,{href:(0,s.getLocalizedPath)(l?.href,a,"ref=navMenu"),className:"no-underline hover:text-current",children:(0,e.jsx)("div",{className:"laptop:h-[280px] tablet:max-w-none relative h-[240px] max-w-[358px]",children:(0,e.jsxs)("div",{className:"relative h-full overflow-hidden",children:[(0,e.jsx)(i.Picture,{source:l.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(i.Text,{html:l?.title,as:"p",className:(0,s.cn)("text-xl font-bold leading-[1.2]",{"text-white":l?.theme!=="dark","text-black":l?.theme==="dark"})}),l?.desc&&(0,e.jsx)(i.Text,{html:l?.desc,className:(0,s.cn)("text-sm font-bold leading-[1.4]",{"text-white":l?.theme!=="dark","text-black":l?.theme==="dark"})})]})]})})},`resourceItem-${o}`))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var D=Object.create;var f=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var B=(e,s)=>{for(var u in s)f(e,u,{get:s[u],enumerable:!0})},h=(e,s,u,m)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of $(s))!O.call(e,c)&&c!==u&&f(e,c,{get:()=>s[c],enumerable:!(m=E(s,c))||m.enumerable});return e};var I=(e,s,u)=>(u=e!=null?D(z(e)):{},h(s||!e||!e.__esModule?f(u,"default",{value:e,enumerable:!0}):u,e)),T=e=>h(f({},"__esModule",{value:!0}),e);var W={};B(W,{ResourceSidebarDropdown:()=>A});module.exports=T(W);var o=require("react/jsx-runtime"),i=I(require("react")),d=require("../../components/index.js"),p=require("../../helpers/utils.js"),w=require("./icons/index.js"),N=require("./NavProvider.js"),k=require("./ResourceItem.js"),C=require("../AiuiProvider/index.js");const A=i.default.memo(({resourceCategoriesMetadata:e,resourcesMetadata:s})=>{const{onSidebarNavClick:u}=(0,N.useNavContext)(),[m,c]=(0,i.useState)([]),[y,g]=(0,i.useState)(-1),R=(0,i.useRef)(null),{locale:x="us"}=(0,C.useAiuiContext)(),v=(0,i.useCallback)(()=>{const n=e?.subcategories;if(!n?.length)return;const a=n.findIndex(l=>!!l?.subSubCategories),t=n.findIndex(l=>!l?.subSubCategories),r=n.map((l,b)=>({index:b,open:a===b||t===b}));c(r)},[e]);(0,i.useEffect)(()=>{v()},[v]);const S=(0,i.useMemo)(()=>{const n=e?.subcategories?.[m?.find(t=>t.open)?.index||0],a=s?.find(t=>t?.label?.toLowerCase()===n?.label?.toLowerCase())||{};if(n?.subSubCategories){const t=n?.subSubCategories?.[y];return s?.find(l=>l?.label?.toLowerCase()===t?.label?.toLowerCase())||{}}else return a},[e,m,y,s]),F=(0,i.useCallback)((n,a)=>{a?.subSubCategories?.length>0?g(0):g(-1),c(t=>t.map((r,l)=>({...r,open:l===n?!r.open:!1})))},[]),L=(n,a)=>{c(t=>t.map(r=>r.index===n?{...r,open:!0}:{...r,open:!1})),g(a)};return(0,o.jsxs)(d.Container,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[(0,o.jsxs)("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:R,children:[(0,o.jsx)("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:e?.subcategories?.map((n,a)=>{const t=Array.isArray(n?.subSubCategories)&&n?.subSubCategories?.length>0,r=m?.find(l=>l.index===a)?.open;return(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{className:(0,p.cn)("rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!t&&r}),onClick:()=>{F(a,n),u?.(n,a)},"aria-expanded":t?r:void 0,"aria-haspopup":t?"true":void 0,children:[(0,o.jsx)(d.Text,{html:n.label,className:"p-4 text-sm font-bold leading-[1.4]"}),t&&(0,o.jsx)(w.DownArrow,{"aria-hidden":"true",className:(0,p.cn)("size-4",{"rotate-180":r})})]}),r&&(0,o.jsx)("div",{className:"flex flex-col",role:"menu",children:n.subSubCategories?.map((l,b)=>(0,o.jsx)("button",{onClick:()=>{L(a,b),u?.(l,b)},className:(0,p.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]":y===b}),role:"menuitem","aria-label":l.label,children:(0,o.jsx)(d.Text,{html:l.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${a}-${b}`))})]},`subcategoryItem-${a}`)})}),e&&(0,o.jsx)("div",{className:"flex",children:(0,o.jsxs)("div",{className:"flex flex-col gap-4",children:[e?.primary&&(0,o.jsx)(d.Button,{as:"a",href:(0,p.getLocalizedPath)(e?.primary?.url,x,`ref=${e?.primary?.label}_shopall`),variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:e?.primary?.label}),e?.secondary&&(0,o.jsx)(d.Button,{as:"a",href:(0,p.getLocalizedPath)(e?.secondary?.url,x,"ref=navMenu"),variant:"link",size:"lg",className:"link-btn lg-desktop:text-base justify-start !p-0 text-sm",children:e?.secondary?.label})]})})]}),(0,o.jsx)("div",{className:"desktop:h-[509px] flex-1 overflow-y-auto py-4",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:(0,o.jsx)("div",{className:"grid grid-cols-3 gap-4 ",children:Array.isArray(S?.resources)?S.resources.map((n,a)=>(0,o.jsx)(k.ResourceItem,{resource:n},`resourceItem-${a}`)):null})})]})});A.displayName="ResourceSidebarDropdown";
|
|
@@ -3,9 +3,10 @@ import React from 'react';
|
|
|
3
3
|
* 侧边栏下拉
|
|
4
4
|
* @param categoriesItem 分类项
|
|
5
5
|
*/
|
|
6
|
-
export declare const SidebarDropdown: React.MemoExoticComponent<({ sidebarCategoriesMetadata, seriesMetadata }: {
|
|
6
|
+
export declare const SidebarDropdown: React.MemoExoticComponent<({ sidebarCategoriesMetadata, seriesMetadata, navigationTitle, }: {
|
|
7
7
|
sidebarCategoriesMetadata: any;
|
|
8
8
|
seriesMetadata: any;
|
|
9
|
+
navigationTitle?: string;
|
|
9
10
|
}) => import("react/jsx-runtime").JSX.Element>;
|
|
10
11
|
/**
|
|
11
12
|
* 系列产品项组件
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var H=Object.create;var _=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var K=(t,c)=>{for(var b in c)_(t,b,{get:c[b],enumerable:!0})},P=(t,c,b,y)=>{if(c&&typeof c=="object"||typeof c=="function")for(let v of T(c))!W.call(t,v)&&v!==b&&_(t,v,{get:()=>c[v],enumerable:!(y=G(c,v))||y.enumerable});return t};var U=(t,c,b)=>(b=t!=null?H(V(t)):{},P(c||!t||!t.__esModule?_(b,"default",{value:t,enumerable:!0}):b,t)),q=t=>P(_({},"__esModule",{value:!0}),t);var I={};K(I,{SeriesProductItem:()=>B,SidebarDropdown:()=>j});module.exports=q(I);var e=require("react/jsx-runtime"),i=U(require("react")),l=require("../../components/index.js"),p=require("../../helpers/utils.js"),z=require("./icons/index.js"),D=require("./NavProvider.js"),L=require("../AiuiProvider/index.js"),A=require("../../shared/track.js");const j=i.default.memo(({sidebarCategoriesMetadata:t,seriesMetadata:c,navigationTitle:b})=>{const{buildProps:y,onSidebarNavClick:v}=(0,D.useNavContext)(),{locale:x="us",pageHandle:k,trackingData:C}=(0,L.useAiuiContext)(),[h,f]=(0,i.useState)([]),[g,N]=(0,i.useState)(-1),S=(0,i.useRef)(null),m=(0,i.useRef)(null),w=(0,i.useCallback)(()=>{const a=t?.subcategories;if(!a?.length)return;const o=a.findIndex(u=>!!u?.subSubCategories),n=a.findIndex(u=>!u?.subSubCategories),r=a.map((u,d)=>({index:d,open:o===d||n===d}));f(r)},[t]);(0,i.useEffect)(()=>{w()},[w]);const s=(0,i.useMemo)(()=>{const a=t?.subcategories?.[h?.find(n=>n.open)?.index||0],o=c?.find(n=>n?.label?.toLowerCase()===a?.label?.toLowerCase())||{};if(a?.collections){const n=y?.categories?.[a?.collections]||{};return{label:o?.label,isCollection:!0,banner:o?.banner,primary:o?.primary,series:[{products:n?.products}]}}else if(a?.subSubCategories){const n=a?.subSubCategories?.[g],r=c?.find(u=>u?.label?.toLowerCase()===n?.label?.toLowerCase())||{};if(n?.collections){const u=y?.categories?.[n?.collections]||{};return{label:r?.label,isCollection:!0,banner:r?.banner,primary:r?.primary,series:[{products:u?.products}]}}else return r}else return o},[t,h,g,c,y]),F=(0,i.useMemo)(()=>h?.find(a=>a.open)?.index??-1,[h]),$=(0,i.useMemo)(()=>k?`Activity Page_${k}`:C?.pageGroup||"Home Page",[k,C]);(0,i.useEffect)(()=>{F<0||!s?.label||(0,A.gaTrack)({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:$,component_type:"copy",component_name:"navigation",position:F+1,component_title:s?.label,navigation:b||""}})},[s?.label,F,$,b]);const E=(0,i.useCallback)((a,o)=>{const n=o?.subSubCategories?.length>0;N(n?0:-1);const r=m.current;f(u=>u.map((d,R)=>R===a?{...d,open:!d.open}:n?{...d,open:!1}:!r&&g===-1?{...d,open:!1}:r&&!r.hasSubSubCategories&&!n&&g===-1?{...d,open:!1}:d)),m.current={index:a,hasSubSubCategories:n}},[g]),O=(a,o)=>{f(n=>n.map(r=>r.index===a?{...r,open:!0}:{...r,open:!1})),N(o)};return(0,e.jsxs)(l.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:S,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 n=Array.isArray(a?.subSubCategories)&&a?.subSubCategories?.length>0,r=h?.find(u=>u.index===o)?.open;return(0,e.jsxs)("div",{children:[(0,e.jsxs)("button",{className:(0,p.cn)("rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!n&&r}),onClick:()=>{E(o,a),v?.(a,o)},"aria-expanded":n?r:void 0,"aria-haspopup":n?"true":void 0,children:[(0,e.jsx)(l.Text,{html:a.label,className:"p-4 text-sm font-bold leading-[1.4]"}),n&&(0,e.jsx)(z.DownArrow,{"aria-hidden":"true",className:(0,p.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:()=>{O(o,d),v?.(u,d)},className:(0,p.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]":g===d}),role:"menuitem","aria-label":u.label,children:(0,e.jsx)(l.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)(l.Button,{as:"a",href:(0,p.getLocalizedPath)(t?.primary?.url,x,`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)(l.Button,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",iconClassName:"size-4",className:"link-btn 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)(l.Text,{html:s?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),s?.primary&&!s?.primary?.hide&&(0,e.jsx)(l.Text,{className:"lg-desktop:text-base text-sm font-bold leading-[1.2]",html:s?.primary?.label})]});return s?.primary?.url?(0,e.jsx)(l.Button,{as:"a",href:(0,p.getLocalizedPath)(s?.primary?.url,x,`ref=${s?.label}_viewmore`),variant:"link",size:"lg",iconClassName:"size-4",className:"link-btn 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)(l.Link,{href:(0,p.getLocalizedPath)(t?.guide?.url,x,"ref=navMenu"),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)(l.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)(l.Link,{asChild:!s?.banner?.href,href:(0,p.getLocalizedPath)(s?.banner?.href,x,"ref=navMenu"),children:(0,e.jsxs)("div",{className:"rounded-sidebar-shelf relative overflow-hidden [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(l.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)(l.Heading,{size:2,html:s?.banner?.title||"Buy in Guide",className:(0,p.cn)("font-bold text-white",{"text-black":s?.banner?.theme==="dark"})}),(0,e.jsx)(l.Text,{html:s?.banner?.desc||"20.000mAh",className:(0,p.cn)("text-sm font-bold text-white",{"text-black":s?.banner?.theme==="dark"})})]})]})}),a.products?.map((n,r)=>(0,e.jsx)(B,{seriesLabel:s?.label,product:n,isCollection:s?.isCollection},`seriesProductItem-${a?.label||""}-${o}-${r}`))]})]},`seriesItem-${a?.label||""}-${o}`))})]})]})});j.displayName="SidebarDropdown";const B=({product:t,isCollection:c,position:b,seriesLabel:y})=>{const{locale:v="us"}=(0,L.useAiuiContext)(),{buildProps:x,onSeriesProductClick:k,componentOverrides:C}=(0,D.useNavContext)(),h=C?.badge?.variant;let f=c?t:x?.products?.find(m=>m.handle===t.handle);const g=f?.variants?.find(m=>m.sku===t.sku)||f?.variants?.[0],N=(0,i.useMemo)(()=>(0,p.getLocalizedPath)(`/products/${f?.handle}`,v,`variant=${(0,p.atobID)(g?.id)}&ref=navMenu`),[f?.handle,g?.id,v]),S=(0,i.useMemo)(()=>f?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,1),[f?.tags]);return g?.availableForSale?(0,e.jsx)(l.Link,{href:N,onClick:m=>{m.preventDefault(),window.open(N,"_self"),k?.(f,b||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:`${g?.image?.url||t?.images?.[0]?.url}&width=200`,loading:"lazy",alt:f?.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((m,w)=>(0,e.jsx)(l.Badge,{size:"xs",variant:h,className:"whitespace-nowrap",children:m},w))}),(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col justify-center",children:[(0,e.jsx)(l.Text,{className:"lg-desktop:text-base line-clamp-2 text-sm font-bold leading-[1.4]",html:t?.custom_name||g?.metafields?.infos?.page_short_title||f?.title}),t?.desc&&(0,e.jsx)(l.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";var a=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var D=(t,e)=>{for(var r in e)a(t,r,{get:e[r],enumerable:!0})},L=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of w(e))!b.call(t,s)&&s!==r&&a(t,s,{get:()=>e[s],enumerable:!(i=v(e,s))||i.enumerable});return t};var R=t=>L(a({},"__esModule",{value:!0}),t);var E={};D(E,{SupportsDropdown:()=>y});module.exports=R(E);var l=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var a=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var D=(t,e)=>{for(var r in e)a(t,r,{get:e[r],enumerable:!0})},L=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of w(e))!b.call(t,s)&&s!==r&&a(t,s,{get:()=>e[s],enumerable:!(i=v(e,s))||i.enumerable});return t};var R=t=>L(a({},"__esModule",{value:!0}),t);var E={};D(E,{SupportsDropdown:()=>y});module.exports=R(E);var l=require("react/jsx-runtime"),o=require("react"),u=require("../../components/index.js"),p=require("es-toolkit"),f=require("../AiuiProvider/index.js"),g=require("../../helpers/utils.js");const y=({supportsMetadata:t,currentNavItemRef:e})=>{const{locale:r="us"}=(0,f.useAiuiContext)(),i=(0,o.useRef)(null),[s,c]=(0,o.useState)(null),[m,h]=(0,o.useState)(0);(0,o.useEffect)(()=>{if(i?.current){const n=i?.current?.getBoundingClientRect();h(n.height)}},[i]);const d=(0,p.debounce)(()=>{if(e){const n=e.getBoundingClientRect();c(n)}},500);return(0,o.useEffect)(()=>(d(),window.addEventListener("resize",d),()=>{window.removeEventListener("resize",d)}),[d]),(0,o.useEffect)(()=>{if(e){const n=e.getBoundingClientRect();c(n)}},[e]),(0,l.jsx)("div",{className:"rounded-b-box absolute top-0 h-full overflow-hidden bg-white transition-all duration-500",style:{right:`calc(100% - ${s?.right}px)`,height:m},children:(0,l.jsx)("div",{ref:i,className:"p-4",children:t?.map(n=>(0,l.jsx)("div",{className:"py-2",children:(0,l.jsx)(u.Link,{href:(0,g.getLocalizedPath)(n.url,r,"ref=navMenu"),className:"text-sm font-bold leading-[1.4] no-underline",children:n.label})},n.id))})})};
|
|
@@ -1 +1 @@
|
|
|
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"),w=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"),x=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"),Ce=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:T,theme:s="light",isTop:d=!1,searchResult:h,onSearch:v,isSearching:p,keywords:L,onPrimaryNavClick:C,onSeriesProductClick:y,onSidebarNavClick:P,onMobileMenuToggle:U,headerId:D,cartCount:z,menuData:B,render:R,componentOverrides:G,...J}=n,[I,f]=(0,t.useState)(!1),[W,A]=(0,t.useState)(!1),[O,H]=(0,t.useState)(!1),[Y,g]=(0,t.useState)(!1),j=(0,t.useRef)(null),M=(0,t.useRef)(null),q=()=>{const N=document?.querySelector("body")?.offsetWidth||0;g(N<=1440)};(0,t.useEffect)(()=>(q(),window.addEventListener("resize",q),()=>{window.removeEventListener("resize",q)}),[]),(0,t.useImperativeHandle)(r,()=>M.current),(0,t.useEffect)(()=>{M.current&&d&&(0,fe.default)(M.current,{duration:0,offset:M.current?.getBoundingClientRect()?.bottom||0})},[d]),(0,t.useEffect)(()=>{if(d){A(!1),H(!1);return}let N=0,a=0,m=0;const b=()=>document?.documentElement?.scrollTop||document?.body?.scrollTop||0,k=b();N=k,A(k>300),H(k>30);const $=(0,ie.default)(()=>{const E=b(),K=E-N;H(E>30),K>0?(a=0,m+=K,m>=300&&E>300&&A(!0)):K<0&&(m=0,a+=Math.abs(K),a>=300&&(A(!1),a=0)),N=E},100);return window.addEventListener("scroll",$,{passive:!0}),()=>window.removeEventListener("scroll",$)},[d]),(0,t.useEffect)(()=>{u&&(u.search=()=>f(!0))},[u]),(0,te.useGSAP)(()=>{j?.current&&I&&X.gsap.fromTo(j.current,{height:0},{height:"auto",duration:.3})},[I]),(0,ae.useScrollLock)(I);const Q=(0,t.useMemo)(()=>i?.bar?.actions?.find(N=>N?.blockType===o.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[i]),_=R?.mobileHeaderNavigation;return(0,e.jsx)(F.default,{buildProps:c,profile:T,isMobile:Y,event:u,payloadData:i,onSidebarNavClick:P,onSeriesProductClick:y,cartCount:z,componentOverrides:G,children:(0,e.jsx)("header",{...J,id:D||"header","data-ui-component-id":"HeaderNavigation",className:d?"relative z-[100] bg-white":(0,w.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,w.cn)("hover:bg-white hover:text-black",s==="light"?"text-black":"text-white",{"!bg-white transition-all duration-500 ease-in-out":!d&&O},{"hover:!text-black":s==="dark","!text-black":!d&&O}),onClick:()=>!d&&H(!0),children:[(0,e.jsx)(ce,{data:i,className:"desktop:block hidden !bg-white",theme:s,onNavItemClick:()=>!d&&H(!0),onPrimaryNavClick:C}),_?(0,e.jsx)(_,{className:"desktop:hidden block !bg-white",menuData:B,data:i,onPrimaryNavClick:C}):(0,e.jsx)(ue,{menuData:B,data:i,className:"desktop:hidden block !bg-white",onPrimaryNavClick:C,onMobileMenuToggle:U}),I&&(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:j,className:(0,w.cn)("overflow-y-auto",{}),children:(0,e.jsx)(be.default,{data:Q,keywords:L,isSearching:p,searchResult:h,onSearch:N=>{v?.(N)},onClose:()=>{v?.(),f(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>f(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:N=>{(N.key==="Enter"||N.key===" "||N.key==="Escape")&&(N.preventDefault(),f(!1))}})]})]})})})}),ce=(0,t.forwardRef)((n,r)=>{const{data:i,onNavItemClick:c,className:u,theme:T,onPrimaryNavClick:s}=n,{event:d,profile:h}=(0,F.useNavContext)(),[v,p]=(0,t.useState)(!1),{locale:L="us"}=(0,oe.useAiuiContext)(),C=(0,t.useMemo)(()=>(0,x.WithGroupCategory)(i?.categories?.filter(a=>a?.pcShow)),[i]),[y,P]=(0,t.useState)(null),[U,D]=(0,t.useState)([]),z=(0,t.useRef)(null),[B,R]=(0,t.useState)(!1),G=(0,t.useRef)(null),J=(0,t.useRef)(null),I=(0,t.useRef)(C.map(a=>Array(a?.length||0).fill(null)));(0,t.useEffect)(()=>{C?.length&&D(C?.map((a,m)=>a?.map((b,k)=>({groupIndex:m,index:k,open:!1}))))},[C]);const f=(0,t.useMemo)(()=>{let a=null;for(const m of U){for(const b of m)if(b.open){a=b;break}if(a)break}return a},[U]);(0,ae.useScrollLock)(!!f?.open||B);const W=(a,m,b)=>{R(!1);const k=C[m][b];if(k?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links)k?.components?.[0]?.url&&window.open(k?.components?.[0]?.url,k?.components?.[0]?.target??"_blank");else{const $=C?.flat()||[],E=$?.findIndex(K=>K?.id===C[m][b]?.id);a.stopPropagation(),c?.(),s?.($[E],E),P(k),D(K=>K.map(xe=>xe.map(V=>V.groupIndex===m&&V.index===b?{...V,open:!V.open}:{...V,open:!1})))}},A=(a,m,b)=>{a.key==="Enter"||a.key===" "?(a.preventDefault(),W(a,m,b)):a.key==="Escape"&&f?.groupIndex===m&&f?.index===b&&(a.preventDefault(),O())},O=()=>{D(a=>a.map(m=>m.map(b=>({...b,open:!1}))))},H=(0,t.useMemo)(()=>{if(y)return y?.components?.[0]?.blockType},[y]),Y=(0,x.WithSidebar)(he.SidebarDropdown,y),g=(0,x.WithResource)(ve.ResourceSidebarDropdown,y),j=(0,x.WithMulticol)(ye.MulticolDropdown,y),M=(0,x.WithSupports)(Ne.SupportsDropdown,{categoriesItem:y,currentNavItemRef:I.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)(j,{});default:return null}},[H,y]),Q=(0,t.useMemo)(()=>i?.bar?.actions?.filter(a=>a?.pcShow),[i]),_=(0,t.useMemo)(()=>Q?.find(a=>a?.blockType===o.HeaderNavigationActionBlockType.Profile),[Q]),N=(0,t.useCallback)(()=>{R(a=>!a)},[]);return(0,t.useEffect)(()=>{if(z?.current){const a=z.current;return a.addEventListener("click",N),()=>{a.removeEventListener("click",N)}}},[N]),(0,te.useGSAP)(()=>{f?.open&&X.gsap.fromTo(J?.current,{height:0},{height:"auto"})},[f?.open]),(0,e.jsxs)(l.Container,{className:(0,w.cn)("relative h-[92px]",u),children:[(0,e.jsxs)("div",{ref:G,onClick:O,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:z,actions:Q,activeStatus:B})]}),(0,e.jsx)("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:C?.map((a,m)=>(0,e.jsx)("div",{className:"flex gap-3",children:a?.map((b,k)=>{const $=f?.groupIndex===m&&f?.index===k;return(0,e.jsx)("div",{ref:E=>{I.current[m][k]=E},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:E=>W(E,m,k),onKeyDown:E=>A(E,m,k),"aria-expanded":$,"aria-haspopup":"true","aria-label":b.text,children:[(0,e.jsx)(l.Text,{html:b.text,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)(S.DownArrow,{className:(0,w.cn)("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":f?.groupIndex===m&&f?.index===k,"opacity-100":v&&f?.groupIndex===m&&f?.index===k,invisible:!b?.components?.length||b?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links})})]}),(0,e.jsx)("div",{className:(0,w.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":$},T==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},b.id)})},`groupCategory-${m}`))})]}),(0,e.jsxs)("div",{role:"menu","aria-hidden":!(f?.open&&y),className:(0,w.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&&y)}),onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{height:`calc(100dvh - ${G?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:J,className:(0,w.cn)("relative z-50",{"overflow-hidden":H!==o.HeaderNavigationBlockType.Supports}),children:q}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:O,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),O())}})]}),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% - ${z?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:h?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:h?.nick_name||_?.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:_?.profiles?.map(a=>(0,e.jsx)(ne.MenuItem,{className:"py-2",label:a?.title,href:(0,w.getLocalizedPath)(a?.url,L)},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:_?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:_?.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:()=>d?.join?.(),children:(0,e.jsx)(l.Text,{html:_?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{className:"grow",variant:"primary",size:"lg",onClick:()=>d?.login?.(),children:(0,e.jsx)(l.Text,{html:_?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>R(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),R(!1))}})]})]})}),ue=(0,t.forwardRef)(({data:n,menuData:r,className:i,onPrimaryNavClick:c,onMobileMenuToggle:u},T)=>{const s=(0,t.useMemo)(()=>(0,x.WithGroupCategory)(n?.categories?.filter(g=>g?.mobileShow)),[n]),{currentMenu:d,setCurrentMenu:h,subSubCategory:v}=(0,F.useNavContext)(),[p,L]=(0,t.useState)(!1),[C,y]=(0,t.useState)(0),[P,U]=(0,t.useState)(null),D=(0,t.useRef)(null),z=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(D?.current&&p){const g=D?.current?.getBoundingClientRect();y(window?.innerHeight-(g?.top||0))}u?.({open:p})},[p,u]),(0,t.useEffect)(()=>{if(!p)return;const g=(0,ie.default)(()=>{if(D?.current){const j=D.current.getBoundingClientRect();z.current=!0,y(window?.innerHeight-(j?.top||0))}},100);return window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[p]),(0,te.useGSAP)(()=>{if(z.current){X.gsap.set(D.current,{height:C}),z.current=!1;return}X.gsap.fromTo(D.current,{height:0},{height:C,duration:.3})},[C]),(0,ae.useScrollLock)(p);const B=(0,t.useMemo)(()=>P?.components?.[0]?.blockType,[P]),R=(0,x.WithSupports)(we.MobileSupportMenu,{categoriesItem:P}),G=(0,x.WithSidebar)(ke.MobileSidebarMenu,P),J=(0,x.WithResource)(ge.MobileResourceSidebarMenu,P),I=(0,x.WithMulticol)(Ce.MobileMulticolMenu,P),f=(0,t.useMemo)(()=>{switch(B){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)(R,{});case o.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(I,{});default:return null}},[B,P,R]),W=(0,t.useCallback)(()=>{L(!1),y(0),h&&h(o.HeaderNavigationMenu.Primary)},[L,y,h]),A=(0,t.useMemo)(()=>n?.bar?.actions?.filter(g=>g?.mobileShow&&g?.blockType!==o.HeaderNavigationActionBlockType.Profile),[n]),O=(0,t.useMemo)(()=>n?.bar?.actions?.find(g=>g?.mobileShow&&g?.blockType===o.HeaderNavigationActionBlockType.Profile)||{},[n]),H=(0,t.useMemo)(()=>{switch(d){case o.HeaderNavigationMenu.Primary:return(0,e.jsx)(Be,{actions:A,menuOpen:p,onMenuOpenClose:()=>{L(!1),y(0)},onMenuOpenClick:()=>L(!0)});case o.HeaderNavigationMenu.Secondary:return(0,e.jsx)(me,{title:P?.text,onMenuOpenClose:W,onMenuBackClick:()=>h?.(o.HeaderNavigationMenu.Primary)});case o.HeaderNavigationMenu.Third:return(0,e.jsx)(me,{title:v?.label,onMenuOpenClose:W,onMenuBackClick:()=>h?.(o.HeaderNavigationMenu.Secondary)});default:return null}},[p,d,h,P,A,v,W]),Y=(0,t.useCallback)((g,j)=>{const M=Array.isArray(s)?Array.isArray(s[g])?s[g][j]:{}:{};U(M),M?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links?M?.components?.[0]?.url&&window.open(M?.components?.[0]?.url,M?.components?.[0]?.target??"_blank"):h?.(o.HeaderNavigationMenu.Secondary)},[s,h]);return(0,e.jsxs)(l.Container,{className:(0,w.cn)("relative h-[56px]",i),children:[H,p&&(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:C},role:"navigation","aria-label":"Mobile navigation menu",children:[d===o.HeaderNavigationMenu.Primary&&r?(0,e.jsx)("div",{className:"pt-4",children:(0,e.jsx)(l.BrandStrip,{data:r})}):null,d===o.HeaderNavigationMenu.Primary?(0,e.jsx)(Le,{categories:s,onPrimaryMenuClick:Y,onPrimaryNavClick:c,profileAction:O,menuData:r}):f]})]})}),Le=({categories:n,onPrimaryMenuClick:r,profileAction:i,onPrimaryNavClick:c,menuData:u})=>(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((T,s)=>(0,e.jsxs)("div",{className:"",children:[s>0||u?(0,e.jsx)("div",{className:(0,w.cn)("my-2 h-px w-full bg-[#E5E5E7]")}):null,T?.map((d,h)=>(0,e.jsx)(ne.MenuItem,{label:d.text,onClick:()=>{const p=(n?.flat()||[])?.findIndex(L=>L?.id===n[s][h]?.id);r(s,h),c?.(d,p)},icon:d.components?.[0]?.icon},d.id))]},`groupCategory-${s}`))}),(0,e.jsx)(ze,{profileAction:i})]}),ze=({profileAction:n})=>{const[r,i]=(0,t.useState)(!1),{profile:c,event:u}=(0,F.useNavContext)(),{locale:T="us"}=(0,oe.useAiuiContext)();return(0,e.jsxs)("div",{className:(0,w.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,w.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,w.getLocalizedPath)(s?.url,T)},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,w.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)(),[T,s]=(0,t.useState)(null),d=v=>{switch(v){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"}},h=(0,t.useCallback)((v,p)=>{switch(s(p),v?.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((v,p)=>(0,e.jsxs)("button",{className:"relative cursor-pointer border-0 bg-transparent p-0","data-tag":v?.tag||"",ref:v.blockType===o.HeaderNavigationActionBlockType.Profile?i:null,onClick:()=>h(v,p),"aria-label":d(v.blockType),"aria-pressed":r&&T===p,children:[(0,e.jsx)(l.Text,{html:v.icon,className:(0,w.cn)("size-5",{"text-brand-0":r&&T===p}),"aria-hidden":"true"}),v.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"})})]},v.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);
|
|
1
|
+
"use strict";"use client";var Be=Object.create;var ie=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Ae=Object.getPrototypeOf,Oe=Object.prototype.hasOwnProperty;var je=(t,o)=>{for(var i in o)ie(t,i,{get:o[i],enumerable:!0})},pe=(t,o,i,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let u of Ie(o))!Oe.call(t,u)&&u!==i&&ie(t,u,{get:()=>o[u],enumerable:!(c=ze(o,u))||c.enumerable});return t};var le=(t,o,i)=>(i=t!=null?Be(Ae(t)):{},pe(o||!t||!t.__esModule?ie(i,"default",{value:t,enumerable:!0}):i,t)),_e=t=>pe(ie({},"__esModule",{value:!0}),t);var Ge={};je(Ge,{default:()=>Fe});module.exports=_e(Ge);var e=require("react/jsx-runtime"),a=require("react"),s=require("../../components/index.js"),xe=require("../../shared/Styles.js"),v=require("../../helpers/utils.js"),K=le(require("./NavProvider.js")),r=require("./types.js"),Ce=le(require("jump.js")),se=require("@gsap/react"),te=require("gsap"),M=require("./withCategory.js"),w=require("./icons/index.js"),we=le(require("../NavigationSearch/index.js")),Me=require("./ResourceSidebarDropdown.js"),Se=require("./MobileResourceSidebarMenu.js"),Te=require("./SidebarDropdown.js"),ce=require("./useScrollLock.js"),De=require("./MulticolDropdown.js"),Le=require("./SupportsDropdown.js"),Pe=require("./MobileSidebarMenu.js"),Ee=require("./MobileSupportMenu.js"),He=require("./MobileMulticolMenu.js"),ue=require("./MobileMenuComponents.js"),q=require("../AiuiProvider/index.js"),me=le(require("../../shared/throttle.js")),Re=require("./useNavCollapse.js");const fe=t=>!!t?.components?.length&&t?.components?.[0]?.blockType!==r.HeaderNavigationBlockType.Links,be=t=>t?.components?.[0]?.blockType===r.HeaderNavigationBlockType.Links&&t?.components?.[0]?.url||t?.url||void 0,ve=t=>t?.components?.[0]?.blockType===r.HeaderNavigationBlockType.Links&&t?.components?.[0]?.target||t?.target,$e=({groupCategories:t})=>(0,e.jsx)("div",{className:"pointer-events-none invisible absolute inset-x-0 top-0 overflow-hidden","aria-hidden":"true",children:(0,e.jsx)(s.Container,{className:"h-[92px]",children:(0,e.jsx)("nav",{className:"flex h-full items-end justify-between",children:t?.map((o,i)=>(0,e.jsx)("div",{className:"flex gap-3","data-nav-item":!0,children:o?.map(c=>(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(s.Text,{html:c.text,"data-nav-item-label":!0,className:"desktop:text-pretty text-nowrap text-sm font-bold leading-[1.4]"}),fe(c)&&(0,e.jsx)(w.DownArrow,{className:"size-4 opacity-0","aria-hidden":"true"})]},c.id))},`measure-group-${i}`))})})}),ge=(0,a.forwardRef)((t,o)=>{const{data:{header:i}={},buildProps:c,event:u,profile:P,theme:m="light",isTop:l=!1,searchResult:p,onSearch:f,isSearching:b,keywords:E,onPrimaryNavClick:T,onSeriesProductClick:y,onSidebarNavClick:D,onMobileMenuToggle:F,headerId:S,cartCount:H,menuData:B,render:z,componentOverrides:G,...U}=t,[k,I]=(0,a.useState)(!1),[g,A]=(0,a.useState)(!1),[J,O]=(0,a.useState)(!1),L=(0,a.useRef)(null),d=(0,a.useRef)(null),_=(0,a.useMemo)(()=>(0,M.WithGroupCategory)(i?.categories?.filter(x=>x?.pcShow)),[i]),R=(0,Re.useNavCollapse)(d),{setNavCollapsed:ae}=(0,q.useAiuiContext)();(0,a.useEffect)(()=>{ae?.(R)},[R,ae]),(0,a.useImperativeHandle)(o,()=>d.current),(0,a.useEffect)(()=>{d.current&&l&&(0,Ce.default)(d.current,{duration:0,offset:d.current?.getBoundingClientRect()?.bottom||0})},[l]),(0,a.useEffect)(()=>{if(l){A(!1),O(!1);return}let x=0,Y=0,V=0;const re=()=>document?.documentElement?.scrollTop||document?.body?.scrollTop||0,W=re();x=W,A(W>300),O(W>30);const j=(0,me.default)(()=>{const $=re(),n=$-x;O($>30),n>0?(Y=0,V+=n,V>=300&&$>300&&A(!0)):n<0&&(V=0,Y+=Math.abs(n),Y>=300&&(A(!1),Y=0)),x=$},100);return window.addEventListener("scroll",j,{passive:!0}),()=>window.removeEventListener("scroll",j)},[l]),(0,a.useEffect)(()=>{u&&(u.search=()=>I(!0))},[u]),(0,se.useGSAP)(()=>{L?.current&&k&&te.gsap.fromTo(L.current,{height:0},{height:"auto",duration:.3})},[k]),(0,ce.useScrollLock)(k);const Q=(0,a.useMemo)(()=>i?.bar?.actions?.find(x=>x?.blockType===r.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[i]),ne=z?.mobileHeaderNavigation;return(0,e.jsx)(K.default,{buildProps:c,profile:P,isMobile:R,event:u,payloadData:i,onSidebarNavClick:D,onSeriesProductClick:y,cartCount:H,componentOverrides:G,children:(0,e.jsx)("header",{...U,id:S||"header","data-ui-component-id":"HeaderNavigation",className:l?"relative z-[100] bg-white":(0,v.cn)("sticky top-0 z-[100] transition-transform duration-500 ease-in-out",{"translate-y-[-100%]":g}),ref:d,children:(0,e.jsxs)("div",{className:(0,v.cn)("hover:bg-white hover:text-black",m==="light"?"text-black":"text-white",{"!bg-white transition-all duration-500 ease-in-out":!l&&J},{"hover:!text-black":m==="dark","!text-black":!l&&J}),onClick:()=>!l&&O(!0),children:[(0,e.jsx)($e,{groupCategories:_}),(0,e.jsx)("div",{className:(0,v.cn)("hidden",R?"laptop:hidden":"laptop:block","desktop:block"),children:(0,e.jsx)(he,{data:i,groupCategories:_,theme:m,onNavItemClick:()=>!l&&O(!0),onPrimaryNavClick:T,className:"!bg-white"})}),(0,e.jsx)("div",{className:(0,v.cn)("block",R?"laptop:block":"laptop:hidden","desktop:hidden"),children:ne?(0,e.jsx)(ne,{menuData:B,data:i,onPrimaryNavClick:T}):(0,e.jsx)(ye,{menuData:B,data:i,onPrimaryNavClick:T,onMobileMenuToggle:F,className:"!bg-white"})}),k&&(0,e.jsxs)("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${d?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[(0,e.jsx)("div",{ref:L,className:(0,v.cn)("overflow-y-auto",{}),children:(0,e.jsx)(we.default,{data:Q,keywords:E,isSearching:b,searchResult:p,onSearch:x=>{f?.(x)},onClose:()=>{f?.(),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))}})]})]})})})}),he=(0,a.forwardRef)((t,o)=>{const{data:i,onNavItemClick:c,className:u,theme:P,onPrimaryNavClick:m,groupCategories:l}=t,{event:p,profile:f}=(0,K.useNavContext)(),[b,E]=(0,a.useState)(!1),{locale:T="us"}=(0,q.useAiuiContext)(),[y,D]=(0,a.useState)(null),[F,S]=(0,a.useState)([]),H=(0,a.useRef)(null),[B,z]=(0,a.useState)(!1),G=(0,a.useRef)(null),U=(0,a.useRef)(null),k=(0,a.useRef)(null),I=(0,a.useRef)(l.map(n=>Array(n?.length||0).fill(null)));(0,a.useEffect)(()=>{l?.length&&S(l?.map((n,h)=>n?.map((N,C)=>({groupIndex:h,index:C,open:!1}))))},[l]);const g=(0,a.useMemo)(()=>{let n=null;for(const h of F){for(const N of h)if(N.open){n=N;break}if(n)break}return n},[F]);(0,ce.useScrollLock)(!!g?.open||B);const A=(n,h)=>{z(!1),c?.();const N=l?.flat()||[],C=N?.findIndex(X=>X?.id===l[n][h]?.id);m?.(N[C],C)},J=(n,h)=>{const N=l[n][h],C=N?.components?.[0];C&&C?.blockType!==r.HeaderNavigationBlockType.Links&&(D(N),S(Z=>Z.map(ee=>ee.map(oe=>oe.groupIndex===n&&oe.index===h?{...oe,open:!0}:{...oe,open:!1}))))},O=(n,h,N)=>{n.key==="Escape"&&g?.groupIndex===h&&g?.index===N&&(n.preventDefault(),L())},L=()=>{S(n=>n.map(h=>h.map(N=>({...N,open:!1}))))},d=()=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{L()},200)},_=()=>{k.current&&clearTimeout(k.current)},R=()=>{k.current&&clearTimeout(k.current)},ae=()=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{L()},200)},Q=(0,a.useMemo)(()=>{if(y)return y?.components?.[0]?.blockType},[y]),ne=(0,M.WithSidebar)(Te.SidebarDropdown,y),x=(0,M.WithResource)(Me.ResourceSidebarDropdown,y),Y=(0,M.WithMulticol)(De.MulticolDropdown,y),V=(0,M.WithSupports)(Le.SupportsDropdown,{categoriesItem:y,currentNavItemRef:I.current?.[g?.groupIndex||0]?.[g?.index||0]}),re=(0,a.useMemo)(()=>{switch(Q){case r.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(ne,{});case r.HeaderNavigationBlockType.Resource:return(0,e.jsx)(x,{});case r.HeaderNavigationBlockType.Supports:return(0,e.jsx)(V,{});case r.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(Y,{});default:return null}},[Q,y]),W=(0,a.useMemo)(()=>i?.bar?.actions?.filter(n=>n?.pcShow),[i]),j=(0,a.useMemo)(()=>W?.find(n=>n?.blockType===r.HeaderNavigationActionBlockType.Profile),[W]),$=(0,a.useCallback)(()=>{z(n=>!n)},[]);return(0,a.useEffect)(()=>{if(H?.current){const n=H.current;return n.addEventListener("click",$),()=>{n.removeEventListener("click",$)}}},[$]),(0,se.useGSAP)(()=>{g?.open&&U?.current&&te.gsap.fromTo(U?.current,{height:0},{height:"auto"})},[g?.open]),(0,e.jsxs)(s.Container,{className:(0,v.cn)("relative h-[92px]",u),children:[(0,e.jsxs)("div",{ref:G,onClick:L,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)(Ne,{}),(0,e.jsx)(de,{ref:H,actions:W,activeStatus:B})]}),(0,e.jsx)("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",onMouseEnter:_,onMouseLeave:d,children:l?.map((n,h)=>(0,e.jsx)("div",{className:"flex gap-3",children:n?.map((N,C)=>{const X=g?.groupIndex===h&&g?.index===C,Z=ve(N);return(0,e.jsx)("div",{ref:ee=>{I.current[h][C]=ee},className:"group",onMouseEnter:()=>J(h,C),children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("a",{href:(0,v.getLocalizedPath)(be(N),T,"ref=navMenu"),...Z?{target:Z}:{},rel:Z==="_blank"?"noopener noreferrer":void 0,className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4 no-underline",onClick:()=>A(h,C),onKeyDown:ee=>O(ee,h,C),"aria-expanded":X,"aria-haspopup":"true","aria-label":N.text,children:[(0,e.jsx)(s.Text,{html:N.text,className:"desktop:text-pretty text-nowrap text-sm font-bold leading-[1.4]"}),(0,e.jsx)(w.DownArrow,{className:(0,v.cn)("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":g?.groupIndex===h&&g?.index===C,"opacity-100":b&&g?.groupIndex===h&&g?.index===C,hidden:!fe(N)})})]}),(0,e.jsx)("div",{className:(0,v.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":X},P==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},N.id)})},`groupCategory-${h}`))})]}),(0,e.jsxs)("div",{role:"menu","aria-hidden":!(g?.open&&y),className:(0,v.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 - ${G?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:U,className:(0,v.cn)("relative z-50",{"overflow-hidden":Q!==r.HeaderNavigationBlockType.Supports}),onMouseEnter:()=>{R(),E(!0)},onMouseLeave:()=>{ae(),E(!1)},children:re}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:L,onMouseEnter:L,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:n=>{(n.key==="Enter"||n.key===" "||n.key==="Escape")&&(n.preventDefault(),L())}})]}),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% - ${H?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:f?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Text,{html:f?.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(n=>(0,e.jsx)(ue.MenuItem,{className:"py-2",label:n?.title,href:(0,v.getLocalizedPath)(n?.url,T,"ref=navMenu")},n.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(w.Polygon,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),(0,e.jsx)(s.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(n=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(s.Picture,{source:n.benefitIcon?.url,className:"size-4 shrink-0",alt:n.benefit,width:16,height:16}),(0,e.jsx)(s.Text,{html:n.benefit,className:"text-sm font-bold leading-[1.4]"})]},n.id))}),(0,e.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,e.jsx)(s.Button,{className:"grow",variant:"secondary",size:"lg",onClick:()=>p?.join?.(),children:(0,e.jsx)(s.Text,{html:j?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(s.Button,{className:"grow",variant:"primary",size:"lg",onClick:()=>p?.login?.(),children:(0,e.jsx)(s.Text,{html:j?.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:n=>{(n.key==="Enter"||n.key===" "||n.key==="Escape")&&(n.preventDefault(),z(!1))}})]})]})}),ye=(0,a.forwardRef)(({data:t,menuData:o,className:i,onPrimaryNavClick:c,onMobileMenuToggle:u},P)=>{const m=(0,a.useMemo)(()=>(0,M.WithGroupCategory)(t?.categories?.filter(d=>d?.mobileShow)),[t]),{currentMenu:l,setCurrentMenu:p,subSubCategory:f}=(0,K.useNavContext)(),[b,E]=(0,a.useState)(!1),[T,y]=(0,a.useState)(0),[D,F]=(0,a.useState)(null),S=(0,a.useRef)(null),H=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(S?.current&&b){const d=S?.current?.getBoundingClientRect();y(window?.innerHeight-(d?.top||0))}u?.({open:b})},[b,u]),(0,a.useEffect)(()=>{if(!b)return;const d=(0,me.default)(()=>{if(S?.current){const _=S.current.getBoundingClientRect();H.current=!0,y(window?.innerHeight-(_?.top||0))}},100);return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[b]),(0,se.useGSAP)(()=>{if(S.current){if(H.current){te.gsap.set(S.current,{height:T}),H.current=!1;return}te.gsap.fromTo(S.current,{height:0},{height:T,duration:.3})}},[T]),(0,ce.useScrollLock)(b);const B=(0,a.useMemo)(()=>D?.components?.[0]?.blockType,[D]),z=(0,M.WithSupports)(Ee.MobileSupportMenu,{categoriesItem:D}),G=(0,M.WithSidebar)(Pe.MobileSidebarMenu,D),U=(0,M.WithResource)(Se.MobileResourceSidebarMenu,D),k=(0,M.WithMulticol)(He.MobileMulticolMenu,D),I=(0,a.useMemo)(()=>{switch(B){case r.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(G,{});case r.HeaderNavigationBlockType.Resource:return(0,e.jsx)(U,{});case r.HeaderNavigationBlockType.Supports:return(0,e.jsx)(z,{});case r.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(k,{});default:return null}},[B,D,z]),g=(0,a.useCallback)(()=>{E(!1),y(0),p&&p(r.HeaderNavigationMenu.Primary)},[E,y,p]),A=(0,a.useMemo)(()=>t?.bar?.actions?.filter(d=>d?.mobileShow&&d?.blockType!==r.HeaderNavigationActionBlockType.Profile),[t]),J=(0,a.useMemo)(()=>t?.bar?.actions?.find(d=>d?.mobileShow&&d?.blockType===r.HeaderNavigationActionBlockType.Profile)||{},[t]),O=(0,a.useMemo)(()=>{switch(l){case r.HeaderNavigationMenu.Primary:return(0,e.jsx)(We,{actions:A,menuOpen:b,onMenuOpenClose:()=>{E(!1),y(0)},onMenuOpenClick:()=>E(!0)});case r.HeaderNavigationMenu.Secondary:return(0,e.jsx)(ke,{title:D?.text,onMenuOpenClose:g,onMenuBackClick:()=>p?.(r.HeaderNavigationMenu.Primary)});case r.HeaderNavigationMenu.Third:return(0,e.jsx)(ke,{title:f?.label,onMenuOpenClose:g,onMenuBackClick:()=>p?.(r.HeaderNavigationMenu.Secondary)});default:return null}},[b,l,p,D,A,f,g]),L=(0,a.useCallback)((d,_)=>{const R=Array.isArray(m)?Array.isArray(m[d])?m[d][_]:{}:{};R?.components?.[0]?.blockType!==r.HeaderNavigationBlockType.Links&&(F(R),p?.(r.HeaderNavigationMenu.Secondary))},[m,p]);return(0,e.jsxs)(s.Container,{className:(0,v.cn)("relative h-[56px]",i),children:[O,b&&(0,e.jsxs)("nav",{ref:S,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:T},role:"navigation","aria-label":"Mobile navigation menu",children:[l===r.HeaderNavigationMenu.Primary&&o?(0,e.jsx)("div",{className:"pt-4",children:(0,e.jsx)(s.BrandStrip,{data:o})}):null,l===r.HeaderNavigationMenu.Primary?(0,e.jsx)(Ke,{categories:m,onPrimaryMenuClick:L,onPrimaryNavClick:c,profileAction:J,menuData:o}):I]})]})}),Ke=({categories:t,onPrimaryMenuClick:o,profileAction:i,onPrimaryNavClick:c,menuData:u})=>{const{locale:P="us"}=(0,q.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:t?.map((m,l)=>(0,e.jsxs)("div",{className:"",children:[l>0||u?(0,e.jsx)("div",{className:(0,v.cn)("my-2 h-px w-full bg-[#E5E5E7]")}):null,m?.map((p,f)=>{const b=p.components?.[0]?.blockType===r.HeaderNavigationBlockType.Links;return(0,e.jsx)(ue.MenuItem,{label:p.text,href:b?(0,v.getLocalizedPath)(be(p),P,"ref=navMenu"):void 0,target:b?ve(p):void 0,onClick:()=>{const T=(t?.flat()||[])?.findIndex(y=>y?.id===t[l][f]?.id);o(l,f),c?.(p,T)},icon:p.components?.[0]?.icon},p.id)})]},`groupCategory-${l}`))}),(0,e.jsx)(Ue,{profileAction:i})]})},Ue=({profileAction:t})=>{const[o,i]=(0,a.useState)(!1),{profile:c,event:u}=(0,K.useNavContext)(),{locale:P="us"}=(0,q.useAiuiContext)();return(0,e.jsxs)("div",{className:(0,v.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":c?.nick_name||t?.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)(w.User,{"aria-hidden":"true"})}),(0,e.jsx)(s.Text,{html:c?.nick_name||t?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!c?.email&&(0,e.jsx)(w.DownArrow,{"aria-hidden":"true",className:(0,v.cn)("laptop:size-4 size-5",{"rotate-180":o})})]}),c?.email&&(0,e.jsx)("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:t?.profiles?.map(m=>(0,e.jsx)(ue.MenuItem,{label:m?.title,href:(0,v.getLocalizedPath)(m?.url,P,"ref=navMenu")},m.id))}),o&&!c?.email&&(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsx)(s.Text,{html:t?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:t?.benefits?.map(m=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(s.Picture,{source:m.benefitIcon?.url,className:"size-4",alt:m.benefit,width:16,height:16}),(0,e.jsx)(s.Text,{html:m.benefit,className:"text-sm font-bold leading-[1.4]"})]},m.id))})]}),!c?.email&&(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,e.jsx)(s.Button,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>u?.join?.(),children:(0,e.jsx)(s.Text,{html:t?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),(0,e.jsx)(s.Button,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>u?.login?.(),children:(0,e.jsx)(s.Text,{html:t?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},We=({menuOpen:t,onMenuOpenClose:o,onMenuOpenClick:i,actions:c})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(Ne,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(de,{actions:c}),t?(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)(w.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)(w.Menu,{className:"size-5","aria-hidden":"true"})})]})]}),Ne=()=>{const{payloadData:t,isMobile:o}=(0,K.useNavContext)(),{locale:i="us"}=(0,q.useAiuiContext)();return(0,e.jsx)("a",{href:(0,v.getLocalizedPath)("/",i,"ref=logo"),className:"hover:text-[#00CBEB] [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:o?t?.bar?.mobileLogo:t?.bar?.desktopLogo}})},de=(0,a.forwardRef)(({actions:t,activeStatus:o=!1},i)=>{const{event:c,cartCount:u}=(0,K.useNavContext)(),[P,m]=(0,a.useState)(null),l=f=>{switch(f){case r.HeaderNavigationActionBlockType.Search:return"Search";case r.HeaderNavigationActionBlockType.Cart:return`Shopping cart${u>0?` (${u} items)`:""}`;case r.HeaderNavigationActionBlockType.Profile:return"User profile";case r.HeaderNavigationActionBlockType.Livestream:return"Livestream";default:return"Action"}},p=(0,a.useCallback)((f,b)=>{switch(m(b),f?.blockType){case r.HeaderNavigationActionBlockType.Search:c?.search?.();break;case r.HeaderNavigationActionBlockType.Cart:c?.cart?.();break;case r.HeaderNavigationActionBlockType.Profile:c?.profile?.();break;case r.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(t)&&t?.map((f,b)=>(0,e.jsxs)("button",{className:"relative cursor-pointer border-0 bg-transparent p-0","data-tag":f?.tag||"",ref:f.blockType===r.HeaderNavigationActionBlockType.Profile?i:null,onClick:()=>p(f,b),"aria-label":l(f.blockType),"aria-pressed":o&&P===b,children:[(0,e.jsx)(s.Text,{html:f.icon,className:(0,v.cn)("size-5",{"text-brand-0":o&&P===b}),"aria-hidden":"true"}),f.blockType===r.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)(s.Text,{html:u?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},f.id))})}),ke=({title:t,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)(w.LeftArrow,{className:"size-5","aria-hidden":"true"})}),(0,e.jsx)(s.Text,{html:t,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)(w.Close,{className:"size-5","aria-hidden":"true"})})]});ye.displayName="MobileNavigation",de.displayName="Actions",ge.displayName="HeaderNavigation",he.displayName="DesktopNavigation";var Fe=(0,xe.withLayout)(ge);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(e,i)=>{for(var t in i)a(e,t,{get:i[t],enumerable:!0})},l=(e,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of m(i))!g.call(e,n)&&n!==t&&a(e,n,{get:()=>i[n],enumerable:!(o=p(i,n))||o.enumerable});return e};var v=e=>l(a({},"__esModule",{value:!0}),e);var b={};u(b,{HeaderNavigationActionBlockType:()=>d,HeaderNavigationBlockType:()=>c,HeaderNavigationMenu:()=>s});module.exports=v(b);var s=(o=>(o.Primary="primary",o.Secondary="secondary",o.Third="third",o))(s||{}),c=(r=>(r.Sidebar="ipc-navigation-sidebar",r.Supports="ipc-navigation-supports",r.Multicol="ipc-navigation-multicol",r.Links="ipc-navigation-links",r.Resource="ipc-navigation-resource",r))(c||{}),d=(n=>(n.Search="ipc-navigation-action-search",n.Cart="ipc-navigation-action-cart",n.Profile="ipc-navigation-action-profile",n.Livestream="ipc-navigation-action-livestream",n))(d||{});
|