@anker-in/headless-ui 1.3.84 → 1.3.86
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/README.md +6 -0
- package/dist/cjs/biz-components/AccordionCards/index.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +4 -3
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
- package/dist/cjs/biz-components/ActivityMechanism/index.d.ts +4 -7
- package/dist/cjs/biz-components/ActivityMechanism/index.js +1 -1
- package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/AnchorNavigation/index.js +1 -1
- package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/PriceAndActions.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/PriceAndActions.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +4 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductInfo.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductInfo.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/tracking.d.ts +20 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/tracking.js +1 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/types.d.ts +2 -0
- package/dist/cjs/biz-components/Category/index.d.ts +4 -2
- package/dist/cjs/biz-components/Category/index.js +1 -1
- package/dist/cjs/biz-components/Chat/action.d.ts +25 -0
- package/dist/cjs/biz-components/Chat/action.js +1 -0
- package/dist/cjs/biz-components/Chat/button.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/button.js +1 -0
- package/dist/cjs/biz-components/Chat/chatContext.d.ts +101 -0
- package/dist/cjs/biz-components/Chat/chatContext.js +1 -0
- package/dist/cjs/biz-components/Chat/exports.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/exports.js +1 -0
- package/dist/cjs/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
- package/dist/cjs/biz-components/Chat/helpers/fetchResponse.js +1 -0
- package/dist/cjs/biz-components/Chat/helpers/fetcher.d.ts +2 -0
- package/dist/cjs/biz-components/Chat/helpers/fetcher.js +1 -0
- package/dist/cjs/biz-components/Chat/index.d.ts +71 -0
- package/dist/cjs/biz-components/Chat/index.js +1 -0
- package/dist/cjs/biz-components/Chat/markdown.d.ts +5 -0
- package/dist/cjs/biz-components/Chat/markdown.js +1 -0
- package/dist/cjs/biz-components/Chat/messages.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/messages.js +1 -0
- package/dist/cjs/biz-components/Chat/props.d.ts +43 -0
- package/dist/cjs/biz-components/Chat/props.js +1 -0
- package/dist/cjs/biz-components/Chat/response.d.ts +4 -0
- package/dist/cjs/biz-components/Chat/response.js +1 -0
- package/dist/cjs/biz-components/Chat/suggestions.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/suggestions.js +1 -0
- package/dist/cjs/biz-components/Chat/utils.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/utils.js +1 -0
- package/dist/cjs/biz-components/Evaluate/index.js +1 -1
- package/dist/cjs/biz-components/EventSchedule/index.js +1 -1
- package/dist/cjs/biz-components/Faq/Faq.d.ts +3 -1
- package/dist/cjs/biz-components/Faq/Faq.js +2 -2
- package/dist/cjs/biz-components/FeatureCards/FeatureCards.js +1 -1
- package/dist/cjs/biz-components/GiftShelf/index.js +1 -1
- package/dist/cjs/biz-components/GiftTierShelf/index.js +1 -1
- package/dist/cjs/biz-components/Graphic/index.js +1 -1
- package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
- package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerMulti/index.js +1 -1
- package/dist/cjs/biz-components/MemberEquity/index.js +2 -2
- package/dist/cjs/biz-components/MiniCart/index.js +1 -1
- package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
- package/dist/cjs/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/cjs/biz-components/PromotionalBar/index.d.ts +3 -2
- package/dist/cjs/biz-components/PromotionalBar/index.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductsPanel.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/Root.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/context.d.ts +11 -1
- package/dist/cjs/biz-components/SceneShelf/context.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/types.d.ts +5 -0
- package/dist/cjs/biz-components/SearchPage/index.js +1 -1
- package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/cjs/biz-components/Title/index.js +1 -1
- package/dist/cjs/components/container.js +1 -1
- package/dist/cjs/helpers/utils.js +1 -1
- package/dist/cjs/shared/track.d.ts +13 -7
- package/dist/cjs/shared/track.js +1 -1
- package/dist/esm/biz-components/AccordionCards/index.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +4 -3
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
- package/dist/esm/biz-components/ActivityMechanism/index.d.ts +4 -7
- package/dist/esm/biz-components/ActivityMechanism/index.js +1 -1
- package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/AnchorNavigation/index.js +1 -1
- package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/PriceAndActions.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/PriceAndActions.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +4 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductInfo.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductInfo.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/tracking.d.ts +20 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/tracking.js +1 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/types.d.ts +2 -0
- package/dist/esm/biz-components/Category/index.d.ts +4 -2
- package/dist/esm/biz-components/Category/index.js +1 -1
- package/dist/esm/biz-components/Chat/action.d.ts +25 -0
- package/dist/esm/biz-components/Chat/action.js +1 -0
- package/dist/esm/biz-components/Chat/button.d.ts +3 -0
- package/dist/esm/biz-components/Chat/button.js +1 -0
- package/dist/esm/biz-components/Chat/chatContext.d.ts +101 -0
- package/dist/esm/biz-components/Chat/chatContext.js +1 -0
- package/dist/esm/biz-components/Chat/exports.d.ts +3 -0
- package/dist/esm/biz-components/Chat/exports.js +1 -0
- package/dist/esm/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
- package/dist/esm/biz-components/Chat/helpers/fetchResponse.js +1 -0
- package/dist/esm/biz-components/Chat/helpers/fetcher.d.ts +2 -0
- package/dist/esm/biz-components/Chat/helpers/fetcher.js +1 -0
- package/dist/esm/biz-components/Chat/index.d.ts +71 -0
- package/dist/esm/biz-components/Chat/index.js +1 -0
- package/dist/esm/biz-components/Chat/markdown.d.ts +5 -0
- package/dist/esm/biz-components/Chat/markdown.js +1 -0
- package/dist/esm/biz-components/Chat/messages.d.ts +3 -0
- package/dist/esm/biz-components/Chat/messages.js +1 -0
- package/dist/esm/biz-components/Chat/props.d.ts +43 -0
- package/dist/esm/biz-components/Chat/props.js +1 -0
- package/dist/esm/biz-components/Chat/response.d.ts +4 -0
- package/dist/esm/biz-components/Chat/response.js +1 -0
- package/dist/esm/biz-components/Chat/suggestions.d.ts +3 -0
- package/dist/esm/biz-components/Chat/suggestions.js +1 -0
- package/dist/esm/biz-components/Chat/utils.d.ts +3 -0
- package/dist/esm/biz-components/Chat/utils.js +1 -0
- package/dist/esm/biz-components/Evaluate/index.js +1 -1
- package/dist/esm/biz-components/EventSchedule/index.js +1 -1
- package/dist/esm/biz-components/Faq/Faq.d.ts +3 -1
- package/dist/esm/biz-components/Faq/Faq.js +2 -2
- package/dist/esm/biz-components/FeatureCards/FeatureCards.js +1 -1
- package/dist/esm/biz-components/GiftShelf/index.js +1 -1
- package/dist/esm/biz-components/GiftTierShelf/index.js +1 -1
- package/dist/esm/biz-components/Graphic/index.js +1 -1
- package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
- package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerMulti/index.js +1 -1
- package/dist/esm/biz-components/MemberEquity/index.js +2 -2
- package/dist/esm/biz-components/MiniCart/index.js +1 -1
- package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
- package/dist/esm/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/esm/biz-components/PromotionalBar/index.d.ts +3 -2
- package/dist/esm/biz-components/PromotionalBar/index.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductsPanel.js +1 -1
- package/dist/esm/biz-components/SceneShelf/Root.js +1 -1
- package/dist/esm/biz-components/SceneShelf/context.d.ts +11 -1
- package/dist/esm/biz-components/SceneShelf/context.js +1 -1
- package/dist/esm/biz-components/SceneShelf/types.d.ts +5 -0
- package/dist/esm/biz-components/SearchPage/index.js +1 -1
- package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/esm/biz-components/Title/index.js +1 -1
- package/dist/esm/components/container.js +1 -1
- package/dist/esm/helpers/utils.js +1 -1
- package/dist/esm/shared/track.d.ts +13 -7
- package/dist/esm/shared/track.js +1 -1
- package/dist/tokens/base.css +48 -0
- package/package.json +50 -3
- package/src/biz-components/Chat/styles/chat.css +14 -0
- package/src/biz-components/Chat/styles/css/animations.css +35 -0
- package/src/biz-components/Chat/styles/css/button.css +56 -0
- package/src/biz-components/Chat/styles/css/colors.css +12 -0
- package/src/biz-components/Chat/styles/css/console.css +134 -0
- package/src/biz-components/Chat/styles/css/header.css +43 -0
- package/src/biz-components/Chat/styles/css/input.css +89 -0
- package/src/biz-components/Chat/styles/css/markdown.css +131 -0
- package/src/biz-components/Chat/styles/css/messages.css +85 -0
- package/src/biz-components/Chat/styles/css/panel.css +23 -0
- package/src/biz-components/Chat/styles/css/popup.css +44 -0
- package/src/biz-components/Chat/styles/css/response.css +25 -0
- package/src/biz-components/Chat/styles/css/sidebar.css +31 -0
- package/src/biz-components/Chat/styles/css/suggestions.css +36 -0
- package/src/biz-components/Chat/styles/css/window.css +60 -0
- package/src/biz-components/Chat/styles/image.png +0 -0
- package/style.css +9 -12
- package/tailwind.config.js +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Fragment as ne,jsx as t,jsxs as re}from"react/jsx-runtime";import{useMemo as W}from"react";import{useCallback as h,useState as a,useEffect as _}from"react";import{CopilotKit as X}from"@copilotkit/react-core";import{CopilotPopup as Y}from"@copilotkit/react-ui";import Z from"./button.js";import j from"./messages.js";import ee from"./response.js";import te from"./suggestions.js";import{CopilotAction as oe}from"./action.js";import b from"./helpers/fetcher.js";const se=P=>{const{title:k,runtimeUrl:i,popup:f,shopifyDomain:p,userId:s="",account:c="",prologue:x="",locale:l="",query:n="",messagesCallback:B,showResponseButton:y,gotocheckoutRender:O,commonRender:v,shulexRender:w,pointsExchangeCouponRender:S,gotocartRender:M,addtocartRender:$,productRender:q,signupRender:D,addtocartHandler:K,style:N,className:I="",lang:u}=P,[H,U]=u?.popupTipTimeout||[3e3,6e3],[C,g]=a(!1),[d,G]=a(!1),[r,A]=a(x),[F,m]=a([]),[T,L]=a([]),R=W(()=>({"x-user-id":s||"","x-shopify-domain":p,"x-member-ship":c,"x-user-locale":l}),[s,p,c,l]),z=h(async()=>{const e=await b({url:`${i}/copilotkit/start${n}`,method:"GET",headers:R});m(e?.suggested_questions?.map(o=>({message:o,title:o}))||[]),A(e?.opening_statement||""),L(e?.history||[])},[s,p,c,l,n]),J=h(async()=>{const e=await b({url:`${i}/copilotkit/suggested_questions${n}`,method:"GET",headers:R});m(e?.suggested_questions?.data?.map(o=>({message:o,title:o}))||[])},[s,p,c,l,n]),Q=()=>{C||g(!0),setTimeout(()=>{g(!1)},U)};return _(()=>{const e=setTimeout(()=>{Q()},H);return()=>{clearTimeout(e)}},[]),t("div",{className:I,style:N||{},children:s&&i&&t(X,{runtimeUrl:`${i}/copilotkit/chat${n}`,showDevConsole:!1,headers:R,children:t(Y,{...f,showResponseButton:y!=="follow",labels:{title:k||"DTC Live Chat",initial:r||""},instructions:r||"",onInProgress:e=>{d&&e&&m([]),d&&!e&&J()},Messages:({messages:e,inProgress:o})=>t(j,{messages:e,inProgress:o,messagesCallback:B,ResponseButton:y==="follow"?t(ee,{messagesId:e?.[e.length-1]?.id}):void 0,children:t(te,{currentSuggestions:F})}),Button:({open:e,setOpen:o})=>{const V=f?.Button||Z;_(()=>{G(e)},[e]);const E=h(()=>{o(!e),g(!1),(!r||!T?.length)&&z()},[r]);return re(ne,{children:[u?.popupTip&&C&&!d&&t("div",{className:"copilotKitPopup copilotKitPopupTip",children:t("button",{onClick:E,"aria-label":"Open Chat",className:"copilotKitPopupTipContent",children:u?.popupTip})}),t(V,{open:e,setOpen:E})]})},children:t(oe,{start:r,history:T,commonRender:v,shulexRender:w,pointsExchangeCouponRender:S,gotocartRender:M,gotocheckoutRender:O,addtocartRender:$,signupRender:D,productRender:q,addtocartHandler:K,productRenderTipMessage:u?.productRenderTipMessage})})})})};var fe=se;export{fe as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{memo as n}from"react";import t from"react-markdown";import a from"remark-gfm";import m from"remark-math";const p=n(t,(o,e)=>o.children===e.children&&o.className===e.className),k=({content:o})=>r("div",{className:"copilotKitMarkdown",children:r(p,{components:i,remarkPlugins:[a,m],children:o})}),i={p({children:o}){return r("p",{children:o})},a({children:o,...e}){return r("a",{style:{color:"blue",textDecoration:"underline"},...e,target:"_blank",rel:"noopener noreferrer",children:o})}};export{k as Markdown};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n,jsxs as h}from"react/jsx-runtime";import K,{useEffect as f,useMemo as I,useState as L}from"react";import{useChatContext as T}from"@copilotkit/react-ui";import{Markdown as C}from"./markdown.js";import{useCopilotContext as w}from"@copilotkit/react-core";import{MessageStatusCode as H,ActionExecutionMessage as A,ResultMessage as k,TextMessage as g,Role as S}from"@copilotkit/runtime-client-gql";const b=({messages:t,inProgress:o,ResponseButton:p,messagesCallback:R,children:x})=>{const[d,a]=L(!0),{chatComponentsCache:M}=w(),r=T();t=[...I(()=>B(r.labels.initial),[r.labels.initial]),...t];const v={};for(let e=0;e<t.length;e++)if(t[e]instanceof A){const s=t[e].id,i=t.find(c=>c instanceof k&&c.actionExecutionId===s);i&&(v[s]=k.decodeResult(i.result||""))}const y=K.useRef(null),E=K.useRef(null),m=()=>{y.current&&y.current.scrollIntoView({behavior:"auto"})};return f(()=>{m()},[t]),f(()=>{R&&R(t)},[t]),f(()=>{const e=document.querySelector(".copilotKitInput textarea");e&&e.addEventListener("click",function(){e.value&&document.activeElement===e?a(!1):(a(!0),m())}),e&&e.addEventListener("input",function(){e.value&&document.activeElement===e?a(!1):(a(!0),m())})},[]),f(()=>{const e=E.current;d&&e?(e.style.maxHeight="500px",e.style.overflow="visible"):!d&&e&&(e.style.maxHeight="0",e.style.overflow="hidden")},[d]),h("div",{className:"copilotKitMessages",children:[t.map((e,s)=>{const i=s===t.length-1;if(e instanceof g&&e.role==="user")return n("div",{className:"copilotKitMessage copilotKitUserMessage",children:n(C,{content:e.content})},s);if(e instanceof g&&e.role=="assistant")return n("div",{className:"copilotKitMessage copilotKitAssistantMessage",children:i&&o&&!e.content?r.icons.spinnerIcon:n(C,{content:e.content})},s);if(e instanceof A)if(M.current!==null&&M.current[e.name]){const c=M.current[e.name];if(typeof c=="string")return i&&o?h("div",{className:"copilotKitMessage copilotKitAssistantMessage",children:[r.icons.spinnerIcon," ",n("span",{className:"inProgressLabel",children:c})]},s):null;{const N=e.arguments;let l="inProgress";v[e.id]!==void 0?l="complete":e.status.code!==H.Pending&&(l="executing");const u=c({status:l,args:N,result:v[e.id]});return!u&&l==="complete"?null:typeof u=="string"?h("div",{className:"copilotKitMessage copilotKitAssistantMessage",children:[i&&o&&r.icons.spinnerIcon," ",u]},s):n("div",{className:"copilotKitCustomAssistantMessage",children:u},s)}}else return!o||!i?null:n("div",{className:"copilotKitMessage copilotKitAssistantMessage",children:r.icons.spinnerIcon},s)}),n("div",{className:"responseButtonBox",children:p}),n("footer",{ref:y,children:n("div",{className:"copilotKitMessagesFooter",ref:E,children:x})})]})};function B(t){let o=[];return t&&(Array.isArray(t)?o.push(...t):o.push(t)),o.map(p=>new g({role:S.Assistant,content:p}))}var z=b;export{z as default};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Message } from '@copilotkit/runtime-client-gql';
|
|
3
|
+
export interface ButtonProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
setOpen: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface WindowProps {
|
|
8
|
+
open: boolean;
|
|
9
|
+
setOpen: (open: boolean) => void;
|
|
10
|
+
clickOutsideToClose: boolean;
|
|
11
|
+
hitEscapeToClose: boolean;
|
|
12
|
+
shortcut: string;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export interface HeaderProps {
|
|
16
|
+
open: boolean;
|
|
17
|
+
setOpen: (open: boolean) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface ChatSuggestions {
|
|
20
|
+
currentSuggestions: SuggestionsProps[];
|
|
21
|
+
}
|
|
22
|
+
export interface SuggestionsProps {
|
|
23
|
+
title: string;
|
|
24
|
+
message: string;
|
|
25
|
+
partial?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface MessagesProps {
|
|
29
|
+
messages: Message[];
|
|
30
|
+
inProgress: boolean;
|
|
31
|
+
ResponseButton?: React.ReactElement;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
messagesCallback?: (messages: any) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface InputProps {
|
|
36
|
+
inProgress: boolean;
|
|
37
|
+
onSend: (text: string) => Promise<Message>;
|
|
38
|
+
isVisible?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ResponseButtonProps {
|
|
41
|
+
onClick: () => void;
|
|
42
|
+
inProgress: boolean;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"react";import"@copilotkit/runtime-client-gql";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as i}from"react/jsx-runtime";import{useChatContext as n}from"@copilotkit/react-ui";import{useCopilotChat as a}from"@copilotkit/react-core";const p=({messagesId:c})=>{const e=n(),{isLoading:o,reloadMessages:s,stopGeneration:t}=a();return!o&&i("button",{onClick:()=>o?t():s(),className:"copilotKitResponseButton",children:[o?e.labels.stopGenerating:e.labels.regenerateResponse,r("span",{children:o?e.icons.stopIcon:e.icons.regenerateIcon})]})};var u=p;export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{useCopilotChat as u}from"@copilotkit/react-core";import{Role as l,TextMessage as m}from"@copilotkit/runtime-client-gql";const d=({currentSuggestions:o})=>{const{appendMessage:e}=u();return o?.length>0&&s("div",{className:"suggestions",children:o.map(({title:n,message:t,partial:p,className:a},g)=>s("button",{disabled:p,onClick:i=>{i.preventDefault();const r=new m({content:t,role:l.User});e(r)},className:a||"suggestion",children:s("span",{children:n})},t+g))})};var C=d;export{C as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { useCopilotChat, useCopilotAction, useCopilotReadable } from '@copilotkit/react-core';
|
|
2
|
+
import { Role, ActionExecutionMessage, TextMessage } from '@copilotkit/runtime-client-gql';
|
|
3
|
+
export { useCopilotChat, useCopilotAction, useCopilotReadable, Role, ActionExecutionMessage, TextMessage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useCopilotChat as o,useCopilotAction as e,useCopilotReadable as t}from"@copilotkit/react-core";import{Role as i,ActionExecutionMessage as s,TextMessage as p}from"@copilotkit/runtime-client-gql";export{s as ActionExecutionMessage,i as Role,p as TextMessage,e as useCopilotAction,o as useCopilotChat,t as useCopilotReadable};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as r}from"react/jsx-runtime";import h,{useImperativeHandle as g,useRef as x,useState as k}from"react";import{createPortal as y}from"react-dom";import N from"../Title/index.js";import{cn as n,getLocalizedPath as M}from"../../helpers/utils.js";import L from"../../components/picture.js";import T from"../SwiperBox/index.js";import{withLayout as C}from"../../shared/Styles.js";import{Avatar as E,AvatarImage as P,AvatarFallback as z}from"../../components/avatar.js";import{Container as A}from"../../components/container.js";import{Text as B}from"../../components/text.js";import{useExposure as R}from"../../hooks/useExposure.js";import{trackUrlRef as I}from"../../shared/trackUrlRef.js";import{useAiuiContext as F}from"../AiuiProvider/index.js";import{useTracking as H}from"../../hooks/useTracking.js";const u="copy",f="product_review",$=({data:e,configuration:o})=>{const{buildRef:d}=H(),p=x(null),[s,m]=k({visible:!1,x:0,y:0,text:""}),a=i=>{const l=Number(i),w=Number.isFinite(l)?Math.max(0,Math.floor(l)):0;return Array.from({length:w})||[]},c=i=>{e?.description&&m({visible:!0,x:i.clientX,y:i.clientY,text:e.description})},v=()=>{m(i=>({...i,visible:!1}))};return R(p,{componentType:u,componentName:f,componentTitle:e?.title,componentDescription:e?.description,position:o?.index+1}),t("div",{ref:p,className:n("bg-background tablet:hover:bg-info-white box-border w-full overflow-hidden duration-300","rounded-box","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]","laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative","md-tablet:h-[360px]"),children:r("div",{className:"desktop:p-6 absolute inset-0 box-border flex flex-col overflow-hidden p-4",children:[r("div",{className:n("lg-desktop:mb-16 desktop:mb-10 mb-8 flex w-full justify-between"),children:[r("div",{className:"flex-1",children:[e?.title?t("h4",{className:"laptop:text-lg text-sm font-bold",children:e?.title}):null,t("div",{className:"mt-1 flex items-center",children:a(e?.rating)?.map?.((i,l)=>t("div",{className:"mr-1",children:t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:t("path",{d:"M7.32745 1.36274C7.60256 0.805304 8.39744 0.805305 8.67255 1.36274L10.1766 4.41035C10.2859 4.63171 10.4971 4.78514 10.7413 4.82063L14.1046 5.30934C14.7197 5.39873 14.9654 6.15471 14.5202 6.58861L12.0866 8.96084C11.9098 9.13315 11.8292 9.3814 11.8709 9.62469L12.4454 12.9743C12.5505 13.587 11.9074 14.0542 11.3572 13.765L8.349 12.1835C8.13051 12.0686 7.86949 12.0686 7.65099 12.1835L4.64282 13.765C4.0926 14.0542 3.44953 13.587 3.55461 12.9743L4.12912 9.62469C4.17085 9.3814 4.09019 9.13315 3.91342 8.96084L1.47976 6.58861C1.03462 6.15471 1.28025 5.39873 1.89542 5.30934L5.25866 4.82063C5.50294 4.78514 5.71412 4.63171 5.82336 4.41035L7.32745 1.36274Z",fill:"#F77234"})})},l))})]}),t("div",{className:"desktop:size-12 size-10 overflow-hidden",children:e?.avatar?.url?r(E,{className:"size-full",isAdaptation:!e?.avatar?.url,children:[t(P,{src:e?.avatar?.url}),t(z,{children:e?.title})]}):null})]}),r("div",{className:"flex-1",onMouseMove:c,onMouseLeave:v,children:[t(B,{className:n("lg-desktop:text-2xl text-info-primary evaluate-description line-clamp-5 break-words text-xl font-bold leading-[1.2]"),children:e?.description||""}),typeof window<"u"&&s.visible&&y(t("div",{className:"pointer-events-none fixed z-[9999] max-w-xs rounded-lg bg-black/60 px-3 py-2 text-sm text-white shadow-lg backdrop-blur-sm transition-opacity duration-200",style:{left:`${s.x+16}px`,top:`${s.y+16}px`},children:s.text}),document.body)]}),t("a",{href:I(M(e?.link||"",o?.locale||"us"),d(u,f)),onClick:()=>{o?.event?.primaryButton(e,o?.index+1)},"data-headless-type-name":`${u}#${f}`,"data-headless-title-desc-button":`${e?.title}#${e?.description||e?.subTitle}`,"data-headless-nav-position":`''#${o?.index+1}`,children:r("div",{className:n("mt-3 flex cursor-pointer items-center overflow-hidden bg-[#F7F8F9] p-3","rounded-box"),children:[t("div",{className:"laptop:size-16 desktop:size-20 mr-3 flex size-12 items-center",children:t(L,{className:"w-full object-cover",source:e?.img?.url,alt:e?.img?.alt||""})}),t("p",{className:"lg-desktop:text-[18px] desktop-[16px] line-clamp-2 flex-1 text-[14px] font-bold tracking-[-0.04em]",children:e?.subTitle||""})]})})]})})},b=h.forwardRef(({className:e="",data:o,key:d,...p},s)=>{const{products:m,title:a,theme:c,...v}=o,i=x(null),{locale:l="us"}=F();return g(s,()=>i.current),t("div",{...p,ref:i,className:e,children:t("div",{className:"evaluate-box relative z-10",children:t(A,{...o?.containerProps||{},className:"overflow-hidden",children:r("div",{ref:s,className:n("w-full",e,{"aiui-dark":c==="dark"}),children:[a&&t(N,{data:{title:a}}),t(T,{className:"!overflow-visible",id:"Evaluate"+d,data:{list:m,configuration:{...v,title:a,locale:l}},Slide:$,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}})]})})})})});b.displayName="Evaluate";var Q=C(b);export{Q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n,jsxs as f}from"react/jsx-runtime";import*as r from"react";import{cn as l}from"../../helpers/index.js";import{withLayout as W}from"../../shared/Styles.js";import{Text as V,Picture as q,Heading as Z}from"../../components/index.js";import{Swiper as A,SwiperSlide as B}from"swiper/react";import{cva as b}from"class-variance-authority";import{buildSsrSlideCss as H}from"../SwiperBox/buildSsrSlideCss.js";import{useExposure as G}from"../../hooks/useExposure.js";const J="image",K="event_schedule",y=(e,s)=>{const d=Date.now(),c=new Date(e).getTime(),m=new Date(s).getTime();return d>m?"completed":d<c?"not-started":"in-progress"},O=b("h-1 w-full overflow-hidden",{variants:{state:{"in-progress-light":"bg-[#F6CD4E]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F6CD4E]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),Q=b("size-4 rounded-full transition-colors",{variants:{state:{"in-progress-light":"bg-[#F6CD4E]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F6CD4E]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),D=b("font-bold leading-[1.2]",{variants:{state:{"in-progress-light":"text-[#080A0F]","in-progress-dark":"text-white","not-started-light":"text-[#080A0F]","not-started-dark":"text-[#F5F6F7]","completed-light":"text-[#4A4C56]/60","completed-dark":"text-[#F5F6F7]/60"}},defaultVariants:{state:"not-started-light"}}),U=b("laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden",{variants:{state:{"in-progress-light":"bg-[#F4E8BC]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F4E8BC]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),X=({timeStatus:e,theme:s="light",className:d,index:c,nodeLength:m})=>{const o=`${e}-${s}`,a=c===0,i=c===m-1;return f("div",{className:l(`event-schedule-timeline-node event-schedule-timeline-node--${e} relative my-2 flex h-1 w-full items-center justify-center`,d),children:[n("div",{className:l(`event-schedule-timeline-progress event-schedule-timeline-progress--${e}`,O({state:o}),a&&"rounded-l-full",i&&"rounded-r-full")}),n("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:n("div",{className:l(`event-schedule-timeline-dot event-schedule-timeline-dot--${e}`,Q({state:o}))})})]})},Y=(e,s)=>{if(e)return s==="in-progress"?e.active:s==="completed"&&e.completed||e.inactive},ee=({timeStatus:e,item:s,theme:d="light",className:c,scheduleCount:m})=>{const o=r.useMemo(()=>Y(s.icon,e),[s.icon,e]),a=`${e}-${d}`;return f("div",{className:l(`event-schedule-card event-schedule-card--${e}`,U({state:a}),c),children:[o&&n("div",{className:`event-schedule-card__background-icon event-schedule-card__background-icon--${e} laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]`,children:n(q,{source:o.url,alt:o.alt,className:"aspect-square"})}),f("div",{className:`event-schedule-card__content event-schedule-card__content--${e} tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8`,children:[n(Z,{html:s.title,className:l(`event-schedule-card__title event-schedule-card__title--${e}`,m>=4?"desktop:text-[24px]":"desktop:text-[32px]","laptop:text-[24px] line-clamp-1 text-[20px]",D({state:a}))}),n("div",{className:`event-schedule-card__details event-schedule-card__details--${e} flex flex-col gap-0.5`,children:s.items.map((i,h)=>f("div",{className:`event-schedule-card__detail-item event-schedule-card__detail-item--${e} flex items-center gap-2`,children:[i.icon&&n(V,{className:l(`event-schedule-card__detail-icon event-schedule-card__detail-icon--${e} desktop:size-6 size-5 shrink-0`,D({state:a})),html:i.icon}),n(V,{html:i.label,className:l(`event-schedule-card__detail-text event-schedule-card__detail-text--${e} lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]`,D({state:a}))})]},h))})]})]})},P=r.forwardRef(({classNames:e={},data:s,className:d,...c},m)=>{const o=s.theme||"light",a=r.useRef(null);r.useImperativeHandle(m,()=>a.current),G(a,{componentType:J,componentName:K,componentTitle:s.scheduleList?.[0]?.title});const i=r.useRef(null),h=r.useRef(null),u=r.useRef(!1),v=r.useMemo(()=>s?.scheduleList?.length||2,[s?.scheduleList]),S=r.useMemo(()=>s.scheduleList.findIndex(t=>y(t.startDate,t.endDate)==="in-progress"),[s.scheduleList]),w=r.useCallback((t,g=!1)=>{const p=j=>{switch(j){case"mobile":return{slidesPerView:1.17};case"tablet":return t===2?{slidesPerView:2}:{slidesPerView:2.4};case"laptop":return t===2?{}:t===4?{slidesPerView:3.2}:{slidesPerView:t};case"desktop":return t===2?{slidesPerView:2}:{slidesPerView:t}}},M=p("mobile"),$=p("tablet"),I=p("laptop"),F=p("desktop");return g?{0:{...M,spaceBetween:12},768:{...$,spaceBetween:12},1024:{...I,spaceBetween:16},1440:{...F,spaceBetween:16}}:{0:M,768:$,1024:I,1440:F}},[]),x=r.useMemo(()=>w(v,!0),[v,w]),k=r.useMemo(()=>w(v,!1),[v,w]),L=r.useId().replace(/[^a-zA-Z0-9_-]/g,""),T=`swiper-ssr-timeline-${L}`,E=`swiper-ssr-cards-${L}`,C=r.useMemo(()=>H(`.${T}`,k),[T,k]),_=r.useMemo(()=>H(`.${E}`,x),[E,x]),N=s.showTimeline!==!1,R=r.useCallback(t=>{u.current||!h.current||(u.current=!0,h.current.slideTo(t.activeIndex,t.params.speed),setTimeout(()=>{u.current=!1},50))},[]),z=r.useCallback(t=>{u.current||!i.current||(u.current=!0,i.current.slideTo(t.activeIndex,t.params.speed),setTimeout(()=>{u.current=!1},50))},[]);return r.useEffect(()=>{i.current&&h.current&&S>=0&&setTimeout(()=>{u.current=!0,i.current?.slideTo(S,500),h.current?.slideTo(S,500),setTimeout(()=>{u.current=!1},600)},100)},[S]),f("div",{...c,ref:a,className:l("event-schedule-root overflow-hidden",e?.root,d),children:[N&&C&&n("style",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:C}}),_&&n("style",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:_}}),N&&n(A,{breakpoints:k,className:l("event-schedule-timeline h-4 w-full !overflow-visible",C&&T),onSwiper:t=>{h.current=t},onSlideChange:z,children:s.scheduleList.map((t,g)=>{const p=y(t.startDate,t.endDate);return n(B,{className:"",children:n(X,{className:e?.timeline,timeStatus:p,theme:o,index:g,nodeLength:s.scheduleList.length})},"timelineNode"+g)})}),n(A,{breakpoints:x,className:l("event-schedule-cards w-full !overflow-visible",_&&E),onSwiper:t=>{i.current=t},onSlideChange:R,children:s.scheduleList.map((t,g)=>{const p=y(t.startDate,t.endDate);return n(B,{children:n(ee,{timeStatus:p,className:l(N?"laptop:mt-4 mt-2":"",e?.eventScheduleCard),item:t,theme:o,scheduleCount:s.scheduleList.length})},"SwiperSlideItem"+g)})})]})});P.displayName="EventSchedule";var oe=W(P);export{oe as default};
|
|
@@ -3,10 +3,12 @@ import type { FaqProps, FaqItem as ItemType, FaqSemanticName } from './types.js'
|
|
|
3
3
|
interface FaqItemProps {
|
|
4
4
|
data: ItemType;
|
|
5
5
|
index: number;
|
|
6
|
+
/** 当前是否展开,用于点击埋点区分 expand / collapse;不传时按收起处理 */
|
|
7
|
+
isOpen?: boolean;
|
|
6
8
|
classNames?: Partial<Record<FaqSemanticName, string>>;
|
|
7
9
|
}
|
|
8
10
|
declare const FaqItem: {
|
|
9
|
-
({ data, index, classNames }: FaqItemProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
({ data, index, isOpen, classNames }: FaqItemProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
displayName: string;
|
|
11
13
|
};
|
|
12
14
|
declare const _default: React.ForwardRefExoticComponent<Omit<FaqProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../index.js").ContainerProps & React.RefAttributes<unknown>> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as d}from"react/jsx-runtime";import u,{useImperativeHandle as b,useRef as w}from"react";import*as r from"@radix-ui/react-accordion";import{Text as F,Heading as D}from"../../components/index.js";import{cn as a}from"../../helpers/index.js";import{withLayout as N}from"../../shared/Styles.js";import{useExposure as T}from"../../hooks/useExposure.js";import{toPlainTrackingText as g}from"../../shared/track.js";const h="copy",y="faq",x=u.forwardRef(({data:e,className:s,defaultOpenIndex:i,classNames:o={}},n)=>{const c=w(null);b(n,()=>c.current),T(c,{componentType:h,componentName:y,componentTitle:e?.productData?.[0]?.title,componentDescription:e?.productData?.[0]?.richDesc??e?.productData?.[0]?.desc});const v=(Array.isArray(i)?i:i!==void 0?[i]:e?.openFirst??!0?[0]:[]).map(m=>`item-${m}`),[f,q]=u.useState(v);return d("div",{ref:c,className:a(s,o.root),children:[t("style",{children:`
|
|
2
2
|
@keyframes faq-slide-down {
|
|
3
3
|
from { height: 0; opacity: 0; }
|
|
4
4
|
to { height: var(--radix-accordion-content-height); opacity: 1; }
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
from { height: var(--radix-accordion-content-height); opacity: 1; }
|
|
8
8
|
to { height: 0; opacity: 0; }
|
|
9
9
|
}
|
|
10
|
-
`}),t(r.Root,{type:"multiple",
|
|
10
|
+
`}),t(r.Root,{type:"multiple",value:f,onValueChange:q,children:e?.productData?.map((m,p)=>t(l,{data:m,index:p,classNames:o,isOpen:f.includes(`item-${p}`)},p))})]})});x.displayName="Faq";const l=({data:e,index:s,isOpen:i=!1,classNames:o={}})=>{const n={"data-headless-type-name":`${h}#${y}`,"data-headless-title-desc-button":`${g(e?.title)}#${g(e?.richDesc??e?.desc)}#${i?"collapse":"expand"}`,"data-headless-nav-position":`#${s+1}`};return d(r.Item,{value:`item-${s}`,className:a("tablet:py-6 border-b border-[#E4E5E6] py-4",o.item),children:[t(r.Header,{className:"flex",children:d(r.Trigger,{...n,className:a("tablet:gap-[128px] group flex flex-1 !cursor-pointer items-center justify-between gap-4 text-left",o.itemHeader),children:[t(D,{as:"h3",html:e?.title,className:a("desktop:text-base lg-desktop:text-lg text-info-primary text-sm font-bold leading-[1.4]",o.title)}),t("div",{className:a("transition-transform duration-300 group-data-[state=open]:rotate-180",o.icon),children:t("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-[20px]",width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",children:t("path",{d:"M14.4111 7.41107C14.7365 7.08563 15.264 7.08563 15.5895 7.41107C15.9149 7.73651 15.9149 8.26402 15.5895 8.58946L10.5895 13.5895C10.264 13.9149 9.73651 13.9149 9.41107 13.5895L4.41107 8.58946C4.08563 8.26402 4.08563 7.73651 4.41107 7.41107C4.73651 7.08563 5.26402 7.08563 5.58946 7.41107L10.0003 11.8219L14.4111 7.41107Z",fill:"#1D1D1F"})})})]})}),t(r.Content,{forceMount:!0,className:a("overflow-hidden text-[#4A4C56]","data-[state=closed]:h-0 data-[state=closed]:opacity-0","data-[state=open]:animate-[faq-slide-down_300ms_ease-out]","data-[state=closed]:animate-[faq-slide-up_300ms_ease-out]",o.content),children:t("div",{className:"mt-2",children:t(F,{html:e?.richDesc??e?.desc,className:a("desktop:text-base lg-desktop:text-lg [&_a]:text-brand-0 text-sm font-bold leading-[1.4] [&_a]:underline",o.description)})})})]})};l.displayName="FaqItem";var P=N(x);export{l as FaqItem,P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as I,jsx as t,jsxs as l}from"react/jsx-runtime";import _,{useImperativeHandle as z,useRef as H}from"react";import{Heading as u,Picture as v,Text as c}from"../../components/index.js";import{cn as f}from"../../helpers/utils.js";import{withLayout as R}from"../../shared/Styles.js";import{useExposure as S}from"../../hooks/useExposure.js";import{trackUrlRef as j}from"../../shared/trackUrlRef.js";import{Swiper as L,SwiperSlide as $}from"swiper/react";import{useTracking as D}from"../../hooks/useTracking.js";const n="image",x="feature_cards",E=(a,r)=>r===2?a===0?"laptop:flex-[2]":"laptop:flex-[3]":r===3?"laptop:flex-[1]":r===4?a===0?"laptop:flex-[2]":a===1||a===2?"laptop:flex-[3]":"laptop:flex-[2]":r===5?a<3?"laptop:flex-[1]":a===3?"laptop:flex-[2]":"laptop:flex-[3]":"laptop:flex-[1]",P=(a,r)=>r===4&&a===1||r===5&&a===2,b=_.forwardRef(({data:a,className:r},k)=>{const{buildRef:N}=D(),{title:o,subtitle:i,items:p=[],theme:w="light",titleTag:y}=a,d=H(null);S(d,{componentType:n,componentName:x,componentTitle:o,componentDescription:i}),z(k,()=>d.current);const m="rounded-box",C=(e,s)=>{const h=l(I,{children:[t(v,{source:e.image?.url,alt:e.image?.alt||e.title,className:"feature-cards__card-image absolute inset-0 !h-full",imgClassName:"!h-full object-cover"}),l("div",{className:"feature-cards__card-content z-10",children:[t(u,{size:3,as:"h2",className:"feature-cards__card-title laptop:text-[20px] desktop:text-[32px] lg-desktop:text-[32px]",children:e.title}),t(c,{size:4,as:"p",className:"feature-cards__card-subtitle laptop:h-[42px] lg-desktop:h-[54px] lg-desktop:text-[18px] mt-[4px] line-clamp-2 h-[42px] text-[14px]",children:e.subtitle})]})]}),T="feature-cards__card relative flex h-[360px] max-h-[560px] flex-col justify-end gap-[16px] overflow-hidden px-[16px] py-[12px] text-info-primary tablet:h-[336px] laptop:h-[336px] laptop:px-[16px] laptop:py-[16px] desktop:h-[448px] desktop:px-[32px] desktop:py-[24px] lg-desktop:h-[560px]",F=s!==void 0?E(s,p.length):"flex-1",g=f(T,m,F,{"aiui-dark":e.theme==="dark","aiui-light":e.theme==="light"});return e.link?t("a",{href:j(e.link,N(n,x)),className:g,"data-headless-type-name":`${n}#${x}`,"data-headless-title-desc-button":`${o}#${e.title}#${e.subtitle}`,children:h}):t("div",{className:g,children:h})};return l("section",{ref:d,"data-ui-component-id":"FeatureCards",className:f("feature-cards text-info-primary flex w-full flex-col justify-center",{"aiui-dark":w==="dark"},r),children:[l("div",{className:"feature-cards__header",children:[t(u,{size:4,as:y??"h2",className:"feature-cards__title laptop:text-center text-left",children:o}),i&&t(c,{size:2,as:"p",className:"feature-cards__subtitle laptop:text-center desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-left text-[14px]",children:i})]}),t("div",{className:"feature-cards__grid laptop:mt-[32px] laptop:flex desktop:mt-[40px] lg-desktop:mt-[24px] mt-[24px] hidden w-full flex-wrap gap-[16px]",children:p.map((e,s)=>l(_.Fragment,{children:[C(e,s),P(s,p.length)&&t("div",{className:"laptop:basis-full laptop:h-0"})]},e.title))}),t("div",{className:"feature-cards__swiper-container laptop:hidden mt-[24px] w-full",children:t(L,{spaceBetween:12,slidesPerView:"auto",grabCursor:!0,className:"feature-cards__swiper relative w-full !overflow-visible",children:p.map(e=>t($,{className:"feature-cards__swiper-slide relative !h-[360px] !w-[296px]",children:l("div",{className:f("feature-cards__card feature-cards__card--mobile text-info-primary absolute inset-0 flex flex-1 flex-col justify-end gap-[16px] overflow-hidden px-[16px] py-[12px]",m,{"aiui-dark":e.theme==="dark","aiui-light":e.theme==="light"}),children:[t(v,{source:e.image?.url,alt:e.image?.alt||e.title,className:"feature-cards__card-image absolute inset-0 !h-full",imgClassName:"!h-full object-cover"}),l("div",{className:"feature-cards__card-content z-10",children:[t(u,{size:3,as:"h2",className:"feature-cards__card-title",children:e.title}),t(c,{size:4,as:"p",className:"feature-cards__card-subtitle laptop:h-[42px] lg-desktop:h-[54px] lg-desktop:text-[18px] mt-[4px] line-clamp-2 h-[42px] overflow-visible text-[14px]",children:e.subtitle})]})]},e.title)},e.title))})})]})});b.displayName="FeatureCards";var K=R(b,{style:"overflow: hidden;"});export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o,jsxs as y}from"react/jsx-runtime";import*as n from"react";import{cn as m}from"../../helpers/index.js";import{Text as C,Picture as E,Button as ot,Container as nt,Heading as at}from"../../components/index.js";import{cva as T}from"class-variance-authority";import{Swiper as st,SwiperSlide as rt}from"swiper/react";import{withLayout as it}from"../../shared/Styles.js";import{formatVariantPrice as lt}from"../Listing/utils/index.js";import{useAiuiContext as ut}from"../AiuiProvider/index.js";import{replaceTemplate as L}from"../Listing/utils/textFormat.js";const ct=T("desktop:px-6 rounded-card relative min-w-0 overflow-hidden p-4",{variants:{state:{light:"bg-[#EAEAEC]",dark:"bg-[#1E2024]"}},defaultVariants:{state:"light"}}),dt=T("",{variants:{layout:{vertical:"",horizontal:"desktop:flex desktop:flex-row desktop:items-stretch desktop:gap-10"}},defaultVariants:{layout:"vertical"}}),ft=T("desktop:max-w-[268px] lg-desktop:max-w-[356px] lg-desktop:h-[171px] relative mx-auto h-[118px] max-w-[256px] ",{variants:{layout:{vertical:"",horizontal:"desktop:flex-1 desktop:h-[122px] lg-desktop:h-[161px]"}},defaultVariants:{layout:"vertical"}}),pt=T("mt-3",{variants:{layout:{vertical:"",horizontal:"desktop:mt-0 desktop:flex-1 desktop:flex desktop:flex-col desktop:justify-center"}},defaultVariants:{layout:"vertical"}}),mt=T("mt-4 self-start",{variants:{state:{light:"bg-[#080A0F] text-white",dark:"bg-white text-[#080A0F]"}},defaultVariants:{state:"light"}}),M=T("",{variants:{state:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{state:"light"}}),U=t=>{if(!t)return;const e=[];return t.lgDesktop?.url&&e.push(`${t.lgDesktop.url} 1920`),t.desktop?.url&&e.push(`${t.desktop.url} 1439`),t.laptop?.url&&e.push(`${t.laptop.url} 1024`),t.tablet?.url&&e.push(`${t.tablet.url} 767`),t.default?.url&&e.push(t.default.url),e.length>0?e.join(", "):void 0},q=t=>t&&(t.default?.alt||t.tablet?.alt||t.laptop?.alt||t.desktop?.alt||t.lgDesktop?.alt)||"",ht=t=>{const e=Math.floor(t/3600),a=Math.floor(t%3600/60),i=t%60;return`${e.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}`},j=t=>{if(typeof t=="number")return t;const e=new Date(t).getTime();return isNaN(e)?0:e},O=t=>{if(!t)return!1;const e=j(t.startTime),a=(t.durationDays??1)*24*3600*1e3,i=t.rounds??1,d=Date.now();if(d<e)return!1;const h=d-e,u=Math.floor(h/a)+1;if(u>i)return!1;const f=e+u*a-d,s=5*60*1e3;return f<=s&&f>0},H=(t,e)=>{if(!t||!e)return t||"";const a=j(e.startTime),i=(e.durationDays??1)*24*3600*1e3,d=e.rounds??1,h=Date.now();if(h<a){const g=new Date(a),l=`${(g.getUTCMonth()+1).toString().padStart(2,"0")}${g.getUTCDate().toString().padStart(2,"0")}`;return`${t}${l}`}const u=h-a,w=Math.min(Math.floor(u/i)+1,d),f=a+(w-1)*i,s=new Date(f),p=`${(s.getUTCMonth()+1).toString().padStart(2,"0")}${s.getUTCDate().toString().padStart(2,"0")}`;return`${t}${p}`},W=n.memo(({config:t,theme:e="light",className:a,countdownText:i="Next round start time",lastRoundText:d="Last round",beforeStartText:h="Start time",countdownIcon:u,onStateChange:w})=>{const[f,s]=n.useState(0),[p,g]=n.useState("beforeStart"),l=n.useMemo(()=>j(t.startTime),[t.startTime]),S=t.rounds??1,N=(t.durationDays??1)*24*3600*1e3;n.useEffect(()=>{const P=()=>{const x=Date.now();if(x<l){const G=Math.max(0,Math.floor((l-x)/1e3));s(G),g("beforeStart");return}const R=x-l,b=Math.floor(R/N)+1;if(b>S){g("finished");return}const D=l+b*N,r=Math.max(0,Math.floor((D-x)/1e3));s(r),g(b===S?"lastRound":"running")};P();const A=setInterval(P,1e3);return()=>clearInterval(A)},[l,N,S]),n.useEffect(()=>{w?.(p)},[p,w]);const V=n.useMemo(()=>{switch(p){case"beforeStart":return h;case"lastRound":return d;default:return i}},[p,h,d,i]);return p==="finished"?null:y("div",{className:m("desktop:gap-2 laptop:text-base flex items-center gap-1 text-sm",e==="dark"?"text-white":"text-[#080A0F]",a),children:[u&&o(E,{source:u.url,alt:u.alt,className:"laptop:size-5 size-4 shrink-0",imgClassName:"size-full object-contain"}),o(C,{html:V,className:"whitespace-nowrap font-bold"}),o("span",{className:"font-bold",children:"|"}),o(C,{className:"font-bold",html:ht(f)})]})});W.displayName="Countdown";const J=n.memo(({progress:t,theme:e="light",className:a})=>{const i=Math.min(100,Math.max(0,t));return o("div",{className:m("flex h-2 w-full items-stretch overflow-hidden rounded-full",e==="dark"?"bg-white/20":"bg-black/20",a),role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,children:o("div",{className:m("h-full rounded-full transition-all duration-300",e==="dark"?"bg-white":"bg-[#080A0F]"),style:{width:`${i}%`}})})});J.displayName="ProgressBar";const K=n.memo(({item:t,theme:e="light",layout:a="vertical",className:i,buttonClassName:d,countdownClassName:h,onButtonClick:u,onProductImageClick:w,buildData:f,buttonText:s,remainText:p,lowStockText:g,soldOutButtonText:l,discountText:S="Only {price}",countdownText:N,countdownIcon:V,lastRoundText:P,beforeStartText:A,comingSoonButtonText:x,loading:R})=>{const{locale:b="us",currencyCode:D}=ut(),r=t.products?.[0],[G,X]=n.useState(()=>O(t.countdown)),[I,Y]=n.useState(()=>H(t.codePrefix,t.countdown)),[$,Z]=n.useState("beforeStart");n.useEffect(()=>{const v=()=>{X(O(t.countdown));const F=H(t.codePrefix,t.countdown);Y(_=>_!==F?F:_)};v();const z=setInterval(v,1e3);return()=>clearInterval(z)},[t.codePrefix,t.countdown]);const tt=n.useCallback(v=>{Z(v)},[]),B=n.useMemo(()=>!r?.handle||!f?.products?.length?null:f.products.find(v=>v.handle===r.handle)||null,[r?.handle,f?.products]),c=n.useMemo(()=>B?.variants?.find(v=>v?.sku===r?.sku)||{},[r?.sku,B?.variants]),k=n.useMemo(()=>{const{price:v,basePrice:z}=lt({locale:D==="CAD"?"us":b||"us",baseAmount:c?.price?.amount,amount:r?.custom_price??c?.price?.amount,currencyCode:B?.price?.currencyCode||"USD"});return{value:z,description:r?.custom_description,salePrice:L(S||"",{price:v})}},[B,c,b,S,r?.custom_price,r?.custom_description]),et=n.useCallback(()=>{u?.({product:r,code:I})},[u,I,r]);return y("div",{className:m(ct({state:e}),i),"data-ui-component-id":"GiftShelfCard",children:[t.countdown&&o("div",{className:"laptop:h-[24px] mb-4 h-[20px]",children:o(W,{config:t.countdown,theme:e,className:h,countdownText:N,lastRoundText:P,beforeStartText:A,countdownIcon:V,onStateChange:tt})}),y("div",{className:dt({layout:a}),children:[y("div",{className:ft({layout:a}),children:[t.backgroundImage&&(w?o("a",{onClick:()=>r&&w(r),className:"cursor-pointer",children:o(E,{source:U(t.backgroundImage),alt:q(t.backgroundImage),className:"rounded-card size-full overflow-hidden object-cover",imgClassName:"h-full w-full object-cover"})}):o(E,{source:U(t.backgroundImage),alt:q(t.backgroundImage),className:"rounded-card size-full overflow-hidden object-cover",imgClassName:"h-full w-full object-cover"})),o("div",{className:"absolute top-1/2 z-10 w-full -translate-y-1/2 px-6",children:y("div",{className:"flex flex-col gap-1",children:[k.value&&o(at,{html:k.value,size:4,className:m("font-bold leading-none",M({state:e}))}),k.description&&o(C,{html:k.description,className:m("text-base font-bold opacity-60",M({state:e}))})]})})]}),y("div",{className:pt({layout:a}),children:[k.salePrice&&o(C,{as:"p",html:k.salePrice,className:m("lg-desktop:text-2xl text-xl font-bold",M({state:e}))}),o(J,{progress:r?.custom_inventory?(c?.quantityAvailable||0)/r.custom_inventory*100:0,theme:e,className:m("mb-1 mt-2",c?.availableForSale&&(c?.quantityAvailable??0)<=0&&"invisible")}),p&&(c?.quantityAvailable??0)>=0&&o(C,{html:L(p,{inventory:r?.custom_inventory?.toString()||"",quantity:c?.quantityAvailable?.toString()||"0"}),as:"p",className:m("laptop:text-base text-sm font-bold",M({state:e}))}),g&&c?.availableForSale&&(c?.quantityAvailable??0)<0&&o(C,{html:g,as:"p",className:m("laptop:text-base text-sm font-bold text-red-500",M({state:e}))}),o(ot,{size:"lg",className:m(mt({state:e}),d),onClick:et,disabled:!c?.availableForSale||R||G||$==="beforeStart"||$==="finished",loading:R&&c?.availableForSale,children:$==="beforeStart"?x||s:c?.availableForSale?s:l||s})]})]})]})});K.displayName="GiftShelfCard";const Q=n.forwardRef(({classNames:t={},data:e,onButtonClick:a,onProductImageClick:i,buildData:d,loading:h,...u},w)=>{const f=e.theme||"light",s=n.useMemo(()=>e?.items?.length||4,[e?.items]),p=s===2?"horizontal":"vertical",g=n.useMemo(()=>{const l=S=>{switch(S){case"mobile":return{slidesPerView:1.2,spaceBetween:12};case"tablet":return s<=2?{slidesPerView:2,spaceBetween:12}:{slidesPerView:2.5,spaceBetween:12};case"laptop":return s<=3?{slidesPerView:s,spaceBetween:16}:{slidesPerView:3.01,spaceBetween:16};case"desktop":return{slidesPerView:Math.min(s,4),spaceBetween:20}}};return{0:l("mobile"),768:l("tablet"),1025:l("laptop"),1440:l("desktop")}},[s]);return o(nt,{ref:w,className:m(t?.root),childClassName:"overflow-hidden","data-ui-component-id":"GiftShelf",...u,children:o(st,{breakpoints:g,className:"w-full !overflow-visible",children:e.items.map((l,S)=>o(rt,{children:o(K,{item:l,theme:f,layout:p,className:t?.card,buttonClassName:t?.button,countdownClassName:t?.countdown,onButtonClick:a,onProductImageClick:i,buildData:d,buttonText:e.buttonText,discountText:e.discountText,remainText:e.remainText,lowStockText:e.lowStockText,soldOutButtonText:e.soldOutButtonText,countdownText:e.countdownText,lastRoundText:e.lastRoundText,countdownIcon:e?.countdownIcon,beforeStartText:e.beforeStartText,comingSoonButtonText:e.comingSoonButtonText,loading:h})},"giftShelfCardItem"+S))})})});Q.displayName="GiftShelf";var Tt=it(Q);export{Tt as default};
|
|
1
|
+
"use client";import{jsx as s,jsxs as R}from"react/jsx-runtime";import*as o from"react";import{cn as g}from"../../helpers/index.js";import{Text as N,Picture as j,Button as ct,Container as dt,Heading as pt}from"../../components/index.js";import{cva as M}from"class-variance-authority";import{Swiper as mt,SwiperSlide as ft}from"swiper/react";import{withLayout as ht}from"../../shared/Styles.js";import{formatVariantPrice as gt}from"../Listing/utils/index.js";import{useAiuiContext as vt}from"../AiuiProvider/index.js";import{replaceTemplate as W}from"../Listing/utils/textFormat.js";import{useExposure as St}from"../../hooks/useExposure.js";import{useViewItemList as wt}from"../../hooks/useViewItemList.js";import{useTracking as xt}from"../../hooks/useTracking.js";import{buildClickTrackingProps as J,trackSelectItem as kt}from"../../shared/track.js";const $="image",P="gift_shelf",K=(t,e,r)=>{const a=r?.find(c=>c.handle===t.handle),i=a?.variants?.find(c=>c?.sku===t.sku);return{item_id:t.sku||"",item_name:i?.title||a?.title||t.name||"",item_variant:i?.title||"",price:String(t.custom_price??i?.price?.amount??""),index:e+1}},bt=M("desktop:px-6 rounded-card relative min-w-0 overflow-hidden p-4",{variants:{state:{light:"bg-[#EAEAEC]",dark:"bg-[#1E2024]"}},defaultVariants:{state:"light"}}),Ct=M("",{variants:{layout:{vertical:"",horizontal:"desktop:flex desktop:flex-row desktop:items-stretch desktop:gap-10"}},defaultVariants:{layout:"vertical"}}),Tt=M("desktop:max-w-[268px] lg-desktop:max-w-[356px] lg-desktop:h-[171px] relative mx-auto h-[118px] max-w-[256px] ",{variants:{layout:{vertical:"",horizontal:"desktop:flex-1 desktop:h-[122px] lg-desktop:h-[161px]"}},defaultVariants:{layout:"vertical"}}),yt=M("mt-3",{variants:{layout:{vertical:"",horizontal:"desktop:mt-0 desktop:flex-1 desktop:flex desktop:flex-col desktop:justify-center"}},defaultVariants:{layout:"vertical"}}),Nt=M("mt-4 self-start",{variants:{state:{light:"bg-[#080A0F] text-white",dark:"bg-white text-[#080A0F]"}},defaultVariants:{state:"light"}}),A=M("",{variants:{state:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{state:"light"}}),Q=t=>{if(!t)return;const e=[];return t.lgDesktop?.url&&e.push(`${t.lgDesktop.url} 1920`),t.desktop?.url&&e.push(`${t.desktop.url} 1439`),t.laptop?.url&&e.push(`${t.laptop.url} 1024`),t.tablet?.url&&e.push(`${t.tablet.url} 767`),t.default?.url&&e.push(t.default.url),e.length>0?e.join(", "):void 0},X=t=>t&&(t.default?.alt||t.tablet?.alt||t.laptop?.alt||t.desktop?.alt||t.lgDesktop?.alt)||"",Mt=t=>{const e=Math.floor(t/3600),r=Math.floor(t%3600/60),a=t%60;return`${e.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`},F=t=>{if(typeof t=="number")return t;const e=new Date(t).getTime();return isNaN(e)?0:e},Y=t=>{if(!t)return!1;const e=F(t.startTime),r=(t.durationDays??1)*24*3600*1e3,a=t.rounds??1,i=Date.now();if(i<e)return!1;const c=i-e,f=Math.floor(c/r)+1;if(f>a)return!1;const d=e+f*r-i,l=5*60*1e3;return d<=l&&d>0},Z=(t,e)=>{if(!t||!e)return t||"";const r=F(e.startTime),a=(e.durationDays??1)*24*3600*1e3,i=e.rounds??1,c=Date.now();if(c<r){const u=new Date(r),v=`${(u.getUTCMonth()+1).toString().padStart(2,"0")}${u.getUTCDate().toString().padStart(2,"0")}`;return`${t}${v}`}const f=c-r,S=Math.min(Math.floor(f/a)+1,i),d=r+(S-1)*a,l=new Date(d),h=`${(l.getUTCMonth()+1).toString().padStart(2,"0")}${l.getUTCDate().toString().padStart(2,"0")}`;return`${t}${h}`},tt=o.memo(({config:t,theme:e="light",className:r,countdownText:a="Next round start time",lastRoundText:i="Last round",beforeStartText:c="Start time",countdownIcon:f,onStateChange:S})=>{const[d,l]=o.useState(0),[h,u]=o.useState("beforeStart"),v=o.useMemo(()=>F(t.startTime),[t.startTime]),b=t.rounds??1,p=(t.durationDays??1)*24*3600*1e3;o.useEffect(()=>{const C=()=>{const T=Date.now();if(T<v){const G=Math.max(0,Math.floor((v-T)/1e3));l(G),u("beforeStart");return}const D=T-v,k=Math.floor(D/p)+1;if(k>b){u("finished");return}const I=v+k*p,B=Math.max(0,Math.floor((I-T)/1e3));l(B),u(k===b?"lastRound":"running")};C();const E=setInterval(C,1e3);return()=>clearInterval(E)},[v,p,b]),o.useEffect(()=>{S?.(h)},[h,S]);const w=o.useMemo(()=>{switch(h){case"beforeStart":return c;case"lastRound":return i;default:return a}},[h,c,i,a]);return h==="finished"?null:R("div",{className:g("desktop:gap-2 laptop:text-base flex items-center gap-1 text-sm",e==="dark"?"text-white":"text-[#080A0F]",r),children:[f&&s(j,{source:f.url,alt:f.alt,className:"laptop:size-5 size-4 shrink-0",imgClassName:"size-full object-contain"}),s(N,{html:w,className:"whitespace-nowrap font-bold"}),s("span",{className:"font-bold",children:"|"}),s(N,{className:"font-bold",html:Mt(d)})]})});tt.displayName="Countdown";const et=o.memo(({progress:t,theme:e="light",className:r})=>{const a=Math.min(100,Math.max(0,t));return s("div",{className:g("flex h-2 w-full items-stretch overflow-hidden rounded-full",e==="dark"?"bg-white/20":"bg-black/20",r),role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,children:s("div",{className:g("h-full rounded-full transition-all duration-300",e==="dark"?"bg-white":"bg-[#080A0F]"),style:{width:`${a}%`}})})});et.displayName="ProgressBar";const ot=o.memo(({item:t,theme:e="light",layout:r="vertical",className:a,buttonClassName:i,countdownClassName:c,onButtonClick:f,onProductImageClick:S,buildData:d,buttonText:l,remainText:h,lowStockText:u,soldOutButtonText:v,discountText:b="Only {price}",countdownText:p,countdownIcon:w,lastRoundText:C,beforeStartText:E,comingSoonButtonText:T,loading:D,position:k})=>{const{locale:I="us",currencyCode:B}=vt(),{pageGroup:G}=xt(),n=t.products?.[0],[st,rt]=o.useState(()=>Y(t.countdown)),[U,at]=o.useState(()=>Z(t.codePrefix,t.countdown)),[_,it]=o.useState("beforeStart");o.useEffect(()=>{const x=()=>{rt(Y(t.countdown));const O=Z(t.codePrefix,t.countdown);at(H=>H!==O?O:H)};x();const L=setInterval(x,1e3);return()=>clearInterval(L)},[t.codePrefix,t.countdown]);const lt=o.useCallback(x=>{it(x)},[]),V=o.useMemo(()=>!n?.handle||!d?.products?.length?null:d.products.find(x=>x.handle===n.handle)||null,[n?.handle,d?.products]),m=o.useMemo(()=>V?.variants?.find(x=>x?.sku===n?.sku)||{},[n?.sku,V?.variants]),y=o.useMemo(()=>{const{price:x,basePrice:L}=gt({locale:B==="CAD"?"us":I||"us",baseAmount:m?.price?.amount,amount:n?.custom_price??m?.price?.amount,currencyCode:V?.price?.currencyCode||"USD"});return{value:L,description:n?.custom_description,salePrice:W(b||"",{price:x})}},[V,m,I,b,n?.custom_price,n?.custom_description]),z=o.useCallback(()=>{n&&kt({pageGroup:G,currency:B||"USD",itemListName:P,position:k+1,items:[K(n,k,d?.products)]})},[n,G,B,k,d?.products]),ut=o.useCallback(()=>{z(),f?.({product:n,code:U})},[z,f,U,n]),q=m?.title||V?.title||n?.name;return R("div",{className:g(bt({state:e}),a),"data-ui-component-id":"GiftShelfCard",children:[t.countdown&&s("div",{className:"laptop:h-[24px] mb-4 h-[20px]",children:s(tt,{config:t.countdown,theme:e,className:c,countdownText:p,lastRoundText:C,beforeStartText:E,countdownIcon:w,onStateChange:lt})}),R("div",{className:Ct({layout:r}),children:[R("div",{className:Tt({layout:r}),children:[t.backgroundImage&&(S?s("a",{onClick:()=>{n&&(z(),S(n))},className:"cursor-pointer",...J({interactive:!!n,componentType:$,componentName:P,title:q,sku:n?.sku,position:k+1}),children:s(j,{source:Q(t.backgroundImage),alt:X(t.backgroundImage),className:"rounded-card size-full overflow-hidden object-cover",imgClassName:"h-full w-full object-cover"})}):s(j,{source:Q(t.backgroundImage),alt:X(t.backgroundImage),className:"rounded-card size-full overflow-hidden object-cover",imgClassName:"h-full w-full object-cover"})),s("div",{className:"absolute top-1/2 z-10 w-full -translate-y-1/2 px-6",children:R("div",{className:"flex flex-col gap-1",children:[y.value&&s(pt,{html:y.value,size:4,className:g("font-bold leading-none",A({state:e}))}),y.description&&s(N,{html:y.description,className:g("text-base font-bold opacity-60",A({state:e}))})]})})]}),R("div",{className:yt({layout:r}),children:[y.salePrice&&s(N,{as:"p",html:y.salePrice,className:g("lg-desktop:text-2xl text-xl font-bold",A({state:e}))}),s(et,{progress:n?.custom_inventory?(m?.quantityAvailable||0)/n.custom_inventory*100:0,theme:e,className:g("mb-1 mt-2",m?.availableForSale&&(m?.quantityAvailable??0)<=0&&"invisible")}),h&&(m?.quantityAvailable??0)>=0&&s(N,{html:W(h,{inventory:n?.custom_inventory?.toString()||"",quantity:m?.quantityAvailable?.toString()||"0"}),as:"p",className:g("laptop:text-base text-sm font-bold",A({state:e}))}),u&&m?.availableForSale&&(m?.quantityAvailable??0)<0&&s(N,{html:u,as:"p",className:g("laptop:text-base text-sm font-bold text-red-500",A({state:e}))}),s(ct,{size:"lg",className:g(Nt({state:e}),i),onClick:ut,...J({interactive:!!n,componentType:$,componentName:P,title:q,buttonName:l,sku:n?.sku,position:k+1}),disabled:!m?.availableForSale||D||st||_==="beforeStart"||_==="finished",loading:D&&m?.availableForSale,children:_==="beforeStart"?T||l:m?.availableForSale?l:v||l})]})]})]})});ot.displayName="GiftShelfCard";const nt=o.forwardRef(({classNames:t={},data:e,onButtonClick:r,onProductImageClick:a,buildData:i,loading:c,...f},S)=>{const d=e.theme||"light",l=o.useRef(null);o.useImperativeHandle(S,()=>l.current);const h=o.useMemo(()=>e.items.flatMap((p,w)=>{const C=p.products?.[0];return C?[K(C,w,i?.products)]:[]}),[e.items,i?.products]);St(l,{componentType:$,componentName:P,componentTitle:e.items?.[0]?.products?.[0]?.name}),wt(l,{componentType:$,componentName:P,itemListName:P,items:h});const u=o.useMemo(()=>e?.items?.length||4,[e?.items]),v=u===2?"horizontal":"vertical",b=o.useMemo(()=>{const p=w=>{switch(w){case"mobile":return{slidesPerView:1.2,spaceBetween:12};case"tablet":return u<=2?{slidesPerView:2,spaceBetween:12}:{slidesPerView:2.5,spaceBetween:12};case"laptop":return u<=3?{slidesPerView:u,spaceBetween:16}:{slidesPerView:3.01,spaceBetween:16};case"desktop":return{slidesPerView:Math.min(u,4),spaceBetween:20}}};return{0:p("mobile"),768:p("tablet"),1025:p("laptop"),1440:p("desktop")}},[u]);return s(dt,{ref:l,className:g(t?.root),childClassName:"overflow-hidden","data-ui-component-id":"GiftShelf",...f,children:s(mt,{breakpoints:b,className:"w-full !overflow-visible",children:e.items.map((p,w)=>s(ft,{children:s(ot,{item:p,theme:d,layout:v,className:t?.card,buttonClassName:t?.button,countdownClassName:t?.countdown,onButtonClick:r,onProductImageClick:a,buildData:i,buttonText:e.buttonText,discountText:e.discountText,remainText:e.remainText,lowStockText:e.lowStockText,soldOutButtonText:e.soldOutButtonText,countdownText:e.countdownText,lastRoundText:e.lastRoundText,countdownIcon:e?.countdownIcon,beforeStartText:e.beforeStartText,comingSoonButtonText:e.comingSoonButtonText,loading:c,position:w})},"giftShelfCardItem"+w))})})});nt.displayName="GiftShelf";var Lt=ht(nt);export{Lt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as t,jsxs as S}from"react/jsx-runtime";import*as r from"react";import{cn as f}from"../../helpers/index.js";import{Text as N,Picture as P,Container as K,Heading as O}from"../../components/index.js";import{cva as M}from"class-variance-authority";import{Swiper as y,SwiperSlide as I}from"swiper/react";import*as G from"swiper/modules";import{withLayout as Q}from"../../shared/Styles.js";import{useAiuiContext as V}from"../AiuiProvider/index.js";import{formatPrice as W}from"../Listing/utils/index.js";import{useExposure as X}from"../../hooks/useExposure.js";import{useViewItemList as Y}from"../../hooks/useViewItemList.js";import{useTracking as Z}from"../../hooks/useTracking.js";import{buildClickTrackingProps as $,trackSelectItem as ee}from"../../shared/track.js";const b="image",T="gift_tier_shelf",B=(e,o,h)=>{const u=h?.find(d=>d.handle===e.handle),s=u?.variants?.find(d=>d?.sku===e.sku);return{item_id:e.sku||"",item_name:s?.title||u?.title||e.name||"",item_variant:s?.title||"",price:String(e.custom_price??s?.price?.amount??""),index:o+1}},te=M("lg-desktop:h-[400px] rounded-card desktop:pt-4 desktop:pb-6 relative flex h-[320px] flex-col items-start gap-1 overflow-hidden p-4",{variants:{theme:{light:"bg-gradient-to-b from-[#FCCA7B] to-[#FFE6BF]",dark:"bg-gradient-to-b from-[#3A3A3A] to-[#1D1D1F]"}},defaultVariants:{theme:"light"}}),F=M("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{theme:"light"}}),z=r.memo(({image:e})=>e?t(P,{source:e.url,alt:e.alt||"Member Tag",className:"h-full w-auto",imgClassName:"h-full w-auto object-contain"}):null);z.displayName="MemberTag";const L=r.memo(({theme:e="light"})=>{const o=e==="light"?"bg-[#f6cd4e]":"bg-[#F5F6F7]";return t("div",{className:"flex h-4 w-full items-center",children:t("div",{className:f("flex h-1 w-full items-center justify-center",o),children:t("div",{className:f("relative size-4 shrink-0 rounded-full",o)})})})});L.displayName="TimelineItem";const _=r.memo(({item:e,theme:o="light",className:h,onClick:u,onProductImageClick:s,interactive:d,buildData:v})=>{const{locale:k="us"}=V(),n=e.products?.[0],a=r.useMemo(()=>!n?.handle||!v?.products?.length?null:v.products.find(w=>w.handle===n.handle)||null,[n?.handle,v?.products]),p=r.useMemo(()=>a?.variants?.find(w=>w?.sku===n?.sku)||{},[n?.sku,a?.variants]),g=W({locale:k||"us",amount:n?.custom_price??p?.price?.amount,currencyCode:a?.price?.currencyCode||"USD"});return S("div",{className:f(te({theme:o}),h),onClick:u,"data-ui-component-id":"GiftTierCard",...$({interactive:!!d,componentType:b,componentName:T,title:e.threshold,description:p?.title||a?.title,sku:n?.sku}),children:[t("div",{className:"lg-desktop:h-[28px] z-10 h-6",children:e.showMemberTag&&e.memberTagImage&&t(z,{image:e.memberTagImage})}),t("div",{className:"relative z-10 mx-auto min-h-0 w-fit flex-1",children:s?t("a",{onClick:s,className:"cursor-pointer",children:t(P,{source:p?.image?.url||a?.images[0]?.url,className:"size-full",imgClassName:"size-full object-contain"})}):t(P,{source:p?.image?.url||a?.images[0]?.url,className:"size-full",imgClassName:"size-full object-contain"})}),S("div",{className:f("z-10 flex w-full shrink-0 flex-col gap-2",F({theme:o})),children:[S("div",{className:"flex items-end gap-1",children:[t(O,{html:g,size:4,className:"font-bold leading-[1.2] tracking-[-0.04em]"}),e.valueUnit&&t(N,{html:e.valueUnit,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.2] tracking-[-0.04em]"})]}),t(N,{html:p?.title||a?.title,className:"lg-desktop:text-2xl line-clamp-2 min-h-[48px] text-wrap text-xl font-bold leading-[1.2] tracking-[-0.04em]"})]})]})});_.displayName="GiftTierCard";const j=r.forwardRef(({classNames:e={},data:o,onCardClick:h,onProductImageClick:u,buildData:s,...d},v)=>{const k=o.theme||"light",n=o.showTimeline!==!1,{pageGroup:a}=Z(),{currencyCode:p}=V(),g=r.useRef(null);r.useImperativeHandle(v,()=>g.current);const w=!!(h||u),[A,E]=r.useState(null),[H,R]=r.useState(null),c=r.useMemo(()=>s?.products?.length?o.items.filter(i=>{const l=i.products?.[0];return l?.handle?s.products.find(x=>x.handle===l.handle)?.variants?.find(x=>x?.sku===l?.sku)?.availableForSale!==!1:!0}):o.items,[o.items,s?.products]),U=r.useMemo(()=>c.flatMap((i,l)=>{const m=i.products?.[0];return m?[B(m,l,s?.products)]:[]}),[c,s?.products]);X(g,{componentType:b,componentName:T,componentTitle:c[0]?.threshold}),Y(g,{componentType:b,componentName:T,itemListName:T,items:U});const D=(i,l)=>{const m=i.products?.[0];w&&m&&ee({pageGroup:a,currency:p||"USD",itemListName:T,position:l+1,items:[B(m,l,s?.products)]}),h?.(i,l)},q=r.useMemo(()=>{const i=c.length;return{0:{slidesPerView:1.2,spaceBetween:12},768:{slidesPerView:Math.min(i,2.5),spaceBetween:12},1025:{slidesPerView:Math.min(i,3.5),spaceBetween:16},1440:{slidesPerView:Math.min(i,4),spaceBetween:16}}},[c.length]),J=r.useMemo(()=>{const i=c.length;return{0:{slidesPerView:1.2,spaceBetween:0},768:{slidesPerView:Math.min(i,2.5),spaceBetween:0},1025:{slidesPerView:Math.min(i,3.5),spaceBetween:0},1440:{slidesPerView:Math.min(i,4),spaceBetween:0}}},[c.length]),C=r.useMemo(()=>G.Controller?[G.Controller]:[],[]);return S(K,{ref:g,className:f(e?.root),childClassName:"overflow-hidden","data-ui-component-id":"GiftTierShelf",...d,children:[t(y,{modules:C,breakpoints:q,className:"w-full !overflow-visible",onSwiper:E,controller:{control:H},children:c.map((i,l)=>t(I,{children:t(_,{item:i,theme:k,buildData:s,className:e?.card,interactive:w,onClick:()=>D(i,l),onProductImageClick:()=>{const m=i.products?.[0];m&&u?.(m,i)}})},"giftTierItem"+l))}),n&&t("div",{className:"mt-4 flex flex-col gap-4",children:t("div",{className:f("w-full",e?.timeline),children:t(y,{modules:C,breakpoints:J,className:"w-full !overflow-visible",onSwiper:R,controller:{control:A},children:c.map((i,l)=>t(I,{children:S("div",{className:"flex flex-col items-center",children:[t(L,{theme:k}),t(N,{html:i.threshold,className:f("lg-desktop:text-2xl text-center text-xl font-bold leading-[1.2] tracking-[-0.04em]",F({theme:k}),e?.thresholdText)})]})},"timelineItem"+l))})})})]})});j.displayName="GiftTierShelf";var fe=Q(j);export{fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as ae,jsx as t,jsxs as n}from"react/jsx-runtime";import{useMediaQuery as q}from"react-responsive";import Q,{useImperativeHandle as X,useRef as $,useState as p}from"react";import{createPortal as Z}from"react-dom";import{cn as m,getLocalizedPath as T}from"../../helpers/utils.js";import{withLayout as F}from"../../shared/Styles.js";import J from"../SwiperBox/index.js";import{Button as K,Heading as O,Picture as y,Text as G,Tabs as W,TabsList as ee,TabsTrigger as te,TabsContent as oe}from"../../components/index.js";import P from"../Title/index.js";import{VideoModal as se}from"../VideoModal/index.js";import{TextModal as le}from"../TextModal/index.js";import{useExposure as B}from"../../hooks/useExposure.js";import{trackUrlRef as I}from"../../shared/trackUrlRef.js";import{useAiuiContext as ie}from"../AiuiProvider/index.js";import"swiper/css";import{useTracking as re}from"../../hooks/useTracking.js";const u="image",h="graphic",L=e=>{let o="";const s=d=>(d?.url&&(o=d.url),o),c=s(e.lgDesktop),l=s(e.desktop),r=s(e.laptop),b=s(e.tablet),g=e.default?.url;return[`${c} 9999`,`${l} 1919`,`${r} 1439`,`${b} 1024`,`${g} 768`].join(", ")},D="descTitle lg-desktop:text-[32px] desktop:mt-2 desktop:text-[24px] text-lines-2 mt-1 line-clamp-3 flex-1 text-[24px] font-bold leading-[1.2]",ne=({data:e,configuration:o})=>{const{buildRef:s}=re(),c=$(null),[l,r]=p({visible:!1,x:0,y:0,text:""}),b=o?.descriptionTag||"h3",g=()=>{switch(o.num){case 1:return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case 2:return"tablet:aspect-w-[346] tablet:aspect-h-[360] laptop:aspect-w-[440] laptop:aspect-h-[360] desktop:aspect-w-[648] desktop:aspect-h-[384] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480]";case 3:return"tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[427] desktop:aspect-h-[384] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[480]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[316] desktop:aspect-h-[384] lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480]"}},d=i=>{e?.description&&r({visible:!0,x:i.clientX,y:i.clientY,text:e.description})},v=()=>{r(i=>({...i,visible:!1}))};B(c,{componentType:u,componentName:h,componentTitle:e?.title,componentDescription:e?.description,position:o?.index+1});const x=e?.href?"a":"div",w=e?.href?{href:I(T(e.href,o?.locale||"us"),s(u,h))}:{};return t("div",{ref:c,className:m(g(),"graphicItem","laptop:h-auto text-info-primary md-tablet:h-[360px] flex-1 shrink-0 md:basis-[296px]",{"aiui-dark":e.theme==="dark"}),children:t("div",{className:m("rounded-box absolute inset-0 overflow-hidden"),children:n("div",{className:`graphic-children relative block size-full overflow-hidden ${e?.href?"cursor-pointer":""}`,children:[e?.href?n("a",{"aria-label":e?.title||e?.description,href:I(T(e?.href||"",o?.locale||"us"),s(u,h)),className:"rounded-card block size-full overflow-hidden","data-headless-nav-postion":`''#${o?.index+1}`,"data-headless-type-name":`${u}#${h}`,"data-headless-title-desc-button":`${e?.title}#${e?.description}`,children:[t(y,{className:"h-full",imgClassName:"h-full object-cover tablet:hover:scale-110 transition-all duration-300",source:e?.backgroundImage?.default?L(e.backgroundImage):e?.imgUrl?.url,alt:e?.backgroundImage?.lgDesktop?.alt||e?.backgroundImage?.default?.alt||e?.imgUrl?.alt||""}),t("span",{className:"sr-only",children:e?.title||e?.description})]}):t("div",{className:"rounded-card block size-full overflow-hidden",children:t(y,{className:"h-full",imgClassName:"h-full object-cover tablet:hover:scale-110 transition-all duration-300",source:e?.backgroundImage?.default?L(e.backgroundImage):e?.imgUrl?.url||"",alt:e?.backgroundImage?.lgDesktop?.alt||e?.backgroundImage?.default?.alt||e?.imgUrl?.alt||""})}),n(x,{...w,className:m("laptop:p-6 absolute bottom-0 z-[1] box-border flex w-full flex-col p-4",{"bg-gradient-to-b from-transparent to-black/80":e?.showBottomGradient&&e?.theme==="dark","bg-gradient-to-b from-transparent to-white/80":e?.showBottomGradient&&e?.theme!=="dark"}),children:[n("div",{className:m("flex items-end gap-1 overflow-hidden","graphic-bottom"),children:[n("div",{className:"flex-1 overflow-hidden",children:[t(G,{html:e?.title,style:{color:e?.textColor},className:"spanTitle graphic-title lg-desktop:text-lg desktop:text-base line-clamp-3 text-sm font-bold leading-[1.2]"}),e?.description&&n("div",{onMouseMove:d,onMouseLeave:v,children:[e?.title?t(O,{html:e?.description,style:{color:e?.textColor},as:b,className:`${D} graphic-description`}):t(b,{style:{color:e?.textColor},dangerouslySetInnerHTML:{__html:e?.description||""},className:`${D} graphic-description-item`}),typeof window<"u"&&l.visible&&Z(t(G,{as:"div",html:l.text,className:"pointer-events-none fixed z-[9999] max-w-xs rounded-lg bg-black/60 px-3 py-2 text-sm text-white shadow-lg backdrop-blur-sm transition-opacity duration-200",style:{left:`${l.x+16}px`,top:`${l.y+16}px`}}),document.body)]})]}),!e?.isShowIcon&&(e?.video?.url||e?.youtubeId)&&t("button",{"aria-label":"Play Video",onClick:i=>{i.preventDefault(),i.stopPropagation(),o?.onVideoPlayBtnClick?.(o?.index||0,e)},className:"laptop:size-12 flex size-8 items-center justify-center rounded-full bg-white/20 hover:bg-black/75",children:t("svg",{width:"12",height:"14",viewBox:"0 0 12 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M12 7L0 14L0 0L12 7Z",fill:"white"})})}),e?.isShowIcon&&e?.icon?.url&&t("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),o?.onIconClick?.(e,o)},className:"laptop:size-9 flex size-8 items-center justify-center overflow-hidden rounded-full bg-white/20 hover:bg-black/75",children:t(y,{className:"h-full",imgClassName:"h-full object-cover",source:e?.icon?.url,alt:e?.icon?.alt||""})})]}),e.buttonText&&t(K,{as:"a","aria-label":e?.title||e?.description,variant:"secondary",className:"bgButton mt-[8px] self-start",href:I(T(e?.href||"",o?.locale||"us"),s(u,h)),"data-headless-nav-position":`''#${o?.index+1}`,"data-headless-type-name":`${u}#${h}`,"data-headless-title-desc-button":`${e?.title}#${e?.description}#${e?.buttonText}`,children:e.buttonText})]})]})})})},A=({items:e=[],sharedConfig:o})=>{const s=c=>{const l=e.length>3,r=e.length>2;switch(c){case 1440:return l?4:e.length;case 1024:return l?3:e.length;case 768:return e.length===1?1:l||r?2.3:2;default:return e.length===1?1:1.2}};return t(J,{id:"Graphic",className:m("!overflow-visible"),data:{list:e,configuration:{...o,num:e.length}},Slide:ne,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:s()},768:{spaceBetween:16,freeMode:!1,slidesPerView:s(768)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:s(1024)},1440:{spaceBetween:16,freeMode:!1,slidesPerView:s(1440)}}})},U=Q.forwardRef(({data:e,className:o,...s},c)=>{const l=q({query:"(max-width: 768px)"}),r=$(null),[b,g]=p(!1),[d,v]=p(""),[x,w]=p(""),[i,C]=p(""),[z,M]=p(null),[R,N]=p(!1),{locale:H="us"}=ie(),E=e?.isShowTab??!1,f=e?.tabs,j=e?.tabAlign??"left",[Y,_]=p(f?.[0]?.id??"");X(c,()=>r.current),B(r,{componentType:u,componentName:h,componentTitle:e?.title});const S={itemShape:e?.itemShape,descriptionTag:e?.descriptionTag,locale:H,onVideoPlayBtnClick:(a,k)=>{g(!0),k?.isYouTube?(w(k?.youtubeId||""),v(""),C("")):(w(""),v(k?.video?.url||""),C(k?.mobileVideo?.url||""))},onIconClick:a=>{N(!0),M(a)}},V=()=>n(ae,{children:[t(se,{visible:b,youTubeId:x,onCloseModal:()=>g(!1),videoUrl:x?"":l&&i||d}),t(le,{textVisible:R,extension:z?.extension,onCloseModal:()=>{N(!1),M(null)}})]});return!E||!f||f.length===0?n("div",{...s,ref:r,className:m("graphicBlock",o),children:[n("div",{className:"graphic-box",children:[e?.title&&t(P,{data:{title:e.title,align:e?.titleAlign??"left"}}),t(A,{items:e?.items,sharedConfig:S})]}),V()]}):n("div",{...s,ref:r,className:m("graphicBlock",o),children:[e?.title&&t(P,{data:{title:e.title,align:e?.titleAlign??"left"}}),n(W,{value:Y,onValueChange:_,align:j,children:[t("div",{className:"mb-[24px]",children:t(ee,{children:f.map(a=>t(te,{value:a.id,children:a.label},a.id))})}),f.map(a=>t(oe,{value:a.id,children:t(A,{items:a.items,sharedConfig:S})},a.id))]}),V()]})});U.displayName="Graphic";var Ie=F(U);export{Ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as d}from"react/jsx-runtime";import R,{useState as B,useEffect as U,useRef as A}from"react";import{useMediaQuery as E}from"react-responsive";import{withLayout as D}from"../../shared/Styles.js";import C from"../../components/picture.js";import O from"../../components/button.js";import{Heading as I}from"../../components/heading.js";import{Tabs as H,TabsList as Y,TabsTrigger as Q,TabsContent as q}from"../../components/tabs.js";import{VideoModal as Z}from"../VideoModal/index.js";import{cn as v,getLocalizedPath as P}from"../../helpers/utils.js";import _ from"../SwiperBox/index.js";import{isVideo as L}from"../../shared/mimeType.js";import{useExposure as j}from"../../hooks/useExposure.js";import{trackUrlRef as V}from"../../shared/trackUrlRef.js";import{useAiuiContext as F}from"../AiuiProvider/index.js";import{useTracking as J}from"../../hooks/useTracking.js";const f="image",g="p1_banner",K=({data:o,configuration:t,jIndex:m})=>{const{buildRef:u}=J(),[y,n]=B(!1),l=E({query:"(max-width: 768px)"}),c=A(null),i=()=>{switch(t?.num){case 1:return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case 2:return"tablet:aspect-w-[346] tablet:aspect-h-[400] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case 3:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[426] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[426] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}};j(c,{componentType:f,componentName:g,position:m,componentTitle:o.title,componentDescription:o.description,navigation:t?.activeTab}),U(()=>{n(l)},[l]);const{theme:k="light",title:a,description:p,imageUrl:r,primaryButton:h,secondaryButton:b,imageMobileUrl:w,blockLink:x,video:$,youtubeId:T,isYouTube:M}=o,N="lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px]";return d("div",{className:v("item-wrapper text-info-primary group relative box-border w-full overflow-hidden",i(),{"rounded-box":!0,"aiui-dark":k==="dark","h-[400px]":y},"text-info-primary"),ref:c,children:[x&&e("a",{className:"absolute inset-0 z-10",href:V(P(x||"",t?.locale||"us"),u(f,g)),"data-headless-type-name":`${f}#${g}`,"data-headless-title-desc-button":`${a}#${p}`,"data-headless-nav-position":`${t?.activeTab}#${m}`,"aria-hidden":"true",tabIndex:-1}),d("div",{className:"absolute inset-0",children:[L(r?.mimeType)?e("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:block hidden h-full overflow-hidden",children:e("source",{src:r?.url,type:"video/mp4"})}):e(C,{source:r?.url,alt:r?.alt||"",className:"tablet:block hidden h-full overflow-hidden",imgClassName:v("h-full object-cover",x&&"transition-all duration-300 group-hover:scale-105"),style:{aspectRatio:`${r?.width}/${r?.height}`}}),L(w?.mimeType)?e("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:hidden block h-full overflow-hidden",children:e("source",{src:w?.url,type:"video/mp4"})}):e(C,{source:w?.url||r?.url,alt:w?.alt||r?.alt||"",className:"tablet:hidden block h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 object-cover"}),d("div",{className:v("laptop:p-6 desktop:p-[32px] laptop:gap-4 desktop:gap-6 pointer-events-none absolute inset-x-0 bottom-0 z-20 flex w-fit flex-col gap-6 p-4",{"laptop:top-1/2 laptop:-translate-y-1/2 laptop:bottom-auto":o?.width==="full"}),children:[d("div",{className:"flex flex-col gap-1",children:[e(I,{size:3,as:"h3",className:"item-title",html:a}),e(I,{as:"h4",className:"item-description desktop:text-[16px] lg-desktop:text-[18px] line-clamp-3 text-[14px]",html:p})]}),d("div",{className:"lg-desktop:gap-3 flex gap-2",children:[b&&b.text&&d(O,{"aria-label":a??p,className:v(N,"link-left pointer-events-auto"),variant:"secondary",as:"a",href:V(P(b.link||"",t?.locale||"us"),u(f,g)),"data-headless-type-name":`${f}#${g}`,"data-headless-title-desc-button":`${a}#${p}#${b?.text}`,"data-headless-nav-position":`${t?.activeTab}#${m}`,children:[b.text,e("span",{className:"sr-only",children:a??p})]}),h&&h.text&&e(O,{"aria-label":a??p,className:v(N,"link-right pointer-events-auto"),variant:"primary",as:"a",href:V(P(h.link||"",t?.locale||"us"),u(f,g)),"data-headless-type-name":`${f}#${g}`,"data-headless-title-desc-button":`${a}#${p}#${h.text}`,"data-headless-nav-position":`${t?.activeTab}#${m}`,children:h.text})]})]})]}),e("div",{children:e("div",{className:"laptop:bottom-[32px] laptop:right-[32px] absolute bottom-[16px] right-[16px]",children:($?.url||T)&&e("button",{onClick:()=>{t?.onVideoPlayBtnClick?.($?.url||T,M)},className:"laptop:size-12 hover:bg-current/75 bg-info-primary flex size-8 items-center justify-center rounded-full opacity-80",children:e("svg",{width:"12",height:"14",viewBox:"0 0 12 14",fill:k==="dark"?"black":"white",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M12 7L0 14L0 0L12 7Z"})})})})})]})},S=({items:o=[],shape:t,locale:m,activeTab:u,onVideoPlayBtnClick:y})=>{const n=l=>{const c=o?.length,i=c>3,k=c>2,a=c>1;switch(!0){case l>=1440:case l>=1024:return i?3:c;case l>=768:return i||k?2.3:a?2:1;default:return a?1.2:1}};return e(_,{className:"!overflow-visible",id:"GraphicOverlaySwiper",data:{list:o||[],configuration:{shape:t,num:o.length,locale:m,activeTab:u,onVideoPlayBtnClick:y}},Slide:K,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:n(374)},768:{spaceBetween:16,freeMode:!1,slidesPerView:n(768)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:n(1024)},1440:{spaceBetween:16,freeMode:!1,slidesPerView:n(1440)}}})},G=R.forwardRef((o,t)=>{const{data:m,className:u,...y}=o,{shape:n,items:l=[],isShowTab:c=!1,tabs:i,tabAlign:k="left"}=m,[a,p]=B(!1),[r,h]=B(""),[b,w]=B(""),[x,$]=B(i?.[0]?.id??""),{locale:T="us"}=F(),M=(s,z)=>{p(!0),z?w?.(s||""):h?.(s||"")},N=()=>e(Z,{visible:a,youTubeId:b,videoUrl:r,onCloseModal:()=>p(!1)});return!c||!i||i.length===0?d("section",{"data-ui-component-id":"GraphicOverlay",ref:t,...y,className:v("graphicOverlayBlock text-info-primary ",u),children:[l&&l.length>0?e(S,{items:l,shape:n,locale:T,onVideoPlayBtnClick:M}):null,a&&N()]}):d("section",{"data-ui-component-id":"GraphicOverlay",ref:t,...y,className:v("graphicOverlayBlock text-info-primary ",u),children:[d(H,{value:x,onValueChange:$,align:k,children:[e("div",{className:"mb-6",children:e(Y,{children:i.map(s=>e(Q,{value:s.id,children:s.label},s.id))})}),i.map(s=>e(q,{value:s.id,children:s.items&&s.items.length>0?e(S,{items:s.items,shape:n,locale:T,activeTab:s.id,onVideoPlayBtnClick:M}):null},s.id))]}),a&&N()]})});G.displayName="GraphicOverlayBlock";var ue=D(G);export{ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as rt,jsx as t,jsxs as u}from"react/jsx-runtime";import pe,{useImperativeHandle as Ee,useRef as k,useState as Me,useEffect as Pe}from"react";import N from"gsap";import{ScrollTrigger as C}from"gsap/dist/ScrollTrigger";import O from"jump.js";import{buildPictureSource as Re,resolveTierMedia as L,useMediaTier as De}from"./mediaResolver.js";import{useInView as je}from"react-intersection-observer";import Ae from"../../helpers/ScrollLoadVideo.js";import{Button as V,Heading as Oe,Picture as U,Text as G,Countdown as Ue}from"../../components/index.js";import{cn as p}from"../../helpers/index.js";import{cva as S}from"class-variance-authority";import{withLayout as Ge}from"../../shared/Styles.js";import{useExposure as Je}from"../../hooks/useExposure.js";import{buildTrackingRef as _e,trackUrlRef as z}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as h,resolveComponentMediaType as qe}from"../../shared/track.js";import{getLocalizedPath as Fe}from"../../helpers/utils.js";import{useAiuiContext as We}from"../AiuiProvider/index.js";import{sizeMap as Ye}from"../../components/button.js";import{VideoModal as Ze}from"../VideoModal/index.js";import Ke from"./HeroBannerCarousel.js";const f="hero_banner",Qe=S("hero-banner-content lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"tablet:px-[32px] laptop:top-1/2 laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] laptop:-translate-y-1/2 left-0 px-[16px]",center:"tablet:top-[84px] laptop:top-[76px] desktop:top-[176px] lg-desktop:top-[192px] left-1/2 top-[84px] -translate-x-1/2 translate-y-0 items-center text-center"}},defaultVariants:{align:"left"}}),Xe=S("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),$e=S("hero-banner-button-group lg-desktop:gap-x-3 pointer-events-auto flex flex-wrap items-center gap-x-2 gap-y-3",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),et=S("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),tt=({size:s="base"})=>{const{width:T,height:c}=Ye[s];return t("svg",{width:T,height:c,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},ce=pe.forwardRef(({data:s,className:T,classNames:c={},onSecondaryClick:J,onPrimaryClick:_,onTertiaryClick:q,jumpOptions:ue={},a11yLabels:me,...F},W)=>{const{locale:Y,pageHandle:de}=We(),Z=s.mode!=="single"&&!!s.items&&s.items.length>0,I={...{duration:500,offset:0},...ue},w=e=>!e||!Y?e:Fe(e,Y),{label:K,title:l,subtitle:o,endDate:Q,endDate_tz:fe,dateFormat:ge,pcImage:E,isShowVideo:X,isVideoLoop:be=!0,primaryButton:a,secondaryButton:r,tertiaryButton:i,theme:ve="light",size:M="default",titleSize:P,caption:$=[],blockLink:B,iconArray:ee,align:b="left",enableParallax:te=!0}=s,R=Array.isArray($)?$:[],ye=Array.isArray(ee)?ee:void 0,re=De(),ne=Re(s),xe=L(s,re,"video")?.url||"",[oe,ae]=Me(!1),{ref:ke,inView:ie}=je(),D=k(null),j=k(null),A=k(null),v=k(null),d=k(null),m=qe(X),H=_e(de??"",m,f),g=L(s,re,m==="video"?"video":"image")?.id||E?.id||"",he=l?.trim()||o?.trim()||E?.alt?.trim()||void 0,Te=l!==void 0?l?.trim()||o?.trim()||E?.alt?.trim()||void 0:o&&o.trim()||"",we=o&&o.trim()||"";Je(d,{componentType:m,componentName:f,componentTitle:Te,componentDescription:we,creativeId:g,position:1});const Be=B?z(w(B),H):void 0,He=r?.link?z(w(r.link),H):void 0,Ne=a?.link?z(w(a.link),H):void 0,Ce=i?.link?z(w(i.link),H):void 0,Le=h({interactive:!!B,componentType:m,componentName:f,title:l,description:o,position:1,creativeId:g}),Ve=h({interactive:!0,componentType:m,componentName:f,title:l,description:o,buttonName:"video play",position:1,creativeId:g}),Se=h({interactive:!!(r?.link||r?.isCustomSecondaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:r?.text,position:1,creativeId:g}),ze=h({interactive:!!(a?.link||a?.isCustomPrimaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:a?.text,position:1,creativeId:g}),Ie=h({interactive:!!(i?.link||i?.isCustomTertiaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:i?.text,position:1,creativeId:g});return Ee(W,()=>d.current),Pe(()=>{if(Z||!te)return;N.registerPlugin(C);function e(){if(!v.current)return;const n=d.current?.clientHeight||100;window.innerHeight<=n?D.current=C.create({trigger:d.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*40-20;N.set(v.current,{yPercent:x})}}):(A.current=C.create({trigger:d.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:y=>{const x=y.progress*20-20;N.set(v.current,{yPercent:x})}}),j.current=C.create({trigger:d.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*20;N.set(v.current,{yPercent:x})}}))}return ie&&e(),()=>{D.current&&D.current.kill(),A.current&&A.current.kill(),j.current&&j.current.kill()}},[ie,s.items,te]),Z?t(Ke,{data:s,className:T,classNames:c,onPrimaryClick:_,onSecondaryClick:J,onTertiaryClick:q,a11yLabels:me,ref:W,...F}):t("div",{...F,ref:ke,"data-ui-component-id":"HeroBanner",className:p(c.root),children:u("div",{ref:d,className:p(ve==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":M==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":M==="sm"},T),children:[B&&t("a",{className:"absolute inset-0 z-10",href:Be,tabIndex:-1,"aria-hidden":"true","aria-label":he,...Le}),t("div",{ref:v,className:p("absolute left-0 top-0 size-full"),children:X?u(rt,{children:[t(Ae,{poster:void 0,src:xe,className:"laptop:w-full absolute inset-0 h-full transition-opacity duration-500",videoLayerClassName:"opacity-0",videoClassName:"h-full object-cover",muted:!0,loop:be,playsInline:!0,onPlaying:e=>{const n=e.currentTarget;n.parentElement?.classList.remove("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:e=>{const n=e.currentTarget;if(n.currentTime>=.5)return;n.parentElement?.classList.add("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),t("div",{"data-video-poster":"true",className:"laptop:w-full bg-container-primary pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:t(U,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})})]}):t(U,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})}),u("div",{className:Qe({align:b}),children:[u("div",{className:Xe({align:b}),children:[K&&t(G,{size:2,as:"p",className:p("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:K}),l&&t(Oe,{as:P==="4"?"h1":"h2",html:l,className:p("hero-banner-title",c.title),size:P?Number(P||"5"):M==="sm"?4:5}),o&&t(G,{as:"p",size:2,className:p("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",c.subtitle),html:o}),Q&&t("div",{className:"mt-3",children:t(Ue,{endDate:Q,endDate_tz:fe,dateFormat:ge,variant:"spacious",align:b})})]}),u("div",{className:p($e({align:b}),c.buttonGroup),children:[u("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[r?.isShowPlayVideoButton&&r?.playVideoButtonText?u(V,{onClick:()=>ae(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...Ve,children:[r?.playVideoButtonText," ",t(tt,{size:"lg"})]}):r?.text?u(V,{"aria-label":l??o,size:"lg",variant:"secondary",className:p("hero-banner-secondary-button",c.secondaryButton),as:r?.isCustomSecondaryButton?"button":"a",href:He,target:r?.target,rel:r?.target==="_blank"?r?.rel??"noopener noreferrer":r?.rel,onClick:e=>{if(r.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(r.link);n&&O(n,I)}r?.isCustomSecondaryButton&&J?.(s,e,r?.customSecondaryEventId)},...Se,children:[r?.text,t("span",{className:"sr-only",children:l??o})]}):null,a&&a.text&&t(V,{"aria-label":l??o,size:"lg",variant:"primary",className:p("hero-banner-primary-button",c.primaryButton),as:a?.isCustomPrimaryButton?"button":"a",href:Ne,target:a?.target,rel:a?.target==="_blank"?a?.rel??"noopener noreferrer":a?.rel,onClick:e=>{if(a.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(a.link);n&&O(n,I)}a?.isCustomPrimaryButton&&_?.(s,e,a?.customPrimaryEventId)},...ze,children:a.text})]}),i&&i.text&&u(V,{"aria-label":l??o,size:"lg",variant:"link",className:p("hero-banner-tertiary-button w-auto p-0",c.tertiaryButton),as:i?.isCustomTertiaryButton?"button":"a",href:Ce,target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:e=>{if(i.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(i.link);n&&O(n,I)}i?.isCustomTertiaryButton&&q?.(s,e,i?.customTertiaryEventId)},...Ie,children:[i.text,t("span",{className:"sr-only",children:l??o})]})]}),t("div",{className:et({align:b}),children:ye?.map(e=>t("div",{className:"h-12",children:t(U,{className:"!inline-block h-full !w-auto",imgClassName:"!w-auto h-full object-contain",loading:"eager",alt:e?.pcImage?.alt||"",source:e?.pcImage?.url})},e?.pcImage?.url||e?.pcImage?.alt))})]}),R.length>0&&t("div",{className:p("hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] pointer-events-none absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]",c.captionGroup),children:R.map((e,n)=>u(pe.Fragment,{children:[t(G,{size:2,className:p("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:e.title}),n<R.length-1&&t("div",{className:p("bg-info-primary w-px")})]},e.title))}),oe&&t(Ze,{visible:oe,videoUrl:r?.isYoutubeVideo?void 0:r?.videoUrl?.url,youTubeId:r?.isYoutubeVideo?r?.youtubeId:void 0,onCloseModal:()=>ae(!1)})]})})});ce.displayName="HeroBanner";var wt=Ge(ce);export{wt as default};
|
|
1
|
+
"use client";import{Fragment as rt,jsx as t,jsxs as u}from"react/jsx-runtime";import ce,{useImperativeHandle as Ee,useRef as k,useState as Me,useEffect as Pe}from"react";import N from"gsap";import{ScrollTrigger as C}from"gsap/dist/ScrollTrigger";import O from"jump.js";import{buildPictureSource as Re,resolveTierMedia as L,useMediaTier as De}from"./mediaResolver.js";import{useInView as je}from"react-intersection-observer";import Ae from"../../helpers/ScrollLoadVideo.js";import{Button as V,Heading as Oe,Picture as U,Text as G,Countdown as Ue}from"../../components/index.js";import{cn as c}from"../../helpers/index.js";import{cva as S}from"class-variance-authority";import{withLayout as Ge}from"../../shared/Styles.js";import{useExposure as Je}from"../../hooks/useExposure.js";import{buildTrackingRef as _e,trackUrlRef as z}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as h,resolveComponentMediaType as qe}from"../../shared/track.js";import{getLocalizedPath as Fe}from"../../helpers/utils.js";import{useAiuiContext as We}from"../AiuiProvider/index.js";import{sizeMap as Ye}from"../../components/button.js";import{VideoModal as Ze}from"../VideoModal/index.js";import Ke from"./HeroBannerCarousel.js";const f="hero_banner",Qe=S("hero-banner-content lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"laptop:top-1/2 px-grid laptop:-translate-y-1/2 left-0",center:"tablet:top-[84px] laptop:top-[76px] desktop:top-[176px] lg-desktop:top-[192px] left-1/2 top-[84px] -translate-x-1/2 translate-y-0 items-center text-center"}},defaultVariants:{align:"left"}}),Xe=S("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),$e=S("hero-banner-button-group lg-desktop:gap-x-3 pointer-events-auto flex flex-wrap items-center gap-x-2 gap-y-3",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),et=S("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),tt=({size:s="base"})=>{const{width:T,height:p}=Ye[s];return t("svg",{width:T,height:p,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},pe=ce.forwardRef(({data:s,className:T,classNames:p={},onSecondaryClick:J,onPrimaryClick:_,onTertiaryClick:q,jumpOptions:ue={},a11yLabels:me,...F},W)=>{const{locale:Y,pageHandle:de}=We(),Z=s.mode!=="single"&&!!s.items&&s.items.length>0,I={...{duration:500,offset:0},...ue},w=e=>!e||!Y?e:Fe(e,Y),{label:K,title:l,subtitle:o,endDate:Q,endDate_tz:fe,dateFormat:ge,pcImage:E,isShowVideo:X,isVideoLoop:be=!0,primaryButton:a,secondaryButton:r,tertiaryButton:i,theme:ve="light",size:M="default",titleSize:P,caption:$=[],blockLink:B,iconArray:ee,align:b="left",enableParallax:te=!0}=s,R=Array.isArray($)?$:[],ye=Array.isArray(ee)?ee:void 0,re=De(),ne=Re(s),xe=L(s,re,"video")?.url||"",[oe,ae]=Me(!1),{ref:ke,inView:ie}=je(),D=k(null),j=k(null),A=k(null),v=k(null),d=k(null),m=qe(X),H=_e(de??"",m,f),g=L(s,re,m==="video"?"video":"image")?.id||E?.id||"",he=l?.trim()||o?.trim()||E?.alt?.trim()||void 0,Te=l!==void 0?l?.trim()||o?.trim()||E?.alt?.trim()||void 0:o&&o.trim()||"",we=o&&o.trim()||"";Je(d,{componentType:m,componentName:f,componentTitle:Te,componentDescription:we,creativeId:g,position:1});const Be=B?z(w(B),H):void 0,He=r?.link?z(w(r.link),H):void 0,Ne=a?.link?z(w(a.link),H):void 0,Ce=i?.link?z(w(i.link),H):void 0,Le=h({interactive:!!B,componentType:m,componentName:f,title:l,description:o,position:1,creativeId:g}),Ve=h({interactive:!0,componentType:m,componentName:f,title:l,description:o,buttonName:"video play",position:1,creativeId:g}),Se=h({interactive:!!(r?.link||r?.isCustomSecondaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:r?.text,position:1,creativeId:g}),ze=h({interactive:!!(a?.link||a?.isCustomPrimaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:a?.text,position:1,creativeId:g}),Ie=h({interactive:!!(i?.link||i?.isCustomTertiaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:i?.text,position:1,creativeId:g});return Ee(W,()=>d.current),Pe(()=>{if(Z||!te)return;N.registerPlugin(C);function e(){if(!v.current)return;const n=d.current?.clientHeight||100;window.innerHeight<=n?D.current=C.create({trigger:d.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*40-20;N.set(v.current,{yPercent:x})}}):(A.current=C.create({trigger:d.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:y=>{const x=y.progress*20-20;N.set(v.current,{yPercent:x})}}),j.current=C.create({trigger:d.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*20;N.set(v.current,{yPercent:x})}}))}return ie&&e(),()=>{D.current&&D.current.kill(),A.current&&A.current.kill(),j.current&&j.current.kill()}},[ie,s.items,te]),Z?t(Ke,{data:s,className:T,classNames:p,onPrimaryClick:_,onSecondaryClick:J,onTertiaryClick:q,a11yLabels:me,ref:W,...F}):t("div",{...F,ref:ke,"data-ui-component-id":"HeroBanner",className:c(p.root),children:u("div",{ref:d,className:c(ve==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":M==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":M==="sm"},T),children:[B&&t("a",{className:"absolute inset-0 z-10",href:Be,tabIndex:-1,"aria-hidden":"true","aria-label":he,...Le}),t("div",{ref:v,className:c("absolute left-0 top-0 size-full"),children:X?u(rt,{children:[t(Ae,{poster:void 0,src:xe,className:"laptop:w-full absolute inset-0 h-full transition-opacity duration-500",videoLayerClassName:"opacity-0",videoClassName:"h-full object-cover",muted:!0,loop:be,playsInline:!0,onPlaying:e=>{const n=e.currentTarget;n.parentElement?.classList.remove("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:e=>{const n=e.currentTarget;if(n.currentTime>=.5)return;n.parentElement?.classList.add("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),t("div",{"data-video-poster":"true",className:"laptop:w-full bg-container-primary pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:t(U,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})})]}):t(U,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})}),u("div",{className:Qe({align:b}),children:[u("div",{className:Xe({align:b}),children:[K&&t(G,{size:2,as:"p",className:c("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:K}),l&&t(Oe,{as:P==="4"?"h1":"h2",html:l,className:c("hero-banner-title",p.title),size:P?Number(P||"5"):M==="sm"?4:5}),o&&t(G,{as:"p",size:2,className:c("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",p.subtitle),html:o}),Q&&t("div",{className:"mt-3",children:t(Ue,{endDate:Q,endDate_tz:fe,dateFormat:ge,variant:"spacious",align:b})})]}),u("div",{className:c($e({align:b}),p.buttonGroup),children:[u("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[r?.isShowPlayVideoButton&&r?.playVideoButtonText?u(V,{onClick:()=>ae(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...Ve,children:[r?.playVideoButtonText," ",t(tt,{size:"lg"})]}):r?.text?u(V,{"aria-label":l??o,size:"lg",variant:"secondary",className:c("hero-banner-secondary-button",p.secondaryButton),as:r?.isCustomSecondaryButton?"button":"a",href:He,target:r?.target,rel:r?.target==="_blank"?r?.rel??"noopener noreferrer":r?.rel,onClick:e=>{if(r.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(r.link);n&&O(n,I)}r?.isCustomSecondaryButton&&J?.(s,e,r?.customSecondaryEventId)},...Se,children:[r?.text,t("span",{className:"sr-only",children:l??o})]}):null,a&&a.text&&t(V,{"aria-label":l??o,size:"lg",variant:"primary",className:c("hero-banner-primary-button",p.primaryButton),as:a?.isCustomPrimaryButton?"button":"a",href:Ne,target:a?.target,rel:a?.target==="_blank"?a?.rel??"noopener noreferrer":a?.rel,onClick:e=>{if(a.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(a.link);n&&O(n,I)}a?.isCustomPrimaryButton&&_?.(s,e,a?.customPrimaryEventId)},...ze,children:a.text})]}),i&&i.text&&u(V,{"aria-label":l??o,size:"lg",variant:"link",className:c("hero-banner-tertiary-button w-auto p-0",p.tertiaryButton),as:i?.isCustomTertiaryButton?"button":"a",href:Ce,target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:e=>{if(i.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(i.link);n&&O(n,I)}i?.isCustomTertiaryButton&&q?.(s,e,i?.customTertiaryEventId)},...Ie,children:[i.text,t("span",{className:"sr-only",children:l??o})]})]}),t("div",{className:et({align:b}),children:ye?.map(e=>t("div",{className:"h-12",children:t(U,{className:"!inline-block h-full !w-auto",imgClassName:"!w-auto h-full object-contain",loading:"eager",alt:e?.pcImage?.alt||"",source:e?.pcImage?.url})},e?.pcImage?.url||e?.pcImage?.alt))})]}),R.length>0&&t("div",{className:c("hero-banner-caption-group laptop:gap-3 px-grid desktop:pb-[24px] pointer-events-none absolute bottom-0 z-10 flex items-stretch gap-2 pb-[16px]",p.captionGroup),children:R.map((e,n)=>u(ce.Fragment,{children:[t(G,{size:2,className:c("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:e.title}),n<R.length-1&&t("div",{className:c("bg-info-primary w-px")})]},e.title))}),oe&&t(Ze,{visible:oe,videoUrl:r?.isYoutubeVideo?void 0:r?.videoUrl?.url,youTubeId:r?.isYoutubeVideo?r?.youtubeId:void 0,onCloseModal:()=>ae(!1)})]})})});pe.displayName="HeroBanner";var wt=Ge(pe);export{wt as default};
|