@anker-in/headless-ui 1.3.9 → 1.3.11

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 (49) hide show
  1. package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
  2. package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js.map +2 -2
  3. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
  4. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js.map +2 -2
  5. package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +1 -1
  6. package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js.map +3 -3
  7. package/dist/cjs/biz-components/BuyOneGetOneShelf/types.d.ts +14 -1
  8. package/dist/cjs/biz-components/BuyOneGetOneShelf/types.js +1 -1
  9. package/dist/cjs/biz-components/BuyOneGetOneShelf/types.js.map +1 -1
  10. package/dist/cjs/biz-components/Graphic/index.d.ts +1 -0
  11. package/dist/cjs/biz-components/Graphic/index.js +1 -1
  12. package/dist/cjs/biz-components/Graphic/index.js.map +2 -2
  13. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  14. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +2 -2
  15. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js +1 -1
  16. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js.map +2 -2
  17. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
  18. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +2 -2
  19. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
  20. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +2 -2
  21. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js +1 -1
  22. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js.map +2 -2
  23. package/dist/cjs/biz-components/VideoModal/index.js +1 -1
  24. package/dist/cjs/biz-components/VideoModal/index.js.map +2 -2
  25. package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
  26. package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js.map +2 -2
  27. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
  28. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js.map +2 -2
  29. package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +1 -1
  30. package/dist/esm/biz-components/BuyOneGetOneShelf/index.js.map +3 -3
  31. package/dist/esm/biz-components/BuyOneGetOneShelf/types.d.ts +14 -1
  32. package/dist/esm/biz-components/BuyOneGetOneShelf/types.js.map +1 -1
  33. package/dist/esm/biz-components/Graphic/index.d.ts +1 -0
  34. package/dist/esm/biz-components/Graphic/index.js +1 -1
  35. package/dist/esm/biz-components/Graphic/index.js.map +2 -2
  36. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  37. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +2 -2
  38. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js +1 -1
  39. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js.map +2 -2
  40. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
  41. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +2 -2
  42. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
  43. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +2 -2
  44. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js +1 -1
  45. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js.map +2 -2
  46. package/dist/esm/biz-components/VideoModal/index.js +1 -1
  47. package/dist/esm/biz-components/VideoModal/index.js.map +2 -2
  48. package/package.json +1 -1
  49. package/style.css +0 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../src/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.tsx"],
