@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.
Files changed (183) hide show
  1. package/dist/cjs/biz-components/AccordionCards/index.js +1 -1
  2. package/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +4 -3
  3. package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
  4. package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
  5. package/dist/cjs/biz-components/ActivityMechanism/index.d.ts +4 -7
  6. package/dist/cjs/biz-components/ActivityMechanism/index.js +1 -1
  7. package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
  8. package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
  9. package/dist/cjs/biz-components/AnchorNavigation/index.js +1 -1
  10. package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js +1 -1
  11. package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +2 -0
  12. package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
  13. package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +2 -0
  14. package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
  15. package/dist/cjs/biz-components/BuyOneGetOneShelf/PriceAndActions.d.ts +2 -0
  16. package/dist/cjs/biz-components/BuyOneGetOneShelf/PriceAndActions.js +1 -1
  17. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -0
  18. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
  19. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +4 -0
  20. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
  21. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductInfo.d.ts +2 -0
  22. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductInfo.js +1 -1
  23. package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +1 -1
  24. package/dist/cjs/biz-components/BuyOneGetOneShelf/tracking.d.ts +20 -0
  25. package/dist/cjs/biz-components/BuyOneGetOneShelf/tracking.js +1 -0
  26. package/dist/cjs/biz-components/BuyOneGetOneShelf/types.d.ts +2 -0
  27. package/dist/cjs/biz-components/Category/index.d.ts +4 -2
  28. package/dist/cjs/biz-components/Category/index.js +1 -1
  29. package/dist/cjs/biz-components/Chat/action.d.ts +25 -0
  30. package/dist/cjs/biz-components/Chat/action.js +1 -0
  31. package/dist/cjs/biz-components/Chat/button.d.ts +3 -0
  32. package/dist/cjs/biz-components/Chat/button.js +1 -0
  33. package/dist/cjs/biz-components/Chat/chatContext.d.ts +101 -0
  34. package/dist/cjs/biz-components/Chat/chatContext.js +1 -0
  35. package/dist/cjs/biz-components/Chat/exports.d.ts +3 -0
  36. package/dist/cjs/biz-components/Chat/exports.js +1 -0
  37. package/dist/cjs/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
  38. package/dist/cjs/biz-components/Chat/helpers/fetchResponse.js +1 -0
  39. package/dist/cjs/biz-components/Chat/helpers/fetcher.d.ts +2 -0
  40. package/dist/cjs/biz-components/Chat/helpers/fetcher.js +1 -0
  41. package/dist/cjs/biz-components/Chat/index.d.ts +71 -0
  42. package/dist/cjs/biz-components/Chat/index.js +1 -0
  43. package/dist/cjs/biz-components/Chat/markdown.d.ts +5 -0
  44. package/dist/cjs/biz-components/Chat/markdown.js +1 -0
  45. package/dist/cjs/biz-components/Chat/messages.d.ts +3 -0
  46. package/dist/cjs/biz-components/Chat/messages.js +1 -0
  47. package/dist/cjs/biz-components/Chat/props.d.ts +43 -0
  48. package/dist/cjs/biz-components/Chat/props.js +1 -0
  49. package/dist/cjs/biz-components/Chat/response.d.ts +4 -0
  50. package/dist/cjs/biz-components/Chat/response.js +1 -0
  51. package/dist/cjs/biz-components/Chat/suggestions.d.ts +3 -0
  52. package/dist/cjs/biz-components/Chat/suggestions.js +1 -0
  53. package/dist/cjs/biz-components/Chat/utils.d.ts +3 -0
  54. package/dist/cjs/biz-components/Chat/utils.js +1 -0
  55. package/dist/cjs/biz-components/Evaluate/index.js +1 -1
  56. package/dist/cjs/biz-components/EventSchedule/index.js +1 -1
  57. package/dist/cjs/biz-components/Faq/Faq.d.ts +3 -1
  58. package/dist/cjs/biz-components/Faq/Faq.js +2 -2
  59. package/dist/cjs/biz-components/FeatureCards/FeatureCards.js +1 -1
  60. package/dist/cjs/biz-components/GiftShelf/index.js +1 -1
  61. package/dist/cjs/biz-components/GiftTierShelf/index.js +1 -1
  62. package/dist/cjs/biz-components/Graphic/index.js +1 -1
  63. package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
  64. package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
  65. package/dist/cjs/biz-components/MediaPlayerMulti/index.js +1 -1
  66. package/dist/cjs/biz-components/MemberEquity/index.js +2 -2
  67. package/dist/cjs/biz-components/MiniCart/index.js +1 -1
  68. package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
  69. package/dist/cjs/biz-components/ProductHero/ProductHero.js +1 -1
  70. package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
  71. package/dist/cjs/biz-components/PromotionalBar/index.d.ts +3 -2
  72. package/dist/cjs/biz-components/PromotionalBar/index.js +1 -1
  73. package/dist/cjs/biz-components/SceneShelf/ProductCard.js +1 -1
  74. package/dist/cjs/biz-components/SceneShelf/ProductsPanel.js +1 -1
  75. package/dist/cjs/biz-components/SceneShelf/Root.js +1 -1
  76. package/dist/cjs/biz-components/SceneShelf/context.d.ts +11 -1
  77. package/dist/cjs/biz-components/SceneShelf/context.js +1 -1
  78. package/dist/cjs/biz-components/SceneShelf/types.d.ts +5 -0
  79. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
  80. package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
  81. package/dist/cjs/biz-components/Title/index.js +1 -1
  82. package/dist/cjs/shared/track.d.ts +13 -7
  83. package/dist/cjs/shared/track.js +1 -1
  84. package/dist/esm/biz-components/AccordionCards/index.js +1 -1
  85. package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +4 -3
  86. package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
  87. package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
  88. package/dist/esm/biz-components/ActivityMechanism/index.d.ts +4 -7
  89. package/dist/esm/biz-components/ActivityMechanism/index.js +1 -1
  90. package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
  91. package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
  92. package/dist/esm/biz-components/AnchorNavigation/index.js +1 -1
  93. package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js +1 -1
  94. package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +2 -0
  95. package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
  96. package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +2 -0
  97. package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
  98. package/dist/esm/biz-components/BuyOneGetOneShelf/PriceAndActions.d.ts +2 -0
  99. package/dist/esm/biz-components/BuyOneGetOneShelf/PriceAndActions.js +1 -1
  100. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -0
  101. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
  102. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +4 -0
  103. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
  104. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductInfo.d.ts +2 -0
  105. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductInfo.js +1 -1
  106. package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +1 -1
  107. package/dist/esm/biz-components/BuyOneGetOneShelf/tracking.d.ts +20 -0
  108. package/dist/esm/biz-components/BuyOneGetOneShelf/tracking.js +1 -0
  109. package/dist/esm/biz-components/BuyOneGetOneShelf/types.d.ts +2 -0
  110. package/dist/esm/biz-components/Category/index.d.ts +4 -2
  111. package/dist/esm/biz-components/Category/index.js +1 -1
  112. package/dist/esm/biz-components/Chat/action.d.ts +25 -0
  113. package/dist/esm/biz-components/Chat/action.js +1 -0
  114. package/dist/esm/biz-components/Chat/button.d.ts +3 -0
  115. package/dist/esm/biz-components/Chat/button.js +1 -0
  116. package/dist/esm/biz-components/Chat/chatContext.d.ts +101 -0
  117. package/dist/esm/biz-components/Chat/chatContext.js +1 -0
  118. package/dist/esm/biz-components/Chat/exports.d.ts +3 -0
  119. package/dist/esm/biz-components/Chat/exports.js +1 -0
  120. package/dist/esm/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
  121. package/dist/esm/biz-components/Chat/helpers/fetchResponse.js +1 -0
  122. package/dist/esm/biz-components/Chat/helpers/fetcher.d.ts +2 -0
  123. package/dist/esm/biz-components/Chat/helpers/fetcher.js +1 -0
  124. package/dist/esm/biz-components/Chat/index.d.ts +71 -0
  125. package/dist/esm/biz-components/Chat/index.js +1 -0
  126. package/dist/esm/biz-components/Chat/markdown.d.ts +5 -0
  127. package/dist/esm/biz-components/Chat/markdown.js +1 -0
  128. package/dist/esm/biz-components/Chat/messages.d.ts +3 -0
  129. package/dist/esm/biz-components/Chat/messages.js +1 -0
  130. package/dist/esm/biz-components/Chat/props.d.ts +43 -0
  131. package/dist/esm/biz-components/Chat/props.js +1 -0
  132. package/dist/esm/biz-components/Chat/response.d.ts +4 -0
  133. package/dist/esm/biz-components/Chat/response.js +1 -0
  134. package/dist/esm/biz-components/Chat/suggestions.d.ts +3 -0
  135. package/dist/esm/biz-components/Chat/suggestions.js +1 -0
  136. package/dist/esm/biz-components/Chat/utils.d.ts +3 -0
  137. package/dist/esm/biz-components/Chat/utils.js +1 -0
  138. package/dist/esm/biz-components/Evaluate/index.js +1 -1
  139. package/dist/esm/biz-components/EventSchedule/index.js +1 -1
  140. package/dist/esm/biz-components/Faq/Faq.d.ts +3 -1
  141. package/dist/esm/biz-components/Faq/Faq.js +2 -2
  142. package/dist/esm/biz-components/FeatureCards/FeatureCards.js +1 -1
  143. package/dist/esm/biz-components/GiftShelf/index.js +1 -1
  144. package/dist/esm/biz-components/GiftTierShelf/index.js +1 -1
  145. package/dist/esm/biz-components/Graphic/index.js +1 -1
  146. package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
  147. package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
  148. package/dist/esm/biz-components/MediaPlayerMulti/index.js +1 -1
  149. package/dist/esm/biz-components/MemberEquity/index.js +2 -2
  150. package/dist/esm/biz-components/MiniCart/index.js +1 -1
  151. package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
  152. package/dist/esm/biz-components/ProductHero/ProductHero.js +1 -1
  153. package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
  154. package/dist/esm/biz-components/PromotionalBar/index.d.ts +3 -2
  155. package/dist/esm/biz-components/PromotionalBar/index.js +1 -1
  156. package/dist/esm/biz-components/SceneShelf/ProductCard.js +1 -1
  157. package/dist/esm/biz-components/SceneShelf/ProductsPanel.js +1 -1
  158. package/dist/esm/biz-components/SceneShelf/Root.js +1 -1
  159. package/dist/esm/biz-components/SceneShelf/context.d.ts +11 -1
  160. package/dist/esm/biz-components/SceneShelf/context.js +1 -1
  161. package/dist/esm/biz-components/SceneShelf/types.d.ts +5 -0
  162. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
  163. package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
  164. package/dist/esm/biz-components/Title/index.js +1 -1
  165. package/dist/esm/shared/track.d.ts +13 -7
  166. package/dist/esm/shared/track.js +1 -1
  167. package/package.json +50 -3
  168. package/src/biz-components/Chat/styles/chat.css +14 -0
  169. package/src/biz-components/Chat/styles/css/animations.css +35 -0
  170. package/src/biz-components/Chat/styles/css/button.css +56 -0
  171. package/src/biz-components/Chat/styles/css/colors.css +12 -0
  172. package/src/biz-components/Chat/styles/css/console.css +134 -0
  173. package/src/biz-components/Chat/styles/css/header.css +43 -0
  174. package/src/biz-components/Chat/styles/css/input.css +89 -0
  175. package/src/biz-components/Chat/styles/css/markdown.css +131 -0
  176. package/src/biz-components/Chat/styles/css/messages.css +85 -0
  177. package/src/biz-components/Chat/styles/css/panel.css +23 -0
  178. package/src/biz-components/Chat/styles/css/popup.css +44 -0
  179. package/src/biz-components/Chat/styles/css/response.css +25 -0
  180. package/src/biz-components/Chat/styles/css/sidebar.css +31 -0
  181. package/src/biz-components/Chat/styles/css/suggestions.css +36 -0
  182. package/src/biz-components/Chat/styles/css/window.css +60 -0
  183. package/src/biz-components/Chat/styles/image.png +0 -0
