@anker-in/headless-ui 1.3.50 → 1.3.52

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 (94) hide show
  1. package/dist/cjs/biz-components/ImageTextOverlay/index.js +1 -1
  2. package/dist/cjs/biz-components/ImageTextOverlay/index.js.map +2 -2
  3. package/dist/cjs/biz-components/Listing/BizProductProvider.d.ts +11 -9
  4. package/dist/cjs/biz-components/Listing/BizProductProvider.js +1 -1
  5. package/dist/cjs/biz-components/Listing/BizProductProvider.js.map +3 -3
  6. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
  7. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
  8. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js +1 -1
  9. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js.map +3 -3
  10. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +1 -0
  11. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  12. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
  13. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.d.ts +48 -0
  14. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.js +2 -0
  15. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.js.map +7 -0
  16. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.d.ts +1 -1
  17. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js +1 -1
  18. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js.map +3 -3
  19. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +0 -2
  20. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
  21. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +4 -4
  22. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.d.ts +3 -0
  23. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js +2 -0
  24. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js.map +7 -0
  25. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.d.ts +115 -0
  26. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.js +2 -0
  27. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.js.map +7 -0
  28. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  29. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
  30. package/dist/cjs/biz-components/Listing/components/index.d.ts +0 -1
  31. package/dist/cjs/biz-components/Listing/components/index.js +1 -1
  32. package/dist/cjs/biz-components/Listing/components/index.js.map +3 -3
  33. package/dist/cjs/biz-components/Listing/hooks/useBenefits.d.ts +8 -2
  34. package/dist/cjs/biz-components/Listing/hooks/useBenefits.js +1 -1
  35. package/dist/cjs/biz-components/Listing/hooks/useBenefits.js.map +3 -3
  36. package/dist/cjs/biz-components/Listing/types/product.d.ts +0 -21
  37. package/dist/cjs/biz-components/Listing/types/product.js +1 -1
  38. package/dist/cjs/biz-components/Listing/types/product.js.map +1 -1
  39. package/dist/cjs/biz-components/index.d.ts +3 -3
  40. package/dist/cjs/biz-components/index.js +1 -1
  41. package/dist/cjs/biz-components/index.js.map +3 -3
  42. package/dist/esm/biz-components/ImageTextOverlay/index.js +1 -1
  43. package/dist/esm/biz-components/ImageTextOverlay/index.js.map +2 -2
  44. package/dist/esm/biz-components/Listing/BizProductProvider.d.ts +11 -9
  45. package/dist/esm/biz-components/Listing/BizProductProvider.js +1 -1
  46. package/dist/esm/biz-components/Listing/BizProductProvider.js.map +3 -3
  47. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
  48. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
  49. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js +1 -1
  50. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js.map +3 -3
  51. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +1 -0
  52. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  53. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
  54. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.d.ts +48 -0
  55. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.js +1 -0
  56. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.js.map +7 -0
  57. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.d.ts +1 -1
  58. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js +1 -1
  59. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js.map +3 -3
  60. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +0 -2
  61. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
  62. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +3 -3
  63. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.d.ts +3 -0
  64. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js +2 -0
  65. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js.map +7 -0
  66. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.d.ts +115 -0
  67. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.js +1 -0
  68. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.js.map +7 -0
  69. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  70. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
  71. package/dist/esm/biz-components/Listing/components/index.d.ts +0 -1
  72. package/dist/esm/biz-components/Listing/components/index.js +1 -1
  73. package/dist/esm/biz-components/Listing/components/index.js.map +2 -2
  74. package/dist/esm/biz-components/Listing/hooks/useBenefits.d.ts +8 -2
  75. package/dist/esm/biz-components/Listing/hooks/useBenefits.js +1 -1
  76. package/dist/esm/biz-components/Listing/hooks/useBenefits.js.map +3 -3
  77. package/dist/esm/biz-components/Listing/types/product.d.ts +0 -21
  78. package/dist/esm/biz-components/Listing/types/product.js.map +1 -1
  79. package/dist/esm/biz-components/index.d.ts +3 -3
  80. package/dist/esm/biz-components/index.js +1 -1
  81. package/dist/esm/biz-components/index.js.map +2 -2
  82. package/package.json +1 -1
  83. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.d.ts +0 -2
  84. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js +0 -2
  85. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +0 -7
  86. package/dist/cjs/biz-components/Listing/components/ProductCard/index.d.ts +0 -2
  87. package/dist/cjs/biz-components/Listing/components/ProductCard/index.js +0 -2
  88. package/dist/cjs/biz-components/Listing/components/ProductCard/index.js.map +0 -7
  89. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.d.ts +0 -2
  90. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js +0 -2
  91. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +0 -7
  92. package/dist/esm/biz-components/Listing/components/ProductCard/index.d.ts +0 -2
  93. package/dist/esm/biz-components/Listing/components/ProductCard/index.js +0 -2
  94. package/dist/esm/biz-components/Listing/components/ProductCard/index.js.map +0 -7
@@ -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-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": "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",
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"]
4
+ "sourcesContent": ["import { Text, Picture, Checkbox } from '../../../../../../components/index.js'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { useFollowTooltip, FollowTooltip } from '../../../../hooks/useFollowTooltip.js'\nimport type { BundleOption } from './types.js'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\n\nconst ProductBundle = () => {\n const { bundle, checkedBundle, setCheckedBundle } = useBizProductContext()\n if (!bundle || !bundle?.bundleOptions?.length) return null\n\n const { tooltip, getTooltipProps } = useFollowTooltip()\n\n const handleSelectedChange = (bundleItem: BundleOption) => {\n if (checkedBundle?.ruleId === bundleItem.ruleId) {\n bundle?.onCheckedChange?.(undefined)\n setCheckedBundle?.(undefined)\n } else {\n setCheckedBundle?.(bundleItem)\n bundle?.onCheckedChange?.(bundleItem)\n }\n }\n\n return (\n <div className={cn('ipc-product-detail-bundle', bundle?.className)}>\n <Text className=\"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]\" html={bundle?.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 {bundle?.bundleOptions.map((bundle, index) => (\n <div key={index}>\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?.ruleId === bundle.ruleId,\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?.ruleId === bundle.ruleId,\n })}\n id={bundle.ruleId}\n value={bundle.ruleId}\n checked={checkedBundle?.ruleId === bundle.ruleId}\n />\n <label\n htmlFor={bundle.ruleId}\n className=\"size-full flex items-center cursor-pointer py-4 lg-desktop:py-6\"\n >\n {bundle.bundleVariants.map(variant => (\n <div className=\"flex items-center flex-1 justify-between gap-6\" key={variant.variantId}>\n <div className=\"flex items-center gap-2\">\n <Picture source={variant.imageUrl} className=\"size-12 shrink-0\" imgClassName=\"h-full\" />\n <Text\n {...getTooltipProps(variant.title)}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold\"\n html={variant.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={variant.price}\n />\n {variant.comparePrice && (\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base !leading-[1.2] font-bold text-[#6D6D6F] line-through\"\n html={variant.comparePrice}\n />\n )}\n </div>\n </div>\n ))}\n </label>\n </div>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nProductBundle.displayName = 'ProductBundle'\n\nexport default withLayout(ProductBundle)\nexport type { ProductBundleProps, BundleOption, BundleVariantItem } from './types.js'\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAyBM,IAAAI,EAAA,6BAzBNC,EAAwC,iDACxCC,EAAmB,8CACnBC,EAA2B,8CAC3BC,EAAgD,iDAEhDC,EAAqC,6CAErC,MAAMC,EAAgB,IAAM,CAC1B,KAAM,CAAE,OAAAC,EAAQ,cAAAC,EAAe,iBAAAC,CAAiB,KAAI,wBAAqB,EACzE,GAAI,CAACF,GAAU,CAACA,GAAQ,eAAe,OAAQ,OAAO,KAEtD,KAAM,CAAE,QAAAG,EAAS,gBAAAC,CAAgB,KAAI,oBAAiB,EAEhDC,EAAwBC,GAA6B,CACrDL,GAAe,SAAWK,EAAW,QACvCN,GAAQ,kBAAkB,MAAS,EACnCE,IAAmB,MAAS,IAE5BA,IAAmBI,CAAU,EAC7BN,GAAQ,kBAAkBM,CAAU,EAExC,EAEA,SACE,QAAC,OAAI,aAAW,MAAG,4BAA6BN,GAAQ,SAAS,EAC/D,oBAAC,QAAK,UAAU,6DAA6D,KAAMA,GAAQ,MAAO,KAClG,OAAC,OAAI,UAAU,uFACZ,SAAAA,GAAQ,cAAc,IAAI,CAACA,EAAQO,OAClC,OAAC,OACC,oBAAC,OACC,aAAW,MACT,mHACA,CACG,eAAiBN,GAAe,SAAWD,EAAO,MACrD,CACF,EAEA,oBAAC,YACC,gBAAiB,IAAMK,EAAqBL,CAAM,EAClD,KAAK,KACL,aAAW,MAAG,yCAA0C,CACtD,iDAAkDC,GAAe,SAAWD,EAAO,MACrF,CAAC,EACD,GAAIA,EAAO,OACX,MAAOA,EAAO,OACd,QAASC,GAAe,SAAWD,EAAO,OAC5C,KACA,OAAC,SACC,QAASA,EAAO,OAChB,UAAU,kEAET,SAAAA,EAAO,eAAe,IAAIQ,MACzB,QAAC,OAAI,UAAU,iDACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,WAAQ,OAAQA,EAAQ,SAAU,UAAU,mBAAmB,aAAa,SAAS,KACtF,OAAC,QACE,GAAGJ,EAAgBI,EAAQ,KAAK,EACjC,UAAU,2EACV,KAAMA,EAAQ,MAChB,KACA,OAAC,iBAAe,GAAGL,EAAS,GAC9B,KACA,QAAC,OAAI,UAAU,wEACb,oBAAC,QACC,UAAU,4EACV,KAAMK,EAAQ,MAChB,EACCA,EAAQ,iBACP,OAAC,QACC,UAAU,wGACV,KAAMA,EAAQ,aAChB,GAEJ,IArBmEA,EAAQ,SAsB7E,CACD,EACH,GACF,GAjDQD,CAkDV,CACD,EACH,GACF,CAEJ,EAEAR,EAAc,YAAc,gBAE5B,IAAOR,KAAQ,cAAWQ,CAAa",
6
+ "names": ["ProductBundle_exports", "__export", "ProductBundle_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_helpers", "import_Styles", "import_useFollowTooltip", "import_BizProductProvider", "ProductBundle", "bundle", "checkedBundle", "setCheckedBundle", "tooltip", "getTooltipProps", "handleSelectedChange", "bundleItem", "index", "variant"]
7
7
  }
