@anker-in/headless-ui 1.3.84 → 1.3.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/biz-components/AccordionCards/index.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +4 -3
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
- package/dist/cjs/biz-components/ActivityMechanism/index.d.ts +4 -7
- package/dist/cjs/biz-components/ActivityMechanism/index.js +1 -1
- package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/AnchorNavigation/index.js +1 -1
- package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/PriceAndActions.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/PriceAndActions.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +4 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductInfo.d.ts +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductInfo.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/tracking.d.ts +20 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/tracking.js +1 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/types.d.ts +2 -0
- package/dist/cjs/biz-components/Category/index.d.ts +4 -2
- package/dist/cjs/biz-components/Category/index.js +1 -1
- package/dist/cjs/biz-components/Chat/action.d.ts +25 -0
- package/dist/cjs/biz-components/Chat/action.js +1 -0
- package/dist/cjs/biz-components/Chat/button.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/button.js +1 -0
- package/dist/cjs/biz-components/Chat/chatContext.d.ts +101 -0
- package/dist/cjs/biz-components/Chat/chatContext.js +1 -0
- package/dist/cjs/biz-components/Chat/exports.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/exports.js +1 -0
- package/dist/cjs/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
- package/dist/cjs/biz-components/Chat/helpers/fetchResponse.js +1 -0
- package/dist/cjs/biz-components/Chat/helpers/fetcher.d.ts +2 -0
- package/dist/cjs/biz-components/Chat/helpers/fetcher.js +1 -0
- package/dist/cjs/biz-components/Chat/index.d.ts +71 -0
- package/dist/cjs/biz-components/Chat/index.js +1 -0
- package/dist/cjs/biz-components/Chat/markdown.d.ts +5 -0
- package/dist/cjs/biz-components/Chat/markdown.js +1 -0
- package/dist/cjs/biz-components/Chat/messages.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/messages.js +1 -0
- package/dist/cjs/biz-components/Chat/props.d.ts +43 -0
- package/dist/cjs/biz-components/Chat/props.js +1 -0
- package/dist/cjs/biz-components/Chat/response.d.ts +4 -0
- package/dist/cjs/biz-components/Chat/response.js +1 -0
- package/dist/cjs/biz-components/Chat/suggestions.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/suggestions.js +1 -0
- package/dist/cjs/biz-components/Chat/utils.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/utils.js +1 -0
- package/dist/cjs/biz-components/Evaluate/index.js +1 -1
- package/dist/cjs/biz-components/EventSchedule/index.js +1 -1
- package/dist/cjs/biz-components/Faq/Faq.d.ts +3 -1
- package/dist/cjs/biz-components/Faq/Faq.js +2 -2
- package/dist/cjs/biz-components/FeatureCards/FeatureCards.js +1 -1
- package/dist/cjs/biz-components/GiftShelf/index.js +1 -1
- package/dist/cjs/biz-components/GiftTierShelf/index.js +1 -1
- package/dist/cjs/biz-components/Graphic/index.js +1 -1
- package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
- package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerMulti/index.js +1 -1
- package/dist/cjs/biz-components/MemberEquity/index.js +2 -2
- package/dist/cjs/biz-components/MiniCart/index.js +1 -1
- package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
- package/dist/cjs/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/cjs/biz-components/PromotionalBar/index.d.ts +3 -2
- package/dist/cjs/biz-components/PromotionalBar/index.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/ProductsPanel.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/Root.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/context.d.ts +11 -1
- package/dist/cjs/biz-components/SceneShelf/context.js +1 -1
- package/dist/cjs/biz-components/SceneShelf/types.d.ts +5 -0
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/cjs/biz-components/Title/index.js +1 -1
- package/dist/cjs/shared/track.d.ts +13 -7
- package/dist/cjs/shared/track.js +1 -1
- package/dist/esm/biz-components/AccordionCards/index.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +4 -3
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
- package/dist/esm/biz-components/ActivityMechanism/index.d.ts +4 -7
- package/dist/esm/biz-components/ActivityMechanism/index.js +1 -1
- package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/AnchorNavigation/index.js +1 -1
- package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/PriceAndActions.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/PriceAndActions.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +4 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductInfo.d.ts +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductInfo.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/tracking.d.ts +20 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/tracking.js +1 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/types.d.ts +2 -0
- package/dist/esm/biz-components/Category/index.d.ts +4 -2
- package/dist/esm/biz-components/Category/index.js +1 -1
- package/dist/esm/biz-components/Chat/action.d.ts +25 -0
- package/dist/esm/biz-components/Chat/action.js +1 -0
- package/dist/esm/biz-components/Chat/button.d.ts +3 -0
- package/dist/esm/biz-components/Chat/button.js +1 -0
- package/dist/esm/biz-components/Chat/chatContext.d.ts +101 -0
- package/dist/esm/biz-components/Chat/chatContext.js +1 -0
- package/dist/esm/biz-components/Chat/exports.d.ts +3 -0
- package/dist/esm/biz-components/Chat/exports.js +1 -0
- package/dist/esm/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
- package/dist/esm/biz-components/Chat/helpers/fetchResponse.js +1 -0
- package/dist/esm/biz-components/Chat/helpers/fetcher.d.ts +2 -0
- package/dist/esm/biz-components/Chat/helpers/fetcher.js +1 -0
- package/dist/esm/biz-components/Chat/index.d.ts +71 -0
- package/dist/esm/biz-components/Chat/index.js +1 -0
- package/dist/esm/biz-components/Chat/markdown.d.ts +5 -0
- package/dist/esm/biz-components/Chat/markdown.js +1 -0
- package/dist/esm/biz-components/Chat/messages.d.ts +3 -0
- package/dist/esm/biz-components/Chat/messages.js +1 -0
- package/dist/esm/biz-components/Chat/props.d.ts +43 -0
- package/dist/esm/biz-components/Chat/props.js +1 -0
- package/dist/esm/biz-components/Chat/response.d.ts +4 -0
- package/dist/esm/biz-components/Chat/response.js +1 -0
- package/dist/esm/biz-components/Chat/suggestions.d.ts +3 -0
- package/dist/esm/biz-components/Chat/suggestions.js +1 -0
- package/dist/esm/biz-components/Chat/utils.d.ts +3 -0
- package/dist/esm/biz-components/Chat/utils.js +1 -0
- package/dist/esm/biz-components/Evaluate/index.js +1 -1
- package/dist/esm/biz-components/EventSchedule/index.js +1 -1
- package/dist/esm/biz-components/Faq/Faq.d.ts +3 -1
- package/dist/esm/biz-components/Faq/Faq.js +2 -2
- package/dist/esm/biz-components/FeatureCards/FeatureCards.js +1 -1
- package/dist/esm/biz-components/GiftShelf/index.js +1 -1
- package/dist/esm/biz-components/GiftTierShelf/index.js +1 -1
- package/dist/esm/biz-components/Graphic/index.js +1 -1
- package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
- package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/esm/biz-components/MediaPlayerMulti/index.js +1 -1
- package/dist/esm/biz-components/MemberEquity/index.js +2 -2
- package/dist/esm/biz-components/MiniCart/index.js +1 -1
- package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
- package/dist/esm/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/esm/biz-components/PromotionalBar/index.d.ts +3 -2
- package/dist/esm/biz-components/PromotionalBar/index.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/SceneShelf/ProductsPanel.js +1 -1
- package/dist/esm/biz-components/SceneShelf/Root.js +1 -1
- package/dist/esm/biz-components/SceneShelf/context.d.ts +11 -1
- package/dist/esm/biz-components/SceneShelf/context.js +1 -1
- package/dist/esm/biz-components/SceneShelf/types.d.ts +5 -0
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/esm/biz-components/Title/index.js +1 -1
- package/dist/esm/shared/track.d.ts +13 -7
- package/dist/esm/shared/track.js +1 -1
- package/package.json +50 -3
- package/src/biz-components/Chat/styles/chat.css +14 -0
- package/src/biz-components/Chat/styles/css/animations.css +35 -0
- package/src/biz-components/Chat/styles/css/button.css +56 -0
- package/src/biz-components/Chat/styles/css/colors.css +12 -0
- package/src/biz-components/Chat/styles/css/console.css +134 -0
- package/src/biz-components/Chat/styles/css/header.css +43 -0
- package/src/biz-components/Chat/styles/css/input.css +89 -0
- package/src/biz-components/Chat/styles/css/markdown.css +131 -0
- package/src/biz-components/Chat/styles/css/messages.css +85 -0
- package/src/biz-components/Chat/styles/css/panel.css +23 -0
- package/src/biz-components/Chat/styles/css/popup.css +44 -0
- package/src/biz-components/Chat/styles/css/response.css +25 -0
- package/src/biz-components/Chat/styles/css/sidebar.css +31 -0
- package/src/biz-components/Chat/styles/css/suggestions.css +36 -0
- package/src/biz-components/Chat/styles/css/window.css +60 -0
- package/src/biz-components/Chat/styles/image.png +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var W=Object.create;var S=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var se=(o,a)=>{for(var l in a)S(o,l,{get:a[l],enumerable:!0})},U=(o,a,l,u)=>{if(a&&typeof a=="object"||typeof a=="function")for(let p of ee(a))!ae.call(o,p)&&p!==l&&S(o,p,{get:()=>a[p],enumerable:!(u=X(a,p))||u.enumerable});return o};var $=(o,a,l)=>(l=o!=null?W(te(o)):{},U(a||!o||!o.__esModule?S(l,"default",{value:o,enumerable:!0}):l,o)),oe=o=>U(S({},"__esModule",{value:!0}),o);var ie={};se(ie,{default:()=>le});module.exports=oe(ie);var e=require("react/jsx-runtime"),r=$(require("react")),A=require("react-responsive"),Q=$(require("./MultiLayoutGraphicBlockCarousel.js")),Y=require("../../shared/Styles.js"),R=$(require("../../components/picture.js")),j=$(require("../../components/button.js")),E=require("../../components/heading.js"),q=require("../VideoModal/index.js"),V=require("../../components/grid.js"),O=$(require("../Title/index.js")),i=require("../../helpers/utils.js"),_=$(require("../SwiperBox/index.js")),H=require("../../shared/mimeType.js"),v=require("../../components/tabs.js"),Z=require("../../hooks/useExposure.js"),z=require("../../shared/trackUrlRef.js"),F=require("../AiuiProvider/index.js"),J=require("../../shared/track.js");const g="image",y="p1_banner",C=({data:o,configuration:a,jIndex:l,spanType:u,title:p,onSecondaryButtonClick:k,onPrimaryButtonClick:L})=>{const[c,N]=(0,r.useState)(!1),b=(0,A.useMediaQuery)({query:"(max-width: 768px)"}),m=(0,r.useRef)(null),I=()=>{if(u)switch(u){case"full":return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case"half":return"tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case"one-third":return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}else switch(a?.num){case 1:return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case 2:return"tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case 3:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}};(0,Z.useExposure)(m,{componentType:g,componentName:y,position:l,componentTitle:o.title,componentDescription:o.description,navigation:a?.activeTab}),(0,r.useEffect)(()=>{N(b)},[b]);const{theme:G="light",title:f,description:h,imageUrl:d,primaryButton:B,secondaryButton:n,imageMobileUrl:x,blockLink:T,video:w,youtubeId:M,isYouTube:P,id:t}=o,s="lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px]";return(0,e.jsxs)("div",{className:(0,i.cn)("item-wrapper cursor-pointer","text-info-primary group relative box-border w-full overflow-hidden",I(),{"rounded-box":!0,"aiui-dark":G==="dark","h-[400px]":c},"text-info-primary"),ref:m,children:[(T||n.link)&&(0,e.jsx)("a",{className:"absolute inset-0 z-10",href:(0,z.trackUrlRef)((0,i.getLocalizedPath)(T||n.link||"",a?.locale||"us"),`${g}_${y}`),"data-headless-type-name":`${g}#${y}`,"data-headless-title-desc-button":`${f}#${h}`,"data-headless-nav-position":`${a?.activeTab}#${l}`,"aria-hidden":"true",tabIndex:-1}),(0,e.jsxs)("div",{className:"absolute inset-0",children:[(0,H.isVideo)(d?.mimeType)?(0,e.jsx)("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:block hidden size-full overflow-hidden object-cover",children:(0,e.jsx)("source",{src:d?.url,type:"video/mp4"})}):(0,e.jsx)(R.default,{source:d?.url,alt:d?.alt||"",className:"tablet:block hidden h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 group-hover:scale-105 object-cover",style:{aspectRatio:`${d?.width}/${d?.height}`}}),(0,H.isVideo)(x?.mimeType)?(0,e.jsx)("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:hidden block size-full overflow-hidden object-cover",children:(0,e.jsx)("source",{src:x?.url,type:"video/mp4"})}):(0,e.jsx)(R.default,{source:x?.url||d?.url,alt:x?.alt||d?.alt||"",className:"tablet:hidden block h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 object-cover"})]}),(0,e.jsxs)("div",{className:(0,i.cn)("pointer-events-none absolute inset-0 z-20 flex flex-col",u==="full"?"laptop:justify-center justify-end":"justify-end"),children:[(0,e.jsxs)("div",{className:"laptop:p-6 desktop:p-[32px] laptop:gap-4 desktop:gap-6 pointer-events-auto flex w-fit flex-col gap-6 p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(E.Heading,{size:3,as:"h3",className:"item-title",html:f}),(0,e.jsx)(E.Heading,{as:"h4",className:"item-description desktop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px]",html:h})]}),(0,e.jsxs)("div",{className:"lg-desktop:gap-3 flex gap-2",children:[n&&n.text&&(0,e.jsxs)(j.default,{"aria-label":f??h,className:(0,i.cn)(s,"link-left"),variant:"secondary",as:"a","data-track":`${t}-link-left`,onClick:()=>{k?.(o)},href:(0,z.trackUrlRef)((0,i.getLocalizedPath)(n.link||"",a?.locale||"us"),`${g}_${y}`),"data-headless-type-name":`${g}#${y}`,"data-headless-title-desc-button":`${f}#${h}#${n.text}`,"data-headless-nav-position":`${a?.activeTab}#${l}`,children:[n.text,(0,e.jsx)("span",{className:"sr-only",children:f??h})]}),B&&B.text&&(0,e.jsx)(j.default,{"aria-label":f??h,className:(0,i.cn)(s,"link-right"),variant:"primary","data-track":`${t}-link-right`,as:"a",onClick:()=>{L?.(o)},href:(0,z.trackUrlRef)((0,i.getLocalizedPath)(B.link||"",a?.locale||"us"),`${g}_${y}`),"data-headless-type-name":`${g}#${y}`,"data-headless-title-desc-button":`${f}#${h}#${B.text}`,"data-headless-nav-position":`${a?.activeTab}#${l}`,children:B.text})]})]}),(w?.url||M)&&(0,e.jsx)("div",{className:"laptop:bottom-6 laptop:right-6 pointer-events-auto absolute bottom-4 right-4",children:(0,e.jsx)("button",{onClick:()=>{a?.onVideoPlayBtnClick?.(P&&M?M:w?.url||M,P)},className:"laptop:size-12 flex size-8 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75",children:(0,e.jsx)("svg",{width:"12",height:"14",viewBox:"0 0 12 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,e.jsx)("path",{d:"M12 7L0 14L0 0L12 7Z",fill:"white"})})})})]})]})},D=r.default.forwardRef((o,a)=>{const{data:l,className:u,onSecondaryButtonClick:p,onPrimaryButtonClick:k,...L}=o,{sectionTitle:c,groupByTab:N=!1,items:b=[],carousel:m}=l,[I,G]=(0,r.useState)(!1),[f,h]=(0,r.useState)(""),[d,B]=(0,r.useState)(""),{locale:n="us"}=(0,F.useAiuiContext)(),x=t=>{switch(t){case"full":return 12;case"half":return 6;case"one-third":return 4}},T=b.map(t=>t.tabName).filter(Boolean).filter((t,s,K)=>K.indexOf(t)===s),w=(t,s)=>{G(!0),s?B?.(t||""):h?.(t||"")},M=(t,s)=>{switch(t){case 1:return 1;case 2:return 2;default:return s?2.3:3}},P=T.map(t=>({tabName:t,items:b.filter(s=>s.tabName===t)})).reduce((t,s)=>(t[s.tabName]=s.items,t),{});return l.mode==="carousel"&&b.length>0?(0,e.jsx)(Q.default,{data:l,onPrimaryButtonClick:k,onSecondaryButtonClick:p,className:u,ref:a,...L}):(0,e.jsxs)("section",{"data-ui-component-id":"MultiLayoutGraphicBlock",ref:a,...L,className:(0,i.cn)("multiLayoutGraphicBlock","text-info-primary",u),children:[c&&(0,e.jsx)(O.default,{data:{title:c},className:"section-title"}),N?(0,e.jsxs)(v.Tabs,{align:"left",defaultValue:(0,i.spaceToHyphen)(T[0]),children:[(0,e.jsx)(v.TabsList,{children:T.map((t,s)=>(0,e.jsx)(v.TabsTrigger,{value:(0,i.spaceToHyphen)(t),onClick:()=>{(0,J.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:g,component_name:y,component_title:c,component_position:1,navigation:t,button_name:t}})},children:t},s))}),T.map((t,s)=>(0,e.jsx)(v.TabsContent,{value:(0,i.spaceToHyphen)(t),className:"desktop:mt-[36px] mt-[24px] w-full",children:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(_.default,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock1",data:{list:P?.[t]||[],configuration:{isTab:N,activeTab:t,title:c,num:P?.[t]?.length||0,locale:n,onVideoPlayBtnClick:w,onSecondaryButtonClick:p,onPrimaryButtonClick:k}},Slide:C,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:M(P?.[t]?.length||0,!0)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:M(P?.[t]?.length||0)}}}),m&&m?.items.length>0?(0,e.jsx)(_.default,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock2",data:{list:m?.items||[],configuration:{isTab:N,locale:n,onVideoPlayBtnClick:w,title:c,onSecondaryButtonClick:p,onPrimaryButtonClick:k}},Slide:C,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]})},s))]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(V.Grid,{className:"w-full",children:[b.map((t,s)=>(0,e.jsx)(V.GridItem,{span:x(t.width??"full"),className:"laptop:block hidden",children:(0,e.jsx)(C,{data:t,configuration:{locale:n,onVideoPlayBtnClick:w,title:c},jIndex:s,spanType:t.width,onSecondaryButtonClick:p,onPrimaryButtonClick:k})},`${t?.title||""}${s}`)),b.map((t,s)=>(0,e.jsx)(V.GridItem,{span:x("full"),className:"laptop:hidden block",children:(0,e.jsx)(C,{data:t,configuration:{locale:n,onVideoPlayBtnClick:w,title:c},jIndex:s,spanType:"full",onSecondaryButtonClick:p,onPrimaryButtonClick:k})},`${t?.title||""}${s}`))]}),m&&m?.items.length>0?(0,e.jsx)(_.default,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock3",data:{list:m?.items||[],configuration:{locale:n,onVideoPlayBtnClick:w,title:c,onSecondaryButtonClick:p,onPrimaryButtonClick:k}},Slide:C,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]}),I&&(0,e.jsx)(q.VideoModal,{visible:I,youTubeId:d,videoUrl:f,onCloseModal:()=>G(!1)})]})});D.displayName="MultiLayoutGraphicBlock";var le=(0,Y.withLayout)(D,{container:{desktopSpan:12,mobileSpan:12}});
|
|
1
|
+
"use strict";var X=Object.create;var S=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var oe=(o,a)=>{for(var l in a)S(o,l,{get:a[l],enumerable:!0})},D=(o,a,l,m)=>{if(a&&typeof a=="object"||typeof a=="function")for(let p of te(a))!se.call(o,p)&&p!==l&&S(o,p,{get:()=>a[p],enumerable:!(m=ee(a,p))||m.enumerable});return o};var M=(o,a,l)=>(l=o!=null?X(ae(o)):{},D(a||!o||!o.__esModule?S(l,"default",{value:o,enumerable:!0}):l,o)),le=o=>D(S({},"__esModule",{value:!0}),o);var pe={};oe(pe,{default:()=>ie});module.exports=le(pe);var e=require("react/jsx-runtime"),c=M(require("react")),Q=require("react-responsive"),Y=M(require("./MultiLayoutGraphicBlockCarousel.js")),q=require("../../shared/Styles.js"),j=M(require("../../components/picture.js")),E=M(require("../../components/button.js")),H=require("../../components/heading.js"),O=require("../VideoModal/index.js"),V=require("../../components/grid.js"),Z=M(require("../Title/index.js")),i=require("../../helpers/utils.js"),_=M(require("../SwiperBox/index.js")),U=require("../../shared/mimeType.js"),x=require("../../components/tabs.js"),F=require("../../hooks/useExposure.js"),z=require("../../shared/trackUrlRef.js"),J=require("../AiuiProvider/index.js"),K=require("../../shared/track.js"),W=require("../../hooks/useTracking.js");const v="image",B="p1_banner",$=({data:o,configuration:a,jIndex:l,spanType:m,title:p,onSecondaryButtonClick:g,onPrimaryButtonClick:L})=>{const{buildRef:n}=(0,W.useTracking)(),[P,T]=(0,c.useState)(!1),f=(0,Q.useMediaQuery)({query:"(max-width: 768px)"}),N=(0,c.useRef)(null),I=()=>{if(m)switch(m){case"full":return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case"half":return"tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case"one-third":return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}else switch(a?.num){case 1:return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case 2:return"tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case 3:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}};(0,F.useExposure)(N,{componentType:v,componentName:B,position:l,componentTitle:o.title,componentDescription:o.description,navigation:a?.activeTab}),(0,c.useEffect)(()=>{T(f)},[f]);const{theme:R="light",title:h,description:k,imageUrl:d,primaryButton:r,secondaryButton:u,imageMobileUrl:b,blockLink:y,video:C,youtubeId:w,isYouTube:t,id:s}=o,G="lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px]";return(0,e.jsxs)("div",{className:(0,i.cn)("item-wrapper cursor-pointer","text-info-primary group relative box-border w-full overflow-hidden",I(),{"rounded-box":!0,"aiui-dark":R==="dark","h-[400px]":P},"text-info-primary"),ref:N,children:[(y||u.link)&&(0,e.jsx)("a",{className:"absolute inset-0 z-10",href:(0,z.trackUrlRef)((0,i.getLocalizedPath)(y||u.link||"",a?.locale||"us"),n(v,B)),"data-headless-type-name":`${v}#${B}`,"data-headless-title-desc-button":`${h}#${k}`,"data-headless-nav-position":`${a?.activeTab}#${l}`,"aria-hidden":"true",tabIndex:-1}),(0,e.jsxs)("div",{className:"absolute inset-0",children:[(0,U.isVideo)(d?.mimeType)?(0,e.jsx)("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:block hidden size-full overflow-hidden object-cover",children:(0,e.jsx)("source",{src:d?.url,type:"video/mp4"})}):(0,e.jsx)(j.default,{source:d?.url,alt:d?.alt||"",className:"tablet:block hidden h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 group-hover:scale-105 object-cover",style:{aspectRatio:`${d?.width}/${d?.height}`}}),(0,U.isVideo)(b?.mimeType)?(0,e.jsx)("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:hidden block size-full overflow-hidden object-cover",children:(0,e.jsx)("source",{src:b?.url,type:"video/mp4"})}):(0,e.jsx)(j.default,{source:b?.url||d?.url,alt:b?.alt||d?.alt||"",className:"tablet:hidden block h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 object-cover"})]}),(0,e.jsxs)("div",{className:(0,i.cn)("pointer-events-none absolute inset-0 z-20 flex flex-col",m==="full"?"laptop:justify-center justify-end":"justify-end"),children:[(0,e.jsxs)("div",{className:"laptop:p-6 desktop:p-[32px] laptop:gap-4 desktop:gap-6 pointer-events-auto flex w-fit flex-col gap-6 p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(H.Heading,{size:3,as:"h3",className:"item-title",html:h}),(0,e.jsx)(H.Heading,{as:"h4",className:"item-description desktop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px]",html:k})]}),(0,e.jsxs)("div",{className:"lg-desktop:gap-3 flex gap-2",children:[u&&u.text&&(0,e.jsxs)(E.default,{"aria-label":h??k,className:(0,i.cn)(G,"link-left"),variant:"secondary",as:"a","data-track":`${s}-link-left`,onClick:()=>{g?.(o)},href:(0,z.trackUrlRef)((0,i.getLocalizedPath)(u.link||"",a?.locale||"us"),n(v,B)),"data-headless-type-name":`${v}#${B}`,"data-headless-title-desc-button":`${h}#${k}#${u.text}`,"data-headless-nav-position":`${a?.activeTab}#${l}`,children:[u.text,(0,e.jsx)("span",{className:"sr-only",children:h??k})]}),r&&r.text&&(0,e.jsx)(E.default,{"aria-label":h??k,className:(0,i.cn)(G,"link-right"),variant:"primary","data-track":`${s}-link-right`,as:"a",onClick:()=>{L?.(o)},href:(0,z.trackUrlRef)((0,i.getLocalizedPath)(r.link||"",a?.locale||"us"),n(v,B)),"data-headless-type-name":`${v}#${B}`,"data-headless-title-desc-button":`${h}#${k}#${r.text}`,"data-headless-nav-position":`${a?.activeTab}#${l}`,children:r.text})]})]}),(C?.url||w)&&(0,e.jsx)("div",{className:"laptop:bottom-6 laptop:right-6 pointer-events-auto absolute bottom-4 right-4",children:(0,e.jsx)("button",{onClick:()=>{a?.onVideoPlayBtnClick?.(t&&w?w:C?.url||w,t)},className:"laptop:size-12 flex size-8 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75",children:(0,e.jsx)("svg",{width:"12",height:"14",viewBox:"0 0 12 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,e.jsx)("path",{d:"M12 7L0 14L0 0L12 7Z",fill:"white"})})})})]})]})},A=c.default.forwardRef((o,a)=>{const{data:l,className:m,onSecondaryButtonClick:p,onPrimaryButtonClick:g,...L}=o,{sectionTitle:n,groupByTab:P=!1,items:T=[],carousel:f}=l,[N,I]=(0,c.useState)(!1),[R,h]=(0,c.useState)(""),[k,d]=(0,c.useState)(""),{locale:r="us"}=(0,J.useAiuiContext)(),u=t=>{switch(t){case"full":return 12;case"half":return 6;case"one-third":return 4}},b=T.map(t=>t.tabName).filter(Boolean).filter((t,s,G)=>G.indexOf(t)===s),y=(t,s)=>{I(!0),s?d?.(t||""):h?.(t||"")},C=(t,s)=>{switch(t){case 1:return 1;case 2:return 2;default:return s?2.3:3}},w=b.map(t=>({tabName:t,items:T.filter(s=>s.tabName===t)})).reduce((t,s)=>(t[s.tabName]=s.items,t),{});return l.mode==="carousel"&&T.length>0?(0,e.jsx)(Y.default,{data:l,onPrimaryButtonClick:g,onSecondaryButtonClick:p,className:m,ref:a,...L}):(0,e.jsxs)("section",{"data-ui-component-id":"MultiLayoutGraphicBlock",ref:a,...L,className:(0,i.cn)("multiLayoutGraphicBlock","text-info-primary",m),children:[n&&(0,e.jsx)(Z.default,{data:{title:n},className:"section-title"}),P?(0,e.jsxs)(x.Tabs,{align:"left",defaultValue:(0,i.spaceToHyphen)(b[0]),children:[(0,e.jsx)(x.TabsList,{children:b.map((t,s)=>(0,e.jsx)(x.TabsTrigger,{value:(0,i.spaceToHyphen)(t),onClick:()=>{(0,K.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:v,component_name:B,component_title:n,component_position:1,navigation:t,button_name:t}})},children:t},s))}),b.map((t,s)=>(0,e.jsx)(x.TabsContent,{value:(0,i.spaceToHyphen)(t),className:"desktop:mt-[36px] mt-[24px] w-full",children:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(_.default,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock1",data:{list:w?.[t]||[],configuration:{isTab:P,activeTab:t,title:n,num:w?.[t]?.length||0,locale:r,onVideoPlayBtnClick:y,onSecondaryButtonClick:p,onPrimaryButtonClick:g}},Slide:$,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:C(w?.[t]?.length||0,!0)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:C(w?.[t]?.length||0)}}}),f&&f?.items.length>0?(0,e.jsx)(_.default,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock2",data:{list:f?.items||[],configuration:{isTab:P,locale:r,onVideoPlayBtnClick:y,title:n,onSecondaryButtonClick:p,onPrimaryButtonClick:g}},Slide:$,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]})},s))]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(V.Grid,{className:"w-full",children:[T.map((t,s)=>(0,e.jsx)(V.GridItem,{span:u(t.width??"full"),className:"laptop:block hidden",children:(0,e.jsx)($,{data:t,configuration:{locale:r,onVideoPlayBtnClick:y,title:n},jIndex:s,spanType:t.width,onSecondaryButtonClick:p,onPrimaryButtonClick:g})},`${t?.title||""}${s}`)),T.map((t,s)=>(0,e.jsx)(V.GridItem,{span:u("full"),className:"laptop:hidden block",children:(0,e.jsx)($,{data:t,configuration:{locale:r,onVideoPlayBtnClick:y,title:n},jIndex:s,spanType:"full",onSecondaryButtonClick:p,onPrimaryButtonClick:g})},`${t?.title||""}${s}`))]}),f&&f?.items.length>0?(0,e.jsx)(_.default,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock3",data:{list:f?.items||[],configuration:{locale:r,onVideoPlayBtnClick:y,title:n,onSecondaryButtonClick:p,onPrimaryButtonClick:g}},Slide:$,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]}),N&&(0,e.jsx)(O.VideoModal,{visible:N,youTubeId:k,videoUrl:R,onCloseModal:()=>I(!1)})]})});A.displayName="MultiLayoutGraphicBlock";var ie=(0,q.withLayout)(A,{container:{desktopSpan:12,mobileSpan:12}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var w=Object.create;var l=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var E=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},f=(t,e,r,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of R(e))!D.call(t,a)&&a!==r&&l(t,a,{get:()=>e[a],enumerable:!(p=y(e,a))||p.enumerable});return t};var z=(t,e,r)=>(r=t!=null?w(L(t)):{},f(e||!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),B=t=>f(l({},"__esModule",{value:!0}),t);var j={};E(j,{default:()=>M});module.exports=B(j);var o=require("react/jsx-runtime"),i=z(require("react")),s=require("../../components/index.js"),h=require("../../helpers/utils.js"),x=require("../../shared/Styles.js"),_=require("../../hooks/useExposure.js"),k=require("../../hooks/useTracking.js"),N=require("../../shared/trackUrlRef.js"),g=require("../../shared/track.js");const u="image",d="product_hero",b=i.default.forwardRef(({data:t,className:e},r)=>{const{title:p,subtitle:a,ctaText:c,poster:v,mobPoster:H,ctaLink:m,theme:P="light"}=t,n=(0,i.useRef)(null),{buildRef:T}=(0,k.useTracking)();return(0,_.useExposure)(n,{componentType:u,componentName:d,componentTitle:p,componentDescription:a}),(0,i.useImperativeHandle)(r,()=>n.current),(0,o.jsxs)("section",{ref:n,"data-ui-component-id":"ProductHero",className:(0,h.cn)("product-hero text-info-primary tablet:flex-row tablet:gap-[16px] lg-desktop:gap-[64px] flex w-full flex-col items-center justify-between gap-[32px]",{"aiui-dark":P==="dark"},e),children:[(0,o.jsxs)("div",{className:"product-hero__content tablet:basis-[42%] laptop:basis-[36%] flex w-full flex-col items-start gap-[24px]",children:[(0,o.jsxs)("div",{className:"product-hero__text",children:[(0,o.jsx)(s.Heading,{as:"h3",size:4,html:p,className:"product-hero__title"}),(0,o.jsx)(s.Heading,{as:"h4",size:2,html:a,className:"product-hero__subtitle product-hero__subtitle--desktop laptop:mt-[12px] laptop:block desktop:mt-[16px] mt-[4px] hidden"}),(0,o.jsx)(s.Text,{as:"p",size:2,html:a,className:"product-hero__subtitle product-hero__subtitle--mobile laptop:mt-[12px] laptop:hidden desktop:mt-[16px] mt-[4px] block"})]}),c&&(0,o.jsx)("a",{href:m?(0,N.trackUrlRef)(m,T(u,d)):void 0,className:"product-hero__cta-link",...(0,g.buildClickTrackingProps)({interactive:!!m,componentType:u,componentName:d,title:p,description:a,buttonName:c}),children:(0,o.jsx)(s.Button,{className:"product-hero__cta-button w-fit",children:c})})]}),(0,o.jsx)(s.Picture,{className:"product-hero__image tablet:aspect-[824/640] tablet:basis-[58%] laptop:basis-[64%] rounded-box aspect-[358/360] shrink",source:`${v?.url}, ${H?.url} 768`,imgClassName:"h-full object-cover"})]})});b.displayName="ProductHero";var M=(0,x.withLayout)(b);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var W=Object.create;var R=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Z=(n,l)=>{for(var p in l)R(n,p,{get:l[p],enumerable:!0})},L=(n,l,p,g)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of K(l))!X.call(n,d)&&d!==p&&R(n,d,{get:()=>l[d],enumerable:!(g=J(l,d))||g.enumerable});return n};var ee=(n,l,p)=>(p=n!=null?W(Q(n)):{},L(l||!n||!n.__esModule?R(p,"default",{value:n,enumerable:!0}):p,n)),te=n=>L(R({},"__esModule",{value:!0}),n);var re={};Z(re,{default:()=>ne});module.exports=te(re);var t=require("react/jsx-runtime"),s=require("react"),C=require("../../helpers/utils.js"),z=require("../../shared/Styles.js"),f=require("../../components/index.js"),j=require("../../hooks/useExposure.js"),Y=require("../../hooks/useTracking.js"),F=require("../../shared/trackUrlRef.js"),y=require("../../shared/track.js"),M=ee(require("@radix-ui/react-popover"));const S="navigation",$="product_nav",A=n=>n.anchorId??n.id??"",oe=n=>(0,t.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:(0,t.jsx)("path",{d:"M5 7.5L10 12.5L15 7.5",stroke:"currentColor",strokeWidth:"1.66667",strokeLinecap:"round",strokeLinejoin:"round"})}),B=(0,s.forwardRef)(({className:n="",data:l,id:p,onAnchorClick:g,scrollOffsetExtra:d=0},G)=>{const{tabLinks:v=[],anchorList:a=[],textLink:c,buyBtn:u,theme:O="light"}=l||{},{buildRef:V}=(0,Y.useTracking)(),x=(e,o,r=1)=>({href:(0,F.trackUrlRef)(e,V(S,$)),"data-headless-type-name":`${S}#${$}`,"data-headless-title-desc-button":`##${(0,y.toPlainTrackingText)(o)}`,"data-headless-nav-position":`${(0,y.toPlainTrackingText)(o)}#${r}`}),[_,T]=(0,s.useState)(""),w=(0,s.useRef)(null),N=(0,s.useRef)(!1),k=(0,s.useRef)(""),b=(0,s.useRef)(null),D=(0,s.useRef)(new Map);(0,s.useImperativeHandle)(G,()=>w.current),(0,j.useExposure)(w,{componentType:S,componentName:$,componentTitle:[...v.map(e=>e.label),...a.map(e=>e.label)].join(" | "),componentDescription:u?.text??c?.text??""});const E=(0,s.useCallback)(()=>{if(a.length===0)return;const e=window.scrollY;window.scrollTo({top:0,behavior:"instant"}),requestAnimationFrame(()=>{const o=new Map;a.forEach(r=>{const i=A(r),m=document.getElementById(i);if(m){const P=m.getBoundingClientRect();o.set(i,P.top+window.scrollY)}}),D.current=o,window.scrollTo({top:e,behavior:"instant"})})},[a]);(0,s.useEffect)(()=>{if(a.length===0)return;const e=setTimeout(E,100);return()=>clearTimeout(e)},[a,E]),(0,s.useEffect)(()=>{if(a.length===0)return;let e=null;const o=new ResizeObserver(()=>{e&&clearTimeout(e),e=setTimeout(E,150)});return o.observe(document.body),()=>{o.disconnect(),e&&clearTimeout(e)}},[a,E]),(0,s.useEffect)(()=>{if(a.length===0)return;const e=()=>{if(N.current){b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{N.current=!1,k.current&&(T(k.current),k.current="")},100);return}const r=w.current?.offsetHeight||0,i=window.scrollY+r+d+10;let m="";const P=D.current;for(let h=a.length-1;h>=0;h--){const U=a[h],H=A(U),I=P.get(H);if(I!==void 0&&i>=I){m=H;break}}if(!m&&a.length>0){const h=P.get(A(a[0]));h!==void 0&&i<h&&(m="")}T(m)},o=setTimeout(()=>{e()},200);return window.addEventListener("scroll",e,{passive:!0}),()=>{clearTimeout(o),window.removeEventListener("scroll",e),b.current&&clearTimeout(b.current)}},[a,d]),(0,s.useEffect)(()=>{const e=document.querySelectorAll(".header"),o=[];return e.forEach(r=>{const i=r;o.push({element:i,originalPosition:i.style.position||getComputedStyle(i).position}),i.style.position="relative"}),()=>{o.forEach(({element:r,originalPosition:i})=>{r.style.position=i==="static"?"":i})}},[]);const q=(e,o)=>{e.preventDefault();const r=D.current.get(o);if(r===void 0){console.warn(`Cached position for "${o}" not found`);return}T(o),k.current=o,N.current=!0;const i=w.current?.offsetHeight||0,m=r-i-d;window.scrollTo({top:m,behavior:"smooth"}),window.history.pushState(null,"",`#${o}`)};return(0,t.jsxs)("div",{id:p,ref:w,className:(0,C.cn)("product-nav text-info-primary bg-container-primary tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] !sticky top-0 !z-[51] flex w-full justify-between overflow-hidden px-4 py-0",{"aiui-dark":O==="dark"},n),children:[(0,t.jsxs)("div",{className:"product-nav-main desktop:flex-row desktop:gap-[48px] flex w-full flex-col justify-start",children:[(0,t.jsxs)("div",{className:"product-nav-header laptop:w-full desktop:w-fit desktop:gap-[24px] desktop:py-0 flex w-full flex-row items-center justify-between gap-[16px] pt-[14px]",children:[(0,t.jsxs)("div",{className:"product-nav-tabs flex flex-row items-center gap-[8px]",children:[v.map((e,o)=>(0,t.jsxs)("div",{className:"product-nav-tab-item flex items-center gap-[8px]",children:[(0,t.jsx)("a",{...x(e.link,e.label,v.indexOf(e)+1),className:(0,C.cn)("product-nav-tab-link hover:text-brand-color text-nowrap text-[14px] font-bold tracking-[-0.04em]",{"text-[#6D6D6F]":o!==0,"hidden desktop:block":o===1}),children:(0,t.jsx)("span",{children:e.label})}),o!==v.length-1&&(0,t.jsx)("div",{className:"product-nav-tab-divider desktop:inline-block hidden h-[14px] w-px bg-[#E4E5E6]"})]},e.link||o)),v.length>1&&(0,t.jsxs)(M.Root,{children:[(0,t.jsx)(M.Trigger,{asChild:!0,children:(0,t.jsx)("button",{className:"product-nav-dropdown-trigger desktop:hidden -ml-1 inline-block","aria-label":"More products",children:(0,t.jsx)(oe,{className:"text-[#1D1D1F]"})})}),(0,t.jsx)(M.Content,{className:"product-nav-dropdown-content rounded-[6px] border border-[#E4E5E6] bg-white p-[6px] px-[8px] py-[4px]",style:{boxShadow:"0px 4px 8px 0px rgba(0,0,0,0.12)"},side:"bottom",align:"end",alignOffset:10,sideOffset:10,children:v.slice(1).map(e=>(0,t.jsx)("a",{...x(e.link,e.label,v.indexOf(e)+1),className:"product-nav-dropdown-link hover:text-brand-color text-nowrap",children:(0,t.jsx)("span",{children:e.label})},e.link))})]})]}),(0,t.jsxs)("div",{className:"product-nav-mobile-actions desktop:hidden desktop:gap-[24px] flex items-center gap-[16px]",children:[c?.link&&(0,t.jsx)("a",{...x(c.link,c.text),target:c.target||"_self",className:"product-nav-text-link hover:text-brand-color cursor-pointer",children:(0,t.jsx)(f.Text,{size:2,className:"text-nowrap",children:c.text})}),u?.link&&(0,t.jsx)(f.Button,{as:"a",...x(u.link,u.text),size:"sm",className:"product-nav-buy-button text-nowrap",children:u.text})]})]}),(0,t.jsx)("div",{className:"product-nav-anchors laptop:w-fit desktop:gap-[24px] desktop:py-[8px] flex w-full items-center gap-[16px] overflow-x-scroll py-[12px] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:a.map((e,o)=>{const r=A(e);return(0,t.jsxs)("a",{href:`#${r}`,className:"product-nav-anchor-link","data-headless-type-name":`${S}#${$}`,"data-headless-title-desc-button":`##${(0,y.toPlainTrackingText)(e.label)}`,"data-headless-nav-position":`${(0,y.toPlainTrackingText)(e.label)}#${o+1}`,onClick:i=>{g?(i.preventDefault(),T(r),k.current=r,N.current=!0,g(e,o)):q(i,r)},children:[(0,t.jsx)(f.Text,{size:2,className:"product-nav-anchor-text text-nowrap",children:e.label}),(0,t.jsx)("div",{className:(0,C.cn)("product-nav-anchor-indicator laptop:top-[12px] desktop:top-[10px] relative top-[12px] h-[4px] w-full bg-transparent",{"!bg-brand-0":_===r})})]},r)})})]}),(0,t.jsxs)("div",{className:"product-nav-desktop-actions desktop:flex desktop:gap-[24px] desktop:py-[8px] hidden items-center gap-[16px]",children:[c?.link&&(0,t.jsx)(f.Link,{...x(c.link,c.text),target:c.target||"_self",className:"product-nav-text-link no-underline",children:(0,t.jsx)(f.Text,{size:2,className:"text-nowrap",children:c.text})}),u?.link&&(0,t.jsx)(f.Button,{as:"a",...x(u.link,u.text),size:"sm",className:"product-nav-buy-button text-nowrap",children:u.text})]})]})});B.displayName="ProductNav";var ne=(0,z.withLayout)(B);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Media, Theme } from '../../types/props.js';
|
|
3
|
+
import type { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical';
|
|
3
4
|
export interface PromotionalBarSemanticName {
|
|
4
5
|
root: 'root';
|
|
5
6
|
content: 'content';
|
|
@@ -27,8 +28,8 @@ export interface ResponsiveBackgroundImage {
|
|
|
27
28
|
*/
|
|
28
29
|
export interface PromotionalBarData {
|
|
29
30
|
theme: Theme;
|
|
30
|
-
/**
|
|
31
|
-
contentTitle?: string;
|
|
31
|
+
/** 组件内容标题(HTML 字符串或 CMS 的 Lexical 富文本) */
|
|
32
|
+
contentTitle?: string | SerializedEditorState;
|
|
32
33
|
/** 组件内容描述 */
|
|
33
34
|
contentDesc?: string;
|
|
34
35
|
/** 按钮文本 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var S=Object.create;var x=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var I=(e,t)=>{for(var n in t)x(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of H(t))!E.call(e,l)&&l!==n&&x(e,l,{get:()=>t[l],enumerable:!(c=F(t,l))||c.enumerable});return e};var U=(e,t,n)=>(n=e!=null?S(z(e)):{},v(t||!e||!e.__esModule?x(n,"default",{value:e,enumerable:!0}):n,e)),w=e=>v(x({},"__esModule",{value:!0}),e);var $={};I($,{default:()=>C});module.exports=w($);var r=require("react/jsx-runtime"),g=U(require("react")),m=require("../../helpers/index.js"),u=require("../../components/index.js"),B=require("../../shared/Styles.js"),D=require("../../helpers/index.js"),P=require("../AiuiProvider/index.js"),M=require("../../shared/trackUrlRef.js"),N=require("../../shared/track.js"),R=require("../../hooks/useExposure.js"),y=require("../../hooks/useTracking.js");const b="image",k="PromotionalBar",A=e=>{if(!e)return;const{mobile:t,tablet:n,laptop:c,desktop:l,lgDesktop:h}=e,o=[],p=L=>L?.url,a=p(h),s=p(l),i=p(c),d=p(n),f=p(t);return a?o.push(a):s?o.push(s):i?o.push(i):d?o.push(d):f&&o.push(f),s&&a&&o.push(`${s} 1920`),i&&(s||a)&&o.push(`${i} 1440`),d&&(i||s||a)&&o.push(`${d} 1024`),f&&(d||i||s||a)&&o.push(`${f} 768`),o.length>0?o.join(", "):void 0},T=g.forwardRef(({classNames:e,data:t,className:n,...c},l)=>{const{locale:h="us"}=(0,P.useAiuiContext)(),{buildRef:o}=(0,y.useTracking)(),{backgroundImage:p,theme:a="dark"}=t,s=g.useMemo(()=>A(p),[p]),i=g.useRef(null);return g.useImperativeHandle(l,()=>i.current),(0,R.useExposure)(i,{componentType:b,componentName:k,componentTitle:t.contentTitle,componentDescription:t.contentDesc}),(0,r.jsx)("div",{ref:i,...c,className:(0,m.cn)("laptop:h-[192px] lg-desktop:h-[240px] h-[240px] text-[#080A0F]",{"text-[#F5F6F7]":a==="dark"},e?.root,n),children:(0,r.jsxs)("div",{className:"promotional-bar-content rounded-card relative h-full overflow-hidden",children:[(0,r.jsxs)("div",{className:(0,m.cn)("laptop:px-8 laptop:justify-center laptop:box-content lg-desktop:max-w-[686px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4",e?.content),children:[t.contentTitle&&(0,r.jsx)(u.Heading,{className:(0,m.cn)("line-clamp-2 ",e?.title),html:t.contentTitle,size:3}),t.contentDesc&&(0,r.jsx)("p",{className:(0,m.cn)("laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] ",e?.description),dangerouslySetInnerHTML:{__html:t.contentDesc}}),(0,r.jsx)("div",{className:"laptop:mt-4 mt-2",children:t.buttonText&&(0,r.jsx)(u.Button,{as:"a",variant:"link",className:(0,m.cn)("!p-0 text-[#F5F6F7]",{"text-[#080A0F]":a==="light"},e?.button),href:(0,M.trackUrlRef)((0,D.getLocalizedPath)(t.buttonLink||"",h),o(b,k)),...(0,N.buildClickTrackingProps)({interactive:!!t.buttonLink,componentType:b,componentName:k,title:t.contentTitle,description:t.contentDesc,buttonName:t.buttonText}),iconClassName:"size-4",children:t.buttonText})})]}),(0,r.jsx)(u.Picture,{source:s,className:"absolute inset-0 z-10 ",imgClassName:"h-full object-cover transition-transform duration-300 ease-in-out hover:scale-[1.05]"})]})})});T.displayName="PromotionalBar";var C=(0,B.withLayout)(T);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var _=Object.create;var p=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var M=(t,i)=>{for(var e in i)p(t,e,{get:i[e],enumerable:!0})},P=(t,i,e,m)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of A(i))!I.call(t,r)&&r!==e&&p(t,r,{get:()=>i[r],enumerable:!(m=q(i,r))||m.enumerable});return t};var B=(t,i,e)=>(e=t!=null?_(H(t)):{},P(i||!t||!t.__esModule?p(e,"default",{value:t,enumerable:!0}):e,t)),E=t=>P(p({},"__esModule",{value:!0}),t);var F={};M(F,{SceneProductCard:()=>b});module.exports=E(F);var a=require("react/jsx-runtime"),W=B(require("react")),l=require("../../helpers/index.js"),s=require("../../components/index.js"),u=require("./context.js"),N=require("../../shared/LocalizedLink.js"),v=require("../../shared/trackUrlRef.js"),f=require("../../shared/track.js"),S=require("../../hooks/useTracking.js");const h="shelf",x="scene_shelf",b=W.forwardRef(({className:t,classNames:i,product:e,selected:m,onSelectChange:r,showTags:w,showOriginalPrice:y,onProductImageClick:T,...z},L)=>{const n=(0,u.useSceneShelfContext)(),{buildRef:$}=(0,S.useTracking)(),j=w??n?.showTags??!0,D=y??n?.showOriginalPrice??!0,o=i??n?.classNames??{},g=m??(n?n.selectedIds.has(e.id):!1),k=r??n?.onSelectChange,C=T??n?.onProductImageClick,d=e.soldOut??!1,O=c=>{d||typeof c=="boolean"&&k?.(c,e)},R=()=>{d||k?.(!g,e)};return(0,a.jsxs)("div",{ref:L,className:(0,l.cn)("scene-shelf-product-card","lg-desktop:gap-2 lg-desktop:h-[362px] lg-desktop:px-6 lg-desktop:pb-6 lg-desktop:pt-4 rounded-box box-border flex h-[284px] flex-col justify-between gap-2 border-2 border-solid p-4 pb-6 transition-colors",d?"cursor-not-allowed opacity-50":"cursor-pointer",g?(0,l.cn)("border-brand-0 bg-container-secondary-0",o?.cardSelected):(0,l.cn)("border-lines bg-container-primary",!d&&"hover:bg-container-secondary",o?.card),t),onClick:R,"data-headless-type-name":`${h}#${x}`,"data-headless-title-desc-button":`${(0,f.toPlainTrackingText)(e.custom_name??e.title)}##${g?"Unselect":"Select"}`,"data-headless-sku":e.sku??e.id,...z,children:[(0,a.jsx)("div",{className:(0,l.cn)("scene-shelf-product-card-tags","lg-desktop:left-6 lg-desktop:top-6 flex max-h-[24px] min-h-[24px] flex-wrap gap-1 overflow-visible pr-9",o?.tags),children:j&&e.tags?.map((c,U)=>(0,a.jsx)(s.Badge,{variant:c.variant||"outline",size:"sm",className:"scene-shelf-product-card-badge",children:c.label},U))}),(0,a.jsx)(s.Checkbox,{checked:g,disabled:d,onCheckedChange:O,onClick:c=>c.stopPropagation(),className:(0,l.cn)("scene-shelf-product-card-checkbox","text-brand-0 border-brand-0 lg-desktop:right-6 lg-desktop:top-6 absolute right-4 top-4 size-5 shrink-0",o?.checkbox)}),(0,a.jsx)("div",{className:(0,l.cn)("flex flex-1 grow-0 items-center justify-center",o?.image),children:C?(0,a.jsx)("a",{onClick:()=>C(e),role:"button","data-headless-type-name":`${h}#${x}`,"data-headless-title-desc-button":`${(0,f.toPlainTrackingText)(e.custom_name??e.title)}##image`,"data-headless-sku":e.sku??e.id,children:(0,a.jsx)(s.Picture,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):e?.href?(0,a.jsx)(N.LocalizedLink,{href:(0,v.trackUrlRef)(e.href,$(h,x)),"data-headless-type-name":`${h}#${x}`,"data-headless-title-desc-button":`${(0,f.toPlainTrackingText)(e.custom_name??e.title)}##image`,"data-headless-sku":e.sku??e.id,children:(0,a.jsx)(s.Picture,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):(0,a.jsx)(s.Picture,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}),(0,a.jsxs)("div",{className:"flex grow flex-col justify-start gap-4",children:[(0,a.jsx)(s.Heading,{as:"h3",size:2,className:(0,l.cn)("text-info-primary line-clamp-2",o?.title),html:e.custom_name??e.title}),(0,a.jsxs)("div",{className:(0,l.cn)("flex flex-wrap items-center gap-1",o?.priceWrapper),children:[(0,a.jsx)(s.Text,{as:"span",size:2,className:(0,l.cn)("text-info-primary lg-desktop:text-[24px] whitespace-nowrap text-[20px]",o?.currentPrice),children:e.currentPrice.formatted}),D&&e.originalPrice&&e.originalPrice.value>e.currentPrice.value&&(0,a.jsx)(s.Text,{as:"span",size:2,className:(0,l.cn)("text-info-quaternary lg-desktop:text-[24px] whitespace-nowrap text-[20px] line-through",o?.originalPrice),children:e.originalPrice.formatted})]}),e?.priceLabel&&(0,a.jsx)(s.Text,{size:4,className:(0,l.cn)("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",o?.productPriceLabel),children:e.priceLabel})]})]})});b.displayName="SceneShelf.ProductCard";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var ae=Object.create;var y=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ie=(e,n)=>{for(var o in n)y(e,o,{get:n[o],enumerable:!0})},O=(e,n,o,m)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of oe(n))!re.call(e,c)&&c!==o&&y(e,c,{get:()=>n[c],enumerable:!(m=ne(n,c))||m.enumerable});return e};var le=(e,n,o)=>(o=e!=null?ae(se(e)):{},O(n||!e||!e.__esModule?y(o,"default",{value:e,enumerable:!0}):o,e)),ce=e=>O(y({},"__esModule",{value:!0}),e);var pe={};ie(pe,{SceneShelfProductsPanel:()=>L});module.exports=ce(pe);var t=require("react/jsx-runtime"),u=le(require("react")),g=require("swiper/react"),h=require("swiper/modules"),s=require("../../helpers/index.js"),r=require("../../components/index.js"),I=require("../SwiperBox/buildSsrSlideCss.js"),w=require("./context.js"),P=require("../../shared/track.js"),fe=require("swiper/css");const de="shelf",ue="scene_shelf",L=u.forwardRef(({title:e,totalPriceLabel:n,totalCurrentPrice:o,totalOriginalPrice:m,primaryButtonText:c,primaryButtonFun:V,secondaryButtonText:_,secondaryButtonFun:j,bundleDiscountLabel:E,className:q,children:G,...W},Z)=>{const a=(0,w.useSceneShelfContext)(),v=(0,w.useSceneShelfRootInfo)(),i=a?.classNames,C=n??a?.totalPriceLabel??"Total Price:",f=o??a?.totalCurrentPrice,b=m??a?.totalOriginalPrice,T=c??a?.primaryButtonText??"Shop Now",D=V??a?.primaryButtonFun??"buyNow",B=_??a?.secondaryButtonText??"Add to Cart",F=j??a?.secondaryButtonFun??"addCart",x=E??a?.bundleDiscountLabel,d=a?.selectedProducts??[],J=a?.onLearnMore,K=a?.onShopNow,Q=a?.onAddToCart,U=a?.showOriginalPrice??!0,[X,Y]=u.useState(!1),[ee,te]=u.useState(!1),M=u.Children.toArray(G),A=M.length,S=u.useMemo(()=>({0:{slidesPerView:1.5,spaceBetween:10},768:{slidesPerView:2.8,spaceBetween:16},1024:{slidesPerView:2.3,spaceBetween:10},1440:{slidesPerView:A<=3?3:3.2,spaceBetween:16}}),[A]),N=`swiper-ssr-${u.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,k=u.useMemo(()=>(0,I.buildSsrSlideCss)(`.${N}`,S),[N,S]),R=async(l,p)=>{if(!l)return;const H=p==="primary"?Y:te;H(!0);try{switch(l){case"buyNow":await K?.(d);break;case"addCart":await Q?.(d);break;case"learnMore":await J?.(d);break;default:break}}finally{H(!1)}},$=l=>({"data-headless-type-name":`${de}#${ue}`,"data-headless-title-desc-button":`${(0,P.toPlainTrackingText)(v?.title??e)}#${(0,P.toPlainTrackingText)(v?.subtitle)}#${(0,P.toPlainTrackingText)(l)}`,"data-headless-nav-position":"#1",...d.length>0?{"data-headless-sku":d.map(p=>p.sku??p.id).join(",")}:{}}),z=l=>l==="learnMore"?!1:d.length===0;return(0,t.jsxs)("div",{ref:Z,className:(0,s.cn)("bg-container-primary laptop:p-6 lg-desktop:p-8 flex min-w-0 flex-1 flex-col justify-between overflow-hidden p-4",q,i?.content),...W,children:[e&&(0,t.jsx)(r.Heading,{as:"h2",size:3,className:(0,s.cn)("text-info-primary flex-0 mb-[16px] line-clamp-1 shrink-0",i?.title),html:e}),(0,t.jsxs)("div",{className:(0,s.cn)("lg-desktop:mb-[24px] mb-[16px] flex-1 ",i?.productList),children:[k&&(0,t.jsx)("style",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:k}}),(0,t.jsx)(g.Swiper,{modules:[h.FreeMode,h.Mousewheel],freeMode:!0,mousewheel:{forceToAxis:!0},className:k?N:void 0,breakpoints:S,children:M.map((l,p)=>(0,t.jsx)(g.SwiperSlide,{className:"h-fit shrink-0",children:l},p))})]}),(0,t.jsxs)("div",{className:(0,s.cn)("tablet:items-end tablet:flex-row flex-0 flex flex-col items-start justify-between gap-2",i?.footer),children:[(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsxs)("div",{className:(0,s.cn)("flex flex-wrap items-center gap-1",i?.totalPrice),children:[C&&(0,t.jsx)(r.Text,{as:"span",size:2,className:"text-info-primary lg-desktop:text-[24px] text-[20px]",children:C}),f&&(0,t.jsx)(r.Text,{as:"span",size:2,className:(0,s.cn)("text-info-primary lg-desktop:text-[24px] text-[20px]",i?.currentTotalPrice),children:f.formatted}),U&&b&&f&&b.value>f.value&&(0,t.jsx)(r.Text,{as:"span",size:2,className:(0,s.cn)("text-info-quaternary lg-desktop:text-[24px] text-[20px] line-through",i?.originalTotalPrice),children:b.formatted})]}),x&&(0,t.jsx)(r.Text,{as:"span",size:2,className:(0,s.cn)("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 text-[14px]",i?.bundleDiscountLabel),children:typeof x=="function"?x(d):x})]}),(0,t.jsxs)("div",{className:(0,s.cn)("flex items-stretch gap-3",i?.buttonGroup),children:[B&&(0,t.jsx)(r.Button,{variant:"secondary",className:"min-w-0 whitespace-normal text-center",onClick:()=>R(F,"secondary"),...$(B),disabled:z(F),loading:ee,children:B}),T&&(0,t.jsx)(r.Button,{variant:"primary",className:"min-w-0 whitespace-normal text-center",onClick:()=>R(D,"primary"),...$(T),disabled:z(D),loading:X,children:T})]})]})]})});L.displayName="SceneShelf.ProductsPanel";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var x=Object.create;var a=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var g=(e,o)=>{for(var t in o)a(e,t,{get:o[t],enumerable:!0})},p=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of y(o))!N.call(e,i)&&i!==t&&a(e,i,{get:()=>o[i],enumerable:!(n=T(o,i))||n.enumerable});return e};var L=(e,o,t)=>(t=e!=null?x(H(e)):{},p(o||!e||!e.__esModule?a(t,"default",{value:e,enumerable:!0}):t,e)),M=e=>p(a({},"__esModule",{value:!0}),e);var P={};g(P,{SceneShelfRoot:()=>l});module.exports=M(P);var r=require("react/jsx-runtime"),c=L(require("react")),m=require("../../helpers/index.js"),s=require("../../components/index.js"),d=require("../../hooks/useExposure.js"),h=require("./context.js");const D="shelf",E="scene_shelf",l=c.forwardRef(({title:e,subtitle:o,theme:t="light",classNames:n,className:i,children:S,...v},R)=>{const f=c.useRef(null);c.useImperativeHandle(R,()=>f.current),(0,d.useExposure)(f,{componentType:D,componentName:E,componentTitle:e,componentDescription:o});const u=c.useMemo(()=>({title:e,subtitle:o}),[e,o]);return(0,r.jsx)(h.SceneShelfRootInfoContext.Provider,{value:u,children:(0,r.jsxs)("div",{ref:f,className:(0,m.cn)("text-info-primary w-full",{"aiui-dark":t==="dark"},i,n?.root),...v,children:[(e||o)&&(0,r.jsxs)("div",{className:(0,m.cn)("mb-6",n?.header),children:[e&&(0,r.jsx)(s.Heading,{as:"h2",size:4,className:(0,m.cn)("text-info-primary mb-2",n?.title),html:e}),o&&(0,r.jsx)(s.Text,{as:"p",size:3,className:(0,m.cn)("",n?.subtitle),html:o})]}),(0,r.jsx)("div",{className:(0,m.cn)("space-y-6",n?.sceneList),children:S})]})})});l.displayName="SceneShelf.Root";
|
|
@@ -48,4 +48,14 @@ declare const SceneShelfContext: React.Context<SceneShelfContextValue | null>;
|
|
|
48
48
|
* @returns Context 值,如果在 Root 外使用则返回 null
|
|
49
49
|
*/
|
|
50
50
|
export declare function useSceneShelfContext(): SceneShelfContextValue | null;
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* SceneShelf Root 级信息,用于让深层按钮的点击埋点与 Root 的曝光保持一致
|
|
53
|
+
* (Root 位于 Scene Context 外层,ProductsPanel 无法直接读到 Root 的标题)
|
|
54
|
+
*/
|
|
55
|
+
export interface SceneShelfRootInfo {
|
|
56
|
+
title?: string;
|
|
57
|
+
subtitle?: string;
|
|
58
|
+
}
|
|
59
|
+
declare const SceneShelfRootInfoContext: React.Context<SceneShelfRootInfo | null>;
|
|
60
|
+
export declare function useSceneShelfRootInfo(): SceneShelfRootInfo | null;
|
|
61
|
+
export { SceneShelfContext, SceneShelfRootInfoContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var l=Object.create;var r=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var o in t)r(e,o,{get:t[o],enumerable:!0})},u=(e,t,o,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of S(t))!f.call(e,n)&&n!==o&&r(e,n,{get:()=>t[n],enumerable:!(d=s(t,n))||d.enumerable});return e};var p=(e,t,o)=>(o=e!=null?l(P(e)):{},u(t||!e||!e.__esModule?r(o,"default",{value:e,enumerable:!0}):o,e)),m=e=>u(r({},"__esModule",{value:!0}),e);var g={};C(g,{SceneShelfContext:()=>a,SceneShelfRootInfoContext:()=>i,useSceneShelfContext:()=>x,useSceneShelfRootInfo:()=>h});module.exports=m(g);var c=p(require("react"));const a=c.createContext(null);function x(){return c.useContext(a)}const i=c.createContext(null);function h(){return c.useContext(i)}
|
|
@@ -34,6 +34,11 @@ export interface PriceData {
|
|
|
34
34
|
export interface SceneProductCardData {
|
|
35
35
|
/** 产品唯一标识 */
|
|
36
36
|
id: string;
|
|
37
|
+
/**
|
|
38
|
+
* 产品 SKU,用于埋点 data-headless-sku。
|
|
39
|
+
* 未传时回退到 id(兼容旧数据),但 id 不一定是 SKU,建议由数据层显式传入
|
|
40
|
+
*/
|
|
41
|
+
sku?: string;
|
|
37
42
|
/** 产品名称 */
|
|
38
43
|
title: string;
|
|
39
44
|
/** 自定义产品名称 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ze=Object.create;var fe=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var Fe=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,Ee=Object.prototype.hasOwnProperty;var Oe=(e,t)=>{for(var p in t)fe(e,p,{get:t[p],enumerable:!0})},Ie=(e,t,p,N)=>{if(t&&typeof t=="object"||typeof t=="function")for(let g of Fe(t))!Ee.call(e,g)&&g!==p&&fe(e,g,{get:()=>t[g],enumerable:!(N=Ae(t,g))||N.enumerable});return e};var Ne=(e,t,p)=>(p=e!=null?ze(Me(e)):{},Ie(t||!e||!e.__esModule?fe(p,"default",{value:e,enumerable:!0}):p,e)),je=e=>Ie(fe({},"__esModule",{value:!0}),e);var Re={};Oe(Re,{ShelfDisplayHorizontalItem:()=>Ue,ShelfDisplayWrapItem:()=>He,getProductImage:()=>De});module.exports=je(Re);var s=require("react/jsx-runtime"),Te=require("../AiuiProvider/index.js"),Ce=require("./shelfDisplay.js"),xe=Ne(require("../../components/picture.js")),ve=Ne(require("../../components/badge.js")),k=require("../../helpers/utils.js"),be=require("../../components/text.js"),se=Ne(require("../../components/button.js")),Be=require("../../shared/track.js"),Pe=require("../../shared/trackUrlRef.js"),Le=require("../../components/heading.js"),$e=require("../../hooks/useExposure.js"),c=require("react");const ye="image",ge="product_shelf",he=999999999e-2,De=e=>{const t=e?.sku,p=e?.variants,N=p?.find(j=>j?.sku===t),g=N?.image?.url||p?.[0]?.image?.url||"",re=N?.image?.altText||p?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:g,altText:re}},We=({items:e})=>e?.length?(0,s.jsx)("div",{className:"shelf-display-social-endorsements desktop:gap-2 absolute right-0 top-0 z-10 flex flex-col items-center gap-1",children:e.map((t,p)=>typeof t.icon=="string"?(0,s.jsx)("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},p):(0,s.jsx)(be.Text,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},p))}):null,He=({data:e,configuration:t})=>{const{isDisplayBackImage:p=!1,itemShape:N,metafields:g,isTopTag:re=!1,isShowTag:j,isShowOriginalPrice:I,isShowShortTitle:ke=!1,isShowPricesTag:z=!1,pricesTagTextColor:W,pricesTagBgColor:H,itemsTagTextColor:w,itemsTagBgColor:K,formatPrice:ie,renderOriginalPrice:Q,renderPriceLabel:we,renderPrice:U}=t||{},{locale:C="es",copyWriting:oe,currencyDisplay:X}=(0,Te.useAiuiContext)(),{discounts:Y,discountsCopy:le}=g||{},ne=(0,c.useRef)(null),[n,ae]=(0,c.useState)([]),[ce,A]=(0,c.useState)(""),[pe,F]=(0,c.useState)(!1),[_,R]=(0,c.useState)(!1),me=(i,d,u,f)=>{const{primaryFun:b,onAddCart:T,onBuyNow:ee,onLearnMore:te,event:Se}=t||{};if(b){if(b==="AddCart"&&T)return T(i,d+1,u,f);if(b==="BuyNow"&&ee)return ee(i,d+1,u,f);if(b==="LearnMore"&&te)return te(i,d+1,u,f)}Se?.primaryButton?.(i,d+1,u,f)},_e=(i,d,u,f)=>{const{secondaryFun:b,onAddCart:T,onBuyNow:ee,onLearnMore:te,event:Se}=t||{};if(b){if(b==="AddCart"&&T)return T(i,d+1,u,f);if(b==="BuyNow"&&ee)return ee(i,d+1,u,f);if(b==="LearnMore"&&te)return te(i,d+1,u,f)}Se?.secondaryButton?.(i,d+1,u,f)},o=(0,c.useMemo)(()=>{const i=e?.variants||[];if(i.length)return e?.sku?i?.find?.(d=>d?.sku===e?.sku)||i[0]:i?.[0]},[e?.sku,e?.variants]),M=o?.id?.split?.("/")||[],B=M?.[M?.length-1],h=!o?.availableForSale||o?.price?.amount===he||o?.price===he,S=o?.coupons?.[0],de=e?.price?.currencyCode||"USD",q=(0,c.useMemo)(()=>(0,Ce.formatVariantPrice)({locale:C,amount:S?S?.variant_price4wscode:o?.price,baseAmount:S?o?.price:0,currencyCode:de,currencyDisplay:X,customFormatPrice:ie}),[de,C,S,X,o,ie]),{price:E,basePrice:P,discount:L,discountAmount:O}=q,{imageUrl:V,altText:ue}=De(e),G=e?.custom_name||e?.title,$=ke&&o?.metafields?.infos?.page_short_title||G,Z=e?.custom_description||e?.description,r=()=>{if(S?.value_type==="fixed_amount"){const i=O||"",d=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(d){const[,u,f,b]=d;let T=f;return f.endsWith(".00")?T=f.replace(/\.00$/,""):f.endsWith(",00")&&(T=f.replace(/,00$/,"")),`${u}${T}${b}`}return i}return L||""};(0,c.useEffect)(()=>{let i=[];if(L||O){const u=`${r()} ${Y?.off||le?.off||""}`;A(u)}const d=e?.tags?.filter?.(u=>u?.startsWith?.("CLtag"))?.map?.(u=>u?.replace?.("CLtag:",""))?.slice?.(0,L&&z?1:2)||[];ae(i.concat(d))},[e?.tags,L,O,z,Y?.off,le?.off]),(0,$e.useExposure)(ne,{componentType:ye,componentName:ge,componentTitle:G,componentDescription:Z,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){F(!0);try{await me(e,t?.index,t,S)}finally{F(!1)}}},a=async()=>{if(!_&&!e?.custom_secondary_link){R(!0);try{await _e(e,t?.index,t,S)}finally{R(!1)}}},m=()=>(0,s.jsxs)("div",{className:"shelf-display-product-content desktop:gap-6 flex flex-1 flex-col justify-between gap-4",children:[(0,s.jsxs)("div",{className:"shelf-display-product-content-title-desc",children:[$?(0,s.jsx)(Le.Heading,{as:"h3",title:$||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:$||""}):null,(0,s.jsx)(be.Text,{size:2,className:(0,k.cn)("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:Z||""})]}),(0,s.jsxs)("div",{className:"shelf-display-product-content-price-button",children:[(0,s.jsx)("div",{className:"mb-2 flex flex-wrap items-center",children:U?U(e,{price:E,basePrice:P,discount:L,discountAmount:O,variant:o,coupon:S,isSoldOut:h,isShowOriginalPrice:I}):h?(0,s.jsx)("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:oe?.soldOutText}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"final-price lg-desktop:text-2xl text-info-primary whitespace-nowrap text-xl font-bold !leading-[1.2]",children:o?.availableForSale&&E||""}),Q?Q(e,{price:E,basePrice:P,discount:L,discountAmount:O,isShowOriginalPrice:I}):P&&I&&(0,s.jsx)("div",{className:"origin-price lg-desktop:text-2xl text-info-quaternary ml-1 whitespace-nowrap text-xl font-bold !leading-[1.2] line-through",children:o?.availableForSale&&P||""})]})}),!U&&we?.(e,o,{isShowOriginalPrice:I}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!h?(0,s.jsx)(se.default,{disabled:h&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:a,loading:_,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(se.default,{disabled:h&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:l,loading:pe,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]}),y={...W?{color:W}:{},...H?{backgroundColor:H,backgroundImage:"none"}:{},...W||H?{outline:"none"}:{}},x={...w?{color:w}:{},...K?{backgroundColor:K,backgroundImage:"none"}:{},...w||K?{outlineColor:w}:{}},D=()=>(0,s.jsxs)("div",{className:"lg-desktop:min-h-[28px] box-border flex min-h-6 flex-wrap gap-1 overflow-hidden",children:[z&&ce&&(0,s.jsx)(ve.default,{className:"shelf-prices-tag",variant:"fill",style:y,children:ce||""}),j&&n?.length>0&&n?.map?.((i,d)=>(0,s.jsx)(ve.default,{className:"shelf-items-tag",variant:"outline",style:x,children:i},d))]}),v=e?.custom_bg_image,J=e?.custom_theme;return(0,s.jsx)("div",{ref:ne,className:(0,k.cn)("shelf-display-item box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300","rounded-box relative",v?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":J==="dark","aiui-light":J==="light"}),style:v?{backgroundImage:`url(${v})`}:void 0,children:p?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(xe.default,{source:V,alt:ue,className:(0,k.cn)("absolute inset-0 size-full",{"opacity-0":v}),imgClassName:"size-full object-cover"}),(0,s.jsxs)("div",{className:"desktop:p-6 relative flex flex-1 flex-col p-4",children:[(0,s.jsx)(D,{}),m()]})]}):(0,s.jsxs)("div",{className:"desktop:gap-2 desktop:p-6 desktop:pt-4 flex flex-1 flex-col gap-1 p-4",children:[(0,s.jsx)(D,{}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-display-item-image lg-desktop:size-[240px] relative mx-auto size-[180px] overflow-hidden",{"opacity-0":v}),children:[(0,s.jsx)("a",{"aria-label":G,target:t?.target,href:(0,Pe.trackUrlRef)(`${C==="us"||!C?"":`/${C}`}/products/${e?.handle}?variant=${B}`,`${ye}_${ge}`),onClick:()=>{(0,Be.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||o?.sku,item_name:e?.name,item_variant:o?.name,price:o?.price,index:t?.index+1}]}})},className:"block size-full",children:(0,s.jsx)(xe.default,{source:V,alt:ue,className:"size-full",imgClassName:"size-full object-cover"})}),(0,s.jsx)(We,{items:e?.socialEndorsements})]}),m()]})},e?.id||e?.handle)},Ue=({data:e,configuration:t})=>{const{itemShape:p,itemLength:N,metafields:g,isShowShortTitle:re,formatPrice:j,renderOriginalPrice:I,renderPriceLabel:ke,renderPrice:z}=t||{},{discounts:W,discountsCopy:H}=g||{},{locale:w="us",copyWriting:K,currencyDisplay:ie}=(0,Te.useAiuiContext)(),[Q,we]=(0,c.useState)([]),U=(0,c.useRef)(null),[C,oe]=(0,c.useState)(!1),[X,Y]=(0,c.useState)(!1),le=(r,l,a,m)=>{const{primaryFun:y,onAddCart:x,onBuyNow:D,onLearnMore:v,event:J}=t||{};if(y){if(y==="AddCart"&&x)return x(r,l+1,a,m);if(y==="BuyNow"&&D)return D(r,l+1,a,m);if(y==="LearnMore"&&v)return v(r,l+1,a,m)}J?.primaryButton?.(r,l+1,a,m)},ne=(r,l,a,m)=>{const{secondaryFun:y,onAddCart:x,onBuyNow:D,onLearnMore:v,event:J}=t||{};if(y){if(y==="AddCart"&&x)return x(r,l+1,a,m);if(y==="BuyNow"&&D)return D(r,l+1,a,m);if(y==="LearnMore"&&v)return v(r,l+1,a,m)}J?.secondaryButton?.(r,l+1,a,m)},n=(0,c.useMemo)(()=>{const r=e?.variants||[];if(r.length)return e?.sku&&r.find(l=>l?.sku===e?.sku)||r[0]},[e?.sku,e?.variants]),ae=n?.id?.split?.("/")||[],ce=ae?.[ae?.length-1],A=!n?.availableForSale||n?.price?.amount===he||n?.price===he,pe=t?.isShowTag,F=t?.isShowOriginalPrice,_=n?.coupons?.[0],R=!!(F&&_),me=e?.price?.currencyCode||"USD",_e=(0,c.useMemo)(()=>(0,Ce.formatVariantPrice)({locale:w,amount:R?_?.variant_price4wscode:n?.price,baseAmount:R?n?.price:0,currencyCode:me,currencyDisplay:ie,customFormatPrice:j}),[me,w,R,_?.variant_price4wscode,n,j]),{price:o,basePrice:M,discount:B,discountAmount:h}=_e,{imageUrl:S,altText:de}=De(e),q=e?.custom_name||e?.title,E=re&&n?.metafields?.infos?.page_short_title||q,P=e?.custom_description||e?.description;(0,$e.useExposure)(U,{componentType:ye,componentName:ge,componentTitle:q,componentDescription:P,position:t?.index+1});const L=async()=>{if(!C&&!e?.custom_primary_link){oe(!0);try{await le(e,t?.index,t,_)}finally{oe(!1)}}},O=async()=>{if(!X&&!e?.custom_secondary_link){Y(!0);try{await ne(e,t?.index,t,_)}finally{Y(!1)}}},V=()=>N>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},ue=()=>N>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col",G=()=>{if(_?.value_type==="fixed_amount"){const r=h||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,a,m,y]=l;let x=m;return m.endsWith(".00")?x=m.replace(/\.00$/,""):m.endsWith(",00")&&(x=m.replace(/,00$/,"")),`${a}${x}${y}`}return r}return B||""};(0,c.useEffect)(()=>{let r=[];if(B||h){const a=`${G()} ${W?.off||H?.off||""}`;r.push(a)}const l=e?.tags?.filter?.(a=>a?.startsWith?.("CLtag"))?.map?.(a=>a?.replace?.("CLtag:",""))?.slice?.(0,B?1:2)||[];we(r.concat(l))},[e?.tags,B,h,W?.off,H?.off]);const $=e?.custom_bg_image,Z=e?.custom_theme;return(0,s.jsx)("div",{ref:U,className:(0,k.cn)(V().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",$?"bg-cover bg-center bg-no-repeat":"bg-container-secondary-1 tablet:hover:bg-info-white",{"aiui-dark":Z==="dark","aiui-light":Z==="light"}),style:$?{backgroundImage:`url(${$})`}:void 0,children:(0,s.jsxs)("div",{className:(0,k.cn)(ue(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[(0,s.jsx)("div",{className:(0,k.cn)(V().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":$}),children:(0,s.jsx)("a",{"aria-label":q,target:t?.target,href:(0,Pe.trackUrlRef)(`${w==="us"||!w?"":`/${w}`}/products/${e?.handle}?variant=${ce}`,`${ye}_${ge}`),onClick:()=>{(0,Be.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||n?.sku,item_name:e?.name,item_variant:n?.name,price:n?.price,index:t?.index+1}]}})},children:(0,s.jsx)(xe.default,{source:S,alt:de,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),(0,s.jsxs)("div",{className:(0,k.cn)("flex flex-col items-start justify-center",V().boxItem),children:[pe&&(0,s.jsx)("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:Q?.length>0&&Q?.map?.((r,l)=>(0,s.jsx)(ve.default,{className:"shelf-items-tag",variant:"fill",children:r},l))}),E?(0,s.jsx)(Le.Heading,{as:"h3",title:E||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:E||""}):null,P?(0,s.jsx)(be.Text,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description text-info-primary line-clamp-1 h-5 text-sm",html:P||""}):null,(0,s.jsx)("div",{className:"mb-2 mt-5 flex flex-wrap items-center",children:z?z(e,{price:o,basePrice:M,discount:B,discountAmount:h,variant:n,coupon:_,isSoldOut:A,isShowOriginalPrice:F}):A?(0,s.jsx)("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:K?.soldOutText}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"final-price tablet:text-xl text-info-primary whitespace-nowrap text-xl font-bold",children:n?.availableForSale&&o||""}),I?I(e,{price:o,basePrice:M,discount:B,discountAmount:h,isShowOriginalPrice:F}):M&&(0,s.jsx)("div",{className:"origin-price tablet:text-xl text-info-quaternary ml-1 whitespace-nowrap text-lg font-bold line-through",children:n?.availableForSale&&M||""})]})}),!z&&ke?.(e,n,{isShowOriginalPrice:F}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!A?(0,s.jsx)(se.default,{disabled:A&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:O,loading:X,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(se.default,{disabled:A&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:L,loading:C,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};
|
|
1
|
+
"use strict";var Fe=Object.create;var ye=Object.defineProperty;var Me=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty;var We=(e,t)=>{for(var n in t)ye(e,n,{get:t[n],enumerable:!0})},Ae=(e,t,n,N)=>{if(t&&typeof t=="object"||typeof t=="function")for(let g of Ee(t))!je.call(e,g)&&g!==n&&ye(e,g,{get:()=>t[g],enumerable:!(N=Me(t,g))||N.enumerable});return e};var Ne=(e,t,n)=>(n=e!=null?Fe(Oe(e)):{},Ae(t||!e||!e.__esModule?ye(n,"default",{value:e,enumerable:!0}):n,e)),He=e=>Ae(ye({},"__esModule",{value:!0}),e);var Ve={};We(Ve,{ShelfDisplayHorizontalItem:()=>qe,ShelfDisplayWrapItem:()=>Re,getProductImage:()=>ze});module.exports=He(Ve);var s=require("react/jsx-runtime"),Ce=require("../AiuiProvider/index.js"),Be=require("./shelfDisplay.js"),ve=Ne(require("../../components/picture.js")),be=Ne(require("../../components/badge.js")),k=require("../../helpers/utils.js"),ke=require("../../components/text.js"),se=Ne(require("../../components/button.js")),Pe=require("../../shared/track.js"),Le=require("../../shared/trackUrlRef.js"),De=require("../../components/heading.js"),Ie=require("../../hooks/useExposure.js"),m=require("react"),$e=require("../../hooks/useTracking.js");const ge="image",he="product_shelf",xe=999999999e-2,ze=e=>{const t=e?.sku,n=e?.variants,N=n?.find(re=>re?.sku===t),g=N?.image?.url||n?.[0]?.image?.url||"",J=N?.image?.altText||n?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:g,altText:J}},Ue=({items:e})=>e?.length?(0,s.jsx)("div",{className:"shelf-display-social-endorsements desktop:gap-2 absolute right-0 top-0 z-10 flex flex-col items-center gap-1",children:e.map((t,n)=>typeof t.icon=="string"?(0,s.jsx)("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},n):(0,s.jsx)(ke.Text,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},n))}):null,Re=({data:e,configuration:t})=>{const{buildRef:n}=(0,$e.useTracking)(),{isDisplayBackImage:N=!1,itemShape:g,metafields:J,isTopTag:re=!1,isShowTag:ie,isShowOriginalPrice:$,isShowShortTitle:we=!1,isShowPricesTag:z=!1,pricesTagTextColor:j,pricesTagBgColor:W,itemsTagTextColor:w,itemsTagBgColor:K,formatPrice:oe,renderOriginalPrice:Q,renderPriceLabel:_e,renderPrice:H}=t||{},{locale:C="es",copyWriting:le,currencyDisplay:X}=(0,Ce.useAiuiContext)(),{discounts:Y,discountsCopy:ne}=J||{},ae=(0,m.useRef)(null),[a,ce]=(0,m.useState)([]),[me,A]=(0,m.useState)(""),[pe,F]=(0,m.useState)(!1),[_,U]=(0,m.useState)(!1),de=(i,d,u,f)=>{const{primaryFun:b,onAddCart:T,onBuyNow:ee,onLearnMore:te,event:Te}=t||{};if(b){if(b==="AddCart"&&T)return T(i,d+1,u,f);if(b==="BuyNow"&&ee)return ee(i,d+1,u,f);if(b==="LearnMore"&&te)return te(i,d+1,u,f)}Te?.primaryButton?.(i,d+1,u,f)},Se=(i,d,u,f)=>{const{secondaryFun:b,onAddCart:T,onBuyNow:ee,onLearnMore:te,event:Te}=t||{};if(b){if(b==="AddCart"&&T)return T(i,d+1,u,f);if(b==="BuyNow"&&ee)return ee(i,d+1,u,f);if(b==="LearnMore"&&te)return te(i,d+1,u,f)}Te?.secondaryButton?.(i,d+1,u,f)},o=(0,m.useMemo)(()=>{const i=e?.variants||[];if(i.length)return e?.sku?i?.find?.(d=>d?.sku===e?.sku)||i[0]:i?.[0]},[e?.sku,e?.variants]),M=o?.id?.split?.("/")||[],B=M?.[M?.length-1],h=!o?.availableForSale||o?.price?.amount===xe||o?.price===xe,S=o?.coupons?.[0],ue=e?.price?.currencyCode||"USD",R=(0,m.useMemo)(()=>(0,Be.formatVariantPrice)({locale:C,amount:S?S?.variant_price4wscode:o?.price,baseAmount:S?o?.price:0,currencyCode:ue,currencyDisplay:X,customFormatPrice:oe}),[ue,C,S,X,o,oe]),{price:E,basePrice:P,discount:L,discountAmount:O}=R,{imageUrl:q,altText:fe}=ze(e),V=e?.custom_name||e?.title,D=we&&o?.metafields?.infos?.page_short_title||V,Z=e?.custom_description||e?.description,r=()=>{if(S?.value_type==="fixed_amount"){const i=O||"",d=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(d){const[,u,f,b]=d;let T=f;return f.endsWith(".00")?T=f.replace(/\.00$/,""):f.endsWith(",00")&&(T=f.replace(/,00$/,"")),`${u}${T}${b}`}return i}return L||""};(0,m.useEffect)(()=>{let i=[];if(L||O){const u=`${r()} ${Y?.off||ne?.off||""}`;A(u)}const d=e?.tags?.filter?.(u=>u?.startsWith?.("CLtag"))?.map?.(u=>u?.replace?.("CLtag:",""))?.slice?.(0,L&&z?1:2)||[];ce(i.concat(d))},[e?.tags,L,O,z,Y?.off,ne?.off]),(0,Ie.useExposure)(ae,{componentType:ge,componentName:he,componentTitle:V,componentDescription:Z,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){F(!0);try{await de(e,t?.index,t,S)}finally{F(!1)}}},c=async()=>{if(!_&&!e?.custom_secondary_link){U(!0);try{await Se(e,t?.index,t,S)}finally{U(!1)}}},p=()=>(0,s.jsxs)("div",{className:"shelf-display-product-content desktop:gap-6 flex flex-1 flex-col justify-between gap-4",children:[(0,s.jsxs)("div",{className:"shelf-display-product-content-title-desc",children:[D?(0,s.jsx)(De.Heading,{as:"h3",title:D||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:D||""}):null,(0,s.jsx)(ke.Text,{size:2,className:(0,k.cn)("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:Z||""})]}),(0,s.jsxs)("div",{className:"shelf-display-product-content-price-button",children:[(0,s.jsx)("div",{className:"mb-2 flex flex-wrap items-center",children:H?H(e,{price:E,basePrice:P,discount:L,discountAmount:O,variant:o,coupon:S,isSoldOut:h,isShowOriginalPrice:$}):h?(0,s.jsx)("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:le?.soldOutText}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"final-price lg-desktop:text-2xl text-info-primary whitespace-nowrap text-xl font-bold !leading-[1.2]",children:o?.availableForSale&&E||""}),Q?Q(e,{price:E,basePrice:P,discount:L,discountAmount:O,isShowOriginalPrice:$}):P&&$&&(0,s.jsx)("div",{className:"origin-price lg-desktop:text-2xl text-info-quaternary ml-1 whitespace-nowrap text-xl font-bold !leading-[1.2] line-through",children:o?.availableForSale&&P||""})]})}),!H&&_e?.(e,o,{isShowOriginalPrice:$}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!h?(0,s.jsx)(se.default,{disabled:h&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:c,loading:_,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(se.default,{disabled:h&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:l,loading:pe,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]}),y={...j?{color:j}:{},...W?{backgroundColor:W,backgroundImage:"none"}:{},...j||W?{outline:"none"}:{}},x={...w?{color:w}:{},...K?{backgroundColor:K,backgroundImage:"none"}:{},...w||K?{outlineColor:w}:{}},I=()=>(0,s.jsxs)("div",{className:"lg-desktop:min-h-[28px] box-border flex min-h-6 flex-wrap gap-1 overflow-hidden",children:[z&&me&&(0,s.jsx)(be.default,{className:"shelf-prices-tag",variant:"fill",style:y,children:me||""}),ie&&a?.length>0&&a?.map?.((i,d)=>(0,s.jsx)(be.default,{className:"shelf-items-tag",variant:"outline",style:x,children:i},d))]}),v=e?.custom_bg_image,G=e?.custom_theme;return(0,s.jsx)("div",{ref:ae,className:(0,k.cn)("shelf-display-item box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300","rounded-box relative",v?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":G==="dark","aiui-light":G==="light"}),style:v?{backgroundImage:`url(${v})`}:void 0,children:N?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ve.default,{source:q,alt:fe,className:(0,k.cn)("absolute inset-0 size-full",{"opacity-0":v}),imgClassName:"size-full object-cover"}),(0,s.jsxs)("div",{className:"desktop:p-6 relative flex flex-1 flex-col p-4",children:[(0,s.jsx)(I,{}),p()]})]}):(0,s.jsxs)("div",{className:"desktop:gap-2 desktop:p-6 desktop:pt-4 flex flex-1 flex-col gap-1 p-4",children:[(0,s.jsx)(I,{}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-display-item-image lg-desktop:size-[240px] relative mx-auto size-[180px] overflow-hidden",{"opacity-0":v}),children:[(0,s.jsx)("a",{"aria-label":V,target:t?.target,href:(0,Le.trackUrlRef)(`${C==="us"||!C?"":`/${C}`}/products/${e?.handle}?variant=${B}`,n(ge,he)),onClick:()=>{(0,Pe.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||o?.sku,item_name:e?.name,item_variant:o?.name,price:o?.price,index:t?.index+1}]}})},className:"block size-full",children:(0,s.jsx)(ve.default,{source:q,alt:fe,className:"size-full",imgClassName:"size-full object-cover"})}),(0,s.jsx)(Ue,{items:e?.socialEndorsements})]}),p()]})},e?.id||e?.handle)},qe=({data:e,configuration:t})=>{const{buildRef:n}=(0,$e.useTracking)(),{itemShape:N,itemLength:g,metafields:J,isShowShortTitle:re,formatPrice:ie,renderOriginalPrice:$,renderPriceLabel:we,renderPrice:z}=t||{},{discounts:j,discountsCopy:W}=J||{},{locale:w="us",copyWriting:K,currencyDisplay:oe}=(0,Ce.useAiuiContext)(),[Q,_e]=(0,m.useState)([]),H=(0,m.useRef)(null),[C,le]=(0,m.useState)(!1),[X,Y]=(0,m.useState)(!1),ne=(r,l,c,p)=>{const{primaryFun:y,onAddCart:x,onBuyNow:I,onLearnMore:v,event:G}=t||{};if(y){if(y==="AddCart"&&x)return x(r,l+1,c,p);if(y==="BuyNow"&&I)return I(r,l+1,c,p);if(y==="LearnMore"&&v)return v(r,l+1,c,p)}G?.primaryButton?.(r,l+1,c,p)},ae=(r,l,c,p)=>{const{secondaryFun:y,onAddCart:x,onBuyNow:I,onLearnMore:v,event:G}=t||{};if(y){if(y==="AddCart"&&x)return x(r,l+1,c,p);if(y==="BuyNow"&&I)return I(r,l+1,c,p);if(y==="LearnMore"&&v)return v(r,l+1,c,p)}G?.secondaryButton?.(r,l+1,c,p)},a=(0,m.useMemo)(()=>{const r=e?.variants||[];if(r.length)return e?.sku&&r.find(l=>l?.sku===e?.sku)||r[0]},[e?.sku,e?.variants]),ce=a?.id?.split?.("/")||[],me=ce?.[ce?.length-1],A=!a?.availableForSale||a?.price?.amount===xe||a?.price===xe,pe=t?.isShowTag,F=t?.isShowOriginalPrice,_=a?.coupons?.[0],U=!!(F&&_),de=e?.price?.currencyCode||"USD",Se=(0,m.useMemo)(()=>(0,Be.formatVariantPrice)({locale:w,amount:U?_?.variant_price4wscode:a?.price,baseAmount:U?a?.price:0,currencyCode:de,currencyDisplay:oe,customFormatPrice:ie}),[de,w,U,_?.variant_price4wscode,a,ie]),{price:o,basePrice:M,discount:B,discountAmount:h}=Se,{imageUrl:S,altText:ue}=ze(e),R=e?.custom_name||e?.title,E=re&&a?.metafields?.infos?.page_short_title||R,P=e?.custom_description||e?.description;(0,Ie.useExposure)(H,{componentType:ge,componentName:he,componentTitle:R,componentDescription:P,position:t?.index+1});const L=async()=>{if(!C&&!e?.custom_primary_link){le(!0);try{await ne(e,t?.index,t,_)}finally{le(!1)}}},O=async()=>{if(!X&&!e?.custom_secondary_link){Y(!0);try{await ae(e,t?.index,t,_)}finally{Y(!1)}}},q=()=>g>=2?{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] max-w-full",imgItem:"m-tablet:m-auto lg-desktop:max-w-[330px] lg-desktop:max-h-[330px] desktop:max-w-[260px] desktop:max-h-[260px] max-w-[138px] max-h-[138px]",wrap:"lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480] desktop:aspect-w-[648] desktop:aspect-h-[380] laptop:aspect-w-[440] laptop:aspect-h-[356] tablet:aspect-w-[346] tablet:aspect-h-[360] md-tablet:w-full"}:{boxItem:"lg-desktop:max-w-[401px] desktop:max-w-[292px] laptop:max-w-[289px] max-w-[262px]",imgItem:"md-tablet:m-auto lg-desktop:max-w-[450px] lg-desktop:max-h-[450px] desktop:max-w-[332px] desktop:max-h-[332px] max-w-[312px] max-h-[312px]",wrap:"lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[480] desktop:aspect-w-[1312] desktop:aspect-h-[380] laptop:aspect-w-[896] laptop:aspect-h-[356] tablet:aspect-w-[704] tablet:aspect-h-[360] md-tablet:w-full"},fe=()=>g>=2?"flex flex-col justify-between desktop:gap-12 desktop:flex-row desktop:justify-center desktop:items-center":"flex justify-center items-center gap-6 md-tablet:flex-col",V=()=>{if(_?.value_type==="fixed_amount"){const r=h||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,c,p,y]=l;let x=p;return p.endsWith(".00")?x=p.replace(/\.00$/,""):p.endsWith(",00")&&(x=p.replace(/,00$/,"")),`${c}${x}${y}`}return r}return B||""};(0,m.useEffect)(()=>{let r=[];if(B||h){const c=`${V()} ${j?.off||W?.off||""}`;r.push(c)}const l=e?.tags?.filter?.(c=>c?.startsWith?.("CLtag"))?.map?.(c=>c?.replace?.("CLtag:",""))?.slice?.(0,B?1:2)||[];_e(r.concat(l))},[e?.tags,B,h,j?.off,W?.off]);const D=e?.custom_bg_image,Z=e?.custom_theme;return(0,s.jsx)("div",{ref:H,className:(0,k.cn)(q().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",D?"bg-cover bg-center bg-no-repeat":"bg-container-secondary-1 tablet:hover:bg-info-white",{"aiui-dark":Z==="dark","aiui-light":Z==="light"}),style:D?{backgroundImage:`url(${D})`}:void 0,children:(0,s.jsxs)("div",{className:(0,k.cn)(fe(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[(0,s.jsx)("div",{className:(0,k.cn)(q().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":D}),children:(0,s.jsx)("a",{"aria-label":R,target:t?.target,href:(0,Le.trackUrlRef)(`${w==="us"||!w?"":`/${w}`}/products/${e?.handle}?variant=${me}`,n(ge,he)),onClick:()=>{(0,Pe.gaTrack)({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||a?.sku,item_name:e?.name,item_variant:a?.name,price:a?.price,index:t?.index+1}]}})},children:(0,s.jsx)(ve.default,{source:S,alt:ue,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),(0,s.jsxs)("div",{className:(0,k.cn)("flex flex-col items-start justify-center",q().boxItem),children:[pe&&(0,s.jsx)("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:Q?.length>0&&Q?.map?.((r,l)=>(0,s.jsx)(be.default,{className:"shelf-items-tag",variant:"fill",children:r},l))}),E?(0,s.jsx)(De.Heading,{as:"h3",title:E||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:E||""}):null,P?(0,s.jsx)(ke.Text,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description text-info-primary line-clamp-1 h-5 text-sm",html:P||""}):null,(0,s.jsx)("div",{className:"mb-2 mt-5 flex flex-wrap items-center",children:z?z(e,{price:o,basePrice:M,discount:B,discountAmount:h,variant:a,coupon:_,isSoldOut:A,isShowOriginalPrice:F}):A?(0,s.jsx)("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:K?.soldOutText}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"final-price tablet:text-xl text-info-primary whitespace-nowrap text-xl font-bold",children:a?.availableForSale&&o||""}),$?$(e,{price:o,basePrice:M,discount:B,discountAmount:h,isShowOriginalPrice:F}):M&&(0,s.jsx)("div",{className:"origin-price tablet:text-xl text-info-quaternary ml-1 whitespace-nowrap text-lg font-bold line-through",children:a?.availableForSale&&M||""})]})}),!z&&we?.(e,a,{isShowOriginalPrice:F}),(0,s.jsxs)("div",{className:(0,k.cn)("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!A?(0,s.jsx)(se.default,{disabled:A&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:O,loading:X,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?(0,s.jsx)(se.default,{disabled:A&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:L,loading:C,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var I=Object.create;var f=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var W=(o,r)=>{for(var a in r)f(o,a,{get:r[a],enumerable:!0})},S=(o,r,a,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of $(r))!V.call(o,s)&&s!==a&&f(o,s,{get:()=>r[s],enumerable:!(u=U(r,s))||u.enumerable});return o};var A=(o,r,a)=>(a=o!=null?I(O(o)):{},S(r||!o||!o.__esModule?f(a,"default",{value:o,enumerable:!0}):a,o)),q=o=>S(f({},"__esModule",{value:!0}),o);var K={};W(K,{default:()=>J});module.exports=q(K);var t=require("react/jsx-runtime"),i=A(require("react")),l=require("../../components/index.js"),n=require("../../helpers/utils.js"),L=require("../../shared/Styles.js"),z=require("../../hooks/useExposure.js"),E=require("../AiuiProvider/index.js"),R=require("../../hooks/useTracking.js"),D=require("../../shared/trackUrlRef.js"),h=require("../../shared/track.js"),p=require("swiper/react"),v=require("swiper/modules"),X=require("swiper/css"),Y=require("swiper/css/navigation"),Z=require("swiper/css/pagination"),ee=require("swiper/css/effect-coverflow");const w="carousel",b="three_d_carousel",F=()=>(0,t.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]",children:[(0,t.jsx)("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),(0,t.jsx)("path",{d:"M32 20L24 28L32 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),G=()=>(0,t.jsxs)("svg",{width:"56",height:"56",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"three-d-carousel__nav-icon lg-desktop:scale-100 scale-[70%] text-white hover:text-[#1f1f1f]",children:[(0,t.jsx)("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),(0,t.jsx)("path",{d:"M24 20L32 28L24 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),C=i.default.forwardRef(({data:o,className:r},a)=>{const{title:u,items:s=[],titleTag:P}=o,g=s.length<4?[...s,...s]:s,c=(0,i.useRef)(null),x=(0,i.useRef)(null),_=(0,i.useRef)(null),[j,B]=i.default.useState(180),{locale:k="us"}=(0,E.useAiuiContext)(),{buildRef:H}=(0,R.useTracking)(),y=e=>e?(0,D.trackUrlRef)((0,n.getLocalizedPath)(e,k),H(w,b)):(0,n.getLocalizedPath)("",k),N=e=>e.buttonLink?{"data-headless-type-name":`${w}#${b}`,"data-headless-title-desc-button":`${(0,h.toPlainTrackingText)(e.title)}#${(0,h.toPlainTrackingText)(e.description)}#${(0,h.toPlainTrackingText)(e.buttonText)}`,"data-headless-nav-position":`#${s.indexOf(e)+1}`}:{};return(0,z.useExposure)(x,{componentType:w,componentName:b,componentTitle:u}),(0,i.useImperativeHandle)(a,()=>x.current),i.default.useEffect(()=>{const e=_.current;if(!e)return;const d=()=>{const M=e.offsetWidth,T=Math.round(M*.125);B(T),c.current?.params?.coverflowEffect&&(c.current.params.coverflowEffect.stretch=T,c.current.update())};d();const m=new ResizeObserver(d);return m.observe(e),()=>m.disconnect()},[]),(0,t.jsxs)("section",{ref:x,"data-ui-component-id":"ThreeDCarousel",className:(0,n.cn)("three-d-carousel laptop:overflow-hidden w-full overflow-visible",r),children:[(0,t.jsx)(l.Heading,{as:P??"h2",size:4,html:u,className:"three-d-carousel__title laptop:text-center text-left"}),(0,t.jsxs)("div",{ref:_,className:"three-d-carousel__desktop laptop:block relative mx-auto mt-[24px] hidden w-full",children:[(0,t.jsx)(p.Swiper,{onSwiper:e=>c.current=e,centeredSlides:!0,initialSlide:0,loop:!0,slidesPerView:"auto",spaceBetween:0,grabCursor:!0,modules:[v.EffectCoverflow,v.Navigation],slideToClickedSlide:!0,className:"three-d-carousel__swiper rounded-box relative aspect-[1386/502] overflow-visible",effect:"coverflow",coverflowEffect:{rotate:0,stretch:j,depth:300,modifier:1,slideShadows:!0},children:g.map((e,d)=>(0,t.jsx)(p.SwiperSlide,{className:"three-d-carousel__slide relative !w-1/2 cursor-grab overflow-hidden opacity-0 [.swiper-slide-active&]:opacity-100 [.swiper-slide-next&]:opacity-100 [.swiper-slide-prev&]:opacity-100",children:({isActive:m})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.Picture,{source:e.imageUrl?.url||"",alt:e.imageUrl?.alt||e.title,className:(0,n.cn)("three-d-carousel__image rounded-box mx-auto h-full overflow-hidden"),imgClassName:"h-full object-cover",style:{filter:m?"":"brightness(50%) contrast(120%)"}}),(0,t.jsxs)("div",{className:(0,n.cn)("three-d-carousel__image-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 box-border flex size-full flex-col justify-end gap-1 p-[16px]",{"aiui-dark":e.theme==="dark","opacity-0":!m}),children:[(0,t.jsx)(l.Heading,{as:"h2",size:2,html:e.title}),(0,t.jsx)(l.Text,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-description lg-desktop:text-[18px] desktop:text-[16px] text-[14px]"}),e.buttonText&&(0,t.jsx)("a",{href:y(e.buttonLink),...N(e),className:"three-d-carousel__image-link ",children:(0,t.jsx)(l.Button,{size:"base",variant:"secondary",className:"three-d-carousel__image-button desktop:mt-6 mt-4",children:e.buttonText})})]})]})},d))}),(0,t.jsxs)("div",{className:"three-d-carousel__nav-controls laptop:px-[64px] desktop:px-[140px] lg-desktop:px-[200px] absolute left-1/2 top-1/2 z-20 flex w-full -translate-x-1/2 -translate-y-1/2 justify-between",children:[(0,t.jsx)("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--prev",onClick:()=>c.current?.slidePrev(),"aria-label":"Previous slide",children:(0,t.jsx)(F,{})}),(0,t.jsx)("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--next",onClick:()=>c.current?.slideNext(),"aria-label":"Next slide",children:(0,t.jsx)(G,{})})]})]}),(0,t.jsx)("div",{className:"three-d-carousel__mobile laptop:hidden mt-[24px] block w-full overflow-visible",children:(0,t.jsx)(p.Swiper,{loop:!0,loopAdditionalSlides:1,slidesPerView:"auto",spaceBetween:12,grabCursor:!0,className:"three-d-carousel__swiper-mobile relative w-full !overflow-visible",children:g.map((e,d)=>(0,t.jsxs)(p.SwiperSlide,{className:"three-d-carousel__slide-mobile relative !h-[360px] !w-[296px] cursor-grab overflow-hidden",children:[(0,t.jsx)(l.Picture,{source:e.mobImageUrl?.url||e.imageUrl?.url||"",alt:e.mobImageUrl?.alt||e.title,className:"three-d-carousel__image-mobile rounded-box mx-auto h-full overflow-hidden",imgClassName:"h-full object-cover"}),(0,t.jsxs)("div",{className:(0,n.cn)("three-d-carousel__image-mobile-content tablet:p-[24px] desktop:p-[32px] text-info-primary absolute left-0 top-0 flex size-full flex-col justify-end gap-1 p-[16px]",{"aiui-dark":e.theme==="dark"}),children:[(0,t.jsx)(l.Heading,{as:"h2",size:2,html:e.title}),(0,t.jsx)(l.Text,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-mobile-description text-[14px]"}),e.buttonText&&(0,t.jsx)("a",{href:y(e.buttonLink),...N(e),className:"three-d-carousel__image-mobile-link ",children:(0,t.jsx)(l.Button,{size:"base",variant:"secondary",className:"three-d-carousel__image-mobile-button mt-3",children:e.buttonText})})]})]},d))})})]})});C.displayName="ThreeDCarousel";var J=(0,L.withLayout)(C,{style:"overflow: hidden;"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var ft=Object.create;var b=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var ht=Object.getOwnPropertyNames;var xt=Object.getPrototypeOf,wt=Object.prototype.hasOwnProperty;var bt=(t,n)=>{for(var e in n)b(t,e,{get:n[e],enumerable:!0})},j=(t,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of ht(n))!wt.call(t,l)&&l!==e&&b(t,l,{get:()=>n[l],enumerable:!(o=gt(n,l))||o.enumerable});return t};var yt=(t,n,e)=>(e=t!=null?ft(xt(t)):{},j(n||!t||!t.__esModule?b(e,"default",{value:t,enumerable:!0}):e,t)),Tt=t=>j(b({},"__esModule",{value:!0}),t);var Ct={};bt(Ct,{default:()=>Lt});module.exports=Tt(Ct);var r=require("react/jsx-runtime"),s=yt(require("react")),y=require("gsap"),P=require("gsap/dist/SplitText"),R=require("gsap/dist/ScrollTrigger"),a=require("../../helpers/utils.js"),c=require("../../components/index.js"),_=require("../../shared/Styles.js"),W=require("../AiuiProvider/index.js"),Z=require("../../hooks/useExposure.js"),q=require("../../hooks/useTracking.js"),F=require("@payloadcms/richtext-lexical/plaintext"),G=require("../../shared/trackUrlRef.js"),J=require("react-intersection-observer");const M="link",z="title";function vt(t){if(!t)return!1;if(typeof t=="string")return t.trim().length>0;const n=t?.root?.children;return!Array.isArray(n)||n.length===0?!1:n.some(e=>{const o=e?.children;return!Array.isArray(o)||o.length===0?!1:o.some(l=>typeof l?.text=="string"&&l.text.length>0)})}function g(t){if(!t)return"";if(typeof t=="string")return t;try{return(0,F.convertLexicalToPlaintext)({data:t})||""}catch{return""}}const kt="text-info-primary desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]",O=({data:t,onClick:n,className:e})=>{const{extensions:o,title:l,caption:h,subtitle:T,align:x}=t,{locale:v="us"}=(0,W.useAiuiContext)(),{buildRef:u}=(0,q.useTracking)();if(!o?.textLink)return null;const w=o?.link?(0,G.trackUrlRef)((0,a.getLocalizedPath)(o.link,v),u(M,z)):void 0;return(0,r.jsxs)("a",{className:(0,a.cn)("text-info-primary hover:text-brand-0 lg-desktop:text-base flex cursor-pointer items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]",{"justify-center mt-4":x==="center"},{"mt-1 laptop:mt-0":x==="left"},e),...w?{href:w}:{},"data-headless-type-name":`${M}#${z}`,"data-headless-title-desc-button":`${g(h||l)}#${g(T)}#${g(o.textLink)}`,...n?{onClick:n}:{},children:[(0,r.jsx)("div",{className:"truncate whitespace-nowrap",children:o?.textLink}),(0,r.jsx)("div",{className:"lg-desktop:size-5 size-4",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:(0,r.jsx)("path",{d:"M5.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z",fill:"currentColor",className:"transition-all duration-[0.4s]"})})})]})},U=s.default.forwardRef(({data:t,className:n,classNames:e,as:o="h2",weight:l="bold",onButtonClick:h,id:T,...x},v)=>{const{title:u,titleSize:w=4,caption:k,subtitle:L,content:N,countdown:i,showCountdown:K=!1,theme:S="light",extensions:A,align:p="left"}=t,C=(0,s.useRef)(null),m=(0,s.useRef)(null),d=(0,s.useRef)(null),f=(0,s.useRef)(null),[Q,X]=(0,s.useState)(!0),{ref:Y,inView:V}=(0,J.useInView)();(0,s.useImperativeHandle)(v,()=>C.current),(0,Z.useExposure)(C,{componentType:M,componentName:z,componentTitle:g(k||u),componentDescription:g(L)});const tt=()=>{X(!1)},et=i?.targetDateTime||i?.targetDate||"",nt=i?.targetDateTime_tz,rt=i?.labels?{day:i.labels.days||"Day",hour:i.labels.hours||"Hours",minute:i.labels.minutes||"Mins",second:i.labels.seconds||"Secs"}:void 0;return(0,s.useEffect)(()=>{y.gsap.registerPlugin(P.SplitText,R.ScrollTrigger);function ot(){if(!m.current)return;const it=m.current?.clientHeight||80;d.current&&d.current.revert(),f.current&&f.current.kill(),d.current=new P.SplitText(m.current,{type:"words",wordsClass:"word"});const H=d.current.words;y.gsap.set(H,{opacity:0}),f.current=R.ScrollTrigger.create({trigger:m.current,start:"bottom bottom-=4%",end:`bottom+=${it*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:st=>{const lt=st.progress,$=H.length||1,at=.5,D=1/$,B=D*(1-at),I=($-1)*B+D,ct=Math.min(1,I>0?lt/I:0);H.forEach((dt,ut)=>{const pt=ut*B,mt=D;let E=(ct-pt)/mt;E=Math.max(0,Math.min(1,E)),y.gsap.set(dt,{opacity:E})})}})}return V&&ot(),()=>{d.current&&d.current.revert(),f.current&&f.current.kill()}},[V]),(0,r.jsxs)("div",{id:A?.id?A?.id:T,className:(0,a.cn)("titleBottom title-box flex items-end justify-between gap-2 pb-6",{"aiui-dark":S==="dark"},n,e?.wrapper),...x,ref:C,children:[(0,r.jsxs)("div",{ref:Y,className:(0,a.cn)("flex-1",e?.container,{"text-center":p==="center","text-left":p==="left"}),children:[(k||u)&&(0,r.jsx)(c.Heading,{ref:m,as:o,size:w,html:k||u,weight:l,className:(0,a.cn)("text-info-primary",e?.title)}),L&&(0,r.jsx)(c.Text,{html:L,as:"div",className:(0,a.cn)(kt,e?.subtitle)}),vt(N)&&(0,r.jsx)(c.Text,{html:N,as:"div",size:4,className:(0,a.cn)("title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]",e?.content)}),(0,r.jsx)(O,{data:t,className:(0,a.cn)({"laptop:hidden":p==="left"},e?.button),onClick:h}),K&&i&&Q&&(0,r.jsx)(c.Countdown,{endDate:et,endDate_tz:nt,timeLabels:rt,showDays:i?.showDays,showHours:i?.showHours,showMinutes:i?.showMinutes,showSeconds:i?.showSeconds,theme:S,onExpire:tt,hideWhenExpired:!0,align:p==="center"?"center":"left",className:(0,a.cn)("mt-4",e?.countdown)})]}),(0,r.jsx)(O,{data:t,className:(0,a.cn)("hidden",{"laptop:flex":p==="left"},e?.button),onClick:h})]})});U.displayName="Title";var Lt=(0,_.withLayout)(U);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SerializedEditorState } from '@payloadcms/richtext-lexical/lexical';
|
|
1
2
|
export declare const gaTrack: (data: any) => "" | undefined;
|
|
2
3
|
/**
|
|
3
4
|
* GA4 `select_item` 事件商品项
|
|
@@ -30,12 +31,17 @@ export interface TrackSelectItemOptions {
|
|
|
30
31
|
export declare const trackSelectItem: ({ pageGroup, currency, itemListId, itemListName, position, items, }: TrackSelectItemOptions) => void;
|
|
31
32
|
/** 组件类型:图片 image / 视频 video(埋点规范) */
|
|
32
33
|
export type ComponentMediaType = 'image' | 'video';
|
|
34
|
+
/** 埋点文本入参:纯字符串,或 CMS 返回的 Lexical 富文本对象 */
|
|
35
|
+
export type TrackingTextInput = string | SerializedEditorState | null | undefined;
|
|
33
36
|
/**
|
|
34
37
|
* 埋点文本归一化:CMS 富文本标题常携带 `<br>` 等 HTML 标签,
|
|
35
38
|
* 直接上报会污染 GA4 维度(如 component_title 出现 `<br>`)。
|
|
36
39
|
* 此函数去标签、还原常见实体并压缩空白。
|
|
40
|
+
*
|
|
41
|
+
* 入参也可以是 Lexical 富文本对象(CMS 的标题、描述字段),会先转成纯文本再归一化;
|
|
42
|
+
* 转换失败时返回空字符串,不抛错,避免埋点异常拖垮组件渲染。
|
|
37
43
|
*/
|
|
38
|
-
export declare const toPlainTrackingText: (value?:
|
|
44
|
+
export declare const toPlainTrackingText: (value?: TrackingTextInput) => string;
|
|
39
45
|
/** 按当前渲染的创意是否为视频解析 component_type。
|
|
40
46
|
* 埋点规范:图片传 image、视频传 video。
|
|
41
47
|
*/
|
|
@@ -48,12 +54,12 @@ export interface ClickTrackingPropsInput {
|
|
|
48
54
|
interactive: boolean;
|
|
49
55
|
componentType: ComponentMediaType;
|
|
50
56
|
componentName: string;
|
|
51
|
-
/** 运营配置的创意标题 → component_title */
|
|
52
|
-
title?:
|
|
53
|
-
/** 运营配置的创意描述 → component_description */
|
|
54
|
-
description?:
|
|
55
|
-
/** 按钮文案(视频播放入口固定传 `video play` / `video pause`) → button_name */
|
|
56
|
-
buttonName?:
|
|
57
|
+
/** 运营配置的创意标题 → component_title(可为 Lexical 富文本) */
|
|
58
|
+
title?: TrackingTextInput;
|
|
59
|
+
/** 运营配置的创意描述 → component_description(可为 Lexical 富文本) */
|
|
60
|
+
description?: TrackingTextInput;
|
|
61
|
+
/** 按钮文案(视频播放入口固定传 `video play` / `video pause`) → button_name(可为 Lexical 富文本) */
|
|
62
|
+
buttonName?: TrackingTextInput;
|
|
57
63
|
/** 导航/电梯/锚点文案,与 position 以 `#` 分隔 */
|
|
58
64
|
navigation?: string;
|
|
59
65
|
/** 同一位置内的组件顺序 / 轮播帧序号(1-based) → position */
|
package/dist/cjs/shared/track.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var k=(e,t)=>{for(var n in t)g(e,n,{get:t[n],enumerable:!0})},x=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _(t))!y.call(e,i)&&i!==n&&g(e,i,{get:()=>t[i],enumerable:!(r=T(t,i))||r.enumerable});return e};var v=e=>x(g({},"__esModule",{value:!0}),e);var h={};k(h,{buildClickTrackingProps:()=>w,gaTrack:()=>d,resolveComponentMediaType:()=>b,toPlainTrackingText:()=>o,trackComponentClick:()=>S,trackSelectItem:()=>f});module.exports=v(h);var l=require("@payloadcms/richtext-lexical/plaintext");const d=e=>{if(typeof window>"u")return"";window.dataLayer=window.dataLayer||[];try{window.dataLayer?.push({event_parameters:null}),window.dataLayer?.push(e||{})}catch(t){console.log("pageGTMEvent error",t)}},f=({pageGroup:e="Home Page",currency:t="USD",itemListId:n,itemListName:r,position:i,items:a})=>{d({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:e,position:i,item_list_id:n,item_list_name:r,currency:t,items:a.map(p=>({...p,item_list_id:n,item_list_name:r}))}})},C=/<[^>]*>/g,I={" ":" ","&":"&","<":"<",">":">",""":'"',"'":"'"},o=e=>{if(!e)return"";let t;if(typeof e=="string")t=e;else try{t=(0,l.convertLexicalToPlaintext)({data:e})||""}catch{return""}return t.replace(C," ").replace(/&[a-z#0-9]+;/gi,n=>I[n.toLowerCase()]??" ").replace(/\s+/g," ").trim()},b=e=>e?"video":"image",w=({interactive:e,componentType:t,componentName:n,title:r,description:i,buttonName:a,navigation:p="",position:m=1,creativeId:s,sku:c})=>{if(!e)return{};const u=`${o(r)}#${o(i)}${a===void 0?"":`#${o(a)}`}`;return{"data-headless-type-name":`${t}#${n}`,"data-headless-title-desc-button":u,"data-headless-nav-position":`${p}#${m}`,...s?{"data-headless-creative-id":s}:{},...c?{"data-headless-sku":c}:{}}},S=({pageGroup:e="Home Page",componentType:t,componentName:n,position:r=1,buttonName:i,componentTitle:a,componentDescription:p,creativeId:m,sku:s,navigation:c=""})=>{d({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:e,component_type:t,component_name:n,position:r,creative_id:m||"",button_name:o(i),component_title:o(a),component_description:o(p),SKU:s||"",navigation:c}})};
|