@anker-in/headless-ui 1.1.9-alpha.1764758211572 → 1.1.9-alpha.1764822725414

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 (205) hide show
  1. package/dist/cjs/biz-components/AccordionCards/index.d.ts +1 -1
  2. package/dist/cjs/biz-components/AccordionCards/index.js +1 -1
  3. package/dist/cjs/biz-components/AccordionCards/index.js.map +2 -2
  4. package/dist/cjs/biz-components/AiuiProvider/index.js.map +2 -2
  5. package/dist/cjs/biz-components/AplusDesc/index.js +1 -1
  6. package/dist/cjs/biz-components/AplusDesc/index.js.map +3 -3
  7. package/dist/cjs/biz-components/BrandEquity/BrandEquity.js +1 -1
  8. package/dist/cjs/biz-components/BrandEquity/BrandEquity.js.map +1 -1
  9. package/dist/cjs/biz-components/Category/SwiperCategory.js +1 -1
  10. package/dist/cjs/biz-components/Category/SwiperCategory.js.map +3 -3
  11. package/dist/cjs/biz-components/Category/index.d.ts +1 -1
  12. package/dist/cjs/biz-components/Category/index.js +1 -1
  13. package/dist/cjs/biz-components/Category/index.js.map +1 -1
  14. package/dist/cjs/biz-components/DownLoad/index.js +1 -1
  15. package/dist/cjs/biz-components/DownLoad/index.js.map +3 -3
  16. package/dist/cjs/biz-components/Evaluate/index.d.ts +1 -1
  17. package/dist/cjs/biz-components/Evaluate/index.js +1 -1
  18. package/dist/cjs/biz-components/Evaluate/index.js.map +3 -3
  19. package/dist/cjs/biz-components/Faq/Faq.js +1 -1
  20. package/dist/cjs/biz-components/Faq/Faq.js.map +2 -2
  21. package/dist/cjs/biz-components/FootCharger/index.js +1 -1
  22. package/dist/cjs/biz-components/FootCharger/index.js.map +3 -3
  23. package/dist/cjs/biz-components/FooterNavigation/index.js +1 -1
  24. package/dist/cjs/biz-components/FooterNavigation/index.js.map +1 -1
  25. package/dist/cjs/biz-components/FooterNavigation/types.d.ts +1 -1
  26. package/dist/cjs/biz-components/FooterNavigation/types.js.map +1 -1
  27. package/dist/cjs/biz-components/GiftBox/index.js +1 -1
  28. package/dist/cjs/biz-components/GiftBox/index.js.map +3 -3
  29. package/dist/cjs/biz-components/Graphic/index.js +1 -1
  30. package/dist/cjs/biz-components/Graphic/index.js.map +2 -2
  31. package/dist/cjs/biz-components/GraphicMore/index.js +1 -1
  32. package/dist/cjs/biz-components/GraphicMore/index.js.map +3 -3
  33. package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
  34. package/dist/cjs/biz-components/GraphicOverlay/GraphicOverlay.js.map +3 -3
  35. package/dist/cjs/biz-components/HeaderNavigation/NavProvider.d.ts +5 -5
  36. package/dist/cjs/biz-components/HeaderNavigation/NavProvider.js +1 -1
  37. package/dist/cjs/biz-components/HeaderNavigation/NavProvider.js.map +3 -3
  38. package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
  39. package/dist/cjs/biz-components/HeaderNavigation/index.js.map +1 -1
  40. package/dist/cjs/biz-components/HeaderNavigation/types.d.ts +7 -7
  41. package/dist/cjs/biz-components/HeaderNavigation/types.js +1 -1
  42. package/dist/cjs/biz-components/HeaderNavigation/types.js.map +3 -3
  43. package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js +1 -1
  44. package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js.map +2 -2
  45. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +2 -2
  46. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +1 -1
  47. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.js +1 -1
  48. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.js.map +2 -2
  49. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.d.ts +1 -1
  50. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
  51. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +2 -2
  52. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +2 -2
  53. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +2 -2
  54. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +1 -1
  55. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.d.ts +1 -1
  56. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js +1 -1
  57. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +3 -3
  58. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/types.d.ts +1 -1
  59. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/types.js +1 -1
  60. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/types.js.map +2 -2
  61. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.d.ts +1 -1
  62. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.js +1 -1
  63. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.js.map +3 -3
  64. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  65. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +2 -2
  66. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/types.d.ts +3 -3
  67. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/types.js.map +1 -1
  68. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +2 -2
  69. package/dist/cjs/biz-components/SelectStore/index.js.map +1 -1
  70. package/dist/cjs/biz-components/ShelfDisplay/couponUtils.js +1 -1
  71. package/dist/cjs/biz-components/ShelfDisplay/couponUtils.js.map +2 -2
  72. package/dist/cjs/biz-components/ShelfDisplay/handleCoupon.js +1 -1
  73. package/dist/cjs/biz-components/ShelfDisplay/handleCoupon.js.map +2 -2
  74. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +3 -3
  75. package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +2 -2
  76. package/dist/cjs/biz-components/Specs/index.js +1 -1
  77. package/dist/cjs/biz-components/Specs/index.js.map +1 -1
  78. package/dist/cjs/biz-components/Subscribe/index.js +2 -2
  79. package/dist/cjs/biz-components/Subscribe/index.js.map +1 -1
  80. package/dist/cjs/biz-components/TextModal/index.js +1 -1
  81. package/dist/cjs/biz-components/TextModal/index.js.map +1 -1
  82. package/dist/cjs/components/board.js +1 -1
  83. package/dist/cjs/components/board.js.map +1 -1
  84. package/dist/cjs/components/carousel.js +1 -1
  85. package/dist/cjs/components/carousel.js.map +1 -1
  86. package/dist/cjs/components/tabs.js +1 -1
  87. package/dist/cjs/components/tabs.js.map +1 -1
  88. package/dist/cjs/helpers/ScrollLoadVideo.d.ts +5 -4
  89. package/dist/cjs/helpers/ScrollLoadVideo.js +1 -1
  90. package/dist/cjs/helpers/ScrollLoadVideo.js.map +3 -3
  91. package/dist/cjs/stories/HeroBanner.stories.js +2 -2
  92. package/dist/cjs/stories/HeroBanner.stories.js.map +3 -3
  93. package/dist/cjs/stories/container.stories.js +1 -1
  94. package/dist/cjs/stories/container.stories.js.map +3 -3
  95. package/dist/cjs/stories/faq.stories.js.map +2 -2
  96. package/dist/cjs/stories/graphic.stories.js +1 -1
  97. package/dist/cjs/stories/graphic.stories.js.map +3 -3
  98. package/dist/cjs/stories/graphicAttractionBlock.stories.js +1 -1
  99. package/dist/cjs/stories/graphicAttractionBlock.stories.js.map +3 -3
  100. package/dist/cjs/stories/shelfDisplay.stories.js +1 -1
  101. package/dist/cjs/stories/shelfDisplay.stories.js.map +3 -3
  102. package/dist/esm/biz-components/AccordionCards/index.d.ts +1 -1
  103. package/dist/esm/biz-components/AccordionCards/index.js +1 -1
  104. package/dist/esm/biz-components/AccordionCards/index.js.map +2 -2
  105. package/dist/esm/biz-components/AiuiProvider/index.js.map +2 -2
  106. package/dist/esm/biz-components/AplusDesc/index.js +1 -1
  107. package/dist/esm/biz-components/AplusDesc/index.js.map +3 -3
  108. package/dist/esm/biz-components/BrandEquity/BrandEquity.js +1 -1
  109. package/dist/esm/biz-components/BrandEquity/BrandEquity.js.map +1 -1
  110. package/dist/esm/biz-components/Category/SwiperCategory.js +1 -1
  111. package/dist/esm/biz-components/Category/SwiperCategory.js.map +3 -3
  112. package/dist/esm/biz-components/Category/index.d.ts +1 -1
  113. package/dist/esm/biz-components/Category/index.js +1 -1
  114. package/dist/esm/biz-components/Category/index.js.map +1 -1
  115. package/dist/esm/biz-components/DownLoad/index.js +1 -1
  116. package/dist/esm/biz-components/DownLoad/index.js.map +2 -2
  117. package/dist/esm/biz-components/Evaluate/index.d.ts +1 -1
  118. package/dist/esm/biz-components/Evaluate/index.js +1 -1
  119. package/dist/esm/biz-components/Evaluate/index.js.map +3 -3
  120. package/dist/esm/biz-components/Faq/Faq.js +1 -1
  121. package/dist/esm/biz-components/Faq/Faq.js.map +2 -2
  122. package/dist/esm/biz-components/FootCharger/index.js +1 -1
  123. package/dist/esm/biz-components/FootCharger/index.js.map +2 -2
  124. package/dist/esm/biz-components/FooterNavigation/index.js +1 -1
  125. package/dist/esm/biz-components/FooterNavigation/index.js.map +1 -1
  126. package/dist/esm/biz-components/FooterNavigation/types.d.ts +1 -1
  127. package/dist/esm/biz-components/FooterNavigation/types.js.map +1 -1
  128. package/dist/esm/biz-components/GiftBox/index.js +1 -1
  129. package/dist/esm/biz-components/GiftBox/index.js.map +3 -3
  130. package/dist/esm/biz-components/Graphic/index.js +1 -1
  131. package/dist/esm/biz-components/Graphic/index.js.map +2 -2
  132. package/dist/esm/biz-components/GraphicMore/index.js +1 -1
  133. package/dist/esm/biz-components/GraphicMore/index.js.map +2 -2
  134. package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js +1 -1
  135. package/dist/esm/biz-components/GraphicOverlay/GraphicOverlay.js.map +3 -3
  136. package/dist/esm/biz-components/HeaderNavigation/NavProvider.d.ts +5 -5
  137. package/dist/esm/biz-components/HeaderNavigation/NavProvider.js +1 -1
  138. package/dist/esm/biz-components/HeaderNavigation/NavProvider.js.map +3 -3
  139. package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
  140. package/dist/esm/biz-components/HeaderNavigation/index.js.map +1 -1
  141. package/dist/esm/biz-components/HeaderNavigation/types.d.ts +7 -7
  142. package/dist/esm/biz-components/HeaderNavigation/types.js +1 -1
  143. package/dist/esm/biz-components/HeaderNavigation/types.js.map +2 -2
  144. package/dist/esm/biz-components/Listing/components/PaidShipping/index.js +1 -1
  145. package/dist/esm/biz-components/Listing/components/PaidShipping/index.js.map +2 -2
  146. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +2 -2
  147. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +1 -1
  148. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.js +1 -1
  149. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/ModalContainer.js.map +2 -2
  150. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.d.ts +1 -1
  151. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
  152. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +2 -2
  153. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  154. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +2 -2
  155. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +2 -2
  156. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +1 -1
  157. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.d.ts +1 -1
  158. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js +1 -1
  159. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +3 -3
  160. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/types.d.ts +1 -1
  161. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/types.js.map +2 -2
  162. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.d.ts +1 -1
  163. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.js +1 -1
  164. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/components/Select.js.map +3 -3
  165. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  166. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +2 -2
  167. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/types.d.ts +3 -3
  168. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/types.js.map +1 -1
  169. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  170. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +2 -2
  171. package/dist/esm/biz-components/SelectStore/index.js.map +1 -1
  172. package/dist/esm/biz-components/ShelfDisplay/couponUtils.js +1 -1
  173. package/dist/esm/biz-components/ShelfDisplay/couponUtils.js.map +2 -2
  174. package/dist/esm/biz-components/ShelfDisplay/handleCoupon.js +1 -1
  175. package/dist/esm/biz-components/ShelfDisplay/handleCoupon.js.map +2 -2
  176. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +3 -3
  177. package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +2 -2
  178. package/dist/esm/biz-components/Specs/index.js +1 -1
  179. package/dist/esm/biz-components/Specs/index.js.map +1 -1
  180. package/dist/esm/biz-components/Subscribe/index.js +2 -2
  181. package/dist/esm/biz-components/Subscribe/index.js.map +1 -1
  182. package/dist/esm/biz-components/TextModal/index.js +1 -1
  183. package/dist/esm/biz-components/TextModal/index.js.map +1 -1
  184. package/dist/esm/components/board.js +1 -1
  185. package/dist/esm/components/board.js.map +1 -1
  186. package/dist/esm/components/carousel.js +1 -1
  187. package/dist/esm/components/carousel.js.map +1 -1
  188. package/dist/esm/components/tabs.js +1 -1
  189. package/dist/esm/components/tabs.js.map +1 -1
  190. package/dist/esm/helpers/ScrollLoadVideo.d.ts +5 -4
  191. package/dist/esm/helpers/ScrollLoadVideo.js +1 -1
  192. package/dist/esm/helpers/ScrollLoadVideo.js.map +3 -3
  193. package/dist/esm/stories/HeroBanner.stories.js +2 -2
  194. package/dist/esm/stories/HeroBanner.stories.js.map +3 -3
  195. package/dist/esm/stories/container.stories.js +2 -2
  196. package/dist/esm/stories/container.stories.js.map +2 -2
  197. package/dist/esm/stories/faq.stories.js.map +2 -2
  198. package/dist/esm/stories/graphic.stories.js +1 -1
  199. package/dist/esm/stories/graphic.stories.js.map +2 -2
  200. package/dist/esm/stories/graphicAttractionBlock.stories.js +1 -1
  201. package/dist/esm/stories/graphicAttractionBlock.stories.js.map +2 -2
  202. package/dist/esm/stories/shelfDisplay.stories.js +1 -1
  203. package/dist/esm/stories/shelfDisplay.stories.js.map +2 -2
  204. package/package.json +3 -2
  205. package/style.css +6 -6
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Text as s,Button as A,Grid as ee,GridItem as q,Picture as F,Heading as te}from"../../../../../components/index.js";import{useBizProductContext as j}from"../../../BizProductProvider.js";import{useEffect as ae,useMemo as B,useState as ne}from"react";import{formatPrice as N}from"../../../utils/index.js";import{useAiuiContext as S}from"../../../../AiuiProvider/index.js";import K from"decimal.js";import{replaceTemplate as oe}from"../../../utils/textFormat.js";import{withLayout as le}from"../../../../../shared/Styles.js";import{ExposureDetector as ie}from"../../../../../components/index.js";import{gaTrack as re}from"../../../../../shared/track.js";const ce=()=>{const{locale:x="us",copyWriting:a}=S(),{product:p,variant:o,finalPrice:g,comparePrice:f,coupon:P,selectedOptions:d,selectedVariants:v,totalSavings:r,onAddToCart:D,onBuyNow:E,savingDetail:b,checkedBundle:k,joinedRecommendBuyProducts:t,setJoinedRecommendBuyProducts:u,setSavingDetail:$,addToCartLoading:O,buyNowLoading:G,profile:L,addOrder:I,setAddOrder:w}=j(),_=B(()=>p?.payload?.components?.find(l=>l.componentKey==="ProductSummary")?.data||{},[p?.payload]),[z]=v,T=B(()=>{const l=k?.variants.find(y=>y.variant.sku===z?.sku),i=new K(z?.price?.amount||0).minus(l?.price||z?.price?.amount).toNumber();let m=new K(z?.price?.amount||0);L?.email&&(m=m.minus(b?.member||0));const h=m.minus(b?.coupon).minus(i).toNumber();return Math.floor(h*100)/100},[z,k,L,b?.member,b?.coupon]),{bundleVariant:V,giftVariant:R,exchangeVariant:W}=se()||{},[c,C]=ne();ae(()=>{C({bundle:t.bundle?.value?void 0:V,gift:t.gift?.value?void 0:R,exchange:t.exchange?.value?void 0:W})},[V,R,W,t]);const H=B(()=>{const l=[];return I&&I.forEach((i,m)=>{t[i]?.value&&l.push({type:i,key:`${i}-${m}`})}),l},[I,t]),U=B(()=>{const l=d?.quantity||"",i=d?.color||d?.colour||d?.couleur||"";return`${l&&i?`${l} | ${i}`:l||i}`},[d?.quantity,d?.color,d?.colour,d?.couleur]),X=B(()=>{const l=o?.payload?.components?.find(Z=>Z.componentKey==="ProductSummary")?.data||{},{image_1920:i,image_1440:m,image_1024:h,image_768:y,image_390:Y}=l?.thumbnail||{};return(l?.thumbnail?`${i} 1920, ${m} 1440, ${h} 1024, ${y} 768, ${Y} 390`:o.image?.url)||o.image?.url},[o.image?.url,o?.payload?.components]);return o.availableForSale?e("div",{className:"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16",children:e("div",{className:"laptop:rounded-2xl bg-[#F5F5F7]",children:n(ee,{className:"tablet:p-8 tablet:!pb-0 px-4 pt-6",children:[n(q,{className:"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4",children:[e(te,{className:"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]",html:_?.readyWant?.replace?.("{title}",p?.title)}),e("div",{className:"",children:e(F,{source:X,className:"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]",imgClassName:"object-cover h-full"})})]}),n(q,{className:"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6",children:[n("div",{children:[n("div",{className:"flex flex-col gap-4",children:[e(ie,{exposureKey:"listing_selector",onExposure:()=>{re({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${o.sku}`,component_type:"image",component_name:"listing_selector",position:1}})},children:n("div",{className:"flex items-center justify-between gap-6",children:[n("div",{className:"flex items-center gap-4",children:[e(F,{source:o.image?.url||p?.images?.[0]?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),n("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[e(s,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:p.title}),e(s,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:U})]})]}),n("div",{className:"flex items-center gap-1",children:[e(s,{className:"laptop-md:text-2xl text-base font-bold",html:N({amount:T,currencyCode:o.price.currencyCode,locale:x})}),T<o?.price?.amount&&e(s,{className:"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through",html:N({amount:o?.price?.amount,currencyCode:o.price.currencyCode,locale:x})})]})]})}),H.map(({type:l,key:i})=>l==="gift"&&t?.gift?.value?e(J,{giftOperation:m=>{u?.({...t,gift:{value:void 0,canOperate:!0}}),C?.({...c,gift:m}),w?.(h=>h.filter(y=>y!=="gift"))},status:!!t?.gift,gift:t?.gift?.value,canOperate:t?.gift?.canOperate},i):l==="bundle"&&t?.bundle?.value?e(M,{bundleOperation:m=>{u?.({...t,bundle:{value:void 0,canOperate:!0}}),C?.({...c,bundle:m}),w?.(h=>h.filter(y=>y!=="bundle"))},status:!!t?.bundle,bundleListItem:t?.bundle?.value,canOperate:t?.bundle?.canOperate},i):l==="exchange"&&t?.exchange?.value?e(Q,{exchangeOperation:m=>{u?.({...t,exchange:{value:void 0,canOperate:!0}}),C?.({...c,exchange:m}),w?.(h=>h.filter(y=>y!=="exchange"))},status:!!t?.exchange,canOperate:t?.exchange?.canOperate,exchange:t?.exchange?.value},i):null)]}),(c?.bundle||c?.gift||c?.exchange)&&n("div",{className:"laptop-md:mt-8 mt-6",children:[e(s,{className:"laptop-md:text-[18px] text-sm font-bold",html:_?.recommendBuy}),n("div",{className:"laptop-md:gap-4 mt-4 flex flex-col gap-6",children:[c?.exchange&&e(Q,{exchangeOperation:l=>{u?.({...t,exchange:{value:l,canOperate:!0}}),C?.({...c,exchange:void 0}),w?.(i=>[...i,"exchange"])},canOperate:t?.exchange?.canOperate,status:!c?.exchange,exchange:c?.exchange}),c?.bundle&&e(M,{bundleOperation:l=>{$?.({...b,exchangePurchase:0}),u?.({...t,bundle:{value:l,canOperate:!0}}),C?.({...c,bundle:void 0}),w?.(i=>[...i,"bundle"])},canOperate:t?.bundle?.canOperate,status:!c?.bundle,bundleListItem:c?.bundle}),c?.gift&&e(J,{giftOperation:l=>{u?.({...t,gift:{value:l,canOperate:!0}}),C?.({...c,gift:void 0}),w?.(i=>[...i,"gift"])},canOperate:t?.gift?.canOperate,status:!c?.gift,gift:c?.gift})]})]})]}),n("div",{className:"text-right",children:[e(s,{className:"laptop:text-xl laptop-md:text-2xl text-right font-bold",html:`${oe(a?.totalPrice||"",{amount:N({amount:Math.floor(g*100)/100,currencyCode:o.price.currencyCode,locale:x})})}`}),r>0&&e(s,{className:"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through",html:N({amount:f,currencyCode:o.price.currencyCode,locale:x})}),n("div",{className:"mt-4 flex justify-end gap-3",children:[e(A,{size:"lg",variant:"secondary",loading:O,className:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",onClick:()=>D?.(),children:a?.addToCart}),e(A,{size:"lg",loading:G,variant:"primary",className:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",onClick:()=>E?.(),children:a?.shopNow})]})]})]})]})})}):null},se=()=>{const{bundle:x,variant:a,checkedBundle:p,freeGift:o,checkedGift:g,exchangePurchase:f,checkedExchangePurchase:P}=j();let d,v,r;const{bundleList:D}=x||{},{giftList:E=[]}=o||{},{giftList:b=[]}=f||{},k=D?.filter(O=>O.variants.slice(1,O.variants.length).every(G=>G.variant.availableForSale))||[],[t]=k;d=p||t;const[u]=E?.filter(O=>O.availableForSale)??[];v=g||u;const[$]=b?.filter(O=>O.availableForSale)??[];return r=P||$,{bundleVariant:d,giftVariant:v,exchangeVariant:r}},M=({bundleOperation:x,bundleListItem:a,canOperate:p,status:o})=>{const{locale:g="us",copyWriting:f}=S(),{variant:P,setCheckedBundle:d}=j(),v=a?.variants.filter(r=>r.variant.sku!==P.sku);return e("div",{className:"",children:v?.map(r=>n("div",{className:"flex items-center justify-between gap-4",children:[n("div",{className:"flex items-center gap-4",children:[e(F,{source:r?.variant?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),e("div",{className:"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]",children:e(s,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold",html:r.variant.product.title})})]}),n("div",{className:"flex flex-col items-end justify-center gap-1",children:[!!a&&n("div",{className:"flex items-center gap-1",children:[e(s,{className:"laptop-md:text-2xl text-base font-bold",html:N({amount:r?.price||0,locale:g,currencyCode:r.variant?.price?.currencyCode||""})}),r.price<r.variant.price.amount&&e(s,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:N({amount:r.variant.price.amount||0,locale:g,currencyCode:r.variant?.price?.currencyCode||""})})]}),p&&e(A,{size:"icon",variant:"link",onClick:()=>{d?.(o?void 0:a),x?.(a)},className:"size-auto shrink-0 underline",children:o?f?.remove:f?.add})]})]},r.variant.id))})},J=({giftOperation:x,gift:a,status:p,canOperate:o})=>{const{locale:g="us",copyWriting:f}=S(),{freeGift:P,setCheckedGift:d}=j(),{freeLabel:v}=P||{},{options:r}=a||{},D=B(()=>{const E=r?.find(u=>u.name==="color"||u.name==="colour"||u.name==="couleur")||{},b=r?.find(u=>u.name==="quantity")||{},k=E?E.values?.[0]?.label:"",t=b?b.values?.[0]?.label:"";return`${k&&t?t+" | "+k:t||k} | ${v}`},[v,r]);return n("div",{className:"flex items-center justify-between gap-6",children:[n("div",{className:"flex items-center gap-4",children:[e(F,{source:a?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),n("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[e(s,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:a?.product?.title}),e(s,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:D})]})]}),n("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!a&&n("div",{className:"flex items-center gap-1",children:[e(s,{className:"laptop-md:text-2xl text-base font-bold",html:v}),e(s,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:N({amount:a.price.amount,locale:g,currencyCode:a.price.currencyCode})})]}),o&&e(A,{size:"icon",variant:"link",onClick:()=>{d?.(p?void 0:a),x(a)},className:"size-auto shrink-0 underline",children:p?f?.remove:f?.add})]})]})},Q=({exchangeOperation:x,exchange:a,canOperate:p,status:o})=>{const{locale:g="us",copyWriting:f}=S(),{setCheckedExchangePurchase:P}=j();return n("div",{className:"flex items-center justify-between gap-6",children:[n("div",{className:"flex items-center gap-4",children:[e(F,{source:a?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),n("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[e(s,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:a?.product?.title}),e(s,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]"})]})]}),n("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!a&&n("div",{className:"flex items-center gap-1",children:[e(s,{className:"laptop-md:text-2xl text-base font-bold",html:N({amount:a.finalPrice?.amount||0,locale:g,currencyCode:a.price.currencyCode})}),e(s,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:N({amount:a.price?.amount||0,locale:g,currencyCode:a.price.currencyCode})})]}),p&&e(A,{size:"icon",variant:"link",onClick:()=>{P?.(o?void 0:a),x(a)},className:"size-auto shrink-0 underline",children:o?f?.remove:f?.add})]})]})};var ke=le(ce);export{ke as default};
1
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import{Text as s,Button as A,Grid as ee,GridItem as q,Picture as F,Heading as te}from"../../../../../components/index.js";import{useBizProductContext as j}from"../../../BizProductProvider.js";import{useEffect as ae,useMemo as B,useState as ne}from"react";import{formatPrice as N}from"../../../utils/index.js";import{useAiuiContext as S}from"../../../../AiuiProvider/index.js";import K from"decimal.js";import{replaceTemplate as oe}from"../../../utils/textFormat.js";import{withLayout as le}from"../../../../../shared/Styles.js";import{ExposureDetector as ie}from"../../../../../components/index.js";import{gaTrack as re}from"../../../../../shared/track.js";const ce=()=>{const{locale:x="us",copyWriting:a}=S(),{product:p,variant:o,finalPrice:g,comparePrice:f,coupon:P,selectedOptions:d,selectedVariants:v,totalSavings:r,onAddToCart:D,onBuyNow:E,savingDetail:b,checkedBundle:k,joinedRecommendBuyProducts:t,setJoinedRecommendBuyProducts:u,setSavingDetail:$,addToCartLoading:O,buyNowLoading:G,profile:L,addOrder:I,setAddOrder:w}=j(),_=B(()=>p?.payload?.components?.find(l=>l.componentKey==="ProductSummary")?.data||{},[p?.payload]),[z]=v,T=B(()=>{const l=k?.variants.find(y=>y.variant.sku===z?.sku),i=new K(z?.price?.amount||0).minus(l?.price||z?.price?.amount).toNumber();let m=new K(z?.price?.amount||0);L?.email&&(m=m.minus(b?.member||0));const h=m.minus(b?.coupon).minus(i).toNumber();return Math.floor(h*100)/100},[z,k,L,b?.member,b?.coupon]),{bundleVariant:V,giftVariant:R,exchangeVariant:W}=se()||{},[c,C]=ne();ae(()=>{C({bundle:t.bundle?.value?void 0:V,gift:t.gift?.value?void 0:R,exchange:t.exchange?.value?void 0:W})},[V,R,W,t]);const H=B(()=>{const l=[];return I&&I.forEach((i,m)=>{t[i]?.value&&l.push({type:i,key:`${i}-${m}`})}),l},[I,t]),U=B(()=>{const l=d?.quantity||"",i=d?.color||d?.colour||d?.couleur||"";return`${l&&i?`${l} | ${i}`:l||i}`},[d?.quantity,d?.color,d?.colour,d?.couleur]),X=B(()=>{const l=o?.payload?.components?.find(Z=>Z.componentKey==="ProductSummary")?.data||{},{image_1920:i,image_1440:m,image_1024:h,image_768:y,image_390:Y}=l?.thumbnail||{};return(l?.thumbnail?`${i} 1920, ${m} 1440, ${h} 1024, ${y} 768, ${Y} 390`:o.image?.url)||o.image?.url},[o.image?.url,o?.payload?.components]);return o.availableForSale?e("div",{className:"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16",children:e("div",{className:"laptop:rounded-2xl bg-[#F5F5F7]",children:n(ee,{className:"tablet:p-8 tablet:!pb-0 px-4 pt-6",children:[n(q,{className:"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4",children:[e(te,{className:"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]",html:_?.readyWant?.replace?.("{title}",p?.title)}),e("div",{className:"",children:e(F,{source:X,className:"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]",imgClassName:"object-cover h-full"})})]}),n(q,{className:"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6",children:[n("div",{children:[n("div",{className:"flex flex-col gap-4",children:[e(ie,{exposureKey:"listing_selector",onExposure:()=>{re({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${o.sku}`,component_type:"image",component_name:"listing_selector",position:1}})},children:n("div",{className:"flex items-center justify-between gap-6",children:[n("div",{className:"flex items-center gap-4",children:[e(F,{source:o.image?.url||p?.images?.[0]?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),n("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[e(s,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:p.title}),e(s,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:U})]})]}),n("div",{className:"flex items-center gap-1",children:[e(s,{className:"laptop-md:text-2xl text-base font-bold",html:N({amount:T,currencyCode:o.price.currencyCode,locale:x})}),T<o?.price?.amount&&e(s,{className:"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through",html:N({amount:o?.price?.amount,currencyCode:o.price.currencyCode,locale:x})})]})]})}),H.map(({type:l,key:i})=>l==="gift"&&t?.gift?.value?e(J,{giftOperation:m=>{u?.({...t,gift:{value:void 0,canOperate:!0}}),C?.({...c,gift:m}),w?.(h=>h.filter(y=>y!=="gift"))},status:!!t?.gift,gift:t?.gift?.value,canOperate:t?.gift?.canOperate},i):l==="bundle"&&t?.bundle?.value?e(M,{bundleOperation:m=>{u?.({...t,bundle:{value:void 0,canOperate:!0}}),C?.({...c,bundle:m}),w?.(h=>h.filter(y=>y!=="bundle"))},status:!!t?.bundle,bundleListItem:t?.bundle?.value,canOperate:t?.bundle?.canOperate},i):l==="exchange"&&t?.exchange?.value?e(Q,{exchangeOperation:m=>{u?.({...t,exchange:{value:void 0,canOperate:!0}}),C?.({...c,exchange:m}),w?.(h=>h.filter(y=>y!=="exchange"))},status:!!t?.exchange,canOperate:t?.exchange?.canOperate,exchange:t?.exchange?.value},i):null)]}),(c?.bundle||c?.gift||c?.exchange)&&n("div",{className:"laptop-md:mt-8 mt-6",children:[e(s,{className:"laptop-md:text-[18px] text-sm font-bold",html:_?.recommendBuy}),n("div",{className:"laptop-md:gap-4 mt-4 flex flex-col gap-6",children:[c?.exchange&&e(Q,{exchangeOperation:l=>{u?.({...t,exchange:{value:l,canOperate:!0}}),C?.({...c,exchange:void 0}),w?.(i=>[...i,"exchange"])},canOperate:t?.exchange?.canOperate,status:!c?.exchange,exchange:c?.exchange}),c?.bundle&&e(M,{bundleOperation:l=>{$?.({...b,exchangePurchase:0}),u?.({...t,bundle:{value:l,canOperate:!0}}),C?.({...c,bundle:void 0}),w?.(i=>[...i,"bundle"])},canOperate:t?.bundle?.canOperate,status:!c?.bundle,bundleListItem:c?.bundle}),c?.gift&&e(J,{giftOperation:l=>{u?.({...t,gift:{value:l,canOperate:!0}}),C?.({...c,gift:void 0}),w?.(i=>[...i,"gift"])},canOperate:t?.gift?.canOperate,status:!c?.gift,gift:c?.gift})]})]})]}),n("div",{className:"text-right",children:[e(s,{className:"laptop:text-xl laptop-md:text-2xl text-right font-bold",html:`${oe(a?.totalPrice||"",{amount:N({amount:Math.floor(g*100)/100,currencyCode:o.price.currencyCode,locale:x})})}`}),r>0&&e(s,{className:"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through",html:N({amount:f,currencyCode:o.price.currencyCode,locale:x})}),n("div",{className:"mt-4 flex justify-end gap-3",children:[e(A,{size:"lg",variant:"secondary",loading:O,className:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",onClick:()=>D?.(),children:a?.addToCart}),e(A,{size:"lg",loading:G,variant:"primary",className:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",onClick:()=>E?.(),children:a?.shopNow})]})]})]})]})})}):null},se=()=>{const{bundle:x,variant:a,checkedBundle:p,freeGift:o,checkedGift:g,exchangePurchase:f,checkedExchangePurchase:P}=j();let d,v,r;const{bundleList:D}=x||{},{giftList:E=[]}=o||{},{giftList:b=[]}=f||{},k=D?.filter(O=>O.variants.slice(1,O.variants.length).every(G=>G.variant.availableForSale))||[],[t]=k;d=p||t;const[u]=E?.filter(O=>O.availableForSale)??[];v=g||u;const[$]=b?.filter(O=>O.availableForSale)??[];return r=P||$,{bundleVariant:d,giftVariant:v,exchangeVariant:r}},M=({bundleOperation:x,bundleListItem:a,canOperate:p,status:o})=>{const{locale:g="us",copyWriting:f}=S(),{variant:P,setCheckedBundle:d}=j(),v=a?.variants.filter(r=>r.variant.sku!==P.sku);return e("div",{className:"",children:v?.map(r=>n("div",{className:"flex items-center justify-between gap-4",children:[n("div",{className:"flex items-center gap-4",children:[e(F,{source:r?.variant?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),e("div",{className:"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]",children:e(s,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold",html:r.variant.product.title})})]}),n("div",{className:"flex flex-col items-end justify-center gap-1",children:[!!a&&n("div",{className:"flex items-center gap-1",children:[e(s,{className:"laptop-md:text-2xl text-base font-bold",html:N({amount:r?.price||0,locale:g,currencyCode:r.variant?.price?.currencyCode||""})}),r.price<r.variant.price.amount&&e(s,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:N({amount:r.variant.price.amount||0,locale:g,currencyCode:r.variant?.price?.currencyCode||""})})]}),p&&e(A,{size:"icon",variant:"link",onClick:()=>{d?.(o?void 0:a),x?.(a)},className:"size-auto shrink-0 underline",children:o?f?.remove:f?.add})]})]},r.variant.id))})},J=({giftOperation:x,gift:a,status:p,canOperate:o})=>{const{locale:g="us",copyWriting:f}=S(),{freeGift:P,setCheckedGift:d}=j(),{freeLabel:v}=P||{},{options:r}=a||{},D=B(()=>{const E=r?.find(u=>u.name==="color"||u.name==="colour"||u.name==="couleur")||{},b=r?.find(u=>u.name==="quantity")||{},k=E?E.values?.[0]?.label:"",t=b?b.values?.[0]?.label:"";return`${k&&t?t+" | "+k:t||k} | ${v}`},[v,r]);return n("div",{className:"flex items-center justify-between gap-6",children:[n("div",{className:"flex items-center gap-4",children:[e(F,{source:a?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),n("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[e(s,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:a?.product?.title}),e(s,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:D})]})]}),n("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!a&&n("div",{className:"flex items-center gap-1",children:[e(s,{className:"laptop-md:text-2xl text-base font-bold",html:v}),e(s,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:N({amount:a.price.amount,locale:g,currencyCode:a.price.currencyCode})})]}),o&&e(A,{size:"icon",variant:"link",onClick:()=>{d?.(p?void 0:a),x(a)},className:"size-auto shrink-0 underline",children:p?f?.remove:f?.add})]})]})},Q=({exchangeOperation:x,exchange:a,canOperate:p,status:o})=>{const{locale:g="us",copyWriting:f}=S(),{setCheckedExchangePurchase:P}=j();return n("div",{className:"flex items-center justify-between gap-6",children:[n("div",{className:"flex items-center gap-4",children:[e(F,{source:a?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),n("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[e(s,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:a?.product?.title}),e(s,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]"})]})]}),n("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!a&&n("div",{className:"flex items-center gap-1",children:[e(s,{className:"laptop-md:text-2xl text-base font-bold",html:N({amount:a.finalPrice?.amount||0,locale:g,currencyCode:a.price.currencyCode})}),e(s,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:N({amount:a.price?.amount||0,locale:g,currencyCode:a.price.currencyCode})})]}),p&&e(A,{size:"icon",variant:"link",onClick:()=>{P?.(o?void 0:a),x(a)},className:"size-auto shrink-0 underline",children:o?f?.remove:f?.add})]})]})};var Pe=le(ce);export{Pe as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/biz-components/Listing/components/ProductCard/ProductSummary/index.tsx"],
4
- "sourcesContent": ["import { Text, Button, Container, Grid, GridItem, Picture, Heading } from '../../../../../components/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useEffect, useMemo, useState } from 'react'\nimport { formatPrice } from '../../../utils/index.js'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport type { BundleListItem, ProductVariant, ProductPrice, ProductOption } from '../../../types/product'\nimport Decimal from 'decimal.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\nimport { withLayout } from '../../../../../shared/Styles.js'\nimport { ExposureDetector } from '../../../../../components/index.js'\nimport { gaTrack } from '../../../../../shared/track.js'\n\nconst ProductSummary = () => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const {\n product,\n variant,\n finalPrice,\n comparePrice,\n coupon,\n selectedOptions,\n selectedVariants,\n totalSavings,\n onAddToCart,\n onBuyNow,\n savingDetail,\n checkedBundle,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n setSavingDetail,\n addToCartLoading,\n buyNowLoading,\n profile,\n addOrder,\n setAddOrder,\n } = useBizProductContext()\n\n const productSummaryData = useMemo(() => {\n return product?.payload?.components?.find((item: any) => item.componentKey === 'ProductSummary')?.data || {}\n }, [product?.payload])\n\n const [currentProductVariant] = selectedVariants\n\n const summaryFinalPrice = useMemo(() => {\n const currentBundleVariant = checkedBundle?.variants.find(v => v.variant.sku === currentProductVariant?.sku)\n const currentBundlePrice = new Decimal(currentProductVariant?.price?.amount || 0)\n .minus(currentBundleVariant?.price || currentProductVariant?.price?.amount)\n .toNumber()\n let currentProductPrice = new Decimal(currentProductVariant?.price?.amount || 0)\n if (profile?.email) {\n currentProductPrice = currentProductPrice.minus(savingDetail?.member || 0)\n }\n const finalPrice = currentProductPrice.minus(savingDetail?.coupon).minus(currentBundlePrice).toNumber()\n return Math.floor(finalPrice * 100) / 100\n }, [currentProductVariant, checkedBundle, profile, savingDetail?.member, savingDetail?.coupon])\n\n const { bundleVariant, giftVariant, exchangeVariant } = useRecommendBuyProducts() || {}\n\n const [initialRecommendBuyProducts, setInitialRecommendBuyProducts] = useState<{\n bundle?: BundleListItem\n gift?: ProductVariant\n exchange?: ProductVariant\n }>()\n\n useEffect(() => {\n setInitialRecommendBuyProducts({\n bundle: joinedRecommendBuyProducts.bundle?.value ? undefined : bundleVariant,\n gift: joinedRecommendBuyProducts.gift?.value ? undefined : giftVariant,\n exchange: joinedRecommendBuyProducts.exchange?.value ? undefined : exchangeVariant,\n })\n }, [bundleVariant, giftVariant, exchangeVariant, joinedRecommendBuyProducts])\n\n // \u6839\u636E\u6DFB\u52A0\u987A\u5E8F\u751F\u6210\u5DF2\u6DFB\u52A0\u4EA7\u54C1\u7684\u5217\u8868\n const orderedJoinedProducts = useMemo(() => {\n const result: Array<{ type: 'bundle' | 'gift' | 'exchange'; key: string }> = []\n\n // \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6DFB\u52A0\n if (addOrder) {\n addOrder.forEach((type, index) => {\n if (joinedRecommendBuyProducts[type]?.value) {\n result.push({ type, key: `${type}-${index}` })\n }\n })\n }\n\n return result\n }, [addOrder, joinedRecommendBuyProducts])\n\n const productOptionsText = useMemo(() => {\n const quantity = selectedOptions?.quantity || ''\n const color = selectedOptions?.color || selectedOptions?.colour || selectedOptions?.couleur || ''\n return `${quantity && color ? `${quantity} | ${color}` : quantity || color}`\n }, [selectedOptions?.quantity, selectedOptions?.color, selectedOptions?.colour, selectedOptions?.couleur])\n\n const variantImage = useMemo(() => {\n const variantProductSummary =\n variant?.payload?.components?.find((item: any) => item.componentKey === 'ProductSummary')?.data || {}\n const { image_1920, image_1440, image_1024, image_768, image_390 } = variantProductSummary?.thumbnail || {}\n const variantProductGalleryItemImage = variantProductSummary?.thumbnail\n ? `${image_1920} 1920, ${image_1440} 1440, ${image_1024} 1024, ${image_768} 768, ${image_390} 390`\n : variant.image?.url\n return variantProductGalleryItemImage || variant.image?.url\n }, [variant.image?.url, variant?.payload?.components])\n\n const isAvailable = variant.availableForSale\n if (!isAvailable) return null\n\n return (\n <div className=\"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16\">\n <div className=\"laptop:rounded-2xl bg-[#F5F5F7]\">\n <Grid className=\"tablet:p-8 tablet:!pb-0 px-4 pt-6\">\n <GridItem className=\"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4\">\n <Heading\n className=\"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]\"\n html={productSummaryData?.readyWant?.replace?.('{title}', product?.title)}\n />\n <div className=\"\">\n <Picture\n source={variantImage}\n className=\"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]\"\n imgClassName=\"object-cover h-full\"\n />\n </div>\n </GridItem>\n <GridItem className=\"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6\">\n <div>\n <div className=\"flex flex-col gap-4\">\n <ExposureDetector\n exposureKey=\"listing_selector\"\n onExposure={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_impression',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`,\n component_type: 'image',\n component_name: 'listing_selector',\n position: 1,\n },\n })\n }}\n >\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={product.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={productOptionsText}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: summaryFinalPrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n {summaryFinalPrice < variant?.price?.amount && (\n <Text\n className=\"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: variant?.price?.amount,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n </div>\n </ExposureDetector>\n {/* \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6E32\u67D3\u5DF2\u6DFB\u52A0\u7684\u4EA7\u54C1 */}\n {orderedJoinedProducts.map(({ type, key }) => {\n if (type === 'gift' && joinedRecommendBuyProducts?.gift?.value) {\n return (\n <ProductGiftSummary\n key={key}\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'gift'))\n }}\n status={!!joinedRecommendBuyProducts?.gift}\n gift={joinedRecommendBuyProducts?.gift?.value}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n />\n )\n }\n if (type === 'bundle' && joinedRecommendBuyProducts?.bundle?.value) {\n return (\n <ProductBundleSummary\n key={key}\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'bundle'))\n }}\n status={!!joinedRecommendBuyProducts?.bundle}\n bundleListItem={joinedRecommendBuyProducts?.bundle?.value}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n />\n )\n }\n if (type === 'exchange' && joinedRecommendBuyProducts?.exchange?.value) {\n return (\n <ProductExchangeSummary\n key={key}\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'exchange'))\n }}\n status={!!joinedRecommendBuyProducts?.exchange}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n exchange={joinedRecommendBuyProducts?.exchange?.value}\n />\n )\n }\n return null\n })}\n </div>\n {(initialRecommendBuyProducts?.bundle ||\n initialRecommendBuyProducts?.gift ||\n initialRecommendBuyProducts?.exchange) && (\n <div className=\"laptop-md:mt-8 mt-6\">\n <Text className=\"laptop-md:text-[18px] text-sm font-bold\" html={productSummaryData?.recommendBuy} />\n <div className=\"laptop-md:gap-4 mt-4 flex flex-col gap-6\">\n {initialRecommendBuyProducts?.exchange && (\n <ProductExchangeSummary\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: exchange,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'exchange'])\n }}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n status={!initialRecommendBuyProducts?.exchange}\n exchange={initialRecommendBuyProducts?.exchange}\n />\n )}\n {initialRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setSavingDetail?.({ ...savingDetail, exchangePurchase: 0 })\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: bundle,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'bundle'])\n }}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n status={!initialRecommendBuyProducts?.bundle}\n bundleListItem={initialRecommendBuyProducts?.bundle}\n />\n )}\n {initialRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: gift,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'gift'])\n }}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n status={!initialRecommendBuyProducts?.gift}\n gift={initialRecommendBuyProducts?.gift}\n />\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"text-right\">\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl text-right font-bold\"\n html={`${replaceTemplate(copyWriting?.totalPrice || '', { amount: formatPrice({ amount: Math.floor(finalPrice * 100) / 100, currencyCode: variant.price.currencyCode, locale }) })}`}\n />\n\n {totalSavings > 0 && (\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: comparePrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n <div className=\"mt-4 flex justify-end gap-3\">\n <Button\n size=\"lg\"\n variant=\"secondary\"\n loading={addToCartLoading}\n className=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n onClick={() => onAddToCart?.()}\n >\n {copyWriting?.addToCart}\n </Button>\n <Button\n size=\"lg\"\n loading={buyNowLoading}\n variant=\"primary\"\n className=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n onClick={() => onBuyNow?.()}\n >\n {copyWriting?.shopNow}\n </Button>\n </div>\n </div>\n </GridItem>\n </Grid>\n </div>\n </div>\n )\n}\n\nconst useRecommendBuyProducts = () => {\n const { bundle, variant, checkedBundle, freeGift, checkedGift, exchangePurchase, checkedExchangePurchase } =\n useBizProductContext()\n let bundleVariant = undefined\n let giftVariant = undefined\n let exchangeVariant = undefined\n const { bundleList } = bundle || {}\n\n const { giftList = [] } = freeGift || {}\n const { giftList: exchangeList = [] } = exchangePurchase || {}\n\n const availableBundleList =\n bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n ) || []\n\n const [firstAvailableBundle] = availableBundleList\n bundleVariant = checkedBundle || firstAvailableBundle\n\n const [firstAvailableGift] = giftList?.filter(gift => gift.availableForSale) ?? []\n giftVariant = checkedGift || firstAvailableGift\n\n const [firstAvailableExchange] = exchangeList?.filter(exchange => exchange.availableForSale) ?? []\n exchangeVariant = checkedExchangePurchase || firstAvailableExchange\n\n return { bundleVariant, giftVariant, exchangeVariant }\n}\n\nconst ProductBundleSummary = ({\n bundleOperation,\n bundleListItem,\n canOperate,\n status,\n}: {\n bundleOperation: (bundle?: BundleListItem) => void\n bundleListItem?: BundleListItem\n canOperate?: boolean\n status?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { variant, setCheckedBundle } = useBizProductContext()\n const bundleVariants = bundleListItem?.variants.filter(v => v.variant.sku !== variant.sku)\n\n return (\n <div className=\"\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center justify-between gap-4\" key={bundleVariant.variant.id}>\n <div className=\"flex items-center gap-4\">\n <Picture\n source={bundleVariant?.variant?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold\"\n html={bundleVariant.variant.product.title}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-1\">\n {!!bundleListItem && (\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: bundleVariant?.price || 0,\n locale,\n currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n })}\n />\n {bundleVariant.price < bundleVariant.variant.price.amount && (\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: bundleVariant.variant.price.amount || 0,\n locale,\n currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n })}\n />\n )}\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedBundle?.(status ? undefined : bundleListItem)\n bundleOperation?.(bundleListItem)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n })}\n </div>\n )\n}\n\nconst ProductGiftSummary = ({\n giftOperation,\n gift,\n status,\n canOperate,\n}: {\n giftOperation: (gift?: ProductVariant) => void\n gift?: ProductVariant\n status?: boolean\n canOperate?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { freeGift, setCheckedGift } = useBizProductContext()\n const { freeLabel } = freeGift || {}\n const { options } = gift || {}\n\n const giftOptionsText = useMemo(() => {\n const giftColorOption = (options?.find(\n option => option.name === 'color' || option.name === 'colour' || option.name === 'couleur'\n ) || {}) as ProductOption\n const giftQuantityOption = options?.find(option => option.name === 'quantity') || ({} as ProductOption)\n const giftColorOptionText = giftColorOption ? giftColorOption.values?.[0]?.label : ''\n const giftQuantityOptionText = giftQuantityOption ? giftQuantityOption.values?.[0]?.label : ''\n return `${giftColorOptionText && giftQuantityOptionText ? giftQuantityOptionText + ' | ' + giftColorOptionText : giftQuantityOptionText || giftColorOptionText} | ${freeLabel}`\n }, [freeLabel, options])\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={gift?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={gift?.product?.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={giftOptionsText}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!gift && (\n <div className=\"flex items-center gap-1\">\n <Text className=\"laptop-md:text-2xl text-base font-bold\" html={freeLabel} />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedGift?.(status ? undefined : gift)\n giftOperation(gift)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst ProductExchangeSummary = ({\n exchangeOperation,\n exchange,\n canOperate,\n status,\n}: {\n exchangeOperation: (exchange?: ProductVariant) => void\n exchange?: ProductVariant & { finalPrice?: ProductPrice }\n canOperate?: boolean\n status?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { setCheckedExchangePurchase } = useBizProductContext()\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={exchange?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={exchange?.product?.title}\n />\n <Text className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\" />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!exchange && (\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: exchange.finalPrice?.amount || 0,\n locale,\n currencyCode: exchange.price.currencyCode,\n })}\n />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: exchange.price?.amount || 0,\n locale,\n currencyCode: exchange.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedExchangePurchase?.(status ? undefined : exchange)\n exchangeOperation(exchange)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductSummary)\n"],
5
- "mappings": "AA+GU,OACE,OAAAA,EADF,QAAAC,MAAA,oBA/GV,OAAS,QAAAC,EAAM,UAAAC,EAAmB,QAAAC,GAAM,YAAAC,EAAU,WAAAC,EAAS,WAAAC,OAAe,qCAC1E,OAAS,wBAAAC,MAA4B,iCACrC,OAAS,aAAAC,GAAW,WAAAC,EAAS,YAAAC,OAAgB,QAC7C,OAAS,eAAAC,MAAmB,0BAC5B,OAAS,kBAAAC,MAAsB,oCAE/B,OAAOC,MAAa,aACpB,OAAS,mBAAAC,OAAuB,+BAChC,OAAS,cAAAC,OAAkB,kCAC3B,OAAS,oBAAAC,OAAwB,qCACjC,OAAS,WAAAC,OAAe,iCAExB,MAAMC,GAAiB,IAAM,CAC3B,KAAM,CAAE,OAAAC,EAAS,KAAM,YAAAC,CAAY,EAAIR,EAAe,EAChD,CACJ,QAAA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AAQkE,EAAS,YAAY,QAAU,EACvC,OAAA1D,EACA,aAAc0D,EAAS,MAAM,YAC/B,CAAC,EACH,EACA9E,EAACE,EAAA,CACC,UAAU,qEACV,KAAMU,EAAY,CAChB,OAAQkE,EAAS,OAAO,QAAU,EAClC,OAAA1D,EACA,aAAc0D,EAAS,MAAM,YAC/B,CAAC,EACH,GACF,EAEDc,GACC5F,EAACG,EAAA,CACC,KAAK,OACL,QAAQ,OACR,QAAS,IAAM,CACbwG,IAA6Bd,EAAS,OAAYf,CAAQ,EAC1D4B,EAAkB5B,CAAQ,CAC5B,EACA,UAAU,+BAET,SAAAe,EAASxE,GAAa,OAASA,GAAa,IAC/C,GAEJ,GACF,CAEJ,EAEA,IAAOuF,GAAQ5F,GAAWG,EAAc",
4
+ "sourcesContent": ["import { Text, Button, Grid, GridItem, Picture, Heading } from '../../../../../components/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useEffect, useMemo, useState } from 'react'\nimport { formatPrice } from '../../../utils/index.js'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport type { BundleListItem, ProductVariant, ProductPrice, ProductOption } from '../../../types/product'\nimport Decimal from 'decimal.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\nimport { withLayout } from '../../../../../shared/Styles.js'\nimport { ExposureDetector } from '../../../../../components/index.js'\nimport { gaTrack } from '../../../../../shared/track.js'\n\nconst ProductSummary = () => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const {\n product,\n variant,\n finalPrice,\n comparePrice,\n coupon,\n selectedOptions,\n selectedVariants,\n totalSavings,\n onAddToCart,\n onBuyNow,\n savingDetail,\n checkedBundle,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n setSavingDetail,\n addToCartLoading,\n buyNowLoading,\n profile,\n addOrder,\n setAddOrder,\n } = useBizProductContext()\n\n const productSummaryData = useMemo(() => {\n return product?.payload?.components?.find((item: any) => item.componentKey === 'ProductSummary')?.data || {}\n }, [product?.payload])\n\n const [currentProductVariant] = selectedVariants\n\n const summaryFinalPrice = useMemo(() => {\n const currentBundleVariant = checkedBundle?.variants.find(v => v.variant.sku === currentProductVariant?.sku)\n const currentBundlePrice = new Decimal(currentProductVariant?.price?.amount || 0)\n .minus(currentBundleVariant?.price || currentProductVariant?.price?.amount)\n .toNumber()\n let currentProductPrice = new Decimal(currentProductVariant?.price?.amount || 0)\n if (profile?.email) {\n currentProductPrice = currentProductPrice.minus(savingDetail?.member || 0)\n }\n const finalPrice = currentProductPrice.minus(savingDetail?.coupon).minus(currentBundlePrice).toNumber()\n return Math.floor(finalPrice * 100) / 100\n }, [currentProductVariant, checkedBundle, profile, savingDetail?.member, savingDetail?.coupon])\n\n const { bundleVariant, giftVariant, exchangeVariant } = useRecommendBuyProducts() || {}\n\n const [initialRecommendBuyProducts, setInitialRecommendBuyProducts] = useState<{\n bundle?: BundleListItem\n gift?: ProductVariant\n exchange?: ProductVariant\n }>()\n\n useEffect(() => {\n setInitialRecommendBuyProducts({\n bundle: joinedRecommendBuyProducts.bundle?.value ? undefined : bundleVariant,\n gift: joinedRecommendBuyProducts.gift?.value ? undefined : giftVariant,\n exchange: joinedRecommendBuyProducts.exchange?.value ? undefined : exchangeVariant,\n })\n }, [bundleVariant, giftVariant, exchangeVariant, joinedRecommendBuyProducts])\n\n // \u6839\u636E\u6DFB\u52A0\u987A\u5E8F\u751F\u6210\u5DF2\u6DFB\u52A0\u4EA7\u54C1\u7684\u5217\u8868\n const orderedJoinedProducts = useMemo(() => {\n const result: Array<{ type: 'bundle' | 'gift' | 'exchange'; key: string }> = []\n\n // \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6DFB\u52A0\n if (addOrder) {\n addOrder.forEach((type, index) => {\n if (joinedRecommendBuyProducts[type]?.value) {\n result.push({ type, key: `${type}-${index}` })\n }\n })\n }\n\n return result\n }, [addOrder, joinedRecommendBuyProducts])\n\n const productOptionsText = useMemo(() => {\n const quantity = selectedOptions?.quantity || ''\n const color = selectedOptions?.color || selectedOptions?.colour || selectedOptions?.couleur || ''\n return `${quantity && color ? `${quantity} | ${color}` : quantity || color}`\n }, [selectedOptions?.quantity, selectedOptions?.color, selectedOptions?.colour, selectedOptions?.couleur])\n\n const variantImage = useMemo(() => {\n const variantProductSummary =\n variant?.payload?.components?.find((item: any) => item.componentKey === 'ProductSummary')?.data || {}\n const { image_1920, image_1440, image_1024, image_768, image_390 } = variantProductSummary?.thumbnail || {}\n const variantProductGalleryItemImage = variantProductSummary?.thumbnail\n ? `${image_1920} 1920, ${image_1440} 1440, ${image_1024} 1024, ${image_768} 768, ${image_390} 390`\n : variant.image?.url\n return variantProductGalleryItemImage || variant.image?.url\n }, [variant.image?.url, variant?.payload?.components])\n\n const isAvailable = variant.availableForSale\n if (!isAvailable) return null\n\n return (\n <div className=\"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16\">\n <div className=\"laptop:rounded-2xl bg-[#F5F5F7]\">\n <Grid className=\"tablet:p-8 tablet:!pb-0 px-4 pt-6\">\n <GridItem className=\"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4\">\n <Heading\n className=\"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]\"\n html={productSummaryData?.readyWant?.replace?.('{title}', product?.title)}\n />\n <div className=\"\">\n <Picture\n source={variantImage}\n className=\"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]\"\n imgClassName=\"object-cover h-full\"\n />\n </div>\n </GridItem>\n <GridItem className=\"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6\">\n <div>\n <div className=\"flex flex-col gap-4\">\n <ExposureDetector\n exposureKey=\"listing_selector\"\n onExposure={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_impression',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`,\n component_type: 'image',\n component_name: 'listing_selector',\n position: 1,\n },\n })\n }}\n >\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={product.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={productOptionsText}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: summaryFinalPrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n {summaryFinalPrice < variant?.price?.amount && (\n <Text\n className=\"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: variant?.price?.amount,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n </div>\n </ExposureDetector>\n {/* \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6E32\u67D3\u5DF2\u6DFB\u52A0\u7684\u4EA7\u54C1 */}\n {orderedJoinedProducts.map(({ type, key }) => {\n if (type === 'gift' && joinedRecommendBuyProducts?.gift?.value) {\n return (\n <ProductGiftSummary\n key={key}\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'gift'))\n }}\n status={!!joinedRecommendBuyProducts?.gift}\n gift={joinedRecommendBuyProducts?.gift?.value}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n />\n )\n }\n if (type === 'bundle' && joinedRecommendBuyProducts?.bundle?.value) {\n return (\n <ProductBundleSummary\n key={key}\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'bundle'))\n }}\n status={!!joinedRecommendBuyProducts?.bundle}\n bundleListItem={joinedRecommendBuyProducts?.bundle?.value}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n />\n )\n }\n if (type === 'exchange' && joinedRecommendBuyProducts?.exchange?.value) {\n return (\n <ProductExchangeSummary\n key={key}\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'exchange'))\n }}\n status={!!joinedRecommendBuyProducts?.exchange}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n exchange={joinedRecommendBuyProducts?.exchange?.value}\n />\n )\n }\n return null\n })}\n </div>\n {(initialRecommendBuyProducts?.bundle ||\n initialRecommendBuyProducts?.gift ||\n initialRecommendBuyProducts?.exchange) && (\n <div className=\"laptop-md:mt-8 mt-6\">\n <Text className=\"laptop-md:text-[18px] text-sm font-bold\" html={productSummaryData?.recommendBuy} />\n <div className=\"laptop-md:gap-4 mt-4 flex flex-col gap-6\">\n {initialRecommendBuyProducts?.exchange && (\n <ProductExchangeSummary\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: exchange,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'exchange'])\n }}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n status={!initialRecommendBuyProducts?.exchange}\n exchange={initialRecommendBuyProducts?.exchange}\n />\n )}\n {initialRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setSavingDetail?.({ ...savingDetail, exchangePurchase: 0 })\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: bundle,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'bundle'])\n }}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n status={!initialRecommendBuyProducts?.bundle}\n bundleListItem={initialRecommendBuyProducts?.bundle}\n />\n )}\n {initialRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: gift,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'gift'])\n }}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n status={!initialRecommendBuyProducts?.gift}\n gift={initialRecommendBuyProducts?.gift}\n />\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"text-right\">\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl text-right font-bold\"\n html={`${replaceTemplate(copyWriting?.totalPrice || '', { amount: formatPrice({ amount: Math.floor(finalPrice * 100) / 100, currencyCode: variant.price.currencyCode, locale }) })}`}\n />\n\n {totalSavings > 0 && (\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: comparePrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n <div className=\"mt-4 flex justify-end gap-3\">\n <Button\n size=\"lg\"\n variant=\"secondary\"\n loading={addToCartLoading}\n className=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n onClick={() => onAddToCart?.()}\n >\n {copyWriting?.addToCart}\n </Button>\n <Button\n size=\"lg\"\n loading={buyNowLoading}\n variant=\"primary\"\n className=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n onClick={() => onBuyNow?.()}\n >\n {copyWriting?.shopNow}\n </Button>\n </div>\n </div>\n </GridItem>\n </Grid>\n </div>\n </div>\n )\n}\n\nconst useRecommendBuyProducts = () => {\n const { bundle, variant, checkedBundle, freeGift, checkedGift, exchangePurchase, checkedExchangePurchase } =\n useBizProductContext()\n let bundleVariant = undefined\n let giftVariant = undefined\n let exchangeVariant = undefined\n const { bundleList } = bundle || {}\n\n const { giftList = [] } = freeGift || {}\n const { giftList: exchangeList = [] } = exchangePurchase || {}\n\n const availableBundleList =\n bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n ) || []\n\n const [firstAvailableBundle] = availableBundleList\n bundleVariant = checkedBundle || firstAvailableBundle\n\n const [firstAvailableGift] = giftList?.filter(gift => gift.availableForSale) ?? []\n giftVariant = checkedGift || firstAvailableGift\n\n const [firstAvailableExchange] = exchangeList?.filter(exchange => exchange.availableForSale) ?? []\n exchangeVariant = checkedExchangePurchase || firstAvailableExchange\n\n return { bundleVariant, giftVariant, exchangeVariant }\n}\n\nconst ProductBundleSummary = ({\n bundleOperation,\n bundleListItem,\n canOperate,\n status,\n}: {\n bundleOperation: (bundle?: BundleListItem) => void\n bundleListItem?: BundleListItem\n canOperate?: boolean\n status?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { variant, setCheckedBundle } = useBizProductContext()\n const bundleVariants = bundleListItem?.variants.filter(v => v.variant.sku !== variant.sku)\n\n return (\n <div className=\"\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center justify-between gap-4\" key={bundleVariant.variant.id}>\n <div className=\"flex items-center gap-4\">\n <Picture\n source={bundleVariant?.variant?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold\"\n html={bundleVariant.variant.product.title}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-1\">\n {!!bundleListItem && (\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: bundleVariant?.price || 0,\n locale,\n currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n })}\n />\n {bundleVariant.price < bundleVariant.variant.price.amount && (\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: bundleVariant.variant.price.amount || 0,\n locale,\n currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n })}\n />\n )}\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedBundle?.(status ? undefined : bundleListItem)\n bundleOperation?.(bundleListItem)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n })}\n </div>\n )\n}\n\nconst ProductGiftSummary = ({\n giftOperation,\n gift,\n status,\n canOperate,\n}: {\n giftOperation: (gift?: ProductVariant) => void\n gift?: ProductVariant\n status?: boolean\n canOperate?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { freeGift, setCheckedGift } = useBizProductContext()\n const { freeLabel } = freeGift || {}\n const { options } = gift || {}\n\n const giftOptionsText = useMemo(() => {\n const giftColorOption = (options?.find(\n option => option.name === 'color' || option.name === 'colour' || option.name === 'couleur'\n ) || {}) as ProductOption\n const giftQuantityOption = options?.find(option => option.name === 'quantity') || ({} as ProductOption)\n const giftColorOptionText = giftColorOption ? giftColorOption.values?.[0]?.label : ''\n const giftQuantityOptionText = giftQuantityOption ? giftQuantityOption.values?.[0]?.label : ''\n return `${giftColorOptionText && giftQuantityOptionText ? giftQuantityOptionText + ' | ' + giftColorOptionText : giftQuantityOptionText || giftColorOptionText} | ${freeLabel}`\n }, [freeLabel, options])\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={gift?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={gift?.product?.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={giftOptionsText}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!gift && (\n <div className=\"flex items-center gap-1\">\n <Text className=\"laptop-md:text-2xl text-base font-bold\" html={freeLabel} />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedGift?.(status ? undefined : gift)\n giftOperation(gift)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst ProductExchangeSummary = ({\n exchangeOperation,\n exchange,\n canOperate,\n status,\n}: {\n exchangeOperation: (exchange?: ProductVariant) => void\n exchange?: ProductVariant & { finalPrice?: ProductPrice }\n canOperate?: boolean\n status?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { setCheckedExchangePurchase } = useBizProductContext()\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={exchange?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={exchange?.product?.title}\n />\n <Text className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\" />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!exchange && (\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: exchange.finalPrice?.amount || 0,\n locale,\n currencyCode: exchange.price.currencyCode,\n })}\n />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: exchange.price?.amount || 0,\n locale,\n currencyCode: exchange.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedExchangePurchase?.(status ? undefined : exchange)\n exchangeOperation(exchange)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductSummary)\n"],
5
+ "mappings": "AA+GU,OACE,OAAAA,EADF,QAAAC,MAAA,oBA/GV,OAAS,QAAAC,EAAM,UAAAC,EAAQ,QAAAC,GAAM,YAAAC,EAAU,WAAAC,EAAS,WAAAC,OAAe,qCAC/D,OAAS,wBAAAC,MAA4B,iCACrC,OAAS,aAAAC,GAAW,WAAAC,EAAS,YAAAC,OAAgB,QAC7C,OAAS,eAAAC,MAAmB,0BAC5B,OAAS,kBAAAC,MAAsB,oCAE/B,OAAOC,MAAa,aACpB,OAAS,mBAAAC,OAAuB,+BAChC,OAAS,cAAAC,OAAkB,kCAC3B,OAAS,oBAAAC,OAAwB,qCACjC,OAAS,WAAAC,OAAe,iCAExB,MAAMC,GAAiB,IAAM,CAC3B,KAAM,CAAE,OAAAC,EAAS,KAAM,YAAAC,CAAY,EAAIR,EAAe,EAChD,CACJ,QAAAS,EACA,QAAAC,EACA,WAAAC,EACA,aAAAC,EACA,OAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,aAAAC,EACA,YAAAC,EACA,SAAAC,EACA,aAAAC,EACA,cAAAC,EACA,2BAAAC,EACA,8BAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,cAAAC,EACA,QAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAAIjC,EAAqB,EAEnBkC,EAAqBhC,EAAQ,IAC1BY,GAAS,SAAS,YAAY,KAAMqB,GAAcA,EAAK,eAAiB,gBAAgB,GAAG,MAAQ,CAAC,EAC1G,CAACrB,GAAS,OAAO,CAAC,EAEf,CAACsB,CAAqB,EAAIhB,EAE1BiB,EAAoBnC,EAAQ,IAAM,CACtC,MAAMoC,EAAuBb,GAAe,SAAS,KAAKc,GAAKA,EAAE,QAAQ,MAAQH,GAAuB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"useBizProductContext", "useEffect", "useMemo", "useState", "formatPrice", "useAiuiContext", "Decimal", "replaceTemplate", "withLayout", "ExposureDetector", "gaTrack", "ProductSummary", "locale", "copyWriting", "product", "variant", "finalPrice", "comparePrice", "coupon", "selectedOptions", "selectedVariants", "totalSavings", "onAddToCart", "onBuyNow", "savingDetail", "checkedBundle", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "setSavingDetail", "addToCartLoading", "buyNowLoading", "profile", "addOrder", "setAddOrder", "productSummaryData", "item", "currentProductVariant", "summaryFinalPrice", "currentBundleVariant", "v", "currentBundlePrice", "currentProductPrice", "bundleVariant", "giftVariant", "exchangeVariant", "useRecommendBuyProducts", "initialRecommendBuyProducts", "setInitialRecommendBuyProducts", "orderedJoinedProducts", "result", "type", "index", "productOptionsText", "quantity", "color", "variantImage", "variantProductSummary", "image_1920", "image_1440", "image_1024", "image_768", "image_390", "key", "ProductGiftSummary", "gift", "prev", "t", "ProductBundleSummary", "bundle", "ProductExchangeSummary", "exchange", "freeGift", "checkedGift", "exchangePurchase", "checkedExchangePurchase", "bundleList", "giftList", "exchangeList", "availableBundleList", "firstAvailableBundle", "firstAvailableGift", "firstAvailableExchange", "bundleOperation", "bundleListItem", "canOperate", "status", "setCheckedBundle", "bundleVariants", "giftOperation", "setCheckedGift", "freeLabel", "options", "giftOptionsText", "giftColorOption", "option", "giftQuantityOption", "giftColorOptionText", "giftQuantityOptionText", "exchangeOperation", "setCheckedExchangePurchase", "ProductSummary_default"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/SelectStore/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport { cn } from '../../helpers/utils.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport type { Img } from '../../types/props.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Picture, Text } from '../../components/index.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { useRef } from 'react'\n\nexport type SelectStoreDataType = {\n title: string\n desc: string\n img: Img\n mobileImg: Img\n padImg: Img\n miniImg: Img\n // pay: {\n // img: Img\n // }[]\n // delivery: {\n // img: Img\n // }[]\n // service: {\n // title: string\n // img: Img\n // }[]\n}\n\ntype SelectStoreType = {\n data: {\n list: SelectStoreDataType[]\n }\n className?: string\n}\n\nconst componentType = 'image'\nconst componentName = 'select_store'\n\nconst Item = ({ index, item }: { index: number; item: SelectStoreDataType }) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useExposure(ref, {\n componentType: componentType,\n componentName: componentName,\n position: index + 1,\n componentTitle: item.title,\n componentDescription: item.desc,\n })\n\n return (\n <div\n ref={ref}\n className=\"lg-desktop:aspect-[543/320] laptop:aspect-[440/280] tablet:aspect-[346/240] select-store-wrapper rounded-box relative flex aspect-[358/240] flex-col overflow-hidden bg-[#EAEAEC]\"\n >\n <Picture\n className=\"object-cover\"\n imgClassName=\"w-full object-cover\"\n source={`${item?.img?.url}, ${item?.padImg?.url} 1439, ${item?.miniImg?.url} 1023, ${item?.mobileImg?.url} 767`}\n />\n <div className=\"laptop:px-6 laptop:pb-6 lg-desktop:px-8 lg-desktop:pb-8 px-4 pb-4\">\n <Text\n html={item?.title}\n className=\"lg-desktop:text-[24px] text-[20px] leading-[1.2] text-[#1d1d1f] [&_*_strong]:!font-bold\"\n />\n <Text\n html={item?.desc}\n className=\"lg-desktop:text-[16px] line-clamp-1 text-[14px] leading-[1.4] text-[#1d1d1f]\"\n />\n </div>\n </div>\n )\n}\n\nconst SelectStore = (props: SelectStoreType) => {\n const { data, className } = props\n const { list } = data\n // const number = list?.[2]?.service?.length || 0\n return (\n <>\n <div className=\"\">\n <div className=\"laptop:grid-cols-3 tablet:grid-cols-2 grid grid-cols-1 gap-4\">\n {list.map((item, index) => (\n <Item key={index} index={index} item={item} />\n ))}\n </div>\n {/* <div className='grid desktop:grid-cols-3 tablet:grid-cols-2 grid-cols-1 gap-4'>\n {list.map((item, index) => (\n <div key={index} className='bg-[#EAEAEC] rounded-2xl min-h-[240px] laptop:min-h-[280px] lg-desktop:min-h-[320px]'>\n <div className='flex flex-col laptop:p-[24px] lg-desktop:p-[32px] p-[16px] justify-start h-full'>\n <div className=\"flex flex-col justify-center flex-1\">\n \n {item?.pay && (\n <div className='flex gap-[16px] flex-wrap items-center justify-center laptop:gap-[24px]'>\n {item?.pay?.map((pay, ind)=>{\n return (\n <div key={ind} className='laptop:w-[60px] w-[48px]'>\n <Picture\n className=\" w-full\"\n imgClassName=\"\"\n source={pay?.img?.url}\n alt={pay?.img?.alt || ''}\n />\n </div>\n )\n })}\n </div>\n )}\n \n {\n item?.delivery && (\n <div className='flex gap-[24px] items-center justify-center'>\n {item?.delivery?.map((delivery, ind)=>{\n return (\n <div key={ind} className=''>\n <Picture\n className={` ${ind === 0 ? 'laptop:w-[174px] w-[116px]' : 'laptop:w-[75px] w-[50px]'}`}\n imgClassName=\"\"\n source={delivery?.img?.url}\n alt={delivery?.img?.alt || ''}\n />\n </div>\n )\n })}\n </div>\n ) \n }\n \n {\n item?.service && (\n <div className=' desktop:gap-[24px] gap-[8px] tablet:gap-[12px] laptop:gap-[28px] grid l-tablet:grid-cols-2 tablet:flex flex-wrap desktop:grid-cols-4 items-center justify-center'>\n {item?.service?.map((service, ind)=>{\n // \u5224\u65AD\uFF1A\u53EA\u5BF9\u7B2C\u4E94\u6761\uFF08index === 4\uFF09\u5E94\u7528\u54CD\u5E94\u5F0F\u663E\u793A/\u9690\u85CF\n const isFifth = ind === 4;\n return (\n <div key={ind} className={`\n flex flex-col items-center desktop:h-full w-[157px] justify-start desktop:w-[81px]\n ${isFifth ? 'laptop:flex desktop:hidden hidden' : ''} \n `}>\n <div className='w-[70px] desktop:w-[54px]'>\n <Picture\n className=\"\"\n imgClassName=\"w-full h-auto\"\n source={service?.img?.url}\n alt={service?.img?.alt || ''}\n />\n </div>\n <div className='text-center'>\n <Text html={service?.title} className=' font-bold text-[12px] mt-[8px] leading-[1.4]' />\n </div>\n </div>\n )\n })}\n </div>\n )\n }\n </div>\n <div className='mt-auto'>\n <Text html={item?.title} className='text-[20px] lg-desktop:text-[24px] [&_*_strong]:!font-bold leading-[1.2] text-[#1d1d1f]'/>\n <Text html={item?.desc} className='text-[14px] line-clamp-1 lg-desktop:text-[16px] leading-[1.4] text-[#1d1d1f]'/>\n </div>\n \n </div>\n </div>\n ))}\n </div> */}\n </div>\n </>\n )\n}\n\nexport default withLayout(SelectStore)\n"],
4
+ "sourcesContent": ["'use client'\nimport { cn } from '../../helpers/utils.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport type { Img } from '../../types/props.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Picture, Text } from '../../components/index.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { useRef } from 'react'\n\nexport type SelectStoreDataType = {\n title: string\n desc: string\n img: Img\n mobileImg: Img\n padImg: Img\n miniImg: Img\n // pay: {\n // img: Img\n // }[]\n // delivery: {\n // img: Img\n // }[]\n // service: {\n // title: string\n // img: Img\n // }[]\n}\n\ntype SelectStoreType = {\n data: {\n list: SelectStoreDataType[]\n }\n className?: string\n}\n\nconst componentType = 'image'\nconst componentName = 'select_store'\n\nconst Item = ({ index, item }: { index: number; item: SelectStoreDataType }) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useExposure(ref, {\n componentType: componentType,\n componentName: componentName,\n position: index + 1,\n componentTitle: item.title,\n componentDescription: item.desc,\n })\n\n return (\n <div\n ref={ref}\n className=\"lg-desktop:aspect-[543/320] laptop:aspect-[440/280] tablet:aspect-[346/240] select-store-wrapper rounded-box relative flex aspect-[358/240] flex-col overflow-hidden bg-[#EAEAEC]\"\n >\n <Picture\n className=\"object-cover\"\n imgClassName=\"w-full object-cover\"\n source={`${item?.img?.url}, ${item?.padImg?.url} 1439, ${item?.miniImg?.url} 1023, ${item?.mobileImg?.url} 767`}\n />\n <div className=\"laptop:px-6 laptop:pb-6 lg-desktop:px-8 lg-desktop:pb-8 px-4 pb-4\">\n <Text\n html={item?.title}\n className=\"lg-desktop:text-[24px] text-[20px] leading-[1.2] text-[#1d1d1f] [&_*_strong]:!font-bold\"\n />\n <Text\n html={item?.desc}\n className=\"lg-desktop:text-[16px] line-clamp-1 text-[14px] leading-[1.4] text-[#1d1d1f]\"\n />\n </div>\n </div>\n )\n}\n\nconst SelectStore = (props: SelectStoreType) => {\n const { data, className } = props\n const { list } = data\n // const number = list?.[2]?.service?.length || 0\n return (\n <>\n <div className=\"\">\n <div className=\"laptop:grid-cols-3 tablet:grid-cols-2 grid grid-cols-1 gap-4\">\n {list.map((item, index) => (\n <Item key={index} index={index} item={item} />\n ))}\n </div>\n {/* <div className='grid desktop:grid-cols-3 tablet:grid-cols-2 grid-cols-1 gap-4'>\n {list.map((item, index) => (\n <div key={index} className='bg-[#EAEAEC] rounded-2xl min-h-[240px] laptop:min-h-[280px] lg-desktop:min-h-[320px]'>\n <div className='flex flex-col laptop:p-[24px] lg-desktop:p-[32px] p-[16px] justify-start h-full'>\n <div className=\"flex flex-col justify-center flex-1\">\n \n {item?.pay && (\n <div className='flex gap-[16px] flex-wrap items-center justify-center laptop:gap-[24px]'>\n {item?.pay?.map((pay, ind)=>{\n return (\n <div key={ind} className='laptop:w-[60px] w-[48px]'>\n <Picture\n className=\" w-full\"\n imgClassName=\"\"\n source={pay?.img?.url}\n alt={pay?.img?.alt || ''}\n />\n </div>\n )\n })}\n </div>\n )}\n \n {\n item?.delivery && (\n <div className='flex gap-[24px] items-center justify-center'>\n {item?.delivery?.map((delivery, ind)=>{\n return (\n <div key={ind} className=''>\n <Picture\n className={` ${ind === 0 ? 'laptop:w-[174px] w-[116px]' : 'laptop:w-[75px] w-[50px]'}`}\n imgClassName=\"\"\n source={delivery?.img?.url}\n alt={delivery?.img?.alt || ''}\n />\n </div>\n )\n })}\n </div>\n ) \n }\n \n {\n item?.service && (\n <div className=' desktop:gap-[24px] gap-[8px] tablet:gap-[12px] laptop:gap-[28px] grid l-tablet:grid-cols-2 tablet:flex flex-wrap desktop:grid-cols-4 items-center justify-center'>\n {item?.service?.map((service, ind)=>{\n // \u5224\u65AD\uFF1A\u53EA\u5BF9\u7B2C\u4E94\u6761\uFF08index === 4\uFF09\u5E94\u7528\u54CD\u5E94\u5F0F\u663E\u793A/\u9690\u85CF\n const isFifth = ind === 4;\n return (\n <div key={ind} className={`\n flex flex-col items-center desktop:h-full w-[157px] justify-start desktop:w-[81px]\n ${isFifth ? 'laptop:flex desktop:hidden hidden' : ''} \n `}>\n <div className='w-[70px] desktop:w-[54px]'>\n <Picture\n className=\"\"\n imgClassName=\"w-full h-auto\"\n source={service?.img?.url}\n alt={service?.img?.alt || ''}\n />\n </div>\n <div className='text-center'>\n <Text html={service?.title} className=' font-bold text-[12px] mt-[8px] leading-[1.4]' />\n </div>\n </div>\n )\n })}\n </div>\n )\n }\n </div>\n <div className='mt-auto'>\n <Text html={item?.title} className='text-[20px] lg-desktop:text-[24px] [&_*_strong]:!font-bold leading-[1.2] text-[#080A0F]'/>\n <Text html={item?.desc} className='text-[14px] line-clamp-1 lg-desktop:text-[16px] leading-[1.4] text-[#080A0F]'/>\n </div>\n \n </div>\n </div>\n ))}\n </div> */}\n </div>\n </>\n )\n}\n\nexport default withLayout(SelectStore)\n"],
5
5
  "mappings": "aAsDM,OAwBF,YAAAA,EAxBE,OAAAC,EAKA,QAAAC,MALA,oBArDN,MAAmB,yBACnB,MAAsB,wBAEtB,OAAS,cAAAC,MAAkB,yBAC3B,OAAS,WAAAC,EAAS,QAAAC,MAAY,4BAC9B,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,UAAAC,MAAc,QA4BvB,MAAMC,EAAgB,QAChBC,EAAgB,eAEhBC,EAAO,CAAC,CAAE,MAAAC,EAAO,KAAAC,CAAK,IAAoD,CAC9E,MAAMC,EAAMN,EAAuB,IAAI,EAEvC,OAAAD,EAAYO,EAAK,CACf,cAAeL,EACf,cAAeC,EACf,SAAUE,EAAQ,EAClB,eAAgBC,EAAK,MACrB,qBAAsBA,EAAK,IAC7B,CAAC,EAGCV,EAAC,OACC,IAAKW,EACL,UAAU,oLAEV,UAAAZ,EAACG,EAAA,CACC,UAAU,eACV,aAAa,sBACb,OAAQ,GAAGQ,GAAM,KAAK,GAAG,KAAKA,GAAM,QAAQ,GAAG,UAAUA,GAAM,SAAS,GAAG,UAAUA,GAAM,WAAW,GAAG,OAC3G,EACAV,EAAC,OAAI,UAAU,oEACb,UAAAD,EAACI,EAAA,CACC,KAAMO,GAAM,MACZ,UAAU,0FACZ,EACAX,EAACI,EAAA,CACC,KAAMO,GAAM,KACZ,UAAU,+EACZ,GACF,GACF,CAEJ,EAEME,EAAeC,GAA2B,CAC9C,KAAM,CAAE,KAAAC,EAAM,UAAAC,CAAU,EAAIF,EACtB,CAAE,KAAAG,CAAK,EAAIF,EAEjB,OACEf,EAAAD,EAAA,CACE,SAAAC,EAAC,OAAI,UAAU,GACb,SAAAA,EAAC,OAAI,UAAU,+DACZ,SAAAiB,EAAK,IAAI,CAACN,EAAMD,IACfV,EAACS,EAAA,CAAiB,MAAOC,EAAO,KAAMC,GAA3BD,CAAiC,CAC7C,EACH,EAiFF,EACF,CAEJ,EAEA,IAAOQ,EAAQhB,EAAWW,CAAW",
6
6
  "names": ["Fragment", "jsx", "jsxs", "withLayout", "Picture", "Text", "useExposure", "useRef", "componentType", "componentName", "Item", "index", "item", "ref", "SelectStore", "props", "data", "className", "list", "SelectStore_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- var i=(n=>(n.hideChannel="wsch",n.appChannel="wsap",n.udcChannel="wsuc",n))(i||{});function p(a){return a?typeof a=="string"&&a.includes("/")?a?.split("/")?.pop()?.split("?")?.shift():a:null}class c{static isHideChannelCoupon(t){return!!t?.toLowerCase().startsWith("wsch")}static isAppChannelCoupon(t){return!!t?.toLowerCase().startsWith("wsap")}static isUDCChannelCoupon(t){return!!t?.toLowerCase().startsWith("wsuc")}static isCouponInValidPeriod(t){const o=new Date().getTime(),n=t?.ends_at===null||t?.ends_at===void 0,s=new Date(t?.ends_at).getTime()>o,e=new Date(t?.starts_at).getTime()<=o;return(n||s)&&e}static getMatchChannelCoupons(t,o){if(!o||t.length===0)return[];const n=o.toLowerCase(),s=[];for(const e of t){const r=e?.title.toLowerCase();if(r===n)return[e];r.includes(n)&&s.push(e)}return s}static isCouponMatchVariant(t,o){return t?.variant_shopify_id===+p(o?.id)}static validateVariantCoupon(t){const o=t?.coupons||t?.metafields?.coupons||[],n=t?.custom_coupons||t?.metafields?.custom_coupons||[],s=Array.isArray(o)&&o.length>0,e=Array.isArray(n)&&n.length>0;return s||e}static getValidCustomCoupon({customDataItem:t,udcGroupIds:o,udcWhiteGroupIds:n}){const{udcGroups:s,whiteGroups:e}=t;return s?.some(u=>o?.includes(u))?!0:e?.some(u=>n?.includes(u))}}export{i as CouponType,c as CouponUtils,p as atobID};
1
+ var i=(n=>(n.hideChannel="wsch",n.appChannel="wsap",n.udcChannel="wsuc",n))(i||{});function p(a){return a?typeof a=="string"&&a.includes("/")?a?.split("/")?.pop()?.split("?")?.shift():a:null}class c{static isHideChannelCoupon(t){return!!t?.toLowerCase().startsWith("wsch")}static isAppChannelCoupon(t){return!!t?.toLowerCase().startsWith("wsap")}static isUDCChannelCoupon(t){return!!t?.toLowerCase().startsWith("wsuc")}static isCouponInValidPeriod(t){const o=new Date().getTime(),n=t?.ends_at===null||t?.ends_at===void 0,s=new Date(t?.ends_at).getTime()>o,e=new Date(t?.starts_at).getTime()<=o;return(n||s)&&e}static getMatchChannelCoupons(t,o){if(!o||t.length===0)return[];const n=o.toLowerCase(),s=[];for(const e of t){const r=e?.title?.toLowerCase();if(r===n)return[e];r.includes(n)&&s.push(e)}return s}static isCouponMatchVariant(t,o){return t?.variant_shopify_id===+p(o?.id)}static validateVariantCoupon(t){const o=t?.coupons||t?.metafields?.coupons||[],n=t?.custom_coupons||t?.metafields?.custom_coupons||[],s=Array.isArray(o)&&o.length>0,e=Array.isArray(n)&&n.length>0;return s||e}static getValidCustomCoupon({customDataItem:t,udcGroupIds:o,udcWhiteGroupIds:n}){const{udcGroups:s,whiteGroups:e}=t;return s?.some(u=>o?.includes(u))?!0:e?.some(u=>n?.includes(u))}}export{i as CouponType,c as CouponUtils,p as atobID};
2
2
  //# sourceMappingURL=couponUtils.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/ShelfDisplay/couponUtils.ts"],
4
- "sourcesContent": ["import type { ProductVariant, VariantCoupon } from './couponType'\n\nexport enum CouponType {\n hideChannel = 'wsch',\n appChannel = 'wsap',\n udcChannel = 'wsuc',\n}\n\nexport function atobID(id: any) {\n if (!id) {\n return null\n }\n if (typeof id === 'string' && id.includes('/')) {\n return id?.split('/')?.pop()?.split('?')?.shift()\n }\n return id\n}\n\nexport interface GetValidCustomCouponProps {\n /** custom_data item */\n customDataItem: {\n udcGroups: number[]\n whiteGroups: number[]\n discount: VariantCoupon\n }\n /** \u4EBA\u7FA4\u5206\u7EC4\uFF0C\u6765\u81EA get_user_in_group \u63A5\u53E3 */\n udcGroupIds?: number[]\n udcWhiteGroupIds?: number[]\n}\n\nclass CouponUtils {\n /** \u662F\u5426\u4E3A\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238 */\n static isHideChannelCoupon(couponTitle?: string): boolean {\n return !!couponTitle?.toLowerCase().startsWith(CouponType.hideChannel)\n }\n\n /** \u662F\u5426\u4E3A App \u6E20\u9053\u4F18\u60E0\u5238 */\n static isAppChannelCoupon(couponTitle?: string): boolean {\n return !!couponTitle?.toLowerCase().startsWith(CouponType.appChannel)\n }\n\n /** \u662F\u5426\u4E3A UDC \u6E20\u9053\u4F18\u60E0\u5238 */\n static isUDCChannelCoupon(couponTitle?: string): boolean {\n return !!couponTitle?.toLowerCase().startsWith(CouponType.udcChannel)\n }\n\n /** \u68C0\u67E5\u4F18\u60E0\u5238\u662F\u5426\u5728\u6709\u6548\u671F\u5185 */\n static isCouponInValidPeriod(coupon: VariantCoupon): boolean {\n const now = new Date().getTime()\n const hasNoEndDate = coupon?.ends_at === null || coupon?.ends_at === undefined\n const isNotExpired = new Date(coupon?.ends_at as string).getTime() > now\n const hasStarted = new Date(coupon?.starts_at).getTime() <= now\n\n return (hasNoEndDate || isNotExpired) && hasStarted\n }\n\n /** \u68C0\u67E5\u4F18\u60E0\u5238\u662F\u5426\u5339\u914D\u6307\u5B9A\u7684\u9690\u85CF\u6E20\u9053 */\n static getMatchChannelCoupons(activeCoupons: VariantCoupon[], channel?: string): VariantCoupon[] {\n if (!channel || activeCoupons.length === 0) {\n return []\n }\n\n const lowerChannel = channel.toLowerCase()\n const result: VariantCoupon[] = []\n\n for (const coupon of activeCoupons) {\n const couponTitle = coupon?.title.toLowerCase()\n\n // \u5B8C\u5168\u5339\u914D\u7684\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238\uFF0C\u627E\u5230\u5C31\u7ACB\u5373\u8FD4\u56DE\n if (couponTitle === lowerChannel) {\n return [coupon]\n }\n\n // \u6536\u96C6\u90E8\u5206\u5339\u914D\u7684\u4F18\u60E0\u5238\uFF08\u539F\u903B\u8F91\uFF1AWSCH****\uFF09\n if (couponTitle.includes(lowerChannel)) {\n result.push(coupon)\n }\n }\n\n return result\n }\n\n /** \u68C0\u67E5\u4F18\u60E0\u5238\u662F\u5426\u5339\u914D\u53D8\u4F53ID */\n static isCouponMatchVariant(coupon: VariantCoupon, variant: ProductVariant | undefined): boolean {\n return coupon?.variant_shopify_id === +atobID(variant?.id)\n }\n\n /** \u9A8C\u8BC1\u662F\u5426\u6709 coupons \u6216\u8005 custom_coupons */\n static validateVariantCoupon(variant: ProductVariant | undefined): boolean {\n const coupons = variant?.coupons || variant?.metafields?.coupons || []\n const customCoupons = variant?.custom_coupons || variant?.metafields?.custom_coupons || []\n const hasValidCoupons = Array.isArray(coupons) && coupons.length > 0\n const hasValidCustomCoupons = Array.isArray(customCoupons) && customCoupons.length > 0\n\n return hasValidCoupons || hasValidCustomCoupons\n }\n\n /** \u83B7\u53D6 custom_data \u4E2D\u7B26\u5408 UDC \u4EBA\u7FA4\u5206\u7EC4\u7684\u6298\u6263 */\n static getValidCustomCoupon({ customDataItem, udcGroupIds, udcWhiteGroupIds }: GetValidCustomCouponProps): boolean {\n const { udcGroups, whiteGroups } = customDataItem\n\n // \u5148\u68C0\u67E5 udcGroups \u5728\u63A5\u53E3\u91CC\u6709\u6CA1\u6709\n const hasUDCGroupMatch = udcGroups?.some(id => udcGroupIds?.includes(id))\n\n if (hasUDCGroupMatch) {\n return true\n }\n\n // \u6CA1\u6709\u7684\u8BDD\u518D\u68C0\u67E5 whiteGroups\n return whiteGroups?.some(id => udcWhiteGroupIds?.includes(id))\n }\n}\n\nexport { CouponUtils }\n"],
5
- "mappings": "AAEO,IAAKA,OACVA,EAAA,YAAc,OACdA,EAAA,WAAa,OACbA,EAAA,WAAa,OAHHA,OAAA,IAML,SAASC,EAAOC,EAAS,CAC9B,OAAKA,EAGD,OAAOA,GAAO,UAAYA,EAAG,SAAS,GAAG,EACpCA,GAAI,MAAM,GAAG,GAAG,IAAI,GAAG,MAAM,GAAG,GAAG,MAAM,EAE3CA,EALE,IAMX,CAcA,MAAMC,CAAY,CAEhB,OAAO,oBAAoBC,EAA+B,CACxD,MAAO,CAAC,CAACA,GAAa,YAAY,EAAE,WAAW,MAAsB,CACvE,CAGA,OAAO,mBAAmBA,EAA+B,CACvD,MAAO,CAAC,CAACA,GAAa,YAAY,EAAE,WAAW,MAAqB,CACtE,CAGA,OAAO,mBAAmBA,EAA+B,CACvD,MAAO,CAAC,CAACA,GAAa,YAAY,EAAE,WAAW,MAAqB,CACtE,CAGA,OAAO,sBAAsBC,EAAgC,CAC3D,MAAMC,EAAM,IAAI,KAAK,EAAE,QAAQ,EACzBC,EAAeF,GAAQ,UAAY,MAAQA,GAAQ,UAAY,OAC/DG,EAAe,IAAI,KAAKH,GAAQ,OAAiB,EAAE,QAAQ,EAAIC,EAC/DG,EAAa,IAAI,KAAKJ,GAAQ,SAAS,EAAE,QAAQ,GAAKC,EAE5D,OAAQC,GAAgBC,IAAiBC,CAC3C,CAGA,OAAO,uBAAuBC,EAAgCC,EAAmC,CAC/F,GAAI,CAACA,GAAWD,EAAc,SAAW,EACvC,MAAO,CAAC,EAGV,MAAME,EAAeD,EAAQ,YAAY,EACnCE,EAA0B,CAAC,EAEjC,UAAWR,KAAUK,EAAe,CAClC,MAAMN,EAAcC,GAAQ,MAAM,YAAY,EAG9C,GAAID,IAAgBQ,EAClB,MAAO,CAACP,CAAM,EAIZD,EAAY,SAASQ,CAAY,GACnCC,EAAO,KAAKR,CAAM,CAEtB,CAEA,OAAOQ,CACT,CAGA,OAAO,qBAAqBR,EAAuBS,EAA8C,CAC/F,OAAOT,GAAQ,qBAAuB,CAACJ,EAAOa,GAAS,EAAE,CAC3D,CAGA,OAAO,sBAAsBA,EAA8C,CACzE,MAAMC,EAAUD,GAAS,SAAWA,GAAS,YAAY,SAAW,CAAC,EAC/DE,EAAgBF,GAAS,gBAAkBA,GAAS,YAAY,gBAAkB,CAAC,EACnFG,EAAkB,MAAM,QAAQF,CAAO,GAAKA,EAAQ,OAAS,EAC7DG,EAAwB,MAAM,QAAQF,CAAa,GAAKA,EAAc,OAAS,EAErF,OAAOC,GAAmBC,CAC5B,CAGA,OAAO,qBAAqB,CAAE,eAAAC,EAAgB,YAAAC,EAAa,iBAAAC,CAAiB,EAAuC,CACjH,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAY,EAAIJ,EAKnC,OAFyBG,GAAW,KAAKpB,GAAMkB,GAAa,SAASlB,CAAE,CAAC,EAG/D,GAIFqB,GAAa,KAAKrB,GAAMmB,GAAkB,SAASnB,CAAE,CAAC,CAC/D,CACF",
4
+ "sourcesContent": ["import type { ProductVariant, VariantCoupon } from './couponType'\n\nexport enum CouponType {\n hideChannel = 'wsch',\n appChannel = 'wsap',\n udcChannel = 'wsuc',\n}\n\nexport function atobID(id: any) {\n if (!id) {\n return null\n }\n if (typeof id === 'string' && id.includes('/')) {\n return id?.split('/')?.pop()?.split('?')?.shift()\n }\n return id\n}\n\nexport interface GetValidCustomCouponProps {\n /** custom_data item */\n customDataItem: {\n udcGroups: number[]\n whiteGroups: number[]\n discount: VariantCoupon\n }\n /** \u4EBA\u7FA4\u5206\u7EC4\uFF0C\u6765\u81EA get_user_in_group \u63A5\u53E3 */\n udcGroupIds?: number[]\n udcWhiteGroupIds?: number[]\n}\n\nclass CouponUtils {\n /** \u662F\u5426\u4E3A\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238 */\n static isHideChannelCoupon(couponTitle?: string): boolean {\n return !!couponTitle?.toLowerCase().startsWith(CouponType.hideChannel)\n }\n\n /** \u662F\u5426\u4E3A App \u6E20\u9053\u4F18\u60E0\u5238 */\n static isAppChannelCoupon(couponTitle?: string): boolean {\n return !!couponTitle?.toLowerCase().startsWith(CouponType.appChannel)\n }\n\n /** \u662F\u5426\u4E3A UDC \u6E20\u9053\u4F18\u60E0\u5238 */\n static isUDCChannelCoupon(couponTitle?: string): boolean {\n return !!couponTitle?.toLowerCase().startsWith(CouponType.udcChannel)\n }\n\n /** \u68C0\u67E5\u4F18\u60E0\u5238\u662F\u5426\u5728\u6709\u6548\u671F\u5185 */\n static isCouponInValidPeriod(coupon: VariantCoupon): boolean {\n const now = new Date().getTime()\n const hasNoEndDate = coupon?.ends_at === null || coupon?.ends_at === undefined\n const isNotExpired = new Date(coupon?.ends_at as string).getTime() > now\n const hasStarted = new Date(coupon?.starts_at).getTime() <= now\n\n return (hasNoEndDate || isNotExpired) && hasStarted\n }\n\n /** \u68C0\u67E5\u4F18\u60E0\u5238\u662F\u5426\u5339\u914D\u6307\u5B9A\u7684\u9690\u85CF\u6E20\u9053 */\n static getMatchChannelCoupons(activeCoupons: VariantCoupon[], channel?: string): VariantCoupon[] {\n if (!channel || activeCoupons.length === 0) {\n return []\n }\n\n const lowerChannel = channel.toLowerCase()\n const result: VariantCoupon[] = []\n\n for (const coupon of activeCoupons) {\n const couponTitle = coupon?.title?.toLowerCase()\n\n // \u5B8C\u5168\u5339\u914D\u7684\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238\uFF0C\u627E\u5230\u5C31\u7ACB\u5373\u8FD4\u56DE\n if (couponTitle === lowerChannel) {\n return [coupon]\n }\n\n // \u6536\u96C6\u90E8\u5206\u5339\u914D\u7684\u4F18\u60E0\u5238\uFF08\u539F\u903B\u8F91\uFF1AWSCH****\uFF09\n if (couponTitle.includes(lowerChannel)) {\n result.push(coupon)\n }\n }\n\n return result\n }\n\n /** \u68C0\u67E5\u4F18\u60E0\u5238\u662F\u5426\u5339\u914D\u53D8\u4F53ID */\n static isCouponMatchVariant(coupon: VariantCoupon, variant: ProductVariant | undefined): boolean {\n return coupon?.variant_shopify_id === +atobID(variant?.id)\n }\n\n /** \u9A8C\u8BC1\u662F\u5426\u6709 coupons \u6216\u8005 custom_coupons */\n static validateVariantCoupon(variant: ProductVariant | undefined): boolean {\n const coupons = variant?.coupons || variant?.metafields?.coupons || []\n const customCoupons = variant?.custom_coupons || variant?.metafields?.custom_coupons || []\n const hasValidCoupons = Array.isArray(coupons) && coupons.length > 0\n const hasValidCustomCoupons = Array.isArray(customCoupons) && customCoupons.length > 0\n\n return hasValidCoupons || hasValidCustomCoupons\n }\n\n /** \u83B7\u53D6 custom_data \u4E2D\u7B26\u5408 UDC \u4EBA\u7FA4\u5206\u7EC4\u7684\u6298\u6263 */\n static getValidCustomCoupon({ customDataItem, udcGroupIds, udcWhiteGroupIds }: GetValidCustomCouponProps): boolean {\n const { udcGroups, whiteGroups } = customDataItem\n\n // \u5148\u68C0\u67E5 udcGroups \u5728\u63A5\u53E3\u91CC\u6709\u6CA1\u6709\n const hasUDCGroupMatch = udcGroups?.some(id => udcGroupIds?.includes(id))\n\n if (hasUDCGroupMatch) {\n return true\n }\n\n // \u6CA1\u6709\u7684\u8BDD\u518D\u68C0\u67E5 whiteGroups\n return whiteGroups?.some(id => udcWhiteGroupIds?.includes(id))\n }\n}\n\nexport { CouponUtils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OAAOT,GAAQ,qBAAuB,CAACJ,EAAOa,GAAS,EAAE,CAC3D,CAGA,OAAO,sBAAsBA,EAA8C,CACzE,MAAMC,EAAUD,GAAS,SAAWA,GAAS,YAAY,SAAW,CAAC,EAC/DE,EAAgBF,GAAS,gBAAkBA,GAAS,YAAY,gBAAkB,CAAC,EACnFG,EAAkB,MAAM,QAAQF,CAAO,GAAKA,EAAQ,OAAS,EAC7DG,EAAwB,MAAM,QAAQF,CAAa,GAAKA,EAAc,OAAS,EAErF,OAAOC,GAAmBC,CAC5B,CAGA,OAAO,qBAAqB,CAAE,eAAAC,EAAgB,YAAAC,EAAa,iBAAAC,CAAiB,EAAuC,CACjH,KAAM,CAAE,UAAAC,EAAW,YAAAC,CAAY,EAAIJ,EAKnC,OAFyBG,GAAW,KAAKpB,GAAMkB,GAAa,SAASlB,CAAE,CAAC,EAG/D,GAIFqB,GAAa,KAAKrB,GAAMmB,GAAkB,SAASnB,CAAE,CAAC,CAC/D,CACF",
6
6
  "names": ["CouponType", "atobID", "id", "CouponUtils", "couponTitle", "coupon", "now", "hasNoEndDate", "isNotExpired", "hasStarted", "activeCoupons", "channel", "lowerChannel", "result", "variant", "coupons", "customCoupons", "hasValidCoupons", "hasValidCustomCoupons", "customDataItem", "udcGroupIds", "udcWhiteGroupIds", "udcGroups", "whiteGroups"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{CouponUtils as n}from"./couponUtils";function I({variant:t,channel:m,inApp:r,udcGroupIds:s,udcWhiteGroupIds:a,targetCode:p}){if(!n.validateVariantCoupon(t))return;const C=t?.coupons||t.metafields?.coupons||[],V=(t?.custom_coupons||t.metafields?.custom_coupons||[])?.filter(o=>s||a?n.getValidCustomCoupon({customDataItem:o,udcGroupIds:s,udcWhiteGroupIds:a}):!0)?.map(o=>o?.discount?.title),c=C?.find(o=>{const e=n.isCouponInValidPeriod(o),u=n.isCouponMatchVariant(o,t);return V?.includes?.(o?.title||"")&&e&&u});if(r&&c)return c;const i=C.filter(o=>{const e=n.isCouponInValidPeriod(o),u=n.isCouponMatchVariant(o,t),f=n.isUDCChannelCoupon(o?.title||"");return e&&u&&!f}),d=n.getMatchChannelCoupons(i,m);if(d.length>0)return d[0];const l=p?i.filter(o=>o.title?.toLocaleUpperCase()===p?.toLocaleUpperCase()):void 0;return(l||i.filter(o=>{const e=n.isHideChannelCoupon(o?.title||""),u=n.isAppChannelCoupon(o?.title||"");return r?!e:!e&&!u}))?.[0]}export{I as getCouponFromVariant};
1
+ import{CouponUtils as n}from"./couponUtils";function I({variant:t,channel:m,inApp:r,udcGroupIds:s,udcWhiteGroupIds:a,targetCode:p}){if(!n.validateVariantCoupon(t))return;const C=t?.coupons||t.metafields?.coupons||[],V=(t?.custom_coupons||t.metafields?.custom_coupons||[])?.filter(o=>s||a?n.getValidCustomCoupon({customDataItem:o,udcGroupIds:s,udcWhiteGroupIds:a}):!0)?.map(o=>o?.discount?.title||""),c=C?.find(o=>{const e=n.isCouponInValidPeriod(o),u=n.isCouponMatchVariant(o,t);return V?.includes?.(o?.title||"")&&e&&u});if(r&&c)return c;const i=C.filter(o=>{const e=n.isCouponInValidPeriod(o),u=n.isCouponMatchVariant(o,t),f=n.isUDCChannelCoupon(o?.title||"");return e&&u&&!f}),d=n.getMatchChannelCoupons(i,m);if(d.length>0)return d[0];const l=p?i.filter(o=>o?.title?.toLocaleUpperCase()===p?.toLocaleUpperCase()):void 0;return(l||i.filter(o=>{const e=n.isHideChannelCoupon(o?.title||""),u=n.isAppChannelCoupon(o?.title||"");return r?!e:!e&&!u}))?.[0]}export{I as getCouponFromVariant};
2
2
  //# sourceMappingURL=handleCoupon.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/ShelfDisplay/handleCoupon.ts"],
4
- "sourcesContent": ["/* eslint-disable import/extensions */\nimport { CouponUtils } from './couponUtils'\n\nimport type { ProductVariant, VariantCoupon } from './couponType'\n\ninterface GetCouponFromVariantProps {\n /** \u53D8\u4F53 */\n variant: ProductVariant | undefined\n /** \u9690\u85CF\u6E20\u9053 */\n channel?: string\n /** \u662F\u5426\u5728app\u4E2D */\n inApp?: boolean\n /** UDC\u4EBA\u7FA4\u5206\u7EC4 */\n udcGroupIds?: number[]\n /** UDC\u767D\u540D\u5355\u4EBA\u7FA4\u5206\u7EC4 */\n udcWhiteGroupIds?: number[]\n /** \u76EE\u6807\u4EE3\u7801 */\n targetCode?: string\n}\n\nexport interface GetValidCustomCouponProps {\n /** custom_data item */\n customDataItem: {\n udcGroups: number[]\n whiteGroups: number[]\n discount: VariantCoupon\n }\n /** \u4EBA\u7FA4\u5206\u7EC4\uFF0C\u6765\u81EA get_user_in_group \u63A5\u53E3 */\n udcGroupIds?: number[]\n udcWhiteGroupIds?: number[]\n}\n\nexport function getCouponFromVariant({\n variant,\n channel,\n inApp,\n udcGroupIds,\n udcWhiteGroupIds,\n targetCode,\n}: GetCouponFromVariantProps): VariantCoupon | undefined {\n // \u9A8C\u8BC1\u8F93\u5165\u53C2\u6570\n if (!CouponUtils.validateVariantCoupon(variant)) {\n return undefined\n }\n const coupons: any = variant?.coupons || variant!.metafields?.coupons || []\n const customCoupons: any = variant?.custom_coupons || variant!.metafields?.custom_coupons || []\n\n // udc_groups \u4EBA\u7FA4\u5206\u7EC4\u4F18\u60E0\u5238\uFF0C\u627E\u51FA\u6240\u6709\u5339\u914D\u7684\u6298\u6263\u7801\n const udcGroupCouponTitleList: string[] | undefined = customCoupons\n ?.filter((item: GetValidCustomCouponProps['customDataItem']) => {\n if (udcGroupIds || udcWhiteGroupIds) {\n return CouponUtils.getValidCustomCoupon({\n customDataItem: item,\n udcGroupIds,\n udcWhiteGroupIds,\n })\n }\n return true\n })\n ?.map((item: GetValidCustomCouponProps['customDataItem']) => item?.discount?.title)\n\n // custom_data \u4E2D\u7684 title \u53EA\u662F\u8868\u660E\u4ED6\u547D\u4E2D\u4E86\u8FD9\u4E2A udc \u6298\u6263\uFF0C\u6700\u7EC8\u4EE5 coupons \u7684\u6570\u636E\u4E3A\u51C6\n // \u547D\u4E2D\u7684\u6240\u6709\u6298\u6263\u7801\u9010\u4E00\u9A8C\u8BC1\uFF0C\u627E\u5230\u6700\u5148\u5339\u914D\u7684\u6298\u6263\u7801\uFF0C\u56E0\u4E3A coupons \u4E2D\u6298\u6263\u5927\u7684\u9760\u524D\n const udcGroupCoupon = coupons?.find((item: VariantCoupon) => {\n const isInValidPeriod = CouponUtils.isCouponInValidPeriod(item)\n const isMatchVariant = CouponUtils.isCouponMatchVariant(item, variant)\n return udcGroupCouponTitleList?.includes?.(item?.title || '') && isInValidPeriod && isMatchVariant\n })\n\n // \u627E\u5230 UDC \u6298\u6263\u5C31\u76F4\u63A5\u7528\n // TODO UDC \u6298\u6263\u76EE\u524D\u7EA6\u5B9A\u4EC5\u5728 app \u4F7F\u7528\n if (inApp && udcGroupCoupon) {\n return udcGroupCoupon\n }\n\n // \u8FC7\u6EE4\u51FA\u6240\u6709\u6709\u6548\u7684\u4F18\u60E0\u5238\n const activeCoupons = coupons.filter((coupon: VariantCoupon) => {\n const isInValidPeriod = CouponUtils.isCouponInValidPeriod(coupon)\n const isMatchVariant = CouponUtils.isCouponMatchVariant(coupon, variant)\n const isUDCChannel = CouponUtils.isUDCChannelCoupon(coupon?.title || '')\n return isInValidPeriod && isMatchVariant && !isUDCChannel\n })\n\n // \u8FC7\u6EE4\u51FA\u9690\u85CF\u6E20\u9053\u7684\u4F18\u60E0\u5238\n const matchChannelCoupons = CouponUtils.getMatchChannelCoupons(activeCoupons, channel)\n\n // \u5982\u679C\u6709\u5339\u914D\u7684\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238\u5219\u4F18\u5148\u4F7F\u7528\n if (matchChannelCoupons.length > 0) {\n return matchChannelCoupons[0]\n }\n\n // \u5982\u679C\u6709\u76EE\u6807\u4EE3\u7801\u5219\u8FC7\u6EE4\u51FA\u76EE\u6807\u4EE3\u7801\u7684\u4F18\u60E0\u5238\n const targetCoupons = targetCode\n ? activeCoupons.filter(\n (coupon: VariantCoupon) => coupon.title?.toLocaleUpperCase() === targetCode?.toLocaleUpperCase()\n )\n : undefined\n\n const finalCoupons = targetCoupons\n ? targetCoupons\n : activeCoupons.filter((coupon: VariantCoupon) => {\n const isHideChannelCoupon = CouponUtils.isHideChannelCoupon(coupon?.title || '')\n const isAppChannelCoupon = CouponUtils.isAppChannelCoupon(coupon?.title || '')\n\n // app \u4E0B\u53EA\u9700\u8981\u8FC7\u6EE4\u51FA\u975E\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238\n if (inApp) {\n return !isHideChannelCoupon\n }\n\n // \u5B98\u7F51\u4E0B\u9700\u8981\u8FC7\u6EE4\u51FA\u975E\u9690\u85CF\u6E20\u9053\u548C\u975E app \u6E20\u9053\u4F18\u60E0\u5238\n return !isHideChannelCoupon && !isAppChannelCoupon\n })\n\n return finalCoupons?.[0]\n}\n"],
5
- "mappings": "AACA,OAAS,eAAAA,MAAmB,gBA+BrB,SAASC,EAAqB,CACnC,QAAAC,EACA,QAAAC,EACA,MAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,WAAAC,CACF,EAAyD,CAEvD,GAAI,CAACP,EAAY,sBAAsBE,CAAO,EAC5C,OAEF,MAAMM,EAAeN,GAAS,SAAWA,EAAS,YAAY,SAAW,CAAC,EAIpEO,GAHqBP,GAAS,gBAAkBA,EAAS,YAAY,gBAAkB,CAAC,IAI1F,OAAQQ,GACJL,GAAeC,EACVN,EAAY,qBAAqB,CACtC,eAAgBU,EAChB,YAAAL,EACA,iBAAAC,CACF,CAAC,EAEI,EACR,GACC,IAAKI,GAAsDA,GAAM,UAAU,KAAK,EAI9EC,EAAiBH,GAAS,KAAME,GAAwB,CAC5D,MAAME,EAAkBZ,EAAY,sBAAsBU,CAAI,EACxDG,EAAiBb,EAAY,qBAAqBU,EAAMR,CAAO,EACrE,OAAOO,GAAyB,WAAWC,GAAM,OAAS,EAAE,GAAKE,GAAmBC,CACtF,CAAC,EAID,GAAIT,GAASO,EACX,OAAOA,EAIT,MAAMG,EAAgBN,EAAQ,OAAQO,GAA0B,CAC9D,MAAMH,EAAkBZ,EAAY,sBAAsBe,CAAM,EAC1DF,EAAiBb,EAAY,qBAAqBe,EAAQb,CAAO,EACjEc,EAAehB,EAAY,mBAAmBe,GAAQ,OAAS,EAAE,EACvE,OAAOH,GAAmBC,GAAkB,CAACG,CAC/C,CAAC,EAGKC,EAAsBjB,EAAY,uBAAuBc,EAAeX,CAAO,EAGrF,GAAIc,EAAoB,OAAS,EAC/B,OAAOA,EAAoB,CAAC,EAI9B,MAAMC,EAAgBX,EAClBO,EAAc,OACXC,GAA0BA,EAAO,OAAO,kBAAkB,IAAMR,GAAY,kBAAkB,CACjG,EACA,OAiBJ,OAfqBW,GAEjBJ,EAAc,OAAQC,GAA0B,CAC9C,MAAMI,EAAsBnB,EAAY,oBAAoBe,GAAQ,OAAS,EAAE,EACzEK,EAAqBpB,EAAY,mBAAmBe,GAAQ,OAAS,EAAE,EAG7E,OAAIX,EACK,CAACe,EAIH,CAACA,GAAuB,CAACC,CAClC,CAAC,KAEiB,CAAC,CACzB",
4
+ "sourcesContent": ["/* eslint-disable import/extensions */\nimport { CouponUtils } from './couponUtils'\n\nimport type { ProductVariant, VariantCoupon } from './couponType'\n\ninterface GetCouponFromVariantProps {\n /** \u53D8\u4F53 */\n variant: ProductVariant | undefined\n /** \u9690\u85CF\u6E20\u9053 */\n channel?: string\n /** \u662F\u5426\u5728app\u4E2D */\n inApp?: boolean\n /** UDC\u4EBA\u7FA4\u5206\u7EC4 */\n udcGroupIds?: number[]\n /** UDC\u767D\u540D\u5355\u4EBA\u7FA4\u5206\u7EC4 */\n udcWhiteGroupIds?: number[]\n /** \u76EE\u6807\u4EE3\u7801 */\n targetCode?: string\n}\n\nexport interface GetValidCustomCouponProps {\n /** custom_data item */\n customDataItem: {\n udcGroups: number[]\n whiteGroups: number[]\n discount: VariantCoupon\n }\n /** \u4EBA\u7FA4\u5206\u7EC4\uFF0C\u6765\u81EA get_user_in_group \u63A5\u53E3 */\n udcGroupIds?: number[]\n udcWhiteGroupIds?: number[]\n}\n\nexport function getCouponFromVariant({\n variant,\n channel,\n inApp,\n udcGroupIds,\n udcWhiteGroupIds,\n targetCode,\n}: GetCouponFromVariantProps): VariantCoupon | undefined {\n // \u9A8C\u8BC1\u8F93\u5165\u53C2\u6570\n if (!CouponUtils.validateVariantCoupon(variant)) {\n return undefined\n }\n const coupons: any = variant?.coupons || variant!.metafields?.coupons || []\n const customCoupons: any = variant?.custom_coupons || variant!.metafields?.custom_coupons || []\n\n // udc_groups \u4EBA\u7FA4\u5206\u7EC4\u4F18\u60E0\u5238\uFF0C\u627E\u51FA\u6240\u6709\u5339\u914D\u7684\u6298\u6263\u7801\n const udcGroupCouponTitleList: string[] | undefined = customCoupons\n ?.filter((item: GetValidCustomCouponProps['customDataItem']) => {\n if (udcGroupIds || udcWhiteGroupIds) {\n return CouponUtils.getValidCustomCoupon({\n customDataItem: item,\n udcGroupIds,\n udcWhiteGroupIds,\n })\n }\n return true\n })\n ?.map((item: GetValidCustomCouponProps['customDataItem']) => item?.discount?.title || '')\n\n // custom_data \u4E2D\u7684 title \u53EA\u662F\u8868\u660E\u4ED6\u547D\u4E2D\u4E86\u8FD9\u4E2A udc \u6298\u6263\uFF0C\u6700\u7EC8\u4EE5 coupons \u7684\u6570\u636E\u4E3A\u51C6\n // \u547D\u4E2D\u7684\u6240\u6709\u6298\u6263\u7801\u9010\u4E00\u9A8C\u8BC1\uFF0C\u627E\u5230\u6700\u5148\u5339\u914D\u7684\u6298\u6263\u7801\uFF0C\u56E0\u4E3A coupons \u4E2D\u6298\u6263\u5927\u7684\u9760\u524D\n const udcGroupCoupon = coupons?.find((item: VariantCoupon) => {\n const isInValidPeriod = CouponUtils.isCouponInValidPeriod(item)\n const isMatchVariant = CouponUtils.isCouponMatchVariant(item, variant)\n return udcGroupCouponTitleList?.includes?.(item?.title || '') && isInValidPeriod && isMatchVariant\n })\n\n // \u627E\u5230 UDC \u6298\u6263\u5C31\u76F4\u63A5\u7528\n // TODO UDC \u6298\u6263\u76EE\u524D\u7EA6\u5B9A\u4EC5\u5728 app \u4F7F\u7528\n if (inApp && udcGroupCoupon) {\n return udcGroupCoupon\n }\n\n // \u8FC7\u6EE4\u51FA\u6240\u6709\u6709\u6548\u7684\u4F18\u60E0\u5238\n const activeCoupons = coupons.filter((coupon: VariantCoupon) => {\n const isInValidPeriod = CouponUtils.isCouponInValidPeriod(coupon)\n const isMatchVariant = CouponUtils.isCouponMatchVariant(coupon, variant)\n const isUDCChannel = CouponUtils.isUDCChannelCoupon(coupon?.title || '')\n return isInValidPeriod && isMatchVariant && !isUDCChannel\n })\n\n // \u8FC7\u6EE4\u51FA\u9690\u85CF\u6E20\u9053\u7684\u4F18\u60E0\u5238\n const matchChannelCoupons = CouponUtils.getMatchChannelCoupons(activeCoupons, channel)\n\n // \u5982\u679C\u6709\u5339\u914D\u7684\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238\u5219\u4F18\u5148\u4F7F\u7528\n if (matchChannelCoupons.length > 0) {\n return matchChannelCoupons[0]\n }\n\n // \u5982\u679C\u6709\u76EE\u6807\u4EE3\u7801\u5219\u8FC7\u6EE4\u51FA\u76EE\u6807\u4EE3\u7801\u7684\u4F18\u60E0\u5238\n const targetCoupons = targetCode\n ? activeCoupons.filter(\n (coupon: VariantCoupon) => coupon?.title?.toLocaleUpperCase() === targetCode?.toLocaleUpperCase()\n )\n : undefined\n\n const finalCoupons = targetCoupons\n ? targetCoupons\n : activeCoupons.filter((coupon: VariantCoupon) => {\n const isHideChannelCoupon = CouponUtils.isHideChannelCoupon(coupon?.title || '')\n const isAppChannelCoupon = CouponUtils.isAppChannelCoupon(coupon?.title || '')\n\n // app \u4E0B\u53EA\u9700\u8981\u8FC7\u6EE4\u51FA\u975E\u9690\u85CF\u6E20\u9053\u4F18\u60E0\u5238\n if (inApp) {\n return !isHideChannelCoupon\n }\n\n // \u5B98\u7F51\u4E0B\u9700\u8981\u8FC7\u6EE4\u51FA\u975E\u9690\u85CF\u6E20\u9053\u548C\u975E app \u6E20\u9053\u4F18\u60E0\u5238\n return !isHideChannelCoupon && !isAppChannelCoupon\n })\n return finalCoupons?.[0]\n}\n"],
5
+ "mappings": "AACA,OAAS,eAAAA,MAAmB,gBA+BrB,SAASC,EAAqB,CACnC,QAAAC,EACA,QAAAC,EACA,MAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,WAAAC,CACF,EAAyD,CAEvD,GAAI,CAACP,EAAY,sBAAsBE,CAAO,EAC5C,OAEF,MAAMM,EAAeN,GAAS,SAAWA,EAAS,YAAY,SAAW,CAAC,EAIpEO,GAHqBP,GAAS,gBAAkBA,EAAS,YAAY,gBAAkB,CAAC,IAI1F,OAAQQ,GACJL,GAAeC,EACVN,EAAY,qBAAqB,CACtC,eAAgBU,EAChB,YAAAL,EACA,iBAAAC,CACF,CAAC,EAEI,EACR,GACC,IAAKI,GAAsDA,GAAM,UAAU,OAAS,EAAE,EAIpFC,EAAiBH,GAAS,KAAME,GAAwB,CAC5D,MAAME,EAAkBZ,EAAY,sBAAsBU,CAAI,EACxDG,EAAiBb,EAAY,qBAAqBU,EAAMR,CAAO,EACrE,OAAOO,GAAyB,WAAWC,GAAM,OAAS,EAAE,GAAKE,GAAmBC,CACtF,CAAC,EAID,GAAIT,GAASO,EACX,OAAOA,EAIT,MAAMG,EAAgBN,EAAQ,OAAQO,GAA0B,CAC9D,MAAMH,EAAkBZ,EAAY,sBAAsBe,CAAM,EAC1DF,EAAiBb,EAAY,qBAAqBe,EAAQb,CAAO,EACjEc,EAAehB,EAAY,mBAAmBe,GAAQ,OAAS,EAAE,EACvE,OAAOH,GAAmBC,GAAkB,CAACG,CAC/C,CAAC,EAGKC,EAAsBjB,EAAY,uBAAuBc,EAAeX,CAAO,EAGrF,GAAIc,EAAoB,OAAS,EAC/B,OAAOA,EAAoB,CAAC,EAI9B,MAAMC,EAAgBX,EAClBO,EAAc,OACXC,GAA0BA,GAAQ,OAAO,kBAAkB,IAAMR,GAAY,kBAAkB,CAClG,EACA,OAgBJ,OAdqBW,GAEjBJ,EAAc,OAAQC,GAA0B,CAC9C,MAAMI,EAAsBnB,EAAY,oBAAoBe,GAAQ,OAAS,EAAE,EACzEK,EAAqBpB,EAAY,mBAAmBe,GAAQ,OAAS,EAAE,EAG7E,OAAIX,EACK,CAACe,EAIH,CAACA,GAAuB,CAACC,CAClC,CAAC,KACiB,CAAC,CACzB",
6
6
  "names": ["CouponUtils", "getCouponFromVariant", "variant", "channel", "inApp", "udcGroupIds", "udcWhiteGroupIds", "targetCode", "coupons", "udcGroupCouponTitleList", "item", "udcGroupCoupon", "isInValidPeriod", "isMatchVariant", "activeCoupons", "coupon", "isUDCChannel", "matchChannelCoupons", "targetCoupons", "isHideChannelCoupon", "isAppChannelCoupon"]
7
7
  }
@@ -1,8 +1,8 @@
1
- import{Fragment as X,jsx as s,jsxs as m}from"react/jsx-runtime";import{useAiuiContext as Y}from"../AiuiProvider/index.js";import{formatVariantPrice as Z}from"./shelfDisplay.js";import J from"../../components/picture.js";import K from"../../components/badge.js";import{cn as d}from"../../helpers/utils.js";import{Text as ee}from"../../components/text.js";import F from"../../components/button.js";import{gaTrack as te}from"../../shared/track.js";import{trackUrlRef as se}from"../../shared/trackUrlRef.js";import{Heading as le}from"../../components/heading.js";import{getCouponFromVariant as oe}from"./handleCoupon.js";import{useExposure as ae}from"../../hooks/useExposure.js";import{useRef as ie,useEffect as ne,useMemo as T,useState as Q}from"react";const A="image",G="product_shelf",re=999999999e-2,pe=e=>{const t=e?.sku,u=e?.variants,x=u?.find(b=>b?.sku===t),_=x?.image?.url||u?.[0]?.image?.url||"",g=x?.image?.altText||u?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:_,altText:g}},Te=({data:e,configuration:t})=>{const{isDisplayBackImage:u=!1,itemShape:x,metafields:_,isTopTag:g=!1,isShowTag:b,isShowOriginalPrice:f}=t||{},{locale:h="us",copyWriting:O,inApp:S,udcGroupIds:N,udcWhiteGroupIds:B,targetCode:C,channel:I}=Y(),{discounts:U,discountsCopy:D}=_||{},z=ie(null),[H,i]=Q([]),[L,M]=Q(""),R=(l,c,p)=>t?.event?.primaryButton?.(l,c+1,p),P=(l,c,p)=>t?.event?.secondaryButton?.(l,c+1,p),a=T(()=>{const l=e?.variants||[];if(l.length)return e?.sku&&l.find(c=>c?.sku===e?.sku)||l[0]},[e?.sku,e?.variants]),W=!a?.availableForSale&&a?.price?.amount===re,$=T(()=>oe({variant:a,inApp:S,udcGroupIds:N,udcWhiteGroupIds:B,targetCode:C,channel:I}),[a,S,N,B,C,I]),j=!!(f&&$),E=e?.price?.currencyCode||"USD",y=T(()=>Z({locale:h,amount:j?$?.variant_price4wscode:a?.price,baseAmount:j?a?.price:0,currencyCode:E}),[E,h,j,$?.variant_price4wscode,a]),{price:V,basePrice:q,discount:r}=y,{imageUrl:w,altText:k}=pe(e),v=e?.custom_name||e?.title,o=e?.custom_description||e?.description;ne(()=>{let l=[];if(r){const p=`${r}${U?.off||D?.off||""}`;M(p),l.push(p)}const c=e?.tags?.filter?.(p=>p?.startsWith?.("CLtag"))?.map?.(p=>p?.replace?.("CLtag:",""))?.slice?.(0,r?1:2);i(l.concat(c))},[e?.tags,r,U?.off,D?.off]),ae(z,{componentType:A,componentName:G,componentTitle:v,componentDescription:o,position:t?.index+1});const n=()=>m(X,{children:[b&&H?.length>0?s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:H?.map?.((l,c)=>s(K,{className:"shelf-items-tag",children:l},c))}):null,v?s(le,{as:"h3",title:v||"",size:2,className:"shelf-display-product-title line-clamp-2",html:v||""}):null,o?s(ee,{size:2,className:"lg-desktop:text-lg desktop:text-base shelf-display-product-description line-clamp-1 text-sm",html:o||""}):null,s("div",{className:"mb-2 mt-4 flex items-center",children:W?s("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:O?.soldOutText}):m(X,{children:[s("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:a?.availableForSale&&V||""}),s("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:a?.availableForSale&&q||""})]})}),m("div",{className:d("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?s(F,{variant:"secondary",onClick:()=>P(e,t?.index,t),className:`
1
+ import{Fragment as Y,jsx as s,jsxs as m}from"react/jsx-runtime";import{useAiuiContext as Z}from"../AiuiProvider/index.js";import{formatVariantPrice as ee}from"./shelfDisplay.js";import K from"../../components/picture.js";import Q from"../../components/badge.js";import{cn as d}from"../../helpers/utils.js";import{Text as te}from"../../components/text.js";import F from"../../components/button.js";import{gaTrack as se}from"../../shared/track.js";import{trackUrlRef as le}from"../../shared/trackUrlRef.js";import{Heading as oe}from"../../components/heading.js";import{getCouponFromVariant as ae}from"./handleCoupon.js";import{useExposure as ie}from"../../hooks/useExposure.js";import{useRef as ne,useEffect as re,useMemo as T,useState as X}from"react";const A="image",G="product_shelf",M=999999999e-2,pe=e=>{const t=e?.sku,u=e?.variants,x=u?.find(b=>b?.sku===t),_=x?.image?.url||u?.[0]?.image?.url||"",g=x?.image?.altText||u?.[0]?.image?.altText||e?.custom_name||e?.title||"";return{imageUrl:_,altText:g}},Te=({data:e,configuration:t})=>{const{isDisplayBackImage:u=!1,itemShape:x,metafields:_,isTopTag:g=!1,isShowTag:b,isShowOriginalPrice:f}=t||{},{locale:h="us",copyWriting:O,inApp:S,udcGroupIds:N,udcWhiteGroupIds:B,targetCode:C,channel:I}=Z(),{discounts:U,discountsCopy:D}=_||{},z=ne(null),[H,i]=X([]),[L,R]=X(""),V=(l,c,p)=>t?.event?.primaryButton?.(l,c+1,p),P=(l,c,p)=>t?.event?.secondaryButton?.(l,c+1,p),o=T(()=>{const l=e?.variants||[];if(l.length)return e?.sku?l?.find?.(c=>c?.sku===e?.sku)||l[0]:l?.[0]},[e?.sku,e?.variants]),W=!o?.availableForSale&&(o?.price?.amount===M||o?.price===M),$=T(()=>ae({variant:o,inApp:S,udcGroupIds:N,udcWhiteGroupIds:B,targetCode:C,channel:I}),[o,S,N,B,C,I]),j=!!(f&&$),E=e?.price?.currencyCode||"USD",y=T(()=>ee({locale:h,amount:j?$?.variant_price4wscode:o?.price,baseAmount:j?o?.price:0,currencyCode:E}),[E,h,j,$?.variant_price4wscode,o]),{price:q,basePrice:J,discount:r}=y,{imageUrl:w,altText:k}=pe(e),v=e?.custom_name||e?.title,a=e?.custom_description||e?.description;re(()=>{let l=[];if(r){const p=`${r}${U?.off||D?.off||""}`;R(p),l.push(p)}const c=e?.tags?.filter?.(p=>p?.startsWith?.("CLtag"))?.map?.(p=>p?.replace?.("CLtag:",""))?.slice?.(0,r?1:2);i(l.concat(c))},[e?.tags,r,U?.off,D?.off]),ie(z,{componentType:A,componentName:G,componentTitle:v,componentDescription:a,position:t?.index+1});const n=()=>m(Y,{children:[b&&H?.length>0?s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:H?.map?.((l,c)=>s(Q,{className:"shelf-items-tag",children:l},c))}):null,v?s(oe,{as:"h3",title:v||"",size:2,className:"shelf-display-product-title line-clamp-2",html:v||""}):null,a?s(te,{size:2,className:"lg-desktop:text-lg desktop:text-base shelf-display-product-description line-clamp-1 text-sm",html:a||""}):null,s("div",{className:"mb-2 mt-4 flex items-center",children:W?s("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:O?.soldOutText}):m(Y,{children:[s("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:o?.availableForSale&&q||""}),s("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:o?.availableForSale&&J||""})]})}),m("div",{className:d("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?s(F,{variant:"secondary",onClick:()=>P(e,t?.index,t),className:`
2
2
  ${t.direction==="vertical"?"w-full":""}
3
- `,children:t?.secondaryButton||""}):null,t?.primaryButton?s(F,{variant:"primary",onClick:()=>R(e,t?.index,t),className:`
3
+ `,children:t?.secondaryButton||""}):null,t?.primaryButton?s(F,{variant:"primary",onClick:()=>V(e,t?.index,t),className:`
4
4
  ${t.direction==="vertical"?"w-full":""}
5
- `,children:t?.primaryButton||""}):null]})]});return s("div",{ref:z,className:d("bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300",x==="round"?"rounded-2xl":"rounded-none","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]","laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative","md-tablet:h-[360px] shelf-display-item"),children:u?s("div",{className:"absolute inset-0 box-border overflow-hidden",children:m("div",{className:"relative inset-0 size-full",children:[s(J,{source:w,alt:k,className:"flex h-full justify-center object-cover [&_img]:w-auto"}),s("div",{className:"desktop:p-6 absolute inset-x-0 bottom-0 box-border overflow-hidden p-4",children:n()})]})}):m("div",{className:"desktop:p-6 absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4",children:[L&&g&&s(K,{className:"shelf-prices-tag absolute left-4 top-4 z-10",children:L||""}),s("div",{className:d("lg-desktop:h-[195px] shelf-display-item-image relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden"),children:s("a",{"aria-label":v,target:t?.target,href:se(`${h==="us"||!h?"":`/${h}`}/products/${e?.handle}`,`${A}_${G}`),onClick:()=>{te({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||a?.sku,item_name:e?.name,item_variant:a?.name,price:a?.price,index:t?.index+1}]}})},children:s(J,{source:w,alt:k,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),n()]})},e?.id||e?.handle)},_e=({data:e,configuration:t})=>{const{itemShape:u,itemLength:x,metafields:_}=t||{},{discounts:g,discountsCopy:b}=_||{},{locale:f="us",copyWriting:h,inApp:O,udcGroupIds:S,udcWhiteGroupIds:N,targetCode:B,channel:C}=Y(),[I,U]=Q([]),D=ie(null),z=(o,n,l)=>t?.event?.primaryButton?.(o,n+1,l),H=(o,n,l)=>t?.event?.secondaryButton?.(o,n+1,l),i=T(()=>{const o=e?.variants||[];if(o.length)return e?.sku&&o.find(n=>n?.sku===e?.sku)||o[0]},[e?.sku,e?.variants]),L=!i?.availableForSale&&i?.price?.amount===re,M=t?.isShowTag,R=t?.isShowOriginalPrice,P=T(()=>oe({variant:i,inApp:O,udcGroupIds:S,udcWhiteGroupIds:N,targetCode:B,channel:C}),[i,O,S,N,B,C]),a=!!(R&&P),W=e?.price?.currencyCode||"USD",$=T(()=>Z({locale:f,amount:a?P?.variant_price4wscode:i?.price,baseAmount:a?i?.price:0,currencyCode:W}),[W,f,a,P?.variant_price4wscode,i]),{price:j,basePrice:E,discount:y}=$,{imageUrl:V,altText:q}=pe(e),r=e?.custom_name||e?.title,w=e?.custom_description||e?.description;ae(D,{componentType:A,componentName:G,componentTitle:r,componentDescription:w,position:t?.index+1});const k=()=>x>=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"},v=()=>x>=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";return ne(()=>{let o=[];if(y){const l=`${y}${g?.off||b?.off||""}`;o.push(l)}const n=e?.tags?.filter?.(l=>l?.startsWith?.("CLtag"))?.map?.(l=>l?.replace?.("CLtag:",""))?.slice?.(0,y?1:2);U(o.concat(n))},[e?.tags,y,g?.off,b?.off]),s("div",{ref:D,className:d(k().wrap,u==="round"?"rounded-2xl":"rounded-none","shelf-display-item","bg-container-secondary-1 tablet:hover:bg-info-white gap-6 duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden"),children:m("div",{className:d(v(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[s("div",{className:d(k().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden"),children:s("a",{"aria-label":r,target:t?.target,href:se(`${f==="us"||!f?"":`/${f}`}/products/${e?.handle}`,`${A}_${G}`),onClick:()=>{te({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||i?.sku,item_name:e?.name,item_variant:i?.name,price:i?.price,index:t?.index+1}]}})},children:s(J,{source:V,alt:q,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),m("div",{className:d("flex flex-col items-start justify-center",k().boxItem),children:[M&&I?.length>0?s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:I?.map?.((o,n)=>s(K,{className:"shelf-items-tag",children:o},n))}):null,r?s(le,{as:"h3",title:r||"",size:2,className:"shelf-display-product-title mb-1 line-clamp-2",html:r||""}):null,w?s(ee,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description line-clamp-1 h-5 text-sm",html:w||""}):null,s("div",{className:"mb-2 mt-5 flex items-center",children:L?s("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:h?.soldOutText}):m(X,{children:[s("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:i?.availableForSale&&j||""}),s("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:i?.availableForSale&&E||""})]})}),m("div",{className:d("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?s(F,{variant:"secondary",onClick:()=>H(e,t?.index,t),className:`
5
+ `,children:t?.primaryButton||""}):null]})]});return s("div",{ref:z,className:d("bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300",x==="round"?"rounded-2xl":"rounded-none","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]","laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative","md-tablet:h-[360px] shelf-display-item"),children:u?s("div",{className:"absolute inset-0 box-border overflow-hidden",children:m("div",{className:"relative inset-0 size-full",children:[s(K,{source:w,alt:k,className:"flex h-full justify-center object-cover [&_img]:w-auto"}),s("div",{className:"desktop:p-6 absolute inset-x-0 bottom-0 box-border overflow-hidden p-4",children:n()})]})}):m("div",{className:"desktop:p-6 absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4",children:[L&&g&&s(Q,{className:"shelf-prices-tag absolute left-4 top-4 z-10",children:L||""}),s("div",{className:d("lg-desktop:h-[195px] shelf-display-item-image relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden"),children:s("a",{"aria-label":v,target:t?.target,href:le(`${h==="us"||!h?"":`/${h}`}/products/${e?.handle}`,`${A}_${G}`),onClick:()=>{se({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}]}})},children:s(K,{source:w,alt:k,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),n()]})},e?.id||e?.handle)},_e=({data:e,configuration:t})=>{const{itemShape:u,itemLength:x,metafields:_}=t||{},{discounts:g,discountsCopy:b}=_||{},{locale:f="us",copyWriting:h,inApp:O,udcGroupIds:S,udcWhiteGroupIds:N,targetCode:B,channel:C}=Z(),[I,U]=X([]),D=ne(null),z=(a,n,l)=>t?.event?.primaryButton?.(a,n+1,l),H=(a,n,l)=>t?.event?.secondaryButton?.(a,n+1,l),i=T(()=>{const a=e?.variants||[];if(a.length)return e?.sku&&a.find(n=>n?.sku===e?.sku)||a[0]},[e?.sku,e?.variants]),L=!i?.availableForSale&&(i?.price?.amount===M||i?.price===M),R=t?.isShowTag,V=t?.isShowOriginalPrice,P=T(()=>ae({variant:i,inApp:O,udcGroupIds:S,udcWhiteGroupIds:N,targetCode:B,channel:C}),[i,O,S,N,B,C]),o=!!(V&&P),W=e?.price?.currencyCode||"USD",$=T(()=>ee({locale:f,amount:o?P?.variant_price4wscode:i?.price,baseAmount:o?i?.price:0,currencyCode:W}),[W,f,o,P?.variant_price4wscode,i]),{price:j,basePrice:E,discount:y}=$,{imageUrl:q,altText:J}=pe(e),r=e?.custom_name||e?.title,w=e?.custom_description||e?.description;ie(D,{componentType:A,componentName:G,componentTitle:r,componentDescription:w,position:t?.index+1});const k=()=>x>=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"},v=()=>x>=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";return re(()=>{let a=[];if(y){const l=`${y}${g?.off||b?.off||""}`;a.push(l)}const n=e?.tags?.filter?.(l=>l?.startsWith?.("CLtag"))?.map?.(l=>l?.replace?.("CLtag:",""))?.slice?.(0,y?1:2);U(a.concat(n))},[e?.tags,y,g?.off,b?.off]),s("div",{ref:D,className:d(k().wrap,u==="round"?"rounded-2xl":"rounded-none","shelf-display-item","bg-container-secondary-1 tablet:hover:bg-info-white gap-6 duration-300","md-tablet:h-[360px] relative box-border w-full cursor-pointer overflow-hidden"),children:m("div",{className:d(v(),"desktop:p-6 absolute inset-0 box-border overflow-hidden p-4"),children:[s("div",{className:d(k().imgItem,"desktop:mb-0 relative mb-1 overflow-hidden"),children:s("a",{"aria-label":r,target:t?.target,href:le(`${f==="us"||!f?"":`/${f}`}/products/${e?.handle}`,`${A}_${G}`),onClick:()=>{se({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||i?.sku,item_name:e?.name,item_variant:i?.name,price:i?.price,index:t?.index+1}]}})},children:s(K,{source:q,alt:J,className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),m("div",{className:d("flex flex-col items-start justify-center",k().boxItem),children:[R&&I?.length>0?s("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:I?.map?.((a,n)=>s(Q,{className:"shelf-items-tag",children:a},n))}):null,r?s(oe,{as:"h3",title:r||"",size:2,className:"shelf-display-product-title mb-1 line-clamp-2",html:r||""}):null,w?s(te,{size:2,className:"lg-desktop:text-lg lg-desktop:h-[26px] desktop:text-base desktop:h-6 shelf-display-product-description line-clamp-1 h-5 text-sm",html:w||""}):null,s("div",{className:"mb-2 mt-5 flex items-center",children:L?s("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:h?.soldOutText}):m(Y,{children:[s("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:i?.availableForSale&&j||""}),s("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:i?.availableForSale&&E||""})]})}),m("div",{className:d("shelf-flex-button-group","lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?s(F,{variant:"secondary",onClick:()=>H(e,t?.index,t),className:`
6
6
  ${t.direction==="vertical"?"w-full":""}
7
7
  `,children:t?.secondaryButton||""}):null,t?.primaryButton?s(F,{variant:"primary",onClick:()=>z(e,t?.index,t),className:`
8
8
  ${t.direction==="vertical"?"w-full":""}