@@ -0,0 +1,48 @@
1
+ export interface BundleVariantItem {
2
+ /** 变体唯一标识符(对应 API variant_id) */
3
+ variantId: string | number;
4
+ /** 对应主商品的 sku,用于 ProductSummary 摘要中匹配当前商品折扣 */
5
+ sku?: string;
6
+ /** 产品名称(业务端从商品数据中获取) */
7
+ title: string;
8
+ /** 产品主图 URL(可选,业务端提供) */
9
+ imageUrl: string;
10
+ /**
11
+ * 格式化后的折扣价字符串,由业务端计算并格式化
12
+ * 示例:'$89.99'、'€79,99'
13
+ */
14
+ price: string;
15
+ /**
16
+ * 折扣价的数字原始值(可选)
17
+ * 仅供 ProductSummary 内部做价格折算,不用于展示
18
+ */
19
+ priceAmount?: number;
20
+ /**
21
+ * 格式化后的划线原价字符串(可选)
22
+ * 仅在有折扣时传入,组件会显示划线样式
23
+ * 示例:'$99.99'
24
+ */
25
+ comparePrice?: string;
26
+ }
27
+ /**
28
+ * 单个 bundle 选项(对应 API bundle_list 中的一项)
29
+ */
30
+ export interface BundleOption {
31
+ /** bundle 唯一 规则ID */
32
+ ruleId?: string;
33
+ /**
34
+ * 需要展示的其他商品列表
35
+ * 注意:业务端应排除当前主商品,只传入搭配商品
36
+ */
37
+ bundleVariants: BundleVariantItem[];
38
+ /** 单个bundle节省总金额 */
39
+ savings?: string;
40
+ }
41
+ export interface ProductBundleProps {
42
+ title?: string;
43
+ /** bundle最大节省金额 */
44
+ maxSavings?: string;
45
+ bundleOptions?: BundleOption[];
46
+ onCheckedChange?: (bundle?: BundleOption) => void;
47
+ className?: string;
48
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var r=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var d=(e,n,s,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of g(n))!u.call(e,t)&&t!==s&&r(e,t,{get:()=>n[t],enumerable:!(i=a(n,t))||i.enumerable});return e};var l=e=>d(r({},"__esModule",{value:!0}),e);var o={};module.exports=l(o);
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../src/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.ts"],
4
+ "sourcesContent": ["\nexport interface BundleVariantItem {\n /** \u53D8\u4F53\u552F\u4E00\u6807\u8BC6\u7B26\uFF08\u5BF9\u5E94 API variant_id\uFF09 */\n variantId: string | number\n /** \u5BF9\u5E94\u4E3B\u5546\u54C1\u7684 sku\uFF0C\u7528\u4E8E ProductSummary \u6458\u8981\u4E2D\u5339\u914D\u5F53\u524D\u5546\u54C1\u6298\u6263 */\n sku?: string\n /** \u4EA7\u54C1\u540D\u79F0\uFF08\u4E1A\u52A1\u7AEF\u4ECE\u5546\u54C1\u6570\u636E\u4E2D\u83B7\u53D6\uFF09 */\n title: string\n /** \u4EA7\u54C1\u4E3B\u56FE URL\uFF08\u53EF\u9009\uFF0C\u4E1A\u52A1\u7AEF\u63D0\u4F9B\uFF09 */\n imageUrl: string\n /**\n * \u683C\u5F0F\u5316\u540E\u7684\u6298\u6263\u4EF7\u5B57\u7B26\u4E32\uFF0C\u7531\u4E1A\u52A1\u7AEF\u8BA1\u7B97\u5E76\u683C\u5F0F\u5316\n * \u793A\u4F8B\uFF1A'$89.99'\u3001'\u20AC79,99'\n */\n price: string\n /**\n * \u6298\u6263\u4EF7\u7684\u6570\u5B57\u539F\u59CB\u503C\uFF08\u53EF\u9009\uFF09\n * \u4EC5\u4F9B ProductSummary \u5185\u90E8\u505A\u4EF7\u683C\u6298\u7B97\uFF0C\u4E0D\u7528\u4E8E\u5C55\u793A\n */\n priceAmount?: number\n /**\n * \u683C\u5F0F\u5316\u540E\u7684\u5212\u7EBF\u539F\u4EF7\u5B57\u7B26\u4E32\uFF08\u53EF\u9009\uFF09\n * \u4EC5\u5728\u6709\u6298\u6263\u65F6\u4F20\u5165\uFF0C\u7EC4\u4EF6\u4F1A\u663E\u793A\u5212\u7EBF\u6837\u5F0F\n * \u793A\u4F8B\uFF1A'$99.99'\n */\n comparePrice?: string\n}\n\n/**\n * \u5355\u4E2A bundle \u9009\u9879\uFF08\u5BF9\u5E94 API bundle_list \u4E2D\u7684\u4E00\u9879\uFF09\n */\nexport interface BundleOption {\n /** bundle \u552F\u4E00 \u89C4\u5219ID */\n ruleId?: string\n /**\n * \u9700\u8981\u5C55\u793A\u7684\u5176\u4ED6\u5546\u54C1\u5217\u8868\n * \u6CE8\u610F\uFF1A\u4E1A\u52A1\u7AEF\u5E94\u6392\u9664\u5F53\u524D\u4E3B\u5546\u54C1\uFF0C\u53EA\u4F20\u5165\u642D\u914D\u5546\u54C1\n */\n bundleVariants: BundleVariantItem[]\n /** \u5355\u4E2Abundle\u8282\u7701\u603B\u91D1\u989D */\n savings?: string\n}\n\nexport interface ProductBundleProps {\n title?: string\n /** bundle\u6700\u5927\u8282\u7701\u91D1\u989D */\n maxSavings?: string\n bundleOptions?: BundleOption[]\n onCheckedChange?: (bundle?: BundleOption) => void\n className?: string\n}\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["types_exports", "__toCommonJS"]
7
+ }
@@ -13,7 +13,7 @@ export interface CouponCardProps {
13
13
  /** 优惠码 */
14
14
  code: string;
15
15
  /** 倒计时文案 (如 "Ends in: 1:23:45:00") */
16
- countdownText?: string;
16
+ countdownText?: React.ReactNode;
17
17
  /** 复制按钮文案 */
18
18
  copyText: string;
19
19
  /** 已复制文案 */
@@ -1,2 +1,2 @@
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;
1
+ "use strict";"use client";var B=Object.create;var b=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var E=(o,t)=>{for(var n in t)b(o,n,{get:t[n],enumerable:!0})},T=(o,t,n,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of L(t))!z.call(o,a)&&a!==n&&b(o,a,{get:()=>t[a],enumerable:!(d=R(t,a))||d.enumerable});return o};var v=(o,t,n)=>(n=o!=null?B($(o)):{},T(t||!o||!o.__esModule?b(n,"default",{value:o,enumerable:!0}):n,o)),H=o=>T(b({},"__esModule",{value:!0}),o);var q={};E(q,{CouponCard:()=>y,MemberDiscountCard:()=>N,default:()=>A});module.exports=H(q);var e=require("react/jsx-runtime"),P=v(require("react")),s=require("../../../../../../helpers/index.js"),r=require("../../../../../../components/index.js"),w=v(require("../../../../hooks/useCopy.js")),F=require("../../../../hooks/useBenefits.js"),M=require("../../../../BizProductProvider.js"),I=require("../../../../hooks/useComponentData.js"),x=require("../../../../utils/textFormat.js"),_=require("../../../../../AiuiProvider/index.js"),S=v(require("../../../../../../hooks/useCountDown.js"));const U=P.default.memo(function({endTime:t,template:n}){const{days:d,hours:a,minutes:l,seconds:m}=(0,S.default)({endTime:t});return(0,e.jsx)(e.Fragment,{children:(0,x.replaceTemplate)(n,{countdown:`${d}:${a}:${l}:${m}`})})}),y=({checked:o,discountText:t,codeText:n,code:d,countdownText:a,copyText:l,copiedText:m,onClick:p,className:f})=>{const{copied:C,copy:k}=(0,w.default)();return(0,e.jsx)("div",{className:(0,s.cn)("flex flex-col gap-3 rounded-box overflow-hidden",f),role:"button",tabIndex:0,onClick:p,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?m:l})]})]}),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})]})})};y.displayName="CouponCard";const N=({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})]})})});N.displayName="MemberDiscountCard";const D=({className:o})=>{const{profile:t,variant:n,onUseCouponChange:d,onUseMemberDiscountChange:a,openSignInPopup:l,discount:m,savingDetail:p}=(0,M.useBizProductContext)(),{locale:f="us",trackingData:C}=(0,_.useAiuiContext)(),k=(0,F.useBenefits)({variant:n}),{commonCoupon:i,memberDiscount:g}=k,h=C?.common?.coupon,c=(0,I.useComponentData)("ProductCoupon")??{};return!i?.enable&&!g?.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)(y,{checked:p?.coupon>0,discountText:(0,x.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:f})||""}),codeText:(0,x.replaceTemplate)(c?.common?.withCode,{code:i?.config?.title??""}),code:i?.config?.title??"",countdownText:i?.config?.ends_at?(0,e.jsx)(U,{endTime:i.config.ends_at,template:c?.common?.endsIn??""}):void 0,copyText:h?.copy||c?.copyCode,copiedText:h?.copied||c?.copied,onClick:()=>{const u=p?.coupon?0:m?.codeSavings??0;d?.(u)}}),g?.enable&&(0,e.jsx)(N,{checked:!!t?.email&&!!p?.member,discountText:(0,x.replaceTemplate)(c?.member?.offMember,{discount:(0,s.formatPrice)({amount:g?.config?.amount??0,currencyCode:n.price.currencyCode,locale:f})||""}),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:u=>{u?.stopPropagation(),l?.()},className:"underline text-nowrap",dangerouslySetInnerHTML:{__html:c?.member?.login}})]}),onClick:()=>{if(!t?.email){l?.();return}const u=p?.member?0:g?.config?.amount??0;a?.(u)}})]})};D.displayName="ProductCoupon";var A=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 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,EAAAL,GA8DU,IAAAM,EAAA,6BA5DVC,EAAkB,iBAClBC,EAAgC,8CAChCC,EAAqC,iDACrCC,EAAoB,2CACpBC,EAA4B,4CAC5BC,EAAqC,6CACrCC,EAAiC,iDACjCC,EAAgC,2CAChCC,EAA+B,gDAC/BC,EAAyB,sDA6BlB,MAAMd,EAAwC,CAAC,CACpD,QAAAe,EACA,aAAAC,EACA,SAAAC,EACA,KAAAC,EACA,cAAAC,EACA,SAAAC,EACA,WAAAC,EACA,QAAAC,EACA,UAAAC,CACF,IAAM,CACJ,KAAM,CAAE,OAAQC,EAAU,KAAMC,CAAgB,KAAI,EAAAC,SAAQ,EAE5D,SACE,OAAC,OACC,aAAW,MAAG,kDAAmDH,CAAS,EAC1E,KAAK,SACL,SAAU,EACV,QAASD,EAET,oBAAC,OAAI,UAAU,8EACb,qBAAC,OAAI,UAAU,sBACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,YACC,KAAK,KACL,UAAU,qIACV,QAASP,EACX,KACA,OAAC,QAAK,UAAU,2GACb,SAAAC,EACH,GACF,KAEA,QAAC,OAAI,UAAU,iCACb,oBAAC,OAAI,UAAU,qCACb,mBAAC,QAAK,UAAU,kGACb,SAAAC,EACH,EACF,KACA,OAAC,QACC,UAAU,yDACV,KAAK,SACL,SAAU,EACV,QAASU,GAAS,CAChBA,EAAM,eAAe,EACrBA,EAAM,gBAAgB,EACtBF,EAAgBP,CAAI,CACtB,EAEC,SAAAM,EAAWH,EAAaD,EAC3B,GACF,GACF,EAECD,MACC,OAAC,QAAK,UAAU,uFACb,SAAAA,EACH,GAEJ,EACF,CAEJ,EAEAnB,EAAW,YAAc,aAgBlB,MAAMC,EAAwD,CAAC,CACpE,QAAAc,EACA,aAAAC,EACA,YAAAY,EACA,QAAAN,EACA,UAAAC,CACF,OAEI,OAAC,OACC,aAAW,MAAG,kDAAmDA,CAAS,EAC1E,KAAK,SACL,SAAU,EACV,QAASD,EAET,mBAAC,OAAI,UAAU,8EACb,oBAAC,OAAI,UAAU,sBACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,YACC,KAAK,KACL,UAAU,qIACV,QAASP,EACX,KACA,OAAC,QAAK,UAAU,2GACb,SAAAC,EACH,GACF,EAECY,MACC,OAAC,QAAK,UAAU,uGACb,SAAAA,EACH,GAEJ,EACF,EACF,EAIJ3B,EAAmB,YAAc,qBAEjC,MAAM4B,EAA8C,CAAC,CAAE,UAAAN,CAAU,IAAM,CACrE,KAAM,CAAE,QAAAO,EAAS,QAAAC,EAAS,kBAAAC,EAAmB,0BAAAC,EAA2B,gBAAAC,EAAiB,SAAAC,EAAU,aAAAC,CAAa,KAC9G,wBAAqB,EACjB,CAAE,OAAAC,EAAS,KAAM,aAAAC,CAAa,KAAI,kBAAe,EACjDC,KAAW,eAAY,CAAE,QAAAR,CAAQ,CAAC,EAClC,CAAE,aAAAS,EAAc,eAAAC,CAAe,EAAIF,EAEnC,CAAE,KAAAG,EAAM,MAAAC,EAAO,QAAAC,EAAS,QAAAC,CAAQ,KAAI,EAAAC,SAAa,CAAE,QAASN,GAAc,QAAQ,OAAQ,CAAC,EAE3FO,EAAaT,GAAc,QAAQ,OAEnCU,KAAoB,oBAAiB,eAAe,GAAK,CAAC,EAEhE,MAAK,CAACR,GAAc,QAAU,CAACC,GAAgB,QAAW,CAACV,GAAS,iBAC3D,QAIP,QAAC,OAAI,aAAW,MAAG,yEAA0ER,CAAS,EACnG,UAAAyB,GAAmB,UAClB,OAAC,QAAK,UAAU,kGACb,SAAAA,EAAkB,MACrB,EAEDR,GAAc,WACb,OAACxC,EAAA,CACC,QAASoC,GAAc,OAAS,EAChC,gBAAc,mBAAgBY,GAAmB,QAAQ,UAAW,CAClE,SACER,GAAc,QAAQ,YAAc,aAChC,KAAK,IAAI,OAAOA,GAAc,QAAQ,OAAS,CAAC,CAAC,EAAI,OACrD,eAAY,CACV,OAAQ,KAAK,IAAI,OAAOA,GAAc,QAAQ,aAAe,CAAC,CAAC,EAC/D,aAAcT,EAAQ,MAAM,aAC5B,OAAAM,CACF,CAAC,GAAK,EACd,CAAC,EACD,YAAU,mBAAgBW,GAAmB,QAAQ,SAAU,CAC7D,KAAMR,GAAc,QAAQ,OAAS,EACvC,CAAC,EACD,KAAMA,GAAc,QAAQ,OAAS,GACrC,cACEA,GAAc,QAAQ,WAClB,mBAAgBQ,GAAmB,QAAQ,OAAQ,CACjD,UAAW,GAAGN,CAAI,IAAIC,CAAK,IAAIC,CAAO,IAAIC,CAAO,EACnD,CAAC,EACD,OAEN,SAAUE,GAAY,MAAQC,GAAmB,SACjD,WAAYD,GAAY,QAAUC,GAAmB,OACrD,QAAS,IAAM,CACb,MAAMC,EAAgBb,GAAc,OAAwC,EAA9BD,GAAU,aAAe,EACvEH,IAAoBiB,CAAY,CAClC,EACF,EAGDR,GAAgB,WACf,OAACxC,EAAA,CACC,QAAS,EAAQ6B,GAAS,OAAU,CAAC,CAACM,GAAc,OACpD,gBAAc,mBAAgBY,GAAmB,QAAQ,UAAW,CAClE,YACE,eAAY,CACV,OAAQP,GAAgB,QAAQ,QAAU,EAC1C,aAAcV,EAAQ,MAAM,aAC5B,OAAAM,CACF,CAAC,GAAK,EACV,CAAC,EACD,YACUP,GAAS,MACfkB,GAAmB,QAAQ,aAE3B,oBACE,oBAAC,QAAK,UAAU,OAAO,wBAAyB,CAAE,OAAQA,GAAmB,QAAQ,WAAY,EAAG,KACpG,OAAC,QACC,KAAK,SACL,SAAU,EACV,QAASE,GAAK,CACZA,GAAG,gBAAgB,EACnBhB,IAAkB,CACpB,EACA,UAAU,wBACV,wBAAyB,CAAE,OAAQc,GAAmB,QAAQ,KAAM,EACtE,GACF,EAGJ,QAAS,IAAM,CACb,GAAI,CAAClB,GAAS,MAAO,CACnBI,IAAkB,EAClB,MACF,CACA,MAAMiB,EAAgBf,GAAc,OAAiD,EAAvCK,GAAgB,QAAQ,QAAU,EAChFR,IAA4BkB,CAAY,CAC1C,EACF,GAEJ,CAEJ,EAEAtB,EAAc,YAAc,gBAE5B,IAAO3B,EAAQ2B",
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"]
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\n// \u5012\u8BA1\u65F6\u663E\u793A\u7EC4\u4EF6\uFF08memo \u9694\u79BB\uFF0C\u907F\u514D\u5916\u5C42 ProductCoupon \u6BCF\u79D2\u91CD\u6E32\u67D3\uFF09\nconst CountdownDisplay = React.memo(function CountdownDisplay({\n endTime,\n template,\n}: {\n endTime: string\n template: string\n}) {\n const { days, hours, minutes, seconds } = useCountDown({ endTime })\n\n return (\n <>\n {replaceTemplate(template, {\n countdown: `${days}:${hours}:${minutes}:${seconds}`,\n })}\n </>\n )\n})\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?: React.ReactNode\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 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 ? (\n <CountdownDisplay\n endTime={commonCoupon.config.ends_at}\n template={productCouponData?.common?.endsIn ?? ''}\n />\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": "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",
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", "CountdownDisplay", "React", "endTime", "template", "days", "hours", "minutes", "seconds", "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", "couponCopy", "productCouponData", "couponSaving", "e", "memberSaving"]
7
7
  }