4
- "sourcesContent": ["import { Text, Picture, Checkbox } from '../../../../../../components/index.js'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider/index.js'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { formatPrice } from '../../../../utils/index.js'\nimport type { BundleListItem } from '../../../../types/product'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { useFollowTooltip, FollowTooltip } from '../../../../hooks/useFollowTooltip.js'\n\nconst ProductBundle = () => {\n const { locale = 'us' } = useAiuiContext()\n const {\n variant,\n bundle,\n checkedBundle,\n setCheckedBundle,\n setCheckedGift,\n savingDetail,\n setSavingDetail,\n setCheckedExchangePurchase,\n setJoinedRecommendBuyProducts,\n joinedRecommendBuyProducts,\n setAddOrder,\n } = useBizProductContext()\n\n const { title, bundleList, showAtListing } = bundle || {}\n\n const availableBundleList = bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n )\n\n if (!availableBundleList?.length && showAtListing) return null\n\n const handleSelectedChange = (bundleItem: BundleListItem) => {\n if (checkedBundle?.id === bundleItem.id) {\n setCheckedBundle?.(undefined)\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: undefined,\n canOperate: true,\n },\n })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'bundle'))\n } else {\n setCheckedBundle?.(bundleItem)\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: bundleItem,\n canOperate: false,\n },\n })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => {\n // \u5982\u679C\u5DF2\u7ECF\u5B58\u5728\uFF0C\u5148\u79FB\u9664\u518D\u6DFB\u52A0\u5230\u672B\u5C3E\n const filtered = prev.filter(t => t !== 'bundle')\n return [...filtered, 'bundle']\n })\n }\n }\n\n const { tooltip, getTooltipProps } = useFollowTooltip()\n\n return (\n <div className=\"ipc-product-detail-bundle\">\n <Text className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\" html={title} />\n <div className=\"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3\">\n {availableBundleList?.map(bundle => {\n const bundleVariants = bundle.variants.filter(v => v.variant.sku !== variant.sku)\n return (\n <div key={bundle.id}>\n <div\n className={cn(\n 'rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold',\n {\n ['border-brand']: checkedBundle?.id === bundle.id,\n }\n )}\n >\n <Checkbox\n onCheckedChange={() => handleSelectedChange(bundle)}\n size=\"lg\"\n className={cn('rounded-full border-2 border-[#E4E5E6]', {\n 'border-brand': checkedBundle?.id === bundle.id,\n })}\n id={bundle.id}\n value={bundle.id}\n checked={checkedBundle?.id === bundle.id}\n />\n <label htmlFor={bundle.id} className=\"size-full flex items-center cursor-pointer py-4 lg-desktop:py-6\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center justify-between gap-6 \" key={bundleVariant.variant.id}>\n <div className=\"flex items-center gap-2\">\n <Picture\n source={bundleVariant?.variant?.image?.url}\n className=\"size-12 shrink-0\"\n imgClassName=\"h-full\"\n />\n <Text\n {...getTooltipProps(bundleVariant.variant.product.title)}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold\"\n html={bundleVariant.variant.product.title}\n />\n <FollowTooltip {...tooltip} />\n </div>\n <div className=\"laptop:flex-row flex shrink-0 flex-col items-center justify-end gap-1\">\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base !leading-[1.2] font-bold\"\n html={formatPrice({\n amount: bundleVariant.price,\n locale,\n currencyCode: bundleVariant.variant.price.currencyCode,\n })}\n />\n {bundleVariant.price < bundleVariant.variant.price.amount && (\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base !leading-[1.2] font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: bundleVariant.variant.price.amount,\n locale,\n currencyCode: bundleVariant.variant.price.currencyCode,\n })}\n />\n )}\n </div>\n </div>\n )\n })}\n </label>\n </div>\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductBundle)\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmEM,IAAAI,EAAA,6BAnENC,EAAwC,iDACxCC,EAAmB,8CACnBC,EAA+B,gDAC/BC,EAAqC,6CACrCC,EAA4B,sCAE5BC,EAA2B,8CAC3BC,EAAgD,iDAEhD,MAAMC,EAAgB,IAAM,CAC1B,KAAM,CAAE,OAAAC,EAAS,IAAK,KAAI,kBAAe,EACnC,CACJ,QAAAC,EACA,OAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,2BAAAC,EACA,8BAAAC,EACA,2BAAAC,EACA,YAAAC,CACF,KAAI,wBAAqB,EAEnB,CAAE,MAAAC,EAAO,WAAAC,EAAY,cAAAC,CAAc,EAAIZ,GAAU,CAAC,EAElDa,EAAsBF,GAAY,OAAOX,GAC7CA,EAAO,SAAS,MAAM,EAAGA,EAAO,SAAS,MAAM,EAAE,MAAMc,GAAKA,EAAE,QAAQ,gBAAgB,CACxF,EAEA,GAAI,CAACD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GAAGF,EAAgBE,EAAc,QAAQ,QAAQ,KAAK,EACvD,UAAU,2EACV,KAAMA,EAAc,QAAQ,QAAQ,MACtC,KACA,OAAC,iBAAe,GAAGH,EAAS,GAC9B,KACA,QAAC,OAAI,UAAU,wEACb,oBAAC,QACC,UAAU,4EACV,QAAM,eAAY,CAChB,OAAQG,EAAc,MACtB,OAAAxB,EACA,aAAcwB,EAAc,QAAQ,MAAM,YAC5C,CAAC,EACH,EACCA,EAAc,MAAQA,EAAc,QAAQ,MAAM,WACjD,OAAC,QACC,UAAU,wGACV,QAAM,eAAY,CAChB,OAAQA,EAAc,QAAQ,MAAM,OACpC,OAAAxB,EACA,aAAcwB,EAAc,QAAQ,MAAM,YAC5C,CAAC,EACH,GAEJ,IAjC6DA,EAAc,QAAQ,EAkCrF,CAEH,EACH,GACF,GA5DQtB,EAAO,EA6DjB,CAEJ,CAAC,EACH,GACF,CAEJ,EAEA,IAAOb,KAAQ,cAAWU,CAAa",
4
+ "sourcesContent": ["import { Text, Picture, Checkbox } from '../../../../../../components/index.js'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider/index.js'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { formatPrice } from '../../../../utils/index.js'\nimport type { BundleListItem } from '../../../../types/product'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { useFollowTooltip, FollowTooltip } from '../../../../hooks/useFollowTooltip.js'\n\nconst ProductBundle = () => {\n const { locale = 'us' } = useAiuiContext()\n const {\n variant,\n bundle,\n checkedBundle,\n setCheckedBundle,\n setCheckedGift,\n savingDetail,\n setSavingDetail,\n setCheckedExchangePurchase,\n setJoinedRecommendBuyProducts,\n joinedRecommendBuyProducts,\n setAddOrder,\n } = useBizProductContext()\n\n const { title, bundleList, showAtListing } = bundle || {}\n\n const availableBundleList = bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n )\n\n if (!availableBundleList?.length && showAtListing) return null\n\n const handleSelectedChange = (bundleItem: BundleListItem) => {\n if (checkedBundle?.id === bundleItem.id) {\n setCheckedBundle?.(undefined)\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: undefined,\n canOperate: true,\n },\n })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'bundle'))\n } else {\n setCheckedBundle?.(bundleItem)\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: bundleItem,\n canOperate: false,\n },\n })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => {\n // \u5982\u679C\u5DF2\u7ECF\u5B58\u5728\uFF0C\u5148\u79FB\u9664\u518D\u6DFB\u52A0\u5230\u672B\u5C3E\n const filtered = prev.filter(t => t !== 'bundle')\n return [...filtered, 'bundle']\n })\n }\n }\n\n const { tooltip, getTooltipProps } = useFollowTooltip()\n\n return (\n <div className=\"ipc-product-detail-bundle\">\n <Text className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\" html={title} />\n <div className=\"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3\">\n {availableBundleList?.map(bundle => {\n const bundleVariants = bundle.variants.filter(v => v.variant.sku !== variant.sku)\n return (\n <div key={bundle.id}>\n <div\n className={cn(\n 'rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold',\n {\n ['border-brand']: checkedBundle?.id === bundle.id,\n }\n )}\n >\n <Checkbox\n onCheckedChange={() => handleSelectedChange(bundle)}\n size=\"lg\"\n className={cn('rounded-full border-2 border-[#E4E5E6]', {\n 'border-brand-0 data-[state=checked]:bg-brand-0': checkedBundle?.id === bundle.id,\n })}\n id={bundle.id}\n value={bundle.id}\n checked={checkedBundle?.id === bundle.id}\n />\n <label htmlFor={bundle.id} className=\"size-full flex items-center cursor-pointer py-4 lg-desktop:py-6\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center justify-between gap-6 \" key={bundleVariant.variant.id}>\n <div className=\"flex items-center gap-2\">\n <Picture\n source={bundleVariant?.variant?.image?.url}\n className=\"size-12 shrink-0\"\n imgClassName=\"h-full\"\n />\n <Text\n {...getTooltipProps(bundleVariant.variant.product.title)}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold\"\n html={bundleVariant.variant.product.title}\n />\n <FollowTooltip {...tooltip} />\n </div>\n <div className=\"laptop:flex-row flex shrink-0 flex-col items-center justify-end gap-1\">\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base !leading-[1.2] font-bold\"\n html={formatPrice({\n amount: bundleVariant.price,\n locale,\n currencyCode: bundleVariant.variant.price.currencyCode,\n })}\n />\n {bundleVariant.price < bundleVariant.variant.price.amount && (\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base !leading-[1.2] font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: bundleVariant.variant.price.amount,\n locale,\n currencyCode: bundleVariant.variant.price.currencyCode,\n })}\n />\n )}\n </div>\n </div>\n )\n })}\n </label>\n </div>\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductBundle)\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmEM,IAAAI,EAAA,6BAnENC,EAAwC,iDACxCC,EAAmB,8CACnBC,EAA+B,gDAC/BC,EAAqC,6CACrCC,EAA4B,sCAE5BC,EAA2B,8CAC3BC,EAAgD,iDAEhD,MAAMC,EAAgB,IAAM,CAC1B,KAAM,CAAE,OAAAC,EAAS,IAAK,KAAI,kBAAe,EACnC,CACJ,QAAAC,EACA,OAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,eA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AAkDC,GAAe,KAAOD,EAAO,EACjF,CAAC,EACD,GAAIA,EAAO,GACX,MAAOA,EAAO,GACd,QAASC,GAAe,KAAOD,EAAO,GACxC,KACA,OAAC,SAAM,QAASA,EAAO,GAAI,UAAU,kEAClC,SAAAqB,GAAgB,IAAIC,MAEjB,QAAC,OAAI,UAAU,2CACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,WACC,OAAQA,GAAe,SAAS,OAAO,IACvC,UAAU,mBACV,aAAa,SACf,KACA,OAAC,QACE,GAAGF,EAAgBE,EAAc,QAAQ,QAAQ,KAAK,EACvD,UAAU,2EACV,KAAMA,EAAc,QAAQ,QAAQ,MACtC,KACA,OAAC,iBAAe,GAAGH,EAAS,GAC9B,KACA,QAAC,OAAI,UAAU,wEACb,oBAAC,QACC,UAAU,4EACV,QAAM,eAAY,CAChB,OAAQG,EAAc,MACtB,OAAAxB,EACA,aAAcwB,EAAc,QAAQ,MAAM,YAC5C,CAAC,EACH,EACCA,EAAc,MAAQA,EAAc,QAAQ,MAAM,WACjD,OAAC,QACC,UAAU,wGACV,QAAM,eAAY,CAChB,OAAQA,EAAc,QAAQ,MAAM,OACpC,OAAAxB,EACA,aAAcwB,EAAc,QAAQ,MAAM,YAC5C,CAAC,EACH,GAEJ,IAjC6DA,EAAc,QAAQ,EAkCrF,CAEH,EACH,GACF,GA5DQtB,EAAO,EA6DjB,CAEJ,CAAC,EACH,GACF,CAEJ,EAEA,IAAOb,KAAQ,cAAWU,CAAa",
6
6
  "names": ["ProductBundle_exports", "__export", "ProductBundle_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_helpers", "import_AiuiProvider", "import_BizProductProvider", "import_utils", "import_Styles", "import_useFollowTooltip", "ProductBundle", "locale", "variant", "bundle", "checkedBundle", "setCheckedBundle", "setCheckedGift", "savingDetail", "setSavingDetail", "setCheckedExchangePurchase", "setJoinedRecommendBuyProducts", "joinedRecommendBuyProducts", "setAddOrder", "title", "bundleList", "showAtListing", "availableBundleList", "v", "handleSelectedChange", "bundleItem", "prev", "t", "tooltip", "getTooltipProps", "bundleVariants", "bundleVariant"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var $=Object.create;var f=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var A=(o,t)=>{for(var n in t)f(o,n,{get:t[n],enumerable:!0})},h=(o,t,n,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of E(t))!U.call(o,a)&&a!==n&&f(o,a,{get:()=>t[a],enumerable:!(d=z(t,a))||d.enumerable});return o};var T=(o,t,n)=>(n=o!=null?$(H(o)):{},h(t||!o||!o.__esModule?f(n,"default",{value:o,enumerable:!0}):n,o)),q=o=>h(f({},"__esModule",{value:!0}),o);var J={};A(J,{CouponCard:()=>v,MemberDiscountCard:()=>y,default:()=>G});module.exports=q(J);var e=require("react/jsx-runtime"),O=require("react"),s=require("../../../../../../helpers/index.js"),r=require("../../../../../../components/index.js"),P=T(require("../../../../hooks/useCopy.js")),w=require("../../../../hooks/useBenefits.js"),F=require("../../../../BizProductProvider.js"),M=require("../../../../hooks/useComponentData.js"),m=require("../../../../utils/textFormat.js"),I=require("../../../../../AiuiProvider/index.js"),_=T(require("../../../../../../hooks/useCountDown.js"));const v=({checked:o,discountText:t,codeText:n,code:d,countdownText:a,copyText:g,copiedText:b,onClick:l,className:x})=>{const{copied:C,copy:k}=(0,P.default)();return(0,e.jsx)("div",{className:(0,s.cn)("flex flex-col gap-3 rounded-box overflow-hidden",x),role:"button",tabIndex:0,onClick:l,children:(0,e.jsxs)("div",{className:"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(r.Checkbox,{size:"lg",className:"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary",checked:o}),(0,e.jsx)(r.Text,{className:"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]",children:t})]}),(0,e.jsxs)("div",{className:"flex w-full items-center gap-2",children:[(0,e.jsx)("div",{className:"flex shrink-0 flex-col items-start",children:(0,e.jsx)(r.Text,{className:"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px]",children:n})}),(0,e.jsx)(r.Link,{className:"lg-desktop:text-[16px] text-[14px] font-bold underline",role:"button",tabIndex:0,onClick:i=>{i.preventDefault(),i.stopPropagation(),k(d)},children:C?b:g})]})]}),a&&(0,e.jsx)(r.Text,{className:"text-brand-0 text-sm lg-desktop:text-base font-bold leading-[1.4] tracking-[-0.28px]",children:a})]})})};v.displayName="CouponCard";const y=({checked:o,discountText:t,description:n,onClick:d,className:a})=>(0,e.jsx)("div",{className:(0,s.cn)("flex flex-col gap-3 rounded-box overflow-hidden",a),role:"button",tabIndex:0,onClick:d,children:(0,e.jsx)("div",{className:"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4",children:(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(r.Checkbox,{size:"lg",className:"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary",checked:o}),(0,e.jsx)(r.Text,{className:"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]",children:t})]}),n&&(0,e.jsx)(r.Text,{className:"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px] pl-8",children:n})]})})});y.displayName="MemberDiscountCard";const D=({className:o})=>{const{profile:t,variant:n,onUseCouponChange:d,onUseMemberDiscountChange:a,openSignInPopup:g,discount:b,savingDetail:l}=(0,F.useBizProductContext)(),{locale:x="us",trackingData:C}=(0,I.useAiuiContext)(),k=(0,w.useBenefits)({variant:n}),{commonCoupon:i,memberDiscount:u}=k,{days:S,hours:B,minutes:L,seconds:R}=(0,_.default)({endTime:i?.config?.ends_at}),N=C?.common?.coupon,c=(0,M.useComponentData)("ProductCoupon")??{};return!i?.enable&&!u?.enable||!n?.availableForSale?null:(0,e.jsxs)("div",{className:(0,s.cn)("ipc-product-detail-product-coupon flex flex-col gap-3 lg-desktop:gap-4",o),children:[c?.title&&(0,e.jsx)(r.Text,{className:"text-info-primary text-[14px] lg-desktop:text-[16px] font-bold leading-[1.2] tracking-[-0.56px]",children:c.title}),i?.enable&&(0,e.jsx)(v,{checked:l?.coupon>0,discountText:(0,m.replaceTemplate)(c?.common?.offCoupon,{discount:i?.config?.value_type=="percentage"?Math.abs(Number(i?.config?.value||0))+"%":(0,s.formatPrice)({amount:Math.abs(Number(i?.config?.fixed_value||0)),currencyCode:n.price.currencyCode,locale:x})||""}),codeText:(0,m.replaceTemplate)(c?.common?.withCode,{code:i?.config?.title??""}),code:i?.config?.title??"",countdownText:i?.config?.ends_at?(0,m.replaceTemplate)(c?.common?.endsIn,{countdown:`${S}:${B}:${L}:${R}`}):void 0,copyText:N?.copy||c?.copyCode,copiedText:N?.copied||c?.copied,onClick:()=>{const p=l?.coupon?0:b?.codeSavings??0;d?.(p)}}),u?.enable&&(0,e.jsx)(y,{checked:!!t?.email&&!!l?.member,discountText:(0,m.replaceTemplate)(c?.member?.offMember,{discount:(0,s.formatPrice)({amount:u?.config?.amount??0,currencyCode:n.price.currencyCode,locale:x})||""}),description:t?.email?c?.member?.loginDesc:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"mr-2",dangerouslySetInnerHTML:{__html:c?.member?.unloginDesc}}),(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:p=>{p?.stopPropagation(),g?.()},className:"underline text-nowrap",dangerouslySetInnerHTML:{__html:c?.member?.login}})]}),onClick:()=>{if(t?.email){const p=l?.member?0:u?.config?.amount??0;a?.(p)}}})]})};D.displayName="ProductCoupon";var G=D;
1
+ "use strict";"use client";var $=Object.create;var g=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var A=(o,t)=>{for(var n in t)g(o,n,{get:t[n],enumerable:!0})},h=(o,t,n,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of E(t))!U.call(o,a)&&a!==n&&g(o,a,{get:()=>t[a],enumerable:!(d=z(t,a))||d.enumerable});return o};var T=(o,t,n)=>(n=o!=null?$(H(o)):{},h(t||!o||!o.__esModule?g(n,"default",{value:o,enumerable:!0}):n,o)),q=o=>h(g({},"__esModule",{value:!0}),o);var J={};A(J,{CouponCard:()=>v,MemberDiscountCard:()=>y,default:()=>G});module.exports=q(J);var e=require("react/jsx-runtime"),O=require("react"),s=require("../../../../../../helpers/index.js"),i=require("../../../../../../components/index.js"),P=T(require("../../../../hooks/useCopy.js")),w=require("../../../../hooks/useBenefits.js"),F=require("../../../../BizProductProvider.js"),M=require("../../../../hooks/useComponentData.js"),m=require("../../../../utils/textFormat.js"),I=require("../../../../../AiuiProvider/index.js"),_=T(require("../../../../../../hooks/useCountDown.js"));const v=({checked:o,discountText:t,codeText:n,code:d,countdownText:a,copyText:x,copiedText:b,onClick:l,className:u})=>{const{copied:C,copy:k}=(0,P.default)();return(0,e.jsx)("div",{className:(0,s.cn)("flex flex-col gap-3 rounded-box overflow-hidden",u),role:"button",tabIndex:0,onClick:l,children:(0,e.jsxs)("div",{className:"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(i.Checkbox,{size:"lg",className:"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary",checked:o}),(0,e.jsx)(i.Text,{className:"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]",children:t})]}),(0,e.jsxs)("div",{className:"flex w-full items-center gap-2",children:[(0,e.jsx)("div",{className:"flex shrink-0 flex-col items-start",children:(0,e.jsx)(i.Text,{className:"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px]",children:n})}),(0,e.jsx)(i.Link,{className:"lg-desktop:text-[16px] text-[14px] font-bold underline",role:"button",tabIndex:0,onClick:r=>{r.preventDefault(),r.stopPropagation(),k(d)},children:C?b:x})]})]}),a&&(0,e.jsx)(i.Text,{className:"text-brand-0 text-sm lg-desktop:text-base font-bold leading-[1.4] tracking-[-0.28px]",children:a})]})})};v.displayName="CouponCard";const y=({checked:o,discountText:t,description:n,onClick:d,className:a})=>(0,e.jsx)("div",{className:(0,s.cn)("flex flex-col gap-3 rounded-box overflow-hidden",a),role:"button",tabIndex:0,onClick:d,children:(0,e.jsx)("div",{className:"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4",children:(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(i.Checkbox,{size:"lg",className:"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary",checked:o}),(0,e.jsx)(i.Text,{className:"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]",children:t})]}),n&&(0,e.jsx)(i.Text,{className:"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px] pl-8",children:n})]})})});y.displayName="MemberDiscountCard";const D=({className:o})=>{const{profile:t,variant:n,onUseCouponChange:d,onUseMemberDiscountChange:a,openSignInPopup:x,discount:b,savingDetail:l}=(0,F.useBizProductContext)(),{locale:u="us",trackingData:C}=(0,I.useAiuiContext)(),k=(0,w.useBenefits)({variant:n}),{commonCoupon:r,memberDiscount:f}=k,{days:S,hours:B,minutes:L,seconds:R}=(0,_.default)({endTime:r?.config?.ends_at}),N=C?.common?.coupon,c=(0,M.useComponentData)("ProductCoupon")??{};return!r?.enable&&!f?.enable||!n?.availableForSale?null:(0,e.jsxs)("div",{className:(0,s.cn)("ipc-product-detail-product-coupon flex flex-col gap-3 lg-desktop:gap-4",o),children:[c?.title&&(0,e.jsx)(i.Text,{className:"text-info-primary text-[14px] lg-desktop:text-[16px] font-bold leading-[1.2] tracking-[-0.56px]",children:c.title}),r?.enable&&(0,e.jsx)(v,{checked:l?.coupon>0,discountText:(0,m.replaceTemplate)(c?.common?.offCoupon,{discount:r?.config?.value_type=="percentage"?Math.abs(Number(r?.config?.value||0))+"%":(0,s.formatPrice)({amount:Math.abs(Number(r?.config?.fixed_value||0)),currencyCode:n.price.currencyCode,locale:u})||""}),codeText:(0,m.replaceTemplate)(c?.common?.withCode,{code:r?.config?.title??""}),code:r?.config?.title??"",countdownText:r?.config?.ends_at?(0,m.replaceTemplate)(c?.common?.endsIn,{countdown:`${S}:${B}:${L}:${R}`}):void 0,copyText:N?.copy||c?.copyCode,copiedText:N?.copied||c?.copied,onClick:()=>{const p=l?.coupon?0:b?.codeSavings??0;d?.(p)}}),f?.enable&&(0,e.jsx)(y,{checked:!!t?.email&&!!l?.member,discountText:(0,m.replaceTemplate)(c?.member?.offMember,{discount:(0,s.formatPrice)({amount:f?.config?.amount??0,currencyCode:n.price.currencyCode,locale:u})||""}),description:t?.email?c?.member?.loginDesc:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"mr-2",dangerouslySetInnerHTML:{__html:c?.member?.unloginDesc}}),(0,e.jsx)("span",{role:"button",tabIndex:0,onClick:p=>{p?.stopPropagation(),x?.()},className:"underline text-nowrap",dangerouslySetInnerHTML:{__html:c?.member?.login}})]}),onClick:()=>{if(!t?.email){x?.();return}const p=l?.member?0:f?.config?.amount??0;a?.(p)}})]})};D.displayName="ProductCoupon";var G=D;
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/ProductDetail/ProductCoupon/index.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport React from 'react'\nimport { cn, formatPrice } from '../../../../../../helpers/index.js'\nimport { Text, Link, Checkbox } from '../../../../../../components/index.js'\nimport useCopy from '../../../../hooks/useCopy.js'\nimport { useBenefits } from '../../../../hooks/useBenefits.js'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { useComponentData } from '../../../../hooks/useComponentData.js'\nimport { replaceTemplate } from '../../../../utils/textFormat.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider/index.js'\nimport useCountDown from '../../../../../../hooks/useCountDown.js'\n\nexport interface ProductCouponProps {\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n}\n\n// \u4F18\u60E0\u5238\u5361\u7247\u7EC4\u4EF6\nexport interface CouponCardProps {\n /** \u662F\u5426\u9009\u4E2D */\n checked: boolean\n /** \u6298\u6263\u6587\u6848 (\u5982 \"20% OFF\") */\n discountText: string\n /** \u4F18\u60E0\u7801\u6587\u6848 (\u5982 \"With code: ABC123\") */\n codeText: string\n /** \u4F18\u60E0\u7801 */\n code: string\n /** \u5012\u8BA1\u65F6\u6587\u6848 (\u5982 \"Ends in: 1:23:45:00\") */\n countdownText?: string\n /** \u590D\u5236\u6309\u94AE\u6587\u6848 */\n copyText: string\n /** \u5DF2\u590D\u5236\u6587\u6848 */\n copiedText: string\n /** \u70B9\u51FB\u4E8B\u4EF6 */\n onClick?: () => void\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n}\n\nexport const CouponCard: React.FC<CouponCardProps> = ({\n checked,\n discountText,\n codeText,\n code,\n countdownText,\n copyText,\n copiedText,\n onClick,\n className,\n}) => {\n const { copied: isCopied, copy: copyToClipboard } = useCopy()\n\n return (\n <div\n className={cn('flex flex-col gap-3 rounded-box overflow-hidden', className)}\n role=\"button\"\n tabIndex={0}\n onClick={onClick}\n >\n <div className=\"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4\">\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-1\">\n <Checkbox\n size=\"lg\"\n className=\"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary\"\n checked={checked}\n />\n <Text className=\"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]\">\n {discountText}\n </Text>\n </div>\n\n <div className=\"flex w-full items-center gap-2\">\n <div className=\"flex shrink-0 flex-col items-start\">\n <Text className=\"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px]\">\n {codeText}\n </Text>\n </div>\n <Link\n className=\"lg-desktop:text-[16px] text-[14px] font-bold underline\"\n role=\"button\"\n tabIndex={0}\n onClick={event => {\n event.preventDefault()\n event.stopPropagation()\n copyToClipboard(code)\n }}\n >\n {isCopied ? copiedText : copyText}\n </Link>\n </div>\n </div>\n\n {countdownText && (\n <Text className=\"text-brand-0 text-sm lg-desktop:text-base font-bold leading-[1.4] tracking-[-0.28px]\">\n {countdownText}\n </Text>\n )}\n </div>\n </div>\n )\n}\n\nCouponCard.displayName = 'CouponCard'\n\n// \u4F1A\u5458\u4EF7\u4F18\u60E0\u5361\u7247\u7EC4\u4EF6\nexport interface MemberDiscountCardProps {\n /** \u662F\u5426\u9009\u4E2D */\n checked: boolean\n /** \u6298\u6263\u6587\u6848 (\u5982 \"$10 OFF Member Price\") */\n discountText: string\n /** \u63CF\u8FF0\u6587\u6848 */\n description?: string\n /** \u70B9\u51FB\u4E8B\u4EF6 */\n onClick?: () => void\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n}\n\nexport const MemberDiscountCard: React.FC<MemberDiscountCardProps> = ({\n checked,\n discountText,\n description,\n onClick,\n className,\n}) => {\n return (\n <div\n className={cn('flex flex-col gap-3 rounded-box overflow-hidden', className)}\n role=\"button\"\n tabIndex={0}\n onClick={onClick}\n >\n <div className=\"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4\">\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-1\">\n <Checkbox\n size=\"lg\"\n className=\"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary\"\n checked={checked}\n />\n <Text className=\"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]\">\n {discountText}\n </Text>\n </div>\n\n {description && (\n <Text className=\"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px] pl-8\">\n {description}\n </Text>\n )}\n </div>\n </div>\n </div>\n )\n}\n\nMemberDiscountCard.displayName = 'MemberDiscountCard'\n\nconst ProductCoupon: React.FC<ProductCouponProps> = ({ className }) => {\n const { profile, variant, onUseCouponChange, onUseMemberDiscountChange, openSignInPopup, discount, savingDetail } =\n useBizProductContext()\n const { locale = 'us', trackingData } = useAiuiContext()\n const benefits = useBenefits({ variant })\n const { commonCoupon, memberDiscount } = benefits\n\n const { days, hours, minutes, seconds } = useCountDown({ endTime: commonCoupon?.config?.ends_at })\n\n const couponCopy = trackingData?.common?.coupon\n\n const productCouponData = useComponentData('ProductCoupon') ?? {}\n\n if ((!commonCoupon?.enable && !memberDiscount?.enable) || !variant?.availableForSale) {\n return null\n }\n\n return (\n <div className={cn('ipc-product-detail-product-coupon flex flex-col gap-3 lg-desktop:gap-4', className)}>\n {productCouponData?.title && (\n <Text className=\"text-info-primary text-[14px] lg-desktop:text-[16px] font-bold leading-[1.2] tracking-[-0.56px]\">\n {productCouponData.title}\n </Text>\n )}\n {commonCoupon?.enable && (\n <CouponCard\n checked={savingDetail?.coupon > 0}\n discountText={replaceTemplate(productCouponData?.common?.offCoupon, {\n discount:\n commonCoupon?.config?.value_type == 'percentage'\n ? Math.abs(Number(commonCoupon?.config?.value || 0)) + '%'\n : formatPrice({\n amount: Math.abs(Number(commonCoupon?.config?.fixed_value || 0)),\n currencyCode: variant.price.currencyCode,\n locale,\n }) || '',\n })}\n codeText={replaceTemplate(productCouponData?.common?.withCode, {\n code: commonCoupon?.config?.title ?? '',\n })}\n code={commonCoupon?.config?.title ?? ''}\n countdownText={\n commonCoupon?.config?.ends_at\n ? replaceTemplate(productCouponData?.common?.endsIn, {\n countdown: `${days}:${hours}:${minutes}:${seconds}`,\n })\n : undefined\n }\n copyText={couponCopy?.copy || productCouponData?.copyCode}\n copiedText={couponCopy?.copied || productCouponData?.copied}\n onClick={() => {\n const couponSaving = !savingDetail?.coupon ? (discount?.codeSavings ?? 0) : 0\n onUseCouponChange?.(couponSaving)\n }}\n />\n )}\n\n {memberDiscount?.enable && (\n <MemberDiscountCard\n checked={Boolean(profile?.email) && !!savingDetail?.member}\n discountText={replaceTemplate(productCouponData?.member?.offMember, {\n discount:\n formatPrice({\n amount: memberDiscount?.config?.amount ?? 0,\n currencyCode: variant.price.currencyCode,\n locale,\n }) || '',\n })}\n description={\n Boolean(profile?.email) ? (\n productCouponData?.member?.loginDesc\n ) : (\n <>\n <span className=\"mr-2\" dangerouslySetInnerHTML={{ __html: productCouponData?.member?.unloginDesc }} />\n <span\n role=\"button\"\n tabIndex={0}\n onClick={e => {\n e?.stopPropagation()\n openSignInPopup?.()\n }}\n className=\"underline text-nowrap\"\n dangerouslySetInnerHTML={{ __html: productCouponData?.member?.login }}\n />\n </>\n )\n }\n onClick={() => {\n if (profile?.email) {\n const memberSaving = !savingDetail?.member ? (memberDiscount?.config?.amount ?? 0) : 0\n onUseMemberDiscountChange?.(memberSaving)\n }\n }}\n />\n )}\n </div>\n )\n}\n\nProductCoupon.displayName = 'ProductCoupon'\n\nexport default ProductCoupon\n"],
5
- "mappings": "ukBAAA,IAAAA,EA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ACF,EACF,GAEJ,CAEJ,EAEAtB,EAAc,YAAc,gBAE5B,IAAO3B,EAAQ2B",
4
+ "sourcesContent": ["'use client'\n\nimport React from 'react'\nimport { cn, formatPrice } from '../../../../../../helpers/index.js'\nimport { Text, Link, Checkbox } from '../../../../../../components/index.js'\nimport useCopy from '../../../../hooks/useCopy.js'\nimport { useBenefits } from '../../../../hooks/useBenefits.js'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { useComponentData } from '../../../../hooks/useComponentData.js'\nimport { replaceTemplate } from '../../../../utils/textFormat.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider/index.js'\nimport useCountDown from '../../../../../../hooks/useCountDown.js'\n\nexport interface ProductCouponProps {\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n}\n\n// \u4F18\u60E0\u5238\u5361\u7247\u7EC4\u4EF6\nexport interface CouponCardProps {\n /** \u662F\u5426\u9009\u4E2D */\n checked: boolean\n /** \u6298\u6263\u6587\u6848 (\u5982 \"20% OFF\") */\n discountText: string\n /** \u4F18\u60E0\u7801\u6587\u6848 (\u5982 \"With code: ABC123\") */\n codeText: string\n /** \u4F18\u60E0\u7801 */\n code: string\n /** \u5012\u8BA1\u65F6\u6587\u6848 (\u5982 \"Ends in: 1:23:45:00\") */\n countdownText?: string\n /** \u590D\u5236\u6309\u94AE\u6587\u6848 */\n copyText: string\n /** \u5DF2\u590D\u5236\u6587\u6848 */\n copiedText: string\n /** \u70B9\u51FB\u4E8B\u4EF6 */\n onClick?: () => void\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n}\n\nexport const CouponCard: React.FC<CouponCardProps> = ({\n checked,\n discountText,\n codeText,\n code,\n countdownText,\n copyText,\n copiedText,\n onClick,\n className,\n}) => {\n const { copied: isCopied, copy: copyToClipboard } = useCopy()\n\n return (\n <div\n className={cn('flex flex-col gap-3 rounded-box overflow-hidden', className)}\n role=\"button\"\n tabIndex={0}\n onClick={onClick}\n >\n <div className=\"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4\">\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-1\">\n <Checkbox\n size=\"lg\"\n className=\"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary\"\n checked={checked}\n />\n <Text className=\"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]\">\n {discountText}\n </Text>\n </div>\n\n <div className=\"flex w-full items-center gap-2\">\n <div className=\"flex shrink-0 flex-col items-start\">\n <Text className=\"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px]\">\n {codeText}\n </Text>\n </div>\n <Link\n className=\"lg-desktop:text-[16px] text-[14px] font-bold underline\"\n role=\"button\"\n tabIndex={0}\n onClick={event => {\n event.preventDefault()\n event.stopPropagation()\n copyToClipboard(code)\n }}\n >\n {isCopied ? copiedText : copyText}\n </Link>\n </div>\n </div>\n\n {countdownText && (\n <Text className=\"text-brand-0 text-sm lg-desktop:text-base font-bold leading-[1.4] tracking-[-0.28px]\">\n {countdownText}\n </Text>\n )}\n </div>\n </div>\n )\n}\n\nCouponCard.displayName = 'CouponCard'\n\n// \u4F1A\u5458\u4EF7\u4F18\u60E0\u5361\u7247\u7EC4\u4EF6\nexport interface MemberDiscountCardProps {\n /** \u662F\u5426\u9009\u4E2D */\n checked: boolean\n /** \u6298\u6263\u6587\u6848 (\u5982 \"$10 OFF Member Price\") */\n discountText: string\n /** \u63CF\u8FF0\u6587\u6848 */\n description?: string\n /** \u70B9\u51FB\u4E8B\u4EF6 */\n onClick?: () => void\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n}\n\nexport const MemberDiscountCard: React.FC<MemberDiscountCardProps> = ({\n checked,\n discountText,\n description,\n onClick,\n className,\n}) => {\n return (\n <div\n className={cn('flex flex-col gap-3 rounded-box overflow-hidden', className)}\n role=\"button\"\n tabIndex={0}\n onClick={onClick}\n >\n <div className=\"flex flex-col gap-3 overflow-hidden rounded-box bg-[#EDFBFF] p-3 laptop:p-4\">\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-1\">\n <Checkbox\n size=\"lg\"\n className=\"data-[state=checked]:border-info-primary data-[state=checked]:bg-info-primary mr-2 rounded-full border-[1.6px] border-info-primary\"\n checked={checked}\n />\n <Text className=\"text-info-primary text-base laptop:text-xl lg-desktop:text-2xl font-bold leading-[1.2] tracking-[-0.8px]\">\n {discountText}\n </Text>\n </div>\n\n {description && (\n <Text className=\"text-info-primary lg-desktop:text-[16px] text-[14px] font-bold leading-[1.4] tracking-[-0.28px] pl-8\">\n {description}\n </Text>\n )}\n </div>\n </div>\n </div>\n )\n}\n\nMemberDiscountCard.displayName = 'MemberDiscountCard'\n\nconst ProductCoupon: React.FC<ProductCouponProps> = ({ className }) => {\n const { profile, variant, onUseCouponChange, onUseMemberDiscountChange, openSignInPopup, discount, savingDetail } =\n useBizProductContext()\n const { locale = 'us', trackingData } = useAiuiContext()\n const benefits = useBenefits({ variant })\n const { commonCoupon, memberDiscount } = benefits\n\n const { days, hours, minutes, seconds } = useCountDown({ endTime: commonCoupon?.config?.ends_at })\n\n const couponCopy = trackingData?.common?.coupon\n\n const productCouponData = useComponentData('ProductCoupon') ?? {}\n\n if ((!commonCoupon?.enable && !memberDiscount?.enable) || !variant?.availableForSale) {\n return null\n }\n\n return (\n <div className={cn('ipc-product-detail-product-coupon flex flex-col gap-3 lg-desktop:gap-4', className)}>\n {productCouponData?.title && (\n <Text className=\"text-info-primary text-[14px] lg-desktop:text-[16px] font-bold leading-[1.2] tracking-[-0.56px]\">\n {productCouponData.title}\n </Text>\n )}\n {commonCoupon?.enable && (\n <CouponCard\n checked={savingDetail?.coupon > 0}\n discountText={replaceTemplate(productCouponData?.common?.offCoupon, {\n discount:\n commonCoupon?.config?.value_type == 'percentage'\n ? Math.abs(Number(commonCoupon?.config?.value || 0)) + '%'\n : formatPrice({\n amount: Math.abs(Number(commonCoupon?.config?.fixed_value || 0)),\n currencyCode: variant.price.currencyCode,\n locale,\n }) || '',\n })}\n codeText={replaceTemplate(productCouponData?.common?.withCode, {\n code: commonCoupon?.config?.title ?? '',\n })}\n code={commonCoupon?.config?.title ?? ''}\n countdownText={\n commonCoupon?.config?.ends_at\n ? replaceTemplate(productCouponData?.common?.endsIn, {\n countdown: `${days}:${hours}:${minutes}:${seconds}`,\n })\n : undefined\n }\n copyText={couponCopy?.copy || productCouponData?.copyCode}\n copiedText={couponCopy?.copied || productCouponData?.copied}\n onClick={() => {\n const couponSaving = !savingDetail?.coupon ? (discount?.codeSavings ?? 0) : 0\n onUseCouponChange?.(couponSaving)\n }}\n />\n )}\n\n {memberDiscount?.enable && (\n <MemberDiscountCard\n checked={Boolean(profile?.email) && !!savingDetail?.member}\n discountText={replaceTemplate(productCouponData?.member?.offMember, {\n discount:\n formatPrice({\n amount: memberDiscount?.config?.amount ?? 0,\n currencyCode: variant.price.currencyCode,\n locale,\n }) || '',\n })}\n description={\n Boolean(profile?.email) ? (\n productCouponData?.member?.loginDesc\n ) : (\n <>\n <span className=\"mr-2\" dangerouslySetInnerHTML={{ __html: productCouponData?.member?.unloginDesc }} />\n <span\n role=\"button\"\n tabIndex={0}\n onClick={e => {\n e?.stopPropagation()\n openSignInPopup?.()\n }}\n className=\"underline text-nowrap\"\n dangerouslySetInnerHTML={{ __html: productCouponData?.member?.login }}\n />\n </>\n )\n }\n onClick={() => {\n if (!profile?.email) {\n openSignInPopup?.()\n return\n }\n const memberSaving = !savingDetail?.member ? (memberDiscount?.config?.amount ?? 0) : 0\n onUseMemberDiscountChange?.(memberSaving)\n }}\n />\n )}\n </div>\n )\n}\n\nProductCoupon.displayName = 'ProductCoupon'\n\nexport default ProductCoupon\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,uBAAAC,EAAA,YAAAC,IAAA,eAAAC,E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,IAAO3B,EAAQ2B",
6
6
  "names": ["ProductCoupon_exports", "__export", "CouponCard", "MemberDiscountCard", "ProductCoupon_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_helpers", "import_components", "import_useCopy", "import_useBenefits", "import_BizProductProvider", "import_useComponentData", "import_textFormat", "import_AiuiProvider", "import_useCountDown", "checked", "discountText", "codeText", "code", "countdownText", "copyText", "copiedText", "onClick", "className", "isCopied", "copyToClipboard", "useCopy", "event", "description", "ProductCoupon", "profile", "variant", "onUseCouponChange", "onUseMemberDiscountChange", "openSignInPopup", "discount", "savingDetail", "locale", "trackingData", "benefits", "commonCoupon", "memberDiscount", "days", "hours", "minutes", "seconds", "useCountDown", "couponCopy", "productCouponData", "couponSaving", "e", "memberSaving"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var L=(r,o)=>{for(var d in o)n(r,d,{get:o[d],enumerable:!0})},O=(r,o,d,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of T(o))!z.call(r,c)&&c!==d&&n(r,c,{get:()=>o[c],enumerable:!(a=B(o,c))||a.enumerable});return r};var S=r=>O(n({},"__esModule",{value:!0}),r);var R={};L(R,{default:()=>A});module.exports=S(R);var t=require("react/jsx-runtime"),l=require("../../../../../../components/index.js"),p=require("../../../../../../helpers/index.js"),k=require("react"),C=require("../../../../BizProductProvider.js"),m=require("../../../../utils/index.js"),v=require("../../../../../AiuiProvider/index.js"),y=require("../../../../../../shared/Styles.js"),i=require("../../../../hooks/useFollowTooltip.js");const V=()=>{const{locale:r="us"}=(0,v.useAiuiContext)(),{tooltip:o,getTooltipProps:d}=(0,i.useFollowTooltip)(),{checkedExchangePurchase:a,exchangePurchase:c,setCheckedBundle:j,setJoinedRecommendBuyProducts:u,setSavingDetail:N,setCheckedExchangePurchase:x,joinedRecommendBuyProducts:h,savingDetail:E,setAddOrder:f}=(0,C.useBizProductContext)(),{title:w,giftList:b=[],freeLabel:G}=c||{},g=(0,k.useMemo)(()=>b?.filter(e=>e.availableForSale),[b]),D=e=>{a?.id===e.id?(x?.(void 0),u?.({...h,exchange:{value:void 0,canOperate:!0}}),N?.({...E,exchangePurchase:0}),f?.(s=>s.filter(P=>P!=="exchange"))):(x?.(e),u?.({...h,exchange:{value:e,canOperate:!1}}),f?.(s=>[...s.filter(F=>F!=="exchange"),"exchange"]))};return g?.length?(0,t.jsxs)("div",{className:"ipc-product-detail-exchange-purchase",children:[(0,t.jsx)(l.Text,{className:"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]",html:w}),(0,t.jsx)("div",{className:"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3",children:g.map(e=>(0,t.jsxs)("div",{className:(0,p.cn)("rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold",{"border-brand":a?.id===e.id}),children:[(0,t.jsx)(l.Checkbox,{onCheckedChange:()=>D(e),size:"lg",className:(0,p.cn)("rounded-full border-2 border-[#E4E5E6]",{"border-brand":a?.id===e.id}),id:e.id,checked:a?.id===e.id,value:e.id}),(0,t.jsxs)("label",{htmlFor:e.id,className:"flex w-full cursor-pointer items-center justify-between gap-4 py-4 lg-desktop:py-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l.Picture,{source:e.image?.url,className:"size-12 shrink-0",imgClassName:"h-full"}),(0,t.jsx)(l.Text,{...d(e.product.title),className:"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold",html:e.product.title}),(0,t.jsx)(i.FollowTooltip,{...o})]}),(0,t.jsxs)("div",{className:"tablet:flex-row flex shrink-0 flex-col items-center gap-1",children:[(0,t.jsx)(l.Text,{className:"laptop:text-[20px] lg-desktop:text-2xl !leading-[1.2] text-base font-bold",html:(0,m.formatPrice)({amount:e?.finalPrice?.amount||0,locale:r,currencyCode:e?.finalPrice?.currencyCode||"USD"})}),(0,t.jsx)(l.Text,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base !leading-[1.2] font-bold text-[#6D6D6F] line-through",html:(0,m.formatPrice)({amount:e.price.amount,locale:r,currencyCode:e.price.currencyCode})})]})]})]},e.id))})]}):null};var A=(0,y.withLayout)(V);
