@anker-in/headless-ui 1.3.84 → 1.3.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/biz-components/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/ImageWithText/ImageWithText.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/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/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/ImageWithText/ImageWithText.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/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/shared/track.d.ts +13 -7
- package/dist/esm/shared/track.js +1 -1
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as i,jsxs as a}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{jsx as i,jsxs as a}from"react/jsx-runtime";import C from"../Title/index.js";import{cn as o}from"../../helpers/utils.js";import x from"../../components/picture.js";import L from"../../components/button.js";import D from"../SwiperBox/index.js";import{withLayout as S}from"../../shared/Styles.js";import j,{useState as _,useRef as T,useCallback as A,useImperativeHandle as z,useEffect as M}from"react";import{useExposure as E}from"../../hooks/useExposure.js";import{trackUrlRef as k}from"../../shared/trackUrlRef.js";import P from"../../shared/throttle.js";import{Heading as w}from"../../components/heading.js";import{useTracking as B}from"../../hooks/useTracking.js";const l="image",s="scene_banner",O=({item:e,idx:t,itemShape:c,hoverIndex:m,getRef:I,handleSwiperItemClick:g,contentWidth:d,primaryButton:p,event:u,data:f,accordionRef:N})=>{const{buildRef:y}=B(),v=m===t,R=v?8:1;return E({current:N.current[t]},{componentType:l,componentName:s,componentTitle:e?.title,position:t+1,componentDescription:e?.subTitle}),a("div",{style:{flex:`${R} 1 0%`,transition:"all 0.6s"},ref:h=>{h&&I(t,h)},className:o("rounded-box relative cursor-pointer overflow-hidden"),onMouseEnter:()=>g(t),onClick:()=>{g(t)},children:[e?.imgLink?i("a",{href:k(e.imgLink,y(l,s)),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}`,children:i(x,{source:e?.img?.url,className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",alt:e?.img?.alt||""})}):i(x,{source:e?.img?.url,className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",alt:e?.img?.alt||""}),a("div",{style:{width:d},className:o("absolute inset-x-0 bottom-0 flex w-full items-end justify-between overflow-hidden px-8 pb-8 opacity-0 transition-opacity duration-[600ms] ease-in",v&&d?"opacity-100":"opacity-0"),children:[a("div",{className:"mr-16 flex-1 overflow-hidden",children:[i(w,{as:"h3",className:"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold",html:e?.title}),i(w,{as:"h4",className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]",html:e?.subTitle})]}),p&&a(L,{className:o("mb-1.5 font-bold"),as:"a",href:k(e?.link,y(l,s)),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${p}`,onClick:()=>u?.primaryButton?.(f,t),children:[p,i("span",{className:"sr-only",children:e?.title??e?.subTitle})]})]})]},t)},V=({data:e,configuration:t})=>{const{buildRef:c}=B(),m=T(null);return E(m,{componentType:l,componentName:s,componentTitle:e?.title,position:t?.index+1,componentDescription:e?.subTitle}),a("div",{ref:m,className:o("bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid","rounded-box"),children:[e?.imgLink?i("a",{href:k(e.imgLink,c(l,s)),"data-headless-type-name":`${l}#${s}`,"data-headless-title-desc-button":`${e?.title}@${e?.subTitle}`,"data-headless-nav-position":`''#${t?.index+1}`,children:i(x,{className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",source:e?.mobileImg?.url||"",alt:e?.mobileImg?.alt||""})}):i(x,{className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",source:e?.mobileImg?.url||"",alt:e?.mobileImg?.alt||""}),a("div",{className:o("absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4"),children:[a("div",{className:"tablet:mb-6 mb-4 flex-1 overflow-hidden",children:[i(w,{as:"h3",className:"text-info-primary line-clamp-3 text-2xl font-bold leading-[1.2]",html:e?.title}),i(w,{as:"h4",className:"text-info-primary line-clamp-2 text-sm font-bold",html:e?.subTitle})]}),t?.primaryButton&&i(L,{as:"a",variant:"secondary","aria-label":e?.title??e?.subTitle,className:o("text-info-primary text-sm font-bold"),href:k(e.link,c(l,s)),"data-headless-type-name":`${l}#${s}`,"data-headless-nav-position":`''#${t?.index+1}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${t?.primaryButton}`,children:t?.primaryButton})]})]})},H=j.forwardRef(({data:e,autoplay:t={enabled:!1,loop:!1,interval:1500},className:c="",event:m,...I},g)=>{const[d,p]=_(0),u=T(0),f=T([]),[N,y]=_(0),v=T(null);z(g,()=>v.current);const R=(n,r)=>{r&&(f.current[n]=r)};M(()=>{const n=()=>{f.current[u.current]&&y(f.current[u.current].offsetWidth)};n();const r=P(n,300);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]);const h=A(n=>{d!==n&&(p(n),u.current=n)},[e?.products,d]);return M(()=>{let n;return t?.enabled&&(n=setInterval(()=>{p(r=>{const $=r??0;let b;if(t.loop!==!1)b=($+1)%e?.products?.length;else if(b=$+1,b>=e?.products?.length)return b=e?.products?.length-1,n&&clearInterval(n),$;return u.current=b,b})},t?.interval)),()=>{n&&clearInterval(n)}},[t?.enabled,t?.interval,t?.loop,e?.products?.length,h]),a("div",{...I,ref:v,children:[e?.title&&i(C,{data:{title:e?.title}}),i("div",{className:o("laptop:block hidden",{"aiui-dark":e?.theme==="dark"}),children:i("div",{className:o("lg-desktop:h-[calc(560_/_1920*100vw)] desktop:h-[calc(448_/_1440*100vw)] laptop:h-[calc(336_/_1025*100vw)] flex max-h-[560px] min-h-[336px] w-full gap-4 overflow-hidden",c),children:e?.products?.map((n,r)=>i(O,{item:n,idx:r,itemShape:e?.itemShape,hoverIndex:d,getRef:R,handleSwiperItemClick:h,contentWidth:N,primaryButton:e?.primaryButton,event:m,data:e,accordionRef:f},r))})}),i("div",{className:o("laptop:hidden block",{"aiui-dark":e?.theme==="dark"}),children:i(D,{className:o("h-[400px] !overflow-visible",c),id:"AccordionCards"+e?.key,data:{list:e?.products,configuration:{shape:e?.shape,itemShape:e?.itemShape,primaryButton:e?.primaryButton,event:m,title:e?.title}},Slide:V,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3}}})})]})});H.displayName="AccordionCards";var te=S(H);export{te as default};
|
|
@@ -101,12 +101,13 @@ export interface VariantData {
|
|
|
101
101
|
*/
|
|
102
102
|
export interface ProductCardData extends BaseProductData, VariantData {
|
|
103
103
|
}
|
|
104
|
-
/**
|
|
105
|
-
* 产品卡片组件 Props
|
|
106
|
-
*/
|
|
107
104
|
export interface ProductCardProps {
|
|
108
105
|
/** 产品数据 */
|
|
109
106
|
product: ProductCardData;
|
|
107
|
+
/** 当前所在 Tab 的文案,上报为 navigation */
|
|
108
|
+
tabName?: string;
|
|
109
|
+
/** 卡片在列表中的位置(从 1 开始),上报为 position */
|
|
110
|
+
position?: number;
|
|
110
111
|
/** 样式类名 */
|
|
111
112
|
className?: string;
|
|
112
113
|
/** 是否展示标签系统 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as Ie,jsx as t,jsxs as l}from"react/jsx-runtime";import*as L from"react";import{cn as a}from"../../helpers/index.js";import{Button as J,Badge as Ne,Card as Pe,CardContent as Ae,Picture as Q,Text as x,Heading as D,Progress as Be}from"../../components/index.js";import{toPlainTrackingText as z}from"../../shared/track.js";import{trackUrlRef as Le}from"../../shared/trackUrlRef.js";import{useTracking as De}from"../../hooks/useTracking.js";import{MemberLabel as ze}from"./MemberLabel.js";import{layoutModeStyles as W}from"./styles.js";const _e=5,X="shelf",Y="active_shelf";function Re(e,n,r,y){if(e===void 0)return!0;switch(e){case"always":return!0;case"never":return!1;case"below-quantity":return n===void 0?!0:r<=n;case"below-percentage":return n===void 0?!0:r/y*100<=n;default:return!0}}const Me=({items:e})=>e?.length?t("div",{className:"active-shelf-display-social-endorsements desktop:gap-2 laptop:flex absolute right-0 top-0 z-10 hidden flex-col items-center gap-1",children:e.slice(0,3).map((n,r)=>typeof n.icon=="string"?t("img",{src:n.icon,alt:n.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},r):t(x,{"aria-label":n.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:n.icon},r))}):null,Z={style1:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/2_7746fc9c-d4e4-4a59-a972-fa4cb0f3f8bd.png?v=1789381635",textClass:"aiui-dark text-info-primary"},style2:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/1_e0438358-493b-40cb-9a58-89d6ee2d3751.png?v=1789381628",textClass:"aiui-dark text-info-primary"},style3:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/1_19208ba4-71ea-4580-892d-72167f1cf606.png?v=1789381639",textClass:"aiui-dark text-info-primary"}},we=({text:e,style:n="style1",icon:r,className:y,textClassName:_,textColor:h,layoutMode:C="flex",renderBadge:v})=>{if(!e)return null;const g=n==="custom",k=g&&!!v,o=g&&!v&&!!r?.url,m=g?void 0:Z[n],S=Z.style1,c=W[C],T={style1:c.discountBadgeText,style2:c.discountBadgeTextStyle2,style3:c.discountBadgeTextStyle3},N=g?c.discountBadgeTextCenter:T[n];return l("div",{className:a("active-shelf-discount-badge","absolute left-0 top-0 z-30",c.discountBadgeSize,y),children:[k?v({text:e,layoutMode:C}):o?t(Q,{source:r.url,alt:r.alt||e,className:"block size-full",imgClassName:"block size-full object-contain"}):t("img",{src:(m??S).bg,alt:e,loading:"lazy",className:"block size-full object-contain"}),!k&&t(x,{className:a("active-shelf-discount-badge-text text-center","absolute inset-0 font-bold !leading-[1.2]",N,(m??S).textClass,_),style:h?{color:h}:void 0,html:e})]})},w=L.forwardRef(({product:e,tabName:n="",position:r=1,className:y,showTags:_=!0,stockDisplayMode:h,stockThresholdValue:C,onLearnMore:v,onShopNow:g,onAddToCart:k,classNames:o,secondaryButtonText:m,secondaryButtonFun:S,primaryButtonText:c,primaryButtonFun:T,showOriginalPrice:N,renderOriginalPrice:I,copy:f,onProductImageClick:b,tagTypeConfig:E,fill:F,outline:j,memberPriceTextColor:q,userType:P,memberImages:ee,customTagsIcon:te,customTagStyle:ae,discountTagTextColor:ie,onMemberSignUp:ne,onPlusMemberAddCart:oe,showMemberPrice:V,layoutMode:R,renderDiscountBadge:se},re)=>{const[le,ce]=L.useState(!1),[de,ue]=L.useState(!1),{buildRef:ge}=De(),me=e.custom_name||e.name,A=i=>({"data-headless-type-name":`${X}#${Y}`,"data-headless-title-desc-button":`${z(me)}#${z(e.description)}#${z(i)}`,"data-headless-nav-position":`${z(n)}#${r}`,...e.sku?{"data-headless-sku":e.sku}:{}}),B=e?.listingLink?Le(e.listingLink,ge(X,Y)):void 0,fe=e?.memberDiscountAmount,be=e?.plusMemberDiscountAmount,pe=e?.activityLabels??[],ye=P==="guest"?"guest":"member",$=pe.find(i=>i.type===ye)?.label,ve=P==="guest"?f?.memberActivityLabelUnLogin:f?.memberActivityLabel,Se=!!$||!!ve,xe=e?.discountAmount,s=W[R??"flex"],he=L.useMemo(()=>e?.availableForSale&&e?.quantityAvailable<=0?_e:e?.availableForSale?(e?.quantityAvailable??0)/(e?.totalInventory??1)*100:0,[e?.availableForSale,e?.quantityAvailable,e?.totalInventory]),O=async(i,d)=>{if(!i)return;const u=d==="primary"?ce:ue;u(!0);try{switch(i){case"buyNow":await g?.(e);break;case"addCart":await k?.(e);break;case"learnMore":await v?.(e);break;default:break}}finally{u(!1)}},Ce=e.availableForSale&&e.quantityAvailable<=0,ke=(i,d)=>{const u=i===0?E?.firstTagVariant:i===1?E?.secondTagVariant:void 0,M=(u||void 0)??(d==="fill"?"fill":d!==void 0?"outline":i===0?"fill":"outline"),p=M==="fill"?{outline:F?.outlineColor,bg:F?.bgColor}:{outline:j?.outlineColor,bg:j?.bgColor},K={...p.outline?{outlineColor:p.outline}:{},...p.bg?{backgroundColor:p.bg,backgroundImage:"none"}:{}};return M==="outline"&&p.outline&&(K.color=p.outline),{variant:M,style:K}},U=!!e.custom_bg_image,Te=!!e.custom_scene_image,H=i=>i?{backgroundImage:`url(${i})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"}:void 0;return l(Pe,{ref:re,className:a("active-shelf-card","hover:bg-container-secondary-0 bg-container-primary relative flex h-full cursor-pointer flex-col overflow-hidden border-none",s.cardRadius,y,o?.productCard),children:[t(we,{text:xe,style:ae,icon:te,layoutMode:R,renderBadge:se,className:o?.discountBadge,textClassName:o?.discountBadgeText,textColor:ie}),l(Ae,{className:a(s.cardContent,"relative flex flex-1 flex-col justify-between"),children:[l("div",{className:"product-image-wrapper group/product-image laptop:pb-2 laptop:mb-4 desktop:pb-6 desktop:mb-4 relative mb-4",children:[U&&t("div",{"aria-hidden":!0,className:a("pointer-events-none absolute inset-0 z-20",s.imageOffset),style:H(e.custom_bg_image)}),Te&&t("div",{"aria-hidden":!0,className:a("laptop:block laptop:group-hover/product-image:opacity-100 pointer-events-none absolute inset-0 z-20 hidden opacity-0 transition-opacity duration-300",s.imageOffset),style:H(e.custom_scene_image)}),t("div",{className:a("product-image mx-auto cursor-pointer overflow-hidden",s.image),children:t("a",{onClick:()=>b?.(e),...!b&&{href:B},...b||B?A():{},rel:"noreferrer",className:a("block size-full",U&&"opacity-0"),children:t(Q,{source:e.image,alt:e.name,className:"aspect-square size-full object-contain",imgClassName:"size-full object-contain"})})}),t(Me,{items:e?.socialEndorsements})]}),_&&t("div",{className:"desktop:mb-2 mb-1 flex h-[24px] gap-1",children:e.tags?.map((i,d)=>{if(!i.label)return null;const{variant:u,style:G}=ke(d,i.variant);return t(Ne,{size:"sm",variant:u,className:"active-shelf-items-tag py-0",style:G,children:i.label},d)})}),l("div",{className:"flex h-full flex-1 grow flex-col justify-between gap-4",children:[l("div",{children:[t(D,{as:"h3",size:"none",className:a("text-info-primary",s.title,o?.productTitle),children:t("a",{onClick:()=>b?.(e),...!b&&{href:B},...b||B?A():{},rel:"noreferrer",className:"hover:text-brand-0 cursor-pointer ",children:e.custom_name||e.name})}),e?.description&&t(x,{size:"none",className:a("active-shelf-product-description text-info-primary",s.description,o?.productDescription),html:e.custom_description||e.description})]}),l("div",{children:[t("div",{className:a(o?.productPrice),children:t("div",{className:a("flex items-baseline",s.priceGap),children:e.availableForSale?l(Ie,{children:[t(D,{size:"none",className:a("text-info-primary",s.price),as:"h6",children:e.price}),I?I(e,{showOriginalPrice:N}):N&&e.originalPrice&&t(D,{size:"none",className:a("text-info-tertiary line-through",s.price,o?.originalPrice),as:"h6",children:e.originalPrice})]}):t(D,{size:"none",className:a("text-info-tertiary",s.price),children:f?.outOfStockLabel??"Sold Out"})})}),V&&e?.priceLabel&&e?.availableForSale&&t("div",{className:a("min-h-[1lh]",s.priceLabel),children:t(x,{size:"none",className:a("text-brand-0",o?.productPriceLabel),style:{...q?{color:q}:{}},children:e.priceLabel})}),l("div",{className:a("mt-2 flex",s.buttonContainer,o?.buttonGroup),children:[m&&t(J,{variant:"secondary",size:"lg",className:a(s.buttonItem,o?.secondaryButton),onClick:()=>O(S,"secondary"),disabled:!e.availableForSale&&S!=="learnMore",loading:de,...A(m),children:m}),c&&t(J,{variant:"primary",size:"lg",className:a(s.buttonItem,o?.primaryButton),onClick:()=>O(T,"primary"),disabled:!e.availableForSale&&T!=="learnMore",loading:le,...A(c),children:c})]}),Re(h,C,e?.quantityAvailable??0,e?.totalInventory??0)&&l("div",{className:"active-shelf-stock mt-4 flex flex-col gap-1",children:[t(Be,{value:he,max:100,min:0,size:"base",variant:"default","aria-label":"stock progress",classNames:{root:a("active-shelf-stock-track","bg-[var(--progress-track-bg,rgba(0,0,0,0.2))]",o?.stockTrack),progressBar:a("active-shelf-stock-bar","bg-brand-0 transition-all duration-300 ease-in-out",o?.stockBar)}}),t(x,{size:3,className:"text-info-tertiary text-[14px]",children:Ce?f?.limitedStock:f?.stockDisplayText?.replace("{count}",`${e.availableForSale?e.quantityAvailable:0}`)})]})]})]})]}),V&&P&&t(ze,{userType:P,copy:f,images:ee,onSignUp:ne,onPlusMemberAddCart:oe,hasActivity:Se,activityLabel:$,memberDiscountAmount:fe,plusMemberDiscountAmount:be,layoutMode:R})]})});w.displayName="ActiveShelf.ProductCard";var Ue=w;export{w as ProductCard,Ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as ge,jsx as t,jsxs as n}from"react/jsx-runtime";import*as i from"react";import{cn as p}from"../../helpers/index.js";import{withLayout as Ce}from"../../shared/Styles.js";import{Text as xe,Heading as ve,Tabs as Pe,TabsList as Me,TabsTrigger as ke,TabsContent as Se}from"../../components/index.js";import le from"../PromotionalBar/index.js";import{Swiper as Be,SwiperSlide as De}from"swiper/react";import{Navigation as Le}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import{ProductCard as ie}from"./ProductCard.js";import{useExposure as Ne}from"../../hooks/useExposure.js";const Re="shelf",Ae="active_shelf",Ee=()=>n("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"prev-mask bg-masks-0 group-hover/prev-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M15 6L9 12L15 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),Ie=()=>n("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"next-mask bg-masks-0 group-hover/next-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M9 6L15 12L9 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});function ce(r){return typeof window>"u"?2:window.matchMedia("(min-width: 1440px)").matches?r==="3"?3:4:window.matchMedia("(min-width: 768px)").matches?3:2}function de(){return typeof window>"u"?!0:!window.matchMedia("(min-width: 768px)").matches}function ue(){return typeof window>"u"?!1:window.matchMedia("(min-width: 1025px)").matches}const se=i.forwardRef(({products:r,layoutMode:o,className:$,copy:c,showTags:f,stockDisplayMode:T,stockThresholdValue:y,onLearnMore:h,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:P,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,renderDiscountBadge:D,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,discountTagTextColor:A,onMemberSignUp:E,onPlusMemberAddCart:q,tileMaxRowsPc:Z,tileMaxRowsMob:G,tileDesktopColumns:l,tileExpandText:J,tileCollapseText:K,showMemberPrice:I},Q)=>{const z=i.useId().replace(/:/g,""),F=`swiper-button-next-custom-${z}`,H=`swiper-button-prev-custom-${z}`,[O,d]=i.useState({isBeginning:!0,isEnd:!1}),X=i.useRef(null),u=i.useCallback(()=>{const e=X.current;if(!e?.slides||e.slides.length===0)return;e.slides.forEach(U=>{U.style.height="auto"});const V=Array.from(e.slides).map(U=>U.scrollHeight),ne=Math.max(...V);ne>0&&e.slides.forEach(U=>{U.style.height=`${ne}px`})},[]);i.useEffect(()=>{const e=()=>{requestAnimationFrame(u)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[u]);const[g,s]=i.useState(!1),[Y,ee]=i.useState(()=>ce(l)),[fe,Te]=i.useState(()=>de()),[ye,he]=i.useState(()=>ue());i.useEffect(()=>{const e=()=>{ee(ce(l)),Te(de()),he(ue())};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[l]);const te=o==="horizontal"&&!ye?"flex":o,oe=fe?G:Z,re=te==="flex"&&!!oe&&oe>0,ae=oe?oe*Y:r.length,be=re&&r.length>ae,we=re&&!g?r.slice(0,ae):r;return r?.length===0?null:t("div",{ref:Q,className:$,children:te==="flex"?n(ge,{children:[t("div",{className:p("tablet:grid-cols-3 tablet:gap-4 grid grid-cols-2 justify-start gap-3",l==="3"?"desktop:grid-cols-3 lg-desktop:grid-cols-3":"desktop:grid-cols-4 lg-desktop:grid-cols-4"),children:we.map((e,V)=>t(ie,{product:e,layoutMode:te,className:"shrink-0",showTags:f,stockDisplayMode:T,stockThresholdValue:y,onLearnMore:h,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:P,renderDiscountBadge:D,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,copy:c,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,discountTagTextColor:A,onMemberSignUp:E,onPlusMemberAddCart:q,showMemberPrice:I},e.shopify_id+"-"+e.sku||V))}),be&&n("div",{className:"active-shelf-toggle laptop:hover:text-brand-0 text-info-primary mt-6 flex items-center justify-center",children:[t("button",{className:"laptop:text-base text-sm font-bold",onClick:()=>s(e=>!e),children:g?K??"Show less":J??"Show more"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",className:p("laptop:size-5 size-4",g&&"rotate-180"),width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:t("path",{d:"M17.2929 8.29302C17.6834 7.90249 18.3164 7.90249 18.707 8.29302C19.0975 8.68354 19.0975 9.31655 18.707 9.70708L12.707 15.7071C12.3164 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70708C4.90237 9.31655 4.90237 8.68354 5.29289 8.29302C5.68342 7.90249 6.31643 7.90249 6.70696 8.29302L11.9999 13.586L17.2929 8.29302Z",fill:"currentColor"})})]})]}):n("div",{className:"group relative",children:[t(Be,{modules:[Le],spaceBetween:16,navigation:{nextEl:`.${F}`,prevEl:`.${H}`},onSwiper:e=>{X.current=e,d({isBeginning:e.isBeginning,isEnd:e.isEnd}),setTimeout(u,100)},slidesPerView:3,breakpoints:{1025:{freeMode:!1,slidesPerView:3},1440:{freeMode:!1,slidesPerView:l==="3"?3:4}},onReachEnd:()=>{d(e=>({...e,isEnd:!0}))},onReachBeginning:()=>{d(e=>({...e,isBeginning:!0}))},onFromEdge:()=>{d({isBeginning:!1,isEnd:!1})},className:"!overflow-visible [&_.swiper-wrapper]:items-start",children:r.map((e,V)=>t(De,{className:"overflow-hidden",children:t(ie,{product:e,layoutMode:te,className:"w-full max-w-full",showTags:f,stockDisplayMode:T,stockThresholdValue:y,onLearnMore:h,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:P,renderDiscountBadge:D,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,copy:c,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,discountTagTextColor:A,onMemberSignUp:E,onPlusMemberAddCart:q,showMemberPrice:I})},e.shopify_id+"-"+e.sku||V))}),t("button",{className:`${H} tablet:block group/prev-mask absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 ${O.isBeginning?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":c?.previousSlideLabel,children:t(Ee,{})}),t("button",{className:`${F} tablet:block group/next-mask absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 ${O.isEnd?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":c?.nextSlideLabel,children:t(Ie,{})})]})})});se.displayName="ProductsList";const pe=i.forwardRef(({className:r,data:o,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:T,onMemberSignUp:y,onPlusMemberAddCart:h,classNames:a,renderOriginalPrice:b,renderDiscountBadge:w,...j},W)=>{const m=i.useRef(null);Ne(m,{componentType:Re,componentName:Ae,componentTitle:o.title,componentDescription:o.description}),i.useImperativeHandle(W,()=>m.current);const{theme:C="light",layoutMode:x="flex",showTags:v=!0,stockDisplayMode:P,stockThresholdValue:M,showOriginalPrice:k,secondaryButtonText:S,primaryButtonText:B,secondaryButtonFun:D,primaryButtonFun:L,isShowTab:_=!0,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,copy:q,userType:Z,memberImages:G,customTagsIcon:l,customTagStyle:J,discountTagTextColor:K,showMemberPrice:I,tileMaxRowsPc:Q,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O}=o,d=q||{},X=o.productsTab&&o.productsTab.length>0,u=_&&X,g=u?void 0:o.resourceBlocks?.find(s=>s.blockType==="PromotionalBar"&&s.display==="visible");return n("div",{ref:m,className:p("w-full",{"aiui-dark":C==="dark"},r,a?.root),style:{"--progress-track-bg":C==="dark"?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)"},...j,children:[o.title&&t(ve,{as:"h2",html:o.title,size:4,className:p("text-info-primary mb-4 leading-tight",a?.title)}),o.description&&t(xe,{size:3,as:"p",html:o.description,className:p("text-info-primary mb-6",a?.description)}),n(Pe,{defaultValue:o.productsTab?.[0]?.id,className:"w-full",children:[u&&t(Me,{className:"mb-6",children:o.productsTab?.map(s=>t(ke,{value:s.id,children:s.tab},"tab-"+s.id))}),u?o.productsTab?.map(s=>{const Y=s.resourceBlocks?.find(ee=>ee.blockType==="PromotionalBar"&&ee.display==="visible");return n(Se,{value:s.id,children:[Y&&t(le,{data:Y,className:p("laptop:mb-4 mb-3",a?.promotionalBar)}),t(se,{products:s.data,layoutMode:x,copy:d,showTags:v,stockDisplayMode:P,stockThresholdValue:M,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:T,classNames:a,secondaryButtonText:S,secondaryButtonFun:D,primaryButtonText:B,primaryButtonFun:L,showOriginalPrice:k,renderOriginalPrice:b,renderDiscountBadge:w,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,userType:Z,memberImages:G,customTagsIcon:l,customTagStyle:J,discountTagTextColor:K,onMemberSignUp:y,onPlusMemberAddCart:h,showMemberPrice:I,tileMaxRowsPc:Q,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O})]},"tab-content-"+s.id)}):n(ge,{children:[g&&t(le,{data:g,className:p("laptop:mb-4 mb-3",a?.promotionalBar)}),t(se,{products:o.productsCard,layoutMode:x,copy:d,showTags:v,stockDisplayMode:P,stockThresholdValue:M,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:T,classNames:a,secondaryButtonText:S,secondaryButtonFun:D,primaryButtonText:B,primaryButtonFun:L,showOriginalPrice:k,renderOriginalPrice:b,renderDiscountBadge:w,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,userType:Z,memberImages:G,customTagsIcon:l,customTagStyle:J,discountTagTextColor:K,onMemberSignUp:y,onPlusMemberAddCart:h,showMemberPrice:I,tileMaxRowsPc:Q,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O})]})]})]})});pe.displayName="ActiveShelf";const me=pe;me.ProductCard=ie;const ze=Ce(me);var Ge=ze;export{Ge as default};
|
|
1
|
+
"use client";import{Fragment as Te,jsx as t,jsxs as a}from"react/jsx-runtime";import*as s from"react";import{cn as f}from"../../helpers/index.js";import{withLayout as Se}from"../../shared/Styles.js";import{Text as Be,Heading as De,Tabs as Le,TabsList as Ne,TabsTrigger as Re,TabsContent as Ae}from"../../components/index.js";import ue from"../PromotionalBar/index.js";import{Swiper as Ee,SwiperSlide as Ie}from"swiper/react";import{Navigation as ze}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import{ProductCard as se}from"./ProductCard.js";import{useExposure as $e}from"../../hooks/useExposure.js";import{toPlainTrackingText as h}from"../../shared/track.js";const re="shelf",ne="active_shelf",Fe=()=>a("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"prev-mask bg-masks-0 group-hover/prev-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M15 6L9 12L15 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),He=()=>a("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"next-mask bg-masks-0 group-hover/next-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M9 6L15 12L9 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});function pe(d){return typeof window>"u"?2:window.matchMedia("(min-width: 1440px)").matches?d==="3"?3:4:window.matchMedia("(min-width: 768px)").matches?3:2}function me(){return typeof window>"u"?!0:!window.matchMedia("(min-width: 768px)").matches}function ge(){return typeof window>"u"?!1:window.matchMedia("(min-width: 1025px)").matches}const ae=s.forwardRef(({tabName:d="",shelfTitle:o="",shelfDescription:q="",products:n,layoutMode:b,className:Z,copy:u,showTags:w,stockDisplayMode:r,stockThresholdValue:C,onLearnMore:v,onShopNow:G,onAddToCart:J,onProductImageClick:T,classNames:x,secondaryButtonText:P,secondaryButtonFun:M,primaryButtonText:k,primaryButtonFun:S,showOriginalPrice:B,renderOriginalPrice:D,tagTypeConfig:L,fill:N,outline:R,memberPriceTextColor:K,renderDiscountBadge:A,userType:E,memberImages:I,customTagsIcon:z,customTagStyle:Q,discountTagTextColor:$,onMemberSignUp:F,onPlusMemberAddCart:H,tileMaxRowsPc:X,tileMaxRowsMob:Y,tileDesktopColumns:l,tileExpandText:O,tileCollapseText:V,showMemberPrice:U},ee)=>{const j=s.useId().replace(/:/g,""),W=`swiper-button-next-custom-${j}`,te=`swiper-button-prev-custom-${j}`,[y,p]=s.useState({isBeginning:!0,isEnd:!1}),i=s.useRef(null),c=s.useCallback(()=>{const e=i.current;if(!e?.slides||e.slides.length===0)return;e.slides.forEach(_=>{_.style.height="auto"});const g=Array.from(e.slides).map(_=>_.scrollHeight),de=Math.max(...g);de>0&&e.slides.forEach(_=>{_.style.height=`${de}px`})},[]);s.useEffect(()=>{const e=()=>{requestAnimationFrame(c)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[c]);const[m,ye]=s.useState(!1),[be,we]=s.useState(()=>pe(l)),[Ce,ve]=s.useState(()=>me()),[xe,Pe]=s.useState(()=>ge());s.useEffect(()=>{const e=()=>{we(pe(l)),ve(me()),Pe(ge())};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[l]);const oe=b==="horizontal"&&!xe?"flex":b,ie=Ce?Y:X,le=oe==="flex"&&!!ie&&ie>0,ce=ie?ie*be:n.length,Me=le&&n.length>ce,ke=le&&!m?n.slice(0,ce):n;return n?.length===0?null:t("div",{ref:ee,className:Z,children:oe==="flex"?a(Te,{children:[t("div",{className:f("tablet:grid-cols-3 tablet:gap-4 grid grid-cols-2 justify-start gap-3",l==="3"?"desktop:grid-cols-3 lg-desktop:grid-cols-3":"desktop:grid-cols-4 lg-desktop:grid-cols-4"),children:ke.map((e,g)=>t(se,{product:e,tabName:d,position:g+1,layoutMode:oe,className:"shrink-0",showTags:w,stockDisplayMode:r,stockThresholdValue:C,onLearnMore:v,onShopNow:G,onAddToCart:J,onProductImageClick:T,classNames:x,secondaryButtonText:P,secondaryButtonFun:M,primaryButtonText:k,primaryButtonFun:S,showOriginalPrice:B,renderOriginalPrice:D,renderDiscountBadge:A,tagTypeConfig:L,fill:N,outline:R,memberPriceTextColor:K,copy:u,userType:E,memberImages:I,customTagsIcon:z,customTagStyle:Q,discountTagTextColor:$,onMemberSignUp:F,onPlusMemberAddCart:H,showMemberPrice:U},e.shopify_id+"-"+e.sku||g))}),Me&&a("div",{className:"active-shelf-toggle laptop:hover:text-brand-0 text-info-primary mt-6 flex items-center justify-center",children:[t("button",{className:"laptop:text-base text-sm font-bold",onClick:()=>ye(e=>!e),"data-headless-type-name":`${re}#${ne}`,"data-headless-title-desc-button":`${h(o)}#${h(q)}#${m?V??"Show less":O??"Show more"}`,"data-headless-nav-position":`${h(d)}#1`,children:m?V??"Show less":O??"Show more"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",className:f("laptop:size-5 size-4",m&&"rotate-180"),width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:t("path",{d:"M17.2929 8.29302C17.6834 7.90249 18.3164 7.90249 18.707 8.29302C19.0975 8.68354 19.0975 9.31655 18.707 9.70708L12.707 15.7071C12.3164 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70708C4.90237 9.31655 4.90237 8.68354 5.29289 8.29302C5.68342 7.90249 6.31643 7.90249 6.70696 8.29302L11.9999 13.586L17.2929 8.29302Z",fill:"currentColor"})})]})]}):a("div",{className:"group relative",children:[t(Ee,{modules:[ze],spaceBetween:16,navigation:{nextEl:`.${W}`,prevEl:`.${te}`},onSwiper:e=>{i.current=e,p({isBeginning:e.isBeginning,isEnd:e.isEnd}),setTimeout(c,100)},slidesPerView:3,breakpoints:{1025:{freeMode:!1,slidesPerView:3},1440:{freeMode:!1,slidesPerView:l==="3"?3:4}},onReachEnd:()=>{p(e=>({...e,isEnd:!0}))},onReachBeginning:()=>{p(e=>({...e,isBeginning:!0}))},onFromEdge:()=>{p({isBeginning:!1,isEnd:!1})},className:"!overflow-visible [&_.swiper-wrapper]:items-start",children:n.map((e,g)=>t(Ie,{className:"overflow-hidden",children:t(se,{product:e,tabName:d,position:g+1,layoutMode:oe,className:"w-full max-w-full",showTags:w,stockDisplayMode:r,stockThresholdValue:C,onLearnMore:v,onShopNow:G,onAddToCart:J,onProductImageClick:T,classNames:x,secondaryButtonText:P,secondaryButtonFun:M,primaryButtonText:k,primaryButtonFun:S,showOriginalPrice:B,renderOriginalPrice:D,renderDiscountBadge:A,tagTypeConfig:L,fill:N,outline:R,memberPriceTextColor:K,copy:u,userType:E,memberImages:I,customTagsIcon:z,customTagStyle:Q,discountTagTextColor:$,onMemberSignUp:F,onPlusMemberAddCart:H,showMemberPrice:U})},e.shopify_id+"-"+e.sku||g))}),t("button",{className:`${te} tablet:block group/prev-mask absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 ${y.isBeginning?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":u?.previousSlideLabel,children:t(Fe,{})}),t("button",{className:`${W} tablet:block group/next-mask absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 ${y.isEnd?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":u?.nextSlideLabel,children:t(He,{})})]})})});ae.displayName="ProductsList";const fe=s.forwardRef(({className:d,data:o,onLearnMore:q,onShopNow:n,onAddToCart:b,onProductImageClick:Z,onMemberSignUp:u,onPlusMemberAddCart:w,classNames:r,renderOriginalPrice:C,renderDiscountBadge:v,...G},J)=>{const T=s.useRef(null);$e(T,{componentType:re,componentName:ne,componentTitle:o.title,componentDescription:o.description}),s.useImperativeHandle(J,()=>T.current);const{theme:x="light",layoutMode:P="flex",showTags:M=!0,stockDisplayMode:k,stockThresholdValue:S,showOriginalPrice:B,secondaryButtonText:D,primaryButtonText:L,secondaryButtonFun:N,primaryButtonFun:R,isShowTab:K=!0,tagTypeConfig:A,fill:E,outline:I,memberPriceTextColor:z,copy:Q,userType:$,memberImages:F,customTagsIcon:H,customTagStyle:X,discountTagTextColor:Y,showMemberPrice:l,tileMaxRowsPc:O,tileMaxRowsMob:V,tileDesktopColumns:U,tileExpandText:ee,tileCollapseText:j}=o,W=Q||{},te=o.productsTab&&o.productsTab.length>0,y=K&&te,p=y?void 0:o.resourceBlocks?.find(i=>i.blockType==="PromotionalBar"&&i.display==="visible");return a("div",{ref:T,className:f("w-full",{"aiui-dark":x==="dark"},d,r?.root),style:{"--progress-track-bg":x==="dark"?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)"},...G,children:[o.title&&t(De,{as:"h2",html:o.title,size:4,className:f("text-info-primary mb-4 leading-tight",r?.title)}),o.description&&t(Be,{size:3,as:"p",html:o.description,className:f("text-info-primary mb-6",r?.description)}),a(Le,{defaultValue:o.productsTab?.[0]?.id,className:"w-full",children:[y&&t(Ne,{className:"mb-6",children:o.productsTab?.map((i,c)=>t(Re,{value:i.id,"data-headless-type-name":`${re}#${ne}`,"data-headless-title-desc-button":`${h(o.title)}#${h(o.description)}#${h(i.tab)}`,"data-headless-nav-position":`${h(i.tab)}#${c+1}`,children:i.tab},"tab-"+i.id))}),y?o.productsTab?.map(i=>{const c=i.resourceBlocks?.find(m=>m.blockType==="PromotionalBar"&&m.display==="visible");return a(Ae,{value:i.id,children:[c&&t(ue,{data:c,className:f("laptop:mb-4 mb-3",r?.promotionalBar)}),t(ae,{tabName:i.tab,shelfTitle:o.title,shelfDescription:o.description,products:i.data,layoutMode:P,copy:W,showTags:M,stockDisplayMode:k,stockThresholdValue:S,onLearnMore:q,onShopNow:n,onAddToCart:b,onProductImageClick:Z,classNames:r,secondaryButtonText:D,secondaryButtonFun:N,primaryButtonText:L,primaryButtonFun:R,showOriginalPrice:B,renderOriginalPrice:C,renderDiscountBadge:v,tagTypeConfig:A,fill:E,outline:I,memberPriceTextColor:z,userType:$,memberImages:F,customTagsIcon:H,customTagStyle:X,discountTagTextColor:Y,onMemberSignUp:u,onPlusMemberAddCart:w,showMemberPrice:l,tileMaxRowsPc:O,tileMaxRowsMob:V,tileDesktopColumns:U,tileExpandText:ee,tileCollapseText:j})]},"tab-content-"+i.id)}):a(Te,{children:[p&&t(ue,{data:p,className:f("laptop:mb-4 mb-3",r?.promotionalBar)}),t(ae,{shelfTitle:o.title,shelfDescription:o.description,products:o.productsCard,layoutMode:P,copy:W,showTags:M,stockDisplayMode:k,stockThresholdValue:S,onLearnMore:q,onShopNow:n,onAddToCart:b,onProductImageClick:Z,classNames:r,secondaryButtonText:D,secondaryButtonFun:N,primaryButtonText:L,primaryButtonFun:R,showOriginalPrice:B,renderOriginalPrice:C,renderDiscountBadge:v,tagTypeConfig:A,fill:E,outline:I,memberPriceTextColor:z,userType:$,memberImages:F,customTagsIcon:H,customTagStyle:X,discountTagTextColor:Y,onMemberSignUp:u,onPlusMemberAddCart:w,showMemberPrice:l,tileMaxRowsPc:O,tileMaxRowsMob:V,tileDesktopColumns:U,tileExpandText:ee,tileCollapseText:j})]})]})]})});fe.displayName="ActiveShelf";const he=fe;he.ProductCard=se;const Oe=Se(he);var Ye=Oe;export{Ye as default};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ActivityMechanismProps } from './types.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
declare const ActivityMechanism: React.ForwardRefExoticComponent<ActivityMechanismProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
-
export default ActivityMechanism;
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<ActivityMechanismProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../index.js").ContainerProps & React.RefAttributes<unknown>> & {
|
|
4
|
+
readonly $$typeof: symbol;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as U,jsx as l,jsxs as h}from"react/jsx-runtime";import $,{useImperativeHandle as P,useRef as z}from"react";import{Heading as x,Picture as y,Text as A,Button as D,Link as H,Container as w}from"../../components/index.js";import{withLayout as L}from"../../shared/Styles.js";import{cn as o}from"../../helpers/utils.js";import{useExposure as b}from"../../hooks/useExposure.js";import{useTracking as B}from"../../hooks/useTracking.js";import{trackUrlRef as T}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as E,toPlainTrackingText as M}from"../../shared/track.js";import{cva as v}from"class-variance-authority";import{getLocalizedPath as R}from"../../helpers/index.js";import{useAiuiContext as S}from"../AiuiProvider/index.js";const m="image",u="activity_mechanism",N=v("line-clamp-2",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{theme:"light"}}),C=v("desktop:text-[16px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] tracking-[-0.02em]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white/80"}},defaultVariants:{theme:"light"}}),F=v("mt-2 !p-0 text-[14px]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{theme:"light"}}),f={default:767,tablet:1024,laptop:1439,desktop:1919,lgDesktop:9999},j=t=>{if(!t)return"";const e=[];return t.lgDesktop?.url&&e.push(`${t.lgDesktop.url}`),t.desktop?.url&&e.push(`${t.desktop.url} ${f.desktop}`),t.laptop?.url&&e.push(`${t.laptop.url} ${f.laptop}`),t.tablet?.url&&e.push(`${t.tablet.url} ${f.tablet}`),t.default?.url&&e.push(`${t.default.url} ${f.default}`),e.join(", ")},K=t=>t&&(t.default?.alt||t.tablet?.alt||t.laptop?.alt||t.desktop?.alt||t.lgDesktop?.alt)||"",O=({item:t,theme:e,classNames:s})=>{const{title:i,description:p,linkText:a,linkHref:n,backgroundImage:c}=t,r=j(c),d=K(c),{locale:g="us"}=S(),{buildRef:k}=B();return l("div",{className:o("rounded-card relative flex flex-col overflow-hidden","desktop:px-6 h-[280px] p-4","laptop:gap-4 gap-3","laptop:h-[320px] lg-desktop:h-[400px]",s?.card),children:n?h(H,{href:R(T(n,k(m,u)),g),className:"no-underline",...E({interactive:!0,componentType:m,componentName:u,title:M(i),description:M(p),buttonName:a}),children:[r&&l(y,{source:r,alt:d||i,className:o("absolute inset-0 size-full",s?.background),imgClassName:"size-full object-cover"}),h("div",{className:"relative z-10",children:[l(x,{as:"h3",size:3,className:o(N({theme:e}),s?.title),children:i}),l(A,{as:"p",className:o(C({theme:e}),s?.description),children:p}),a&&l(D,{variant:"link",as:"a",href:R(T(n,k(m,u)),g),className:o(F({theme:e}),s?.link),children:a})]})]}):h(U,{children:[r&&l(y,{source:r,alt:d||i,className:o("absolute inset-0 size-full",s?.background),imgClassName:"size-full object-cover"}),h("div",{className:"relative z-10",children:[l(x,{as:"h3",size:3,className:o(N({theme:e}),s?.title),children:i}),l(A,{as:"p",className:o(C({theme:e}),s?.description),children:p})]})]})})},V=$.forwardRef(({data:t,classNames:e},s)=>{const{items:i=[],theme:p="light"}=t,a=z(null);if(P(s,()=>a.current),b(a,{componentType:m,componentName:u,componentTitle:i[0]?.title||"",componentDescription:i[0]?.description||""}),!i||i.length===0)return null;const n={1:"laptop:grid-cols-1 desktop:grid-cols-1 lg-desktop:grid-cols-1",2:"laptop:grid-cols-2 desktop:grid-cols-2 lg-desktop:grid-cols-2",3:"tablet:grid-cols-2 laptop:grid-cols-3 desktop:grid-cols-3 lg-desktop:grid-cols-3",4:"laptop:grid-cols-4 desktop:grid-cols-4 lg-desktop:grid-cols-4"},c=n[Math.min(i.length,4)]||n[4];return l(w,{"data-ui-component-id":"ActivityMechanism",className:o("activity-mechanism","w-full",e?.root),ref:a,children:l("div",{className:o("tablet:grid-cols-2 laptop:gap-4 grid grid-cols-1 gap-3",c,e?.grid),children:i.map((r,d)=>l(O,{item:r,theme:p,classNames:{...e,...i?.length===3&&{card:e?.card+" first:tablet:col-span-full first:laptop:col-span-1"}}},`${r.title}-${d}`))})})});V.displayName="ActivityMechanism";var et=L(V);export{et as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as i,jsxs as f}from"react/jsx-runtime";import*as c from"react";import{cn as r}from"../../helpers/index.js";import{Text as P,Picture as I,Heading as g,Container as L,Link as T}from"../../components/index.js";import{cva as w}from"class-variance-authority";import{Swiper as V,SwiperSlide as z}from"swiper/react";import{withLayout as B}from"../../shared/Styles.js";import{useExposure as E}from"../../hooks/useExposure.js";import{useTracking as R}from"../../hooks/useTracking.js";import{trackUrlRef as j}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as D,toPlainTrackingText as x}from"../../shared/track.js";const m="image",v="activity_schedule",H=w("rounded-card laptop:px-6 laptop:py-4 relative flex min-w-0 flex-col justify-between gap-2 overflow-hidden px-4 py-3",{variants:{state:{"active-light":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","active-dark":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","inactive-light":"bg-[#EAEAEC]","inactive-dark":"bg-[#1E2024]"},size:{small:"laptop:h-[160px] h-[120px]",large:"laptop:h-[240px] h-[200px]"}},defaultVariants:{state:"inactive-light",size:"small"}}),h=w("font-bold leading-[1.2]",{variants:{state:{"active-light":"text-white","active-dark":"text-white","inactive-light":"text-[#080A0F]","inactive-dark":"text-white"}},defaultVariants:{state:"inactive-light"}}),y=c.memo(({item:e,theme:s="light",className:d,size:n,position:u})=>{const l=e.isActive||!1,{buildRef:o}=R(),t=`${l?"active":"inactive"}-${s}`;return i("div",{className:r(H({state:t,size:n}),d),"data-ui-component-id":"ActivityScheduleCard",children:f(T,{asChild:!e?.link,href:e?.link?j(e.link,o(m,v)):void 0,className:"size-full no-underline hover:text-current",...D({interactive:!!e?.link,componentType:m,componentName:v,title:e.title,description:e.subtitle,position:u}),children:[(l?e.activeIcon:e.inactiveIcon)&&i("div",{className:"laptop:w-[160px] aspect-1 absolute right-0 top-0 z-10 w-[120px]",children:i(I,{source:l?e.activeIcon.url:e.inactiveIcon.url,alt:l?e.activeIcon.alt:e.inactiveIcon.alt,className:"aspect-square"})}),f("div",{className:"relative z-20 flex h-full flex-col justify-between",children:[i(g,{as:"h3",size:3,html:e.title,className:r(h({state:t}))}),f("div",{className:"flex flex-col gap-1",children:[i("div",{className:"flex flex-col justify-end overflow-hidden",children:i(g,{as:"h4",size:2,html:e.subtitle,className:r(" line-clamp-2",h({state:t}))})}),n==="large"&&e.description&&i(P,{html:e.description,className:r("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-3 text-[14px] leading-[1.4]",h({state:t}))})]})]})]})})});y.displayName="ActivityScheduleCard";const k=c.forwardRef(({classNames:e={},data:s,...d},n)=>{const u=s.theme||"light",l=s.size||"large",o=c.useRef(null);c.useImperativeHandle(n,()=>o.current),E(o,{componentType:m,componentName:v,componentTitle:s.scheduleList?.map(a=>x(a.title)).join(" | "),componentDescription:s.scheduleList?.map(a=>x(a.subtitle)).join(" | ")});const t=c.useMemo(()=>s?.scheduleList?.length||2,[s?.scheduleList]),b=c.useMemo(()=>{const a=C=>{switch(C){case"mobile":return{slidesPerView:1.17,spaceBetween:12};case"tablet":return t===2?{slidesPerView:2,spaceBetween:12}:{slidesPerView:2.4,spaceBetween:12};case"laptop":return t===2?{}:t===4?{slidesPerView:3.2,spaceBetween:16}:{slidesPerView:t,spaceBetween:16};case"desktop":return t===2?{slidesPerView:2,spaceBetween:16}:{slidesPerView:t,spaceBetween:16}}},p=a("mobile"),S=a("tablet"),A=a("laptop"),N=a("desktop");return{0:p,768:S,1024:A,1440:N}},[t]);return i(L,{ref:o,className:r(e?.root),childClassName:"overflow-hidden","data-ui-component-id":"ActivitySchedule",...d,children:i(V,{breakpoints:b,className:"w-full !overflow-visible",children:s.scheduleList.map((a,p)=>i(z,{children:i(y,{item:a,theme:u,size:l,className:e?.card,position:p+1})},"activityScheduleCardItem"+p))})})});k.displayName="ActivitySchedule";var O=B(k);export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as h}from"react/jsx-runtime";import{gaTrack as P}from"../../shared/track.js";import{buildPageGroup as R}from"../../shared/trackUrlRef.js";import{createContext as N,useContext as H,useEffect as i,useMemo as G,useRef as u,useState as L}from"react";import{extendLocaleMap as w}from"../../helpers/index.js";const x=N({trackingData:{},locale:void 0,copyWriting:{}}),K=()=>{const o=H(x);if(!o)throw new Error("useAiui must be used in <AiuiProvider>");return o},O=({children:o,...e})=>{const d=u(null),l=u(e?.trackingData),g=u(e?.pageHandle),[m,C]=L(void 0);i(()=>{e.localeMap&&Object.keys(e.localeMap).length>0&&w(e.localeMap)},[e.localeMap]),i(()=>{l.current=e?.trackingData},[e?.trackingData]),i(()=>{g.current=e?.pageHandle},[e?.pageHandle]),i(()=>{const r=d.current;if(!r)return;const v=()=>{r.querySelectorAll("[data-headless-type-name]").forEach(n=>{n.closest("[data-aiui-provider-root]")===r&&(n.hasAttribute("data-headless-track-bound")||(n.addEventListener("click",a=>E(a,n)),n.setAttribute("data-headless-track-bound","true")))})},E=(n,a)=>{const t={};if(!a||!a.attributes)return t;for(const M of Array.from(a.attributes)){const p=M?.name;p?.startsWith("data-headless-")&&(t[p]=a.getAttribute(p))}const D=t?.["data-headless-sku"],T=t?.["data-headless-creative-id"],b=t?.["data-headless-type-name"]?.split?.("#"),s=t?.["data-headless-title-desc-button"]?.split?.("#"),y=t?.["data-headless-nav-position"]?.split?.("#"),_=R({pageHandle:g.current,pageGroup:l.current?.pageGroup}),c=y?.[1],k=c===void 0||c===""?"":Number(c);P({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:_,component_type:b?.[0]||"",component_name:b?.[1]||"",position:Number.isNaN(k)?"":k,navigation:y?.[0]||"",button_name:s?.[2]||"",SKU:D||"",creative_id:T||"",component_title:s?.[0]||"",component_description:s?.[1]||""}})},f=new MutationObserver(v);return f.observe(r,{childList:!0,subtree:!0}),v(),()=>f.disconnect()},[]);const A=G(()=>({...e,navCollapsed:m,setNavCollapsed:C}),[e,m]);return h(x.Provider,{value:A,children:h("div",{ref:d,"data-aiui-provider-root":"",children:o})})};var U=O;export{x as AiuiContext,U as default,K as useAiuiContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as p}from"react/jsx-runtime";import*as
|
|
1
|
+
"use client";import{jsx as p}from"react/jsx-runtime";import*as a from"react";import{cn as g}from"../../helpers/utils.js";import{cva as h}from"class-variance-authority";import H from"./useAnchorPosition.js";import{Container as k}from"../../components/container.js";import{withLayout as B}from"../../shared/Styles.js";import{useExposure as V}from"../../hooks/useExposure.js";const N="copy",R="anchor_navigation",z=h("anchor-navigation-content flex items-center overflow-x-auto [&::-webkit-scrollbar]:hidden",{variants:{alignment:{start:"tablet:justify-start",center:"tablet:justify-center",end:"tablet:justify-end"},size:{small:"gap-3",large:"gap-6"}},defaultVariants:{alignment:"start",size:"small"}}),M=h("anchor-navigation-item relative shrink-0 text-sm font-bold after:absolute after:bottom-0 after:left-0 after:h-1 after:w-0 after:opacity-0 after:transition-all after:duration-300",{variants:{size:{small:"py-3",large:"py-4"}},defaultVariants:{size:"small"}}),P=h("!sticky top-0 !z-40 w-full",{variants:{theme:{light:"!bg-white",dark:"!bg-[#1E2024]"}},defaultVariants:{theme:"light"}}),$={defaultColor:"text-[#4A4C56]",activeColor:"text-[#080A0F]",activeIndicatorColor:"after:bg-brand-0"},j={defaultColor:"text-[#8A8D92]",activeColor:"text-white",activeIndicatorColor:"after:bg-brand-0"},T=a.forwardRef(({classNames:l={},data:n,onItemClick:b,buttonStyle:s,className:L,...x},w)=>{const{alignment:D="start",theme:I="light",size:C="small"}=n,i=H(n.sectionIds?.map(t=>t.targetId)||[]),c=a.useRef(null),f=a.useRef(null),A=a.useRef([]);a.useImperativeHandle(w,()=>c.current);const y=n.sectionIds?.find(t=>t.targetId===i)?.label??"",E=n.sectionIds?.map(t=>t.label).join(" | ")??"";V(c,{componentType:N,componentName:R,componentTitle:E,componentDescription:y,navigation:y});const d=I==="dark"?j:$,u={defaultColor:s?.defaultColor??d.defaultColor,activeColor:s?.activeColor??d.activeColor,activeIndicatorColor:s?.activeIndicatorColor??d.activeIndicatorColor},m=a.useCallback(t=>{const e=A.current[t];if(e&&f.current){const r=f.current,o=e,v=o.offsetLeft-r.offsetWidth/2+o.offsetWidth/2;typeof r.scrollTo=="function"&&r.scrollTo({left:v,behavior:"smooth"})}},[]);return a.useEffect(()=>{if(!i)return;const t=n.sectionIds?.findIndex(e=>e.targetId===i);t!==void 0&&t!==-1&&m(t)},[i,n.sectionIds,m]),p(k,{ref:c,className:g(P({theme:I}),L,l?.root),...x,children:p("div",{ref:f,className:g(z({alignment:D,size:C}),"relative",l?.content),children:n.sectionIds?.map((t,e)=>{const r=i===t.targetId;return p("button",{ref:o=>{o&&(A.current[e]=o)},"data-headless-type-name":`${N}#${R}`,"data-headless-title-desc-button":`${t.label}##${t.label}`,"data-headless-nav-position":`${t.label}#${e+1}`,"aria-current":r?!0:void 0,onClick:()=>{if(m(e),b){b(t,e);return}const o=document.getElementById(t.targetId);if(o&&c.current){const v=c.current.offsetHeight,S=o.getBoundingClientRect().top+window.scrollY-v;window.scrollTo({top:S,behavior:"smooth"})}},className:g(M({size:C}),r?[u.activeColor,u.activeIndicatorColor,"after:w-full after:opacity-100"]:u.defaultColor,l?.item),children:t.label},t.targetId)})})})});T.displayName="AnchorNavigation";var K=B(T);export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as s}from"react/jsx-runtime";import{forwardRef as
|
|
1
|
+
"use client";import{jsx as t,jsxs as s}from"react/jsx-runtime";import{forwardRef as S,useEffect as T,useRef as h,useState as C,useImperativeHandle as M}from"react";import{cn as p,getLocalizedPath as v}from"../../helpers/utils.js";import B from"../../components/picture.js";import{withLayout as P}from"../../shared/Styles.js";import{useMediaQuery as A}from"react-responsive";import{useExposure as E}from"../../hooks/useExposure.js";import{useAiuiContext as I}from"../AiuiProvider/index.js";import{useTracking as j}from"../../hooks/useTracking.js";import{trackUrlRef as R}from"../../shared/trackUrlRef.js";import{toPlainTrackingText as d}from"../../shared/track.js";import{Swiper as $,SwiperSlide as D}from"swiper/react";import{Pagination as H,FreeMode as q,Mousewheel as z}from"swiper/modules";import"../Title/index.js";import F from"../../components/link.js";const c="copy",u="store_benefits",Q=(e,o)=>{const r=[];for(let i=0;i<e.length;i+=o)r.push(e.slice(i,i+o));return r},b=S(({data:{items:e=[],itemShape:o},className:r},i)=>{const[l,y]=C(!1),f=A({query:"(max-width: 768px)"}),k=h(null),m=h(null),{locale:x="us"}=I();M(i,()=>m.current),E(m,{componentType:c,componentName:u}),T(()=>{y(f)},[f]);const L=l?Q(e,3):e;return t("div",{ref:m,className:p("brand-equity-wrapper w-full",r),children:l?s($,{className:p(r),modules:[q,z,H],freeMode:!0,mousewheel:{forceToAxis:!0},pagination:{clickable:!0,el:k.current},breakpoints:{0:{spaceBetween:12}},children:[L?.map((n,a)=>t(D,{className:"!flex flex-col gap-3",children:Array.isArray(n)&&n?.map((N,g)=>t(w,{data:N,itemShape:o,index:g,locale:x},g))},"SwiperSlide"+a)),t("div",{ref:k,className:"mt-3 flex justify-center"})]}):t("div",{className:p("laptop:gap-4 tablet:grid-cols-2 laptop:grid-cols-4 grid grid-cols-1 gap-3"),children:e.map((n,a)=>t(w,{data:n,itemShape:o,index:a,locale:x},a))})})}),w=({data:e,itemShape:o,index:r,locale:i})=>{const{buildRef:l}=j();return s("div",{className:p("brand-equity-item","lg-desktop:p-8 desktop:p-6 p-4","box-border flex w-full flex-col justify-between overflow-hidden bg-[#DAE7F2]","rounded-box"),children:[s("div",{className:"lg-desktop:h-[50px] flex h-10 items-center justify-between gap-3",children:[t("h3",{className:"link-item-title lg-desktop:text-[18px] desktop:text-[16px] line-clamp-2 flex-1 text-[14px] font-bold leading-[1.2] tracking-[-0.02em] text-[#080A0F]",children:e.title}),t("div",{className:"link-item-img lg-desktop:size-[36px] size-[30px] shrink-0",children:t(B,{className:"size-full object-cover",source:e.icon?.url,alt:e.icon?.alt,imgClassName:"w-full h-full object-cover"})})]}),s("div",{className:"box-border overflow-hidden",children:[t("p",{title:e.description||"",className:"link-item-description lg-desktop:text-[24px] line-clamp-4 text-[20px] font-semibold leading-[1.2] tracking-[-0.04em] text-[#767880]",children:e.description||""}),s(F,{href:e?.link?R(v(e.link,i),l(c,u)):v("",i),asChild:!e?.link,...e?.link?{"data-headless-type-name":`${c}#${u}`,"data-headless-title-desc-button":`${d(e.title)}#${d(e.description)}#${d(e.linkText)}`,"data-headless-nav-position":`#${r+1}`}:{},className:"desktop:mt-4 mt-2 flex items-center gap-0.5 no-underline hover:underline",children:[t("span",{className:"link-item-text laptop:text-base text-sm",children:e?.linkText}),t("div",{className:"size-6",children:t("svg",{width:"24",height:"24",className:"mb-[3px]",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",children:t("path",{className:"transition-all duration-[0.4s]",d:"M10.5 8L14.5 12L10.5 16",stroke:"#777",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})]})};b.displayName="BrandCardLink";var oe=P(b);export{oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import*as
|
|
1
|
+
"use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import*as h from"react";import{cn as r}from"../../helpers/index.js";import"../../components/badge.js";import u from"../../components/picture.js";import{Text as l}from"../../components/text.js";import{buildBogoTrackProps as g}from"./tracking.js";const v=({checked:e,theme:n})=>{const o=n==="dark";return e?i("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",fill:o?"#F5F6F7":"#080A0F"}),t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:o?"#F5F6F7":"#080A0F",strokeWidth:"1.6"}),t("path",{d:"M8 11.5833L10.9474 14.5L16 9.5",stroke:o?"#1E2024":"white",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]}):t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:o?"#B5B7BB":"#2A2C32",strokeWidth:"1.6"})})},c=h.forwardRef(({gift:e,onClick:n,className:o,giftType:s,theme:p,tagBgColor:a,tagTextColor:d,trackingPosition:x},m)=>{const f=s===2||!!e.selected;return t("div",{ref:m,className:r("bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all","buy-one-get-one-shelf-free-gift-item",f?"buy-one-get-one-shelf-free-gift-item-selected":"buy-one-get-one-shelf-free-gift-item-unselected",s===2?"border-brand-0 bg-container-secondary-0 cursor-default":`cursor-pointer hover:shadow-sm ${e.selected?"border-brand-0 bg-container-secondary-0":"border-lines bg-secondary-0 hover:bg-container-secondary"}`,o),onClick:()=>{s===1&&n?.(e)},...s===1?g({title:e.name,buttonName:e.selected?"Unselect gift":"Select gift",position:x,sku:e.sku}):{},children:i("div",{className:"flex size-full flex-col",children:[t("div",{className:"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end",children:e.tag&&t("div",{className:"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]",style:{...a?{backgroundColor:a}:{},...d?{color:d}:{}},children:e.tag})}),i("div",{className:r("laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2"),children:[t("div",{className:"flex size-5 shrink-0 items-center justify-center",children:t(v,{checked:!!e.selected,theme:p})}),t("div",{className:r("size-14 shrink-0","tablet:size-12"),children:t(u,{source:e.image,alt:e.name,className:"size-full rounded object-cover"})}),i("div",{className:"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1",children:[t(l,{size:2,html:e.name,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1")}),i("div",{className:"mt-auto flex items-center justify-between gap-2",children:[i("div",{className:"flex items-center gap-2",children:[t(l,{size:2,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px]"),children:e.currentPrice}),e.originalPrice&&e.originalPrice!==e.currentPrice&&t(l,{size:2,className:r("text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through"),children:e.originalPrice})]}),e.quantity>=1&&i(l,{size:4,className:r("text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]"),children:["x",e.quantity]})]})]})]})]})})});c.displayName="FreeGiftItem";var z=c;export{z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as u}from"react/jsx-runtime";import*as d from"react";import{cn as i}from"../../helpers/index.js";import{Text as G}from"../../components/text.js";import k from"./FreeGiftItem.js";const r=d.forwardRef(({freeGiftLabel:o,freeGifts:t,onGiftClick:f,className:n,giftType:a,theme:s,tagBgColor:p,tagTextColor:c,trackingPosition:m},g)=>!t||t.length===0?null:u("div",{ref:g,className:i("flex w-full flex-col gap-2",n),children:[o&&e(G,{size:2,className:i("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] w-full"),children:o}),e("div",{className:i("tablet:flex-row laptop:flex-col flex flex-col gap-2"),children:t.map((l,x)=>e("div",{className:"min-w-0 flex-1",children:e(k,{gift:l,onClick:f,giftType:a,theme:s,tagBgColor:p,tagTextColor:c,trackingPosition:m})},l.id||x))})]}));r.displayName="GiftSelection";var S=r;export{S as default};
|
|
@@ -15,6 +15,8 @@ export interface PriceAndActionsProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
15
15
|
trackingTitle?: string;
|
|
16
16
|
trackingDescription?: string;
|
|
17
17
|
trackingSku?: string;
|
|
18
|
+
/** 卡片在货架中的位置(从 1 开始),上报为 position */
|
|
19
|
+
trackingPosition?: number;
|
|
18
20
|
classNames?: Partial<Record<BuyOneGetOneShelfProductCardSemanticName, string>>;
|
|
19
21
|
/**
|
|
20
22
|
* 原价区域渲染函数,用于在原价位置展示自定义内容(如 Save 金额文案)。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as L,jsx as t,jsxs as o}from"react/jsx-runtime";import*as C from"react";import{cn as e}from"../../helpers/index.js";import u from"../../components/button.js";import{Text as x}from"../../components/text.js";import{Heading as f}from"../../components/index.js";import{buildBogoTrackProps as N}from"./tracking.js";const b=C.forwardRef(({currentPrice:P,originalPrice:r,priceLabel:n,learnMoreText:a="Learn More",shopNowText:s="Shop Now",soldOutText:v="Sold out",onLearnMore:w,onShopNow:y,availableForSale:l,learnMoreLoading:h,shopNowLoading:k,className:A,trackingTitle:c,trackingDescription:d,trackingSku:p,trackingPosition:m=1,classNames:i,renderOriginalPrice:g},B)=>o("div",{ref:B,className:e("flex w-full flex-col justify-center gap-2",A),children:[t("div",{className:"flex w-full items-center gap-2",children:l?o(L,{children:[t(f,{size:2,className:e("text-info-primary"),children:P}),g?g(r):r&&t(f,{size:2,className:e("text-info-tertiary line-through",i?.productCardOriginalPrice),children:r})]}):t(x,{size:4,className:e("text-info-primary text-2xl leading-[1.2] tracking-[-0.48px]","tablet:text-xl tablet:tracking-[-0.4px]"),children:v})}),n&&t(x,{size:4,className:e("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] text-[14px]",i?.productCardPriceLabel),children:n}),o("div",{className:e("flex w-full items-stretch gap-3","tablet:gap-2"),children:[t(u,{variant:"secondary",size:"lg",onClick:w,loading:h,className:e("min-w-0 flex-1 whitespace-normal text-center",i?.productCardBtnGroup),...N({title:c,description:d,buttonName:a,position:m,sku:p}),children:a}),t(u,{variant:"primary",size:"lg",onClick:y,disabled:!l,loading:k,className:e("min-w-0 flex-1 whitespace-normal text-center",i?.productCardBtnGroup),...N({title:c,description:d,buttonName:s,position:m,sku:p}),children:s})]})]}));b.displayName="PriceAndActions";var O=b;export{O as default};
|
|
@@ -31,6 +31,8 @@ export interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement>,
|
|
|
31
31
|
onGiftClick?: (gift: FreeGift, selectedGifts: FreeGift[]) => void;
|
|
32
32
|
/** 赠品选择变化回调 */
|
|
33
33
|
onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void;
|
|
34
|
+
/** 卡片在货架中的位置(从 1 开始),由 Root 自动注入,用于埋点 position */
|
|
35
|
+
trackingPosition?: number;
|
|
34
36
|
/** 选中赠品SKU变化回调(受控组件) */
|
|
35
37
|
onSelectedGiftSkuChange?: (selectedSku: string | null) => void;
|
|
36
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as l,jsxs as
|
|
1
|
+
"use client";import{jsx as l,jsxs as C}from"react/jsx-runtime";import*as i from"react";import{cn as b}from"../../helpers/index.js";import ye from"./ProductImage.js";import ke from"./ProductInfo.js";import be from"./ProductTags.js";import Fe from"./DiscountBadge.js";import ve from"./GiftSelection.js";import we from"./PriceAndActions.js";import{BuyOneGetOneShelfContext as Be}from"./context.js";const Ne=[],F=i.forwardRef(({productData:e,gifts:t=Ne,giftType:a=1,selectedGiftSku:v,sceneImages:w,tags:B,layout:N,className:L,onProductClick:x,onProductImageClick:T,onLearnMore:M,onShopNow:O,onAddToCart:I,onGiftClick:G,onGiftSelectionChange:R,trackingPosition:d=1,classNames:u,soldOutText:A,renderOriginalPrice:H,tagTypeConfig:E,fill:j,outline:z,customTagStyle:W,customTagsIcon:$,renderDiscountBadge:V,discountTagTextColor:_,giftTagBgColor:U,giftTagTextColor:Y,...q},D)=>{const{layout:J,theme:K,tagTypeConfig:Q,fill:X,outline:Z,customTagStyle:ee,customTagsIcon:te,renderDiscountBadge:oe,discountTagTextColor:ne,giftTagBgColor:re,giftTagTextColor:ie}=i.useContext(Be),m=N??J,ae=E??Q,le=j??X,ce=z??Z,se=W??ee,de=$??te,ue=V??oe,fe=_??ne,ge=U??re,me=Y??ie,[pe,Ce]=i.useState(!1),[xe,Te]=i.useState(!1),[h,f]=i.useState(()=>!t||t.length===0?[]:a===2?t.map(o=>o.id):[t[0].id]),p=i.useMemo(()=>t?t.map(o=>({...o,selected:h.includes(o.id)})):[],[t,h]);i.useEffect(()=>{if(!t||t.length===0){f([]);return}f(a===2?t.map(o=>o.id):o=>{const n=o[0];return n&&t.some(c=>c.id===n)?[n]:[t[0].id]})},[t,a]);const s=i.useMemo(()=>({...e,gifts:t,gift_type:a}),[e,t,a]),Ge=o=>{if(a===2){const n=p.filter(r=>r.selected);G?.(o,n);return}f(()=>{const n=[o.id],r=t?.filter(c=>n.includes(c.id))||[];return G?.(o,r),R?.(r,s),n})},g=!!(T??x),P=e.variantId?.split("/").pop()?.split("?")[0],S=`/products/${e.handle}${P?`?variant=${encodeURIComponent(P)}`:""}`,y=()=>{(T??x)?.(s)},k=async(o,n)=>{const r=p.filter(Se=>Se.selected),c=n==="primary"?Te:Ce;c(!0);try{switch(o){case"buyNow":await O?.(s,r);break;case"addCart":await I?.(s,r);break;case"learnMore":await M?.(s,r);break}}finally{c(!1)}},he=e.learnMoreFun??"learnMore",Pe=e.shopNowFun??"buyNow";return C("div",{ref:D,className:b("bg-container-primary rounded-box relative flex items-stretch overflow-hidden",m==="horizontal"?["laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col","laptop:col-span-2"]:["flex-col justify-between"],L),...q,children:[l(Fe,{text:e.discountAmount,style:se,icon:de,renderBadge:ue,className:u?.productCardDiscountBadge,textClassName:u?.productCardDiscountBadgeText,textColor:fe}),l(ye,{images:w,name:e.name,layout:m,onClick:g?y:void 0,href:g?void 0:S,trackingTitle:e.name,trackingDescription:e.description,trackingSku:e.sku,trackingPosition:d}),l("div",{className:b("bg-container-primary desktop:p-6 flex flex-col justify-between p-4",m==="horizontal"?["rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none","laptop:basis-[39.1%]","desktop:basis-[42.1%]","lg-desktop:basis-[42.1%]","shrink-0"]:["rounded-b-box","w-full","grow"]),children:C("div",{className:"flex flex-1 flex-col justify-between gap-6",children:[C("div",{className:"flex flex-col gap-2",children:[l(be,{tags:e.tags||B,tagTypeConfig:ae,fill:le,outline:ce}),l(ke,{name:e.name,onClick:g?y:void 0,href:g?void 0:S,trackingSku:e.sku,trackingPosition:d,description:e.description,classNames:u})]}),l(ve,{freeGiftLabel:e.freeGiftLabel,freeGifts:p,onGiftClick:Ge,giftType:a,selectedGiftSku:v,trackingPosition:d,theme:K,tagBgColor:ge,tagTextColor:me}),l(we,{currentPrice:e.currentPrice??"",originalPrice:e.originalPrice,priceLabel:e.priceLabel,learnMoreText:e.learnMoreText,shopNowText:e.shopNowText,soldOutText:A,onLearnMore:()=>k(he,"secondary"),onShopNow:()=>k(Pe,"primary"),availableForSale:e.availableForSale,learnMoreLoading:pe,shopNowLoading:xe,trackingTitle:e.name,trackingDescription:e.description,trackingSku:e.sku,trackingPosition:d,classNames:u,renderOriginalPrice:H})]})})]})});F.displayName="BuyOneGetOneShelf.ProductCard";var je=F;export{je as default};
|
|
@@ -10,6 +10,10 @@ export interface ProductImageProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
10
10
|
onClick?: () => void;
|
|
11
11
|
/** 产品链接(无 onClick 回调时自动使用 a 标签跳转) */
|
|
12
12
|
href?: string;
|
|
13
|
+
trackingTitle?: string;
|
|
14
|
+
trackingDescription?: string;
|
|
15
|
+
trackingSku?: string;
|
|
16
|
+
trackingPosition?: number;
|
|
13
17
|
}
|
|
14
18
|
/**
|
|
15
19
|
* ProductImage - 产品图片区域
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import*as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import*as v from"react";import{cn as k}from"../../helpers/index.js";import P from"../../components/picture.js";import{buildBogoTrackProps as h,trackType as z,trackName as N}from"./tracking.js";import{trackUrlRef as L}from"../../shared/trackUrlRef.js";import{useTracking as T}from"../../hooks/useTracking.js";import{LocalizedLink as I}from"../../shared/LocalizedLink.js";const f=({images:i,name:r,layout:o})=>{const{laptop:u,mobile:a,tablet:s,desktop:p,lgDesktop:n}=i,l=p?.url||n?.url,c=u?.url||l,e=s?.url||c,d=a?.url||e,m=[n?.url||l,`${l} 1919`,`${c} 1439`,`${e} 1024`,`${d} 767`].join(", ");return t(P,{source:m,alt:r,className:k({"laptop:absolute inset-0 size-full static":o==="horizontal","w-full h-auto":o==="vertical"}),imgClassName:"size-full object-cover"})},b=v.forwardRef(({images:i,name:r,layout:o="horizontal",className:u,onClick:a,href:s,trackingTitle:p,trackingDescription:n,trackingSku:l,trackingPosition:c},e)=>{const{buildRef:d}=T(),m=h({title:p??r,description:n,buttonName:"image",position:c,sku:l}),g=k("relative grow overflow-hidden",o==="horizontal"?["min-h-[240px]","laptop:basis-[60.9%]","desktop:basis-[57.9%]","lg-desktop:basis-[57.9%]"]:["h-fit grow-0"],a||s?"cursor-pointer":"",u);return a?t("div",{ref:e,className:g,onClick:a,...m,children:t(f,{images:i,name:r,layout:o})}):s?t(I,{href:L(s,d(z,N)),className:g,...m,children:t("div",{ref:e,children:t(f,{images:i,name:r,layout:o})})}):t("div",{ref:e,className:g,children:t(f,{images:i,name:r,layout:o})})});b.displayName="ProductImage";var x=b;export{x as default};
|
|
@@ -7,6 +7,8 @@ export interface ProductInfoProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
onClick?: () => void;
|
|
8
8
|
/** 产品链接(无 onClick 回调时自动使用 a 标签跳转) */
|
|
9
9
|
href?: string;
|
|
10
|
+
trackingSku?: string;
|
|
11
|
+
trackingPosition?: number;
|
|
10
12
|
}
|
|
11
13
|
declare const ProductInfo: React.ForwardRefExoticComponent<ProductInfoProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
14
|
export default ProductInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as e,jsxs as C}from"react/jsx-runtime";import*as k from"react";import{cn as t}from"../../helpers/index.js";import{Text as g}from"../../components/text.js";import{Heading as i}from"../../components/heading.js";import{LocalizedLink as P}from"../../shared/LocalizedLink.js";import{buildBogoTrackProps as h,trackType as x,trackName as T}from"./tracking.js";import{trackUrlRef as N}from"../../shared/trackUrlRef.js";import{useTracking as y}from"../../hooks/useTracking.js";const m=k.forwardRef(({name:r,description:a,onClick:c,href:l,trackingSku:s,trackingPosition:p,className:d,classNames:o={}},f)=>{const{buildRef:u}=y(),n=h({title:r,description:a,buttonName:"title",position:p,sku:s});return C("div",{ref:f,className:t("text-info-primary flex w-full flex-col gap-1",d),children:[c?e(i,{as:"h4",size:2,html:r,className:t("line-clamp-1 ",o?.productCardTitle),onClick:()=>c?.(),...n}):l?e(P,{href:N(l,u(x,T)),className:"block",...n,children:e(i,{as:"h4",size:2,html:r,className:t("line-clamp-1 ",o?.productCardTitle)})}):e(i,{as:"h4",size:2,html:r,className:t("line-clamp-1 ",o?.productCardTitle)}),e(g,{size:2,html:a,className:t("desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1",o?.productCardDescription)})]})});m.displayName="ProductInfo";var I=m;export{I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as s,jsxs as V}from"react/jsx-runtime";import*as t from"react";import{cn as i}from"../../helpers/index.js";import $ from"./ProductCard.js";import{Heading as F,Text as _}from"../../components/index.js";import{BuyOneGetOneShelfContext as W}from"./context.js";import{useExposure as A}from"../../hooks/useExposure.js";import{toPlainTrackingText as b}from"../../shared/track.js";const k="shelf",D="buy_one_get_one_shelf";function E(n){return t.Children.toArray(n).flatMap(e=>t.isValidElement(e)&&e.type===t.Fragment?E(e.props.children):[e])}function q(n){return t.isValidElement(n)?n.props.layout??"horizontal":"horizontal"}function J(n,e){let o=0,r=0;for(let a=0;a<e;a++){const p=q(n[a])==="horizontal"?2:1;p===2&&o>0&&(o=0),o+=p,o===2&&(r=a+1,o=0)}return n.slice(0,r)}const z=t.forwardRef(({className:n,classNames:e={},theme:o,title:r,subtitle:a,children:p,viewMoreThreshold:f=4,viewMoreText:y="View More",viewLessText:h="View Less",tagTypeConfig:g,fill:O,outline:R,customTagStyle:P,customTagsIcon:x,renderDiscountBadge:C,discountTagTextColor:N,giftTagBgColor:S,giftTagTextColor:v,...I},L)=>{const d=t.useRef(null),[c,M]=t.useState(!1);A(d,{componentType:k,componentName:D,componentTitle:r,componentDescription:a}),t.useImperativeHandle(L,()=>d.current);const u=E(p),B=u.length>f,T=B&&!c?J(u,f):u,j=t.useMemo(()=>({layout:"horizontal",theme:o,tagTypeConfig:g,fill:O,outline:R,customTagStyle:P,customTagsIcon:x,renderDiscountBadge:C,discountTagTextColor:N,giftTagBgColor:S,giftTagTextColor:v}),[o,g,O,R,P,x,C,N,S,v]),w=T.map((l,H)=>{if(!t.isValidElement(l))return l;const m=l.props,G={trackingPosition:m.trackingPosition??H+1};return m.layout==="horizontal"&&(G.className=i(m.className,"laptop:col-span-2")),t.cloneElement(l,G)});return s(W.Provider,{value:j,children:V("div",{ref:d,className:i("bogo-shelf-root w-full py-0",{"aiui-dark":o==="dark"},n,e?.root),...I,children:[r&&s(F,{as:"h2",size:3,html:r,className:i("bogo-shelf-title text-info-primary mb-4",e?.title)}),a&&s(_,{size:3,as:"p",html:a,className:i("bogo-shelf-description text-info-primary mb-6",e?.description)}),s("div",{className:i("grid grid-cols-1 gap-6","laptop:grid-cols-2"),children:w}),B&&s("div",{className:"mt-6 flex justify-center",children:V("button",{type:"button",onClick:()=>M(l=>!l),"aria-expanded":c,"data-headless-type-name":`${k}#${D}`,"data-headless-title-desc-button":`${b(r)}#${b(a)}#${c?h:y}`,"data-headless-nav-position":"#1",className:i("hover:text-brand-0 lg-desktop:text-[16px] text-info-primary flex cursor-pointer items-center gap-2 border-none bg-transparent text-[14px] font-bold outline-none transition-colors",e?.viewMoreBtn),children:[c?h:y,s("svg",{className:i("size-4 transition-transform",c&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})})]})})});z.displayName="BuyOneGetOneShelf.Root";const K={Root:z,ProductCard:$};var te=K;export{te as default};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const trackType = "shelf";
|
|
2
|
+
export declare const trackName = "buy_one_get_one_shelf";
|
|
3
|
+
interface TrackInput {
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
buttonName?: string;
|
|
7
|
+
position?: number;
|
|
8
|
+
sku?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 买赠货架点击埋点属性。
|
|
12
|
+
* componentType 为 shelf,超出 buildClickTrackingProps 的 image | video 限定,按规范 4.2 手写属性。
|
|
13
|
+
*/
|
|
14
|
+
export declare const buildBogoTrackProps: ({ title, description, buttonName, position, sku }: TrackInput) => {
|
|
15
|
+
'data-headless-sku'?: string | undefined;
|
|
16
|
+
'data-headless-type-name': string;
|
|
17
|
+
'data-headless-title-desc-button': string;
|
|
18
|
+
'data-headless-nav-position': string;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toPlainTrackingText as t}from"../../shared/track.js";const r="shelf",i="buy_one_get_one_shelf",p=({title:a,description:s,buttonName:n,position:o=1,sku:e})=>({"data-headless-type-name":`${r}#${i}`,"data-headless-title-desc-button":`${t(a)}#${t(s)}#${t(n)}`,"data-headless-nav-position":`#${o}`,...e?{"data-headless-sku":e}:{}});export{p as buildBogoTrackProps,i as trackName,r as trackType};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Img } from '../../types/props.js';
|
|
3
3
|
export interface CategoryItem {
|
|
4
|
-
/**
|
|
5
|
-
image: Img
|
|
4
|
+
/** 产品图片;若 CMS 返回了媒体 id,会作为 creative_id 上报 */
|
|
5
|
+
image: Img & {
|
|
6
|
+
id?: string;
|
|
7
|
+
};
|
|
6
8
|
name: string;
|
|
7
9
|
link?: string;
|
|
8
10
|
}
|