@@ -1,2 +0,0 @@
1
- declare const _default: import("react").ForwardRefExoticComponent<Omit<unknown, "container" | keyof import("../../../../../../shared/Styles.js").StylesProps> & import("../../../../../../shared/Styles.js").StylesProps & import("../../../../../index.js").ContainerProps & import("react").RefAttributes<unknown>> & {};
2
- export default _default;
@@ -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,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);
1
+ "use strict";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 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-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
- "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"]
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
7
  }
@@ -0,0 +1,3 @@
1
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<unknown, "container" | keyof import("../../../../../../shared/Styles.js").StylesProps> & import("../../../../../../shared/Styles.js").StylesProps & import("../../../../../index.js").ContainerProps & import("react").RefAttributes<unknown>> & {};
2
+ export default _default;
3
+ export type { ProductFunctionFreeGiftProps, FunctionFreeGiftItem } from './types.js';
@@ -0,0 +1,2 @@
1
+ "use strict";var f=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var S=(o,l)=>{for(var s in l)f(o,s,{get:l[s],enumerable:!0})},E=(o,l,s,a)=>{if(l&&typeof l=="object"||typeof l=="function")for(let i of w(l))!I.call(o,i)&&i!==s&&f(o,i,{get:()=>l[i],enumerable:!(a=P(l,i))||a.enumerable});return o};var T=o=>E(f({},"__esModule",{value:!0}),o);var j={};S(j,{default:()=>z});module.exports=T(j);var t=require("react/jsx-runtime"),r=require("../../../../../../components/index.js"),c=require("../../../../../../helpers/index.js"),h=require("../../../../../../shared/Styles.js"),p=require("../../../../hooks/useFollowTooltip.js"),g=require("../../../../BizProductProvider.js");const x=()=>{const{functionFreeGift:o,checkedFunctionGifts:l,setCheckedFunctionGifts:s}=(0,g.useBizProductContext)();if(!o||!l||!s)return null;const{title:a,freeLabel:i,giftItems:m=[]}=o,{tooltip:b,getTooltipProps:F}=(0,p.useFollowTooltip)(),k=o.mode==="multiple";if(!m.length)return null;const N=e=>l?.has(String(e.id))??!1,C=e=>{const n=String(e.id);s?.(v=>{const d=new Set(v),u=d.has(n);if(k){u?d.delete(n):d.add(n);const y=m.filter(G=>d.has(String(G.id)));o.onCheckedChange?.(y)}else d.clear(),u||d.add(n),o.onCheckedChange?.(u?void 0:e);return d})};return(0,t.jsxs)("div",{className:(0,c.cn)("ipc-product-detail-free-gift"),children:[(0,t.jsx)(r.Text,{className:"font-bold leading-[1.2] text-[14px] lg-desktop:text-[16px]",html:a}),(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:m.map(e=>{const n=N(e);return(0,t.jsxs)("div",{className:(0,c.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":n}),children:[(0,t.jsx)(r.Checkbox,{onCheckedChange:()=>C(e),size:"lg",className:(0,c.cn)("rounded-full border-2 border-[#E4E5E6]",{"border-brand-0 data-[state=checked]:bg-brand-0":n}),id:String(e.id),checked:n,value:String(e.id)}),(0,t.jsxs)("label",{htmlFor:String(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)(r.Picture,{source:e.imageUrl,className:"size-12 shrink-0",imgClassName:"h-full"}),(0,t.jsx)(r.Text,{...F(e.title),className:"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold",html:e.title}),(0,t.jsx)(p.FollowTooltip,{...b})]}),(0,t.jsxs)("div",{className:"tablet:flex-row flex shrink-0 flex-col items-center gap-1",children:[i&&(0,t.jsx)(r.Text,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold !leading-[1.2]",html:i}),e.comparePrice&&(0,t.jsx)(r.Text,{className:"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold text-[#6D6D6F] line-through !leading-[1.2]",html:e.comparePrice})]})]})]},e.id)})})]})};x.displayName="ProductFunctionFreeGift";var z=(0,h.withLayout)(x);
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../src/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.tsx"],
4
+ "sourcesContent": ["import { Text, Picture, Checkbox } from '../../../../../../components/index.js'\nimport { cn } from '../../../../../../helpers/index.js'\nimport { withLayout } from '../../../../../../shared/Styles.js'\nimport { useFollowTooltip, FollowTooltip } from '../../../../hooks/useFollowTooltip.js'\nimport type { FunctionFreeGiftItem } from './types.js'\nimport { useBizProductContext } from '../../../../BizProductProvider.js'\n\nconst ProductFunctionFreeGift = () => {\n const { functionFreeGift: freeGift, checkedFunctionGifts, setCheckedFunctionGifts } = useBizProductContext()\n\n if (!freeGift) return null\n if (!checkedFunctionGifts || !setCheckedFunctionGifts) return null\n\n const { title, freeLabel, giftItems = [] } = freeGift\n const { tooltip, getTooltipProps } = useFollowTooltip()\n\n const isMultiple = freeGift.mode === 'multiple'\n\n if (!giftItems.length) return null\n\n const isChecked = (gift: FunctionFreeGiftItem): boolean => {\n return checkedFunctionGifts?.has(String(gift.id)) ?? false\n }\n\n const handleToggle = (gift: FunctionFreeGiftItem) => {\n const giftId = String(gift.id)\n setCheckedFunctionGifts?.(prev => {\n const next = new Set(prev)\n const alreadyChecked = next.has(giftId)\n\n if (isMultiple) {\n alreadyChecked ? next.delete(giftId) : next.add(giftId)\n const nextItems = giftItems.filter(g => next.has(String(g.id)))\n freeGift.onCheckedChange?.(nextItems)\n } else {\n next.clear()\n if (!alreadyChecked) {\n next.add(giftId)\n }\n freeGift.onCheckedChange?.(alreadyChecked ? undefined : gift)\n }\n return next\n })\n }\n\n return (\n <div className={cn('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 {giftItems.map(gift => {\n const checked = isChecked(gift)\n return (\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 { 'border-brand': checked }\n )}\n >\n <Checkbox\n onCheckedChange={() => handleToggle(gift)}\n size=\"lg\"\n className={cn('rounded-full border-2 border-[#E4E5E6]', {\n 'border-brand-0 data-[state=checked]:bg-brand-0': checked,\n })}\n id={String(gift.id)}\n checked={checked}\n value={String(gift.id)}\n />\n <label\n htmlFor={String(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.imageUrl} className=\"size-12 shrink-0\" imgClassName=\"h-full\" />\n <Text\n {...getTooltipProps(gift.title)}\n className=\"laptop:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-sm font-bold\"\n html={gift.title}\n />\n <FollowTooltip {...tooltip} />\n </div>\n <div className=\"tablet:flex-row flex shrink-0 flex-col items-center gap-1\">\n {freeLabel && (\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold !leading-[1.2]\"\n html={freeLabel}\n />\n )}\n {gift.comparePrice && (\n <Text\n className=\"laptop:text-[20px] lg-desktop:text-2xl text-base font-bold text-[#6D6D6F] line-through !leading-[1.2]\"\n html={gift.comparePrice}\n />\n )}\n </div>\n </label>\n </div>\n )\n })}\n </div>\n </div>\n )\n}\n\nProductFunctionFreeGift.displayName = 'ProductFunctionFreeGift'\n\nexport default withLayout(ProductFunctionFreeGift)\nexport type { ProductFunctionFreeGiftProps, FunctionFreeGiftItem } from './types.js'\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA+CM,IAAAI,EAAA,6BA/CNC,EAAwC,iDACxCC,EAAmB,8CACnBC,EAA2B,8CAC3BC,EAAgD,iDAEhDC,EAAqC,6CAErC,MAAMC,EAA0B,IAAM,CACpC,KAAM,CAAE,iBAAkBC,EAAU,qBAAAC,EAAsB,wBAAAC,CAAwB,KAAI,wBAAqB,EAG3G,GADI,CAACF,GACD,CAACC,GAAwB,CAACC,EAAyB,OAAO,KAE9D,KAAM,CAAE,MAAAC,EAAO,UAAAC,EAAW,UAAAC,EAAY,CAAC,CAAE,EAAIL,EACvC,CAAE,QAAAM,EAAS,gBAAAC,CAAgB,KAAI,oBAAiB,EAEhDC,EAAaR,EAAS,OAAS,WAErC,GAAI,CAACK,EAAU,OAAQ,OAAO,KAE9B,MAAMI,EAAaC,GACVT,GAAsB,IAAI,OAAOS,EAAK,EAAE,CAAC,GAAK,GAGjDC,EAAgBD,GAA+B,CACnD,MAAME,EAAS,OAAOF,EAAK,EAAE,EAC7BR,IAA0BW,GAAQ,CAChC,MAAMC,EAAO,IAAI,IAAID,CAAI,EACnBE,EAAiBD,EAAK,IAAIF,CAAM,EAEtC,GAAIJ,EAAY,CACdO,EAAiBD,EAAK,OAAOF,CAAM,EAAIE,EAAK,IAAIF,CAAM,EACtD,MAAMI,EAAYX,EAAU,OAAOY,GAAKH,EAAK,IAAI,OAAOG,EAAE,EAAE,CAAC,CAAC,EAC9DjB,EAAS,kBAAkBgB,CAAS,CACtC,MACEF,EAAK,MAAM,EACNC,GACHD,EAAK,IAAIF,CAAM,EAEjBZ,EAAS,kBAAkBe,EAAiB,OAAYL,CAAI,EAE9D,OAAOI,CACT,CAAC,CACH,EAEA,SACE,QAAC,OAAI,aAAW,MAAG,8BAA8B,EAC/C,oBAAC,QAAK,UAAU,6DAA6D,KAAMX,EAAO,KAC1F,OAAC,OAAI,UAAU,uFACZ,SAAAE,EAAU,IAAIK,GAAQ,CACrB,MAAMQ,EAAUT,EAAUC,CAAI,EAC9B,SACE,QAAC,OAEC,aAAW,MACT,mHACA,CAAE,eAAgBQ,CAAQ,CAC5B,EAEA,oBAAC,YACC,gBAAiB,IAAMP,EAAaD,CAAI,EACxC,KAAK,KACL,aAAW,MAAG,yCAA0C,CACtD,iDAAkDQ,CACpD,CAAC,EACD,GAAI,OAAOR,EAAK,EAAE,EAClB,QAASQ,EACT,MAAO,OAAOR,EAAK,EAAE,EACvB,KACA,QAAC,SACC,QAAS,OAAOA,EAAK,EAAE,EACvB,UAAU,qFAEV,qBAAC,OAAI,UAAU,0BACb,oBAAC,WAAQ,OAAQA,EAAK,SAAU,UAAU,mBAAmB,aAAa,SAAS,KACnF,OAAC,QACE,GAAGH,EAAgBG,EAAK,KAAK,EAC9B,UAAU,2EACV,KAAMA,EAAK,MACb,KACA,OAAC,iBAAe,GAAGJ,EAAS,GAC9B,KACA,QAAC,OAAI,UAAU,4DACZ,UAAAF,MACC,OAAC,QACC,UAAU,4EACV,KAAMA,EACR,EAEDM,EAAK,iBACJ,OAAC,QACC,UAAU,wGACV,KAAMA,EAAK,aACb,GAEJ,GACF,IA3CKA,EAAK,EA4CZ,CAEJ,CAAC,EACH,GACF,CAEJ,EAEAX,EAAwB,YAAc,0BAEtC,IAAOR,KAAQ,cAAWQ,CAAuB",
6
+ "names": ["ProductFunctionFreeGift_exports", "__export", "ProductFunctionFreeGift_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_helpers", "import_Styles", "import_useFollowTooltip", "import_BizProductProvider", "ProductFunctionFreeGift", "freeGift", "checkedFunctionGifts", "setCheckedFunctionGifts", "title", "freeLabel", "giftItems", "tooltip", "getTooltipProps", "isMultiple", "isChecked", "gift", "handleToggle", "giftId", "prev", "next", "alreadyChecked", "nextItems", "g", "checked"]
7
+ }
@@ -0,0 +1,115 @@
1
+ /**
2
+ * 单个买赠礼品项
3
+ *
4
+ * 由业务端将 API reward_list 映射而来,所有展示字段已处理为字符串,
5
+ * 组件内部不再做任何格式化计算。
6
+ */
7
+ export interface FunctionFreeGiftItem {
8
+ /**
9
+ * 礼品唯一标识符,用于 checkbox 选中判断
10
+ * 通常对应 API 中的 variant_id
11
+ */
12
+ id: string | number;
13
+ /** 商品标题,业务端从商品数据中获取后传入 */
14
+ title: string;
15
+ /** 商品主图 URL(可选,业务端提供) */
16
+ imageUrl?: string;
17
+ /**
18
+ * 格式化后的划线原价字符串(可选)
19
+ * 仅在有原价需要展示时传入,组件会显示划线样式
20
+ * 示例:'$89.99'、'€79,99'
21
+ */
22
+ comparePrice?: string;
23
+ }
24
+ interface ProductFunctionFreeGiftBaseProps {
25
+ /** 区块标题文案,支持 HTML */
26
+ title?: string;
27
+ /**
28
+ * "FREE" 标签文案,所有礼品共享同一个标签
29
+ * 示例:'FREE'、'Gift'、'Free Gift'
30
+ * 来源:API discount_label.cart_checkout_label
31
+ */
32
+ freeLabel?: string;
33
+ /**
34
+ * 礼品列表
35
+ * 业务端负责:过滤可用项(availableForSale)、映射数据结构
36
+ * 组件直接渲染,不做额外过滤
37
+ */
38
+ giftItems?: FunctionFreeGiftItem[];
39
+ className?: string;
40
+ }
41
+ /**
42
+ * 单选模式(默认)
43
+ * 同一时刻最多选中一个礼品;再次点击已选中项则取消选中。
44
+ *
45
+ * @example
46
+ * ```tsx
47
+ * <ProductFreeGift
48
+ * title="Choose a free gift"
49
+ * freeLabel="FREE"
50
+ * giftItems={items}
51
+ * checkedId={selectedId}
52
+ * onCheckedChange={(gift) => setSelectedId(gift?.id)}
53
+ * />
54
+ * ```
55
+ */
56
+ interface ProductFunctionFreeGiftSingleProps extends ProductFunctionFreeGiftBaseProps {
57
+ mode?: 'single';
58
+ /** 当前选中的礼品 id;undefined 表示无选中 */
59
+ checkedId?: string | number;
60
+ /** 选中时返回 FreeGiftItem,取消选中时返回 undefined */
61
+ onCheckedChange?: (gift?: FunctionFreeGiftItem) => void;
62
+ checkedIds?: never;
63
+ }
64
+ /**
65
+ * 多选模式
66
+ * 可同时选中多个礼品,回调始终返回当前全部已选项数组。
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * <ProductFreeGift
71
+ * mode="multiple"
72
+ * title="Choose your free gifts"
73
+ * freeLabel="FREE"
74
+ * giftItems={items}
75
+ * checkedIds={selectedIds}
76
+ * onCheckedChange={(gifts) => setSelectedIds(gifts.map(g => g.id))}
77
+ * />
78
+ * ```
79
+ */
80
+ interface ProductFunctionFreeGiftMultipleProps extends ProductFunctionFreeGiftBaseProps {
81
+ mode: 'multiple';
82
+ /** 当前选中的礼品 id 数组;空数组表示无选中 */
83
+ checkedIds?: (string | number)[];
84
+ /** 每次勾选/取消后返回当前全部已选的 FreeGiftItem 数组 */
85
+ onCheckedChange?: (gifts: FunctionFreeGiftItem[]) => void;
86
+ checkedId?: never;
87
+ }
88
+ export type ProductFunctionFreeGiftProps = ProductFunctionFreeGiftSingleProps | ProductFunctionFreeGiftMultipleProps;
89
+ export {};
90
+ /**
91
+ * 业务端 free gift rule API 数据结构
92
+ *
93
+ * @example
94
+ * ```json
95
+ * {
96
+ * "rule_id": 1598,
97
+ * "rule_type": 1,
98
+ * "discount_label": {
99
+ * "cart_checkout_label": "Gift",
100
+ * "product_label": "",
101
+ * "sold_out_label": ""
102
+ * },
103
+ * "frontend_labels": null,
104
+ * "apply_unit": 1,
105
+ * "discount_combinations": { ... },
106
+ * "gift_type": 1,
107
+ * "reward_list": [
108
+ * {
109
+ * "get_unit": 1,
110
+ * "variant_list": [{ "variant_id": "44302515404975", "sku": "A3062Z11-97", "handle": "a3062z11-97-travel-case" }]
111
+ * }
112
+ * ]
113
+ * }
114
+ * ```
115
+ */
@@ -0,0 +1,2 @@
1
+ "use strict";var n=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var d=(t,e,c,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of s(e))!u.call(t,i)&&i!==c&&n(t,i,{get:()=>e[i],enumerable:!(r=o(e,i))||r.enumerable});return t};var F=t=>d(n({},"__esModule",{value:!0}),t);var f={};module.exports=F(f);
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../../src/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.ts"],
4
+ "sourcesContent": ["\n// \u2500\u2500\u2500 \u7EC4\u4EF6\u6D88\u8D39\u7C7B\u578B \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * \u5355\u4E2A\u4E70\u8D60\u793C\u54C1\u9879\n *\n * \u7531\u4E1A\u52A1\u7AEF\u5C06 API reward_list \u6620\u5C04\u800C\u6765\uFF0C\u6240\u6709\u5C55\u793A\u5B57\u6BB5\u5DF2\u5904\u7406\u4E3A\u5B57\u7B26\u4E32\uFF0C\n * \u7EC4\u4EF6\u5185\u90E8\u4E0D\u518D\u505A\u4EFB\u4F55\u683C\u5F0F\u5316\u8BA1\u7B97\u3002\n */\nexport interface FunctionFreeGiftItem {\n /**\n * \u793C\u54C1\u552F\u4E00\u6807\u8BC6\u7B26\uFF0C\u7528\u4E8E checkbox \u9009\u4E2D\u5224\u65AD\n * \u901A\u5E38\u5BF9\u5E94 API \u4E2D\u7684 variant_id\n */\n id: string | number\n\n /** \u5546\u54C1\u6807\u9898\uFF0C\u4E1A\u52A1\u7AEF\u4ECE\u5546\u54C1\u6570\u636E\u4E2D\u83B7\u53D6\u540E\u4F20\u5165 */\n title: string\n\n /** \u5546\u54C1\u4E3B\u56FE URL\uFF08\u53EF\u9009\uFF0C\u4E1A\u52A1\u7AEF\u63D0\u4F9B\uFF09 */\n imageUrl?: string\n\n /**\n * \u683C\u5F0F\u5316\u540E\u7684\u5212\u7EBF\u539F\u4EF7\u5B57\u7B26\u4E32\uFF08\u53EF\u9009\uFF09\n * \u4EC5\u5728\u6709\u539F\u4EF7\u9700\u8981\u5C55\u793A\u65F6\u4F20\u5165\uFF0C\u7EC4\u4EF6\u4F1A\u663E\u793A\u5212\u7EBF\u6837\u5F0F\n * \u793A\u4F8B\uFF1A'$89.99'\u3001'\u20AC79,99'\n */\n comparePrice?: string\n}\n\ninterface ProductFunctionFreeGiftBaseProps {\n /** \u533A\u5757\u6807\u9898\u6587\u6848\uFF0C\u652F\u6301 HTML */\n title?: string\n\n /**\n * \"FREE\" \u6807\u7B7E\u6587\u6848\uFF0C\u6240\u6709\u793C\u54C1\u5171\u4EAB\u540C\u4E00\u4E2A\u6807\u7B7E\n * \u793A\u4F8B\uFF1A'FREE'\u3001'Gift'\u3001'Free Gift'\n * \u6765\u6E90\uFF1AAPI discount_label.cart_checkout_label\n */\n freeLabel?: string\n\n /**\n * \u793C\u54C1\u5217\u8868\n * \u4E1A\u52A1\u7AEF\u8D1F\u8D23\uFF1A\u8FC7\u6EE4\u53EF\u7528\u9879\uFF08availableForSale\uFF09\u3001\u6620\u5C04\u6570\u636E\u7ED3\u6784\n * \u7EC4\u4EF6\u76F4\u63A5\u6E32\u67D3\uFF0C\u4E0D\u505A\u989D\u5916\u8FC7\u6EE4\n */\n giftItems?: FunctionFreeGiftItem[]\n\n className?: string\n}\n\n/**\n * \u5355\u9009\u6A21\u5F0F\uFF08\u9ED8\u8BA4\uFF09\n * \u540C\u4E00\u65F6\u523B\u6700\u591A\u9009\u4E2D\u4E00\u4E2A\u793C\u54C1\uFF1B\u518D\u6B21\u70B9\u51FB\u5DF2\u9009\u4E2D\u9879\u5219\u53D6\u6D88\u9009\u4E2D\u3002\n *\n * @example\n * ```tsx\n * <ProductFreeGift\n * title=\"Choose a free gift\"\n * freeLabel=\"FREE\"\n * giftItems={items}\n * checkedId={selectedId}\n * onCheckedChange={(gift) => setSelectedId(gift?.id)}\n * />\n * ```\n */\ninterface ProductFunctionFreeGiftSingleProps extends ProductFunctionFreeGiftBaseProps {\n mode?: 'single'\n /** \u5F53\u524D\u9009\u4E2D\u7684\u793C\u54C1 id\uFF1Bundefined \u8868\u793A\u65E0\u9009\u4E2D */\n checkedId?: string | number\n /** \u9009\u4E2D\u65F6\u8FD4\u56DE FreeGiftItem\uFF0C\u53D6\u6D88\u9009\u4E2D\u65F6\u8FD4\u56DE undefined */\n onCheckedChange?: (gift?: FunctionFreeGiftItem) => void\n checkedIds?: never\n}\n\n/**\n * \u591A\u9009\u6A21\u5F0F\n * \u53EF\u540C\u65F6\u9009\u4E2D\u591A\u4E2A\u793C\u54C1\uFF0C\u56DE\u8C03\u59CB\u7EC8\u8FD4\u56DE\u5F53\u524D\u5168\u90E8\u5DF2\u9009\u9879\u6570\u7EC4\u3002\n *\n * @example\n * ```tsx\n * <ProductFreeGift\n * mode=\"multiple\"\n * title=\"Choose your free gifts\"\n * freeLabel=\"FREE\"\n * giftItems={items}\n * checkedIds={selectedIds}\n * onCheckedChange={(gifts) => setSelectedIds(gifts.map(g => g.id))}\n * />\n * ```\n */\ninterface ProductFunctionFreeGiftMultipleProps extends ProductFunctionFreeGiftBaseProps {\n mode: 'multiple'\n /** \u5F53\u524D\u9009\u4E2D\u7684\u793C\u54C1 id \u6570\u7EC4\uFF1B\u7A7A\u6570\u7EC4\u8868\u793A\u65E0\u9009\u4E2D */\n checkedIds?: (string | number)[]\n /** \u6BCF\u6B21\u52FE\u9009/\u53D6\u6D88\u540E\u8FD4\u56DE\u5F53\u524D\u5168\u90E8\u5DF2\u9009\u7684 FreeGiftItem \u6570\u7EC4 */\n onCheckedChange?: (gifts: FunctionFreeGiftItem[]) => void\n checkedId?: never\n}\n\nexport type ProductFunctionFreeGiftProps = ProductFunctionFreeGiftSingleProps | ProductFunctionFreeGiftMultipleProps\n\n/**\n * \u4E1A\u52A1\u7AEF free gift rule API \u6570\u636E\u7ED3\u6784\n *\n * @example\n * ```json\n * {\n * \"rule_id\": 1598,\n * \"rule_type\": 1,\n * \"discount_label\": {\n * \"cart_checkout_label\": \"Gift\",\n * \"product_label\": \"\",\n * \"sold_out_label\": \"\"\n * },\n * \"frontend_labels\": null,\n * \"apply_unit\": 1,\n * \"discount_combinations\": { ... },\n * \"gift_type\": 1,\n * \"reward_list\": [\n * {\n * \"get_unit\": 1,\n * \"variant_list\": [{ \"variant_id\": \"44302515404975\", \"sku\": \"A3062Z11-97\", \"handle\": \"a3062z11-97-travel-case\" }]\n * }\n * ]\n * }\n * ```\n */\n"],
5
+ "mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
6
+ "names": ["types_exports", "__toCommonJS"]
7
+ }
@@ -1,2 +1,2 @@
1
- "use strict";var re=Object.create;var T=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var ue=(l,t)=>{for(var s in t)T(l,s,{get:t[s],enumerable:!0})},W=(l,t,s,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of se(t))!pe.call(l,n)&&n!==s&&T(l,n,{get:()=>t[n],enumerable:!(u=ce(t,n))||u.enumerable});return l};var q=(l,t,s)=>(s=l!=null?re(de(l)):{},W(t||!l||!l.__esModule?T(s,"default",{value:l,enumerable:!0}):s,l)),me=l=>W(T({},"__esModule",{value:!0}),l);var ve={};ue(ve,{default:()=>ge});module.exports=me(ve);var e=require("react/jsx-runtime"),a=require("../../../../../components/index.js"),B=require("../../../BizProductProvider.js"),K=require("../../../hooks/useComponentData.js"),v=require("react"),g=require("../../../utils/index.js"),S=require("../../../../AiuiProvider/index.js"),$=q(require("decimal.js")),U=require("../../../utils/textFormat.js"),X=require("../../../../../shared/Styles.js"),Y=require("../../../../../components/index.js"),Z=require("../../../../../shared/track.js"),ee=q(require("../../CartActionButtons/index.js"));const xe=()=>{const{locale:l="us",copyWriting:t,trackingData:s}=(0,S.useAiuiContext)(),{product:u,variant:n,finalPrice:x,comparePrice:b,coupon:k,selectedOptions:p,selectedVariants:r,totalSavings:F,onAddToCart:w,onBuyNow:E,savingDetail:f,checkedBundle:N,joinedRecommendBuyProducts:o,setJoinedRecommendBuyProducts:C,setSavingDetail:P,addToCartLoading:j,buyNowLoading:te,notifyMeMode:ae,onNotifyMeClick:oe,profile:_,addOrder:L,setAddOrder:D}=(0,B.useBizProductContext)(),G=s?.showComparePrice??!0,z=(0,K.useComponentData)("ProductSummary")??{},[A]=r,I=(0,v.useMemo)(()=>{const c=N?.variants.find(y=>y.variant.sku===A?.sku),i=new $.default(A?.price?.amount||0).minus(c?.price||A?.price?.amount).toNumber();let m=new $.default(A?.price?.amount||0);_?.email&&(m=m.minus(f?.member||0));const h=m.minus(f?.coupon).minus(i).toNumber();return parseFloat(h.toFixed(2))},[A,N,_,f?.member,f?.coupon]),{bundleVariant:V,giftVariant:M,exchangeVariant:R}=fe()||{},[d,O]=(0,v.useState)();(0,v.useEffect)(()=>{O({bundle:o.bundle?.value?void 0:V,gift:o.gift?.value?void 0:M,exchange:o.exchange?.value?void 0:R})},[V,M,R,o]);const ne=(0,v.useMemo)(()=>{const c=[];return L&&L.forEach((i,m)=>{o[i]?.value&&c.push({type:i,key:`${i}-${m}`})}),c},[L,o]),le=(0,v.useMemo)(()=>{const c=p?.quantity||"",i=p?.color||p?.colour||p?.couleur||"";return`${c&&i?`${c} | ${i}`:c||i}`},[p?.quantity,p?.color,p?.colour,p?.couleur]),ie=(0,v.useMemo)(()=>{const{image_1920:c,image_1440:i,image_1024:m,image_768:h,image_390:y}=z?.thumbnail||{};return(z?.thumbnail?`${c} 1920, ${i} 1440, ${m} 1024, ${h} 768, ${y} 390`:n.image?.url)||n.image?.url},[z?.thumbnail,n.image?.url]);return n.availableForSale?(0,e.jsx)("div",{className:"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16",children:(0,e.jsx)("div",{className:"laptop:rounded-2xl bg-[#F5F5F7]",children:(0,e.jsxs)(a.Grid,{className:"tablet:p-8 tablet:!pb-0 px-4 pt-6",children:[(0,e.jsxs)(a.GridItem,{className:"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4",children:[(0,e.jsx)(a.Heading,{className:"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]",html:z?.readyWant?.replace?.("{title}",u?.title)}),(0,e.jsx)("div",{className:"",children:(0,e.jsx)(a.Picture,{source:ie,className:"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]",imgClassName:"object-cover h-full"})})]}),(0,e.jsxs)(a.GridItem,{className:"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,e.jsx)(Y.ExposureDetector,{exposureKey:"listing_selector",onExposure:()=>{(0,Z.gaTrack)({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${n.sku}`,component_type:"image",component_name:"listing_selector",position:1}})},children:(0,e.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:n.image?.url||u?.images?.[0]?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:u.title}),(0,e.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:le})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:(0,g.formatPrice)({amount:I,currencyCode:n.price.currencyCode,locale:l})}),G&&I<n?.price?.amount&&(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:n?.price?.amount,currencyCode:n.price.currencyCode,locale:l})})]})]})}),ne.map(({type:c,key:i})=>c==="gift"&&o?.gift?.value?(0,e.jsx)(Q,{giftOperation:m=>{C?.({...o,gift:{value:void 0,canOperate:!0}}),O?.({...d,gift:m}),D?.(h=>h.filter(y=>y!=="gift"))},status:!!o?.gift,gift:o?.gift?.value,canOperate:o?.gift?.canOperate},i):c==="bundle"&&o?.bundle?.value?(0,e.jsx)(J,{bundleOperation:m=>{C?.({...o,bundle:{value:void 0,canOperate:!0}}),O?.({...d,bundle:m}),D?.(h=>h.filter(y=>y!=="bundle"))},status:!!o?.bundle,bundleListItem:o?.bundle?.value,canOperate:o?.bundle?.canOperate},i):c==="exchange"&&o?.exchange?.value?(0,e.jsx)(H,{exchangeOperation:m=>{C?.({...o,exchange:{value:void 0,canOperate:!0}}),O?.({...d,exchange:m}),D?.(h=>h.filter(y=>y!=="exchange"))},status:!!o?.exchange,canOperate:o?.exchange?.canOperate,exchange:o?.exchange?.value},i):null)]}),(d?.bundle||d?.gift||d?.exchange)&&(0,e.jsxs)("div",{className:"laptop-md:mt-8 mt-6",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[18px] text-sm font-bold",html:z?.recommendBuy}),(0,e.jsxs)("div",{className:"laptop-md:gap-4 mt-4 flex flex-col gap-6",children:[d?.exchange&&(0,e.jsx)(H,{exchangeOperation:c=>{C?.({...o,exchange:{value:c,canOperate:!0}}),O?.({...d,exchange:void 0}),D?.(i=>[...i,"exchange"])},canOperate:o?.exchange?.canOperate,status:!d?.exchange,exchange:d?.exchange}),d?.bundle&&(0,e.jsx)(J,{bundleOperation:c=>{P?.({...f,exchangePurchase:0}),C?.({...o,bundle:{value:c,canOperate:!0}}),O?.({...d,bundle:void 0}),D?.(i=>[...i,"bundle"])},canOperate:o?.bundle?.canOperate,status:!d?.bundle,bundleListItem:d?.bundle}),d?.gift&&(0,e.jsx)(Q,{giftOperation:c=>{C?.({...o,gift:{value:c,canOperate:!0}}),O?.({...d,gift:void 0}),D?.(i=>[...i,"gift"])},canOperate:o?.gift?.canOperate,status:!d?.gift,gift:d?.gift})]})]})]}),(0,e.jsxs)("div",{className:"text-right",children:[(0,e.jsx)(a.Text,{className:"laptop:text-xl laptop-md:text-2xl text-right font-bold",html:`${(0,U.replaceTemplate)(t?.totalPrice||"",{amount:(0,g.formatPrice)({amount:parseFloat(x.toFixed(2)),currencyCode:n.price.currencyCode,locale:l})})}`}),G&&F>0&&(0,e.jsx)(a.Text,{className:"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:b,currencyCode:n.price.currencyCode,locale:l})}),(0,e.jsx)("div",{className:"mt-4 flex justify-end gap-3",children:(0,e.jsx)(ee.default,{mode:ae,availableForSale:n.availableForSale,addToCartText:t?.addToCart,buyNowText:t?.shopNow,addToCartLoading:j,buyNowLoading:te,addToCartClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",buyNowClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",onAddToCart:w,onBuyNow:E,onNotifyMeClick:oe,notifyMeText:t?.notifyMe,notifyMeClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2"})})]})]})]})})}):null},fe=()=>{const{bundle:l,variant:t,checkedBundle:s,freeGift:u,checkedGift:n,exchangePurchase:x,checkedExchangePurchase:b}=(0,B.useBizProductContext)();let k,p,r;const{bundleList:F}=l||{},{giftList:w=[]}=u||{},{giftList:E=[]}=x||{},f=F?.filter(P=>P.variants.slice(1,P.variants.length).every(j=>j.variant.availableForSale))||[],[N]=f;k=s||N;const[o]=w?.filter(P=>P.availableForSale)??[];p=n||o;const[C]=E?.filter(P=>P.availableForSale)??[];return r=b||C,{bundleVariant:k,giftVariant:p,exchangeVariant:r}},J=({bundleOperation:l,bundleListItem:t,canOperate:s,status:u})=>{const{locale:n="us",copyWriting:x}=(0,S.useAiuiContext)(),{variant:b,setCheckedBundle:k}=(0,B.useBizProductContext)(),p=t?.variants.filter(r=>r.variant.sku!==b.sku);return(0,e.jsx)("div",{className:"",children:p?.map(r=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:r?.variant?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsx)("div",{className:"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]",children:(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold",html:r.variant.product.title})})]}),(0,e.jsxs)("div",{className:"flex flex-col items-end justify-center gap-1",children:[!!t&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:(0,g.formatPrice)({amount:r?.price||0,locale:n,currencyCode:r.variant?.price?.currencyCode||""})}),r.price<r.variant.price.amount&&(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:r.variant.price.amount||0,locale:n,currencyCode:r.variant?.price?.currencyCode||""})})]}),s&&(0,e.jsx)(a.Button,{size:"icon",variant:"link",onClick:()=>{k?.(u?void 0:t),l?.(t)},className:"size-auto shrink-0 underline",children:u?x?.remove:x?.add})]})]},r.variant.id))})},Q=({giftOperation:l,gift:t,status:s,canOperate:u})=>{const{locale:n="us",copyWriting:x}=(0,S.useAiuiContext)(),{freeGift:b,setCheckedGift:k}=(0,B.useBizProductContext)(),{freeLabel:p}=b||{},{options:r}=t||{},F=(0,v.useMemo)(()=>{const w=r?.find(o=>o.name==="color"||o.name==="colour"||o.name==="couleur")||{},E=r?.find(o=>o.name==="quantity")||{},f=w?w.values?.[0]?.label:"",N=E?E.values?.[0]?.label:"";return`${f&&N?N+" | "+f:N||f} | ${p}`},[p,r]);return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:t?.product?.title}),(0,e.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:F})]})]}),(0,e.jsxs)("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!t&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:p}),(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:t.price.amount,locale:n,currencyCode:t.price.currencyCode})})]}),u&&(0,e.jsx)(a.Button,{size:"icon",variant:"link",onClick:()=>{k?.(s?void 0:t),l(t)},className:"size-auto shrink-0 underline",children:s?x?.remove:x?.add})]})]})},H=({exchangeOperation:l,exchange:t,canOperate:s,status:u})=>{const{locale:n="us",copyWriting:x}=(0,S.useAiuiContext)(),{setCheckedExchangePurchase:b}=(0,B.useBizProductContext)();return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,e.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:t?.product?.title}),(0,e.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]"})]})]}),(0,e.jsxs)("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!t&&(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:(0,g.formatPrice)({amount:t.finalPrice?.amount||0,locale:n,currencyCode:t.price.currencyCode})}),(0,e.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:(0,g.formatPrice)({amount:t.price?.amount||0,locale:n,currencyCode:t.price.currencyCode})})]}),s&&(0,e.jsx)(a.Button,{size:"icon",variant:"link",onClick:()=>{b?.(u?void 0:t),l(t)},className:"size-auto shrink-0 underline",children:u?x?.remove:x?.add})]})]})};var ge=(0,X.withLayout)(xe);
1
+ "use strict";var at=Object.create;var w=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var nt=(l,e)=>{for(var s in e)w(l,s,{get:e[s],enumerable:!0})},M=(l,e,s,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of lt(e))!rt.call(l,o)&&o!==s&&w(l,o,{get:()=>e[o],enumerable:!(p=ot(e,o))||p.enumerable});return l};var V=(l,e,s)=>(s=l!=null?at(it(l)):{},M(e||!l||!l.__esModule?w(s,"default",{value:l,enumerable:!0}):s,l)),st=l=>M(w({},"__esModule",{value:!0}),l);var dt={};nt(dt,{default:()=>mt});module.exports=st(dt);var t=require("react/jsx-runtime"),a=require("../../../../../components/index.js"),k=require("../../../BizProductProvider.js"),I=require("../../../hooks/useComponentData.js"),m=require("react"),x=require("../../../utils/index.js"),B=require("../../../../AiuiProvider/index.js"),R=V(require("decimal.js")),q=require("../../../utils/textFormat.js"),W=require("../../../../../shared/Styles.js"),J=require("../../../../../components/index.js"),Q=require("../../../../../shared/track.js"),H=V(require("../../CartActionButtons/index.js"));const ct=()=>{const{locale:l="us",copyWriting:e,trackingData:s}=(0,B.useAiuiContext)(),{product:p,variant:o,finalPrice:u,comparePrice:g,coupon:h,selectedOptions:c,selectedVariants:v,totalSavings:D,onAddToCart:C,onBuyNow:P,savingDetail:d,checkedBundle:b,joinedRecommendBuyProducts:i,setJoinedRecommendBuyProducts:$,setSavingDetail:ut,addToCartLoading:K,buyNowLoading:U,notifyMeMode:X,onNotifyMeClick:Y,profile:A,addOrder:O,setAddOrder:S}=(0,k.useBizProductContext)(),_=s?.showComparePrice??!0,y=(0,I.useComponentData)("ProductSummary")??{},[G]=v,j=(0,m.useMemo)(()=>{let r=new R.default(G?.price?.amount||0);A?.email&&(r=r.minus(d?.member||0));const n=r.minus(d?.coupon).toNumber();return parseFloat(n.toFixed(2))},[G,b,A,d?.member,d?.coupon]),{giftVariant:z}=pt()||{},[f,E]=(0,m.useState)();(0,m.useEffect)(()=>{E({gift:i.gift?.value?void 0:z})},[z,i]);const Z=(0,m.useMemo)(()=>{const r=[];return O&&O.forEach((n,N)=>{i[n]?.value&&r.push({type:n,key:`${n}-${N}`})}),r},[O,i]),tt=(0,m.useMemo)(()=>{const r=c?.quantity||"",n=c?.color||c?.colour||c?.couleur||"";return`${r&&n?`${r} | ${n}`:r||n}`},[c?.quantity,c?.color,c?.colour,c?.couleur]),et=(0,m.useMemo)(()=>{const{image_1920:r,image_1440:n,image_1024:N,image_768:F,image_390:T}=y?.thumbnail||{};return(y?.thumbnail?`${r} 1920, ${n} 1440, ${N} 1024, ${F} 768, ${T} 390`:o.image?.url)||o.image?.url},[y?.thumbnail,o.image?.url]);return o.availableForSale?(0,t.jsx)("div",{className:"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16",children:(0,t.jsx)("div",{className:"laptop:rounded-2xl bg-[#F5F5F7]",children:(0,t.jsxs)(a.Grid,{className:"tablet:p-8 tablet:!pb-0 px-4 pt-6",children:[(0,t.jsxs)(a.GridItem,{className:"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4",children:[(0,t.jsx)(a.Heading,{className:"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]",html:y?.readyWant?.replace?.("{title}",p?.title)}),(0,t.jsx)("div",{className:"",children:(0,t.jsx)(a.Picture,{source:et,className:"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]",imgClassName:"object-cover h-full"})})]}),(0,t.jsxs)(a.GridItem,{className:"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)(J.ExposureDetector,{exposureKey:"listing_selector",onExposure:()=>{(0,Q.gaTrack)({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:`Product Detail Page${o.sku}`,component_type:"image",component_name:"listing_selector",position:1}})},children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(a.Picture,{source:o.image?.url||p?.images?.[0]?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,t.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,t.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:p.title}),(0,t.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:tt})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:(0,x.formatPrice)({amount:j,currencyCode:o.price.currencyCode,locale:l})}),_&&j<o?.price?.amount&&(0,t.jsx)(a.Text,{className:"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through",html:(0,x.formatPrice)({amount:o?.price?.amount,currencyCode:o.price.currencyCode,locale:l})})]})]})}),Z.map(({type:r,key:n})=>r==="gift"&&i?.gift?.value?(0,t.jsx)(L,{giftOperation:N=>{$?.({...i,gift:{value:void 0,canOperate:!0}}),E?.({...f,gift:N}),S?.(F=>F.filter(T=>T!=="gift"))},status:!!i?.gift,gift:i?.gift?.value,canOperate:i?.gift?.canOperate},n):null)]}),f?.gift&&(0,t.jsxs)("div",{className:"laptop-md:mt-8 mt-6",children:[(0,t.jsx)(a.Text,{className:"laptop-md:text-[18px] text-sm font-bold",html:y?.recommendBuy}),(0,t.jsx)("div",{className:"laptop-md:gap-4 mt-4 flex flex-col gap-6",children:f?.gift&&(0,t.jsx)(L,{giftOperation:r=>{$?.({...i,gift:{value:r,canOperate:!0}}),E?.({...f,gift:void 0}),S?.(n=>[...n,"gift"])},canOperate:i?.gift?.canOperate,status:!f?.gift,gift:f?.gift})})]})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)(a.Text,{className:"laptop:text-xl laptop-md:text-2xl text-right font-bold",html:`${(0,q.replaceTemplate)(e?.totalPrice||"",{amount:(0,x.formatPrice)({amount:parseFloat(u.toFixed(2)),currencyCode:o.price.currencyCode,locale:l})})}`}),_&&D>0&&(0,t.jsx)(a.Text,{className:"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through",html:(0,x.formatPrice)({amount:g,currencyCode:o.price.currencyCode,locale:l})}),(0,t.jsx)("div",{className:"mt-4 flex justify-end gap-3",children:(0,t.jsx)(H.default,{mode:X,availableForSale:o.availableForSale,addToCartText:e?.addToCart,buyNowText:e?.shopNow,addToCartLoading:K,buyNowLoading:U,addToCartClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",buyNowClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2",onAddToCart:C,onBuyNow:P,onNotifyMeClick:Y,notifyMeText:e?.notifyMe,notifyMeClassName:"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2"})})]})]})]})})}):null},pt=()=>{const{bundle:l,variant:e,checkedBundle:s,freeGift:p,checkedGift:o}=(0,k.useBizProductContext)();let u;const{giftList:g=[]}=p||{},[h]=g?.filter(c=>c.availableForSale)??[];return u=o||h,{giftVariant:u}},L=({giftOperation:l,gift:e,status:s,canOperate:p})=>{const{locale:o="us",copyWriting:u}=(0,B.useAiuiContext)(),{freeGift:g,setCheckedGift:h}=(0,k.useBizProductContext)(),{freeLabel:c}=g||{},{options:v}=e||{},D=(0,m.useMemo)(()=>{const C=v?.find(i=>i.name==="color"||i.name==="colour"||i.name==="couleur")||{},P=v?.find(i=>i.name==="quantity")||{},d=C?C.values?.[0]?.label:"",b=P?P.values?.[0]?.label:"";return`${d&&b?b+" | "+d:b||d} | ${c}`},[c,v]);return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(a.Picture,{source:e?.image?.url,className:"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2"}),(0,t.jsxs)("div",{className:"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]",children:[(0,t.jsx)(a.Text,{className:"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold",html:e?.product?.title}),(0,t.jsx)(a.Text,{className:"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]",html:D})]})]}),(0,t.jsxs)("div",{className:"flex flex-col items-end justify-center gap-2",children:[!!e&&(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold",html:c}),(0,t.jsx)(a.Text,{className:"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through",html:(0,x.formatPrice)({amount:e.price.amount,locale:o,currencyCode:e.price.currencyCode})})]}),p&&(0,t.jsx)(a.Button,{size:"icon",variant:"link",onClick:()=>{h?.(s?void 0:e),l(e)},className:"size-auto shrink-0 underline",children:s?u?.remove:u?.add})]})]})};var mt=(0,W.withLayout)(ct);
2
2
  //# sourceMappingURL=index.js.map