@@ -1 +1 @@
1
- "use client";import{jsx as a,jsxs as d}from"react/jsx-runtime";import*as T from"react";import{cn as t}from"../../helpers/index.js";import{Checkbox as L,Badge as j,Heading as D,Text as c,Picture as n}from"../../components/index.js";import{useSceneShelfContext as O}from"./context.js";import{LocalizedLink as q}from"../../shared/LocalizedLink.js";const p=T.forwardRef(({className:x,classNames:h,product:e,selected:f,onSelectChange:b,showTags:k,showOriginalPrice:C,onProductImageClick:P,...u},N)=>{const r=O(),S=k??r?.showTags??!0,v=C??r?.showOriginalPrice??!0,s=h??r?.classNames??{},l=f??(r?r.selectedIds.has(e.id):!1),m=b??r?.onSelectChange,g=P??r?.onProductImageClick,o=e.soldOut??!1,w=i=>{o||typeof i=="boolean"&&m?.(i,e)},y=()=>{o||m?.(!l,e)};return d("div",{ref:N,className:t("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",o?"cursor-not-allowed opacity-50":"cursor-pointer",l?t("border-brand-0 bg-container-secondary-0",s?.cardSelected):t("border-lines bg-container-primary",!o&&"hover:bg-container-secondary",s?.card),x),onClick:y,"data-headless-type-name":"SceneShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name??e.title}##Select`,"data-headless-sku":e.id,...u,children:[a("div",{className:t("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",s?.tags),children:S&&e.tags?.map((i,z)=>a(j,{variant:i.variant||"outline",size:"sm",className:"scene-shelf-product-card-badge",children:i.label},z))}),a(L,{checked:l,disabled:o,onCheckedChange:w,onClick:i=>i.stopPropagation(),className:t("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",s?.checkbox)}),a("div",{className:t("flex flex-1 grow-0 items-center justify-center",s?.image),children:g?a("a",{onClick:()=>g(e),role:"button",children:a(n,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):e?.href?a(q,{href:e.href,children:a(n,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):a(n,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}),d("div",{className:"flex grow flex-col justify-start gap-4",children:[a(D,{as:"h3",size:2,className:t("text-info-primary line-clamp-2",s?.title),html:e.custom_name??e.title}),d("div",{className:t("flex flex-wrap items-center gap-1",s?.priceWrapper),children:[a(c,{as:"span",size:2,className:t("text-info-primary lg-desktop:text-[24px] whitespace-nowrap text-[20px]",s?.currentPrice),children:e.currentPrice.formatted}),v&&e.originalPrice&&e.originalPrice.value>e.currentPrice.value&&a(c,{as:"span",size:2,className:t("text-info-quaternary lg-desktop:text-[24px] whitespace-nowrap text-[20px] line-through",s?.originalPrice),children:e.originalPrice.formatted})]}),e?.priceLabel&&a(c,{size:4,className:t("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",s?.productPriceLabel),children:e.priceLabel})]})]})});p.displayName="SceneShelf.ProductCard";export{p as SceneProductCard};
1
+ "use client";import{jsx as a,jsxs as p}from"react/jsx-runtime";import*as D from"react";import{cn as t}from"../../helpers/index.js";import{Checkbox as O,Badge as R,Heading as U,Text as d,Picture as m}from"../../components/index.js";import{useSceneShelfContext as _}from"./context.js";import{LocalizedLink as q}from"../../shared/LocalizedLink.js";import{trackUrlRef as A}from"../../shared/trackUrlRef.js";import{toPlainTrackingText as g}from"../../shared/track.js";import{useTracking as H}from"../../hooks/useTracking.js";const n="shelf",c="scene_shelf",f=D.forwardRef(({className:b,classNames:k,product:e,selected:C,onSelectChange:P,showTags:u,showOriginalPrice:N,onProductImageClick:v,...S},w)=>{const i=_(),{buildRef:y}=H(),T=u??i?.showTags??!0,z=N??i?.showOriginalPrice??!0,s=k??i?.classNames??{},r=C??(i?i.selectedIds.has(e.id):!1),h=P??i?.onSelectChange,x=v??i?.onProductImageClick,o=e.soldOut??!1,L=l=>{o||typeof l=="boolean"&&h?.(l,e)},$=()=>{o||h?.(!r,e)};return p("div",{ref:w,className:t("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",o?"cursor-not-allowed opacity-50":"cursor-pointer",r?t("border-brand-0 bg-container-secondary-0",s?.cardSelected):t("border-lines bg-container-primary",!o&&"hover:bg-container-secondary",s?.card),b),onClick:$,"data-headless-type-name":`${n}#${c}`,"data-headless-title-desc-button":`${g(e.custom_name??e.title)}##${r?"Unselect":"Select"}`,"data-headless-sku":e.sku??e.id,...S,children:[a("div",{className:t("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",s?.tags),children:T&&e.tags?.map((l,j)=>a(R,{variant:l.variant||"outline",size:"sm",className:"scene-shelf-product-card-badge",children:l.label},j))}),a(O,{checked:r,disabled:o,onCheckedChange:L,onClick:l=>l.stopPropagation(),className:t("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",s?.checkbox)}),a("div",{className:t("flex flex-1 grow-0 items-center justify-center",s?.image),children:x?a("a",{onClick:()=>x(e),role:"button","data-headless-type-name":`${n}#${c}`,"data-headless-title-desc-button":`${g(e.custom_name??e.title)}##image`,"data-headless-sku":e.sku??e.id,children:a(m,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):e?.href?a(q,{href:A(e.href,y(n,c)),"data-headless-type-name":`${n}#${c}`,"data-headless-title-desc-button":`${g(e.custom_name??e.title)}##image`,"data-headless-sku":e.sku??e.id,children:a(m,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}):a(m,{source:e.imageUrl,alt:e.imageAlt||e.title,className:"lg-desktop:size-[175px] aspect-square size-[124px] ",imgClassName:"object-contain"})}),p("div",{className:"flex grow flex-col justify-start gap-4",children:[a(U,{as:"h3",size:2,className:t("text-info-primary line-clamp-2",s?.title),html:e.custom_name??e.title}),p("div",{className:t("flex flex-wrap items-center gap-1",s?.priceWrapper),children:[a(d,{as:"span",size:2,className:t("text-info-primary lg-desktop:text-[24px] whitespace-nowrap text-[20px]",s?.currentPrice),children:e.currentPrice.formatted}),z&&e.originalPrice&&e.originalPrice.value>e.currentPrice.value&&a(d,{as:"span",size:2,className:t("text-info-quaternary lg-desktop:text-[24px] whitespace-nowrap text-[20px] line-through",s?.originalPrice),children:e.originalPrice.formatted})]}),e?.priceLabel&&a(d,{size:4,className:t("text-marketing-1 desktop:text-[16px] lg-desktop:text-[18px] mt-2 text-[14px]",s?.productPriceLabel),children:e.priceLabel})]})]})});f.displayName="SceneShelf.ProductCard";export{f as SceneProductCard};
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as s}from"react/jsx-runtime";import*as n from"react";import{Swiper as K,SwiperSlide as Q}from"swiper/react";import{FreeMode as U,Mousewheel as X}from"swiper/modules";import{cn as r}from"../../helpers/index.js";import{Heading as Y,Button as C,Text as d}from"../../components/index.js";import{buildSsrSlideCss as ee}from"../SwiperBox/buildSsrSlideCss.js";import{useSceneShelfContext as te}from"./context.js";import"swiper/css";const k=n.forwardRef(({title:y,totalPriceLabel:v,totalCurrentPrice:D,totalOriginalPrice:F,primaryButtonText:M,primaryButtonFun:A,secondaryButtonText:R,secondaryButtonFun:z,bundleDiscountLabel:H,className:O,children:V,..._},j)=>{const e=te(),a=e?.classNames,P=v??e?.totalPriceLabel??"Total Price:",l=D??e?.totalCurrentPrice,u=F??e?.totalOriginalPrice,w=M??e?.primaryButtonText??"Shop Now",g=A??e?.primaryButtonFun??"buyNow",b=R??e?.secondaryButtonText??"Add to Cart",h=z??e?.secondaryButtonFun??"addCart",c=H??e?.bundleDiscountLabel,i=e?.selectedProducts??[],E=e?.onLearnMore,I=e?.onShopNow,$=e?.onAddToCart,q=e?.showOriginalPrice??!0,[G,W]=n.useState(!1),[Z,J]=n.useState(!1),B=n.Children.toArray(V),S=B.length,p=n.useMemo(()=>({0:{slidesPerView:1.5,spaceBetween:10},768:{slidesPerView:2.8,spaceBetween:16},1024:{slidesPerView:2.3,spaceBetween:10},1440:{slidesPerView:S<=3?3:3.2,spaceBetween:16}}),[S]),m=`swiper-ssr-${n.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,x=n.useMemo(()=>ee(`.${m}`,p),[m,p]),T=async(o,f)=>{if(!o)return;const L=f==="primary"?W:J;L(!0);try{switch(o){case"buyNow":await I?.(i);break;case"addCart":await $?.(i);break;case"learnMore":await E?.(i);break;default:break}}finally{L(!1)}},N=o=>o==="learnMore"?!1:i.length===0;return s("div",{ref:j,className:r("bg-container-primary laptop:p-6 lg-desktop:p-8 flex min-w-0 flex-1 flex-col justify-between overflow-hidden p-4",O,a?.content),..._,children:[y&&t(Y,{as:"h2",size:3,className:r("text-info-primary flex-0 mb-[16px] line-clamp-1 shrink-0",a?.title),html:y}),s("div",{className:r("lg-desktop:mb-[24px] mb-[16px] flex-1 ",a?.productList),children:[x&&t("style",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:x}}),t(K,{modules:[U,X],freeMode:!0,mousewheel:{forceToAxis:!0},className:x?m:void 0,breakpoints:p,children:B.map((o,f)=>t(Q,{className:"h-fit shrink-0",children:o},f))})]}),s("div",{className:r("tablet:items-end tablet:flex-row flex-0 flex flex-col items-start justify-between gap-2",a?.footer),children:[s("div",{className:"flex flex-col",children:[s("div",{className:r("flex flex-wrap items-center gap-1",a?.totalPrice),children:[P&&t(d,{as:"span",size:2,className:"text-info-primary lg-desktop:text-[24px] text-[20px]",children:P}),l&&t(d,{as:"span",size:2,className:r("text-info-primary lg-desktop:text-[24px] text-[20px]",a?.currentTotalPrice),children:l.formatted}),q&&u&&l&&u.value>l.value&&t(d,{as:"span",size:2,className:r("text-info-quaternary lg-desktop:text-[24px] text-[20px] line-through",a?.originalTotalPrice),children:u.formatted})]}),c&&t(d,{as:"span",size:2,className:r("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 text-[14px]",a?.bundleDiscountLabel),children:typeof c=="function"?c(i):c})]}),s("div",{className:r("flex items-stretch gap-3",a?.buttonGroup),children:[b&&t(C,{variant:"secondary",className:"min-w-0 whitespace-normal text-center",onClick:()=>T(h,"secondary"),disabled:N(h),loading:Z,children:b}),w&&t(C,{variant:"primary",className:"min-w-0 whitespace-normal text-center",onClick:()=>T(g,"primary"),disabled:N(g),loading:G,children:w})]})]})]})});k.displayName="SceneShelf.ProductsPanel";export{k as SceneShelfProductsPanel};
1
+ "use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import*as r from"react";import{Swiper as X,SwiperSlide as Y}from"swiper/react";import{FreeMode as ee,Mousewheel as te}from"swiper/modules";import{cn as n}from"../../helpers/index.js";import{Heading as ae,Button as D,Text as u}from"../../components/index.js";import{buildSsrSlideCss as ne}from"../SwiperBox/buildSsrSlideCss.js";import{useSceneShelfContext as oe,useSceneShelfRootInfo as se}from"./context.js";import{toPlainTrackingText as h}from"../../shared/track.js";const re="shelf",ie="scene_shelf";import"swiper/css";const F=r.forwardRef(({title:p,totalPriceLabel:M,totalCurrentPrice:A,totalOriginalPrice:R,primaryButtonText:$,primaryButtonFun:z,secondaryButtonText:H,secondaryButtonFun:O,bundleDiscountLabel:I,className:V,children:_,...j},E)=>{const e=oe(),w=se(),a=e?.classNames,b=M??e?.totalPriceLabel??"Total Price:",c=A??e?.totalCurrentPrice,m=R??e?.totalOriginalPrice,f=$??e?.primaryButtonText??"Shop Now",T=z??e?.primaryButtonFun??"buyNow",x=H??e?.secondaryButtonText??"Add to Cart",B=O??e?.secondaryButtonFun??"addCart",d=I??e?.bundleDiscountLabel,s=e?.selectedProducts??[],q=e?.onLearnMore,G=e?.onShopNow,W=e?.onAddToCart,Z=e?.showOriginalPrice??!0,[J,K]=r.useState(!1),[Q,U]=r.useState(!1),S=r.Children.toArray(_),N=S.length,y=r.useMemo(()=>({0:{slidesPerView:1.5,spaceBetween:10},768:{slidesPerView:2.8,spaceBetween:16},1024:{slidesPerView:2.3,spaceBetween:10},1440:{slidesPerView:N<=3?3:3.2,spaceBetween:16}}),[N]),P=`swiper-ssr-${r.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,g=r.useMemo(()=>ne(`.${P}`,y),[P,y]),k=async(o,i)=>{if(!o)return;const C=i==="primary"?K:U;C(!0);try{switch(o){case"buyNow":await G?.(s);break;case"addCart":await W?.(s);break;case"learnMore":await q?.(s);break;default:break}}finally{C(!1)}},L=o=>({"data-headless-type-name":`${re}#${ie}`,"data-headless-title-desc-button":`${h(w?.title??p)}#${h(w?.subtitle)}#${h(o)}`,"data-headless-nav-position":"#1",...s.length>0?{"data-headless-sku":s.map(i=>i.sku??i.id).join(",")}:{}}),v=o=>o==="learnMore"?!1:s.length===0;return l("div",{ref:E,className:n("bg-container-primary laptop:p-6 lg-desktop:p-8 flex min-w-0 flex-1 flex-col justify-between overflow-hidden p-4",V,a?.content),...j,children:[p&&t(ae,{as:"h2",size:3,className:n("text-info-primary flex-0 mb-[16px] line-clamp-1 shrink-0",a?.title),html:p}),l("div",{className:n("lg-desktop:mb-[24px] mb-[16px] flex-1 ",a?.productList),children:[g&&t("style",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:g}}),t(X,{modules:[ee,te],freeMode:!0,mousewheel:{forceToAxis:!0},className:g?P:void 0,breakpoints:y,children:S.map((o,i)=>t(Y,{className:"h-fit shrink-0",children:o},i))})]}),l("div",{className:n("tablet:items-end tablet:flex-row flex-0 flex flex-col items-start justify-between gap-2",a?.footer),children:[l("div",{className:"flex flex-col",children:[l("div",{className:n("flex flex-wrap items-center gap-1",a?.totalPrice),children:[b&&t(u,{as:"span",size:2,className:"text-info-primary lg-desktop:text-[24px] text-[20px]",children:b}),c&&t(u,{as:"span",size:2,className:n("text-info-primary lg-desktop:text-[24px] text-[20px]",a?.currentTotalPrice),children:c.formatted}),Z&&m&&c&&m.value>c.value&&t(u,{as:"span",size:2,className:n("text-info-quaternary lg-desktop:text-[24px] text-[20px] line-through",a?.originalTotalPrice),children:m.formatted})]}),d&&t(u,{as:"span",size:2,className:n("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 text-[14px]",a?.bundleDiscountLabel),children:typeof d=="function"?d(s):d})]}),l("div",{className:n("flex items-stretch gap-3",a?.buttonGroup),children:[x&&t(D,{variant:"secondary",className:"min-w-0 whitespace-normal text-center",onClick:()=>k(B,"secondary"),...L(x),disabled:v(B),loading:Q,children:x}),f&&t(D,{variant:"primary",className:"min-w-0 whitespace-normal text-center",onClick:()=>k(T,"primary"),...L(f),disabled:v(T),loading:J,children:f})]})]})]})});F.displayName="SceneShelf.ProductsPanel";export{F as SceneShelfProductsPanel};
@@ -1 +1 @@
1
- "use client";import{jsx as a,jsxs as m}from"react/jsx-runtime";import*as f from"react";import{cn as t}from"../../helpers/index.js";import{Heading as p,Text as h}from"../../components/index.js";const o=f.forwardRef(({title:i,subtitle:r,theme:n="light",classNames:e,className:c,children:l,...s},d)=>m("div",{ref:d,className:t("text-info-primary w-full",{"aiui-dark":n==="dark"},c,e?.root),...s,children:[(i||r)&&m("div",{className:t("mb-6",e?.header),children:[i&&a(p,{as:"h2",size:4,className:t("text-info-primary mb-2",e?.title),html:i}),r&&a(h,{as:"p",size:3,className:t("",e?.subtitle),html:r})]}),a("div",{className:t("space-y-6",e?.sceneList),children:l})]}));o.displayName="SceneShelf.Root";export{o as SceneShelfRoot};
1
+ "use client";import{jsx as i,jsxs as c}from"react/jsx-runtime";import*as r from"react";import{cn as n}from"../../helpers/index.js";import{Heading as S,Text as v}from"../../components/index.js";import{useExposure as R}from"../../hooks/useExposure.js";import{SceneShelfRootInfoContext as u}from"./context.js";const x="shelf",T="scene_shelf",a=r.forwardRef(({title:e,subtitle:o,theme:s="light",classNames:t,className:f,children:l,...p},d)=>{const m=r.useRef(null);r.useImperativeHandle(d,()=>m.current),R(m,{componentType:x,componentName:T,componentTitle:e,componentDescription:o});const h=r.useMemo(()=>({title:e,subtitle:o}),[e,o]);return i(u.Provider,{value:h,children:c("div",{ref:m,className:n("text-info-primary w-full",{"aiui-dark":s==="dark"},f,t?.root),...p,children:[(e||o)&&c("div",{className:n("mb-6",t?.header),children:[e&&i(S,{as:"h2",size:4,className:n("text-info-primary mb-2",t?.title),html:e}),o&&i(v,{as:"p",size:3,className:n("",t?.subtitle),html:o})]}),i("div",{className:n("space-y-6",t?.sceneList),children:l})]})})});a.displayName="SceneShelf.Root";export{a as SceneShelfRoot};
@@ -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
- export { SceneShelfContext };
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 client";import*as e from"react";const t=e.createContext(null);function o(){return e.useContext(t)}export{t as SceneShelfContext,o as useSceneShelfContext};
1
+ "use client";import*as e from"react";const t=e.createContext(null);function n(){return e.useContext(t)}const o=e.createContext(null);function r(){return e.useContext(o)}export{t as SceneShelfContext,o as SceneShelfRootInfoContext,n as useSceneShelfContext,r as useSceneShelfRootInfo};
@@ -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
- import{Fragment as Te,jsx as s,jsxs as u}from"react/jsx-runtime";import{useAiuiContext as Ce}from"../AiuiProvider/index.js";import{formatVariantPrice as Be}from"./shelfDisplay.js";import _e from"../../components/picture.js";import Se from"../../components/badge.js";import{cn as w}from"../../helpers/utils.js";import{Text as Ne}from"../../components/text.js";import fe from"../../components/button.js";import{gaTrack as Pe}from"../../shared/track.js";import{trackUrlRef as Le}from"../../shared/trackUrlRef.js";import{Heading as $e}from"../../components/heading.js";import{useExposure as De}from"../../hooks/useExposure.js";import{useRef as Ie,useEffect as ze,useMemo as ye,useState as E}from"react";const ge="image",he="product_shelf",xe=999999999e-2,Ae=e=>{const t=e?.sku,_=e?.variants,O=_?.find(j=>j?.sku===t),K=O?.image?.url||_?.[0]?.image?.url||"",re=O?.image?.altText||_?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:K,altText:re}},Fe=({items:e})=>e?.length?s("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,_)=>typeof t.icon=="string"?s("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},_):s(Ne,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},_))}):null,Ke=({data:e,configuration:t})=>{const{isDisplayBackImage:_=!1,itemShape:O,metafields:K,isTopTag:re=!1,isShowTag:j,isShowOriginalPrice:$,isShowShortTitle:ve=!1,isShowPricesTag:D=!1,pricesTagTextColor:W,pricesTagBgColor:H,itemsTagTextColor:v,itemsTagBgColor:Q,formatPrice:ie,renderOriginalPrice:X,renderPriceLabel:be,renderPrice:U}=t||{},{locale:N="es",copyWriting:oe,currencyDisplay:Y}=Ce(),{discounts:Z,discountsCopy:le}=K||{},ne=Ie(null),[n,ae]=E([]),[ce,I]=E(""),[pe,z]=E(!1),[b,R]=E(!1),me=(i,p,m,d)=>{const{primaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:we}=t||{};if(x){if(x==="AddCart"&&S)return S(i,p+1,m,d);if(x==="BuyNow"&&te)return te(i,p+1,m,d);if(x==="LearnMore"&&se)return se(i,p+1,m,d)}we?.primaryButton?.(i,p+1,m,d)},ke=(i,p,m,d)=>{const{secondaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:we}=t||{};if(x){if(x==="AddCart"&&S)return S(i,p+1,m,d);if(x==="BuyNow"&&te)return te(i,p+1,m,d);if(x==="LearnMore"&&se)return se(i,p+1,m,d)}we?.secondaryButton?.(i,p+1,m,d)},o=ye(()=>{const i=e?.variants||[];if(i.length)return e?.sku?i?.find?.(p=>p?.sku===e?.sku)||i[0]:i?.[0]},[e?.sku,e?.variants]),A=o?.id?.split?.("/")||[],T=A?.[A?.length-1],y=!o?.availableForSale||o?.price?.amount===xe||o?.price===xe,k=o?.coupons?.[0],de=e?.price?.currencyCode||"USD",q=ye(()=>Be({locale:N,amount:k?k?.variant_price4wscode:o?.price,baseAmount:k?o?.price:0,currencyCode:de,currencyDisplay:Y,customFormatPrice:ie}),[de,N,k,Y,o,ie]),{price:F,basePrice:C,discount:B,discountAmount:M}=q,{imageUrl:V,altText:ue}=Ae(e),G=e?.custom_name||e?.title,P=ve&&o?.metafields?.infos?.page_short_title||G,ee=e?.custom_description||e?.description,r=()=>{if(k?.value_type==="fixed_amount"){const i=M||"",p=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(p){const[,m,d,x]=p;let S=d;return d.endsWith(".00")?S=d.replace(/\.00$/,""):d.endsWith(",00")&&(S=d.replace(/,00$/,"")),`${m}${S}${x}`}return i}return B||""};ze(()=>{let i=[];if(B||M){const m=`${r()} ${Z?.off||le?.off||""}`;I(m)}const p=e?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,B&&D?1:2)||[];ae(i.concat(p))},[e?.tags,B,M,D,Z?.off,le?.off]),De(ne,{componentType:ge,componentName:he,componentTitle:G,componentDescription:ee,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){z(!0);try{await me(e,t?.index,t,k)}finally{z(!1)}}},a=async()=>{if(!b&&!e?.custom_secondary_link){R(!0);try{await ke(e,t?.index,t,k)}finally{R(!1)}}},c=()=>u("div",{className:"shelf-display-product-content desktop:gap-6 flex flex-1 flex-col justify-between gap-4",children:[u("div",{className:"shelf-display-product-content-title-desc",children:[P?s($e,{as:"h3",title:P||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:P||""}):null,s(Ne,{size:2,className:w("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:ee||""})]}),u("div",{className:"shelf-display-product-content-price-button",children:[s("div",{className:"mb-2 flex flex-wrap items-center",children:U?U(e,{price:F,basePrice:C,discount:B,discountAmount:M,variant:o,coupon:k,isSoldOut:y,isShowOriginalPrice:$}):y?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:oe?.soldOutText}):u(Te,{children:[s("div",{className:"final-price lg-desktop:text-2xl text-info-primary whitespace-nowrap text-xl font-bold !leading-[1.2]",children:o?.availableForSale&&F||""}),X?X(e,{price:F,basePrice:C,discount:B,discountAmount:M,isShowOriginalPrice:$}):C&&$&&s("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&&C||""})]})}),!U&&be?.(e,o,{isShowOriginalPrice:$}),u("div",{className:w("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!y?s(fe,{disabled:y&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:a,loading:b,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(fe,{disabled:y&&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]})]})]}),f={...W?{color:W}:{},...H?{backgroundColor:H,backgroundImage:"none"}:{},...W||H?{outline:"none"}:{}},g={...v?{color:v}:{},...Q?{backgroundColor:Q,backgroundImage:"none"}:{},...v||Q?{outlineColor:v}:{}},L=()=>u("div",{className:"lg-desktop:min-h-[28px] box-border flex min-h-6 flex-wrap gap-1 overflow-hidden",children:[D&&ce&&s(Se,{className:"shelf-prices-tag",variant:"fill",style:f,children:ce||""}),j&&n?.length>0&&n?.map?.((i,p)=>s(Se,{className:"shelf-items-tag",variant:"outline",style:g,children:i},p))]}),h=e?.custom_bg_image,J=e?.custom_theme;return s("div",{ref:ne,className:w("shelf-display-item box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300","rounded-box relative",h?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":J==="dark","aiui-light":J==="light"}),style:h?{backgroundImage:`url(${h})`}:void 0,children:_?u(Te,{children:[s(_e,{source:V,alt:ue,className:w("absolute inset-0 size-full",{"opacity-0":h}),imgClassName:"size-full object-cover"}),u("div",{className:"desktop:p-6 relative flex flex-1 flex-col p-4",children:[s(L,{}),c()]})]}):u("div",{className:"desktop:gap-2 desktop:p-6 desktop:pt-4 flex flex-1 flex-col gap-1 p-4",children:[s(L,{}),u("div",{className:w("shelf-display-item-image lg-desktop:size-[240px] relative mx-auto size-[180px] overflow-hidden",{"opacity-0":h}),children:[s("a",{"aria-label":G,target:t?.target,href:Le(`${N==="us"||!N?"":`/${N}`}/products/${e?.handle}?variant=${T}`,`${ge}_${he}`),onClick:()=>{Pe({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:s(_e,{source:V,alt:ue,className:"size-full",imgClassName:"size-full object-cover"})}),s(Fe,{items:e?.socialEndorsements})]}),c()]})},e?.id||e?.handle)},Qe=({data:e,configuration:t})=>{const{itemShape:_,itemLength:O,metafields:K,isShowShortTitle:re,formatPrice:j,renderOriginalPrice:$,renderPriceLabel:ve,renderPrice:D}=t||{},{discounts:W,discountsCopy:H}=K||{},{locale:v="us",copyWriting:Q,currencyDisplay:ie}=Ce(),[X,be]=E([]),U=Ie(null),[N,oe]=E(!1),[Y,Z]=E(!1),le=(r,l,a,c)=>{const{primaryFun:f,onAddCart:g,onBuyNow:L,onLearnMore:h,event:J}=t||{};if(f){if(f==="AddCart"&&g)return g(r,l+1,a,c);if(f==="BuyNow"&&L)return L(r,l+1,a,c);if(f==="LearnMore"&&h)return h(r,l+1,a,c)}J?.primaryButton?.(r,l+1,a,c)},ne=(r,l,a,c)=>{const{secondaryFun:f,onAddCart:g,onBuyNow:L,onLearnMore:h,event:J}=t||{};if(f){if(f==="AddCart"&&g)return g(r,l+1,a,c);if(f==="BuyNow"&&L)return L(r,l+1,a,c);if(f==="LearnMore"&&h)return h(r,l+1,a,c)}J?.secondaryButton?.(r,l+1,a,c)},n=ye(()=>{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],I=!n?.availableForSale||n?.price?.amount===xe||n?.price===xe,pe=t?.isShowTag,z=t?.isShowOriginalPrice,b=n?.coupons?.[0],R=!!(z&&b),me=e?.price?.currencyCode||"USD",ke=ye(()=>Be({locale:v,amount:R?b?.variant_price4wscode:n?.price,baseAmount:R?n?.price:0,currencyCode:me,currencyDisplay:ie,customFormatPrice:j}),[me,v,R,b?.variant_price4wscode,n,j]),{price:o,basePrice:A,discount:T,discountAmount:y}=ke,{imageUrl:k,altText:de}=Ae(e),q=e?.custom_name||e?.title,F=re&&n?.metafields?.infos?.page_short_title||q,C=e?.custom_description||e?.description;De(U,{componentType:ge,componentName:he,componentTitle:q,componentDescription:C,position:t?.index+1});const B=async()=>{if(!N&&!e?.custom_primary_link){oe(!0);try{await le(e,t?.index,t,b)}finally{oe(!1)}}},M=async()=>{if(!Y&&!e?.custom_secondary_link){Z(!0);try{await ne(e,t?.index,t,b)}finally{Z(!1)}}},V=()=>O>=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=()=>O>=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(b?.value_type==="fixed_amount"){const r=y||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,a,c,f]=l;let g=c;return c.endsWith(".00")?g=c.replace(/\.00$/,""):c.endsWith(",00")&&(g=c.replace(/,00$/,"")),`${a}${g}${f}`}return r}return T||""};ze(()=>{let r=[];if(T||y){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,T?1:2)||[];be(r.concat(l))},[e?.tags,T,y,W?.off,H?.off]);const P=e?.custom_bg_image,ee=e?.custom_theme;return s("div",{ref:U,className:w(V().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",P?"bg-cover bg-center bg-no-repeat":"bg-container-secondary-1 tablet:hover:bg-info-white",{"aiui-dark":ee==="dark","aiui-light":ee==="light"}),style:P?{backgroundImage:`url(${P})`}:void 0,children:u("div",{className:w(ue(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[s("div",{className:w(V().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":P}),children:s("a",{"aria-label":q,target:t?.target,href:Le(`${v==="us"||!v?"":`/${v}`}/products/${e?.handle}?variant=${ce}`,`${ge}_${he}`),onClick:()=>{Pe({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:s(_e,{source:k,alt:de,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),u("div",{className:w("flex flex-col items-start justify-center",V().boxItem),children:[pe&&s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:X?.length>0&&X?.map?.((r,l)=>s(Se,{className:"shelf-items-tag",variant:"fill",children:r},l))}),F?s($e,{as:"h3",title:F||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:F||""}):null,C?s(Ne,{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:C||""}):null,s("div",{className:"mb-2 mt-5 flex flex-wrap items-center",children:D?D(e,{price:o,basePrice:A,discount:T,discountAmount:y,variant:n,coupon:b,isSoldOut:I,isShowOriginalPrice:z}):I?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:Q?.soldOutText}):u(Te,{children:[s("div",{className:"final-price tablet:text-xl text-info-primary whitespace-nowrap text-xl font-bold",children:n?.availableForSale&&o||""}),$?$(e,{price:o,basePrice:A,discount:T,discountAmount:y,isShowOriginalPrice:z}):A&&s("div",{className:"origin-price tablet:text-xl text-info-quaternary ml-1 whitespace-nowrap text-lg font-bold line-through",children:n?.availableForSale&&A||""})]})}),!D&&ve?.(e,n,{isShowOriginalPrice:z}),u("div",{className:w("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!I?s(fe,{disabled:I&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:M,loading:Y,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(fe,{disabled:I&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:B,loading:N,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};export{Qe as ShelfDisplayHorizontalItem,Ke as ShelfDisplayWrapItem,Ae as getProductImage};
1
+ import{Fragment as Ce,jsx as s,jsxs as u}from"react/jsx-runtime";import{useAiuiContext as Be}from"../AiuiProvider/index.js";import{formatVariantPrice as Pe}from"./shelfDisplay.js";import Se from"../../components/picture.js";import Te from"../../components/badge.js";import{cn as _}from"../../helpers/utils.js";import{Text as Ne}from"../../components/text.js";import ye from"../../components/button.js";import{gaTrack as Le}from"../../shared/track.js";import{trackUrlRef as De}from"../../shared/trackUrlRef.js";import{Heading as Ie}from"../../components/heading.js";import{useExposure as $e}from"../../hooks/useExposure.js";import{useRef as ze,useEffect as Ae,useMemo as ge,useState as E}from"react";import{useTracking as Fe}from"../../hooks/useTracking.js";const he="image",xe="product_shelf",ve=999999999e-2,Me=e=>{const t=e?.sku,v=e?.variants,G=v?.find(re=>re?.sku===t),J=G?.image?.url||v?.[0]?.image?.url||"",K=G?.image?.altText||v?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:J,altText:K}},Ee=({items:e})=>e?.length?s("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,v)=>typeof t.icon=="string"?s("img",{src:t.icon,alt:t.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},v):s(Ne,{"aria-label":t.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:t.icon},v))}):null,Ye=({data:e,configuration:t})=>{const{buildRef:v}=Fe(),{isDisplayBackImage:G=!1,itemShape:J,metafields:K,isTopTag:re=!1,isShowTag:ie,isShowOriginalPrice:D,isShowShortTitle:be=!1,isShowPricesTag:I=!1,pricesTagTextColor:O,pricesTagBgColor:j,itemsTagTextColor:b,itemsTagBgColor:Q,formatPrice:oe,renderOriginalPrice:X,renderPriceLabel:ke,renderPrice:W}=t||{},{locale:T="es",copyWriting:le,currencyDisplay:Y}=Be(),{discounts:Z,discountsCopy:ne}=K||{},ae=ze(null),[n,ce]=E([]),[me,$]=E(""),[pe,z]=E(!1),[k,H]=E(!1),de=(i,m,p,d)=>{const{primaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:_e}=t||{};if(x){if(x==="AddCart"&&S)return S(i,m+1,p,d);if(x==="BuyNow"&&te)return te(i,m+1,p,d);if(x==="LearnMore"&&se)return se(i,m+1,p,d)}_e?.primaryButton?.(i,m+1,p,d)},we=(i,m,p,d)=>{const{secondaryFun:x,onAddCart:S,onBuyNow:te,onLearnMore:se,event:_e}=t||{};if(x){if(x==="AddCart"&&S)return S(i,m+1,p,d);if(x==="BuyNow"&&te)return te(i,m+1,p,d);if(x==="LearnMore"&&se)return se(i,m+1,p,d)}_e?.secondaryButton?.(i,m+1,p,d)},o=ge(()=>{const i=e?.variants||[];if(i.length)return e?.sku?i?.find?.(m=>m?.sku===e?.sku)||i[0]:i?.[0]},[e?.sku,e?.variants]),A=o?.id?.split?.("/")||[],N=A?.[A?.length-1],y=!o?.availableForSale||o?.price?.amount===ve||o?.price===ve,w=o?.coupons?.[0],ue=e?.price?.currencyCode||"USD",U=ge(()=>Pe({locale:T,amount:w?w?.variant_price4wscode:o?.price,baseAmount:w?o?.price:0,currencyCode:ue,currencyDisplay:Y,customFormatPrice:oe}),[ue,T,w,Y,o,oe]),{price:F,basePrice:C,discount:B,discountAmount:M}=U,{imageUrl:R,altText:fe}=Me(e),q=e?.custom_name||e?.title,P=be&&o?.metafields?.infos?.page_short_title||q,ee=e?.custom_description||e?.description,r=()=>{if(w?.value_type==="fixed_amount"){const i=M||"",m=i.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(m){const[,p,d,x]=m;let S=d;return d.endsWith(".00")?S=d.replace(/\.00$/,""):d.endsWith(",00")&&(S=d.replace(/,00$/,"")),`${p}${S}${x}`}return i}return B||""};Ae(()=>{let i=[];if(B||M){const p=`${r()} ${Z?.off||ne?.off||""}`;$(p)}const m=e?.tags?.filter?.(p=>p?.startsWith?.("CLtag"))?.map?.(p=>p?.replace?.("CLtag:",""))?.slice?.(0,B&&I?1:2)||[];ce(i.concat(m))},[e?.tags,B,M,I,Z?.off,ne?.off]),$e(ae,{componentType:he,componentName:xe,componentTitle:q,componentDescription:ee,position:t?.index+1});const l=async()=>{if(!pe&&!e?.custom_primary_link){z(!0);try{await de(e,t?.index,t,w)}finally{z(!1)}}},a=async()=>{if(!k&&!e?.custom_secondary_link){H(!0);try{await we(e,t?.index,t,w)}finally{H(!1)}}},c=()=>u("div",{className:"shelf-display-product-content desktop:gap-6 flex flex-1 flex-col justify-between gap-4",children:[u("div",{className:"shelf-display-product-content-title-desc",children:[P?s(Ie,{as:"h3",title:P||"",size:2,className:"shelf-display-product-title text-info-primary mb-1 line-clamp-2",html:P||""}):null,s(Ne,{size:2,className:_("lg-desktop:text-lg desktop:text-base shelf-display-product-description text-info-primary line-clamp-2 text-sm !leading-[1.4]"),html:ee||""})]}),u("div",{className:"shelf-display-product-content-price-button",children:[s("div",{className:"mb-2 flex flex-wrap items-center",children:W?W(e,{price:F,basePrice:C,discount:B,discountAmount:M,variant:o,coupon:w,isSoldOut:y,isShowOriginalPrice:D}):y?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:le?.soldOutText}):u(Ce,{children:[s("div",{className:"final-price lg-desktop:text-2xl text-info-primary whitespace-nowrap text-xl font-bold !leading-[1.2]",children:o?.availableForSale&&F||""}),X?X(e,{price:F,basePrice:C,discount:B,discountAmount:M,isShowOriginalPrice:D}):C&&D&&s("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&&C||""})]})}),!W&&ke?.(e,o,{isShowOriginalPrice:D}),u("div",{className:_("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!y?s(ye,{disabled:y&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:a,loading:k,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(ye,{disabled:y&&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]})]})]}),f={...O?{color:O}:{},...j?{backgroundColor:j,backgroundImage:"none"}:{},...O||j?{outline:"none"}:{}},g={...b?{color:b}:{},...Q?{backgroundColor:Q,backgroundImage:"none"}:{},...b||Q?{outlineColor:b}:{}},L=()=>u("div",{className:"lg-desktop:min-h-[28px] box-border flex min-h-6 flex-wrap gap-1 overflow-hidden",children:[I&&me&&s(Te,{className:"shelf-prices-tag",variant:"fill",style:f,children:me||""}),ie&&n?.length>0&&n?.map?.((i,m)=>s(Te,{className:"shelf-items-tag",variant:"outline",style:g,children:i},m))]}),h=e?.custom_bg_image,V=e?.custom_theme;return s("div",{ref:ae,className:_("shelf-display-item box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300","rounded-box relative",h?"bg-cover bg-center bg-no-repeat":"bg-background tablet:hover:bg-info-white",{"aiui-dark":V==="dark","aiui-light":V==="light"}),style:h?{backgroundImage:`url(${h})`}:void 0,children:G?u(Ce,{children:[s(Se,{source:R,alt:fe,className:_("absolute inset-0 size-full",{"opacity-0":h}),imgClassName:"size-full object-cover"}),u("div",{className:"desktop:p-6 relative flex flex-1 flex-col p-4",children:[s(L,{}),c()]})]}):u("div",{className:"desktop:gap-2 desktop:p-6 desktop:pt-4 flex flex-1 flex-col gap-1 p-4",children:[s(L,{}),u("div",{className:_("shelf-display-item-image lg-desktop:size-[240px] relative mx-auto size-[180px] overflow-hidden",{"opacity-0":h}),children:[s("a",{"aria-label":q,target:t?.target,href:De(`${T==="us"||!T?"":`/${T}`}/products/${e?.handle}?variant=${N}`,v(he,xe)),onClick:()=>{Le({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:s(Se,{source:R,alt:fe,className:"size-full",imgClassName:"size-full object-cover"})}),s(Ee,{items:e?.socialEndorsements})]}),c()]})},e?.id||e?.handle)},Ze=({data:e,configuration:t})=>{const{buildRef:v}=Fe(),{itemShape:G,itemLength:J,metafields:K,isShowShortTitle:re,formatPrice:ie,renderOriginalPrice:D,renderPriceLabel:be,renderPrice:I}=t||{},{discounts:O,discountsCopy:j}=K||{},{locale:b="us",copyWriting:Q,currencyDisplay:oe}=Be(),[X,ke]=E([]),W=ze(null),[T,le]=E(!1),[Y,Z]=E(!1),ne=(r,l,a,c)=>{const{primaryFun:f,onAddCart:g,onBuyNow:L,onLearnMore:h,event:V}=t||{};if(f){if(f==="AddCart"&&g)return g(r,l+1,a,c);if(f==="BuyNow"&&L)return L(r,l+1,a,c);if(f==="LearnMore"&&h)return h(r,l+1,a,c)}V?.primaryButton?.(r,l+1,a,c)},ae=(r,l,a,c)=>{const{secondaryFun:f,onAddCart:g,onBuyNow:L,onLearnMore:h,event:V}=t||{};if(f){if(f==="AddCart"&&g)return g(r,l+1,a,c);if(f==="BuyNow"&&L)return L(r,l+1,a,c);if(f==="LearnMore"&&h)return h(r,l+1,a,c)}V?.secondaryButton?.(r,l+1,a,c)},n=ge(()=>{const r=e?.variants||[];if(r.length)return e?.sku&&r.find(l=>l?.sku===e?.sku)||r[0]},[e?.sku,e?.variants]),ce=n?.id?.split?.("/")||[],me=ce?.[ce?.length-1],$=!n?.availableForSale||n?.price?.amount===ve||n?.price===ve,pe=t?.isShowTag,z=t?.isShowOriginalPrice,k=n?.coupons?.[0],H=!!(z&&k),de=e?.price?.currencyCode||"USD",we=ge(()=>Pe({locale:b,amount:H?k?.variant_price4wscode:n?.price,baseAmount:H?n?.price:0,currencyCode:de,currencyDisplay:oe,customFormatPrice:ie}),[de,b,H,k?.variant_price4wscode,n,ie]),{price:o,basePrice:A,discount:N,discountAmount:y}=we,{imageUrl:w,altText:ue}=Me(e),U=e?.custom_name||e?.title,F=re&&n?.metafields?.infos?.page_short_title||U,C=e?.custom_description||e?.description;$e(W,{componentType:he,componentName:xe,componentTitle:U,componentDescription:C,position:t?.index+1});const B=async()=>{if(!T&&!e?.custom_primary_link){le(!0);try{await ne(e,t?.index,t,k)}finally{le(!1)}}},M=async()=>{if(!Y&&!e?.custom_secondary_link){Z(!0);try{await ae(e,t?.index,t,k)}finally{Z(!1)}}},R=()=>J>=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=()=>J>=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",q=()=>{if(k?.value_type==="fixed_amount"){const r=y||"",l=r.match(/^(.*?)(\d[\d.,]*)(.*)$/);if(l){const[,a,c,f]=l;let g=c;return c.endsWith(".00")?g=c.replace(/\.00$/,""):c.endsWith(",00")&&(g=c.replace(/,00$/,"")),`${a}${g}${f}`}return r}return N||""};Ae(()=>{let r=[];if(N||y){const a=`${q()} ${O?.off||j?.off||""}`;r.push(a)}const l=e?.tags?.filter?.(a=>a?.startsWith?.("CLtag"))?.map?.(a=>a?.replace?.("CLtag:",""))?.slice?.(0,N?1:2)||[];ke(r.concat(l))},[e?.tags,N,y,O?.off,j?.off]);const P=e?.custom_bg_image,ee=e?.custom_theme;return s("div",{ref:W,className:_(R().wrap,"rounded-box","shelf-display-item","duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden",P?"bg-cover bg-center bg-no-repeat":"bg-container-secondary-1 tablet:hover:bg-info-white",{"aiui-dark":ee==="dark","aiui-light":ee==="light"}),style:P?{backgroundImage:`url(${P})`}:void 0,children:u("div",{className:_(fe(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[s("div",{className:_(R().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden",{"opacity-0":P}),children:s("a",{"aria-label":U,target:t?.target,href:De(`${b==="us"||!b?"":`/${b}`}/products/${e?.handle}?variant=${me}`,v(he,xe)),onClick:()=>{Le({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:s(Se,{source:w,alt:ue,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),u("div",{className:_("flex flex-col items-start justify-center",R().boxItem),children:[pe&&s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:X?.length>0&&X?.map?.((r,l)=>s(Te,{className:"shelf-items-tag",variant:"fill",children:r},l))}),F?s(Ie,{as:"h3",title:F||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] text-info-primary mb-1 line-clamp-2 h-[48px]",html:F||""}):null,C?s(Ne,{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:C||""}):null,s("div",{className:"mb-2 mt-5 flex flex-wrap items-center",children:I?I(e,{price:o,basePrice:A,discount:N,discountAmount:y,variant:n,coupon:k,isSoldOut:$,isShowOriginalPrice:z}):$?s("div",{className:"lg-desktop:text-2xl text-info-primary text-xl font-bold",children:Q?.soldOutText}):u(Ce,{children:[s("div",{className:"final-price tablet:text-xl text-info-primary whitespace-nowrap text-xl font-bold",children:n?.availableForSale&&o||""}),D?D(e,{price:o,basePrice:A,discount:N,discountAmount:y,isShowOriginalPrice:z}):A&&s("div",{className:"origin-price tablet:text-xl text-info-quaternary ml-1 whitespace-nowrap text-lg font-bold line-through",children:n?.availableForSale&&A||""})]})}),!I&&be?.(e,n,{isShowOriginalPrice:z}),u("div",{className:_("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton&&!$?s(ye,{disabled:$&&t?.secondaryFun!=="LearnMore",variant:"secondary",href:e?.custom_secondary_link,as:e?.custom_secondary_link?"a":"button",onClick:M,loading:Y,className:t.direction==="vertical"?"w-full":"",children:t?.secondaryButton||""}):null,t?.primaryButton?s(ye,{disabled:$&&t?.primaryFun!=="LearnMore",variant:"primary",href:e?.custom_primary_link,as:e?.custom_primary_link?"a":"button",onClick:B,loading:T,className:t.direction==="vertical"?"w-full":"",children:t?.primaryButton||""}):null]})]})]})},e?.id||e?.handle)};export{Ze as ShelfDisplayHorizontalItem,Ye as ShelfDisplayWrapItem,Me as getProductImage};
@@ -1 +1 @@
1
- "use client";import{Fragment as V,jsx as t,jsxs as o}from"react/jsx-runtime";import n,{useRef as d,useImperativeHandle as D}from"react";import{Button as w,Heading as p,Picture as x,Text as b}from"../../components/index.js";import{cn as i,getLocalizedPath as _}from"../../helpers/utils.js";import{withLayout as P}from"../../shared/Styles.js";import{useExposure as R}from"../../hooks/useExposure.js";import{useAiuiContext as j}from"../AiuiProvider/index.js";import{Swiper as g,SwiperSlide as k}from"swiper/react";import{Navigation as B,EffectCoverflow as M}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import"swiper/css/pagination";import"swiper/css/effect-coverflow";const H="carousel",U="three_d_carousel",I=()=>o("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:[t("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),t("path",{d:"M32 20L24 28L32 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),O=()=>o("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:[t("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),t("path",{d:"M24 20L32 28L24 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),N=n.forwardRef(({data:y,className:S},T)=>{const{title:u,items:a=[],titleTag:C}=y,m=a.length<4?[...a,...a]:a,r=d(null),c=d(null),f=d(null),[L,z]=n.useState(180),{locale:h="us"}=j();return R(c,{componentType:H,componentName:U,componentTitle:u}),D(T,()=>c.current),n.useEffect(()=>{const e=f.current;if(!e)return;const l=()=>{const E=e.offsetWidth,v=Math.round(E*.125);z(v),r.current?.params?.coverflowEffect&&(r.current.params.coverflowEffect.stretch=v,r.current.update())};l();const s=new ResizeObserver(l);return s.observe(e),()=>s.disconnect()},[]),o("section",{ref:c,"data-ui-component-id":"ThreeDCarousel",className:i("three-d-carousel laptop:overflow-hidden w-full overflow-visible",S),children:[t(p,{as:C??"h2",size:4,html:u,className:"three-d-carousel__title laptop:text-center text-left"}),o("div",{ref:f,className:"three-d-carousel__desktop laptop:block relative mx-auto mt-[24px] hidden w-full",children:[t(g,{onSwiper:e=>r.current=e,centeredSlides:!0,initialSlide:0,loop:!0,slidesPerView:"auto",spaceBetween:0,grabCursor:!0,modules:[M,B],slideToClickedSlide:!0,className:"three-d-carousel__swiper rounded-box relative aspect-[1386/502] overflow-visible",effect:"coverflow",coverflowEffect:{rotate:0,stretch:L,depth:300,modifier:1,slideShadows:!0},children:m.map((e,l)=>t(k,{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:s})=>o(V,{children:[t(x,{source:e.imageUrl?.url||"",alt:e.imageUrl?.alt||e.title,className:i("three-d-carousel__image rounded-box mx-auto h-full overflow-hidden"),imgClassName:"h-full object-cover",style:{filter:s?"":"brightness(50%) contrast(120%)"}}),o("div",{className:i("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":!s}),children:[t(p,{as:"h2",size:2,html:e.title}),t(b,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-description lg-desktop:text-[18px] desktop:text-[16px] text-[14px]"}),e.buttonText&&t("a",{href:_(e.buttonLink||"",h),className:"three-d-carousel__image-link ",children:t(w,{size:"base",variant:"secondary",className:"three-d-carousel__image-button desktop:mt-6 mt-4",children:e.buttonText})})]})]})},l))}),o("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:[t("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--prev",onClick:()=>r.current?.slidePrev(),"aria-label":"Previous slide",children:t(I,{})}),t("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--next",onClick:()=>r.current?.slideNext(),"aria-label":"Next slide",children:t(O,{})})]})]}),t("div",{className:"three-d-carousel__mobile laptop:hidden mt-[24px] block w-full overflow-visible",children:t(g,{loop:!0,loopAdditionalSlides:1,slidesPerView:"auto",spaceBetween:12,grabCursor:!0,className:"three-d-carousel__swiper-mobile relative w-full !overflow-visible",children:m.map((e,l)=>o(k,{className:"three-d-carousel__slide-mobile relative !h-[360px] !w-[296px] cursor-grab overflow-hidden",children:[t(x,{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"}),o("div",{className:i("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:[t(p,{as:"h2",size:2,html:e.title}),t(b,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-mobile-description text-[14px]"}),e.buttonText&&t("a",{href:_(e.buttonLink||"",h),className:"three-d-carousel__image-mobile-link ",children:t(w,{size:"base",variant:"secondary",className:"three-d-carousel__image-mobile-button mt-3",children:e.buttonText})})]})]},l))})})]})});N.displayName="ThreeDCarousel";var ee=P(N,{style:"overflow: hidden;"});export{ee as default};
1
+ "use client";import{Fragment as G,jsx as t,jsxs as o}from"react/jsx-runtime";import c,{useRef as d,useImperativeHandle as M}from"react";import{Button as k,Heading as p,Picture as y,Text as N}from"../../components/index.js";import{cn as i,getLocalizedPath as T}from"../../helpers/utils.js";import{withLayout as I}from"../../shared/Styles.js";import{useExposure as U}from"../../hooks/useExposure.js";import{useAiuiContext as $}from"../AiuiProvider/index.js";import{useTracking as O}from"../../hooks/useTracking.js";import{trackUrlRef as V}from"../../shared/trackUrlRef.js";import{toPlainTrackingText as u}from"../../shared/track.js";import{Swiper as S,SwiperSlide as C}from"swiper/react";import{Navigation as W,EffectCoverflow as A}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import"swiper/css/pagination";import"swiper/css/effect-coverflow";const m="carousel",f="three_d_carousel",q=()=>o("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:[t("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),t("path",{d:"M32 20L24 28L32 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),F=()=>o("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:[t("circle",{cx:"28",cy:"28",r:"28",fill:"currentColor",fillOpacity:"0.2"}),t("path",{d:"M24 20L32 28L24 36",stroke:"white",strokeWidth:"2.66667",strokeLinecap:"round",strokeLinejoin:"round"})]}),L=c.forwardRef(({data:z,className:E},R)=>{const{title:h,items:s=[],titleTag:D}=z,v=s.length<4?[...s,...s]:s,r=d(null),n=d(null),x=d(null),[P,j]=c.useState(180),{locale:w="us"}=$(),{buildRef:B}=O(),b=e=>e?V(T(e,w),B(m,f)):T("",w),g=e=>e.buttonLink?{"data-headless-type-name":`${m}#${f}`,"data-headless-title-desc-button":`${u(e.title)}#${u(e.description)}#${u(e.buttonText)}`,"data-headless-nav-position":`#${s.indexOf(e)+1}`}:{};return U(n,{componentType:m,componentName:f,componentTitle:h}),M(R,()=>n.current),c.useEffect(()=>{const e=x.current;if(!e)return;const l=()=>{const H=e.offsetWidth,_=Math.round(H*.125);j(_),r.current?.params?.coverflowEffect&&(r.current.params.coverflowEffect.stretch=_,r.current.update())};l();const a=new ResizeObserver(l);return a.observe(e),()=>a.disconnect()},[]),o("section",{ref:n,"data-ui-component-id":"ThreeDCarousel",className:i("three-d-carousel laptop:overflow-hidden w-full overflow-visible",E),children:[t(p,{as:D??"h2",size:4,html:h,className:"three-d-carousel__title laptop:text-center text-left"}),o("div",{ref:x,className:"three-d-carousel__desktop laptop:block relative mx-auto mt-[24px] hidden w-full",children:[t(S,{onSwiper:e=>r.current=e,centeredSlides:!0,initialSlide:0,loop:!0,slidesPerView:"auto",spaceBetween:0,grabCursor:!0,modules:[A,W],slideToClickedSlide:!0,className:"three-d-carousel__swiper rounded-box relative aspect-[1386/502] overflow-visible",effect:"coverflow",coverflowEffect:{rotate:0,stretch:P,depth:300,modifier:1,slideShadows:!0},children:v.map((e,l)=>t(C,{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:a})=>o(G,{children:[t(y,{source:e.imageUrl?.url||"",alt:e.imageUrl?.alt||e.title,className:i("three-d-carousel__image rounded-box mx-auto h-full overflow-hidden"),imgClassName:"h-full object-cover",style:{filter:a?"":"brightness(50%) contrast(120%)"}}),o("div",{className:i("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":!a}),children:[t(p,{as:"h2",size:2,html:e.title}),t(N,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-description lg-desktop:text-[18px] desktop:text-[16px] text-[14px]"}),e.buttonText&&t("a",{href:b(e.buttonLink),...g(e),className:"three-d-carousel__image-link ",children:t(k,{size:"base",variant:"secondary",className:"three-d-carousel__image-button desktop:mt-6 mt-4",children:e.buttonText})})]})]})},l))}),o("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:[t("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--prev",onClick:()=>r.current?.slidePrev(),"aria-label":"Previous slide",children:t(q,{})}),t("button",{className:"three-d-carousel__nav-button three-d-carousel__nav-button--next",onClick:()=>r.current?.slideNext(),"aria-label":"Next slide",children:t(F,{})})]})]}),t("div",{className:"three-d-carousel__mobile laptop:hidden mt-[24px] block w-full overflow-visible",children:t(S,{loop:!0,loopAdditionalSlides:1,slidesPerView:"auto",spaceBetween:12,grabCursor:!0,className:"three-d-carousel__swiper-mobile relative w-full !overflow-visible",children:v.map((e,l)=>o(C,{className:"three-d-carousel__slide-mobile relative !h-[360px] !w-[296px] cursor-grab overflow-hidden",children:[t(y,{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"}),o("div",{className:i("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:[t(p,{as:"h2",size:2,html:e.title}),t(N,{as:"p",size:4,html:e.description,className:"three-d-carousel__image-mobile-description text-[14px]"}),e.buttonText&&t("a",{href:b(e.buttonLink),...g(e),className:"three-d-carousel__image-mobile-link ",children:t(k,{size:"base",variant:"secondary",className:"three-d-carousel__image-mobile-button mt-3",children:e.buttonText})})]})]},l))})})]})});L.displayName="ThreeDCarousel";var ce=I(L,{style:"overflow: hidden;"});export{ce as default};
@@ -1 +1 @@
1
- "use client";import{jsx as o,jsxs as T}from"react/jsx-runtime";import st,{useEffect as lt,useRef as h,useImperativeHandle as at,useState as ct}from"react";import{gsap as b}from"gsap";import{SplitText as N}from"gsap/dist/SplitText";import{ScrollTrigger as S}from"gsap/dist/ScrollTrigger";import{cn as i,getLocalizedPath as dt}from"../../helpers/utils.js";import{Heading as ut,Text as $,Countdown as pt}from"../../components/index.js";import{withLayout as mt}from"../../shared/Styles.js";import{useAiuiContext as ft}from"../AiuiProvider/index.js";import{convertLexicalToPlaintext as ht}from"@payloadcms/richtext-lexical/plaintext";import{trackUrlRef as gt}from"../../shared/trackUrlRef.js";import{useInView as xt}from"react-intersection-observer";const A="link",V="title";function wt(t){if(!t)return!1;if(typeof t=="string")return t.trim().length>0;const s=t?.root?.children;return!Array.isArray(s)||s.length===0?!1:s.some(n=>{const r=n?.children;return!Array.isArray(r)||r.length===0?!1:r.some(l=>typeof l?.text=="string"&&l.text.length>0)})}function B(t){if(!t)return"";if(typeof t=="string")return t;try{return ht({data:t})||""}catch{return""}}const yt="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]",I=({data:t,onClick:s,className:n})=>{const{extensions:r,title:l,caption:p,align:m}=t,{locale:g="us"}=ft();if(!r?.textLink)return null;const f=r?.link?gt(dt(r.link,g),`${A}_${V}`):void 0;return T("a",{className:i("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":m==="center"},{"mt-1 laptop:mt-0":m==="left"},n),...f?{href:f}:{},"data-headless-type-name":`${A}#${V}`,"data-headless-title-desc-button":`${B(l)}#${B(p)}`,...s?{onClick:s}:{},children:[o("div",{className:"truncate whitespace-nowrap",children:r?.textLink}),o("div",{className:"lg-desktop:size-5 size-4",children:o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:o("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]"})})})]})},_=st.forwardRef(({data:t,className:s,classNames:n,as:r="h2",weight:l="bold",onButtonClick:p,id:m,...g},f)=>{const{title:v,titleSize:j=4,caption:k,subtitle:C,content:L,countdown:e,showCountdown:O=!1,theme:H="light",extensions:D,align:c="left"}=t,M=h(null),d=h(null),a=h(null),u=h(null),[U,W]=ct(!0),{ref:Z,inView:z}=xt();at(f,()=>M.current);const q=()=>{W(!1)},F=e?.targetDateTime||e?.targetDate||"",G=e?.targetDateTime_tz,J=e?.labels?{day:e.labels.days||"Day",hour:e.labels.hours||"Hours",minute:e.labels.minutes||"Mins",second:e.labels.seconds||"Secs"}:void 0;return lt(()=>{b.registerPlugin(N,S);function K(){if(!d.current)return;const Q=d.current?.clientHeight||80;a.current&&a.current.revert(),u.current&&u.current.kill(),a.current=new N(d.current,{type:"words",wordsClass:"word"});const x=a.current.words;b.set(x,{opacity:0}),u.current=S.create({trigger:d.current,start:"bottom bottom-=4%",end:`bottom+=${Q*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:X=>{const Y=X.progress,E=x.length||1,tt=.5,w=1/E,P=w*(1-tt),R=(E-1)*P+w,et=Math.min(1,R>0?Y/R:0);x.forEach((nt,rt)=>{const ot=rt*P,it=w;let y=(et-ot)/it;y=Math.max(0,Math.min(1,y)),b.set(nt,{opacity:y})})}})}return z&&K(),()=>{a.current&&a.current.revert(),u.current&&u.current.kill()}},[z]),T("div",{id:D?.id?D?.id:m,className:i("titleBottom title-box flex items-end justify-between gap-2 pb-6",{"aiui-dark":H==="dark"},s,n?.wrapper),...g,ref:M,children:[T("div",{ref:Z,className:i("flex-1",n?.container,{"text-center":c==="center","text-left":c==="left"}),children:[(k||v)&&o(ut,{ref:d,as:r,size:j,html:k||v,weight:l,className:i("text-info-primary",n?.title)}),C&&o($,{html:C,as:"div",className:i(yt,n?.subtitle)}),wt(L)&&o($,{html:L,as:"div",size:4,className:i("title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]",n?.content)}),o(I,{data:t,className:i({"laptop:hidden":c==="left"},n?.button),onClick:p}),O&&e&&U&&o(pt,{endDate:F,endDate_tz:G,timeLabels:J,showDays:e?.showDays,showHours:e?.showHours,showMinutes:e?.showMinutes,showSeconds:e?.showSeconds,theme:H,onExpire:q,hideWhenExpired:!0,align:c==="center"?"center":"left",className:i("mt-4",n?.countdown)})]}),o(I,{data:t,className:i("hidden",{"laptop:flex":c==="left"},n?.button),onClick:p})]})});_.displayName="Title";var Pt=mt(_);export{Pt as default};
1
+ "use client";import{jsx as o,jsxs as M}from"react/jsx-runtime";import st,{useEffect as lt,useRef as x,useImperativeHandle as at,useState as ct}from"react";import{gsap as H}from"gsap";import{SplitText as $}from"gsap/dist/SplitText";import{ScrollTrigger as B}from"gsap/dist/ScrollTrigger";import{cn as i,getLocalizedPath as dt}from"../../helpers/utils.js";import{Heading as ut,Text as I,Countdown as pt}from"../../components/index.js";import{withLayout as mt}from"../../shared/Styles.js";import{useAiuiContext as ft}from"../AiuiProvider/index.js";import{useExposure as gt}from"../../hooks/useExposure.js";import{useTracking as ht}from"../../hooks/useTracking.js";import{convertLexicalToPlaintext as xt}from"@payloadcms/richtext-lexical/plaintext";import{trackUrlRef as wt}from"../../shared/trackUrlRef.js";import{useInView as bt}from"react-intersection-observer";const D="link",E="title";function yt(t){if(!t)return!1;if(typeof t=="string")return t.trim().length>0;const s=t?.root?.children;return!Array.isArray(s)||s.length===0?!1:s.some(n=>{const r=n?.children;return!Array.isArray(r)||r.length===0?!1:r.some(l=>typeof l?.text=="string"&&l.text.length>0)})}function m(t){if(!t)return"";if(typeof t=="string")return t;try{return xt({data:t})||""}catch{return""}}const Tt="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]",j=({data:t,onClick:s,className:n})=>{const{extensions:r,title:l,caption:f,subtitle:w,align:g}=t,{locale:b="us"}=ft(),{buildRef:c}=ht();if(!r?.textLink)return null;const h=r?.link?wt(dt(r.link,b),c(D,E)):void 0;return M("a",{className:i("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":g==="center"},{"mt-1 laptop:mt-0":g==="left"},n),...h?{href:h}:{},"data-headless-type-name":`${D}#${E}`,"data-headless-title-desc-button":`${m(f||l)}#${m(w)}#${m(r.textLink)}`,...s?{onClick:s}:{},children:[o("div",{className:"truncate whitespace-nowrap",children:r?.textLink}),o("div",{className:"lg-desktop:size-5 size-4",children:o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:o("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]"})})})]})},O=st.forwardRef(({data:t,className:s,classNames:n,as:r="h2",weight:l="bold",onButtonClick:f,id:w,...g},b)=>{const{title:c,titleSize:h=4,caption:y,subtitle:T,content:z,countdown:e,showCountdown:U=!1,theme:P="light",extensions:R,align:d="left"}=t,v=x(null),u=x(null),a=x(null),p=x(null),[_,W]=ct(!0),{ref:Z,inView:N}=bt();at(b,()=>v.current),gt(v,{componentType:D,componentName:E,componentTitle:m(y||c),componentDescription:m(T)});const q=()=>{W(!1)},F=e?.targetDateTime||e?.targetDate||"",G=e?.targetDateTime_tz,J=e?.labels?{day:e.labels.days||"Day",hour:e.labels.hours||"Hours",minute:e.labels.minutes||"Mins",second:e.labels.seconds||"Secs"}:void 0;return lt(()=>{H.registerPlugin($,B);function K(){if(!u.current)return;const Q=u.current?.clientHeight||80;a.current&&a.current.revert(),p.current&&p.current.kill(),a.current=new $(u.current,{type:"words",wordsClass:"word"});const k=a.current.words;H.set(k,{opacity:0}),p.current=B.create({trigger:u.current,start:"bottom bottom-=4%",end:`bottom+=${Q*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:X=>{const Y=X.progress,S=k.length||1,tt=.5,L=1/S,A=L*(1-tt),V=(S-1)*A+L,et=Math.min(1,V>0?Y/V:0);k.forEach((nt,rt)=>{const ot=rt*A,it=L;let C=(et-ot)/it;C=Math.max(0,Math.min(1,C)),H.set(nt,{opacity:C})})}})}return N&&K(),()=>{a.current&&a.current.revert(),p.current&&p.current.kill()}},[N]),M("div",{id:R?.id?R?.id:w,className:i("titleBottom title-box flex items-end justify-between gap-2 pb-6",{"aiui-dark":P==="dark"},s,n?.wrapper),...g,ref:v,children:[M("div",{ref:Z,className:i("flex-1",n?.container,{"text-center":d==="center","text-left":d==="left"}),children:[(y||c)&&o(ut,{ref:u,as:r,size:h,html:y||c,weight:l,className:i("text-info-primary",n?.title)}),T&&o(I,{html:T,as:"div",className:i(Tt,n?.subtitle)}),yt(z)&&o(I,{html:z,as:"div",size:4,className:i("title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]",n?.content)}),o(j,{data:t,className:i({"laptop:hidden":d==="left"},n?.button),onClick:f}),U&&e&&_&&o(pt,{endDate:F,endDate_tz:G,timeLabels:J,showDays:e?.showDays,showHours:e?.showHours,showMinutes:e?.showMinutes,showSeconds:e?.showSeconds,theme:P,onExpire:q,hideWhenExpired:!0,align:d==="center"?"center":"left",className:i("mt-4",n?.countdown)})]}),o(j,{data:t,className:i("hidden",{"laptop:flex":d==="left"},n?.button),onClick:f})]})});O.displayName="Title";var At=mt(O);export{At as default};
@@ -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?: string | null) => string;
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?: string;
53
- /** 运营配置的创意描述 → component_description */
54
- description?: string;
55
- /** 按钮文案(视频播放入口固定传 `video play` / `video pause`) → button_name */
56
- buttonName?: string;
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 */
@@ -1 +1 @@
1
- const g=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)}},u=({pageGroup:e="Home Page",currency:t="USD",itemListId:n,itemListName:i,position:a,items:r})=>{g({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:e,position:a,item_list_id:n,item_list_name:i,currency:t,items:r.map(s=>({...s,item_list_id:n,item_list_name:i}))}})},l=/<[^>]*>/g,_={"&nbsp;":" ","&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},o=e=>e?e.replace(l," ").replace(/&[a-z#0-9]+;/gi,t=>_[t.toLowerCase()]??" ").replace(/\s+/g," ").trim():"",T=e=>e?"video":"image",y=({interactive:e,componentType:t,componentName:n,title:i,description:a,buttonName:r,navigation:s="",position:m=1,creativeId:p,sku:c})=>{if(!e)return{};const d=`${o(i)}#${o(a)}${r===void 0?"":`#${o(r)}`}`;return{"data-headless-type-name":`${t}#${n}`,"data-headless-title-desc-button":d,"data-headless-nav-position":`${s}#${m}`,...p?{"data-headless-creative-id":p}:{},...c?{"data-headless-sku":c}:{}}},k=({pageGroup:e="Home Page",componentType:t,componentName:n,position:i=1,buttonName:a,componentTitle:r,componentDescription:s,creativeId:m,sku:p,navigation:c=""})=>{g({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:e,component_type:t,component_name:n,position:i,creative_id:m||"",button_name:o(a),component_title:o(r),component_description:o(s),SKU:p||"",navigation:c}})};export{y as buildClickTrackingProps,g as gaTrack,T as resolveComponentMediaType,o as toPlainTrackingText,k as trackComponentClick,u as trackSelectItem};
1
+ import{convertLexicalToPlaintext as l}from"@payloadcms/richtext-lexical/plaintext";const g=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)}},y=({pageGroup:e="Home Page",currency:t="USD",itemListId:n,itemListName:i,position:a,items:r})=>{g({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:e,position:a,item_list_id:n,item_list_name:i,currency:t,items:r.map(p=>({...p,item_list_id:n,item_list_name:i}))}})},u=/<[^>]*>/g,T={"&nbsp;":" ","&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},o=e=>{if(!e)return"";let t;if(typeof e=="string")t=e;else try{t=l({data:e})||""}catch{return""}return t.replace(u," ").replace(/&[a-z#0-9]+;/gi,n=>T[n.toLowerCase()]??" ").replace(/\s+/g," ").trim()},k=e=>e?"video":"image",x=({interactive:e,componentType:t,componentName:n,title:i,description:a,buttonName:r,navigation:p="",position:m=1,creativeId:s,sku:c})=>{if(!e)return{};const d=`${o(i)}#${o(a)}${r===void 0?"":`#${o(r)}`}`;return{"data-headless-type-name":`${t}#${n}`,"data-headless-title-desc-button":d,"data-headless-nav-position":`${p}#${m}`,...s?{"data-headless-creative-id":s}:{},...c?{"data-headless-sku":c}:{}}},v=({pageGroup:e="Home Page",componentType:t,componentName:n,position:i=1,buttonName:a,componentTitle:r,componentDescription:p,creativeId:m,sku:s,navigation:c=""})=>{g({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:e,component_type:t,component_name:n,position:i,creative_id:m||"",button_name:o(a),component_title:o(r),component_description:o(p),SKU:s||"",navigation:c}})};export{x as buildClickTrackingProps,g as gaTrack,k as resolveComponentMediaType,o as toPlainTrackingText,v as trackComponentClick,y as trackSelectItem};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anker-in/headless-ui",
3
- "version": "1.3.84",
3
+ "version": "1.3.85",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/cjs/index.d.ts",
@@ -27,6 +27,17 @@
27
27
  "default": "./dist/esm/biz-components/index.js"
28
28
  }
29
29
  },
30
+ "./chat": {
31
+ "require": {
32
+ "types": "./dist/cjs/biz-components/Chat/exports.d.ts",
33
+ "default": "./dist/cjs/biz-components/Chat/exports.js"
34
+ },
35
+ "import": {
36
+ "types": "./dist/esm/biz-components/Chat/exports.d.ts",
37
+ "default": "./dist/esm/biz-components/Chat/exports.js"
38
+ }
39
+ },
40
+ "./chat.css": "./src/biz-components/Chat/styles/chat.css",
30
41
  "./cpn": {
31
42
  "require": {
32
43
  "types": "./dist/cjs/cpn-components/index.d.ts",
@@ -63,6 +74,7 @@
63
74
  "description": "",
64
75
  "files": [
65
76
  "dist/**",
77
+ "src/biz-components/Chat/styles/**",
66
78
  "static/**",
67
79
  "*.css",
68
80
  "README.md",
@@ -70,7 +82,10 @@
70
82
  "tailwind.config.js",
71
83
  "tailwind.config.d.ts"
72
84
  ],
73
- "sideEffects": false,
85
+ "sideEffects": [
86
+ "*.css",
87
+ "**/*.css"
88
+ ],
74
89
  "keywords": [],
75
90
  "author": "",
76
91
  "license": "GPLv3",
@@ -78,6 +93,9 @@
78
93
  "@babel/preset-env": "^7.24.6",
79
94
  "@babel/preset-react": "^7.24.6",
80
95
  "@babel/preset-typescript": "^7.24.6",
96
+ "@copilotkit/react-core": "1.1.2",
97
+ "@copilotkit/react-ui": "1.1.2",
98
+ "@copilotkit/runtime-client-gql": "1.1.2",
81
99
  "@hyrious/esbuild-plugin-commonjs": "^0.2.6",
82
100
  "@testing-library/jest-dom": "^6.4.6",
83
101
  "@testing-library/react": "^14.3.1",
@@ -102,7 +120,10 @@
102
120
  "postcss-import": "^16.1.0",
103
121
  "postcss-prefix-selector": "^2.1.1",
104
122
  "prettier": "^3.5.3",
123
+ "react-markdown": "^8.0.7",
105
124
  "react-test-renderer": "^18.3.1",
125
+ "remark-gfm": "^3.0.1",
126
+ "remark-math": "^5.1.1",
106
127
  "stylelint": "^16.6.0"
107
128
  },
108
129
  "dependencies": {
@@ -148,13 +169,39 @@
148
169
  "zod": "^4.3.5"
149
170
  },
150
171
  "peerDependencies": {
172
+ "@copilotkit/react-core": "1.1.2",
173
+ "@copilotkit/react-ui": "1.1.2",
174
+ "@copilotkit/runtime-client-gql": "1.1.2",
151
175
  "@gsap/react": "^2.1.2",
152
- "gsap": "^3.13.0"
176
+ "gsap": "^3.13.0",
177
+ "react-markdown": "^8.0.7",
178
+ "remark-gfm": "^3.0.1",
179
+ "remark-math": "^5.1.1"
153
180
  },
154
181
  "publishConfig": {
155
182
  "access": "public",
156
183
  "registry": "https://registry.npmjs.org/"
157
184
  },
185
+ "peerDependenciesMeta": {
186
+ "@copilotkit/react-core": {
187
+ "optional": true
188
+ },
189
+ "@copilotkit/react-ui": {
190
+ "optional": true
191
+ },
192
+ "@copilotkit/runtime-client-gql": {
193
+ "optional": true
194
+ },
195
+ "react-markdown": {
196
+ "optional": true
197
+ },
198
+ "remark-gfm": {
199
+ "optional": true
200
+ },
201
+ "remark-math": {
202
+ "optional": true
203
+ }
204
+ },
158
205
  "scripts": {
159
206
  "dev": "pnpm run dev:css & pnpm run dev:js:esm & pnpm run dev:js:cjs & pnpm run dev:js:esm:types & pnpm run dev:js:cjs:types",
160
207
  "dev:js:cjs": "node esbuild-cjs.mjs watch=true",
@@ -0,0 +1,14 @@
1
+ @import "./css/colors.css";
2
+ @import "./css/popup.css";
3
+ @import "./css/sidebar.css";
4
+ @import "./css/button.css";
5
+ @import "./css/header.css";
6
+ @import "./css/input.css";
7
+ @import "./css/messages.css";
8
+ @import "./css/window.css";
9
+ @import "./css/animations.css";
10
+ @import "./css/response.css";
11
+ @import "./css/markdown.css";
12
+ @import "./css/suggestions.css";
13
+ @import "./css/panel.css";
14
+ @import "./css/console.css";
@@ -0,0 +1,35 @@
1
+ .copilotKitActivityDot1 {
2
+ animation: copilotKitActivityDotsAnimation 1.05s infinite;
3
+ }
4
+ .copilotKitActivityDot2 {
5
+ animation-delay: 0.1s;
6
+ }
7
+ .copilotKitActivityDot3 {
8
+ animation-delay: 0.2s;
9
+ }
10
+ @keyframes copilotKitActivityDotsAnimation {
11
+ 0%,
12
+ 57.14% {
13
+ animation-timing-function: cubic-bezier(0.33, 0.66, 0.66, 1);
14
+ transform: translate(0);
15
+ }
16
+ 28.57% {
17
+ animation-timing-function: cubic-bezier(0.33, 0, 0.66, 0.33);
18
+ transform: translateY(-6px);
19
+ }
20
+ 100% {
21
+ transform: translate(0);
22
+ }
23
+ }
24
+
25
+ @keyframes copilotKitSpinAnimation {
26
+ to {
27
+ transform: rotate(360deg);
28
+ }
29
+ }
30
+
31
+ @keyframes copilotKitPulseAnimation {
32
+ 50% {
33
+ opacity: 0.5;
34
+ }
35
+ }
@@ -0,0 +1,56 @@
1
+ .copilotKitButton {
2
+ width: 3.5rem;
3
+ height: 3.5rem;
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: center;
7
+ border-radius: 50%;
8
+ border: 1px solid rgba(255, 255, 255, 0.2);
9
+ outline: none;
10
+ position: relative;
11
+ transform: scale(1);
12
+ transition: transform 200ms;
13
+ background-color: var(--copilot-kit-primary-color);
14
+ color: var(--copilot-kit-contrast-color);
15
+ cursor: pointer;
16
+ }
17
+
18
+ .copilotKitButton:hover {
19
+ transform: scale(1.1);
20
+ }
21
+
22
+ .copilotKitButton:active {
23
+ transform: scale(0.75);
24
+ }
25
+
26
+ .copilotKitButtonIcon {
27
+ transition:
28
+ opacity 100ms,
29
+ transform 300ms;
30
+ position: absolute;
31
+ top: 50%;
32
+ left: 50%;
33
+ transform: translate(-50%, -50%);
34
+ }
35
+
36
+ /* State when the chat is open */
37
+ .copilotKitButton.open .copilotKitButtonIconOpen {
38
+ transform: translate(-50%, -50%) scale(0) rotate(90deg);
39
+ opacity: 0;
40
+ }
41
+
42
+ .copilotKitButton.open .copilotKitButtonIconClose {
43
+ transform: translate(-50%, -50%) scale(1) rotate(0deg);
44
+ opacity: 1;
45
+ }
46
+
47
+ /* State when the chat is closed */
48
+ .copilotKitButton:not(.open) .copilotKitButtonIconOpen {
49
+ transform: translate(-50%, -50%) scale(1) rotate(0deg);
50
+ opacity: 1;
51
+ }
52
+
53
+ .copilotKitButton:not(.open) .copilotKitButtonIconClose {
54
+ transform: translate(-50%, -50%) scale(0) rotate(-90deg);
55
+ opacity: 0;
56
+ }
@@ -0,0 +1,12 @@
1
+ html {
2
+ --copilot-kit-primary-color: rgb(59 130 246);
3
+ --copilot-kit-contrast-color: rgb(255 255 255);
4
+ --copilot-kit-secondary-color: rgb(243 244 246);
5
+ --copilot-kit-secondary-contrast-color: rgb(0 0 0);
6
+ --copilot-kit-background-color: rgb(255 255 255);
7
+ --copilot-kit-muted-color: rgb(106 106 106);
8
+ --copilot-kit-separator-color: rgba(0, 0, 0, 0.08);
9
+ --copilot-kit-scrollbar-color: rgba(0, 0, 0, 0.2);
10
+ --copilot-kit-response-button-color: #333;
11
+ --copilot-kit-response-button-background-color: #fff;
12
+ }