1
+ "use strict";var n=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var L=(r,o)=>{for(var d in o)n(r,d,{get:o[d],enumerable:!0})},O=(r,o,d,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let c of T(o))!z.call(r,c)&&c!==d&&n(r,c,{get:()=>o[c],enumerable:!(l=B(o,c))||l.enumerable});return r};var S=r=>O(n({},"__esModule",{value:!0}),r);var R={};L(R,{default:()=>A});module.exports=S(R);var t=require("react/jsx-runtime"),a=require("../../../../../../components/index.js"),p=require("../../../../../../helpers/index.js"),k=require("react"),C=require("../../../../BizProductProvider.js"),m=require("../../../../utils/index.js"),v=require("../../../../../AiuiProvider/index.js"),y=require("../../../../../../shared/Styles.js"),i=require("../../../../hooks/useFollowTooltip.js");const V=()=>{const{locale:r="us"}=(0,v.useAiuiContext)(),{tooltip:o,getTooltipProps:d}=(0,i.useFollowTooltip)(),{checkedExchangePurchase:l,exchangePurchase:c,setCheckedBundle:j,setJoinedRecommendBuyProducts:u,setSavingDetail:N,setCheckedExchangePurchase:x,joinedRecommendBuyProducts:h,savingDetail:E,setAddOrder:f}=(0,C.useBizProductContext)(),{title:w,giftList:b=[],freeLabel:G}=c||{},g=(0,k.useMemo)(()=>b?.filter(e=>e.availableForSale),[b]),D=e=>{l?.id===e.id?(x?.(void 0),u?.({...h,exchange:{value:void 0,canOperate:!0}}),N?.({...E,exchangePurchase:0}),f?.(s=>s.filter(P=>P!=="exchange"))):(x?.(e),u?.({...h,exchange:{value:e,canOperate:!1}}),f?.(s=>[...s.filter(F=>F!=="exchange"),"exchange"]))};return g?.length?(0,t.jsxs)("div",{className:"ipc-product-detail-exchange-purchase",children:[(0,t.jsx)(a.Text,{className:"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]",html:w}),(0,t.jsx)("div",{className:"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3",children:g.map(e=>(0,t.jsxs)("div",{className:(0,p.cn)("rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold",{"border-brand":l?.id===e.id}),children:[(0,t.jsx)(a.Checkbox,{onCheckedChange:()=>D(e),size:"lg",className:(0,p.cn)("rounded-full border-2 border-[#E4E5E6]",{"border-brand-0 data-[state=checked]:bg-brand-0":l?.id===e.id}),id:e.id,checked:l?.id===e.id,value:e.id}),(0,t.jsxs)("label",{htmlFor:e.id,className:"flex w-full cursor-pointer items-center justify-between gap-4 py-4 lg-desktop:py-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(a.Picture,{source:e.image?.url,className:"size-12 shrink-0",imgClassName:"h-full"}),(0,t.jsx)(a.Text,{...d(e.product.title),className:"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold",html:e.product.title}),(0,t.jsx)(i.FollowTooltip,{...o})]}),(0,t.jsxs)("div",{className:"tablet:flex-row flex shrink-0 flex-col items-center gap-1",children:[(0,t.jsx)(a.Text,{className:"laptop:text-[20px] lg-desktop:text-2xl !leading-[1.2] text-base font-bold",html:(0,m.formatPrice)({amount:e?.finalPrice?.amount||0,locale:r,currencyCode:e?.finalPrice?.currencyCode||"USD"})}),(0,t.jsx)(a.Text,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base !leading-[1.2] font-bold text-[#6D6D6F] line-through",html:(0,m.formatPrice)({amount:e.price.amount,locale:r,currencyCode:e.price.currencyCode})})]})]})]},e.id))})]}):null};var A=(0,y.withLayout)(V);
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/ProductDetail/ProductExchangePurchase/index.tsx"],
4
- "sourcesContent": ["import { Text, Picture, Checkbox } from '../../../../../../components/index.js'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useMemo } from 'react'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { formatPrice } from '../../../../utils/index.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider/index.js'\nimport type { ProductVariant, ProductPrice } from '../../../../types/product'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { useFollowTooltip, FollowTooltip } from '../../../../hooks/useFollowTooltip.js'\n\nconst ProductExchangePurchase = () => {\n const { locale = 'us' } = useAiuiContext()\n const { tooltip, getTooltipProps } = useFollowTooltip()\n const {\n checkedExchangePurchase,\n exchangePurchase,\n setCheckedBundle,\n setJoinedRecommendBuyProducts,\n setSavingDetail,\n setCheckedExchangePurchase,\n joinedRecommendBuyProducts,\n savingDetail,\n setAddOrder,\n } = useBizProductContext()\n const { title, giftList = [], freeLabel } = exchangePurchase || {}\n const availableGifts = useMemo(() => giftList?.filter(item => item.availableForSale), [giftList])\n\n const handleCheckboxClick = (value: ProductVariant) => {\n if (checkedExchangePurchase?.id === value.id) {\n setCheckedExchangePurchase?.(undefined)\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: undefined,\n canOperate: true,\n },\n })\n setSavingDetail?.({ ...savingDetail, exchangePurchase: 0 })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'exchange'))\n } else {\n setCheckedExchangePurchase?.(value)\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value,\n canOperate: false,\n },\n })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => {\n // \u5982\u679C\u5DF2\u7ECF\u5B58\u5728\uFF0C\u5148\u79FB\u9664\u518D\u6DFB\u52A0\u5230\u672B\u5C3E\n const filtered = prev.filter(t => t !== 'exchange')\n return [...filtered, 'exchange']\n })\n }\n }\n\n if (!availableGifts?.length) return null\n\n return (\n <div className=\"ipc-product-detail-exchange-purchase\">\n <Text className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\" html={title} />\n <div className=\"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3\">\n {availableGifts.map((gift: ProductVariant & { finalPrice?: ProductPrice }) => (\n <div\n key={gift.id}\n className={cn(\n 'rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold',\n {\n ['border-brand']: checkedExchangePurchase?.id === gift.id,\n }\n )}\n >\n <Checkbox\n onCheckedChange={() => handleCheckboxClick(gift)}\n size=\"lg\"\n className={cn('rounded-full border-2 border-[#E4E5E6]', {\n 'border-brand': checkedExchangePurchase?.id === gift.id,\n })}\n id={gift.id}\n checked={checkedExchangePurchase?.id === gift.id}\n value={gift.id}\n ></Checkbox>\n <label\n htmlFor={gift.id}\n className=\"flex w-full cursor-pointer items-center justify-between gap-4 py-4 lg-desktop:py-6\"\n >\n <div className=\"flex items-center gap-2\">\n <Picture source={gift.image?.url} className=\"size-12 shrink-0\" imgClassName=\"h-full\" />\n <Text\n {...getTooltipProps(gift.product.title)}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold\"\n html={gift.product.title}\n />\n <FollowTooltip {...tooltip} />\n </div>\n <div className=\"tablet:flex-row flex shrink-0 flex-col items-center gap-1\">\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl !leading-[1.2] text-base font-bold\"\n html={formatPrice({\n amount: gift?.finalPrice?.amount || 0,\n locale,\n currencyCode: gift?.finalPrice?.currencyCode || 'USD',\n })}\n />\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base !leading-[1.2] 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 </label>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductExchangePurchase)\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA8DM,IAAAI,EAAA,6BA9DNC,EAAwC,iDACxCC,EAAmB,8CACnBC,EAAwB,iBACxBC,EAAqC,6CACrCC,EAA4B,sCAC5BC,EAA+B,gDAE/BC,EAA2B,8CAC3BC,EAAgD,iDAEhD,MAAMC,EAA0B,IAAM,CACpC,KAAM,CAAE,OAAAC,EAAS,IAAK,KAAI,kBAAe,EACnC,CAAE,QAAAC,EAAS,gBAAAC,CAAgB,KAAI,oBAAiB,EAChD,CACJ,wBAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,8BAAAC,EACA,gBAAAC,EACA,2BAAAC,EACA,2BAAAC,EACA,aAAAC,EACA,YAAAC,CACF,KAAI,wBAAqB,EACnB,CAAE,MAAAC,EAAO,SAAAC,EAAW,CAAC,EAAG,UAAAC,CAAU,EAAIV,GAAoB,CAAC,EAC3DW,KAAiB,WAAQ,IAAMF,GAAU,OAAOG,GAAQA,EAAK,gBAAgB,EAAG,CAACH,CAAQ,CAAC,EAE1FI,EAAuBC,GAA0B,CACjDf,GAAyB,KAAOe,EAAM,IACxCV,IAA6B,MAAS,EACtCF,IAAgC,CAC9B,GAAGG,EACH,SAAU,CACR,MAAO,OACP,WAAY,EACd,CACF,CAAC,EACDF,IAAkB,CAAE,GAAGG,EAAc,iBAAkB,CAAE,CAAC,EAE1DC,IAAcQ,GAAQA,EAAK,OAAOC,GAAKA,IAAM,UAAU,CAAC,IAExDZ,IAA6BU,CAAK,EAClCZ,IAAgC,CAC9B,GAAGG,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CAAuB",
4
+ "sourcesContent": ["import { Text, Picture, Checkbox } from '../../../../../../components/index.js'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useMemo } from 'react'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { formatPrice } from '../../../../utils/index.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider/index.js'\nimport type { ProductVariant, ProductPrice } from '../../../../types/product'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { useFollowTooltip, FollowTooltip } from '../../../../hooks/useFollowTooltip.js'\n\nconst ProductExchangePurchase = () => {\n const { locale = 'us' } = useAiuiContext()\n const { tooltip, getTooltipProps } = useFollowTooltip()\n const {\n checkedExchangePurchase,\n exchangePurchase,\n setCheckedBundle,\n setJoinedRecommendBuyProducts,\n setSavingDetail,\n setCheckedExchangePurchase,\n joinedRecommendBuyProducts,\n savingDetail,\n setAddOrder,\n } = useBizProductContext()\n const { title, giftList = [], freeLabel } = exchangePurchase || {}\n const availableGifts = useMemo(() => giftList?.filter(item => item.availableForSale), [giftList])\n\n const handleCheckboxClick = (value: ProductVariant) => {\n if (checkedExchangePurchase?.id === value.id) {\n setCheckedExchangePurchase?.(undefined)\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: undefined,\n canOperate: true,\n },\n })\n setSavingDetail?.({ ...savingDetail, exchangePurchase: 0 })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'exchange'))\n } else {\n setCheckedExchangePurchase?.(value)\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value,\n canOperate: false,\n },\n })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => {\n // \u5982\u679C\u5DF2\u7ECF\u5B58\u5728\uFF0C\u5148\u79FB\u9664\u518D\u6DFB\u52A0\u5230\u672B\u5C3E\n const filtered = prev.filter(t => t !== 'exchange')\n return [...filtered, 'exchange']\n })\n }\n }\n\n if (!availableGifts?.length) return null\n\n return (\n <div className=\"ipc-product-detail-exchange-purchase\">\n <Text className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\" html={title} />\n <div className=\"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3\">\n {availableGifts.map((gift: ProductVariant & { finalPrice?: ProductPrice }) => (\n <div\n key={gift.id}\n className={cn(\n 'rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold',\n {\n ['border-brand']: checkedExchangePurchase?.id === gift.id,\n }\n )}\n >\n <Checkbox\n onCheckedChange={() => handleCheckboxClick(gift)}\n size=\"lg\"\n className={cn('rounded-full border-2 border-[#E4E5E6]', {\n 'border-brand-0 data-[state=checked]:bg-brand-0': checkedExchangePurchase?.id === gift.id,\n })}\n id={gift.id}\n checked={checkedExchangePurchase?.id === gift.id}\n value={gift.id}\n ></Checkbox>\n <label\n htmlFor={gift.id}\n className=\"flex w-full cursor-pointer items-center justify-between gap-4 py-4 lg-desktop:py-6\"\n >\n <div className=\"flex items-center gap-2\">\n <Picture source={gift.image?.url} className=\"size-12 shrink-0\" imgClassName=\"h-full\" />\n <Text\n {...getTooltipProps(gift.product.title)}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold\"\n html={gift.product.title}\n />\n <FollowTooltip {...tooltip} />\n </div>\n <div className=\"tablet:flex-row flex shrink-0 flex-col items-center gap-1\">\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl !leading-[1.2] text-base font-bold\"\n html={formatPrice({\n amount: gift?.finalPrice?.amount || 0,\n locale,\n currencyCode: gift?.finalPrice?.currencyCode || 'USD',\n })}\n />\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base !leading-[1.2] 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 </label>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductExchangePurchase)\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA8DM,IAAAI,EAAA,6BA9DNC,EAAwC,iDACxCC,EAAmB,8CACnBC,EAAwB,iBACxBC,EAAqC,6CACrCC,EAA4B,sCAC5BC,EAA+B,gDAE/BC,EAA2B,8CAC3BC,EAAgD,iDAEhD,MAAMC,EAA0B,IAAM,CACpC,KAAM,CAAE,OAAAC,EAAS,IAAK,KAAI,kBAAe,EACnC,CAAE,QAAAC,EAAS,gBAAAC,CAAgB,KAAI,oBAAiB,EAChD,CACJ,wBAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,8BAAAC,EACA,gBAAAC,EACA,2BAAAC,EACA,2BAAAC,EACA,aAAAC,EACA,YAAAC,CACF,KAAI,wBAAqB,EACnB,CAAE,MAAAC,EAAO,SAAAC,EAAW,CAAC,EAAG,UAAAC,CAAU,EAAIV,GAAoB,CAAC,EAC3DW,KAAiB,WAAQ,IAAMF,GAAU,OAAOG,GAAQA,EAAK,gBAAgB,EAAG,CAACH,CAAQ,CAAC,EAE1FI,EAAuBC,GAA0B,CACjDf,GAAyB,KAAOe,EAAM,IACxCV,IAA6B,MAAS,EACtCF,IAAgC,CAC9B,GAAGG,EACH,SAAU,CACR,MAAO,OACP,WAAY,EACd,CACF,CAAC,EACDF,IAAkB,CAAE,GAAGG,EAAc,iBAAkB,CAAE,CAAC,EAE1DC,IAAcQ,GAAQA,EAAK,OAAOC,GAAKA,IAAM,UAAU,CAAC,IAExDZ,IAA6BU,CAAK,EAClCZ,IAAgC,CAC9B,GAAGG,EACH,SAAU,CACR,MAAAS,EACA,WAAY,EACd,CACF,CAAC,EAEDP,IAAcQ,GAGL,CAAC,GADSA,EAAK,OAAOC,GAAKA,IAAM,UAAU,EAC7B,UAAU,CAChC,EAEL,EAEA,OAAKL,GAAgB,UAGnB,QAAC,OAAI,UAAU,uCACb,oBAAC,QAAK,UAAU,6DAA6D,KAAMH,EAAO,KAC1F,OAAC,OAAI,UAAU,uFACZ,SAAAG,EAAe,IAAKM,MACnB,QAAC,OAEC,aAAW,MACT,mHACA,CACG,eAAiBlB,GAAyB,KAAOkB,EAAK,EACzD,CACF,EAEA,oBAAC,YACC,gBAAiB,IAAMJ,EAAoBI,CAAI,EAC/C,KAAK,KACL,aAAW,MAAG,yCAA0C,CACtD,iDAAkDlB,GAAyB,KAAOkB,EAAK,EACzF,CAAC,EACD,GAAIA,EAAK,GACT,QAASlB,GAAyB,KAAOkB,EAAK,GAC9C,MAAOA,EAAK,GACb,KACD,QAAC,SACC,QAASA,EAAK,GACd,UAAU,qFAEV,qBAAC,OAAI,UAAU,0BACb,oBAAC,WAAQ,OAAQA,EAAK,OAAO,IAAK,UAAU,mBAAmB,aAAa,SAAS,KACrF,OAAC,QACE,GAAGnB,EAAgBmB,EAAK,QAAQ,KAAK,EACtC,UAAU,2EACV,KAAMA,EAAK,QAAQ,MACrB,KACA,OAAC,iBAAe,GAAGpB,EAAS,GAC9B,KACA,QAAC,OAAI,UAAU,4DACb,oBAAC,QACC,UAAU,4EACV,QAAM,eAAY,CAChB,OAAQoB,GAAM,YAAY,QAAU,EACpC,OAAArB,EACA,aAAcqB,GAAM,YAAY,cAAgB,KAClD,CAAC,EACH,KACA,OAAC,QACC,UAAU,yGACV,QAAM,eAAY,CAChB,OAAQA,EAAK,MAAM,OACnB,OAAArB,EACA,aAAcqB,EAAK,MAAM,YAC3B,CAAC,EACH,GACF,GACF,IAjDKA,EAAK,EAkDZ,CACD,EACH,GACF,EA7DkC,IA+DtC,EAEA,IAAOjC,KAAQ,cAAWW,CAAuB",
6
6
  "names": ["ProductExchangePurchase_exports", "__export", "ProductExchangePurchase_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_helpers", "import_react", "import_BizProductProvider", "import_utils", "import_AiuiProvider", "import_Styles", "import_useFollowTooltip", "ProductExchangePurchase", "locale", "tooltip", "getTooltipProps", "checkedExchangePurchase", "exchangePurchase", "setCheckedBundle", "setJoinedRecommendBuyProducts", "setSavingDetail", "setCheckedExchangePurchase", "joinedRecommendBuyProducts", "savingDetail", "setAddOrder", "title", "giftList", "freeLabel", "availableGifts", "item", "handleCheckboxClick", "value", "prev", "t", "gift"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var p=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var L=(r,o)=>{for(var d in o)p(r,d,{get:o[d],enumerable:!0})},O=(r,o,d,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of T(o))!z.call(r,l)&&l!==d&&p(r,l,{get:()=>o[l],enumerable:!(a=D(o,l))||a.enumerable});return r};var A=r=>O(p({},"__esModule",{value:!0}),r);var V={};L(V,{default:()=>S});module.exports=A(V);var t=require("react/jsx-runtime"),i=require("../../../../../../components/index.js"),n=require("../../../../../../helpers/index.js"),k=require("react"),v=require("../../../../BizProductProvider.js"),C=require("../../../../utils/index.js"),N=require("../../../../../AiuiProvider/index.js"),y=require("../../../../../../shared/Styles.js"),s=require("../../../../hooks/useFollowTooltip.js");const R=()=>{const{locale:r="us"}=(0,N.useAiuiContext)(),{tooltip:o,getTooltipProps:d}=(0,s.useFollowTooltip)(),{freeGift:a,checkedGift:l,setCheckedGift:m,setCheckedBundle:j,setSavingDetail:P,savingDetail:E,setJoinedRecommendBuyProducts:f,joinedRecommendBuyProducts:u,setAddOrder:x}=(0,v.useBizProductContext)(),{title:w,giftList:b=[],freeLabel:F}=a||{},h=(0,k.useMemo)(()=>b?.filter(e=>e.availableForSale),[b]),G=e=>{l?.id===e.id?(m?.(void 0),P?.({...E,freeGift:0}),f?.({...u,gift:{value:void 0,canOperate:!0}}),x?.(c=>c.filter(g=>g!=="gift"))):(m?.(e),f?.({...u,gift:{value:e,canOperate:!1}}),x?.(c=>[...c.filter(B=>B!=="gift"),"gift"]))};return h?.length?(0,t.jsxs)("div",{className:"ipc-product-detail-free-gift",children:[(0,t.jsx)(i.Text,{className:"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]",html:w}),(0,t.jsx)("div",{className:"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3",children:h.map(e=>(0,t.jsxs)("div",{className:(0,n.cn)("rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold",{"border-brand":l?.id===e.id}),children:[(0,t.jsx)(i.Checkbox,{onCheckedChange:()=>G(e),size:"lg",className:(0,n.cn)("rounded-full border-2 border-[#E4E5E6]",{"border-brand":l?.id===e.id}),id:e.id,checked:l?.id===e.id,value:e.id}),(0,t.jsxs)("label",{htmlFor:e.id,className:"flex w-full cursor-pointer items-center justify-between gap-4 py-4 lg-desktop:py-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(i.Picture,{source:e.image?.url,className:"size-12 shrink-0",imgClassName:"h-full"}),(0,t.jsx)(i.Text,{...d(e.product.title),className:"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold",html:e.product.title}),(0,t.jsx)(s.FollowTooltip,{...o})]}),(0,t.jsxs)("div",{className:"tablet:flex-row flex shrink-0 flex-col items-center gap-1",children:[(0,t.jsx)(i.Text,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold !leading-[1.2]",html:F}),(0,t.jsx)(i.Text,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold text-[#6D6D6F] line-through !leading-[1.2]",html:(0,C.formatPrice)({amount:e.price.amount,locale:r,currencyCode:e.price.currencyCode})})]})]})]},e.id))})]}):null};var S=(0,y.withLayout)(R);
1
+ "use strict";var p=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var L=(r,o)=>{for(var i in o)p(r,i,{get:o[i],enumerable:!0})},O=(r,o,i,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of T(o))!z.call(r,l)&&l!==i&&p(r,l,{get:()=>o[l],enumerable:!(a=D(o,l))||a.enumerable});return r};var A=r=>O(p({},"__esModule",{value:!0}),r);var V={};L(V,{default:()=>S});module.exports=A(V);var t=require("react/jsx-runtime"),d=require("../../../../../../components/index.js"),n=require("../../../../../../helpers/index.js"),k=require("react"),v=require("../../../../BizProductProvider.js"),C=require("../../../../utils/index.js"),N=require("../../../../../AiuiProvider/index.js"),y=require("../../../../../../shared/Styles.js"),s=require("../../../../hooks/useFollowTooltip.js");const R=()=>{const{locale:r="us"}=(0,N.useAiuiContext)(),{tooltip:o,getTooltipProps:i}=(0,s.useFollowTooltip)(),{freeGift:a,checkedGift:l,setCheckedGift:m,setCheckedBundle:j,setSavingDetail:P,savingDetail:E,setJoinedRecommendBuyProducts:f,joinedRecommendBuyProducts:u,setAddOrder:x}=(0,v.useBizProductContext)(),{title:w,giftList:b=[],freeLabel:F}=a||{},h=(0,k.useMemo)(()=>b?.filter(e=>e.availableForSale),[b]),G=e=>{l?.id===e.id?(m?.(void 0),P?.({...E,freeGift:0}),f?.({...u,gift:{value:void 0,canOperate:!0}}),x?.(c=>c.filter(g=>g!=="gift"))):(m?.(e),f?.({...u,gift:{value:e,canOperate:!1}}),x?.(c=>[...c.filter(B=>B!=="gift"),"gift"]))};return h?.length?(0,t.jsxs)("div",{className:"ipc-product-detail-free-gift",children:[(0,t.jsx)(d.Text,{className:"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]",html:w}),(0,t.jsx)("div",{className:"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3",children:h.map(e=>(0,t.jsxs)("div",{className:(0,n.cn)("rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold",{"border-brand":l?.id===e.id}),children:[(0,t.jsx)(d.Checkbox,{onCheckedChange:()=>G(e),size:"lg",className:(0,n.cn)("rounded-full border-2 border-[#E4E5E6]",{"border-brand-0 data-[state=checked]:bg-brand-0":l?.id===e.id}),id:e.id,checked:l?.id===e.id,value:e.id}),(0,t.jsxs)("label",{htmlFor:e.id,className:"flex w-full cursor-pointer items-center justify-between gap-4 py-4 lg-desktop:py-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Picture,{source:e.image?.url,className:"size-12 shrink-0",imgClassName:"h-full"}),(0,t.jsx)(d.Text,{...i(e.product.title),className:"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold",html:e.product.title}),(0,t.jsx)(s.FollowTooltip,{...o})]}),(0,t.jsxs)("div",{className:"tablet:flex-row flex shrink-0 flex-col items-center gap-1",children:[(0,t.jsx)(d.Text,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold !leading-[1.2]",html:F}),(0,t.jsx)(d.Text,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold text-[#6D6D6F] line-through !leading-[1.2]",html:(0,C.formatPrice)({amount:e.price.amount,locale:r,currencyCode:e.price.currencyCode})})]})]})]},e.id))})]}):null};var S=(0,y.withLayout)(R);
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/ProductDetail/ProductFreeGift/index.tsx"],
4
- "sourcesContent": ["import { Text, Picture, Checkbox } from '../../../../../../components/index.js'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useEffect, useMemo } from 'react'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { formatPrice } from '../../../../utils/index.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider/index.js'\nimport type { ProductVariant } from '../../../../types/product'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { useFollowTooltip, FollowTooltip } from '../../../../hooks/useFollowTooltip.js'\n\nconst ProductFreeGift = () => {\n const { locale = 'us' } = useAiuiContext()\n const { tooltip, getTooltipProps } = useFollowTooltip()\n const {\n freeGift,\n checkedGift,\n setCheckedGift,\n setCheckedBundle,\n setSavingDetail,\n savingDetail,\n setJoinedRecommendBuyProducts,\n joinedRecommendBuyProducts,\n setAddOrder,\n } = useBizProductContext()\n const { title, giftList = [], freeLabel } = freeGift || {}\n const availableGifts = useMemo(() => giftList?.filter(item => item.availableForSale), [giftList])\n\n const handleCheckboxClick = (value: ProductVariant) => {\n if (checkedGift?.id === value.id) {\n setCheckedGift?.(undefined)\n setSavingDetail?.({ ...savingDetail, freeGift: 0 })\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: undefined,\n canOperate: true,\n },\n })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'gift'))\n } else {\n setCheckedGift?.(value)\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value,\n canOperate: false,\n },\n })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => {\n // \u5982\u679C\u5DF2\u7ECF\u5B58\u5728\uFF0C\u5148\u79FB\u9664\u518D\u6DFB\u52A0\u5230\u672B\u5C3E\n const filtered = prev.filter(t => t !== 'gift')\n return [...filtered, 'gift']\n })\n }\n }\n\n // useEffect(() => {\n // // \u5982\u679C\u7B2C\u4E00\u4E2A\u793C\u7269\u53EF\u7528\uFF0C\u5219\u9009\u4E2D\u5B83\n // availableGifts?.[0] && handleCheckboxClick(availableGifts?.[0])\n // }, [availableGifts])\n\n if (!availableGifts?.length) return null\n\n return (\n <div className=\"ipc-product-detail-free-gift\">\n <Text className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\" html={title} />\n <div className=\"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3\">\n {availableGifts.map(gift => (\n <div\n key={gift.id}\n className={cn(\n 'rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold',\n {\n ['border-brand']: checkedGift?.id === gift.id,\n }\n )}\n >\n <Checkbox\n onCheckedChange={() => handleCheckboxClick(gift)}\n size=\"lg\"\n className={cn('rounded-full border-2 border-[#E4E5E6]', {\n 'border-brand': checkedGift?.id === gift.id,\n })}\n id={gift.id}\n checked={checkedGift?.id === gift.id}\n value={gift.id}\n ></Checkbox>\n <label\n htmlFor={gift.id}\n className=\"flex w-full cursor-pointer items-center justify-between gap-4 py-4 lg-desktop:py-6\"\n >\n <div className=\"flex items-center gap-2\">\n <Picture source={gift.image?.url} className=\"size-12 shrink-0\" imgClassName=\"h-full\" />\n <Text\n {...getTooltipProps(gift.product.title)}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold\"\n html={gift.product.title}\n />\n <FollowTooltip {...tooltip} />\n </div>\n <div className=\"tablet:flex-row flex shrink-0 flex-col items-center gap-1\">\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold !leading-[1.2]\"\n html={freeLabel}\n />\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold text-[#6D6D6F] line-through !leading-[1.2]\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n </label>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductFreeGift)\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmEM,IAAAI,EAAA,6BAnENC,EAAwC,iDACxCC,EAAmB,8CACnBC,EAAmC,iBACnCC,EAAqC,6CACrCC,EAA4B,sCAC5BC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C,KAAK,KACL,aAAW,MAAG,yCAA0C,CACtD,eAAgBjB,GAAa,KAAOiB,EAAK,EAC3C,CAAC,EACD,GAAIA,EAAK,GACT,QAASjB,GAAa,KAAOiB,EAAK,GAClC,MAAOA,EAAK,GACb,KACD,QAAC,SACC,QAASA,EAAK,GACd,UAAU,qFAEV,qBAAC,OAAI,UAAU,0BACb,oBAAC,WAAQ,OAAQA,EAAK,OAAO,IAAK,UAAU,mBAAmB,aAAa,SAAS,KACrF,OAAC,QACE,GAAGnB,EAAgBmB,EAAK,QAAQ,KAAK,EACtC,UAAU,2EACV,KAAMA,EAAK,QAAQ,MACrB,KACA,OAAC,iBAAe,GAAGpB,EAAS,GAC9B,KACA,QAAC,OAAI,UAAU,4DACb,oBAAC,QACC,UAAU,4EACV,KAAMa,EACR,KACA,OAAC,QACC,UAAU,wGACV,QAAM,eAAY,CAChB,OAAQO,EAAK,MAAM,OACnB,OAAArB,EACA,aAAcqB,EAAK,MAAM,YAC3B,CAAC,EACH,GACF,GACF,IA7CKA,EAAK,EA8CZ,CACD,EACH,GACF,EAzDkC,IA2DtC,EAEA,IAAOjC,KAAQ,cAAWW,CAAe",
4
+ "sourcesContent": ["import { Text, Picture, Checkbox } from '../../../../../../components/index.js'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { useEffect, useMemo } from 'react'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\nimport { formatPrice } from '../../../../utils/index.js'\nimport { useAiuiContext } from '../../../../../AiuiProvider/index.js'\nimport type { ProductVariant } from '../../../../types/product'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { useFollowTooltip, FollowTooltip } from '../../../../hooks/useFollowTooltip.js'\n\nconst ProductFreeGift = () => {\n const { locale = 'us' } = useAiuiContext()\n const { tooltip, getTooltipProps } = useFollowTooltip()\n const {\n freeGift,\n checkedGift,\n setCheckedGift,\n setCheckedBundle,\n setSavingDetail,\n savingDetail,\n setJoinedRecommendBuyProducts,\n joinedRecommendBuyProducts,\n setAddOrder,\n } = useBizProductContext()\n const { title, giftList = [], freeLabel } = freeGift || {}\n const availableGifts = useMemo(() => giftList?.filter(item => item.availableForSale), [giftList])\n\n const handleCheckboxClick = (value: ProductVariant) => {\n if (checkedGift?.id === value.id) {\n setCheckedGift?.(undefined)\n setSavingDetail?.({ ...savingDetail, freeGift: 0 })\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: undefined,\n canOperate: true,\n },\n })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'gift'))\n } else {\n setCheckedGift?.(value)\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value,\n canOperate: false,\n },\n })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => {\n // \u5982\u679C\u5DF2\u7ECF\u5B58\u5728\uFF0C\u5148\u79FB\u9664\u518D\u6DFB\u52A0\u5230\u672B\u5C3E\n const filtered = prev.filter(t => t !== 'gift')\n return [...filtered, 'gift']\n })\n }\n }\n\n // useEffect(() => {\n // // \u5982\u679C\u7B2C\u4E00\u4E2A\u793C\u7269\u53EF\u7528\uFF0C\u5219\u9009\u4E2D\u5B83\n // availableGifts?.[0] && handleCheckboxClick(availableGifts?.[0])\n // }, [availableGifts])\n\n if (!availableGifts?.length) return null\n\n return (\n <div className=\"ipc-product-detail-free-gift\">\n <Text className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\" html={title} />\n <div className=\"laptop:grid-cols-2 laptop-md:grid-cols-1 lg-desktop:mt-4 mt-3 grid grid-cols-1 gap-3\">\n {availableGifts.map(gift => (\n <div\n key={gift.id}\n className={cn(\n 'rounded-box h-[80px] laptop:h-[100px] flex items-center gap-2 border-2 border-[#E4E5E6] px-4 text-left font-bold',\n {\n ['border-brand']: checkedGift?.id === gift.id,\n }\n )}\n >\n <Checkbox\n onCheckedChange={() => handleCheckboxClick(gift)}\n size=\"lg\"\n className={cn('rounded-full border-2 border-[#E4E5E6]', {\n 'border-brand-0 data-[state=checked]:bg-brand-0': checkedGift?.id === gift.id,\n })}\n id={gift.id}\n checked={checkedGift?.id === gift.id}\n value={gift.id}\n ></Checkbox>\n <label\n htmlFor={gift.id}\n className=\"flex w-full cursor-pointer items-center justify-between gap-4 py-4 lg-desktop:py-6\"\n >\n <div className=\"flex items-center gap-2\">\n <Picture source={gift.image?.url} className=\"size-12 shrink-0\" imgClassName=\"h-full\" />\n <Text\n {...getTooltipProps(gift.product.title)}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold\"\n html={gift.product.title}\n />\n <FollowTooltip {...tooltip} />\n </div>\n <div className=\"tablet:flex-row flex shrink-0 flex-col items-center gap-1\">\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold !leading-[1.2]\"\n html={freeLabel}\n />\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold text-[#6D6D6F] line-through !leading-[1.2]\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n </label>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductFreeGift)\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmEM,IAAAI,EAAA,6BAnENC,EAAwC,iDACxCC,EAAmB,8CACnBC,EAAmC,iBACnCC,EAAqC,6CACrCC,EAA4B,sCAC5BC,EAA+B,gDAE/BC,EAA2B,8CAC3BC,EAAgD,iDAEhD,MAAMC,EAAkB,IAAM,CAC5B,KAAM,CAAE,OAAAC,EAAS,IAAK,KAAI,kBAAe,EACnC,CAAE,QAAAC,EAAS,gBAAAC,CAAgB,KAAI,oBAAiB,EAChD,CACJ,SAAAC,EACA,YAAAC,EACA,eAAAC,EACA,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ACb,oBAAC,WAAQ,OAAQA,EAAK,OAAO,IAAK,UAAU,mBAAmB,aAAa,SAAS,KACrF,OAAC,QACE,GAAGnB,EAAgBmB,EAAK,QAAQ,KAAK,EACtC,UAAU,2EACV,KAAMA,EAAK,QAAQ,MACrB,KACA,OAAC,iBAAe,GAAGpB,EAAS,GAC9B,KACA,QAAC,OAAI,UAAU,4DACb,oBAAC,QACC,UAAU,4EACV,KAAMa,EACR,KACA,OAAC,QACC,UAAU,wGACV,QAAM,eAAY,CAChB,OAAQO,EAAK,MAAM,OACnB,OAAArB,EACA,aAAcqB,EAAK,MAAM,YAC3B,CAAC,EACH,GACF,GACF,IA7CKA,EAAK,EA8CZ,CACD,EACH,GACF,EAzDkC,IA2DtC,EAEA,IAAOjC,KAAQ,cAAWW,CAAe",
6
6
  "names": ["ProductFreeGift_exports", "__export", "ProductFreeGift_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_helpers", "import_react", "import_BizProductProvider", "import_utils", "import_AiuiProvider", "import_Styles", "import_useFollowTooltip", "ProductFreeGift", "locale", "tooltip", "getTooltipProps", "freeGift", "checkedGift", "setCheckedGift", "setCheckedBundle", "setSavingDetail", "savingDetail", "setJoinedRecommendBuyProducts", "joinedRecommendBuyProducts", "setAddOrder", "title", "giftList", "freeLabel", "availableGifts", "item", "handleCheckboxClick", "value", "prev", "t", "gift"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var b=Object.create;var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var r in e)p(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of h(e))!g.call(t,o)&&o!==r&&p(t,o,{get:()=>e[o],enumerable:!(l=v(e,o))||l.enumerable});return t};var P=(t,e,r)=>(r=t!=null?b(N(t)):{},m(e||!t||!t.__esModule?p(r,"default",{value:t,enumerable:!0}):r,t)),y=t=>m(p({},"__esModule",{value:!0}),t);var C={};w(C,{default:()=>B});module.exports=y(C);var a=require("react/jsx-runtime"),i=require("../../../../components/index.js"),n=require("../index.js"),c=require("../../BizProductProvider.js"),u=require("../../hooks/useComponentData.js"),s=P(require("./ScrollSpyNav/index.js")),f=require("../../../../shared/Styles.js");const x=({onSpyNavItemClick:t,totalSavingsSlot:e,actionsSlot:r})=>{const{product:l,renderRating:o}=(0,c.useBizProductContext)(),d=(0,u.useComponentData)("PurchaseBar")??[];return(0,a.jsxs)("div",{id:"purchase-bar",className:"sticky left-0 top-0 z-[45] w-full border-b border-[#E4E5E6] bg-white",children:[(0,a.jsx)(i.Container,{children:(0,a.jsxs)("div",{className:"tablet:justify-between laptop-md:gap-16 tablet:gap-0 tablet:w-full flex flex-wrap items-center gap-[10px]",children:[(0,a.jsxs)("div",{className:"laptop-md:pt-6 laptop-md:pb-0 min-w-0 flex-1 py-3",children:[(0,a.jsx)(i.Heading,{size:2,className:"line-clamp-2 text-wrap",html:l?.title}),(0,a.jsx)("div",{className:"laptop-md:block mt-3 hidden",children:(0,a.jsx)(s.default,{tabs:d,className:"",renderRating:o,onSpyNavItemClick:t})})]}),(0,a.jsx)("div",{className:"laptop-md:block hidden shrink-0",children:r??(0,a.jsx)(n.ProductActions,{totalSavingsSlot:e})})]})}),(0,a.jsxs)(i.Container,{className:"laptop-md:hidden relative",children:[(0,a.jsx)("div",{className:"absolute left-0 top-0 h-px w-full bg-[#E4E5E6]"}),(0,a.jsx)(s.default,{tabs:d,renderRating:o,onSpyNavItemClick:t})]})]})};var B=(0,f.withLayout)(x);
1
+ "use strict";var b=Object.create;var s=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of h(e))!g.call(t,o)&&o!==r&&s(t,o,{get:()=>e[o],enumerable:!(l=v(e,o))||l.enumerable});return t};var P=(t,e,r)=>(r=t!=null?b(N(t)):{},m(e||!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),y=t=>m(s({},"__esModule",{value:!0}),t);var C={};w(C,{default:()=>B});module.exports=y(C);var a=require("react/jsx-runtime"),i=require("../../../../components/index.js"),n=require("../index.js"),c=require("../../BizProductProvider.js"),u=require("../../hooks/useComponentData.js"),p=P(require("./ScrollSpyNav/index.js")),f=require("../../../../shared/Styles.js");const x=({onSpyNavItemClick:t,totalSavingsSlot:e,actionsSlot:r})=>{const{product:l,renderRating:o}=(0,c.useBizProductContext)(),d=(0,u.useComponentData)("PurchaseBar")??[];return(0,a.jsxs)("div",{id:"purchase-bar",className:"sticky left-0 top-0 z-[45] w-full border-b border-[#E4E5E6] bg-white",children:[(0,a.jsx)(i.Container,{children:(0,a.jsxs)("div",{className:"tablet:justify-between laptop-md:gap-16 tablet:gap-0 tablet:w-full flex flex-wrap items-center gap-[10px]",children:[(0,a.jsxs)("div",{className:"laptop-md:pt-6 laptop-md:pb-0 min-w-0 flex-1 py-3",children:[(0,a.jsx)(i.Heading,{as:"h1",size:2,className:"line-clamp-2 text-wrap",html:l?.title}),(0,a.jsx)("div",{className:"laptop-md:block mt-3 hidden",children:(0,a.jsx)(p.default,{tabs:d,className:"",renderRating:o,onSpyNavItemClick:t})})]}),(0,a.jsx)("div",{className:"laptop-md:block hidden shrink-0",children:r??(0,a.jsx)(n.ProductActions,{totalSavingsSlot:e})})]})}),(0,a.jsxs)(i.Container,{className:"laptop-md:hidden relative",children:[(0,a.jsx)("div",{className:"absolute left-0 top-0 h-px w-full bg-[#E4E5E6]"}),(0,a.jsx)(p.default,{tabs:d,renderRating:o,onSpyNavItemClick:t})]})]})};var B=(0,f.withLayout)(x);
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/biz-components/Listing/components/PurchaseBar/index.tsx"],
4
- "sourcesContent": ["import { Heading, Container } from '../../../../components/index.js'\nimport type { PurchaseBarProps } from './types.js'\nimport { ProductActions } from '../index.js'\nimport { useBizProductContext } from '../../BizProductProvider.js'\nimport { useComponentData } from '../../hooks/useComponentData.js'\nimport ScrollSpyNav from './ScrollSpyNav/index.js'\nimport { withLayout } from '../../../../shared/Styles.js'\n\nconst PurchaseBar = ({ onSpyNavItemClick, totalSavingsSlot, actionsSlot }: PurchaseBarProps) => {\n const { product, renderRating } = useBizProductContext()\n\n const PurchaseBarData = useComponentData('PurchaseBar') ?? []\n\n return (\n <div id=\"purchase-bar\" className=\"sticky left-0 top-0 z-[45] w-full border-b border-[#E4E5E6] bg-white\">\n <Container>\n <div className=\"tablet:justify-between laptop-md:gap-16 tablet:gap-0 tablet:w-full flex flex-wrap items-center gap-[10px]\">\n <div className=\"laptop-md:pt-6 laptop-md:pb-0 min-w-0 flex-1 py-3\">\n <Heading size={2} className=\"line-clamp-2 text-wrap\" html={product?.title} />\n <div className=\"laptop-md:block mt-3 hidden\">\n <ScrollSpyNav\n tabs={PurchaseBarData}\n className=\"\"\n renderRating={renderRating}\n onSpyNavItemClick={onSpyNavItemClick}\n />\n </div>\n </div>\n <div className=\"laptop-md:block hidden shrink-0\">\n {actionsSlot ?? <ProductActions totalSavingsSlot={totalSavingsSlot} />}\n </div>\n </div>\n </Container>\n <Container className=\"laptop-md:hidden relative\">\n <div className=\"absolute left-0 top-0 h-px w-full bg-[#E4E5E6]\"></div>\n <ScrollSpyNav tabs={PurchaseBarData} renderRating={renderRating} onSpyNavItemClick={onSpyNavItemClick} />\n </Container>\n </div>\n )\n}\n\nexport default withLayout(PurchaseBar)\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAiBU,IAAAI,EAAA,6BAjBVC,EAAmC,2CAEnCC,EAA+B,uBAC/BC,EAAqC,uCACrCC,EAAiC,2CACjCC,EAAyB,sCACzBC,EAA2B,wCAE3B,MAAMC,EAAc,CAAC,CAAE,kBAAAC,EAAmB,iBAAAC,EAAkB,YAAAC,CAAY,IAAwB,CAC9F,KAAM,CAAE,QAAAC,EAAS,aAAAC,CAAa,KAAI,wBAAqB,EAEjDC,KAAkB,oBAAiB,aAAa,GAAK,CAAC,EAE5D,SACE,QAAC,OAAI,GAAG,eAAe,UAAU,uEAC/B,oBAAC,aACC,oBAAC,OAAI,UAAU,4GACb,qBAAC,OAAI,UAAU,oDACb,oBAAC,WAAQ,KAAM,EAAG,UAAU,yBAAyB,KAAMF,GAAS,MAAO,KAC3E,OAAC,OAAI,UAAU,8BACb,mBAAC,EAAAG,QAAA,CACC,KAAMD,EACN,UAAU,GACV,aAAcD,EACd,kBAAmBJ,EACrB,EACF,GACF,KACA,OAAC,OAAI,UAAU,kCACZ,SAAAE,MAAe,OAAC,kBAAe,iBAAkBD,EAAkB,EACtE,GACF,EACF,KACA,QAAC,aAAU,UAAU,4BACnB,oBAAC,OAAI,UAAU,iDAAiD,KAChE,OAAC,EAAAK,QAAA,CAAa,KAAMD,EAAiB,aAAcD,EAAc,kBAAmBJ,EAAmB,GACzG,GACF,CAEJ,EAEA,IAAOV,KAAQ,cAAWS,CAAW",
4
+ "sourcesContent": ["import { Heading, Container } from '../../../../components/index.js'\nimport type { PurchaseBarProps } from './types.js'\nimport { ProductActions } from '../index.js'\nimport { useBizProductContext } from '../../BizProductProvider.js'\nimport { useComponentData } from '../../hooks/useComponentData.js'\nimport ScrollSpyNav from './ScrollSpyNav/index.js'\nimport { withLayout } from '../../../../shared/Styles.js'\n\nconst PurchaseBar = ({ onSpyNavItemClick, totalSavingsSlot, actionsSlot }: PurchaseBarProps) => {\n const { product, renderRating } = useBizProductContext()\n\n const PurchaseBarData = useComponentData('PurchaseBar') ?? []\n\n return (\n <div id=\"purchase-bar\" className=\"sticky left-0 top-0 z-[45] w-full border-b border-[#E4E5E6] bg-white\">\n <Container>\n <div className=\"tablet:justify-between laptop-md:gap-16 tablet:gap-0 tablet:w-full flex flex-wrap items-center gap-[10px]\">\n <div className=\"laptop-md:pt-6 laptop-md:pb-0 min-w-0 flex-1 py-3\">\n <Heading as=\"h1\" size={2} className=\"line-clamp-2 text-wrap\" html={product?.title} />\n <div className=\"laptop-md:block mt-3 hidden\">\n <ScrollSpyNav\n tabs={PurchaseBarData}\n className=\"\"\n renderRating={renderRating}\n onSpyNavItemClick={onSpyNavItemClick}\n />\n </div>\n </div>\n <div className=\"laptop-md:block hidden shrink-0\">\n {actionsSlot ?? <ProductActions totalSavingsSlot={totalSavingsSlot} />}\n </div>\n </div>\n </Container>\n <Container className=\"laptop-md:hidden relative\">\n <div className=\"absolute left-0 top-0 h-px w-full bg-[#E4E5E6]\"></div>\n <ScrollSpyNav tabs={PurchaseBarData} renderRating={renderRating} onSpyNavItemClick={onSpyNavItemClick} />\n </Container>\n </div>\n )\n}\n\nexport default withLayout(PurchaseBar)\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAiBU,IAAAI,EAAA,6BAjBVC,EAAmC,2CAEnCC,EAA+B,uBAC/BC,EAAqC,uCACrCC,EAAiC,2CACjCC,EAAyB,sCACzBC,EAA2B,wCAE3B,MAAMC,EAAc,CAAC,CAAE,kBAAAC,EAAmB,iBAAAC,EAAkB,YAAAC,CAAY,IAAwB,CAC9F,KAAM,CAAE,QAAAC,EAAS,aAAAC,CAAa,KAAI,wBAAqB,EAEjDC,KAAkB,oBAAiB,aAAa,GAAK,CAAC,EAE5D,SACE,QAAC,OAAI,GAAG,eAAe,UAAU,uEAC/B,oBAAC,aACC,oBAAC,OAAI,UAAU,4GACb,qBAAC,OAAI,UAAU,oDACb,oBAAC,WAAQ,GAAG,KAAK,KAAM,EAAG,UAAU,yBAAyB,KAAMF,GAAS,MAAO,KACnF,OAAC,OAAI,UAAU,8BACb,mBAAC,EAAAG,QAAA,CACC,KAAMD,EACN,UAAU,GACV,aAAcD,EACd,kBAAmBJ,EACrB,EACF,GACF,KACA,OAAC,OAAI,UAAU,kCACZ,SAAAE,MAAe,OAAC,kBAAe,iBAAkBD,EAAkB,EACtE,GACF,EACF,KACA,QAAC,aAAU,UAAU,4BACnB,oBAAC,OAAI,UAAU,iDAAiD,KAChE,OAAC,EAAAK,QAAA,CAAa,KAAMD,EAAiB,aAAcD,EAAc,kBAAmBJ,EAAmB,GACzG,GACF,CAEJ,EAEA,IAAOV,KAAQ,cAAWS,CAAW",
6
6
  "names": ["PurchaseBar_exports", "__export", "PurchaseBar_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import__", "import_BizProductProvider", "import_useComponentData", "import_ScrollSpyNav", "import_Styles", "PurchaseBar", "onSpyNavItemClick", "totalSavingsSlot", "actionsSlot", "product", "renderRating", "PurchaseBarData", "ScrollSpyNav"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var b=(e,o)=>{for(var i in o)n(e,i,{get:o[i],enumerable:!0})},h=(e,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let l of p(o))!c.call(e,l)&&l!==i&&n(e,l,{get:()=>o[l],enumerable:!(r=u(o,l))||r.enumerable});return e};var v=e=>h(n({},"__esModule",{value:!0}),e);var g={};b(g,{VideoModal:()=>d});module.exports=v(g);var t=require("react/jsx-runtime"),a=require("../../components/dialog.js"),s=require("../VideoModal/YouTubePlayer.js");const d=e=>{const{visible:o,youTubeId:i,videoUrl:r,onCloseModal:l,className:m,...w}=e;return(0,t.jsx)(a.Dialog,{open:o,onOpenChange:()=>l(),children:(0,t.jsxs)(a.DialogContent,{className:"max-h-3/4 h-3/4 w-4/5 max-w-[1200px] border-none bg-transparent p-0 [&_button]:hidden",children:[i?(0,t.jsx)(s.YouTubePlayer,{youTubeId:i}):r?(0,t.jsx)("video",{className:"size-full overflow-hidden rounded-2xl object-cover",src:r,muted:!0,loop:!0,autoPlay:!0,controls:!0}):null,(0,t.jsx)("div",{onClick:()=>l(),className:"tablet:size-8 tablet:-right-8 tablet:-top-8 absolute -right-6 -top-6 size-6 cursor-pointer overflow-hidden text-white",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon",className:"HomeCharger_closeWrap__Z7aBo",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})]})})};
1
+ "use strict";var r=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var b=(e,o)=>{for(var l in o)r(e,l,{get:o[l],enumerable:!0})},h=(e,o,l,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of p(o))!c.call(e,i)&&i!==l&&r(e,i,{get:()=>o[i],enumerable:!(n=u(o,i))||n.enumerable});return e};var g=e=>h(r({},"__esModule",{value:!0}),e);var m={};b(m,{VideoModal:()=>d});module.exports=g(m);var t=require("react/jsx-runtime"),a=require("../../components/dialog.js"),s=require("../VideoModal/YouTubePlayer.js");const d=e=>{const{visible:o,youTubeId:l,videoUrl:n,onCloseModal:i,className:v,...w}=e;return(0,t.jsx)(a.Dialog,{open:o,onOpenChange:()=>i(),children:(0,t.jsxs)(a.DialogContent,{className:"max-h-3/4 h-3/4 w-4/5 max-w-[1200px] border-none bg-transparent p-0 [&_button]:hidden",children:[l?(0,t.jsx)(s.YouTubePlayer,{youTubeId:l}):n?(0,t.jsx)("video",{className:"size-full overflow-hidden rounded-2xl object-contain",src:n,muted:!0,loop:!0,autoPlay:!0,controls:!0}):null,(0,t.jsx)("div",{onClick:()=>i(),className:"tablet:size-8 tablet:-right-8 tablet:-top-8 absolute -right-6 -top-6 size-6 cursor-pointer overflow-hidden text-white",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon",className:"HomeCharger_closeWrap__Z7aBo",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})]})})};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/VideoModal/index.tsx"],
4
- "sourcesContent": ["import { Dialog, DialogContent } from '../../components/dialog.js'\nimport { YouTubePlayer } from '../VideoModal/YouTubePlayer.js'\n\nexport interface VideoModalType extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n visible: boolean\n youTubeId?: string\n videoUrl?: string\n onCloseModal: () => void\n}\n\nconst VideoModal = (props: VideoModalType) => {\n const { visible, youTubeId, videoUrl, onCloseModal, className, ...rest } = props\n\n return (\n <Dialog open={visible} onOpenChange={() => onCloseModal()}>\n <DialogContent className=\"max-h-3/4 h-3/4 w-4/5 max-w-[1200px] border-none bg-transparent p-0 [&_button]:hidden\">\n {youTubeId ? (\n <YouTubePlayer youTubeId={youTubeId} />\n ) : videoUrl ? (\n <video\n className=\"size-full overflow-hidden rounded-2xl object-cover\"\n src={videoUrl}\n muted\n loop\n autoPlay\n controls\n />\n ) : null}\n <div\n onClick={() => onCloseModal()}\n className=\"tablet:size-8 tablet:-right-8 tablet:-top-8 absolute -right-6 -top-6 size-6 cursor-pointer overflow-hidden text-white\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\"\n className=\"HomeCharger_closeWrap__Z7aBo\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18 18 6M6 6l12 12\"></path>\n </svg>\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n\nexport { VideoModal }\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAeM,IAAAI,EAAA,6BAfNC,EAAsC,sCACtCC,EAA8B,0CAS9B,MAAMJ,EAAcK,GAA0B,CAC5C,KAAM,CAAE,QAAAC,EAAS,UAAAC,EAAW,SAAAC,EAAU,aAAAC,EAAc,UAAAC,EAAW,GAAGC,CAAK,EAAIN,EAE3E,SACE,OAAC,UAAO,KAAMC,EAAS,aAAc,IAAMG,EAAa,EACtD,oBAAC,iBAAc,UAAU,wFACtB,UAAAF,KACC,OAAC,iBAAc,UAAWA,EAAW,EACnCC,KACF,OAAC,SACC,UAAU,qDACV,IAAKA,EACL,MAAK,GACL,KAAI,GACJ,SAAQ,GACR,SAAQ,GACV,EACE,QACJ,OAAC,OACC,QAAS,IAAMC,EAAa,EAC5B,UAAU,wHAEV,mBAAC,OACC,MAAM,6BACN,KAAK,OACL,QAAQ,YACR,YAAY,MACZ,OAAO,eACP,cAAY,OACZ,YAAU,OACV,UAAU,+BAEV,mBAAC,QAAK,cAAc,QAAQ,eAAe,QAAQ,EAAE,uBAAuB,EAC9E,EACF,GACF,EACF,CAEJ",
4
+ "sourcesContent": ["import { Dialog, DialogContent } from '../../components/dialog.js'\nimport { YouTubePlayer } from '../VideoModal/YouTubePlayer.js'\n\nexport interface VideoModalType extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {\n visible: boolean\n youTubeId?: string\n videoUrl?: string\n onCloseModal: () => void\n}\n\nconst VideoModal = (props: VideoModalType) => {\n const { visible, youTubeId, videoUrl, onCloseModal, className, ...rest } = props\n\n return (\n <Dialog open={visible} onOpenChange={() => onCloseModal()}>\n <DialogContent className=\"max-h-3/4 h-3/4 w-4/5 max-w-[1200px] border-none bg-transparent p-0 [&_button]:hidden\">\n {youTubeId ? (\n <YouTubePlayer youTubeId={youTubeId} />\n ) : videoUrl ? (\n <video\n className=\"size-full overflow-hidden rounded-2xl object-contain\"\n src={videoUrl}\n muted\n loop\n autoPlay\n controls\n />\n ) : null}\n <div\n onClick={() => onCloseModal()}\n className=\"tablet:size-8 tablet:-right-8 tablet:-top-8 absolute -right-6 -top-6 size-6 cursor-pointer overflow-hidden text-white\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n data-slot=\"icon\"\n className=\"HomeCharger_closeWrap__Z7aBo\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18 18 6M6 6l12 12\"></path>\n </svg>\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n\nexport { VideoModal }\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAeM,IAAAI,EAAA,6BAfNC,EAAsC,sCACtCC,EAA8B,0CAS9B,MAAMJ,EAAcK,GAA0B,CAC5C,KAAM,CAAE,QAAAC,EAAS,UAAAC,EAAW,SAAAC,EAAU,aAAAC,EAAc,UAAAC,EAAW,GAAGC,CAAK,EAAIN,EAE3E,SACE,OAAC,UAAO,KAAMC,EAAS,aAAc,IAAMG,EAAa,EACtD,oBAAC,iBAAc,UAAU,wFACtB,UAAAF,KACC,OAAC,iBAAc,UAAWA,EAAW,EACnCC,KACF,OAAC,SACC,UAAU,uDACV,IAAKA,EACL,MAAK,GACL,KAAI,GACJ,SAAQ,GACR,SAAQ,GACV,EACE,QACJ,OAAC,OACC,QAAS,IAAMC,EAAa,EAC5B,UAAU,wHAEV,mBAAC,OACC,MAAM,6BACN,KAAK,OACL,QAAQ,YACR,YAAY,MACZ,OAAO,eACP,cAAY,OACZ,YAAU,OACV,UAAU,+BAEV,mBAAC,QAAK,cAAc,QAAQ,eAAe,QAAQ,EAAE,uBAAuB,EAC9E,EACF,GACF,EACF,CAEJ",
6
6
  "names": ["VideoModal_exports", "__export", "VideoModal", "__toCommonJS", "import_jsx_runtime", "import_dialog", "import_YouTubePlayer", "props", "visible", "youTubeId", "videoUrl", "onCloseModal", "className", "rest"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import*as n from"react";import{cn as r}from"../../helpers/index.js";import x from"../../components/picture.js";import{Text as l}from"../../components/text.js";const o=n.forwardRef(({gift:e,onClick:s,className:p,giftType:a},d)=>t("div",{ref:d,className:r("bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all",a===2?"border-brand-0 bg-container-secondary-0 cursor-default":`cursor-pointer hover:shadow-sm ${e.selected?"border-brand-0 bg-container-secondary-0":"border-lines bg-secondary-0"}`,p),onClick:()=>{a===1&&s?.(e)},children:i("div",{className:"flex size-full flex-col",children:[t("div",{className:"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end",children:e.tag&&t("div",{className:"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold text-white",children:e.tag})}),i("div",{className:r("laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2"),children:[t("div",{className:r("size-14 shrink-0","tablet:size-12"),children:t(x,{source:e.image,alt:e.name,className:"size-full rounded object-cover"})}),i("div",{className:"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1",children:[t(l,{size:2,html:e.name,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1")}),i("div",{className:"mt-auto flex items-center justify-between gap-2",children:[i("div",{className:"flex items-center gap-2",children:[t(l,{size:2,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px]"),children:e.currentPrice}),e.originalPrice&&e.originalPrice!==e.currentPrice&&t(l,{size:2,className:r("text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through"),children:e.originalPrice})]}),e.quantity>=1&&i(l,{size:4,className:r("text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]"),children:["x",e.quantity]})]})]})]})]})}));o.displayName="FreeGiftItem";var u=o;export{u as default};
1
+ "use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import*as n from"react";import{cn as r}from"../../helpers/index.js";import x from"../../components/picture.js";import{Text as l}from"../../components/text.js";const o=n.forwardRef(({gift:e,onClick:s,className:p,giftType:a},d)=>t("div",{ref:d,className:r("bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all",a===2?"border-brand-0 bg-container-secondary-0 cursor-default":`cursor-pointer hover:shadow-sm ${e.selected?"border-brand-0 bg-container-secondary-0":"border-lines bg-secondary-0"}`,p),onClick:()=>{a===1&&s?.(e)},children:i("div",{className:"flex size-full flex-col",children:[t("div",{className:"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end",children:e.tag&&t("div",{className:"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2] text-white",children:e.tag})}),i("div",{className:r("laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2"),children:[t("div",{className:r("size-14 shrink-0","tablet:size-12"),children:t(x,{source:e.image,alt:e.name,className:"size-full rounded object-cover"})}),i("div",{className:"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1",children:[t(l,{size:2,html:e.name,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1")}),i("div",{className:"mt-auto flex items-center justify-between gap-2",children:[i("div",{className:"flex items-center gap-2",children:[t(l,{size:2,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px]"),children:e.currentPrice}),e.originalPrice&&e.originalPrice!==e.currentPrice&&t(l,{size:2,className:r("text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through"),children:e.originalPrice})]}),e.quantity>=1&&i(l,{size:4,className:r("text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]"),children:["x",e.quantity]})]})]})]})]})}));o.displayName="FreeGiftItem";var u=o;export{u as default};
2
2
  //# sourceMappingURL=FreeGiftItem.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/BuyOneGetOneShelf/FreeGiftItem.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport Picture from '../../components/picture.js'\nimport { Text } from '../../components/text.js'\n\nimport type { FreeGift, FreeGiftWithSelection } from './types.js'\n\nexport interface FreeGiftItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {\n /** \u8D60\u54C1\u6570\u636E\uFF08\u5305\u542B\u9009\u62E9\u72B6\u6001\uFF09 */\n gift: FreeGiftWithSelection\n /** \u70B9\u51FB\u56DE\u8C03 */\n onClick?: (gift: FreeGift) => void\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u5355\u9009\u6A21\u5F0F\uFF0C 2 -> \u5168\u9009\u6A21\u5F0F */\n giftType?: 1 | 2\n}\n\n/**\n * FreeGiftItem - \u514D\u8D39\u8D60\u54C1\u9879\n */\nconst FreeGiftItem = React.forwardRef<HTMLDivElement, FreeGiftItemProps>(\n ({ gift, onClick, className, giftType }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all',\n\n // \u6837\u5F0F\u6839\u636E gift_type \u548C\u9009\u62E9\u72B6\u6001\u53D8\u5316\n giftType === 2\n ? 'border-brand-0 bg-container-secondary-0 cursor-default' // \u5168\u9009\u6A21\u5F0F\uFF1A\u59CB\u7EC8\u9009\u4E2D\uFF0C\u4E0D\u53EF\u70B9\u51FB\n : `cursor-pointer hover:shadow-sm ${gift.selected ? 'border-brand-0 bg-container-secondary-0' : 'border-lines bg-secondary-0'}`, // \u5355\u9009\u6A21\u5F0F\uFF1A\u53EF\u70B9\u51FB\uFF0C\u6839\u636E\u9009\u62E9\u72B6\u6001\u53D8\u5316\u8FB9\u6846\n className\n )}\n onClick={() => {\n // \u53EA\u6709\u5355\u9009\u6A21\u5F0F\u624D\u5141\u8BB8\u70B9\u51FB\n if (giftType === 1) {\n onClick?.(gift)\n }\n }}\n >\n <div className=\"flex size-full flex-col\">\n <div className=\"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end\">\n {gift.tag && (\n <div className=\"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold text-white\">\n {gift.tag}\n </div>\n )}\n </div>\n <div className={cn('laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2')}>\n <div className={cn('size-14 shrink-0', 'tablet:size-12')}>\n <Picture source={gift.image} alt={gift.name} className=\"size-full rounded object-cover\" />\n </div>\n <div className=\"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1\">\n <Text\n size={2}\n html={gift.name}\n className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1')}\n />\n <div className=\"mt-auto flex items-center justify-between gap-2\">\n <div className=\"flex items-center gap-2\">\n <Text size={2} className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px]')}>\n {gift.currentPrice}\n </Text>\n {gift.originalPrice && gift.originalPrice !== gift.currentPrice && (\n <Text\n size={2}\n className={cn('text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through')}\n >\n {gift.originalPrice}\n </Text>\n )}\n </div>\n {gift.quantity >= 1 && (\n <Text\n size={4}\n className={cn('text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]')}\n >\n x{gift.quantity}\n </Text>\n )}\n </div>\n </div>\n </div>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,UAAY,GAChBN,EAACI,EAAA,CACC,KAAM,EACN,UAAWF,EAAG,kFAAkF,EACjG,cACGI,EAAK,UACT,GAEJ,GACF,GACF,GACF,EACF,CAGN,EAEAD,EAAa,YAAc,eAE3B,IAAOM,EAAQN",
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport Picture from '../../components/picture.js'\nimport { Text } from '../../components/text.js'\n\nimport type { FreeGift, FreeGiftWithSelection } from './types.js'\n\nexport interface FreeGiftItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {\n /** \u8D60\u54C1\u6570\u636E\uFF08\u5305\u542B\u9009\u62E9\u72B6\u6001\uFF09 */\n gift: FreeGiftWithSelection\n /** \u70B9\u51FB\u56DE\u8C03 */\n onClick?: (gift: FreeGift) => void\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u5355\u9009\u6A21\u5F0F\uFF0C 2 -> \u5168\u9009\u6A21\u5F0F */\n giftType?: 1 | 2\n}\n\n/**\n * FreeGiftItem - \u514D\u8D39\u8D60\u54C1\u9879\n */\nconst FreeGiftItem = React.forwardRef<HTMLDivElement, FreeGiftItemProps>(\n ({ gift, onClick, className, giftType }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all',\n\n // \u6837\u5F0F\u6839\u636E gift_type \u548C\u9009\u62E9\u72B6\u6001\u53D8\u5316\n giftType === 2\n ? 'border-brand-0 bg-container-secondary-0 cursor-default' // \u5168\u9009\u6A21\u5F0F\uFF1A\u59CB\u7EC8\u9009\u4E2D\uFF0C\u4E0D\u53EF\u70B9\u51FB\n : `cursor-pointer hover:shadow-sm ${gift.selected ? 'border-brand-0 bg-container-secondary-0' : 'border-lines bg-secondary-0'}`, // \u5355\u9009\u6A21\u5F0F\uFF1A\u53EF\u70B9\u51FB\uFF0C\u6839\u636E\u9009\u62E9\u72B6\u6001\u53D8\u5316\u8FB9\u6846\n className\n )}\n onClick={() => {\n // \u53EA\u6709\u5355\u9009\u6A21\u5F0F\u624D\u5141\u8BB8\u70B9\u51FB\n if (giftType === 1) {\n onClick?.(gift)\n }\n }}\n >\n <div className=\"flex size-full flex-col\">\n <div className=\"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end\">\n {gift.tag && (\n <div className=\"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2] text-white\">\n {gift.tag}\n </div>\n )}\n </div>\n <div className={cn('laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2')}>\n <div className={cn('size-14 shrink-0', 'tablet:size-12')}>\n <Picture source={gift.image} alt={gift.name} className=\"size-full rounded object-cover\" />\n </div>\n <div className=\"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1\">\n <Text\n size={2}\n html={gift.name}\n className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1')}\n />\n <div className=\"mt-auto flex items-center justify-between gap-2\">\n <div className=\"flex items-center gap-2\">\n <Text size={2} className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px]')}>\n {gift.currentPrice}\n </Text>\n {gift.originalPrice && gift.originalPrice !== gift.currentPrice && (\n <Text\n size={2}\n className={cn('text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through')}\n >\n {gift.originalPrice}\n </Text>\n )}\n </div>\n {gift.quantity >= 1 && (\n <Text\n size={4}\n className={cn('text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]')}\n >\n x{gift.quantity}\n </Text>\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n }\n)\n\nFreeGiftItem.displayName = 'FreeGiftItem'\n\nexport default FreeGiftItem\n"],
5
+ "mappings": "aA6Cc,cAAAA,EAgBE,QAAAC,MAhBF,oBA3Cd,UAAY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B,IAAOM,EAAQN",
6
6
  "names": ["jsx", "jsxs", "React", "cn", "Picture", "Text", "FreeGiftItem", "gift", "onClick", "className", "giftType", "ref", "FreeGiftItem_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as a,jsxs as C}from"react/jsx-runtime";import*as n from"react";import{cn as b}from"../../helpers/index.js";import B from"./ProductImage.js";import E from"./ProductInfo.js";import H from"./GiftSelection.js";import W from"./PriceAndActions.js";const k=n.forwardRef(({productData:r,gifts:t=[],giftType:i=1,selectedGiftSku:w,sceneImages:v,tags:F,layout:f="horizontal",className:g,onProductClick:m,onProductImageClick:p,onLearnMore:N,onShopNow:y,onGiftClick:G,onGiftSelectionChange:L,classNames:M,...I},O)=>{const[T,h]=n.useState(!1),[z,S]=n.useState(!1),[P,c]=n.useState(()=>!t||t.length===0?[]:i===2?t.map(e=>e.id):[t[0].id]),d=n.useMemo(()=>t?t.map(e=>({...e,selected:P.includes(e.id)})):[],[t,P]);n.useEffect(()=>{if(!t||t.length===0){c([]);return}c(i===2?t.map(e=>e.id):e=>{const o=e[0];return o&&t.some(u=>u.id===o)?[o]:[t[0].id]})},[t,i]);const s=n.useMemo(()=>({...r,gifts:t,gift_type:i}),[r,t,i]),R=e=>{if(i===2){const o=d.filter(l=>l.selected);G?.(e,o);return}c(()=>{const o=[e.id],l=t?.filter(u=>o.includes(u.id))||[];return G?.(e,l),L?.(l,s),o})},x=()=>{(p??m)?.(s)},j=async()=>{const e=d.filter(o=>o.selected);h(!0);try{await N?.(s,e)}finally{h(!1)}},A=async()=>{const e=d.filter(o=>o.selected);S(!0);try{await y?.(s,e)}finally{S(!1)}};return C("div",{ref:O,className:b("bg-container-primary rounded-box flex items-stretch overflow-hidden",f==="horizontal"?["laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-1 flex-col"]:["flex-0 tablet:flex-1 tablet:flex-nowrap flex-wrap","flex-col justify-between","min-h-[610px] "],p??m?"cursor-pointer":"",g),...I,children:[a(B,{images:v,name:r.name,layout:f,tags:r.tags||F,onClick:x}),a("div",{className:b("bg-container-primary desktop:p-6 flex flex-col justify-between p-4",f==="horizontal"?["rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none","laptop:basis-[39.1%]","desktop:basis-[42.1%]","lg-desktop:basis-[42.1%]","shrink-0"]:["rounded-b-box","w-full","grow"]),children:C("div",{className:"flex flex-1 flex-col justify-between gap-6",children:[a(E,{name:r.name,onClick:x,description:r.description,classNames:M}),a(H,{freeGiftLabel:r.freeGiftLabel,freeGifts:d,onGiftClick:R,giftType:i,selectedGiftSku:w}),a(W,{currentPrice:r.currentPrice??"",originalPrice:r.originalPrice,learnMoreText:r.learnMoreText,shopNowText:r.shopNowText,onLearnMore:j,onShopNow:A,availableForSale:r.availableForSale,learnMoreLoading:T,shopNowLoading:z,trackingTitle:r.name,trackingDescription:r.description,trackingSku:r.sku})]})})]})});k.displayName="BuyOneGetOneShelf.ProductCard";var K=k;export{K as default};
1
+ "use client";import{jsx as a,jsxs as C}from"react/jsx-runtime";import*as n from"react";import{cn as k}from"../../helpers/index.js";import B from"./ProductImage.js";import E from"./ProductInfo.js";import H from"./GiftSelection.js";import W from"./PriceAndActions.js";const x=n.forwardRef(({productData:r,gifts:t=[],giftType:i=1,selectedGiftSku:w,sceneImages:v,tags:F,layout:f="horizontal",className:g,onProductClick:m,onProductImageClick:p,onLearnMore:N,onShopNow:y,onGiftClick:G,onGiftSelectionChange:L,classNames:M,...I},O)=>{const[T,h]=n.useState(!1),[z,S]=n.useState(!1),[P,c]=n.useState(()=>!t||t.length===0?[]:i===2?t.map(e=>e.id):[t[0].id]),d=n.useMemo(()=>t?t.map(e=>({...e,selected:P.includes(e.id)})):[],[t,P]);n.useEffect(()=>{if(!t||t.length===0){c([]);return}c(i===2?t.map(e=>e.id):e=>{const o=e[0];return o&&t.some(u=>u.id===o)?[o]:[t[0].id]})},[t,i]);const s=n.useMemo(()=>({...r,gifts:t,gift_type:i}),[r,t,i]),R=e=>{if(i===2){const o=d.filter(l=>l.selected);G?.(e,o);return}c(()=>{const o=[e.id],l=t?.filter(u=>o.includes(u.id))||[];return G?.(e,l),L?.(l,s),o})},b=()=>{(p??m)?.(s)},j=async()=>{const e=d.filter(o=>o.selected);h(!0);try{await N?.(s,e)}finally{h(!1)}},A=async()=>{const e=d.filter(o=>o.selected);S(!0);try{await y?.(s,e)}finally{S(!1)}};return C("div",{ref:O,className:k("bg-container-primary rounded-box flex items-stretch overflow-hidden",f==="horizontal"?["laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col","laptop:col-span-2"]:["flex-col justify-between"],p??m?"cursor-pointer":"",g),...I,children:[a(B,{images:v,name:r.name,layout:f,tags:r.tags||F,onClick:b}),a("div",{className:k("bg-container-primary desktop:p-6 flex flex-col justify-between p-4",f==="horizontal"?["rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none","laptop:basis-[39.1%]","desktop:basis-[42.1%]","lg-desktop:basis-[42.1%]","shrink-0"]:["rounded-b-box","w-full","grow"]),children:C("div",{className:"flex flex-1 flex-col justify-between gap-6",children:[a(E,{name:r.name,onClick:b,description:r.description,classNames:M}),a(H,{freeGiftLabel:r.freeGiftLabel,freeGifts:d,onGiftClick:R,giftType:i,selectedGiftSku:w}),a(W,{currentPrice:r.currentPrice??"",originalPrice:r.originalPrice,learnMoreText:r.learnMoreText,shopNowText:r.shopNowText,onLearnMore:j,onShopNow:A,availableForSale:r.availableForSale,learnMoreLoading:T,shopNowLoading:z,trackingTitle:r.name,trackingDescription:r.description,trackingSku:r.sku})]})})]})});x.displayName="BuyOneGetOneShelf.ProductCard";var K=x;export{K as default};
2
2
  //# sourceMappingURL=ProductCard.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/BuyOneGetOneShelf/ProductCard.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductImage from './ProductImage.js'\nimport ProductInfo from './ProductInfo.js'\nimport GiftSelection from './GiftSelection.js'\nimport PriceAndActions from './PriceAndActions.js'\nimport type {\n FreeGift,\n FreeGiftWithSelection,\n ProductCardData,\n PureProductData,\n ProductTag,\n BuyOneGetOneShelfProductCardSemanticName,\n} from './types.js'\n\nexport interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4EA7\u54C1\u6570\u636E\uFF08\u4E0D\u5305\u542B\u8D60\u54C1\u4FE1\u606F\uFF09 */\n productData: PureProductData\n /** \u8D60\u54C1\u5217\u8868 */\n gifts?: FreeGift[]\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u8D60\u9001\u5176\u4E2D\u4E00\u4E2A\u8D60\u54C1\uFF0C 2 -> \u8D60\u9001\u6240\u6709\u8D60\u54C1 */\n giftType?: 1 | 2\n /** \u573A\u666F\u56FE\u7247 */\n sceneImages: any\n /** \u4EA7\u54C1\u6807\u7B7E */\n tags?: ProductTag[]\n /** \u5F53\u524D\u9009\u4E2D\u7684\u8D60\u54C1SKU\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n selectedGiftSku?: string\n /** \u5E03\u5C40\u6A21\u5F0F */\n layout?: 'horizontal' | 'vertical'\n classNames?: Partial<Record<BuyOneGetOneShelfProductCardSemanticName, string>>\n /** @deprecated Use `onProductImageClick` instead. */\n onProductClick?: (product: ProductCardData) => void\n /** \u4EA7\u54C1\u56FE\u7247\u70B9\u51FB\u56DE\u8C03 */\n onProductImageClick?: (product: ProductCardData) => void\n /** Learn More \u70B9\u51FB\u56DE\u8C03 */\n onLearnMore?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** Shop Now \u70B9\u51FB\u56DE\u8C03 */\n onShopNow?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u70B9\u51FB\u56DE\u8C03 */\n onGiftClick?: (gift: FreeGift, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u9009\u62E9\u53D8\u5316\u56DE\u8C03 */\n onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void\n /** \u9009\u4E2D\u8D60\u54C1SKU\u53D8\u5316\u56DE\u8C03\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n onSelectedGiftSkuChange?: (selectedSku: string | null) => void\n}\n\n/**\n * ProductCard - \u4E70\u8D60\u8D27\u67B6\u4EA7\u54C1\u5361\u7247\n *\n * @description \u7528\u4E8E\u4E70\u4E00\u8D60\u4E00\u6D3B\u52A8\u7684\u4EA7\u54C1\u5C55\u793A\u5361\u7247\uFF0C\u5DE6\u4FA7\u5C55\u793A\u4EA7\u54C1\u56FE\u7247\u548C\u6807\u7B7E\uFF0C\u53F3\u4FA7\u5C55\u793A\u4EA7\u54C1\u4FE1\u606F\u3001\u8D60\u54C1\u548C\u8D2D\u4E70\u6309\u94AE\n */\nconst ProductCard = React.forwardRef<HTMLDivElement, ProductCardProps>(\n (\n {\n productData,\n gifts = [],\n giftType = 1,\n selectedGiftSku,\n sceneImages,\n tags,\n layout = 'horizontal',\n className,\n onProductClick,\n onProductImageClick,\n onLearnMore,\n onShopNow,\n onGiftClick,\n onGiftSelectionChange,\n classNames,\n ...props\n },\n ref\n ) => {\n const [learnMoreLoading, setLearnMoreLoading] = React.useState(false)\n const [shopNowLoading, setShopNowLoading] = React.useState(false)\n\n // \u5185\u90E8\u72B6\u6001\u7BA1\u7406\u8D60\u54C1\u7684\u9009\u62E9\u72B6\u6001 - \u4F7F\u7528\u9009\u4E2D\u7684ID\u6570\u7EC4\u800C\u4E0D\u662F\u4FEE\u6539gift\u5BF9\u8C61\n const [selectedGiftIds, setSelectedGiftIds] = React.useState<string[]>(() => {\n if (!gifts || gifts.length === 0) return []\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n return gifts.map((gift: FreeGift) => gift.id)\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u8D60\u54C1\n return [gifts[0].id]\n }\n })\n\n // \u751F\u6210\u5E26\u6709\u9009\u62E9\u72B6\u6001\u7684\u8D60\u54C1\u5217\u8868\u7528\u4E8E\u6E32\u67D3\n const giftsWithSelection = React.useMemo(() => {\n if (!gifts) return []\n\n return gifts.map((gift: FreeGift) => ({\n ...gift,\n selected: selectedGiftIds.includes(gift.id),\n }))\n }, [gifts, selectedGiftIds])\n\n // \u5F53 gifts \u6216 giftType \u66F4\u65B0\u65F6\uFF0C\u540C\u6B65\u66F4\u65B0\u5185\u90E8\u72B6\u6001\n React.useEffect(() => {\n if (!gifts || gifts.length === 0) {\n setSelectedGiftIds([])\n return\n }\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n setSelectedGiftIds(gifts.map((gift: FreeGift) => gift.id))\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u667A\u80FD\u72B6\u6001\u7BA1\u7406\n setSelectedGiftIds(prevSelectedIds => {\n // \u68C0\u67E5\u5F53\u524D\u9009\u4E2D\u7684\u793C\u54C1\u662F\u5426\u4ECD\u7136\u5B58\u5728\u4E8E\u65B0\u7684 gifts \u5217\u8868\u4E2D\n const currentSelectedId = prevSelectedIds[0]\n const isCurrentSelectionValid =\n currentSelectedId && gifts.some((gift: FreeGift) => gift.id === currentSelectedId)\n\n // \u5982\u679C\u5F53\u524D\u9009\u4E2D\u72B6\u6001\u4ECD\u7136\u6709\u6548\uFF0C\u4FDD\u6301\u4E0D\u53D8\uFF1B\u5426\u5219\u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\n return isCurrentSelectionValid ? [currentSelectedId] : [gifts[0].id]\n })\n }\n }, [gifts, giftType])\n\n // \u6784\u9020\u5B8C\u6574\u7684\u4EA7\u54C1\u6570\u636E\u7528\u4E8E\u56DE\u8C03\n const fullProductData: ProductCardData = React.useMemo(\n () => ({\n ...productData,\n gifts,\n gift_type: giftType,\n }),\n [productData, gifts, giftType]\n )\n\n const handleGiftClick = (gift: FreeGift) => {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u4E0D\u5141\u8BB8\u53D6\u6D88\u9009\u62E9\uFF0C\u76F4\u63A5\u8FD4\u56DE\n if (giftType === 2) {\n // \u83B7\u53D6\u5F53\u524D\u6240\u6709\u9009\u4E2D\u7684gifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\n const currentSelectedGifts = giftsWithSelection.filter((g: FreeGiftWithSelection) => g.selected)\n onGiftClick?.(gift, currentSelectedGifts)\n return\n }\n\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F)\n setSelectedGiftIds(() => {\n const newSelectedIds = [gift.id] // \u5355\u9009\uFF1A\u59CB\u7EC8\u9009\u4E2D\u5F53\u524D\u9879\uFF0C\u70B9\u51FB\u5DF2\u9009\u4E2D\u9879\u4FDD\u6301\u72B6\u6001\uFF0C\u70B9\u51FB\u672A\u9009\u4E2D\u9879\u5207\u6362\u5230\u8BE5\u9879\n\n // \u8BA1\u7B97\u65B0\u7684\u9009\u4E2Dgifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\u4F20\u9012\u7ED9\u56DE\u8C03\n const newSelectedGifts = gifts?.filter((g: FreeGift) => newSelectedIds.includes(g.id)) || []\n\n // \u8C03\u7528\u56DE\u8C03\u51FD\u6570\uFF0C\u7B2C\u4E8C\u4E2A\u53C2\u6570\u662F\u5F53\u524D\u9009\u4E2D\u7684gifts\n onGiftClick?.(gift, newSelectedGifts)\n onGiftSelectionChange?.(newSelectedGifts, fullProductData)\n\n return newSelectedIds\n })\n }\n\n const handleProductImageClick = () => {\n const callback = onProductImageClick ?? onProductClick\n callback?.(fullProductData)\n }\n\n const handleLearnMoreClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setLearnMoreLoading(true)\n try {\n await onLearnMore?.(fullProductData, selectedGifts)\n } finally {\n setLearnMoreLoading(false)\n }\n }\n\n const handleShopNowClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setShopNowLoading(true)\n try {\n await onShopNow?.(fullProductData, selectedGifts)\n } finally {\n setShopNowLoading(false)\n }\n }\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary rounded-box flex items-stretch overflow-hidden',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5BB9\u5668\n layout === 'horizontal'\n ? [\n // \u6C34\u5E73\u5E03\u5C40\uFF1Aflex-row\uFF0C\u5360\u6EE1\u6574\u884C\n 'laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-1 flex-col', // 964px + 700px\n ]\n : [\n // \u5782\u76F4\u5E03\u5C40\uFF1Aflex-col\uFF0C\u9002\u5408\u4E00\u884C\u4E24\u4E2A\n 'flex-0 tablet:flex-1 tablet:flex-nowrap flex-wrap',\n 'flex-col justify-between',\n 'min-h-[610px] ',\n ],\n (onProductImageClick ?? onProductClick) ? 'cursor-pointer' : '',\n className\n )}\n {...props}\n >\n {/* \u4EA7\u54C1\u56FE\u7247\u533A\u57DF */}\n <ProductImage\n images={sceneImages}\n name={productData.name}\n layout={layout}\n tags={productData.tags || tags}\n onClick={handleProductImageClick}\n />\n\n {/* \u4EA7\u54C1\u4FE1\u606F\u533A\u57DF */}\n <div\n className={cn(\n 'bg-container-primary desktop:p-6 flex flex-col justify-between p-4',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5706\u89D2\u548C\u5C3A\u5BF8\n layout === 'horizontal'\n ? [\n 'rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none',\n // \u4F7F\u7528 flex-basis \u8BBE\u7F6E\u5BBD\u5EA6\u6BD4\u4F8B\n 'laptop:basis-[39.1%]', // 360px / 921px \u2248 39.1%\n 'desktop:basis-[42.1%]', // 552px / 1312px \u2248 42.1%\n 'lg-desktop:basis-[42.1%]', // 700px / 1664px \u2248 42.1%\n 'shrink-0',\n ]\n : ['rounded-b-box', 'w-full', 'grow']\n )}\n >\n <div className=\"flex flex-1 flex-col justify-between gap-6\">\n {/* \u4EA7\u54C1\u6807\u9898\u548C\u63CF\u8FF0 */}\n <ProductInfo\n name={productData.name}\n onClick={handleProductImageClick}\n description={productData.description}\n classNames={classNames}\n />\n\n {/* \u514D\u8D39\u8D60\u54C1\u533A\u57DF */}\n <GiftSelection\n freeGiftLabel={productData.freeGiftLabel}\n freeGifts={giftsWithSelection}\n onGiftClick={handleGiftClick}\n giftType={giftType}\n selectedGiftSku={selectedGiftSku}\n />\n <PriceAndActions\n currentPrice={productData.currentPrice ?? ''}\n originalPrice={productData.originalPrice}\n learnMoreText={productData.learnMoreText}\n shopNowText={productData.shopNowText}\n onLearnMore={handleLearnMoreClick}\n onShopNow={handleShopNowClick}\n availableForSale={productData.availableForSale}\n learnMoreLoading={learnMoreLoading}\n shopNowLoading={shopNowLoading}\n trackingTitle={productData.name}\n trackingDescription={productData.description}\n trackingSku={productData.sku}\n />\n </div>\n </div>\n </div>\n )\n }\n)\n\nProductCard.displayName = 'BuyOneGetOneShelf.ProductCard'\n\nexport default ProductCard\n"],
5
- "mappings": "aAgNQ,cAAAA,EAyBE,QAAAC,MAzBF,oBA9MR,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAkB,oBACzB,OAAOC,MAAiB,mBACxB,OAAOC,MAAmB,qBAC1B,OAAOC,MAAqB,uBA+C5B,MAAMC,EAAcN,EAAM,WACxB,CACE,CACE,YAAAO,EACA,MAAAC,EAAQ,CAAC,EACT,SAAAC,EAAW,EACX,gBAAAC,EACA,YAAAC,EACA,KAAAC,EACA,OAAAC,EAA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AASiC,EACT,YAAajC,EAAY,YACzB,WAAYc,EACd,EAGAvB,EAACM,EAAA,CACC,cAAeG,EAAY,cAC3B,UAAWwB,EACX,YAAaI,EACb,SAAU1B,EACV,gBAAiBC,EACnB,EACAZ,EAACO,EAAA,CACC,aAAcE,EAAY,cAAgB,GAC1C,cAAeA,EAAY,cAC3B,cAAeA,EAAY,cAC3B,YAAaA,EAAY,YACzB,YAAakC,EACb,UAAWE,EACX,iBAAkBpC,EAAY,iBAC9B,iBAAkBiB,EAClB,eAAgBE,EAChB,cAAenB,EAAY,KAC3B,oBAAqBA,EAAY,YACjC,YAAaA,EAAY,IAC3B,GACF,EACF,GACF,CAEJ,CACF,EAEAD,EAAY,YAAc,gCAE1B,IAAOsC,EAAQtC",
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductImage from './ProductImage.js'\nimport ProductInfo from './ProductInfo.js'\nimport GiftSelection from './GiftSelection.js'\nimport PriceAndActions from './PriceAndActions.js'\nimport type {\n FreeGift,\n FreeGiftWithSelection,\n ProductCardData,\n PureProductData,\n ProductTag,\n BuyOneGetOneShelfProductCardSemanticName,\n} from './types.js'\n\nexport interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4EA7\u54C1\u6570\u636E\uFF08\u4E0D\u5305\u542B\u8D60\u54C1\u4FE1\u606F\uFF09 */\n productData: PureProductData\n /** \u8D60\u54C1\u5217\u8868 */\n gifts?: FreeGift[]\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u8D60\u9001\u5176\u4E2D\u4E00\u4E2A\u8D60\u54C1\uFF0C 2 -> \u8D60\u9001\u6240\u6709\u8D60\u54C1 */\n giftType?: 1 | 2\n /** \u573A\u666F\u56FE\u7247 */\n sceneImages: any\n /** \u4EA7\u54C1\u6807\u7B7E */\n tags?: ProductTag[]\n /** \u5F53\u524D\u9009\u4E2D\u7684\u8D60\u54C1SKU\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n selectedGiftSku?: string\n /** \u5E03\u5C40\u6A21\u5F0F */\n layout?: 'horizontal' | 'vertical'\n classNames?: Partial<Record<BuyOneGetOneShelfProductCardSemanticName, string>>\n /** @deprecated Use `onProductImageClick` instead. */\n onProductClick?: (product: ProductCardData) => void\n /** \u4EA7\u54C1\u56FE\u7247\u70B9\u51FB\u56DE\u8C03 */\n onProductImageClick?: (product: ProductCardData) => void\n /** Learn More \u70B9\u51FB\u56DE\u8C03 */\n onLearnMore?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** Shop Now \u70B9\u51FB\u56DE\u8C03 */\n onShopNow?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u70B9\u51FB\u56DE\u8C03 */\n onGiftClick?: (gift: FreeGift, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u9009\u62E9\u53D8\u5316\u56DE\u8C03 */\n onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void\n /** \u9009\u4E2D\u8D60\u54C1SKU\u53D8\u5316\u56DE\u8C03\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n onSelectedGiftSkuChange?: (selectedSku: string | null) => void\n}\n\n/**\n * ProductCard - \u4E70\u8D60\u8D27\u67B6\u4EA7\u54C1\u5361\u7247\n *\n * @description \u7528\u4E8E\u4E70\u4E00\u8D60\u4E00\u6D3B\u52A8\u7684\u4EA7\u54C1\u5C55\u793A\u5361\u7247\uFF0C\u5DE6\u4FA7\u5C55\u793A\u4EA7\u54C1\u56FE\u7247\u548C\u6807\u7B7E\uFF0C\u53F3\u4FA7\u5C55\u793A\u4EA7\u54C1\u4FE1\u606F\u3001\u8D60\u54C1\u548C\u8D2D\u4E70\u6309\u94AE\n */\nconst ProductCard = React.forwardRef<HTMLDivElement, ProductCardProps>(\n (\n {\n productData,\n gifts = [],\n giftType = 1,\n selectedGiftSku,\n sceneImages,\n tags,\n layout = 'horizontal',\n className,\n onProductClick,\n onProductImageClick,\n onLearnMore,\n onShopNow,\n onGiftClick,\n onGiftSelectionChange,\n classNames,\n ...props\n },\n ref\n ) => {\n const [learnMoreLoading, setLearnMoreLoading] = React.useState(false)\n const [shopNowLoading, setShopNowLoading] = React.useState(false)\n\n // \u5185\u90E8\u72B6\u6001\u7BA1\u7406\u8D60\u54C1\u7684\u9009\u62E9\u72B6\u6001 - \u4F7F\u7528\u9009\u4E2D\u7684ID\u6570\u7EC4\u800C\u4E0D\u662F\u4FEE\u6539gift\u5BF9\u8C61\n const [selectedGiftIds, setSelectedGiftIds] = React.useState<string[]>(() => {\n if (!gifts || gifts.length === 0) return []\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n return gifts.map((gift: FreeGift) => gift.id)\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u8D60\u54C1\n return [gifts[0].id]\n }\n })\n\n // \u751F\u6210\u5E26\u6709\u9009\u62E9\u72B6\u6001\u7684\u8D60\u54C1\u5217\u8868\u7528\u4E8E\u6E32\u67D3\n const giftsWithSelection = React.useMemo(() => {\n if (!gifts) return []\n\n return gifts.map((gift: FreeGift) => ({\n ...gift,\n selected: selectedGiftIds.includes(gift.id),\n }))\n }, [gifts, selectedGiftIds])\n\n // \u5F53 gifts \u6216 giftType \u66F4\u65B0\u65F6\uFF0C\u540C\u6B65\u66F4\u65B0\u5185\u90E8\u72B6\u6001\n React.useEffect(() => {\n if (!gifts || gifts.length === 0) {\n setSelectedGiftIds([])\n return\n }\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n setSelectedGiftIds(gifts.map((gift: FreeGift) => gift.id))\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u667A\u80FD\u72B6\u6001\u7BA1\u7406\n setSelectedGiftIds(prevSelectedIds => {\n // \u68C0\u67E5\u5F53\u524D\u9009\u4E2D\u7684\u793C\u54C1\u662F\u5426\u4ECD\u7136\u5B58\u5728\u4E8E\u65B0\u7684 gifts \u5217\u8868\u4E2D\n const currentSelectedId = prevSelectedIds[0]\n const isCurrentSelectionValid =\n currentSelectedId && gifts.some((gift: FreeGift) => gift.id === currentSelectedId)\n\n // \u5982\u679C\u5F53\u524D\u9009\u4E2D\u72B6\u6001\u4ECD\u7136\u6709\u6548\uFF0C\u4FDD\u6301\u4E0D\u53D8\uFF1B\u5426\u5219\u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\n return isCurrentSelectionValid ? [currentSelectedId] : [gifts[0].id]\n })\n }\n }, [gifts, giftType])\n\n // \u6784\u9020\u5B8C\u6574\u7684\u4EA7\u54C1\u6570\u636E\u7528\u4E8E\u56DE\u8C03\n const fullProductData: ProductCardData = React.useMemo(\n () => ({\n ...productData,\n gifts,\n gift_type: giftType,\n }),\n [productData, gifts, giftType]\n )\n\n const handleGiftClick = (gift: FreeGift) => {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u4E0D\u5141\u8BB8\u53D6\u6D88\u9009\u62E9\uFF0C\u76F4\u63A5\u8FD4\u56DE\n if (giftType === 2) {\n // \u83B7\u53D6\u5F53\u524D\u6240\u6709\u9009\u4E2D\u7684gifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\n const currentSelectedGifts = giftsWithSelection.filter((g: FreeGiftWithSelection) => g.selected)\n onGiftClick?.(gift, currentSelectedGifts)\n return\n }\n\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F)\n setSelectedGiftIds(() => {\n const newSelectedIds = [gift.id] // \u5355\u9009\uFF1A\u59CB\u7EC8\u9009\u4E2D\u5F53\u524D\u9879\uFF0C\u70B9\u51FB\u5DF2\u9009\u4E2D\u9879\u4FDD\u6301\u72B6\u6001\uFF0C\u70B9\u51FB\u672A\u9009\u4E2D\u9879\u5207\u6362\u5230\u8BE5\u9879\n\n // \u8BA1\u7B97\u65B0\u7684\u9009\u4E2Dgifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\u4F20\u9012\u7ED9\u56DE\u8C03\n const newSelectedGifts = gifts?.filter((g: FreeGift) => newSelectedIds.includes(g.id)) || []\n\n // \u8C03\u7528\u56DE\u8C03\u51FD\u6570\uFF0C\u7B2C\u4E8C\u4E2A\u53C2\u6570\u662F\u5F53\u524D\u9009\u4E2D\u7684gifts\n onGiftClick?.(gift, newSelectedGifts)\n onGiftSelectionChange?.(newSelectedGifts, fullProductData)\n\n return newSelectedIds\n })\n }\n\n const handleProductImageClick = () => {\n const callback = onProductImageClick ?? onProductClick\n callback?.(fullProductData)\n }\n\n const handleLearnMoreClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setLearnMoreLoading(true)\n try {\n await onLearnMore?.(fullProductData, selectedGifts)\n } finally {\n setLearnMoreLoading(false)\n }\n }\n\n const handleShopNowClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setShopNowLoading(true)\n try {\n await onShopNow?.(fullProductData, selectedGifts)\n } finally {\n setShopNowLoading(false)\n }\n }\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary rounded-box flex items-stretch overflow-hidden',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5BB9\u5668\n layout === 'horizontal'\n ? [\n 'laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col',\n 'laptop:col-span-2',\n ]\n : ['flex-col justify-between'],\n (onProductImageClick ?? onProductClick) ? 'cursor-pointer' : '',\n className\n )}\n {...props}\n >\n {/* \u4EA7\u54C1\u56FE\u7247\u533A\u57DF */}\n <ProductImage\n images={sceneImages}\n name={productData.name}\n layout={layout}\n tags={productData.tags || tags}\n onClick={handleProductImageClick}\n />\n\n {/* \u4EA7\u54C1\u4FE1\u606F\u533A\u57DF */}\n <div\n className={cn(\n 'bg-container-primary desktop:p-6 flex flex-col justify-between p-4',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5706\u89D2\u548C\u5C3A\u5BF8\n layout === 'horizontal'\n ? [\n 'rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none',\n // \u4F7F\u7528 flex-basis \u8BBE\u7F6E\u5BBD\u5EA6\u6BD4\u4F8B\n 'laptop:basis-[39.1%]', // 360px / 921px \u2248 39.1%\n 'desktop:basis-[42.1%]', // 552px / 1312px \u2248 42.1%\n 'lg-desktop:basis-[42.1%]', // 700px / 1664px \u2248 42.1%\n 'shrink-0',\n ]\n : ['rounded-b-box', 'w-full', 'grow']\n )}\n >\n <div className=\"flex flex-1 flex-col justify-between gap-6\">\n {/* \u4EA7\u54C1\u6807\u9898\u548C\u63CF\u8FF0 */}\n <ProductInfo\n name={productData.name}\n onClick={handleProductImageClick}\n description={productData.description}\n classNames={classNames}\n />\n\n {/* \u514D\u8D39\u8D60\u54C1\u533A\u57DF */}\n <GiftSelection\n freeGiftLabel={productData.freeGiftLabel}\n freeGifts={giftsWithSelection}\n onGiftClick={handleGiftClick}\n giftType={giftType}\n selectedGiftSku={selectedGiftSku}\n />\n <PriceAndActions\n currentPrice={productData.currentPrice ?? ''}\n originalPrice={productData.originalPrice}\n learnMoreText={productData.learnMoreText}\n shopNowText={productData.shopNowText}\n onLearnMore={handleLearnMoreClick}\n onShopNow={handleShopNowClick}\n availableForSale={productData.availableForSale}\n learnMoreLoading={learnMoreLoading}\n shopNowLoading={shopNowLoading}\n trackingTitle={productData.name}\n trackingDescription={productData.description}\n trackingSku={productData.sku}\n />\n </div>\n </div>\n </div>\n )\n }\n)\n\nProductCard.displayName = 'BuyOneGetOneShelf.ProductCard'\n\nexport default ProductCard\n"],
5
+ "mappings": "aA2MQ,cAAAA,EAyBE,QAAAC,MAzBF,oBAzMR,UAAYC,M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KAClB,OAAQM,EACR,KAAMN,EAAY,MAAQK,EAC1B,QAAS4B,EACX,EAGA1C,EAAC,OACC,UAAWG,EACT,qEAEAY,IAAW,aACP,CACE,gFAEA,uBACA,wBACA,2BACA,UACF,EACA,CAAC,gBAAiB,SAAU,MAAM,CACxC,EAEA,SAAAd,EAAC,OAAI,UAAU,6CAEb,UAAAD,EAACK,EAAA,CACC,KAAMI,EAAY,KAClB,QAASiC,EACT,YAAajC,EAAY,YACzB,WAAYc,EACd,EAGAvB,EAACM,EAAA,CACC,cAAeG,EAAY,cAC3B,UAAWwB,EACX,YAAaI,EACb,SAAU1B,EACV,gBAAiBC,EACnB,EACAZ,EAACO,EAAA,CACC,aAAcE,EAAY,cAAgB,GAC1C,cAAeA,EAAY,cAC3B,cAAeA,EAAY,cAC3B,YAAaA,EAAY,YACzB,YAAakC,EACb,UAAWE,EACX,iBAAkBpC,EAAY,iBAC9B,iBAAkBiB,EAClB,eAAgBE,EAChB,cAAenB,EAAY,KAC3B,oBAAqBA,EAAY,YACjC,YAAaA,EAAY,IAC3B,GACF,EACF,GACF,CAEJ,CACF,EAEAD,EAAY,YAAc,gCAE1B,IAAOsC,EAAQtC",
6
6
  "names": ["jsx", "jsxs", "React", "cn", "ProductImage", "ProductInfo", "GiftSelection", "PriceAndActions", "ProductCard", "productData", "gifts", "giftType", "selectedGiftSku", "sceneImages", "tags", "layout", "className", "onProductClick", "onProductImageClick", "onLearnMore", "onShopNow", "onGiftClick", "onGiftSelectionChange", "classNames", "props", "ref", "learnMoreLoading", "setLearnMoreLoading", "shopNowLoading", "setShopNowLoading", "selectedGiftIds", "setSelectedGiftIds", "gift", "giftsWithSelection", "prevSelectedIds", "currentSelectedId", "fullProductData", "handleGiftClick", "currentSelectedGifts", "g", "newSelectedIds", "newSelectedGifts", "handleProductImageClick", "handleLearnMoreClick", "selectedGifts", "handleShopNowClick", "ProductCard_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as i,jsxs as B}from"react/jsx-runtime";import*as a from"react";import{cn as e}from"../../helpers/index.js";import c from"./ProductCard.js";import{Heading as d,Text as y}from"../../components/index.js";import{useExposure as O}from"../../hooks/useExposure.js";const h="shelf",S="buy_one_get_one_shelf",f=a.forwardRef(({className:p,classNames:t={},theme:s,title:o,subtitle:n,children:m,...l},u)=>{const r=a.useRef(null);return O(r,{componentType:h,componentName:S,componentTitle:o,componentDescription:n}),a.useImperativeHandle(u,()=>r.current),B("div",{ref:r,className:e("bogo-shelf-root w-full py-0",{"aiui-dark":s==="dark"},p,t?.root),...l,children:[o&&i(d,{as:"h2",html:o,className:e("bogo-shelf-title text-info-primary mb-4",t?.title)}),n&&i(y,{size:3,as:"p",html:n,className:e("bogo-shelf-description text-info-primary mb-6",t?.description)}),i("div",{className:e("flex flex-wrap justify-center gap-6","laptop:justify-start laptop:flex-row"),children:m})]})});f.displayName="BuyOneGetOneShelf.Root";const G={Root:f,ProductCard:c};var R=G;export{R as default};
1
+ "use client";import{jsx as l,jsxs as R}from"react/jsx-runtime";import*as t from"react";import{cn as s}from"../../helpers/index.js";import B from"./ProductCard.js";import{Heading as G,Text as P}from"../../components/index.js";import{useExposure as b}from"../../hooks/useExposure.js";const E="shelf",D="buy_one_get_one_shelf";function h(o){return t.Children.toArray(o).flatMap(e=>t.isValidElement(e)&&e.type===t.Fragment?h(e.props.children):[e])}function k(o){return t.isValidElement(o)?o.props.layout??"horizontal":"horizontal"}function w(o,e){let r=0,i=0;for(let n=0;n<e;n++){const c=k(o[n])==="horizontal"?2:1;c===2&&r>0&&(r=0),r+=c,r===2&&(i=n+1,r=0)}return o.slice(0,i)}const g=t.forwardRef(({className:o,classNames:e={},theme:r,title:i,subtitle:n,children:c,viewMoreThreshold:u=4,viewMoreText:O="View More",viewLessText:x="View Less",...N},C)=>{const d=t.useRef(null),[p,v]=t.useState(!1);b(d,{componentType:E,componentName:D,componentTitle:i,componentDescription:n}),t.useImperativeHandle(C,()=>d.current);const m=h(c),f=m.length>u,S=(f&&!p?w(m,u):m).map(a=>{if(!t.isValidElement(a))return a;const y=a.props;return y.layout==="horizontal"?t.cloneElement(a,{className:s(y.className,"laptop:col-span-2")}):a});return R("div",{ref:d,className:s("bogo-shelf-root w-full py-0",{"aiui-dark":r==="dark"},o,e?.root),...N,children:[i&&l(G,{as:"h2",html:i,className:s("bogo-shelf-title text-info-primary mb-4",e?.title)}),n&&l(P,{size:3,as:"p",html:n,className:s("bogo-shelf-description text-info-primary mb-6",e?.description)}),l("div",{className:s("grid grid-cols-1 gap-6","laptop:grid-cols-2"),children:S}),f&&l("div",{className:"mt-6 flex justify-center",children:R("button",{type:"button",onClick:()=>v(a=>!a),"aria-expanded":p,className:s("hover:text-brand-0 lg-desktop:text-[16px] text-info-primary flex cursor-pointer items-center gap-2 border-none bg-transparent text-[14px] font-bold outline-none transition-colors",e?.viewMoreBtn),children:[p?x:O,l("svg",{className:s("size-4 transition-transform",p&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:l("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})})]})});g.displayName="BuyOneGetOneShelf.Root";const I={Root:g,ProductCard:B};var V=I;export{V as default};
2
2
  //# sourceMappingURL=index.js.map