@anker-in/headless-ui 1.3.86 → 1.3.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +57 -0
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +4 -1
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/index.d.ts +2 -2
- package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/types.d.ts +12 -1
- package/dist/cjs/biz-components/ActiveShelf/types.js +1 -1
- package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/cjs/biz-components/AiuiProvider/index.d.ts +28 -0
- package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.d.ts +2 -0
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.js +1 -1
- package/dist/cjs/biz-components/BrandEquity/types.d.ts +2 -0
- package/dist/cjs/biz-components/BrandEquity/types.js +1 -1
- package/dist/cjs/biz-components/Chat/button.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/HeroBanner/types.d.ts +12 -6
- package/dist/cjs/biz-components/HeroBanner/types.js +1 -1
- package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/cjs/biz-components/ImageWithText/types.d.ts +8 -2
- package/dist/cjs/biz-components/ImageWithText/types.js +1 -1
- package/dist/cjs/biz-components/Ksp/index.d.ts +2 -0
- package/dist/cjs/biz-components/Ksp/index.js +1 -1
- package/dist/cjs/biz-components/Listing/BizProductProvider.d.ts +8 -2
- package/dist/cjs/biz-components/Listing/BizProductProvider.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js +1 -1
- package/dist/cjs/biz-components/Listing/types/product.d.ts +9 -0
- package/dist/cjs/biz-components/Listing/types/product.js +1 -1
- package/dist/cjs/biz-components/Listing/types.d.ts +19 -0
- package/dist/cjs/biz-components/Listing/types.js +1 -1
- package/dist/cjs/biz-components/Listing/utils/priceCalc.d.ts +28 -0
- package/dist/cjs/biz-components/Listing/utils/priceCalc.js +1 -0
- package/dist/cjs/biz-components/MarqueeReview/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/cjs/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.js +2 -2
- package/dist/cjs/biz-components/ProductCompare/index.d.ts +1 -1
- package/dist/cjs/biz-components/ProductCompare/index.js +1 -1
- package/dist/cjs/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/cjs/biz-components/ProductHero/types.d.ts +2 -0
- package/dist/cjs/biz-components/ProductHero/types.js +1 -1
- package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/cjs/biz-components/ProductNav/types.d.ts +5 -2
- package/dist/cjs/biz-components/ProductNav/types.js +1 -1
- package/dist/cjs/biz-components/SecondaryBanner/index.d.ts +5 -4
- package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/cjs/biz-components/Specs/dropdown.js +1 -2
- package/dist/cjs/biz-components/Specs/index.js +1 -1
- package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/cjs/biz-components/index.d.ts +3 -0
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/components/link.js +1 -1
- package/dist/cjs/hooks/useBoaButton.d.ts +27 -0
- package/dist/cjs/hooks/useBoaButton.js +1 -0
- package/dist/cjs/hooks/useDraggableScroll.js +1 -1
- package/dist/cjs/hooks/useExposure.d.ts +1 -1
- package/dist/cjs/hooks/useExposure.js +1 -1
- package/dist/cjs/hooks/useViewItemList.d.ts +1 -1
- package/dist/cjs/index.d.ts +10 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/shared/ContainerGridContext.d.ts +20 -0
- package/dist/cjs/shared/ContainerGridContext.js +1 -0
- package/dist/cjs/shared/Styles.d.ts +2 -0
- package/dist/cjs/shared/Styles.js +1 -1
- package/dist/cjs/shared/adTrack.d.ts +38 -0
- package/dist/cjs/shared/adTrack.js +1 -0
- package/dist/cjs/shared/amazonAttribution.d.ts +31 -0
- package/dist/cjs/shared/amazonAttribution.js +1 -0
- package/dist/cjs/shared/mediaGridSpec.d.ts +87 -0
- package/dist/cjs/shared/mediaGridSpec.js +1 -0
- package/dist/cjs/stories/BoaStoryProvider.d.ts +10 -0
- package/dist/cjs/stories/BoaStoryProvider.js +1 -0
- package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +4 -1
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/index.d.ts +2 -2
- package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/types.d.ts +12 -1
- package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.d.ts +28 -0
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/BrandEquity/BrandEquity.d.ts +2 -0
- package/dist/esm/biz-components/BrandEquity/BrandEquity.js +1 -1
- package/dist/esm/biz-components/BrandEquity/types.d.ts +2 -0
- package/dist/esm/biz-components/Chat/button.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/HeroBanner/types.d.ts +12 -6
- package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/esm/biz-components/ImageWithText/types.d.ts +8 -2
- package/dist/esm/biz-components/Ksp/index.d.ts +2 -0
- package/dist/esm/biz-components/Ksp/index.js +1 -1
- package/dist/esm/biz-components/Listing/BizProductProvider.d.ts +8 -2
- package/dist/esm/biz-components/Listing/BizProductProvider.js +1 -1
- package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/CompareModal.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js +1 -1
- package/dist/esm/biz-components/Listing/types/product.d.ts +9 -0
- package/dist/esm/biz-components/Listing/types.d.ts +19 -0
- package/dist/esm/biz-components/Listing/utils/priceCalc.d.ts +28 -0
- package/dist/esm/biz-components/Listing/utils/priceCalc.js +1 -0
- package/dist/esm/biz-components/MarqueeReview/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/esm/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.js +2 -2
- package/dist/esm/biz-components/ProductCompare/index.d.ts +1 -1
- package/dist/esm/biz-components/ProductCompare/index.js +1 -1
- package/dist/esm/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/esm/biz-components/ProductHero/types.d.ts +2 -0
- package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/esm/biz-components/ProductNav/types.d.ts +5 -2
- package/dist/esm/biz-components/SecondaryBanner/index.d.ts +5 -4
- package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/esm/biz-components/Specs/dropdown.js +1 -2
- package/dist/esm/biz-components/Specs/index.js +1 -1
- package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/esm/biz-components/index.d.ts +3 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/components/link.js +1 -1
- package/dist/esm/hooks/useBoaButton.d.ts +27 -0
- package/dist/esm/hooks/useBoaButton.js +1 -0
- package/dist/esm/hooks/useDraggableScroll.js +1 -1
- package/dist/esm/hooks/useExposure.d.ts +1 -1
- package/dist/esm/hooks/useExposure.js +1 -1
- package/dist/esm/hooks/useViewItemList.d.ts +1 -1
- package/dist/esm/index.d.ts +10 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/shared/ContainerGridContext.d.ts +20 -0
- package/dist/esm/shared/ContainerGridContext.js +1 -0
- package/dist/esm/shared/Styles.d.ts +2 -0
- package/dist/esm/shared/Styles.js +1 -1
- package/dist/esm/shared/adTrack.d.ts +38 -0
- package/dist/esm/shared/adTrack.js +1 -0
- package/dist/esm/shared/amazonAttribution.d.ts +31 -0
- package/dist/esm/shared/amazonAttribution.js +1 -0
- package/dist/esm/shared/mediaGridSpec.d.ts +87 -0
- package/dist/esm/shared/mediaGridSpec.js +1 -0
- package/dist/esm/stories/BoaStoryProvider.d.ts +10 -0
- package/dist/esm/stories/BoaStoryProvider.js +1 -0
- package/dist/tokens/base.css +22 -1
- package/package.json +5 -2
- package/style.css +250 -136
- package/tailwind.config.js +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var R=Object.create;var s=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var V=(e,t)=>{for(var o in t)s(e,o,{get:t[o],enumerable:!0})},k=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of E(t))!g.call(e,r)&&r!==o&&s(e,r,{get:()=>t[r],enumerable:!(i=L(t,r))||i.enumerable});return e};var b=(e,t,o)=>(o=e!=null?R(N(e)):{},k(t||!e||!e.__esModule?s(o,"default",{value:e,enumerable:!0}):o,e)),S=e=>k(s({},"__esModule",{value:!0}),e);var M={};V(M,{default:()=>w});module.exports=S(M);var n=require("react/jsx-runtime"),l=b(require("react")),d=require("@radix-ui/react-slot"),x=require("../helpers/index.js"),v=require("class-variance-authority");const q=(0,v.cva)("tracking hover:text-brand-0 font-bold underline transition-colors",{variants:{size:{base:"text-text-2",lg:"text-text-3"},variant:{secondary:"text-info-secondary hover:text-info-primary",primary:"text-info-primary hover:text-brand-0"}}}),u=l.default.forwardRef(({children:e,size:t="base",variant:o="primary",className:i,asChild:r=!1,href:m,style:c,disabled:a=!1,suffixIcon:p,onClick:C,...P},h)=>{const f=r&&l.default.isValidElement(e);return(0,n.jsx)(f?d.Slot:"a",{ref:h,onClick:y=>{if(!a&&C?.(y),a||!m){y.preventDefault();return}},href:a?void 0:m,className:(0,x.cn)(q({size:t,variant:o}),i,{"flex items-center":p,"cursor-pointer":!a,"text-info-quaternary cursor-not-allowed hover:text-info-quaternary":a}),...c?{style:c}:null,...P,children:f?e:(0,n.jsxs)(n.Fragment,{children:[e,p&&(0,n.jsx)("span",{className:"svg",children:p})]})})});u.displayName="Link";var w=u;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AmazonLinkFields } from '../shared/amazonAttribution.js';
|
|
2
|
+
import { type AdTrackContext, type AdTrackFields } from '../shared/adTrack.js';
|
|
3
|
+
export type BoaButtonFields = AmazonLinkFields & AdTrackFields;
|
|
4
|
+
export interface ResolvedBoaLink {
|
|
5
|
+
/** 最终链接。非亚马逊链接、开关关闭、服务端渲染阶段都返回原链接 */
|
|
6
|
+
href: string | undefined;
|
|
7
|
+
/** 是否按亚马逊链接处理(开关打开且按钮已勾选) */
|
|
8
|
+
isAmazon: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface UseBoaButtonResult {
|
|
11
|
+
/** 页面级开关是否打开 */
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
/** 按按钮配置解析链接,亚马逊链接补全归因参数 */
|
|
14
|
+
resolveLink: (href: string | undefined, fields?: AmazonLinkFields) => ResolvedBoaLink;
|
|
15
|
+
/** 该按钮是否有可交接的有效埋点事件 */
|
|
16
|
+
hasAdTrack: (fields?: AdTrackFields) => boolean;
|
|
17
|
+
/** 按钮被点击时,把有效埋点事件交给业务端。业务端未接入时静默跳过 */
|
|
18
|
+
trackAd: (fields: AdTrackFields | undefined, context: AdTrackContext) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* BOA 按钮能力:亚马逊链接归因参数拼接 + 广告埋点数据交接。
|
|
22
|
+
*
|
|
23
|
+
* - 服务端渲染输出原链接;挂载后再带上访客落地页的 utm 参数写入完整链接
|
|
24
|
+
* - 页面级开关(AiuiProvider.componentBoaEnabled)关闭时,链接保持原样
|
|
25
|
+
* - 埋点不依赖「自定义按钮事件」,只看按钮自己的 hasTrack 与 trackEvents
|
|
26
|
+
*/
|
|
27
|
+
export declare const useBoaButton: () => UseBoaButtonResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var v=(n,e)=>{for(var t in e)l(n,t,{get:e[t],enumerable:!0})},x=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of b(e))!h.call(n,s)&&s!==t&&l(n,s,{get:()=>e[s],enumerable:!(i=g(e,s))||i.enumerable});return n};var z=n=>x(l({},"__esModule",{value:!0}),n);var F={};v(F,{useBoaButton:()=>C});module.exports=z(F);var a=require("react"),f=require("../biz-components/AiuiProvider/index.js"),m=require("../shared/amazonAttribution.js"),u=require("../shared/adTrack.js");const C=()=>{const{componentBoaEnabled:n,amazonAttribution:e,onAdTrack:t}=(0,f.useAiuiContext)(),[i,s]=(0,a.useState)(void 0);(0,a.useEffect)(()=>{s(window.location.search)},[]);const c=!!n,k=e?.adCampaign,A=e?.maas,p=(0,a.useCallback)((o,d)=>{const r=c&&!!d?.isAmazonlink;return!r||!o?{href:o,isAmazon:r}:i===void 0?{href:o,isAmazon:r}:{href:(0,m.buildAmazonUrl)(o,{buttonAdCampaign:d?.adCampaign,pageAdCampaign:k,maas:A,search:i}),isAmazon:r}},[c,A,k,i]),B=(0,a.useCallback)(o=>(0,u.getValidAdTrackEvents)(o).length>0,[]),T=(0,a.useCallback)((o,d)=>{if(typeof t!="function")return;const r=(0,u.getValidAdTrackEvents)(o);if(r.length!==0)try{t(r,d)}catch{typeof process<"u"}},[t]);return{enabled:c,resolveLink:p,hasAdTrack:B,trackAd:T}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";var m=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var x=(n,o)=>{for(var s in o)m(n,s,{get:o[s],enumerable:!0})},O=(n,o,s,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of M(o))!E.call(n,t)&&t!==s&&m(n,t,{get:()=>o[t],enumerable:!(i=D(o,t))||i.enumerable});return n};var T=n=>O(m({},"__esModule",{value:!0}),n);var U={};x(U,{useDraggableScroll:()=>F});module.exports=T(U);var l=require("react");function F(n={}){const{dragSpeed:o=1,enableMomentum:s=!0,dragElastic:i=.1}=n,t=(0,l.useRef)(null),[b,W]=(0,l.useState)(!1),[S,h]=(0,l.useState)(0),[R,d]=(0,l.useState)(!1),[L,v]=(0,l.useState)(!1),a=()=>{const r=t.current;if(!r)return;const{scrollLeft:e,scrollWidth:c,clientWidth:u}=r,f=c-u,p=f>0?e/f*100:0;h(Math.min(100,Math.max(0,p))),d(e>0),v(e<f-1)};(0,l.useEffect)(()=>{const r=t.current;if(!r)return;a(),r.addEventListener("scroll",a);const e=new ResizeObserver(a);return e.observe(r),()=>{r.removeEventListener("scroll",a),e.disconnect()}},[]);const g=(r,e=!0)=>{const c=t.current;c&&c.scrollTo({left:r,behavior:e?"smooth":"auto"})};return{containerRef:t,isDragging:b,scrollProgress:S,canScrollLeft:R,canScrollRight:L,scrollTo:g,scrollLeft:(r=300)=>{const e=t.current;if(!e)return;const c=Math.max(0,e.scrollLeft-r);g(c)},scrollRight:(r=300)=>{const e=t.current;if(!e)return;const c=e.scrollWidth-e.clientWidth,u=Math.min(c,e.scrollLeft+r);g(u)}}}
|
|
@@ -15,5 +15,5 @@ interface ExposureOptions {
|
|
|
15
15
|
/** 创意 ID(图片/视频媒体 ID),用于区分轮播中的具体创意 → creative_id */
|
|
16
16
|
creativeId?: string;
|
|
17
17
|
}
|
|
18
|
-
export declare const useExposure: (ref: RefObject<HTMLElement>, { componentType, componentName, componentTitle, componentDescription, navigation, position, pageGroup: explicitPageGroup, category, creativeId, }: ExposureOptions) => void;
|
|
18
|
+
export declare const useExposure: (ref: RefObject<HTMLElement | null>, { componentType, componentName, componentTitle, componentDescription, navigation, position, pageGroup: explicitPageGroup, category, creativeId, }: ExposureOptions) => void;
|
|
19
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var T=(r,e)=>{for(var n in e)s(r,n,{get:e[n],enumerable:!0})},h=(r,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of j(e))!k.call(r,t)&&t!==n&&s(r,t,{get:()=>e[t],enumerable:!(o=O(e,t))||o.enumerable});return r};var z=r=>h(s({},"__esModule",{value:!0}),r);var L={};T(L,{useExposure:()=>H});module.exports=z(L);var p=require("react"),a=require("../shared/track.js"),v=require("../shared/trackUrlRef.js"),G=require("./useIntersectionObserver.js"),S=require("../biz-components/AiuiProvider/index.js"),
|
|
1
|
+
"use strict";var s=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var T=(r,e)=>{for(var n in e)s(r,n,{get:e[n],enumerable:!0})},h=(r,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of j(e))!k.call(r,t)&&t!==n&&s(r,t,{get:()=>e[t],enumerable:!(o=O(e,t))||o.enumerable});return r};var z=r=>h(s({},"__esModule",{value:!0}),r);var L={};T(L,{useExposure:()=>H});module.exports=z(L);var p=require("react"),a=require("../shared/track.js"),v=require("../shared/trackUrlRef.js"),G=require("./useIntersectionObserver.js"),S=require("../biz-components/AiuiProvider/index.js"),l=require("@payloadcms/richtext-lexical/plaintext");const H=(r,{componentType:e,componentName:n,componentTitle:o,componentDescription:t,navigation:c="",position:g=1,pageGroup:u,category:m,creativeId:d=""})=>{const{trackingData:f,onExposure:x,pageHandle:y}=(0,S.useAiuiContext)(),E=(0,p.useMemo)(()=>m||(0,v.buildPageGroup)({pageHandle:y,pageGroup:u||f.pageGroup}),[m,u,y,f.pageGroup]),_=(0,p.useMemo)(()=>{const i=typeof o=="object"&&o!==null?(0,l.convertLexicalToPlaintext)({data:o}):o;return typeof i=="string"?(0,a.toPlainTrackingText)(i):i},[o]),b=(0,p.useMemo)(()=>{const i=typeof t=="object"&&t!==null?(0,l.convertLexicalToPlaintext)({data:t}):t;return typeof i=="string"?(0,a.toPlainTrackingText)(i):i},[t]);(0,G.useIntersectionObserverDelay)(r,{once:!0,threshold:.5,delay:2e3,callback:()=>{x?x({componentType:e,componentName:n,componentTitle:_,componentDescription:b,navigation:c,pageGroup:E,position:g,creativeId:d}):(0,a.gaTrack)({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:E,component_type:e,component_name:n,position:g,creative_id:d,component_title:_,component_description:b,navigation:c}})}})};
|
|
@@ -27,5 +27,5 @@ interface ViewItemListOptions {
|
|
|
27
27
|
itemListName?: string;
|
|
28
28
|
items?: ViewItemListProduct[];
|
|
29
29
|
}
|
|
30
|
-
export declare const useViewItemList: (ref: RefObject<HTMLElement>, { componentType, componentName, componentTitle, componentDescription, navigation, position, itemListName, itemListId, items, tabName, pageGroup: explicitPageGroup, category, currency, }: ViewItemListOptions) => void;
|
|
30
|
+
export declare const useViewItemList: (ref: RefObject<HTMLElement | null>, { componentType, componentName, componentTitle, componentDescription, navigation, position, itemListName, itemListId, items, tabName, pageGroup: explicitPageGroup, category, currency, }: ViewItemListOptions) => void;
|
|
31
31
|
export {};
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -3,6 +3,12 @@ export { gaTrack, trackSelectItem, buildClickTrackingProps, resolveComponentMedi
|
|
|
3
3
|
export type { SelectItemProduct, TrackSelectItemOptions, ComponentMediaType, ClickTrackingPropsInput, TrackComponentClickOptions, } from './shared/track.js';
|
|
4
4
|
export { trackUrlRef, buildTrackingRef, buildPageGroup } from './shared/trackUrlRef.js';
|
|
5
5
|
export type { BuildPageGroupOptions } from './shared/trackUrlRef.js';
|
|
6
|
+
export { buildAmazonUrl, extractAmazonAsin } from './shared/amazonAttribution.js';
|
|
7
|
+
export type { AmazonLinkFields, BuildAmazonUrlOptions } from './shared/amazonAttribution.js';
|
|
8
|
+
export { getValidAdTrackEvents } from './shared/adTrack.js';
|
|
9
|
+
export type { AdTrackChannel, AdTrackEvent, AdTrackFields, AdTrackContext, OnAdTrackCallback, } from './shared/adTrack.js';
|
|
10
|
+
export { useBoaButton } from './hooks/useBoaButton.js';
|
|
11
|
+
export type { BoaButtonFields, ResolvedBoaLink, UseBoaButtonResult } from './hooks/useBoaButton.js';
|
|
6
12
|
export type { ExposureParams, OnExposureCallback } from './biz-components/AiuiProvider/index.js';
|
|
7
13
|
export type { Media, Theme, Img, Video, ContainerProps, ComponentCommonProps, ResponsiveMedia, Shape, Align, CurrencyDisplayType, } from './types/props.js';
|
|
8
14
|
export { default as useCountDown } from './hooks/useCountDown.js';
|
|
@@ -18,7 +24,9 @@ export type { UseTrackingOptions, UseTrackingResult } from './hooks/useTracking.
|
|
|
18
24
|
export { useCarouselPlayback } from './hooks/useCarouselPlayback.js';
|
|
19
25
|
export type { CarouselPlaybackState, CarouselSlideTrigger, UseCarouselPlaybackOptions, UseCarouselPlaybackResult, } from './hooks/useCarouselPlayback.js';
|
|
20
26
|
export { cn, getLocalizedPath, noop } from './helpers/index.js';
|
|
21
|
-
export { formatPrice, languageTerritory, PRICE_SYMBOL } from './helpers/index.js';
|
|
27
|
+
export { formatPrice, languageTerritory, PRICE_SYMBOL, extendLocaleMap } from './helpers/index.js';
|
|
22
28
|
export { LocalizedLink, type LocalizedLinkProps } from './shared/LocalizedLink.js';
|
|
23
|
-
export { CarouselArrows, CarouselProgressControls } from './shared/CarouselControls.js';
|
|
29
|
+
export { CarouselArrows, CarouselCornerToggle, CarouselProgressControls } from './shared/CarouselControls.js';
|
|
24
30
|
export type { CarouselArrowsProps, CarouselProgressControlsProps } from './shared/CarouselControls.js';
|
|
31
|
+
export { MEDIA_GRID_SPEC, resolveMediaGridSpec, mediaGridSpecToCssVars, type GridColumns, type MediaMode, type BreakpointSpec, type MediaGridSpec, } from './shared/mediaGridSpec.js';
|
|
32
|
+
export { ContainerGridContext, useContainerGrid, type ContainerGridInfo } from './shared/ContainerGridContext.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var R=Object.create;var u=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var z=(e,o)=>{for(var t in o)u(e,t,{get:o[t],enumerable:!0})},m=(e,o,t,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of G(o))!O.call(e,l)&&l!==t&&u(e,l,{get:()=>o[l],enumerable:!(x=j(o,l))||x.enumerable});return e},C=(e,o,t)=>(m(e,o,"default"),t&&m(t,o,"default")),U=(e,o,t)=>(t=e!=null?R(M(e)):{},m(o||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e)),v=e=>m(u({},"__esModule",{value:!0}),e);var c={};z(c,{CarouselArrows:()=>i.CarouselArrows,CarouselCornerToggle:()=>i.CarouselCornerToggle,CarouselProgressControls:()=>i.CarouselProgressControls,ContainerGridContext:()=>k.ContainerGridContext,LocalizedLink:()=>L.LocalizedLink,MEDIA_GRID_SPEC:()=>n.MEDIA_GRID_SPEC,PRICE_SYMBOL:()=>a.PRICE_SYMBOL,buildAmazonUrl:()=>d.buildAmazonUrl,buildClickTrackingProps:()=>r.buildClickTrackingProps,buildPageGroup:()=>s.buildPageGroup,buildTrackingRef:()=>s.buildTrackingRef,cn:()=>p.cn,extendLocaleMap:()=>a.extendLocaleMap,extractAmazonAsin:()=>d.extractAmazonAsin,formatPrice:()=>a.formatPrice,gaTrack:()=>r.gaTrack,getLocalizedPath:()=>p.getLocalizedPath,getValidAdTrackEvents:()=>f.getValidAdTrackEvents,languageTerritory:()=>a.languageTerritory,mediaGridSpecToCssVars:()=>n.mediaGridSpecToCssVars,noop:()=>p.noop,resolveComponentMediaType:()=>r.resolveComponentMediaType,resolveMediaGridSpec:()=>n.resolveMediaGridSpec,toPlainTrackingText:()=>r.toPlainTrackingText,trackComponentClick:()=>r.trackComponentClick,trackSelectItem:()=>r.trackSelectItem,trackUrlRef:()=>s.trackUrlRef,useBoaButton:()=>y.useBoaButton,useCarouselPlayback:()=>S.useCarouselPlayback,useContainerGrid:()=>k.useContainerGrid,useCountDown:()=>T.default,useDraggableScroll:()=>g.useDraggableScroll,useExposure:()=>P.useExposure,useGridRowCount:()=>A.useGridRowCount,useIntersectionObserverDelay:()=>b.useIntersectionObserverDelay,useRollout:()=>h.useRollout,useTracking:()=>I.useTracking,useViewItemList:()=>B.useViewItemList});module.exports=v(c);C(c,require("./components/index.js"),module.exports);var r=require("./shared/track.js"),s=require("./shared/trackUrlRef.js"),d=require("./shared/amazonAttribution.js"),f=require("./shared/adTrack.js"),y=require("./hooks/useBoaButton.js"),T=U(require("./hooks/useCountDown.js")),g=require("./hooks/useDraggableScroll.js"),P=require("./hooks/useExposure.js"),A=require("./hooks/useGridRowCount.js"),b=require("./hooks/useIntersectionObserver.js"),h=require("./hooks/useRollout.js"),B=require("./hooks/useViewItemList.js"),I=require("./hooks/useTracking.js"),S=require("./hooks/useCarouselPlayback.js"),p=require("./helpers/index.js"),a=require("./helpers/index.js"),L=require("./shared/LocalizedLink.js"),i=require("./shared/CarouselControls.js"),n=require("./shared/mediaGridSpec.js"),k=require("./shared/ContainerGridContext.js");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GridColumns } from './mediaGridSpec.js';
|
|
2
|
+
/**
|
|
3
|
+
* withLayout container 布局的栅格信息(由 withContainerLayout 注入)
|
|
4
|
+
*/
|
|
5
|
+
export interface ContainerGridInfo {
|
|
6
|
+
/** 组件在 12 列页面栅格中占据的列数(来自 container.desktopSpan,默认 12) */
|
|
7
|
+
gridColumns: GridColumns;
|
|
8
|
+
/** 移动端栅格跨度(来自 container.mobileSpan,可选) */
|
|
9
|
+
mobileSpan?: number;
|
|
10
|
+
/** 平板档(768–1024px)栅格跨度(来自 container.tabletSpan,可选;缺省时 tablet 档沿用 desktopSpan) */
|
|
11
|
+
tabletSpan?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const ContainerGridContext: import("react").Context<ContainerGridInfo | null>;
|
|
14
|
+
/**
|
|
15
|
+
* 读取当前组件所处的 container 栅格信息
|
|
16
|
+
*
|
|
17
|
+
* @returns 无 provider(组件未通过 withLayout container 布局包裹)时返回
|
|
18
|
+
* `null`,调用方应回退到 legacy aspect-ratio 类名
|
|
19
|
+
*/
|
|
20
|
+
export declare function useContainerGrid(): ContainerGridInfo | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";"use client";var i=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var d=(e,n)=>{for(var t in n)i(e,t,{get:n[t],enumerable:!0})},p=(e,n,t,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of m(n))!C.call(e,r)&&r!==t&&i(e,r,{get:()=>n[r],enumerable:!(u=a(n,r))||u.enumerable});return e};var s=e=>p(i({},"__esModule",{value:!0}),e);var f={};d(f,{ContainerGridContext:()=>l,useContainerGrid:()=>G});module.exports=s(f);var o=require("react");const l=(0,o.createContext)(null);function G(){return(0,o.useContext)(l)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var G=Object.create;var u=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var B=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},f=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of j(e))!E.call(t,o)&&o!==n&&u(t,o,{get:()=>e[o],enumerable:!(r=L(e,o))||r.enumerable});return t};var C=(t,e,n)=>(n=t!=null?G(_(t)):{},f(e||!t||!t.__esModule?u(n,"default",{value:t,enumerable:!0}):n,t)),O=t=>f(u({},"__esModule",{value:!0}),t);var Q={};B(Q,{getStylesProps:()=>k,useStyles:()=>$,withLayout:()=>J});module.exports=O(Q);var s=require("react/jsx-runtime"),l=C(require("react")),b=require("./simpleHash.js"),w=C(require("./getKeyPropsString.js")),d=require("../components/grid.js"),N=require("../components/container.js"),T=C(require("./ErrorBoundary.js")),I=require("./ContainerGridContext.js");const v=[12,10,8,6,4],A=t=>{const e=typeof t=="string"?Number.parseInt(t,10):t;return v.includes(e??12)?e??12:12},F={12:"col-start-1 col-end-13",10:"col-start-2 col-end-12",8:"col-start-3 col-end-11",6:"col-start-4 col-end-10",4:"col-start-5 col-end-9"},S={12:"tablet:col-start-1 tablet:col-end-13",10:"tablet:col-start-2 tablet:col-end-12",8:"tablet:col-start-3 tablet:col-end-11",6:"tablet:col-start-4 tablet:col-end-10",4:"tablet:col-start-5 tablet:col-end-9"},K={12:"laptop:col-start-1 laptop:col-end-13",10:"laptop:col-start-2 laptop:col-end-12",8:"laptop:col-start-3 laptop:col-end-11",6:"laptop:col-start-4 laptop:col-end-10",4:"laptop:col-start-5 laptop:col-end-9"},R=t=>{const e=(0,w.default)(t);return`style_${(0,b.simpleHash)(e)}`},k=t=>{const{style:e,uid:n,disabled:r,containerClassName:o}=t;return{style:e,uid:n,disabled:r,containerClassName:o}},M=({style:t,uid:e=R({}),disabled:n=!1})=>!t||n?null:(0,s.jsx)("style",{suppressHydrationWarning:!0,"data-style-id":e,dangerouslySetInnerHTML:{__html:`.block-${e} { ${t} }`}}),$=(t,e)=>{const n=(0,l.useMemo)(()=>t?.uid||R({...t,...e??{}}),[e,t]),r=(0,l.useMemo)(()=>(0,s.jsx)(M,{...t,uid:n}),[t,n]);return{className:`block-${n} `,StyleComponent:r,uid:n,idx:e?.idx!=null?String(e.idx):void 0}},H=t=>{const{desktopSpan:e,mobileSpan:n,tabletSpan:r}=t||{},o=n?F[n]:"";if(!r){const p=e?S[e]:"";return`${o} ${p}`.trim()}const a=S[r]??"",c=e?K[e]:"";return`${o} ${a} ${c}`.trim()},D=t=>t?typeof t=="string"?t:typeof t=="object"&&Object.entries(t).length<=0?"":Object.entries(t).map(([e,n])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${n}`).join("; ")+";":"",U=(t,e)=>[t,e].map(D).filter(n=>!!n).map(n=>n.trim().endsWith(";")?n:`${n};`).join(" ");function Z(t,e){const n=l.default.forwardRef((r,o)=>{const{container:a,containerClassName:c,className:p,...m}=r;if(!a||Reflect.ownKeys(a).length===0)return(0,s.jsx)(t,{...m,className:p,ref:o});const y=[e,c,p].filter(Boolean).join(" ").trim(),i=a,P={gridColumns:A(i?.desktopSpan),mobileSpan:i?.mobileSpan,tabletSpan:i?.tabletSpan};return(0,s.jsx)(N.Container,{className:y,children:(0,s.jsx)(d.Grid,{className:"container_grid",children:(0,s.jsx)(d.GridItem,{className:H(i),children:(0,s.jsx)(I.ContainerGridContext.Provider,{value:P,children:(0,s.jsx)(t,{...m,ref:o})})})})})});return n.displayName=`WithContainerLayout(${t.displayName||t.name||"Component"})`,n}function q(t,e){const n=l.default.forwardRef((r,o)=>{const a=k(r),c=U(e?.style,a.style),p={...e,...a,...c&&{style:c}},{className:m,StyleComponent:y,idx:i}=$(p,r.data),{style:P,uid:V,disabled:X,className:h,...x}=r;return(0,s.jsxs)(s.Fragment,{children:[y,(0,s.jsx)(t,{...i?{id:i}:{},...x,className:[m,h].filter(Boolean).join(" ").trim(),ref:o})]})});return n.displayName=`WithStyleInjection(${t.displayName||t.name||"Component"})`,n}function z(t){const e=l.default.forwardRef((n,r)=>(0,s.jsx)(T.default,{children:(0,s.jsx)(t,{...n,ref:r})}));return e.displayName=`WithErrorBoundary(${t.displayName||t.name||"Component"})`,e}const g=new WeakMap;function J(t,e){if(g.has(t))return t;const n=z(q(Z(t,e?.containerClassName),e));n.displayName=`WithLayout(${t.displayName||t.name||"Component"})`,g.set(t,!0);const r=n;return Object.getOwnPropertyNames(t).forEach(o=>{!(o in r)&&o!=="arguments"&&o!=="caller"&&o!=="length"&&o!=="name"&&(r[o]=t[o])}),r}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 广告埋点(Meta、Google 按钮点击)的数据结构与清洗规则。
|
|
3
|
+
* 组件只负责把按钮上配置的事件交给业务端(AiuiProvider.onAdTrack),不初始化三方脚本。
|
|
4
|
+
*/
|
|
5
|
+
export type AdTrackChannel = 'meta' | 'google';
|
|
6
|
+
export interface AdTrackEvent {
|
|
7
|
+
/** 渠道,一期只有 meta、google */
|
|
8
|
+
channel: AdTrackChannel;
|
|
9
|
+
/** Meta 作自定义事件名;Google 作转化名称 */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Google 转化标签,渠道为 google 时必填。不得填写访问令牌或密钥 */
|
|
12
|
+
googleLabel?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AdTrackFields {
|
|
15
|
+
/** 是否增加广告埋点,不勾选则本按钮不上报 */
|
|
16
|
+
hasTrack?: boolean;
|
|
17
|
+
/** 埋点事件,每行一个事件 */
|
|
18
|
+
trackEvents?: AdTrackEvent[];
|
|
19
|
+
}
|
|
20
|
+
export interface AdTrackContext {
|
|
21
|
+
/** 组件名,如 hero_banner */
|
|
22
|
+
componentName: string;
|
|
23
|
+
/** 按钮位置,如 primary、secondary、tertiary、buy、text_link */
|
|
24
|
+
buttonPosition: string;
|
|
25
|
+
/** 按钮文案 */
|
|
26
|
+
buttonText?: string;
|
|
27
|
+
/** 点击时的最终链接 */
|
|
28
|
+
href?: string;
|
|
29
|
+
}
|
|
30
|
+
export type OnAdTrackCallback = (events: AdTrackEvent[], context: AdTrackContext) => void;
|
|
31
|
+
/**
|
|
32
|
+
* 清洗事件行,返回可交给业务端的事件:
|
|
33
|
+
* - 未勾选 hasTrack:整体不交接
|
|
34
|
+
* - 事件名为空:该行跳过
|
|
35
|
+
* - Google 行缺转化标签:该行跳过,Meta 行不受影响
|
|
36
|
+
* - 渠道不是 meta、google:该行跳过
|
|
37
|
+
*/
|
|
38
|
+
export declare const getValidAdTrackEvents: (fields?: AdTrackFields) => AdTrackEvent[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var s=(t,e)=>{for(var r in e)c(t,r,{get:e[r],enumerable:!0})},k=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of g(e))!l.call(t,n)&&n!==r&&c(t,n,{get:()=>e[n],enumerable:!(a=i(e,n))||a.enumerable});return t};var d=t=>k(c({},"__esModule",{value:!0}),t);var A={};s(A,{getValidAdTrackEvents:()=>T});module.exports=d(A);const o=t=>(t??"").trim(),T=t=>!t?.hasTrack||!Array.isArray(t.trackEvents)?[]:t.trackEvents.reduce((e,r)=>{const a=o(r?.name);if(!a)return e;if(r.channel==="meta")e.push({channel:"meta",name:a});else if(r.channel==="google"){const n=o(r.googleLabel);n&&e.push({channel:"google",name:a,googleLabel:n})}return e},[]);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 亚马逊(BOA)链接归因参数拼接,纯函数,不依赖 DOM。
|
|
3
|
+
*
|
|
4
|
+
* 取值优先级(逐个参数单独判断):链接自带 > 按钮级 > 页面级 > 自动计算。
|
|
5
|
+
* 「有值」指参数存在、值非空、且不是 {{xxx}} 占位符;unknown 视为有值。
|
|
6
|
+
*/
|
|
7
|
+
export interface AmazonLinkFields {
|
|
8
|
+
/** 是否为亚马逊链接,勾选后按标准规则拼接归因参数 */
|
|
9
|
+
isAmazonlink?: boolean;
|
|
10
|
+
/** 按钮级活动标识,非空时覆盖页面级广告活动 ID */
|
|
11
|
+
adCampaign?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface BuildAmazonUrlOptions {
|
|
14
|
+
/** 按钮级活动标识 */
|
|
15
|
+
buttonAdCampaign?: string;
|
|
16
|
+
/** 页面级广告活动 ID */
|
|
17
|
+
pageAdCampaign?: string;
|
|
18
|
+
/** 页面级 maas(业务端已按「页面级 > 店铺级 > 内置映射」算好) */
|
|
19
|
+
maas?: string;
|
|
20
|
+
/** 访客落地页的 location.search,用于取 utm 参数 */
|
|
21
|
+
search?: string;
|
|
22
|
+
}
|
|
23
|
+
/** 从链接路径取 10 位商品编号;识别前先去掉 ? 和 # 之后的内容 */
|
|
24
|
+
export declare const extractAmazonAsin: (url?: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* 给亚马逊链接补全归因参数。
|
|
27
|
+
* - 只补缺失的参数;链接自带的有值参数、其他参数(如 th=1)和锚点原样保留
|
|
28
|
+
* - 空链接、纯锚点原样返回
|
|
29
|
+
* - 拼不出来时返回原链接,不抛错
|
|
30
|
+
*/
|
|
31
|
+
export declare const buildAmazonUrl: (url: string | undefined, options?: BuildAmazonUrlOptions) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var A=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var U=(n,t)=>{for(var e in t)A(n,e,{get:t[e],enumerable:!0})},M=(n,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $(t))!I.call(n,i)&&i!==e&&A(n,i,{get:()=>t[i],enumerable:!(a=O(t,i))||a.enumerable});return n};var w=n=>M(A({},"__esModule",{value:!0}),n);var D={};U(D,{buildAmazonUrl:()=>T,extractAmazonAsin:()=>P});module.exports=w(D);const z=/^\{\{.*\}\}$/,E=/\/(?:dp|gp\/product)\/([A-Za-z0-9]{10})(?=[/?#]|$)/,f="maas",p="ref_",g="aa_campaignid",l="aa_adgroupid",h="aa_creativeid",b=[f,p,g,l,h],y=n=>{try{return decodeURIComponent(n)}catch{return n}},S=n=>{if(n==null)return!1;const t=y(n).trim();return t!==""&&!z.test(t)},u=n=>(n??"").trim(),P=(n="")=>n.split("#")[0].split("?")[0].match(E)?.[1]??"",B=n=>n.split("&").filter(Boolean).map(t=>{const e=t.indexOf("="),a=e===-1?t:t.slice(0,e),i=e===-1?"":t.slice(e+1);return{key:y(a),value:i,raw:t}}),L=n=>{const t=new URLSearchParams(n??""),e=a=>u(t.get(a)??void 0);return{term:e("utm_term"),source:e("utm_source"),medium:e("utm_medium"),campaign:e("utm_campaign")}},T=(n,t={})=>{if(!n)return n??"";if(n.startsWith("#"))return n;try{const e=n.indexOf("#"),a=e===-1?"":n.slice(e),i=e===-1?n:n.slice(0,e),m=i.indexOf("?"),k=m===-1?i:i.slice(0,m),x=m===-1?"":i.slice(m+1),r=new Set,C=B(x).filter(s=>b.includes(s.key)?!S(s.value)||r.has(s.key)?!1:(r.add(s.key),!0):!0),R=[],c=(s,d)=>{R.push(`${s}=${encodeURIComponent(d)}`)},o=L(t.search);if(!r.has(f)){const s=u(t.maas);s&&c(f,s)}if(r.has(p)||c(p,"aa_maas"),!r.has(g)){const s=P(n),d=u(t.buttonAdCampaign)||u(t.pageAdCampaign);d?s&&c(g,`${d}${s}`):s&&c(g,s)}r.has(l)||c(l,o.term?o.term.replace(/\s/g,"_"):"unknown"),r.has(h)||c(h,[o.source,o.medium,o.campaign].map(s=>s||"unknown").join("_"));const _=[...C.map(s=>s.raw),...R].join("&");return`${k}${_?`?${_}`:""}${a}`}catch{return n}};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container Grid 媒体尺寸规格表(纯数据 + 纯函数,无 React 依赖)
|
|
3
|
+
*
|
|
4
|
+
* 用途:当 biz-component 通过 withLayout 的 `container` prop 被放置进
|
|
5
|
+
* Container > Grid > GridItem 栅格布局时,媒体区域(图片/视频)在各个
|
|
6
|
+
* 断点下的"满栅格"尺寸规格。组件可据此推导 aspect-ratio CSS 变量,
|
|
7
|
+
* 替代散落在各组件里的硬编码 aspect ratio 类名。
|
|
8
|
+
*
|
|
9
|
+
* ⚠️ 命名辨析:本模块的 `GridColumns` 描述的是 **withLayout container
|
|
10
|
+
* 布局的栅格跨度**(CMS `container.desktopSpan`,即组件在 12 列页面
|
|
11
|
+
* 栅格中占据的列数:12/10/8/6/4)。它与 Ksp 组件内部的 `gridColumns`
|
|
12
|
+
* prop(KSP 卡片瓦片布局自身的 10/12 列网格)是**同名不同概念**,
|
|
13
|
+
* 两者互不相关,请勿混用。
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* 栅格列数(withLayout container 的 desktopSpan 语义)
|
|
17
|
+
*
|
|
18
|
+
* 12 = 满宽(col-start-1 col-end-13)
|
|
19
|
+
* 10 = 10/12 宽(col-start-2 col-end-12)
|
|
20
|
+
* 8 = 8/12 宽(col-start-3 col-end-11)
|
|
21
|
+
* 6 = 6/12 宽(col-start-4 col-end-10)
|
|
22
|
+
* 4 = 4/12 宽(col-start-5 col-end-9)
|
|
23
|
+
*/
|
|
24
|
+
export type GridColumns = 12 | 10 | 8 | 6 | 4;
|
|
25
|
+
/**
|
|
26
|
+
* 媒体排布模式
|
|
27
|
+
* - bottom:媒体在文字下方(整块媒体占满栅格宽度)
|
|
28
|
+
* - left-right:媒体与文字左右并排(媒体只占栅格宽度的一部分)
|
|
29
|
+
*/
|
|
30
|
+
export type MediaMode = 'bottom' | 'left-right';
|
|
31
|
+
/**
|
|
32
|
+
* 单个断点的媒体尺寸规格(px)
|
|
33
|
+
*/
|
|
34
|
+
export interface BreakpointSpec {
|
|
35
|
+
/** 媒体区域宽度(px) */
|
|
36
|
+
w: number;
|
|
37
|
+
/** 媒体区域高度(px) */
|
|
38
|
+
h: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 一套完整的媒体栅格尺寸规格
|
|
42
|
+
*
|
|
43
|
+
* - lgDesktop / desktop / laptop:必填的三个桌面断点
|
|
44
|
+
* - tablet:可选;当前规格表沿用 laptop 档位(设计尚未给出独立 tablet 值,
|
|
45
|
+
* 待设计确认后可单独覆盖)
|
|
46
|
+
* - mobile:移动端只约束高度(宽度跟随视口)
|
|
47
|
+
*/
|
|
48
|
+
export interface MediaGridSpec {
|
|
49
|
+
lgDesktop: BreakpointSpec;
|
|
50
|
+
desktop: BreakpointSpec;
|
|
51
|
+
laptop: BreakpointSpec;
|
|
52
|
+
tablet?: BreakpointSpec;
|
|
53
|
+
mobile: {
|
|
54
|
+
height: number;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 规格表:gridColumns × mediaMode → 各断点媒体尺寸
|
|
59
|
+
*
|
|
60
|
+
* 数值来源:设计确认稿(CONFIRMED,勿随意改动)。
|
|
61
|
+
* 高度 560/488/336 为设计手工调优值;宽度由栅格推导(见测试中的
|
|
62
|
+
* 一致性校验:1920→1664、1440→1312、1025→897≈896,16px gutter)。
|
|
63
|
+
*/
|
|
64
|
+
export declare const MEDIA_GRID_SPEC: Record<GridColumns, Partial<Record<MediaMode, MediaGridSpec>>>;
|
|
65
|
+
/**
|
|
66
|
+
* 解析指定栅格跨度 × 排布模式下的媒体尺寸规格
|
|
67
|
+
*
|
|
68
|
+
* @returns 对应规格;未覆盖的组合(如 8/6/4 栏目前无设计规格)返回
|
|
69
|
+
* `undefined`,调用方应回退到组件既有的 legacy aspect-ratio 类名。
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveMediaGridSpec(columns: GridColumns, mode: MediaMode): MediaGridSpec | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* 将规格转换为 CSS 自定义属性(供组件以 inline style 挂载):
|
|
74
|
+
*
|
|
75
|
+
* - `--ar-t`:tablet 档 aspect-ratio('w/h',无 tablet 档时回退 laptop)
|
|
76
|
+
* - `--ar-l`:laptop 档 aspect-ratio('w/h')
|
|
77
|
+
* - `--ar-d`:desktop 档 aspect-ratio('w/h')
|
|
78
|
+
* - `--ar-x`:lg-desktop 档 aspect-ratio('w/h')
|
|
79
|
+
* - `--mh-m`:mobile 档媒体高度(如 '360px')
|
|
80
|
+
*
|
|
81
|
+
* 组件侧典型用法:
|
|
82
|
+
* ```tsx
|
|
83
|
+
* const spec = resolveMediaGridSpec(12, 'bottom')
|
|
84
|
+
* <div style={spec ? mediaGridSpecToCssVars(spec) : undefined} className="aspect-[var(--ar-l)] ..." />
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare function mediaGridSpecToCssVars(spec: MediaGridSpec): Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var r=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var n=(e,t)=>{for(var i in t)r(e,i,{get:t[i],enumerable:!0})},s=(e,t,i,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of d(t))!h.call(e,o)&&o!==i&&r(e,o,{get:()=>t[o],enumerable:!(p=l(t,o))||p.enumerable});return e};var b=e=>s(r({},"__esModule",{value:!0}),e);var m={};n(m,{MEDIA_GRID_SPEC:()=>a,mediaGridSpecToCssVars:()=>k,resolveMediaGridSpec:()=>g});module.exports=b(m);const a={12:{bottom:{lgDesktop:{w:1664,h:560},desktop:{w:1312,h:488},laptop:{w:896,h:336},tablet:{w:896,h:336},mobile:{height:360}},"left-right":{lgDesktop:{w:964,h:560},desktop:{w:760,h:448},laptop:{w:516,h:336},tablet:{w:516,h:336},mobile:{height:360}}},10:{bottom:{lgDesktop:{w:1384,h:560},desktop:{w:1090,h:488},laptop:{w:744,h:336},tablet:{w:744,h:336},mobile:{height:360}},"left-right":{lgDesktop:{w:824,h:560},desktop:{w:648,h:448},laptop:{w:440,h:336},tablet:{w:440,h:336},mobile:{height:360}}},8:{},6:{},4:{}};function g(e,t){return a[e]?.[t]}function k(e){const t=({w:p,h:o})=>`${p}/${o}`,i=e.tablet??e.laptop;return{"--ar-t":t(i),"--ar-l":t(e.laptop),"--ar-d":t(e.desktop),"--ar-x":t(e.lgDesktop),"--mh-m":`${e.mobile.height}px`}}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BoaButtonFields } from '../hooks/useBoaButton.js';
|
|
3
|
+
export declare const boaStoryButton: BoaButtonFields & {
|
|
4
|
+
text: string;
|
|
5
|
+
link: string;
|
|
6
|
+
};
|
|
7
|
+
/** 演示交接数据,不初始化或调用任何真实广告脚本。 */
|
|
8
|
+
export declare const BoaStoryProvider: ({ children }: {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var m=Object.create;var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var g=(t,a)=>{for(var o in a)i(t,o,{get:a[o],enumerable:!0})},s=(t,a,o,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of d(a))!k.call(t,e)&&e!==o&&i(t,e,{get:()=>a[e],enumerable:!(r=p(a,e))||r.enumerable});return t};var b=(t,a,o)=>(o=t!=null?m(u(t)):{},s(a||!t||!t.__esModule?i(o,"default",{value:t,enumerable:!0}):o,t)),A=t=>s(i({},"__esModule",{value:!0}),t);var v={};g(v,{BoaStoryProvider:()=>h,boaStoryButton:()=>B});module.exports=A(v);var n=require("react/jsx-runtime"),c=require("react"),l=b(require("../biz-components/AiuiProvider/index.js"));const B={text:"Buy on Amazon",link:"https://www.amazon.com/dp/B0HJW5F8L3?th=1#details",isAmazonlink:!0,hasTrack:!0,trackEvents:[{channel:"meta",name:"boa_banner"},{channel:"google",name:"boa_banner",googleLabel:"demo-label"}]},h=({children:t})=>{const[a,o]=(0,c.useState)(null);return(0,n.jsxs)(l.default,{trackingData:{pageGroup:"Activity Page_boa-demo"},pageHandle:"boa-demo",componentBoaEnabled:!0,amazonAttribution:{adCampaign:"demo_",maas:"demo-platform"},onAdTrack:(r,e)=>o({events:r,context:e}),children:[t,(0,n.jsxs)("section",{className:"bg-container-primary text-info-primary p-4",children:[(0,n.jsx)("p",{children:"\u70B9\u51FB\u6309\u94AE\u67E5\u770B\u4EA4\u63A5\u6570\u636E\u3002\u94FE\u63A5\u9ED8\u8BA4\u65B0\u7A97\u53E3\uFF1B\u53EF\u53F3\u952E\u68C0\u67E5\u6700\u7EC8\u5730\u5740\u3002\u8BBF\u95EE\u5730\u5740\u4E2D\u7684 utm \u53C2\u6570\u4F1A\u53C2\u4E0E\u5F52\u56E0\u3002"}),(0,n.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap",children:JSON.stringify(a,null,2)})]})]})};
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import type { ButtonFunctionType, CopyConfig, UserType, ActivityLabel, DiscountTagStyle, ActiveShelfLayoutMode, TagTypeConfig, TagColorConfig } from './types.js';
|
|
3
3
|
import type { BadgeProps } from '../../components/badge.js';
|
|
4
4
|
import type { Img } from '../../types/props.js';
|
|
5
|
+
import type { ShelfBoaFields } from './types.js';
|
|
5
6
|
/**
|
|
6
7
|
* 语义化类名
|
|
7
8
|
*/
|
|
@@ -100,8 +101,10 @@ export interface VariantData {
|
|
|
100
101
|
* 完整的产品卡片数据接口
|
|
101
102
|
*/
|
|
102
103
|
export interface ProductCardData extends BaseProductData, VariantData {
|
|
104
|
+
/** 亚马逊按钮使用的商品链接 */
|
|
105
|
+
customProductLink?: string;
|
|
103
106
|
}
|
|
104
|
-
export interface ProductCardProps {
|
|
107
|
+
export interface ProductCardProps extends ShelfBoaFields {
|
|
105
108
|
/** 产品数据 */
|
|
106
109
|
product: ProductCardData;
|
|
107
110
|
/** 当前所在 Tab 的文案,上报为 navigation */
|
|
@@ -1 +1 @@
|
|
|
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
|
+
"use client";import{Fragment as Ze,jsx as t,jsxs as m}from"react/jsx-runtime";import*as D from"react";import{cn as a}from"../../helpers/index.js";import{Button as ae,Badge as qe,Card as He,CardContent as Ve,Picture as ie,Text as S,Heading as _,Progress as $e}from"../../components/index.js";import{toPlainTrackingText as R}from"../../shared/track.js";import{trackUrlRef as Ue}from"../../shared/trackUrlRef.js";import{useTracking as Ge}from"../../hooks/useTracking.js";import{MemberLabel as Ke}from"./MemberLabel.js";import{layoutModeStyles as ne}from"./styles.js";import{useBoaButton as Je}from"../../hooks/useBoaButton.js";const Qe=5,oe="shelf",se="active_shelf";function We(e,n,c,h){if(e===void 0)return!0;switch(e){case"always":return!0;case"never":return!1;case"below-quantity":return n===void 0?!0:c<=n;case"below-percentage":return n===void 0?!0:c/h*100<=n;default:return!0}}const Xe=({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,c)=>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"},c):t(S,{"aria-label":n.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:n.icon},c))}):null,re={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"}},Ye=({text:e,style:n="style1",icon:c,className:h,textClassName:M,textColor:x,layoutMode:C="flex",renderBadge:k})=>{if(!e)return null;const b=n==="custom",T=b&&!!k,o=b&&!k&&!!c?.url,u=b?void 0:re[n],r=re.style1,d=ne[C],l={style1:d.discountBadgeText,style2:d.discountBadgeTextStyle2,style3:d.discountBadgeTextStyle3},O=b?d.discountBadgeTextCenter:l[n];return m("div",{className:a("active-shelf-discount-badge","absolute left-0 top-0 z-30",d.discountBadgeSize,h),children:[T?k({text:e,layoutMode:C}):o?t(ie,{source:c.url,alt:c.alt||e,className:"block size-full",imgClassName:"block size-full object-contain"}):t("img",{src:(u??r).bg,alt:e,loading:"lazy",className:"block size-full object-contain"}),!T&&t(S,{className:a("active-shelf-discount-badge-text text-center","absolute inset-0 font-bold !leading-[1.2]",O,(u??r).textClass,M),style:x?{color:x}:void 0,html:e})]})},E=D.forwardRef(({product:e,tabName:n="",position:c=1,className:h,showTags:M=!0,stockDisplayMode:x,stockThresholdValue:C,onLearnMore:k,onShopNow:b,onAddToCart:T,classNames:o,secondaryButtonText:u,secondaryButtonFun:r,primaryButtonText:d,primaryButtonFun:l,secondaryAdCampaign:O,primaryAdCampaign:le,secondaryButtonTarget:ce,primaryButtonTarget:de,secondaryHasTrack:me,primaryHasTrack:ue,secondaryTrackEvents:ge,primaryTrackEvents:fe,showOriginalPrice:I,renderOriginalPrice:j,copy:y,onProductImageClick:p,tagTypeConfig:q,fill:H,outline:V,memberPriceTextColor:$,userType:A,memberImages:be,customTagsIcon:ye,customTagStyle:pe,discountTagTextColor:ve,onMemberSignUp:he,onPlusMemberAddCart:ke,showMemberPrice:U,layoutMode:w,renderDiscountBadge:Se},xe)=>{const[Ce,Te]=D.useState(!1),[Ae,ze]=D.useState(!1),{resolveLink:G,trackAd:K,hasAdTrack:J}=Je(),Q={hasTrack:me,trackEvents:ge},W={hasTrack:ue,trackEvents:fe},z=G(e.customProductLink,{isAmazonlink:r==="buyOnAmazon",adCampaign:O}).href,N=G(e.customProductLink,{isAmazonlink:l==="buyOnAmazon",adCampaign:le}).href,{buildRef:Ne}=Ge(),Pe=e.custom_name||e.name,P=i=>({"data-headless-type-name":`${oe}#${se}`,"data-headless-title-desc-button":`${R(Pe)}#${R(e.description)}#${R(i)}`,"data-headless-nav-position":`${R(n)}#${c}`,...e.sku?{"data-headless-sku":e.sku}:{}}),L=e?.listingLink?Ue(e.listingLink,Ne(oe,se)):void 0,Le=e?.memberDiscountAmount,De=e?.plusMemberDiscountAmount,_e=e?.activityLabels??[],Re=A==="guest"?"guest":"member",X=_e.find(i=>i.type===Re)?.label,Me=A==="guest"?y?.memberActivityLabelUnLogin:y?.memberActivityLabel,Oe=!!X||!!Me,we=e?.discountAmount,s=ne[w??"flex"],Be=D.useMemo(()=>e?.availableForSale&&e?.quantityAvailable<=0?Qe:e?.availableForSale?(e?.quantityAvailable??0)/(e?.totalInventory??1)*100:0,[e?.availableForSale,e?.quantityAvailable,e?.totalInventory]),Y=async(i,g)=>{if(!i)return;const f=g==="primary"?Te:ze;f(!0);try{switch(i){case"buyNow":await b?.(e);break;case"addCart":await T?.(e);break;case"learnMore":await k?.(e);break;default:break}}finally{f(!1)}},Ee=e.availableForSale&&e.quantityAvailable<=0,Ie=(i,g)=>{const f=i===0?q?.firstTagVariant:i===1?q?.secondTagVariant:void 0,B=(f||void 0)??(g==="fill"?"fill":g!==void 0?"outline":i===0?"fill":"outline"),v=B==="fill"?{outline:H?.outlineColor,bg:H?.bgColor}:{outline:V?.outlineColor,bg:V?.bgColor},te={...v.outline?{outlineColor:v.outline}:{},...v.bg?{backgroundColor:v.bg,backgroundImage:"none"}:{}};return B==="outline"&&v.outline&&(te.color=v.outline),{variant:B,style:te}},Z=!!e.custom_bg_image,je=!!e.custom_scene_image,F=i=>i?{backgroundImage:`url(${i})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"}:void 0;return m(He,{ref:xe,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,h,o?.productCard),children:[t(Ye,{text:we,style:pe,icon:ye,layoutMode:w,renderBadge:Se,className:o?.discountBadge,textClassName:o?.discountBadgeText,textColor:ve}),m(Ve,{className:a(s.cardContent,"relative flex flex-1 flex-col justify-between"),children:[m("div",{className:"product-image-wrapper group/product-image laptop:pb-2 laptop:mb-4 desktop:pb-6 desktop:mb-4 relative mb-4",children:[Z&&t("div",{"aria-hidden":!0,className:a("pointer-events-none absolute inset-0 z-20",s.imageOffset),style:F(e.custom_bg_image)}),je&&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:F(e.custom_scene_image)}),t("div",{className:a("product-image mx-auto cursor-pointer overflow-hidden",s.image),children:t("a",{onClick:()=>p?.(e),...!p&&{href:L},...p||L?P():{},rel:"noreferrer",className:a("block size-full",Z&&"opacity-0"),children:t(ie,{source:e.image,alt:e.name,className:"aspect-square size-full object-contain",imgClassName:"size-full object-contain"})})}),t(Xe,{items:e?.socialEndorsements})]}),M&&t("div",{className:"desktop:mb-2 mb-1 flex h-[24px] gap-1",children:e.tags?.map((i,g)=>{if(!i.label)return null;const{variant:f,style:ee}=Ie(g,i.variant);return t(qe,{size:"sm",variant:f,className:"active-shelf-items-tag py-0",style:ee,children:i.label},g)})}),m("div",{className:"flex h-full flex-1 grow flex-col justify-between gap-4",children:[m("div",{children:[t(_,{as:"h3",size:"none",className:a("text-info-primary",s.title,o?.productTitle),children:t("a",{onClick:()=>p?.(e),...!p&&{href:L},...p||L?P():{},rel:"noreferrer",className:"hover:text-brand-0 cursor-pointer ",children:e.custom_name||e.name})}),e?.description&&t(S,{size:"none",className:a("active-shelf-product-description text-info-primary",s.description,o?.productDescription),html:e.custom_description||e.description})]}),m("div",{children:[t("div",{className:a(o?.productPrice),children:t("div",{className:a("flex items-baseline",s.priceGap),children:e.availableForSale?m(Ze,{children:[t(_,{size:"none",className:a("text-info-primary",s.price),as:"h6",children:e.price}),j?j(e,{showOriginalPrice:I}):I&&e.originalPrice&&t(_,{size:"none",className:a("text-info-tertiary line-through",s.price,o?.originalPrice),as:"h6",children:e.originalPrice})]}):t(_,{size:"none",className:a("text-info-tertiary",s.price),children:y?.outOfStockLabel??"Sold Out"})})}),U&&e?.priceLabel&&e?.availableForSale&&t("div",{className:a("min-h-[1lh]",s.priceLabel),children:t(S,{size:"none",className:a("text-brand-0",o?.productPriceLabel),style:{...$?{color:$}:{}},children:e.priceLabel})}),m("div",{className:a("mt-2 flex",s.buttonContainer,o?.buttonGroup),children:[u&&t(ae,{variant:"secondary",size:"lg",className:a(s.buttonItem,o?.secondaryButton),as:r==="buyOnAmazon"&&z?"a":"button",href:r==="buyOnAmazon"?z:void 0,target:r==="buyOnAmazon"?ce??"_blank":void 0,rel:r==="buyOnAmazon"?"noopener noreferrer":void 0,onClick:()=>{if(K(Q,{componentName:"active_shelf",buttonPosition:"secondary",buttonText:u,href:r==="buyOnAmazon"?z:void 0}),r!=="buyOnAmazon")return Y(r,"secondary")},disabled:r==="buyOnAmazon"?!z:!e.availableForSale&&r!=="learnMore",loading:Ae,"data-headless-ad-track":J(Q)?"true":void 0,"data-headless-amazon":r==="buyOnAmazon"?"true":void 0,...P(u),children:u}),d&&t(ae,{variant:"primary",size:"lg",className:a(s.buttonItem,o?.primaryButton),as:l==="buyOnAmazon"&&N?"a":"button",href:l==="buyOnAmazon"?N:void 0,target:l==="buyOnAmazon"?de??"_blank":void 0,rel:l==="buyOnAmazon"?"noopener noreferrer":void 0,onClick:()=>{if(K(W,{componentName:"active_shelf",buttonPosition:"primary",buttonText:d,href:l==="buyOnAmazon"?N:void 0}),l!=="buyOnAmazon")return Y(l,"primary")},disabled:l==="buyOnAmazon"?!N:!e.availableForSale&&l!=="learnMore",loading:Ce,"data-headless-ad-track":J(W)?"true":void 0,"data-headless-amazon":l==="buyOnAmazon"?"true":void 0,...P(d),children:d})]}),We(x,C,e?.quantityAvailable??0,e?.totalInventory??0)&&m("div",{className:"active-shelf-stock mt-4 flex flex-col gap-1",children:[t($e,{value:Be,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(S,{size:3,className:"text-info-tertiary text-[14px]",children:Ee?y?.limitedStock:y?.stockDisplayText?.replace("{count}",`${e.availableForSale?e.quantityAvailable:0}`)})]})]})]})]}),U&&A&&t(Ke,{userType:A,copy:y,images:be,onSignUp:he,onPlusMemberAddCart:ke,hasActivity:Oe,activityLabel:X,memberDiscountAmount:Le,plusMemberDiscountAmount:De,layoutMode:w})]})});E.displayName="ActiveShelf.ProductCard";var rt=E;export{E as ProductCard,rt as default};
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { type PromotionalBarProps } from '../PromotionalBar/index.js';
|
|
3
3
|
import 'swiper/css';
|
|
4
4
|
import 'swiper/css/navigation';
|
|
5
|
-
import type { ButtonFunctionType, CopyConfig, UserType, DiscountTagStyle, ActiveShelfLayoutMode, TagTypeConfig, TagColorConfig } from './types.js';
|
|
5
|
+
import type { ShelfBoaFields, ButtonFunctionType, CopyConfig, UserType, DiscountTagStyle, ActiveShelfLayoutMode, TagTypeConfig, TagColorConfig } from './types.js';
|
|
6
6
|
import { ProductCard, type ProductCardData, type ActiveShelfSemanticName, type StockDisplayMode } from './ProductCard.js';
|
|
7
7
|
import type { Img } from '../../types/props.js';
|
|
8
8
|
/**
|
|
@@ -33,7 +33,7 @@ export interface ProductTab {
|
|
|
33
33
|
/**
|
|
34
34
|
* ActiveShelf 业务组件数据接口
|
|
35
35
|
*/
|
|
36
|
-
export interface ActiveShelfData {
|
|
36
|
+
export interface ActiveShelfData extends ShelfBoaFields {
|
|
37
37
|
theme?: 'light' | 'dark';
|
|
38
38
|
/** 组件标题 */
|
|
39
39
|
title?: string;
|
|
@@ -1 +1 @@
|
|
|
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
|
+
"use client";import{Fragment as he,jsx as o,jsxs as n}from"react/jsx-runtime";import*as s from"react";import{cn as T}from"../../helpers/index.js";import{withLayout as Be}from"../../shared/Styles.js";import{Text as De,Heading as Le,Tabs as Ne,TabsList as Ae,TabsTrigger as Ee,TabsContent as Re}from"../../components/index.js";import pe from"../PromotionalBar/index.js";import{Swiper as Ie,SwiperSlide as Fe}from"swiper/react";import{Navigation as ze}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import{ProductCard as re}from"./ProductCard.js";import{useExposure as He}from"../../hooks/useExposure.js";import{toPlainTrackingText as y}from"../../shared/track.js";const ae="shelf",ne="active_shelf",$e=()=>n("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[o("span",{className:"prev-mask bg-masks-0 group-hover/prev-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),o("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:o("path",{d:"M15 6L9 12L15 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),Oe=()=>n("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[o("span",{className:"next-mask bg-masks-0 group-hover/next-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),o("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:o("path",{d:"M9 6L15 12L9 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});function me(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 ge(){return typeof window>"u"?!0:!window.matchMedia("(min-width: 768px)").matches}function Te(){return typeof window>"u"?!1:window.matchMedia("(min-width: 1025px)").matches}const le=s.forwardRef(({tabName:d="",shelfTitle:e="",shelfDescription:Z="",products:a,layoutMode:b,className:G,copy:u,showTags:w,stockDisplayMode:r,stockThresholdValue:C,onLearnMore:v,onShopNow:J,onAddToCart:K,onProductImageClick:f,classNames:x,secondaryButtonText:P,secondaryButtonFun:k,primaryButtonText:M,primaryButtonFun:S,boaFields:B,showOriginalPrice:D,renderOriginalPrice:L,tagTypeConfig:N,fill:A,outline:Q,memberPriceTextColor:E,renderDiscountBadge:R,userType:I,memberImages:F,customTagsIcon:X,customTagStyle:z,discountTagTextColor:H,onMemberSignUp:$,onPlusMemberAddCart:O,tileMaxRowsPc:Y,tileMaxRowsMob:ee,tileDesktopColumns:l,tileExpandText:V,tileCollapseText:U,showMemberPrice:j},te)=>{const W=s.useId().replace(/:/g,""),_=`swiper-button-next-custom-${W}`,oe=`swiper-button-prev-custom-${W}`,[h,p]=s.useState({isBeginning:!0,isEnd:!1}),i=s.useRef(null),c=s.useCallback(()=>{const t=i.current;if(!t?.slides||t.slides.length===0)return;t.slides.forEach(q=>{q.style.height="auto"});const g=Array.from(t.slides).map(q=>q.scrollHeight),ue=Math.max(...g);ue>0&&t.slides.forEach(q=>{q.style.height=`${ue}px`})},[]);s.useEffect(()=>{const t=()=>{requestAnimationFrame(c)};return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[c]);const[m,be]=s.useState(!1),[we,Ce]=s.useState(()=>me(l)),[ve,xe]=s.useState(()=>ge()),[Pe,ke]=s.useState(()=>Te());s.useEffect(()=>{const t=()=>{Ce(me(l)),xe(ge()),ke(Te())};return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[l]);const ie=b==="horizontal"&&!Pe?"flex":b,se=ve?ee:Y,ce=ie==="flex"&&!!se&&se>0,de=se?se*we:a.length,Me=ce&&a.length>de,Se=ce&&!m?a.slice(0,de):a;return a?.length===0?null:o("div",{ref:te,className:G,children:ie==="flex"?n(he,{children:[o("div",{className:T("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:Se.map((t,g)=>o(re,{product:t,tabName:d,position:g+1,layoutMode:ie,className:"shrink-0",showTags:w,stockDisplayMode:r,stockThresholdValue:C,onLearnMore:v,onShopNow:J,onAddToCart:K,onProductImageClick:f,classNames:x,secondaryButtonText:P,secondaryButtonFun:k,...B,primaryButtonText:M,primaryButtonFun:S,showOriginalPrice:D,renderOriginalPrice:L,renderDiscountBadge:R,tagTypeConfig:N,fill:A,outline:Q,memberPriceTextColor:E,copy:u,userType:I,memberImages:F,customTagsIcon:X,customTagStyle:z,discountTagTextColor:H,onMemberSignUp:$,onPlusMemberAddCart:O,showMemberPrice:j},t.shopify_id+"-"+t.sku||g))}),Me&&n("div",{className:"active-shelf-toggle laptop:hover:text-brand-0 text-info-primary mt-6 flex items-center justify-center",children:[o("button",{className:"laptop:text-base text-sm font-bold",onClick:()=>be(t=>!t),"data-headless-type-name":`${ae}#${ne}`,"data-headless-title-desc-button":`${y(e)}#${y(Z)}#${m?U??"Show less":V??"Show more"}`,"data-headless-nav-position":`${y(d)}#1`,children:m?U??"Show less":V??"Show more"}),o("svg",{xmlns:"http://www.w3.org/2000/svg",className:T("laptop:size-5 size-4",m&&"rotate-180"),width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:o("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:[o(Ie,{modules:[ze],spaceBetween:16,navigation:{nextEl:`.${_}`,prevEl:`.${oe}`},onSwiper:t=>{i.current=t,p({isBeginning:t.isBeginning,isEnd:t.isEnd}),setTimeout(c,100)},slidesPerView:3,breakpoints:{1025:{freeMode:!1,slidesPerView:3},1440:{freeMode:!1,slidesPerView:l==="3"?3:4}},onReachEnd:()=>{p(t=>({...t,isEnd:!0}))},onReachBeginning:()=>{p(t=>({...t,isBeginning:!0}))},onFromEdge:()=>{p({isBeginning:!1,isEnd:!1})},className:"!overflow-visible [&_.swiper-wrapper]:items-start",children:a.map((t,g)=>o(Fe,{className:"overflow-hidden",children:o(re,{product:t,tabName:d,position:g+1,layoutMode:ie,className:"w-full max-w-full",showTags:w,stockDisplayMode:r,stockThresholdValue:C,onLearnMore:v,onShopNow:J,onAddToCart:K,onProductImageClick:f,classNames:x,secondaryButtonText:P,secondaryButtonFun:k,...B,primaryButtonText:M,primaryButtonFun:S,showOriginalPrice:D,renderOriginalPrice:L,renderDiscountBadge:R,tagTypeConfig:N,fill:A,outline:Q,memberPriceTextColor:E,copy:u,userType:I,memberImages:F,customTagsIcon:X,customTagStyle:z,discountTagTextColor:H,onMemberSignUp:$,onPlusMemberAddCart:O,showMemberPrice:j})},t.shopify_id+"-"+t.sku||g))}),o("button",{className:`${oe} tablet:block group/prev-mask absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 ${h.isBeginning?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":u?.previousSlideLabel,children:o($e,{})}),o("button",{className:`${_} tablet:block group/next-mask absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 ${h.isEnd?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":u?.nextSlideLabel,children:o(Oe,{})})]})})});le.displayName="ProductsList";const ye=s.forwardRef(({className:d,data:e,onLearnMore:Z,onShopNow:a,onAddToCart:b,onProductImageClick:G,onMemberSignUp:u,onPlusMemberAddCart:w,classNames:r,renderOriginalPrice:C,renderDiscountBadge:v,...J},K)=>{const f=s.useRef(null);He(f,{componentType:ae,componentName:ne,componentTitle:e.title,componentDescription:e.description}),s.useImperativeHandle(K,()=>f.current);const{theme:x="light",layoutMode:P="flex",showTags:k=!0,stockDisplayMode:M,stockThresholdValue:S,showOriginalPrice:B,secondaryButtonText:D,primaryButtonText:L,secondaryButtonFun:N,primaryButtonFun:A,isShowTab:Q=!0,tagTypeConfig:E,fill:R,outline:I,memberPriceTextColor:F,copy:X,userType:z,memberImages:H,customTagsIcon:$,customTagStyle:O,discountTagTextColor:Y,showMemberPrice:ee,tileMaxRowsPc:l,tileMaxRowsMob:V,tileDesktopColumns:U,tileExpandText:j,tileCollapseText:te}=e,W={secondaryAdCampaign:e.secondaryAdCampaign,primaryAdCampaign:e.primaryAdCampaign,secondaryButtonTarget:e.secondaryButtonTarget,primaryButtonTarget:e.primaryButtonTarget,secondaryHasTrack:e.secondaryHasTrack,primaryHasTrack:e.primaryHasTrack,secondaryTrackEvents:e.secondaryTrackEvents,primaryTrackEvents:e.primaryTrackEvents},_=X||{},oe=e.productsTab&&e.productsTab.length>0,h=Q&&oe,p=h?void 0:e.resourceBlocks?.find(i=>i.blockType==="PromotionalBar"&&i.display==="visible");return n("div",{ref:f,className:T("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)"},...J,children:[e.title&&o(Le,{as:"h2",html:e.title,size:4,className:T("text-info-primary mb-4 leading-tight",r?.title)}),e.description&&o(De,{size:3,as:"p",html:e.description,className:T("text-info-primary mb-6",r?.description)}),n(Ne,{defaultValue:e.productsTab?.[0]?.id,className:"w-full",children:[h&&o(Ae,{className:"mb-6",children:e.productsTab?.map((i,c)=>o(Ee,{value:i.id,"data-headless-type-name":`${ae}#${ne}`,"data-headless-title-desc-button":`${y(e.title)}#${y(e.description)}#${y(i.tab)}`,"data-headless-nav-position":`${y(i.tab)}#${c+1}`,children:i.tab},"tab-"+i.id))}),h?e.productsTab?.map(i=>{const c=i.resourceBlocks?.find(m=>m.blockType==="PromotionalBar"&&m.display==="visible");return n(Re,{value:i.id,children:[c&&o(pe,{data:c,className:T("laptop:mb-4 mb-3",r?.promotionalBar)}),o(le,{tabName:i.tab,shelfTitle:e.title,shelfDescription:e.description,products:i.data,layoutMode:P,copy:_,showTags:k,stockDisplayMode:M,stockThresholdValue:S,onLearnMore:Z,onShopNow:a,onAddToCart:b,onProductImageClick:G,classNames:r,secondaryButtonText:D,secondaryButtonFun:N,boaFields:W,primaryButtonText:L,primaryButtonFun:A,showOriginalPrice:B,renderOriginalPrice:C,renderDiscountBadge:v,tagTypeConfig:E,fill:R,outline:I,memberPriceTextColor:F,userType:z,memberImages:H,customTagsIcon:$,customTagStyle:O,discountTagTextColor:Y,onMemberSignUp:u,onPlusMemberAddCart:w,showMemberPrice:ee,tileMaxRowsPc:l,tileMaxRowsMob:V,tileDesktopColumns:U,tileExpandText:j,tileCollapseText:te})]},"tab-content-"+i.id)}):n(he,{children:[p&&o(pe,{data:p,className:T("laptop:mb-4 mb-3",r?.promotionalBar)}),o(le,{shelfTitle:e.title,shelfDescription:e.description,products:e.productsCard,layoutMode:P,copy:_,showTags:k,stockDisplayMode:M,stockThresholdValue:S,onLearnMore:Z,onShopNow:a,onAddToCart:b,onProductImageClick:G,classNames:r,secondaryButtonText:D,secondaryButtonFun:N,boaFields:W,primaryButtonText:L,primaryButtonFun:A,showOriginalPrice:B,renderOriginalPrice:C,renderDiscountBadge:v,tagTypeConfig:E,fill:R,outline:I,memberPriceTextColor:F,userType:z,memberImages:H,customTagsIcon:$,customTagStyle:O,discountTagTextColor:Y,onMemberSignUp:u,onPlusMemberAddCart:w,showMemberPrice:ee,tileMaxRowsPc:l,tileMaxRowsMob:V,tileDesktopColumns:U,tileExpandText:j,tileCollapseText:te})]})]})]})});ye.displayName="ActiveShelf";const fe=ye;fe.ProductCard=re;const Ve=Be(fe);var et=Ve;export{et as default};
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import type { AdTrackEvent } from '../../shared/adTrack.js';
|
|
1
2
|
/**
|
|
2
3
|
* 按钮功能类型
|
|
3
4
|
*/
|
|
4
|
-
export type ButtonFunctionType = 'buyNow' | 'addCart' | 'learnMore';
|
|
5
|
+
export type ButtonFunctionType = 'buyNow' | 'addCart' | 'learnMore' | 'buyOnAmazon';
|
|
6
|
+
export interface ShelfBoaFields {
|
|
7
|
+
secondaryAdCampaign?: string;
|
|
8
|
+
primaryAdCampaign?: string;
|
|
9
|
+
secondaryButtonTarget?: '_self' | '_blank';
|
|
10
|
+
primaryButtonTarget?: '_self' | '_blank';
|
|
11
|
+
secondaryHasTrack?: boolean;
|
|
12
|
+
primaryHasTrack?: boolean;
|
|
13
|
+
secondaryTrackEvents?: AdTrackEvent[];
|
|
14
|
+
primaryTrackEvents?: AdTrackEvent[];
|
|
15
|
+
}
|
|
5
16
|
/**
|
|
6
17
|
* 自定义折扣标签图标样式
|
|
7
18
|
* style1/style2/style3 为内置预设样式(写死在组件中),custom 为自定义上传图标
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 C,Picture as I,Heading as g,Link as L}from"../../components/index.js";import{cva as w}from"class-variance-authority";import{Swiper as T,SwiperSlide as V}from"swiper/react";import{withLayout as z}from"../../shared/Styles.js";import{useExposure as B}from"../../hooks/useExposure.js";import{useTracking as E}from"../../hooks/useTracking.js";import{trackUrlRef as R}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as j,toPlainTrackingText as x}from"../../shared/track.js";const m="image",v="activity_schedule",D=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}=E(),t=`${l?"active":"inactive"}-${s}`;return i("div",{className:r(D({state:t,size:n}),d),"data-ui-component-id":"ActivityScheduleCard",children:f(L,{asChild:!e?.link,href:e?.link?R(e.link,o(m,v)):void 0,className:"size-full no-underline hover:text-current",...j({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(C,{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||"small",o=c.useRef(null);c.useImperativeHandle(n,()=>o.current),B(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=P=>{switch(P){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("div",{ref:o,className:r(e?.root),"data-ui-component-id":"ActivitySchedule",...d,children:i(T,{breakpoints:b,className:"w-full !overflow-visible",children:s?.scheduleList?.map((a,p)=>i(V,{children:i(y,{item:a,theme:u,size:l,className:e?.card,position:p+1})},"activityScheduleCardItem"+p))??null})})});k.displayName="ActivitySchedule";var K=z(k);export{K as default};
|