@anker-in/headless-ui 1.0.20-alpha.1761793143802 → 1.0.20-alpha.1761830686599

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 (69) hide show
  1. package/dist/cjs/biz-components/Listing/components/PaidShipping/LearnMore.js +1 -1
  2. package/dist/cjs/biz-components/Listing/components/PaidShipping/LearnMore.js.map +2 -2
  3. package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js +1 -1
  4. package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingMethod.js.map +2 -2
  5. package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js +1 -1
  6. package/dist/cjs/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js.map +2 -2
  7. package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js +1 -1
  8. package/dist/cjs/biz-components/Listing/components/PaidShipping/index.js.map +2 -2
  9. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
  10. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
  11. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.d.ts +1 -1
  12. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
  13. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +3 -3
  14. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  15. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +2 -2
  16. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
  17. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +2 -2
  18. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +1 -1
  19. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +2 -2
  20. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  21. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +3 -3
  22. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
  23. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js.map +2 -2
  24. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  25. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +2 -2
  26. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  27. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +2 -2
  28. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +1 -1
  29. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +3 -3
  30. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js +1 -1
  31. package/dist/cjs/biz-components/Listing/components/PurchaseBar/index.js.map +2 -2
  32. package/dist/cjs/biz-components/Listing/hooks/useBenefits.d.ts +1 -1
  33. package/dist/cjs/biz-components/Listing/hooks/useBenefits.js +1 -1
  34. package/dist/cjs/biz-components/Listing/hooks/useBenefits.js.map +3 -3
  35. package/dist/esm/biz-components/Listing/components/PaidShipping/LearnMore.js +1 -1
  36. package/dist/esm/biz-components/Listing/components/PaidShipping/LearnMore.js.map +2 -2
  37. package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js +1 -1
  38. package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingMethod.js.map +2 -2
  39. package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js +1 -1
  40. package/dist/esm/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.js.map +2 -2
  41. package/dist/esm/biz-components/Listing/components/PaidShipping/index.js +1 -1
  42. package/dist/esm/biz-components/Listing/components/PaidShipping/index.js.map +2 -2
  43. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
  44. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
  45. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.d.ts +1 -1
  46. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
  47. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +3 -3
  48. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
  49. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +2 -2
  50. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js +1 -1
  51. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFreeGift/index.js.map +2 -2
  52. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +1 -1
  53. package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +2 -2
  54. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
  55. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +3 -3
  56. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
  57. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js.map +2 -2
  58. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
  59. package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +2 -2
  60. package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  61. package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +2 -2
  62. package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js +1 -1
  63. package/dist/esm/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.js.map +3 -3
  64. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js +1 -1
  65. package/dist/esm/biz-components/Listing/components/PurchaseBar/index.js.map +2 -2
  66. package/dist/esm/biz-components/Listing/hooks/useBenefits.d.ts +1 -1
  67. package/dist/esm/biz-components/Listing/hooks/useBenefits.js +1 -1
  68. package/dist/esm/biz-components/Listing/hooks/useBenefits.js.map +3 -3
  69. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/biz-components/Listing/components/ProductCard/ProductSummary/index.tsx"],
4
- "sourcesContent": ["import { Text, Button, Container, Grid, GridItem, Picture, Heading } from '../../../../../components'\nimport type { ProductSummaryProps } from './types'\nimport { useBizProductContext } from '../../../BizProductProvider'\nimport { useEffect, useMemo, useState } from 'react'\nimport { formatPrice } from '../../../utils'\nimport { useAiuiContext } from '../../../../AiuiProvider'\nimport type { BundleListItem, ProductVariant } from '../../../types/product'\nimport { cn } from '../../../../../helpers'\nimport Decimal from 'decimal.js'\n\nconst ProductSummary = ({}: ProductSummaryProps) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const {\n product,\n variant,\n finalPrice,\n comparePrice,\n coupon,\n selectedOptions,\n onAddToCart,\n onBuyNow,\n savingDetail,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n } = useBizProductContext()\n\n const isAvailable = variant.availableForSale\n if (!isAvailable) return null\n\n const { bundleVariant, giftVariant } = useRecommendBuyProducts() || {}\n const [initialRecommendBuyProducts, setInitialRecommendBuyProducts] = useState<{\n bundle?: BundleListItem\n gift?: ProductVariant\n }>()\n\n useEffect(() => {\n setInitialRecommendBuyProducts({\n bundle: joinedRecommendBuyProducts.bundle ? undefined : bundleVariant,\n gift: joinedRecommendBuyProducts.gift ? undefined : giftVariant,\n })\n }, [bundleVariant, giftVariant, joinedRecommendBuyProducts])\n\n const comparePriceRemovedFreeGift = useMemo(\n () => new Decimal(comparePrice).minus(savingDetail.freeGift).toNumber(),\n [comparePrice, savingDetail]\n )\n\n return (\n <div className=\"ipc-product-summary bg-[#F5F5F7] mt-16\">\n <Grid className=\"px-4 py-6 tablet:p-8\">\n <GridItem className=\"col-span-12 desktop:col-start-1 desktop:col-span-5\">\n <Heading\n className=\"font-bold text-[24px] lg-desktop:text-[48px] laptop:text-[32px] desktop:text-[40px] leading-[1] mb-4 [&>span]:text-[#D1D1D1]\"\n html={`${product.title} is ready <br/><span>Just the way you want it.</span>`}\n />\n <div className=\"aspect-[644/320]\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"h-full w-full\"\n imgClassName=\"object-contain h-full\"\n />\n </div>\n </GridItem>\n <GridItem className=\"col-span-12 mt-8 desktop:col-start-7 laptop:mt-0 desktop:col-span-6 flex flex-col gap-6 justify-between\">\n <div>\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"shrink-0 flex items-center gap-4\">\n <Picture source={variant.image?.url || product?.images?.[0]?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] line-clamp-2 desktop:text-[16px] lg-desktop:text-[18px]\"\n html={product.title}\n />\n <Text\n className=\"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]\"\n html={`x1 | ${selectedOptions.color || selectedOptions.colour || selectedOptions.couleur}`}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"text-base desktop:text-2xl font-bold\"\n html={formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}\n />\n {coupon && (\n <Text\n className=\"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n </div>\n {joinedRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({ ...joinedRecommendBuyProducts, gift: undefined })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift })\n }}\n giftStatus={!!joinedRecommendBuyProducts?.gift}\n gift={joinedRecommendBuyProducts?.gift}\n />\n )}\n {joinedRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({ ...joinedRecommendBuyProducts, bundle: undefined })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle })\n }}\n bundleStatus={!!joinedRecommendBuyProducts?.bundle}\n bundleListItem={joinedRecommendBuyProducts?.bundle}\n />\n )}\n </div>\n {(initialRecommendBuyProducts?.bundle || initialRecommendBuyProducts?.gift) && (\n <div className=\"mt-6\">\n <Text className=\"text-sm desktop:text-[18px] font-bold\" html={'Recommend Buy'} />\n <div className=\"flex flex-col gap-6 mt-6\">\n {initialRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({ gift })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift: undefined })\n }}\n giftStatus={!initialRecommendBuyProducts?.gift}\n gift={initialRecommendBuyProducts?.gift}\n />\n )}\n {initialRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({ bundle })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle: undefined })\n }}\n bundleStatus={!initialRecommendBuyProducts?.bundle}\n bundleListItem={initialRecommendBuyProducts?.bundle}\n />\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"text-right\">\n <Text\n className=\"laptop:text-xl desktop:text-2xl font-bold text-right\"\n html={`${copyWriting?.totalPrice} ${formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}`}\n />\n\n {coupon && (\n <Text\n className=\"text-base desktop:text-2xl ml-1 font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n <div className=\"flex gap-3 mt-2\">\n <Button size=\"lg\" variant=\"secondary\" className=\"w-1/2\" onClick={() => onAddToCart?.()}>\n {copyWriting?.addToCart}\n </Button>\n <Button size=\"lg\" variant=\"primary\" className=\"w-1/2\" onClick={() => onBuyNow?.()}>\n {copyWriting?.shopNow}\n </Button>\n </div>\n </div>\n </GridItem>\n </Grid>\n </div>\n )\n}\n\nconst useRecommendBuyProducts = () => {\n const { bundle, variant, checkedBundle, freeGift, checkedGift } = useBizProductContext()\n let bundleVariant = undefined\n let giftVariant = undefined\n const { bundleList } = bundle || {}\n\n const { giftList = [] } = freeGift || {}\n\n const availableBundleList =\n bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n ) || []\n\n const [firstAvailableBundle] = availableBundleList\n bundleVariant = checkedBundle || firstAvailableBundle\n\n const [firstAvailableGift] = giftList?.filter(gift => gift.availableForSale)\n giftVariant = checkedGift || firstAvailableGift\n\n return { bundleVariant, giftVariant }\n}\n\nconst ProductBundleSummary = ({\n bundleOperation,\n bundleStatus,\n bundleListItem,\n}: {\n bundleOperation: (bundle: BundleListItem) => void\n bundleStatus: boolean\n bundleListItem: BundleListItem\n}) => {\n const { locale = 'us' } = useAiuiContext()\n const { variant, setCheckedBundle } = useBizProductContext()\n const bundleVariants = bundleListItem?.variants.filter(v => v.variant.sku !== variant.sku)\n\n return (\n <div className=\"flex items-center justify-between\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center gap-4\" key={bundleVariant.variant.id}>\n <Picture source={bundleVariant?.variant?.image?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] desktop:text-[16px] lg-desktop:text-[18px]\"\n html={bundleVariant.variant.product.title}\n />\n </div>\n </div>\n )\n })}\n <div className=\"flex flex-col items-end gap-1 justify-center\">\n {bundleStatus && (\n <Text\n className=\"text-base desktop:text-2xl font-bold\"\n html={formatPrice({\n amount: bundleVariants[0]?.price,\n locale,\n currencyCode: bundleVariants[0]?.variant?.price?.currencyCode,\n })}\n />\n )}\n <Button\n size={bundleStatus ? 'icon' : 'lg'}\n variant={bundleStatus ? 'link' : 'primary'}\n onClick={() => {\n setCheckedBundle?.(bundleStatus ? undefined : bundleListItem)\n bundleOperation(bundleListItem)\n }}\n className={cn('shrink-0 size-auto', {\n underline: bundleStatus,\n })}\n >\n {bundleStatus ? 'Remove' : 'Add +'}\n </Button>\n </div>\n </div>\n )\n}\n\nconst ProductGiftSummary = ({\n giftOperation,\n giftStatus,\n gift,\n}: {\n giftOperation: (gift: ProductVariant) => void\n giftStatus: boolean\n gift: ProductVariant\n}) => {\n const { locale = 'us' } = useAiuiContext()\n const { freeGift, setCheckedGift } = useBizProductContext()\n const { freeLabel } = freeGift || {}\n\n return (\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-4\">\n <Picture source={gift?.image?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] desktop:text-[16px] lg-desktop:text-[18px]\"\n html={gift?.product?.title}\n />\n <Text\n className=\"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]\"\n html={`x1 | ${freeLabel}`}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end gap-2 justify-center\">\n {giftStatus && (\n <div className=\"flex items-center gap-1\">\n <Text className=\"text-base desktop:text-2xl font-bold\" html={freeLabel} />\n <Text\n className=\"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n )}\n <Button\n size={giftStatus ? 'icon' : 'lg'}\n variant={giftStatus ? 'link' : 'primary'}\n onClick={() => {\n setCheckedGift?.(giftStatus ? undefined : gift)\n giftOperation(gift)\n }}\n className={cn('shrink-0 size-auto', {\n underline: giftStatus,\n })}\n >\n {giftStatus ? 'Remove' : 'Add +'}\n </Button>\n </div>\n </div>\n )\n}\n\nexport default ProductSummary\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAkDQ,IAAAI,EAAA,6BAlDRC,EAA0E,qCAE1EC,EAAqC,uCACrCC,EAA6C,iBAC7CC,EAA4B,0BAC5BC,EAA+B,oCAE/BC,EAAmB,kCACnBC,EAAoB,yBAEpB,MAAMC,EAAiB,CAAC,CAAC,IAA2B,CAClD,KAAM,CAAE,OAAAC,EAAS,KAAM,YAAAC,CAAY,KAAI,kBAAe,EAChD,CACJ,QAAAC,EACA,QAAAC,EACA,WAAAC,EACA,aAAAC,EACA,OAAAC,EACA,gBAAAC,EACA,YAAAC,EACA,SAAAC,EACA,aAAAC,EACA,2BAAAC,EACA,8BAAAC,CACF,KAAI,wBAAqB,EAGzB,GAAI,CADgBT,EAAQ,iBACV,OAAO,KAEzB,KAAM,CAAE,cAAAU,EAAe,YAAAC,CAAY,EAAIC,EAAwB,GAAK,CAAC,EAC/D,CAACC,EAA6BC,CAA8B,KAAI,YAGnE,KAEH,aAAU,IAAM,CACdA,EAA+B,CAC7B,OAAQN,EAA2B,OAAS,OAAYE,EACxD,KAAMF,EAA2B,KAAO,OAAYG,CACtD,CAAC,CACH,EAAG,CAACD,EAAeC,EAAaH,CAA0B,CAAC,EAE3D,MAAMO,KAA8B,WAClC,IAAM,IAAI,EAAAC,QAAQd,CAAY,EAAE,MAAMK,EAAa,QAAQ,EAAE,SAAS,EACtE,CAACL,EAAcK,CAAY,CAC7B,EAEA,SACE,OAAC,OAAI,UAAU,yCACb,oBAAC,QAAK,UAAU,uB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3B,GACF,GACF,CAEJ,EAEA,IAAOlD,EAAQU",
4
+ "sourcesContent": ["import { Text, Button, Container, Grid, GridItem, Picture, Heading } from '../../../../../components'\nimport type { ProductSummaryProps } from './types'\nimport { useBizProductContext } from '../../../BizProductProvider'\nimport { useEffect, useMemo, useState } from 'react'\nimport { formatPrice } from '../../../utils'\nimport { useAiuiContext } from '../../../../AiuiProvider'\nimport type { BundleListItem, ProductVariant } from '../../../types/product'\nimport { cn } from '../../../../../helpers'\nimport Decimal from 'decimal.js'\n\nconst ProductSummary = ({}: ProductSummaryProps) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const {\n product,\n variant,\n finalPrice,\n comparePrice,\n coupon,\n selectedOptions,\n onAddToCart,\n onBuyNow,\n savingDetail,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n } = useBizProductContext()\n\n const isAvailable = variant.availableForSale\n if (!isAvailable) return null\n\n const { bundleVariant, giftVariant } = useRecommendBuyProducts() || {}\n const [initialRecommendBuyProducts, setInitialRecommendBuyProducts] = useState<{\n bundle?: BundleListItem\n gift?: ProductVariant\n }>()\n\n useEffect(() => {\n setInitialRecommendBuyProducts({\n bundle: joinedRecommendBuyProducts.bundle ? undefined : bundleVariant,\n gift: joinedRecommendBuyProducts.gift ? undefined : giftVariant,\n })\n }, [bundleVariant, giftVariant, joinedRecommendBuyProducts])\n\n const comparePriceRemovedFreeGift = useMemo(\n () => new Decimal(comparePrice).minus(savingDetail.freeGift).toNumber(),\n [comparePrice, savingDetail]\n )\n\n return (\n <div className=\"ipc-product-summary laptop:px-16 desktop:px-0 mt-8 \">\n <div className=\"bg-[#F5F5F7] laptop:rounded-2xl\">\n <Grid className=\"px-4 py-6 tablet:p-8\">\n <GridItem className=\"col-span-12 laptop:col-start-1 laptop:col-span-5\">\n <Heading\n className=\"font-bold text-[24px] lg-desktop:text-[48px] laptop:text-[32px] desktop:text-[40px] leading-[1] mb-4 [&>span]:text-[#D1D1D1]\"\n html={`${product.title} is ready <br/><span>Just the way you want it.</span>`}\n />\n <div className=\"aspect-[644/320]\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"h-full w-full\"\n imgClassName=\"object-contain h-full\"\n />\n </div>\n </GridItem>\n <GridItem className=\"col-span-12 mt-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 flex flex-col gap-6 justify-between\">\n <div>\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between\">\n <div className=\"shrink-0 flex items-center gap-4\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"size-16 object-cover\"\n />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] line-clamp-2 desktop:text-[16px] lg-desktop:text-[18px]\"\n html={product.title}\n />\n <Text\n className=\"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]\"\n html={`x1 | ${selectedOptions.color || selectedOptions.colour || selectedOptions.couleur}`}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"text-base desktop:text-2xl laptop:text-xl font-bold\"\n html={formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}\n />\n {coupon && (\n <Text\n className=\"text-base desktop:text-2xl laptop:text-xl font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n </div>\n {joinedRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({ ...joinedRecommendBuyProducts, gift: undefined })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift })\n }}\n giftStatus={!!joinedRecommendBuyProducts?.gift}\n gift={joinedRecommendBuyProducts?.gift}\n />\n )}\n {joinedRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({ ...joinedRecommendBuyProducts, bundle: undefined })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle })\n }}\n bundleStatus={!!joinedRecommendBuyProducts?.bundle}\n bundleListItem={joinedRecommendBuyProducts?.bundle}\n />\n )}\n </div>\n {(initialRecommendBuyProducts?.bundle || initialRecommendBuyProducts?.gift) && (\n <div className=\"mt-6\">\n <Text className=\"text-sm desktop:text-[18px] font-bold\" html={'Recommend Buy'} />\n <div className=\"flex flex-col gap-6 mt-6\">\n {initialRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({ gift })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift: undefined })\n }}\n giftStatus={!initialRecommendBuyProducts?.gift}\n gift={initialRecommendBuyProducts?.gift}\n />\n )}\n {initialRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({ bundle })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle: undefined })\n }}\n bundleStatus={!initialRecommendBuyProducts?.bundle}\n bundleListItem={initialRecommendBuyProducts?.bundle}\n />\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"text-right\">\n <Text\n className=\"laptop:text-xl desktop:text-2xl font-bold text-right\"\n html={`${copyWriting?.totalPrice} ${formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}`}\n />\n\n {coupon && (\n <Text\n className=\"text-base laptop:text-xl desktop:text-2xl ml-1 font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n <div className=\"flex gap-3 mt-2\">\n <Button size=\"lg\" variant=\"secondary\" className=\"w-1/2\" onClick={() => onAddToCart?.()}>\n {copyWriting?.addToCart}\n </Button>\n <Button size=\"lg\" variant=\"primary\" className=\"w-1/2\" onClick={() => onBuyNow?.()}>\n {copyWriting?.shopNow}\n </Button>\n </div>\n </div>\n </GridItem>\n </Grid>\n </div>\n </div>\n )\n}\n\nconst useRecommendBuyProducts = () => {\n const { bundle, variant, checkedBundle, freeGift, checkedGift } = useBizProductContext()\n let bundleVariant = undefined\n let giftVariant = undefined\n const { bundleList } = bundle || {}\n\n const { giftList = [] } = freeGift || {}\n\n const availableBundleList =\n bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n ) || []\n\n const [firstAvailableBundle] = availableBundleList\n bundleVariant = checkedBundle || firstAvailableBundle\n\n const [firstAvailableGift] = giftList?.filter(gift => gift.availableForSale)\n giftVariant = checkedGift || firstAvailableGift\n\n return { bundleVariant, giftVariant }\n}\n\nconst ProductBundleSummary = ({\n bundleOperation,\n bundleStatus,\n bundleListItem,\n}: {\n bundleOperation: (bundle: BundleListItem) => void\n bundleStatus: boolean\n bundleListItem: BundleListItem\n}) => {\n const { locale = 'us' } = useAiuiContext()\n const { variant, setCheckedBundle } = useBizProductContext()\n const bundleVariants = bundleListItem?.variants.filter(v => v.variant.sku !== variant.sku)\n\n return (\n <div className=\"flex items-center justify-between\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center gap-4\" key={bundleVariant.variant.id}>\n <Picture source={bundleVariant?.variant?.image?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] line-clamp-2 max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] desktop:text-[16px] lg-desktop:text-[18px]\"\n html={bundleVariant.variant.product.title}\n />\n </div>\n </div>\n )\n })}\n <div className=\"flex flex-col items-end gap-1 justify-center\">\n {bundleStatus && (\n <Text\n className=\"text-base desktop:text-2xl font-bold\"\n html={formatPrice({\n amount: bundleVariants[0]?.price,\n locale,\n currencyCode: bundleVariants[0]?.variant?.price?.currencyCode,\n })}\n />\n )}\n <Button\n size={bundleStatus ? 'icon' : 'lg'}\n variant={bundleStatus ? 'link' : 'primary'}\n onClick={() => {\n setCheckedBundle?.(bundleStatus ? undefined : bundleListItem)\n bundleOperation(bundleListItem)\n }}\n className={cn('shrink-0 size-auto', {\n underline: bundleStatus,\n })}\n >\n {bundleStatus ? 'Remove' : 'Add +'}\n </Button>\n </div>\n </div>\n )\n}\n\nconst ProductGiftSummary = ({\n giftOperation,\n giftStatus,\n gift,\n}: {\n giftOperation: (gift: ProductVariant) => void\n giftStatus: boolean\n gift: ProductVariant\n}) => {\n const { locale = 'us' } = useAiuiContext()\n const { freeGift, setCheckedGift } = useBizProductContext()\n const { freeLabel } = freeGift || {}\n\n return (\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-4\">\n <Picture source={gift?.image?.url} className=\"size-16 object-cover\" />\n <div className=\"flex flex-col gap-[6px] max-w-[178px] tablet:max-w-none\">\n <Text\n className=\"font-bold text-[14px] line-clamp-2 desktop:text-[16px] lg-desktop:text-[18px]\"\n html={gift?.product?.title}\n />\n <Text\n className=\"text-[12px] laptop:text-[14px] desktop:text-[18px] font-bold text-[#6D6D6F]\"\n html={`x1 | ${freeLabel}`}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end gap-2 justify-center\">\n {giftStatus && (\n <div className=\"flex items-center gap-1\">\n <Text className=\"text-base desktop:text-2xl font-bold\" html={freeLabel} />\n <Text\n className=\"text-base desktop:text-2xl font-bold line-through text-[#6D6D6F]\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n )}\n <Button\n size={giftStatus ? 'icon' : 'lg'}\n variant={giftStatus ? 'link' : 'primary'}\n onClick={() => {\n setCheckedGift?.(giftStatus ? undefined : gift)\n giftOperation(gift)\n }}\n className={cn('shrink-0 size-auto', {\n underline: giftStatus,\n })}\n >\n {giftStatus ? 'Remove' : 'Add +'}\n </Button>\n </div>\n </div>\n )\n}\n\nexport default ProductSummary\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA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EAEMd,EAAqB,CAAC,CAC1B,cAAAkB,EACA,WAAAC,EACA,KAAAlB,CACF,IAIM,CACJ,KAAM,CAAE,OAAArB,EAAS,IAAK,KAAI,kBAAe,EACnC,CAAE,SAAAyB,EAAU,eAAAe,CAAe,KAAI,wBAAqB,EACpD,CAAE,UAAAC,CAAU,EAAIhB,GAAY,CAAC,EAEnC,SACE,QAAC,OAAI,UAAU,oCACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,WAAQ,OAAQJ,GAAM,OAAO,IAAK,UAAU,uBAAuB,KACpE,QAAC,OAAI,UAAU,0DACb,oBAAC,QACC,UAAU,gFACV,KAAMA,GAAM,SAAS,MACvB,KACA,OAAC,QACC,UAAU,8EACV,KAAM,QAAQoB,CAAS,GACzB,GACF,GACF,KACA,QAAC,OAAI,UAAU,+CACZ,UAAAF,MACC,QAAC,OAAI,UAAU,0BACb,oBAAC,QAAK,UAAU,uCAAuC,KAAME,EAAW,KACxE,OAAC,QACC,UAAU,mEACV,QAAM,eAAY,CAChB,OAAQpB,EAAK,MAAM,OACnB,OAAArB,EACA,aAAcqB,EAAK,MAAM,YAC3B,CAAC,EACH,GACF,KAEF,OAAC,UACC,KAAMkB,EAAa,OAAS,KAC5B,QAASA,EAAa,OAAS,UAC/B,QAAS,IAAM,CACbC,IAAiBD,EAAa,OAAYlB,CAAI,EAC9CiB,EAAcjB,CAAI,CACpB,EACA,aAAW,MAAG,qBAAsB,CAClC,UAAWkB,CACb,CAAC,EAEA,SAAAA,EAAa,SAAW,QAC3B,GACF,GACF,CAEJ,EAEA,IAAOlD,EAAQU",
6
6
  "names": ["ProductSummary_exports", "__export", "ProductSummary_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_BizProductProvider", "import_react", "import_utils", "import_AiuiProvider", "import_helpers", "import_decimal", "ProductSummary", "locale", "copyWriting", "product", "variant", "finalPrice", "comparePrice", "coupon", "selectedOptions", "onAddToCart", "onBuyNow", "savingDetail", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "bundleVariant", "giftVariant", "useRecommendBuyProducts", "initialRecommendBuyProducts", "setInitialRecommendBuyProducts", "comparePriceRemovedFreeGift", "Decimal", "ProductGiftSummary", "gift", "ProductBundleSummary", "bundle", "checkedBundle", "freeGift", "checkedGift", "bundleList", "giftList", "availableBundleList", "v", "firstAvailableBundle", "firstAvailableGift", "bundleOperation", "bundleStatus", "bundleListItem", "setCheckedBundle", "bundleVariants", "giftOperation", "giftStatus", "setCheckedGift", "freeLabel"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var y=Object.create;var n=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var P=(t,e)=>{for(var a in e)n(t,a,{get:e[a],enumerable:!0})},x=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of w(e))!B.call(t,i)&&i!==a&&n(t,i,{get:()=>e[i],enumerable:!(r=C(e,i))||r.enumerable});return t};var S=(t,e,a)=>(a=t!=null?y(h(t)):{},x(e||!t||!t.__esModule?n(a,"default",{value:t,enumerable:!0}):a,t)),A=t=>x(n({},"__esModule",{value:!0}),t);var z={};P(z,{default:()=>k});module.exports=A(z);var o=require("react/jsx-runtime"),l=require("../../../../../components"),p=require("../../../../AiuiProvider/index.js"),f=require("../../../BizProductProvider.js"),v=require("react"),c=require("../../../utils"),s=S(require("decimal.js"));const F=()=>{const{copyWriting:t,locale:e="us"}=(0,p.useAiuiContext)(),{variant:a,finalPrice:r,totalSavings:i,comparePrice:d,onAddToCart:g,onBuyNow:N,savingDetail:m,coupon:u}=(0,f.useBizProductContext)();console.log(m,"savingDetail");const b=(0,v.useMemo)(()=>new s.default(d).minus(m.freeGift).toNumber(),[d,m]);return(0,o.jsxs)("div",{className:"bg-white py-3 px-4 tablet:p-0 tablet:flex tablet:items-center tablet:gap-4",children:[a.availableForSale?(0,o.jsxs)("div",{className:"flex items-center justify-between tablet:flex-col desktop:items-end",children:[(0,o.jsxs)("div",{className:"flex items-center gap-1",children:[(0,o.jsx)(l.Text,{className:"text-xl font-bold leading-[1.2] tablet:text-2xl",html:(0,c.formatPrice)({amount:r,currencyCode:a.price.currencyCode,locale:e})}),u&&(0,o.jsx)(l.Text,{className:"text-xl font-bold line-through text-[#999] leading-[1.2] tablet:text-2xl",html:(0,c.formatPrice)({amount:b,currencyCode:a.price.currencyCode,locale:e})})]}),u&&(0,o.jsx)(l.Text,{className:"text-brand-0 text-base leading-[1.4] font-bold tablet:text-2xl",html:`${t?.totalSavings} ${(0,c.formatPrice)({amount:new s.default(b).minus(new s.default(r)).toNumber(),currencyCode:a.price.currencyCode,locale:e})}`})]}):(0,o.jsx)(l.Text,{className:"text-[20px] font-bold text-[#999999]",html:t?.soldOut??"Sold Out"}),(0,o.jsxs)("div",{className:"flex items-center gap-2 mt-2 tablet:mt-0",children:[(0,o.jsx)(l.Button,{variant:"secondary",disabled:!a.availableForSale,size:"lg",className:"w-1/2 tablet:w-auto",onClick:()=>g?.(),children:t?.addToCart??"Add to Cart"}),(0,o.jsx)(l.Button,{variant:"primary",disabled:!a.availableForSale,size:"lg",className:"w-1/2 tablet:w-auto",onClick:()=>N?.(),children:t?.buyNow??"Buy Now"})]})]})};var k=F;
1
+ "use strict";var y=Object.create;var n=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var B=(t,e)=>{for(var a in e)n(t,a,{get:e[a],enumerable:!0})},d=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of C(e))!h.call(t,l)&&l!==a&&n(t,l,{get:()=>e[l],enumerable:!(r=N(e,l))||r.enumerable});return t};var P=(t,e,a)=>(a=t!=null?y(w(t)):{},d(e||!t||!t.__esModule?n(a,"default",{value:t,enumerable:!0}):a,t)),S=t=>d(n({},"__esModule",{value:!0}),t);var k={};B(k,{default:()=>F});module.exports=S(k);var o=require("react/jsx-runtime"),i=require("../../../../../components"),u=require("../../../../AiuiProvider/index.js"),b=require("../../../BizProductProvider.js"),x=require("react"),c=require("../../../utils"),p=P(require("decimal.js"));const A=()=>{const{copyWriting:t,locale:e="us"}=(0,u.useAiuiContext)(),{variant:a,finalPrice:r,totalSavings:l,comparePrice:s,onAddToCart:f,onBuyNow:v,savingDetail:m,coupon:z}=(0,b.useBizProductContext)(),g=(0,x.useMemo)(()=>new p.default(s).minus(m.freeGift).toNumber(),[s,m]);return(0,o.jsxs)("div",{className:"bg-white py-3 px-4 tablet:p-0 tablet:flex tablet:items-center tablet:gap-4",children:[a.availableForSale?(0,o.jsxs)("div",{className:"flex items-center justify-between tablet:flex-col desktop:items-end",children:[(0,o.jsxs)("div",{className:"flex items-center gap-1",children:[(0,o.jsx)(i.Text,{className:"text-xl font-bold leading-[1.2] tablet:text-2xl",html:(0,c.formatPrice)({amount:r,currencyCode:a.price.currencyCode,locale:e})}),l>0&&(0,o.jsx)(i.Text,{className:"text-xl font-bold line-through text-[#999] leading-[1.2] tablet:text-2xl",html:(0,c.formatPrice)({amount:g,currencyCode:a.price.currencyCode,locale:e})})]}),l>0&&(0,o.jsx)(i.Text,{className:"text-brand-0 text-base leading-[1.4] font-bold tablet:text-2xl",html:`${t?.totalSavings} ${(0,c.formatPrice)({amount:l,currencyCode:a.price.currencyCode,locale:e})}`})]}):(0,o.jsx)(i.Text,{className:"text-[20px] font-bold text-[#999999]",html:t?.soldOut??"Sold Out"}),(0,o.jsxs)("div",{className:"flex items-center gap-2 mt-2 tablet:mt-0",children:[(0,o.jsx)(i.Button,{variant:"secondary",disabled:!a.availableForSale,size:"lg",className:"w-1/2 tablet:w-auto",onClick:()=>f?.(),children:t?.addToCart??"Add to Cart"}),(0,o.jsx)(i.Button,{variant:"primary",disabled:!a.availableForSale,size:"lg",className:"w-1/2 tablet:w-auto",onClick:()=>v?.(),children:t?.buyNow??"Buy Now"})]})]})};var F=A;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/biz-components/Listing/components/PurchaseBar/ProductActions/index.tsx"],
4
- "sourcesContent": ["import { Text, Button } from '../../../../../components'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useMemo } from 'react'\nimport { formatPrice } from '../../../utils'\nimport Decimal from 'decimal.js'\n\nconst ProductActions = () => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n const { variant, finalPrice, totalSavings, comparePrice, onAddToCart, onBuyNow, savingDetail, coupon } =\n useBizProductContext()\n\n console.log(savingDetail, 'savingDetail')\n\n const comparePriceRemovedFreeGift = useMemo(\n () => new Decimal(comparePrice).minus(savingDetail.freeGift).toNumber(),\n [comparePrice, savingDetail]\n )\n\n return (\n <div className=\"bg-white py-3 px-4 tablet:p-0 tablet:flex tablet:items-center tablet:gap-4\">\n {variant.availableForSale ? (\n <div className=\"flex items-center justify-between tablet:flex-col desktop:items-end\">\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"text-xl font-bold leading-[1.2] tablet:text-2xl\"\n html={formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}\n />\n {coupon &&<Text\n className=\"text-xl font-bold line-through text-[#999] leading-[1.2] tablet:text-2xl\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />}\n </div>\n {coupon && (\n <Text\n className=\"text-brand-0 text-base leading-[1.4] font-bold tablet:text-2xl\"\n html={`${copyWriting?.totalSavings} ${formatPrice({ amount: new Decimal(comparePriceRemovedFreeGift).minus(new Decimal(finalPrice)).toNumber(), currencyCode: variant.price.currencyCode, locale })}`}\n />\n )}\n </div>\n ) : (\n <Text className=\"text-[20px] font-bold text-[#999999]\" html={copyWriting?.soldOut ?? 'Sold Out'} />\n )}\n <div className=\"flex items-center gap-2 mt-2 tablet:mt-0\">\n <Button\n variant=\"secondary\"\n disabled={!variant.availableForSale}\n size=\"lg\"\n className=\"w-1/2 tablet:w-auto\"\n onClick={() => onAddToCart?.()}\n >\n {copyWriting?.addToCart ?? 'Add to Cart'}\n </Button>\n <Button\n variant=\"primary\"\n disabled={!variant.availableForSale}\n size=\"lg\"\n className=\"w-1/2 tablet:w-auto\"\n onClick={() => onBuyNow?.()}\n >\n {copyWriting?.buyNow ?? 'Buy Now'}\n </Button>\n </div>\n </div>\n )\n}\n\nexport default ProductActions\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAuBU,IAAAI,EAAA,6BAvBVC,EAA6B,qCAC7BC,EAA+B,6CAC/BC,EAAqC,0CACrCC,EAAwB,iBACxBC,EAA4B,0BAC5BC,EAAoB,yBAEpB,MAAMC,EAAiB,IAAM,CAC3B,KAAM,CAAE,YAAAC,EAAa,OAAAC,EAAS,IAAK,KAAI,kBAAe,EAChD,CAAE,QAAAC,EAAS,WAAAC,EAAY,aAAAC,EAAc,aAAAC,EAAc,YAAAC,EAAa,SAAAC,EAAU,aAAAC,EAAc,OAAAC,CAAO,KACnG,wBAAqB,EAErB,QAAQ,IAAID,EAAc,cAAc,EAE1C,MAAME,KAA8B,WAClC,IAAM,IAAI,EAAAC,QAAQN,CAAY,EAAE,MAAMG,EAAa,QAAQ,EAAE,SAAS,EACtE,CAACH,EAAcG,CAAY,CAC7B,EAEA,SACE,QAAC,OAAI,UAAU,6EACZ,UAAAN,EAAQ,oBACP,QAAC,OAAI,UAAU,sEACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,QACC,UAAU,kDACV,QAAM,eAAY,CAAE,OAAQC,EAAY,aAAcD,EAAQ,MAAM,aAAc,OAAAD,CAAO,CAAC,EAC5F,EACCQ,MAAS,OAAC,QACT,UAAU,2EACV,QAAM,eAAY,CAChB,OAAQC,EACR,aAAcR,EAAQ,MAAM,aAC5B,OAAAD,CACF,CAAC,EACH,GACF,EACCQ,MACC,OAAC,QACC,UAAU,iEACV,KAAM,GAAGT,GAAa,YAAY,OAAI,eAAY,CAAE,OAAQ,IAAI,EAAAW,QAAQD,CAA2B,EAAE,MAAM,IAAI,EAAAC,QAAQR,CAAU,CAAC,EAAE,SAAS,EAAG,aAAcD,EAAQ,MAAM,aAAc,OAAAD,CAAO,CAAC,CAAC,GACrM,GAEJ,KAEA,OAAC,QAAK,UAAU,uCAAuC,KAAMD,GAAa,SAAW,WAAY,KAEnG,QAAC,OAAI,UAAU,2CACb,oBAAC,UACC,QAAQ,YACR,SAAU,CAACE,EAAQ,iBACnB,KAAK,KACL,UAAU,sBACV,QAAS,IAAMI,IAAc,EAE5B,SAAAN,GAAa,WAAa,cAC7B,KACA,OAAC,UACC,QAAQ,UACR,SAAU,CAACE,EAAQ,iBACnB,KAAK,KACL,UAAU,sBACV,QAAS,IAAMK,IAAW,EAEzB,SAAAP,GAAa,QAAU,UAC1B,GACF,GACF,CAEJ,EAEA,IAAOV,EAAQS",
4
+ "sourcesContent": ["import { Text, Button } from '../../../../../components'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useMemo } from 'react'\nimport { formatPrice } from '../../../utils'\nimport Decimal from 'decimal.js'\n\nconst ProductActions = () => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n const { variant, finalPrice, totalSavings, comparePrice, onAddToCart, onBuyNow, savingDetail, coupon } =\n useBizProductContext()\n\n const comparePriceRemovedFreeGift = useMemo(\n () => new Decimal(comparePrice).minus(savingDetail.freeGift).toNumber(),\n [comparePrice, savingDetail]\n )\n\n return (\n <div className=\"bg-white py-3 px-4 tablet:p-0 tablet:flex tablet:items-center tablet:gap-4\">\n {variant.availableForSale ? (\n <div className=\"flex items-center justify-between tablet:flex-col desktop:items-end\">\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"text-xl font-bold leading-[1.2] tablet:text-2xl\"\n html={formatPrice({ amount: finalPrice, currencyCode: variant.price.currencyCode, locale })}\n />\n {totalSavings > 0 && (\n <Text\n className=\"text-xl font-bold line-through text-[#999] leading-[1.2] tablet:text-2xl\"\n html={formatPrice({\n amount: comparePriceRemovedFreeGift,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n {totalSavings > 0 && (\n <Text\n className=\"text-brand-0 text-base leading-[1.4] font-bold tablet:text-2xl\"\n html={`${copyWriting?.totalSavings} ${formatPrice({ amount: totalSavings, currencyCode: variant.price.currencyCode, locale })}`}\n />\n )}\n </div>\n ) : (\n <Text className=\"text-[20px] font-bold text-[#999999]\" html={copyWriting?.soldOut ?? 'Sold Out'} />\n )}\n <div className=\"flex items-center gap-2 mt-2 tablet:mt-0\">\n <Button\n variant=\"secondary\"\n disabled={!variant.availableForSale}\n size=\"lg\"\n className=\"w-1/2 tablet:w-auto\"\n onClick={() => onAddToCart?.()}\n >\n {copyWriting?.addToCart ?? 'Add to Cart'}\n </Button>\n <Button\n variant=\"primary\"\n disabled={!variant.availableForSale}\n size=\"lg\"\n className=\"w-1/2 tablet:w-auto\"\n onClick={() => onBuyNow?.()}\n >\n {copyWriting?.buyNow ?? 'Buy Now'}\n </Button>\n </div>\n </div>\n )\n}\n\nexport default ProductActions\n"],
5
+ "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAqBU,IAAAI,EAAA,6BArBVC,EAA6B,qCAC7BC,EAA+B,6CAC/BC,EAAqC,0CACrCC,EAAwB,iBACxBC,EAA4B,0BAC5BC,EAAoB,yBAEpB,MAAMC,EAAiB,IAAM,CAC3B,KAAM,CAAE,YAAAC,EAAa,OAAAC,EAAS,IAAK,KAAI,kBAAe,EAChD,CAAE,QAAAC,EAAS,WAAAC,EAAY,aAAAC,EAAc,aAAAC,EAAc,YAAAC,EAAa,SAAAC,EAAU,aAAAC,EAAc,OAAAC,CAAO,KACnG,wBAAqB,EAEjBC,KAA8B,WAClC,IAAM,IAAI,EAAAC,QAAQN,CAAY,EAAE,MAAMG,EAAa,QAAQ,EAAE,SAAS,EACtE,CAACH,EAAcG,CAAY,CAC7B,EAEA,SACE,QAAC,OAAI,UAAU,6EACZ,UAAAN,EAAQ,oBACP,QAAC,OAAI,UAAU,sEACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,QACC,UAAU,kDACV,QAAM,eAAY,CAAE,OAAQC,EAAY,aAAcD,EAAQ,MAAM,aAAc,OAAAD,CAAO,CAAC,EAC5F,EACCG,EAAe,MACd,OAAC,QACC,UAAU,2EACV,QAAM,eAAY,CAChB,OAAQM,EACR,aAAcR,EAAQ,MAAM,aAC5B,OAAAD,CACF,CAAC,EACH,GAEJ,EACCG,EAAe,MACd,OAAC,QACC,UAAU,iEACV,KAAM,GAAGJ,GAAa,YAAY,OAAI,eAAY,CAAE,OAAQI,EAAc,aAAcF,EAAQ,MAAM,aAAc,OAAAD,CAAO,CAAC,CAAC,GAC/H,GAEJ,KAEA,OAAC,QAAK,UAAU,uCAAuC,KAAMD,GAAa,SAAW,WAAY,KAEnG,QAAC,OAAI,UAAU,2CACb,oBAAC,UACC,QAAQ,YACR,SAAU,CAACE,EAAQ,iBACnB,KAAK,KACL,UAAU,sBACV,QAAS,IAAMI,IAAc,EAE5B,SAAAN,GAAa,WAAa,cAC7B,KACA,OAAC,UACC,QAAQ,UACR,SAAU,CAACE,EAAQ,iBACnB,KAAK,KACL,UAAU,sBACV,QAAS,IAAMK,IAAW,EAEzB,SAAAP,GAAa,QAAU,UAC1B,GACF,GACF,CAEJ,EAEA,IAAOV,EAAQS",
6
6
  "names": ["ProductActions_exports", "__export", "ProductActions_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_AiuiProvider", "import_BizProductProvider", "import_react", "import_utils", "import_decimal", "ProductActions", "copyWriting", "locale", "variant", "finalPrice", "totalSavings", "comparePrice", "onAddToCart", "onBuyNow", "savingDetail", "coupon", "comparePriceRemovedFreeGift", "Decimal"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var k=(o,e)=>{for(var a in e)c(o,a,{get:e[a],enumerable:!0})},C=(o,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of y(e))!g.call(o,l)&&l!==a&&c(o,l,{get:()=>e[l],enumerable:!(s=h(e,l))||s.enumerable});return o};var w=o=>C(c({},"__esModule",{value:!0}),o);var E={};k(E,{DesktopScrollSpyNav:()=>b,MobileScrollSpyNav:()=>u});module.exports=w(E);var t=require("react/jsx-runtime"),A=require("../../../../AiuiProvider/index.js"),p=require("../../../../../helpers/index.js"),n=require("react"),f=require("gsap"),m=require("../../../BizProductProvider.js");const u=({tabs:o,purchaseBarHeight:e,onSpyNavItemClick:a})=>{const[s,l]=(0,n.useState)(!1),[r,v]=(0,n.useState)(o?.[0]),d=(0,n.useRef)(null),{renderRating:x}=(0,m.useBizProductContext)(),N=(0,n.useCallback)(i=>{v(i),a?.(i),l(!1)},[]),S=(0,n.useCallback)(()=>{l(!s),f.gsap.fromTo(d?.current,{height:0},{height:"auto",duration:.5,ease:"power2.inOut"})},[s]);return(0,t.jsxs)("div",{children:[(0,t.jsx)("button",{className:"text-sm h-[28px] font-bold leading-[28px] px-[10px] border rounded-full border-black",onClick:S,children:r?.label}),(0,t.jsxs)("div",{className:(0,p.cn)("absolute top-full w-full flex flex-col z-[60] bg-black/60 left-0",{hidden:!s}),style:{height:`calc(100dvh - ${e}px)`},children:[(0,t.jsxs)("div",{ref:d,className:"border-t overflow-hidden border-[#E4E5E6] flex flex-col bg-white",children:[o?.map(i=>(0,t.jsx)("button",{className:"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold",onClick:()=>N(i),children:i.label},i.id)),(0,t.jsx)("button",{className:"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold",children:x})]}),(0,t.jsx)("div",{className:"flex-1",onClick:()=>l(!1)})]})]})},b=({tabs:o,onSpyNavItemClick:e})=>{const[a,s]=(0,n.useState)(o?.[0]),l=(0,n.useCallback)(r=>{s(r),e?.(r)},[]);return(0,t.jsx)("div",{className:"flex gap-8",children:o?.map(r=>(0,t.jsxs)("button",{className:"text-sm relative py-[10px] font-bold",onClick:()=>l(r),children:[r.label,(0,t.jsx)("div",{className:(0,p.cn)("absolute bottom-0 left-0 w-0 transition-all duration-300 ease-in-out h-[2px] bg-brand-0",{"w-full":a?.id===r.id})})]},r.id))})};
1
+ "use strict";var c=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var k=(e,t)=>{for(var s in t)c(e,s,{get:t[s],enumerable:!0})},y=(e,t,s,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of w(t))!N.call(e,l)&&l!==s&&c(e,l,{get:()=>t[l],enumerable:!(a=g(t,l))||a.enumerable});return e};var C=e=>y(c({},"__esModule",{value:!0}),e);var A={};k(A,{DesktopScrollSpyNav:()=>v,MobileScrollSpyNav:()=>u});module.exports=C(A);var o=require("react/jsx-runtime"),D=require("../../../../AiuiProvider/index.js"),p=require("../../../../../helpers/index.js"),n=require("react"),m=require("gsap"),f=require("../../../BizProductProvider.js");const E=e=>(0,o.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,o.jsx)("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"#1D1D1F",strokeLinecap:"round",strokeLinejoin:"round"})}),u=({tabs:e,purchaseBarHeight:t,onSpyNavItemClick:s})=>{const[a,l]=(0,n.useState)(!1),[r,b]=(0,n.useState)(e?.[0]),d=(0,n.useRef)(null),{renderRating:x}=(0,f.useBizProductContext)(),S=(0,n.useCallback)(i=>{b(i),s?.(i),l(!1)},[]),h=(0,n.useCallback)(()=>{l(!a),m.gsap.fromTo(d?.current,{height:0},{height:"auto",duration:.5,ease:"power2.inOut"})},[a]);return(0,o.jsxs)("div",{children:[(0,o.jsxs)("button",{className:"text-sm h-[28px] font-bold flex gap-1 items-center leading-[28px] px-[10px] border rounded-full border-black",onClick:h,children:[r?.label,(0,o.jsx)(E,{className:"size-3"})]}),(0,o.jsxs)("div",{className:(0,p.cn)("absolute top-full w-full flex flex-col z-[60] bg-black/60 left-0",{hidden:!a}),style:{height:`calc(100dvh - ${t}px)`},children:[(0,o.jsxs)("div",{ref:d,className:"border-t overflow-hidden border-[#E4E5E6] flex flex-col bg-white",children:[e?.map(i=>(0,o.jsx)("button",{className:"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold",onClick:()=>S(i),children:i.label},i.id)),(0,o.jsx)("button",{className:"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold",children:x})]}),(0,o.jsx)("div",{className:"flex-1",onClick:()=>l(!1)})]})]})},v=({tabs:e,onSpyNavItemClick:t})=>{const[s,a]=(0,n.useState)(e?.[0]),l=(0,n.useCallback)(r=>{a(r),t?.(r)},[]);return(0,o.jsx)("div",{className:"flex gap-8",children:e?.map(r=>(0,o.jsxs)("button",{className:"text-sm relative py-[10px] font-bold",onClick:()=>l(r),children:[r.label,(0,o.jsx)("div",{className:(0,p.cn)("absolute bottom-0 left-0 w-0 transition-all duration-300 ease-in-out h-[2px] bg-brand-0",{"w-full":s?.id===r.id})})]},r.id))})};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/biz-components/Listing/components/PurchaseBar/ScrollSpyNav/index.tsx"],
4
- "sourcesContent": ["import { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { cn } from '../../../../../helpers/index.js'\nimport { useState, useCallback, useRef } from 'react'\nimport { gsap } from 'gsap'\nimport type { ScrollSpyNavItem, ScrollSpyNavProps } from './types.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\n\nconst MobileScrollSpyNav = ({ tabs, purchaseBarHeight, onSpyNavItemClick }: ScrollSpyNavProps) => {\n const [dropdownOpen, setDropdownOpen] = useState(false)\n const [activeTab, setActiveTab] = useState(tabs?.[0])\n const dropdownRef = useRef<HTMLDivElement>(null)\n const { renderRating } = useBizProductContext()\n \n const onTabClick = useCallback((tab: ScrollSpyNavItem) => {\n setActiveTab(tab)\n onSpyNavItemClick?.(tab)\n setDropdownOpen(false)\n }, [])\n\n const onDropdownOpen = useCallback(() => {\n setDropdownOpen(!dropdownOpen)\n gsap.fromTo(dropdownRef?.current, { height: 0 }, { height: 'auto', duration: 0.5, ease: 'power2.inOut' })\n }, [dropdownOpen])\n\n return (\n <div>\n <button\n className=\"text-sm h-[28px] font-bold leading-[28px] px-[10px] border rounded-full border-black\"\n onClick={onDropdownOpen}\n >\n {activeTab?.label}\n </button>\n <div\n className={cn('absolute top-full w-full flex flex-col z-[60] bg-black/60 left-0', {\n ['hidden']: !dropdownOpen,\n })}\n style={{\n height: `calc(100dvh - ${purchaseBarHeight}px)`,\n }}\n >\n <div ref={dropdownRef} className=\"border-t overflow-hidden border-[#E4E5E6] flex flex-col bg-white\">\n {tabs?.map(tab => (\n <button\n className=\"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold\"\n key={tab.id}\n onClick={() => onTabClick(tab)}\n >\n {tab.label}\n </button>\n ))}\n <button className=\"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold\">{renderRating}</button>\n </div>\n <div className=\"flex-1\" onClick={() => setDropdownOpen(false)} />\n </div>\n </div>\n )\n}\n\nconst DesktopScrollSpyNav = ({ tabs, onSpyNavItemClick }: ScrollSpyNavProps) => {\n const [activeTab, setActiveTab] = useState(tabs?.[0])\n\n const onTabClick = useCallback((tab: ScrollSpyNavItem) => {\n setActiveTab(tab)\n onSpyNavItemClick?.(tab)\n }, [])\n\n return (\n <div className=\"flex gap-8\">\n {tabs?.map(tab => (\n <button className=\"text-sm relative py-[10px] font-bold\" key={tab.id} onClick={() => onTabClick(tab)}>\n {tab.label}\n <div\n className={cn('absolute bottom-0 left-0 w-0 transition-all duration-300 ease-in-out h-[2px] bg-brand-0', {\n 'w-full': activeTab?.id === tab.id,\n })}\n />\n </button>\n ))}\n </div>\n )\n}\n\nexport { MobileScrollSpyNav, DesktopScrollSpyNav }\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,uBAAAC,IAAA,eAAAC,EAAAJ,GA0BM,IAAAK,EAAA,6BA1BNC,EAA+B,6CAC/BC,EAAmB,2CACnBC,EAA8C,iBAC9CC,EAAqB,gBAErBC,EAAqC,0CAErC,MAAMP,EAAqB,CAAC,CAAE,KAAAQ,EAAM,kBAAAC,EAAmB,kBAAAC,CAAkB,IAAyB,CAChG,KAAM,CAACC,EAAcC,CAAe,KAAI,YAAS,EAAK,EAChD,CAACC,EAAWC,CAAY,KAAI,YAASN,IAAO,CAAC,CAAC,EAC9CO,KAAc,UAAuB,IAAI,EACzC,CAAE,aAAAC,CAAa,KAAI,wBAAqB,EAExCC,KAAa,eAAaC,GAA0B,CACxDJ,EAAaI,CAAG,EAChBR,IAAoBQ,CAAG,EACvBN,EAAgB,EAAK,CACvB,EAAG,CAAC,CAAC,EAECO,KAAiB,eAAY,IAAM,CACvCP,EAAgB,CAACD,CAAY,EAC7B,OAAK,OAAOI,GAAa,QAAS,CAAE,OAAQ,CAAE,EAAG,CAAE,OAAQ,OAAQ,SAAU,GAAK,KAAM,cAAe,CAAC,CAC1G,EAAG,CAACJ,CAAY,CAAC,EAEjB,SACE,QAAC,OACC,oBAAC,UACC,UAAU,uFACV,QAASQ,EAER,SAAAN,GAAW,MACd,KACA,QAAC,OACC,aAAW,MAAG,mEAAoE,CAC/E,OAAW,CAACF,CACf,CAAC,EACD,MAAO,CACL,OAAQ,iBAAiBF,CAAiB,KAC5C,EAEA,qBAAC,OAAI,IAAKM,EAAa,UAAU,mEAC9B,UAAAP,GAAM,IAAIU,MACT,OAAC,UACC,UAAU,qDAEV,QAAS,IAAMD,EAAWC,CAAG,EAE5B,SAAAA,EAAI,OAHAA,EAAI,EAIX,CACD,KACD,OAAC,UAAO,UAAU,qDAAsD,SAAAF,EAAa,GACvF,KACA,OAAC,OAAI,UAAU,SAAS,QAAS,IAAMJ,EAAgB,EAAK,EAAG,GACjE,GACF,CAEJ,EAEMb,EAAsB,CAAC,CAAE,KAAAS,EAAM,kBAAAE,CAAkB,IAAyB,CAC9E,KAAM,CAACG,EAAWC,CAAY,KAAI,YAASN,IAAO,CAAC,CAAC,EAE9CS,KAAa,eAAaC,GAA0B,CACxDJ,EAAaI,CAAG,EAChBR,IAAoBQ,CAAG,CACzB,EAAG,CAAC,CAAC,EAEL,SACE,OAAC,OAAI,UAAU,aACZ,SAAAV,GAAM,IAAIU,MACT,QAAC,UAAO,UAAU,uCAAoD,QAAS,IAAMD,EAAWC,CAAG,EAChG,UAAAA,EAAI,SACL,OAAC,OACC,aAAW,MAAG,0FAA2F,CACvG,SAAUL,GAAW,KAAOK,EAAI,EAClC,CAAC,EACH,IAN4DA,EAAI,EAOlE,CACD,EACH,CAEJ",
6
- "names": ["ScrollSpyNav_exports", "__export", "DesktopScrollSpyNav", "MobileScrollSpyNav", "__toCommonJS", "import_jsx_runtime", "import_AiuiProvider", "import_helpers", "import_react", "import_gsap", "import_BizProductProvider", "tabs", "purchaseBarHeight", "onSpyNavItemClick", "dropdownOpen", "setDropdownOpen", "activeTab", "setActiveTab", "dropdownRef", "renderRating", "onTabClick", "tab", "onDropdownOpen"]
4
+ "sourcesContent": ["import { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { cn } from '../../../../../helpers/index.js'\nimport { useState, useCallback, useRef } from 'react'\nimport { gsap } from 'gsap'\nimport type { ScrollSpyNavItem, ScrollSpyNavProps } from './types.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\n\nconst ArrowDownIcon = (props: React.SVGProps<SVGSVGElement>) => {\n return (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" {...props}>\n <path d=\"M3 4.5L6 7.5L9 4.5\" stroke=\"#1D1D1F\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n )\n}\n\nconst MobileScrollSpyNav = ({ tabs, purchaseBarHeight, onSpyNavItemClick }: ScrollSpyNavProps) => {\n const [dropdownOpen, setDropdownOpen] = useState(false)\n const [activeTab, setActiveTab] = useState(tabs?.[0])\n const dropdownRef = useRef<HTMLDivElement>(null)\n const { renderRating } = useBizProductContext()\n \n const onTabClick = useCallback((tab: ScrollSpyNavItem) => {\n setActiveTab(tab)\n onSpyNavItemClick?.(tab)\n setDropdownOpen(false)\n }, [])\n\n const onDropdownOpen = useCallback(() => {\n setDropdownOpen(!dropdownOpen)\n gsap.fromTo(dropdownRef?.current, { height: 0 }, { height: 'auto', duration: 0.5, ease: 'power2.inOut' })\n }, [dropdownOpen])\n\n return (\n <div>\n <button\n className=\"text-sm h-[28px] font-bold flex gap-1 items-center leading-[28px] px-[10px] border rounded-full border-black\"\n onClick={onDropdownOpen}\n >\n {activeTab?.label}<ArrowDownIcon className='size-3'/>\n </button>\n <div\n className={cn('absolute top-full w-full flex flex-col z-[60] bg-black/60 left-0', {\n ['hidden']: !dropdownOpen,\n })}\n style={{\n height: `calc(100dvh - ${purchaseBarHeight}px)`,\n }}\n >\n <div ref={dropdownRef} className=\"border-t overflow-hidden border-[#E4E5E6] flex flex-col bg-white\">\n {tabs?.map(tab => (\n <button\n className=\"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold\"\n key={tab.id}\n onClick={() => onTabClick(tab)}\n >\n {tab.label}\n </button>\n ))}\n <button className=\"text-sm hover:bg-[#EAEAEC] p-4 text-left font-bold\">{renderRating}</button>\n </div>\n <div className=\"flex-1\" onClick={() => setDropdownOpen(false)} />\n </div>\n </div>\n )\n}\n\nconst DesktopScrollSpyNav = ({ tabs, onSpyNavItemClick }: ScrollSpyNavProps) => {\n const [activeTab, setActiveTab] = useState(tabs?.[0])\n\n const onTabClick = useCallback((tab: ScrollSpyNavItem) => {\n setActiveTab(tab)\n onSpyNavItemClick?.(tab)\n }, [])\n\n return (\n <div className=\"flex gap-8\">\n {tabs?.map(tab => (\n <button className=\"text-sm relative py-[10px] font-bold\" key={tab.id} onClick={() => onTabClick(tab)}>\n {tab.label}\n <div\n className={cn('absolute bottom-0 left-0 w-0 transition-all duration-300 ease-in-out h-[2px] bg-brand-0', {\n 'w-full': activeTab?.id === tab.id,\n })}\n />\n </button>\n ))}\n </div>\n )\n}\n\nexport { MobileScrollSpyNav, DesktopScrollSpyNav }\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,uBAAAC,IAAA,eAAAC,EAAAJ,GAUM,IAAAK,EAAA,6BAVNC,EAA+B,6CAC/BC,EAAmB,2CACnBC,EAA8C,iBAC9CC,EAAqB,gBAErBC,EAAqC,0CAErC,MAAMC,EAAiBC,MAEnB,OAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAA8B,GAAGA,EACjG,mBAAC,QAAK,EAAE,qBAAqB,OAAO,UAAU,cAAc,QAAQ,eAAe,QAAQ,EAC7F,EAIET,EAAqB,CAAC,CAAE,KAAAU,EAAM,kBAAAC,EAAmB,kBAAAC,CAAkB,IAAyB,CAChG,KAAM,CAACC,EAAcC,CAAe,KAAI,YAAS,EAAK,EAChD,CAACC,EAAWC,CAAY,KAAI,YAASN,IAAO,CAAC,CAAC,EAC9CO,KAAc,UAAuB,IAAI,EACzC,CAAE,aAAAC,CAAa,KAAI,wBAAqB,EAExCC,KAAa,eAAaC,GAA0B,CACxDJ,EAAaI,CAAG,EAChBR,IAAoBQ,CAAG,EACvBN,EAAgB,EAAK,CACvB,EAAG,CAAC,CAAC,EAECO,KAAiB,eAAY,IAAM,CACvCP,EAAgB,CAACD,CAAY,EAC7B,OAAK,OAAOI,GAAa,QAAS,CAAE,OAAQ,CAAE,EAAG,CAAE,OAAQ,OAAQ,SAAU,GAAK,KAAM,cAAe,CAAC,CAC1G,EAAG,CAACJ,CAAY,CAAC,EAEjB,SACE,QAAC,OACC,qBAAC,UACC,UAAU,+GACV,QAASQ,EAER,UAAAN,GAAW,SAAM,OAACP,EAAA,CAAc,UAAU,SAAQ,GACrD,KACA,QAAC,OACC,aAAW,MAAG,mEAAoE,CAC/E,OAAW,CAACK,CACf,CAAC,EACD,MAAO,CACL,OAAQ,iBAAiBF,CAAiB,KAC5C,EAEA,qBAAC,OAAI,IAAKM,EAAa,UAAU,mEAC9B,UAAAP,GAAM,IAAIU,MACT,OAAC,UACC,UAAU,qDAEV,QAAS,IAAMD,EAAWC,CAAG,EAE5B,SAAAA,EAAI,OAHAA,EAAI,EAIX,CACD,KACD,OAAC,UAAO,UAAU,qDAAsD,SAAAF,EAAa,GACvF,KACA,OAAC,OAAI,UAAU,SAAS,QAAS,IAAMJ,EAAgB,EAAK,EAAG,GACjE,GACF,CAEJ,EAEMf,EAAsB,CAAC,CAAE,KAAAW,EAAM,kBAAAE,CAAkB,IAAyB,CAC9E,KAAM,CAACG,EAAWC,CAAY,KAAI,YAASN,IAAO,CAAC,CAAC,EAE9CS,KAAa,eAAaC,GAA0B,CACxDJ,EAAaI,CAAG,EAChBR,IAAoBQ,CAAG,CACzB,EAAG,CAAC,CAAC,EAEL,SACE,OAAC,OAAI,UAAU,aACZ,SAAAV,GAAM,IAAIU,MACT,QAAC,UAAO,UAAU,uCAAoD,QAAS,IAAMD,EAAWC,CAAG,EAChG,UAAAA,EAAI,SACL,OAAC,OACC,aAAW,MAAG,0FAA2F,CACvG,SAAUL,GAAW,KAAOK,EAAI,EAClC,CAAC,EACH,IAN4DA,EAAI,EAOlE,CACD,EACH,CAEJ",
6
+ "names": ["ScrollSpyNav_exports", "__export", "DesktopScrollSpyNav", "MobileScrollSpyNav", "__toCommonJS", "import_jsx_runtime", "import_AiuiProvider", "import_helpers", "import_react", "import_gsap", "import_BizProductProvider", "ArrowDownIcon", "props", "tabs", "purchaseBarHeight", "onSpyNavItemClick", "dropdownOpen", "setDropdownOpen", "activeTab", "setActiveTab", "dropdownRef", "renderRating", "onTabClick", "tab", "onDropdownOpen"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var v=(a,e)=>{for(var o in e)c(a,o,{get:e[o],enumerable:!0})},g=(a,e,o,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!x.call(a,r)&&r!==o&&c(a,r,{get:()=>e[r],enumerable:!(l=h(e,r))||l.enumerable});return a};var N=a=>g(c({},"__esModule",{value:!0}),a);var B={};v(B,{default:()=>S});module.exports=N(B);var t=require("react/jsx-runtime"),s=require("react"),p=require("../../../../components"),z=require("gsap"),M=require("../../../AiuiProvider/index.js"),A=require("../../../../helpers/index.js"),u=require("../index.js"),d=require("../../BizProductProvider.js"),i=require("./ScrollSpyNav/index.js");const P=({onSpyNavItemClick:a})=>{const[e,o]=(0,s.useState)(0),{isMobile:l,product:r,renderRating:f,isDesktop:m}=(0,d.useBizProductContext)(),n=(0,s.useMemo)(()=>r?.payload?.components?.find(b=>b.componentKey==="PurchaseBar")?.data||[],[r?.payload]);return(0,s.useEffect)(()=>{o(document.querySelector("#purchase-bar")?.clientHeight||0)},[]),(0,t.jsx)("div",{id:"purchase-bar",className:"bg-white sticky top-0 left-0 w-full z-[52] border-b border-[#E4E5E6]",children:(0,t.jsx)(p.Container,{className:"py-3 desktop:pt-6 desktop:pb-0",children:(0,t.jsxs)("div",{className:"flex gap-[10px] items-center tablet:justify-between tablet:gap-0 tablet:w-full",children:[(0,t.jsxs)("div",{className:"flex-1 tablet:flex-none",children:[(0,t.jsx)(p.Heading,{size:2,className:"line-clamp-2 tablet:max-w-[406px] desktop:max-w-[570px] lg-desktop:max-w-[683px]",html:r?.title}),m&&(0,t.jsxs)("div",{className:"flex justify-between gap-8 items-center mt-3",children:[(0,t.jsx)(i.DesktopScrollSpyNav,{tabs:n,onSpyNavItemClick:a}),f]})]}),m?(0,t.jsx)(u.ProductActions,{}):(0,t.jsx)(i.MobileScrollSpyNav,{tabs:n,purchaseBarHeight:e,onSpyNavItemClick:a})]})})})};var S=P;
1
+ "use strict";var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var v=(a,e)=>{for(var o in e)c(a,o,{get:e[o],enumerable:!0})},g=(a,e,o,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!x.call(a,r)&&r!==o&&c(a,r,{get:()=>e[r],enumerable:!(l=h(e,r))||l.enumerable});return a};var P=a=>g(c({},"__esModule",{value:!0}),a);var N={};v(N,{default:()=>B});module.exports=P(N);var t=require("react/jsx-runtime"),s=require("react"),p=require("../../../../components"),z=require("gsap"),M=require("../../../AiuiProvider/index.js"),A=require("../../../../helpers/index.js"),u=require("../index.js"),d=require("../../BizProductProvider.js"),i=require("./ScrollSpyNav/index.js");const S=({onSpyNavItemClick:a})=>{const[e,o]=(0,s.useState)(0),{isMobile:l,product:r,renderRating:f,isDesktop:m}=(0,d.useBizProductContext)(),n=(0,s.useMemo)(()=>r?.payload?.components?.find(b=>b.componentKey==="PurchaseBar")?.data||[],[r?.payload]);return(0,s.useEffect)(()=>{o(document.querySelector("#purchase-bar")?.clientHeight||0)},[]),(0,t.jsx)("div",{id:"purchase-bar",className:"bg-white sticky top-0 left-0 w-full z-[52] border-b border-[#E4E5E6]",children:(0,t.jsx)(p.Container,{children:(0,t.jsxs)("div",{className:"flex gap-[10px] items-center tablet:justify-between tablet:gap-0 tablet:w-full",children:[(0,t.jsxs)("div",{className:"flex-1 py-3 desktop:pt-6 desktop:pb-0 tablet:flex-none",children:[(0,t.jsx)(p.Heading,{size:2,className:"line-clamp-2 tablet:max-w-[406px] desktop:max-w-[570px] lg-desktop:max-w-[683px]",html:r?.title}),m&&(0,t.jsxs)("div",{className:"flex justify-between gap-8 items-center mt-3",children:[(0,t.jsx)(i.DesktopScrollSpyNav,{tabs:n,onSpyNavItemClick:a}),f]})]}),m?(0,t.jsx)(u.ProductActions,{}):(0,t.jsx)(i.MobileScrollSpyNav,{tabs:n,purchaseBarHeight:e,onSpyNavItemClick:a})]})})})};var B=S;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/biz-components/Listing/components/PurchaseBar/index.tsx"],
4
- "sourcesContent": ["import { useCallback, useEffect, useRef, useState, useMemo } from 'react'\nimport { Text, Heading, Button, Container } from '../../../../components'\nimport type { PurchaseBarProps, ScrollSpyNavProps, ScrollSpyNavItem } from './types.js'\nimport { gsap } from 'gsap'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { cn } from '../../../../helpers/index.js'\nimport { ProductActions } from '../index.js'\nimport { useBizProductContext } from '../../BizProductProvider.js'\nimport { MobileScrollSpyNav, DesktopScrollSpyNav } from './ScrollSpyNav/index.js'\n\nconst PurchaseBar = ({ onSpyNavItemClick }: PurchaseBarProps) => {\n const [purchaseBarHeight, setPurchaseBarHeight] = useState(0)\n const { isMobile, product, renderRating, isDesktop } = useBizProductContext()\n\n const PurchaseBarData = useMemo(() => {\n return product?.payload?.components?.find((item: any) => item.componentKey === 'PurchaseBar')?.data || []\n }, [product?.payload])\n\n useEffect(() => {\n setPurchaseBarHeight(document.querySelector('#purchase-bar')?.clientHeight || 0)\n }, [])\n\n return (\n <div id=\"purchase-bar\" className=\"bg-white sticky top-0 left-0 w-full z-[52] border-b border-[#E4E5E6]\">\n <Container className=\"py-3 desktop:pt-6 desktop:pb-0\">\n <div className=\"flex gap-[10px] items-center tablet:justify-between tablet:gap-0 tablet:w-full\">\n <div className=\"flex-1 tablet:flex-none\">\n <Heading\n size={2}\n className=\"line-clamp-2 tablet:max-w-[406px] desktop:max-w-[570px] lg-desktop:max-w-[683px]\"\n html={product?.title}\n />\n {isDesktop && (\n <div className=\"flex justify-between gap-8 items-center mt-3\">\n <DesktopScrollSpyNav tabs={PurchaseBarData} onSpyNavItemClick={onSpyNavItemClick} />\n {renderRating}\n </div>\n )}\n </div>\n {!isDesktop ? (\n <MobileScrollSpyNav\n tabs={PurchaseBarData}\n purchaseBarHeight={purchaseBarHeight}\n onSpyNavItemClick={onSpyNavItemClick}\n />\n ) : (\n <ProductActions />\n )}\n </div>\n </Container>\n </div>\n )\n}\n\nexport default PurchaseBar\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA2BY,IAAAI,EAAA,6BA3BZC,EAAkE,iBAClEC,EAAiD,kCAEjDC,EAAqB,gBACrBC,EAA+B,0CAC/BC,EAAmB,wCACnBC,EAA+B,uBAC/BC,EAAqC,uCACrCC,EAAwD,mCAExD,MAAMC,EAAc,CAAC,CAAE,kBAAAC,CAAkB,IAAwB,CAC/D,KAAM,CAACC,EAAmBC,CAAoB,KAAI,YAAS,CAAC,EACtD,CAAE,SAAAC,EAAU,QAAAC,EAAS,aAAAC,EAAc,UAAAC,CAAU,KAAI,wBAAqB,EAEtEC,KAAkB,WAAQ,IACvBH,GAAS,SAAS,YAAY,KAAMI,GAAcA,EAAK,eAAiB,aAAa,GAAG,MAAQ,CAAC,EACvG,CAACJ,GAAS,OAAO,CAAC,EAErB,sBAAU,IAAM,CACdF,EAAqB,SAAS,cAAc,eAAe,GAAG,cAAgB,CAAC,CACjF,EAAG,CAAC,CAAC,KAGH,OAAC,OAAI,GAAG,eAAe,UAAU,uEAC/B,mBAAC,aAAU,UAAU,iCACnB,oBAAC,OAAI,UAAU,iFACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,WACC,KAAM,EACN,UAAU,mFACV,KAAME,GAAS,MACjB,EACCE,MACC,QAAC,OAAI,UAAU,+CACb,oBAAC,uBAAoB,KAAMC,EAAiB,kBAAmBP,EAAmB,EACjFK,GACH,GAEJ,EACEC,KAOA,OAAC,mBAAe,KANhB,OAAC,sBACC,KAAMC,EACN,kBAAmBN,EACnB,kBAAmBD,EACrB,GAIJ,EACF,EACF,CAEJ,EAEA,IAAOZ,EAAQW",
4
+ "sourcesContent": ["import { useCallback, useEffect, useRef, useState, useMemo } from 'react'\nimport { Text, Heading, Button, Container } from '../../../../components'\nimport type { PurchaseBarProps, ScrollSpyNavProps, ScrollSpyNavItem } from './types.js'\nimport { gsap } from 'gsap'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { cn } from '../../../../helpers/index.js'\nimport { ProductActions } from '../index.js'\nimport { useBizProductContext } from '../../BizProductProvider.js'\nimport { MobileScrollSpyNav, DesktopScrollSpyNav } from './ScrollSpyNav/index.js'\n\nconst PurchaseBar = ({ onSpyNavItemClick }: PurchaseBarProps) => {\n const [purchaseBarHeight, setPurchaseBarHeight] = useState(0)\n const { isMobile, product, renderRating, isDesktop } = useBizProductContext()\n\n const PurchaseBarData = useMemo(() => {\n return product?.payload?.components?.find((item: any) => item.componentKey === 'PurchaseBar')?.data || []\n }, [product?.payload])\n\n useEffect(() => {\n setPurchaseBarHeight(document.querySelector('#purchase-bar')?.clientHeight || 0)\n }, [])\n\n return (\n <div id=\"purchase-bar\" className=\"bg-white sticky top-0 left-0 w-full z-[52] border-b border-[#E4E5E6]\">\n <Container>\n {/* // py-3 desktop:pt-6 desktop:pb-0 */}\n <div className=\"flex gap-[10px] items-center tablet:justify-between tablet:gap-0 tablet:w-full\">\n <div className=\"flex-1 py-3 desktop:pt-6 desktop:pb-0 tablet:flex-none\">\n <Heading\n size={2}\n className=\"line-clamp-2 tablet:max-w-[406px] desktop:max-w-[570px] lg-desktop:max-w-[683px]\"\n html={product?.title}\n />\n {isDesktop && (\n <div className=\"flex justify-between gap-8 items-center mt-3\">\n <DesktopScrollSpyNav tabs={PurchaseBarData} onSpyNavItemClick={onSpyNavItemClick} />\n {renderRating}\n </div>\n )}\n </div>\n {!isDesktop ? (\n <MobileScrollSpyNav\n tabs={PurchaseBarData}\n purchaseBarHeight={purchaseBarHeight}\n onSpyNavItemClick={onSpyNavItemClick}\n />\n ) : (\n <ProductActions />\n )}\n </div>\n </Container>\n </div>\n )\n}\n\nexport default PurchaseBar\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA4BY,IAAAI,EAAA,6BA5BZC,EAAkE,iBAClEC,EAAiD,kCAEjDC,EAAqB,gBACrBC,EAA+B,0CAC/BC,EAAmB,wCACnBC,EAA+B,uBAC/BC,EAAqC,uCACrCC,EAAwD,mCAExD,MAAMC,EAAc,CAAC,CAAE,kBAAAC,CAAkB,IAAwB,CAC/D,KAAM,CAACC,EAAmBC,CAAoB,KAAI,YAAS,CAAC,EACtD,CAAE,SAAAC,EAAU,QAAAC,EAAS,aAAAC,EAAc,UAAAC,CAAU,KAAI,wBAAqB,EAEtEC,KAAkB,WAAQ,IACvBH,GAAS,SAAS,YAAY,KAAMI,GAAcA,EAAK,eAAiB,aAAa,GAAG,MAAQ,CAAC,EACvG,CAACJ,GAAS,OAAO,CAAC,EAErB,sBAAU,IAAM,CACdF,EAAqB,SAAS,cAAc,eAAe,GAAG,cAAgB,CAAC,CACjF,EAAG,CAAC,CAAC,KAGH,OAAC,OAAI,GAAG,eAAe,UAAU,uEAC/B,mBAAC,aAEC,oBAAC,OAAI,UAAU,iFACb,qBAAC,OAAI,UAAU,yDACb,oBAAC,WACC,KAAM,EACN,UAAU,mFACV,KAAME,GAAS,MACjB,EACCE,MACC,QAAC,OAAI,UAAU,+CACb,oBAAC,uBAAoB,KAAMC,EAAiB,kBAAmBP,EAAmB,EACjFK,GACH,GAEJ,EACEC,KAOA,OAAC,mBAAe,KANhB,OAAC,sBACC,KAAMC,EACN,kBAAmBN,EACnB,kBAAmBD,EACrB,GAIJ,EACF,EACF,CAEJ,EAEA,IAAOZ,EAAQW",
6
6
  "names": ["PurchaseBar_exports", "__export", "PurchaseBar_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_gsap", "import_AiuiProvider", "import_helpers", "import__", "import_BizProductProvider", "import_ScrollSpyNav", "PurchaseBar", "onSpyNavItemClick", "purchaseBarHeight", "setPurchaseBarHeight", "isMobile", "product", "renderRating", "isDesktop", "PurchaseBarData", "item"]
7
7
  }
@@ -46,5 +46,5 @@ interface BenefitsResult {
46
46
  * 包括 通用优惠券,会员价,满减,捆绑折扣,买赠 ,满赠 ,积分抵现
47
47
  * @returns
48
48
  */
49
- export declare const useBenefits: ({ variant, }: BenefitsParams) => BenefitsResult;
49
+ export declare const useBenefits: ({ variant }: BenefitsParams) => BenefitsResult;
50
50
  export {};
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var x=(e,n)=>{for(var l in n)u(e,l,{get:n[l],enumerable:!0})},D=(e,n,l,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of C(n))!I.call(e,t)&&t!==l&&u(e,t,{get:()=>n[t],enumerable:!(i=h(n,t))||i.enumerable});return e};var G=e=>D(u({},"__esModule",{value:!0}),e);var R={};x(R,{useBenefits:()=>P});module.exports=G(R);var m=require("../BizProductProvider"),d=require("../utils/helper"),p=require("../../AiuiProvider/index.js");const P=({variant:e})=>{const{coupon:n,product:l,bundle:i,freeGift:t,memberFunctionResult:a,creditsRedemptionAmount:s,discount:v}=(0,m.useBizProductContext)(),{trackingData:f}=(0,p.useAiuiContext)(),r=Math.max(a?.withCouponMemberTotalSave??0,a?.withoutCouponMaxMemberTotalSave??0),g=!!(f?.paidShipping&&e.requiresShipping&&!e?.metafields?.global?.presell&&!e?.metafields?.global?.HideShipping),c=f?.freeGift,b=c?.excludeProducts?.map(o=>typeof o=="object"&&"sku"in o?o.sku:o)??[],B=f?.levelDiscount&&(0,d.checkItemAvailableForProduct)({product:l,variant:e,item:f?.levelDiscount});return{commonCoupon:{enable:!!n,config:n??{}},freeGift:{enable:!!t&&!!t?.giftList?.length,config:t},bundle:{enable:!!i&&!!i?.bundleList?.length&&Math.max(...i?.bundleList?.map(o=>o.savings??0))>0,config:i},memberDiscount:{enable:r>0,config:{amount:r,description:a?.labels?.find(o=>o.key==="benefit_tab_string")?.value}},creditsRedemption:{enable:!!s&&s>0,config:{amount:s,label:f?.creditsRedemptionLabel}},paidShipping:{enable:g,config:{}},fullGift:{enable:!!(c&&!b.includes(e.sku)),config:c??{}},levelDiscount:{enable:!!B,config:f?.levelDiscount??{}}}};
1
+ "use strict";var r=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var x=(e,n)=>{for(var l in n)r(e,l,{get:n[l],enumerable:!0})},G=(e,n,l,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of I(n))!S.call(e,i)&&i!==l&&r(e,i,{get:()=>n[i],enumerable:!(o=D(n,i))||o.enumerable});return e};var P=e=>G(r({},"__esModule",{value:!0}),e);var y={};x(y,{useBenefits:()=>R});module.exports=P(y);var d=require("../BizProductProvider"),p=require("../utils/helper"),g=require("../../AiuiProvider/index.js");const R=({variant:e})=>{const{coupon:n,product:l,bundle:o,isLogin:i,freeGift:f,memberFunctionResult:a,creditsRedemptionAmount:c,discount:b}=(0,d.useBizProductContext)(),{codeSavings:B}=b||{},{trackingData:s}=(0,g.useAiuiContext)(),m=Math.max(a?.withCouponMemberTotalSave??0,a?.withoutCouponMaxMemberTotalSave??0),h=!!(s?.paidShipping&&e.requiresShipping&&!e?.metafields?.global?.presell&&!e?.metafields?.global?.HideShipping),u=s?.freeGift,C=u?.excludeProducts?.map(t=>typeof t=="object"&&"sku"in t?t.sku:t)??[],v=s?.levelDiscount&&(0,p.checkItemAvailableForProduct)({product:l,variant:e,item:s?.levelDiscount}),M=!i&&(B||0)<(a?.withCouponMemberTotalSave||0);return{commonCoupon:{enable:!!n,config:n??{}},freeGift:{enable:!!f&&!!f?.giftList?.length,config:f},bundle:{enable:!!o&&!!o?.bundleList?.length&&Math.max(...o?.bundleList?.map(t=>t.savings??0))>0,config:o},memberDiscount:{enable:m>0,config:{amount:m,description:a?.labels?.find(t=>t.key==="benefit_tab_string")?.value}},creditsRedemption:{enable:!!c&&c>0,config:{amount:c,label:s?.creditsRedemptionLabel}},paidShipping:{enable:h,config:{}},fullGift:{enable:!!(u&&!C.includes(e.sku)),config:u??{}},levelDiscount:{enable:!!v,config:s?.levelDiscount??{}}}};
2
2
  //# sourceMappingURL=useBenefits.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/biz-components/Listing/hooks/useBenefits.ts"],
4
- "sourcesContent": ["import { useBizProductContext } from '../BizProductProvider'\nimport type { ProductVariant, FreeGift, Bundle } from '../types/product'\nimport { checkItemAvailableForProduct } from '../utils/helper'\n\n\nimport { useAiuiContext } from '../../AiuiProvider/index.js'\n\ninterface BenefitsParams {\n variant: ProductVariant\n}\n\ninterface BenefitItemConfig<T extends Record<string, any> = Record<string, any>> {\n enable: boolean\n config?: T // \u539F\u59CB\u914D\u7F6E\n}\n\ninterface BenefitsResult {\n /**\n * \u901A\u7528\u4F18\u60E0\u5238\n */\n commonCoupon?: BenefitItemConfig\n /**\n * \u4E70\u8D60\n */\n freeGift: BenefitItemConfig<FreeGift>\n /**\n * \u6346\u7ED1\u6298\u6263\n */\n bundle: BenefitItemConfig<Bundle>\n /**\n * \u4F1A\u5458\u4EF7\n */\n memberDiscount: BenefitItemConfig\n /**\n * \u79EF\u5206\u62B5\u73B0\n */\n creditsRedemption: BenefitItemConfig\n /**\n * \u9AD8\u6807\u7269\u6D41\n */\n paidShipping: BenefitItemConfig\n\n /**\n * \u6EE1\u8D60\n */\n fullGift: BenefitItemConfig\n\n /**\n * \u6EE1\u51CF\u6298\u6263\n */\n levelDiscount: BenefitItemConfig\n}\n\n/**\n * \u5546\u54C1\u6743\u76CA\n * \u83B7\u53D6\u5F53\u524Dsku \u6240\u6709\u7684\u6743\u76CA\n * \u5305\u62EC \u901A\u7528\u4F18\u60E0\u5238\uFF0C\u4F1A\u5458\u4EF7\uFF0C\u6EE1\u51CF\uFF0C\u6346\u7ED1\u6298\u6263\uFF0C\u4E70\u8D60 \uFF0C\u6EE1\u8D60 \uFF0C\u79EF\u5206\u62B5\u73B0\n * @returns\n */\nexport const useBenefits = ({\n variant,\n}: BenefitsParams): BenefitsResult => {\n const { coupon, product, bundle, freeGift, memberFunctionResult, creditsRedemptionAmount, discount } = useBizProductContext()\n\n const { trackingData } = useAiuiContext()\n\n const total = Math.max(\n memberFunctionResult?.withCouponMemberTotalSave ?? 0,\n memberFunctionResult?.withoutCouponMaxMemberTotalSave ?? 0\n )\n\n // \u9AD8\u6807\u7269\u6D41\n const showPaidShipping = Boolean(\n trackingData?.paidShipping &&\n variant.requiresShipping &&\n !variant?.metafields?.global?.presell &&\n !variant?.metafields?.global?.HideShipping\n )\n\n // \u811A\u672C\u6EE1\u8D60\n const fullGift = trackingData?.freeGift\n const excludeProducts =\n fullGift?.excludeProducts?.map((item: any) => (typeof item === 'object' && 'sku' in item ? item.sku : item)) ?? []\n\n const showLevelDiscount =\n trackingData?.levelDiscount &&\n checkItemAvailableForProduct({ product, variant, item: trackingData?.levelDiscount })\n\n return {\n commonCoupon: {\n enable: Boolean(coupon),\n config: coupon ?? {},\n },\n freeGift: {\n enable: Boolean(freeGift) && !!freeGift?.giftList?.length,\n config: freeGift,\n },\n bundle: {\n enable:\n Boolean(bundle) &&\n !!bundle?.bundleList?.length &&\n Math.max(...bundle?.bundleList?.map(item => item.savings ?? 0)) > 0, // \u6709\u4F18\u60E0\u624D\u5C55\u793A\n config: bundle,\n },\n memberDiscount: {\n enable: total > 0,\n config: {\n amount: total,\n description: memberFunctionResult?.labels?.find((item: any) => item.key === 'benefit_tab_string')?.value,\n },\n },\n creditsRedemption: {\n enable: Boolean(creditsRedemptionAmount) && creditsRedemptionAmount! > 0,\n config: { amount: creditsRedemptionAmount, label: trackingData?.creditsRedemptionLabel },\n },\n paidShipping: {\n enable: showPaidShipping,\n config: {},\n },\n fullGift: {\n enable: Boolean(fullGift && !excludeProducts.includes(variant.sku)),\n config: fullGift ?? {},\n },\n levelDiscount: {\n enable: Boolean(showLevelDiscount),\n config: trackingData?.levelDiscount ?? {},\n },\n }\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAqC,iCAErCC,EAA6C,2BAG7CC,EAA+B,uCAsDxB,MAAMJ,EAAc,CAAC,CAC1B,QAAAK,CACF,IAAsC,CACpC,KAAM,CAAE,OAAAC,EAAQ,QAAAC,EAAS,OAAAC,EAAQ,SAAAC,EAAU,qBAAAC,EAAsB,wBAAAC,EAAyB,SAAAC,CAAS,KAAI,wBAAqB,EAEtH,CAAE,aAAAC,CAAa,KAAI,kBAAe,EAElCC,EAAQ,KAAK,IACjBJ,GAAsB,2BAA6B,EACnDA,GAAsB,iCAAmC,CAC3D,EAGMK,EAAmB,GACvBF,GAAc,cACZR,EAAQ,kBACR,CAACA,GAAS,YAAY,QAAQ,SAC9B,CAACA,GAAS,YAAY,QAAQ,cAI5BW,EAAWH,GAAc,SACzBI,EACJD,GAAU,iBAAiB,IAAKE,GAAe,OAAOA,GAAS,UAAY,QAASA,EAAOA,EAAK,IAAMA,CAAK,GAAK,CAAC,EAE7GC,EACJN,GAAc,kBACd,gCAA6B,CAAE,QAAAN,EAAS,QAAAF,EAAS,KAAMQ,GAAc,aAAc,CAAC,EAEtF,MAAO,CACL,aAAc,CACZ,OAAQ,EAAQP,EAChB,OAAQA,GAAU,CAAC,CACrB,EACA,SAAU,CACR,OAAQ,EAAQG,GAAa,CAAC,CAACA,GAAU,UAAU,OACnD,OAAQA,CACV,EACA,OAAQ,CACN,OACE,EAAQD,GACR,CAAC,CAACA,GAAQ,YAAY,QACtB,KAAK,IAAI,GAAGA,GAAQ,YAAY,IAAIU,GAAQA,EAAK,SAAW,CAAC,CAAC,EAAI,EACpE,OAAQV,CACV,EACA,eAAgB,CACd,OAAQM,EAAQ,EAChB,OAAQ,CACN,OAAQA,EACR,YAAaJ,GAAsB,QAAQ,KAAMQ,GAAcA,EAAK,MAAQ,oBAAoB,GAAG,KACrG,CACF,EACA,kBAAmB,CACjB,OAAQ,EAAQP,GAA4BA,EAA2B,EACvE,OAAQ,CAAE,OAAQA,EAAyB,MAAOE,GAAc,sBAAuB,CACzF,EACA,aAAc,CACZ,OAAQE,EACR,OAAQ,CAAC,CACX,EACA,SAAU,CACR,OAAQ,GAAQC,GAAY,CAACC,EAAgB,SAASZ,EAAQ,GAAG,GACjE,OAAQW,GAAY,CAAC,CACvB,EACA,cAAe,CACb,OAAQ,EAAQG,EAChB,OAAQN,GAAc,eAAiB,CAAC,CAC1C,CACF,CACF",
6
- "names": ["useBenefits_exports", "__export", "useBenefits", "__toCommonJS", "import_BizProductProvider", "import_helper", "import_AiuiProvider", "variant", "coupon", "product", "bundle", "freeGift", "memberFunctionResult", "creditsRedemptionAmount", "discount", "trackingData", "total", "showPaidShipping", "fullGift", "excludeProducts", "item", "showLevelDiscount"]
4
+ "sourcesContent": ["import { useBizProductContext } from '../BizProductProvider'\nimport type { ProductVariant, FreeGift, Bundle } from '../types/product'\nimport { checkItemAvailableForProduct } from '../utils/helper'\n\nimport { useAiuiContext } from '../../AiuiProvider/index.js'\n\ninterface BenefitsParams {\n variant: ProductVariant\n}\n\ninterface BenefitItemConfig<T extends Record<string, any> = Record<string, any>> {\n enable: boolean\n config?: T // \u539F\u59CB\u914D\u7F6E\n}\n\ninterface BenefitsResult {\n /**\n * \u901A\u7528\u4F18\u60E0\u5238\n */\n commonCoupon?: BenefitItemConfig\n /**\n * \u4E70\u8D60\n */\n freeGift: BenefitItemConfig<FreeGift>\n /**\n * \u6346\u7ED1\u6298\u6263\n */\n bundle: BenefitItemConfig<Bundle>\n /**\n * \u4F1A\u5458\u4EF7\n */\n memberDiscount: BenefitItemConfig\n /**\n * \u79EF\u5206\u62B5\u73B0\n */\n creditsRedemption: BenefitItemConfig\n /**\n * \u9AD8\u6807\u7269\u6D41\n */\n paidShipping: BenefitItemConfig\n\n /**\n * \u6EE1\u8D60\n */\n fullGift: BenefitItemConfig\n\n /**\n * \u6EE1\u51CF\u6298\u6263\n */\n levelDiscount: BenefitItemConfig\n}\n\n/**\n * \u5546\u54C1\u6743\u76CA\n * \u83B7\u53D6\u5F53\u524Dsku \u6240\u6709\u7684\u6743\u76CA\n * \u5305\u62EC \u901A\u7528\u4F18\u60E0\u5238\uFF0C\u4F1A\u5458\u4EF7\uFF0C\u6EE1\u51CF\uFF0C\u6346\u7ED1\u6298\u6263\uFF0C\u4E70\u8D60 \uFF0C\u6EE1\u8D60 \uFF0C\u79EF\u5206\u62B5\u73B0\n * @returns\n */\nexport const useBenefits = ({ variant }: BenefitsParams): BenefitsResult => {\n const { coupon, product, bundle, isLogin, freeGift, memberFunctionResult, creditsRedemptionAmount, discount } =\n useBizProductContext()\n const { codeSavings } = discount || {}\n\n const { trackingData } = useAiuiContext()\n\n const total = Math.max(\n memberFunctionResult?.withCouponMemberTotalSave ?? 0,\n memberFunctionResult?.withoutCouponMaxMemberTotalSave ?? 0\n )\n\n // \u9AD8\u6807\u7269\u6D41\n const showPaidShipping = Boolean(\n trackingData?.paidShipping &&\n variant.requiresShipping &&\n !variant?.metafields?.global?.presell &&\n !variant?.metafields?.global?.HideShipping\n )\n\n // \u811A\u672C\u6EE1\u8D60\n const fullGift = trackingData?.freeGift\n const excludeProducts =\n fullGift?.excludeProducts?.map((item: any) => (typeof item === 'object' && 'sku' in item ? item.sku : item)) ?? []\n\n const showLevelDiscount =\n trackingData?.levelDiscount && checkItemAvailableForProduct({ product, variant, item: trackingData?.levelDiscount })\n\n // \u672A\u767B\u5F55\u4E14code\u4F18\u60E0\u5C0F\u4E8E\u4F1A\u5458\u4EF7\u4F18\u60E0\u65F6\uFF0C\u5C55\u793A\u4F1A\u5458\u4EF7\u4F18\u60E0\n const showMemberDiscount = !isLogin && (codeSavings || 0) < (memberFunctionResult?.withCouponMemberTotalSave || 0)\n\n return {\n commonCoupon: {\n enable: Boolean(coupon),\n config: coupon ?? {},\n },\n freeGift: {\n enable: Boolean(freeGift) && !!freeGift?.giftList?.length,\n config: freeGift,\n },\n bundle: {\n enable:\n Boolean(bundle) &&\n !!bundle?.bundleList?.length &&\n Math.max(...bundle?.bundleList?.map(item => item.savings ?? 0)) > 0, // \u6709\u4F18\u60E0\u624D\u5C55\u793A\n config: bundle,\n },\n memberDiscount: {\n // enable: showMemberDiscount,\n enable: total > 0,\n config: {\n amount: total,\n description: memberFunctionResult?.labels?.find((item: any) => item.key === 'benefit_tab_string')?.value,\n },\n },\n creditsRedemption: {\n enable: Boolean(creditsRedemptionAmount) && creditsRedemptionAmount! > 0,\n config: { amount: creditsRedemptionAmount, label: trackingData?.creditsRedemptionLabel },\n },\n paidShipping: {\n enable: showPaidShipping,\n config: {},\n },\n fullGift: {\n enable: Boolean(fullGift && !excludeProducts.includes(variant.sku)),\n config: fullGift ?? {},\n },\n levelDiscount: {\n enable: Boolean(showLevelDiscount),\n config: trackingData?.levelDiscount ?? {},\n },\n }\n}\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAqC,iCAErCC,EAA6C,2BAE7CC,EAA+B,uCAsDxB,MAAMJ,EAAc,CAAC,CAAE,QAAAK,CAAQ,IAAsC,CAC1E,KAAM,CAAE,OAAAC,EAAQ,QAAAC,EAAS,OAAAC,EAAQ,QAAAC,EAAS,SAAAC,EAAU,qBAAAC,EAAsB,wBAAAC,EAAyB,SAAAC,CAAS,KAC1G,wBAAqB,EACjB,CAAE,YAAAC,CAAY,EAAID,GAAY,CAAC,EAE/B,CAAE,aAAAE,CAAa,KAAI,kBAAe,EA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C1C,CACF,CACF",
6
+ "names": ["useBenefits_exports", "__export", "useBenefits", "__toCommonJS", "import_BizProductProvider", "import_helper", "import_AiuiProvider", "variant", "coupon", "product", "bundle", "isLogin", "freeGift", "memberFunctionResult", "creditsRedemptionAmount", "discount", "codeSavings", "trackingData", "total", "showPaidShipping", "fullGift", "excludeProducts", "item", "showLevelDiscount", "showMemberDiscount"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Button as a,Text as n}from"../../../../components/index.js";import{useAiuiContext as x}from"../../../AiuiProvider/index.js";import{cn as c}from"../../../../helpers/index.js";const m=p=>{const{className:r,setOpenShippingPolicyModal:t,metafields:l}=p,{trackingData:s}=x(),o=s?.common?.copywriting;return i("div",{tabIndex:-1,className:c("from-4.29% to-101.05% relative items-start gap-[16px] overflow-hidden rounded-[8px] border border-[#E8E8E8] bg-gradient-to-r from-[rgba(215,245,254,0.24)] to-[rgba(215,245,254,0.80)] px-[16px] py-[24px] text-[#1F2021] md:py-[16px]","flex flex-col",r),children:[i("div",{className:"flex w-full items-center justify-between",children:[e(n,{size:2,className:"text-[14px] laptop:text-[16px] lg-desktop:text-[18px]",children:"Learn about Express Shipping Policy"}),e(a,{variant:"link",className:"hidden whitespace-nowrap laptop:inline-flex",onClick:()=>{t(!0)},children:o?.learnMore})]}),e(n,{size:1,as:"p",className:"text-[12px] text-[#6D6D6F] laptop:text-[14px]",children:l?.loginBeforeCheckoutNote}),e(a,{variant:"link",className:"inline-flex px-0 laptop:hidden",onClick:()=>{t(!0)},children:o?.learnMore})]})};var g=m;export{g as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Button as p,Text as l}from"../../../../components/index.js";import{useAiuiContext as x}from"../../../AiuiProvider/index.js";import{cn as d}from"../../../../helpers/index.js";const c=i=>{const{className:n,setOpenShippingPolicyModal:o,metafields:r}=i,{trackingData:s}=x(),a=s?.common?.copywriting;return t("div",{tabIndex:-1,className:d("from-4.29% to-101.05% relative items-start gap-[16px] overflow-hidden rounded-xl laptop:rounded-2xl border border-[#E8E8E8] bg-gradient-to-r from-[rgba(215,245,254,0.24)] to-[rgba(215,245,254,0.80)] p-4 laptop:py-3 text-[#1F2021] md:py-[16px]","flex flex-col",n),children:[t("div",{className:"flex w-full items-start justify-between",children:[t("div",{className:"flex flex-col gap-3 laptop:gap-2 lg-desktop:gap-4",children:[e(l,{size:2,className:"text-[14px] laptop:text-[16px] lg-desktop:text-[18px]",children:"Learn about Express Shipping Policy"}),e(l,{size:1,as:"p",className:"text-[12px] text-[#6D6D6F] laptop:text-[14px]",children:r?.loginBeforeCheckoutNote})]}),e(p,{variant:"link",className:"hidden !p-0 whitespace-nowrap laptop:inline-flex",onClick:()=>{o(!0)},children:a?.learnMore})]}),e(p,{variant:"link",className:"inline-flex p-0 laptop:hidden",onClick:()=>{o(!0)},children:a?.learnMore})]})};var u=c;export{u as default};
2
2
  //# sourceMappingURL=LearnMore.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/biz-components/Listing/components/PaidShipping/LearnMore.tsx"],
4
- "sourcesContent": ["import { Button, Text } from '../../../../components/index.js'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { cn } from '../../../../helpers/index.js'\n\nconst LearnMore = (props: any) => {\n const { className, setOpenShippingPolicyModal, metafields } = props\n const { trackingData } = useAiuiContext()\n const shopCommon = trackingData?.common?.copywriting\n\n return (\n <div\n tabIndex={-1}\n className={cn(\n 'from-4.29% to-101.05% relative items-start gap-[16px] overflow-hidden rounded-[8px] border border-[#E8E8E8] bg-gradient-to-r from-[rgba(215,245,254,0.24)] to-[rgba(215,245,254,0.80)] px-[16px] py-[24px] text-[#1F2021] md:py-[16px]',\n 'flex flex-col',\n className,\n )}\n >\n <div className='flex w-full items-center justify-between'>\n <Text size={2} className='text-[14px] laptop:text-[16px] lg-desktop:text-[18px]'>\n Learn about Express Shipping Policy\n </Text>\n <Button\n variant='link'\n className='hidden whitespace-nowrap laptop:inline-flex'\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n >\n {shopCommon?.learnMore}\n </Button>\n </div>\n\n <Text size={1} as='p' className='text-[12px] text-[#6D6D6F] laptop:text-[14px]'>\n {metafields?.loginBeforeCheckoutNote}\n </Text>\n\n <Button\n variant='link'\n className='inline-flex px-0 laptop:hidden'\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n >\n {shopCommon?.learnMore}\n </Button>\n </div>\n )\n}\n\nexport default LearnMore\n"],
5
- "mappings": "AAkBM,OACE,OAAAA,EADF,QAAAC,MAAA,oBAlBN,OAAS,UAAAC,EAAQ,QAAAC,MAAY,kCAC7B,OAAS,kBAAAC,MAAsB,iCAC/B,OAAS,MAAAC,MAAU,+BAEnB,MAAMC,EAAaC,GAAe,CAChC,KAAM,CAAE,UAAAC,EAAW,2BAAAC,EAA4B,WAAAC,CAAW,EAAIH,EACxD,CAAE,aAAAI,CAAa,EAAIP,EAAe,EAClCQ,EAAaD,GAAc,QAAQ,YAEzC,OACEV,EAAC,OACC,SAAU,GACV,UAAWI,EACT,yOACA,gBACAG,CACF,EAEA,UAAAP,EAAC,OAAI,UAAU,2CACb,UAAAD,EAACG,EAAA,CAAK,KAAM,EAAG,UAAU,wDAAwD,+CAEjF,EACAH,EAACE,EAAA,CACC,QAAQ,OACR,UAAU,8CACV,QAAS,IAAM,CACbO,EAA2B,EAAI,CACjC,EAEC,SAAAG,GAAY,UACf,GACF,EAEAZ,EAACG,EAAA,CAAK,KAAM,EAAG,GAAG,IAAI,UAAU,gDAC7B,SAAAO,GAAY,wBACf,EAEAV,EAACE,EAAA,CACC,QAAQ,OACR,UAAU,iCACV,QAAS,IAAM,CACbO,EAA2B,EAAI,CACjC,EAEC,SAAAG,GAAY,UACf,GACF,CAEJ,EAEA,IAAOC,EAAQP",
4
+ "sourcesContent": ["import { Button, Text } from '../../../../components/index.js'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { cn } from '../../../../helpers/index.js'\n\nconst LearnMore = (props: any) => {\n const { className, setOpenShippingPolicyModal, metafields } = props\n const { trackingData } = useAiuiContext()\n const shopCommon = trackingData?.common?.copywriting\n\n return (\n <div\n tabIndex={-1}\n className={cn(\n 'from-4.29% to-101.05% relative items-start gap-[16px] overflow-hidden rounded-xl laptop:rounded-2xl border border-[#E8E8E8] bg-gradient-to-r from-[rgba(215,245,254,0.24)] to-[rgba(215,245,254,0.80)] p-4 laptop:py-3 text-[#1F2021] md:py-[16px]',\n 'flex flex-col',\n className\n )}\n >\n <div className=\"flex w-full items-start justify-between\">\n <div className=\"flex flex-col gap-3 laptop:gap-2 lg-desktop:gap-4\">\n <Text size={2} className=\"text-[14px] laptop:text-[16px] lg-desktop:text-[18px]\">\n Learn about Express Shipping Policy\n </Text>\n <Text size={1} as=\"p\" className=\"text-[12px] text-[#6D6D6F] laptop:text-[14px]\">\n {metafields?.loginBeforeCheckoutNote}\n </Text>\n </div>\n <Button\n variant=\"link\"\n className=\"hidden !p-0 whitespace-nowrap laptop:inline-flex\"\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n >\n {shopCommon?.learnMore}\n </Button>\n </div>\n\n <Button\n variant=\"link\"\n className=\"inline-flex p-0 laptop:hidden\"\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n >\n {shopCommon?.learnMore}\n </Button>\n </div>\n )\n}\n\nexport default LearnMore\n"],
5
+ "mappings": "AAmBQ,OACE,OAAAA,EADF,QAAAC,MAAA,oBAnBR,OAAS,UAAAC,EAAQ,QAAAC,MAAY,kCAC7B,OAAS,kBAAAC,MAAsB,iCAC/B,OAAS,MAAAC,MAAU,+BAEnB,MAAMC,EAAaC,GAAe,CAChC,KAAM,CAAE,UAAAC,EAAW,2BAAAC,EAA4B,WAAAC,CAAW,EAAIH,EACxD,CAAE,aAAAI,CAAa,EAAIP,EAAe,EAClCQ,EAAaD,GAAc,QAAQ,YAEzC,OACEV,EAAC,OACC,SAAU,GACV,UAAWI,EACT,qPACA,gBACAG,CACF,EAEA,UAAAP,EAAC,OAAI,UAAU,0CACb,UAAAA,EAAC,OAAI,UAAU,oDACb,UAAAD,EAACG,EAAA,CAAK,KAAM,EAAG,UAAU,wDAAwD,+CAEjF,EACAH,EAACG,EAAA,CAAK,KAAM,EAAG,GAAG,IAAI,UAAU,gDAC7B,SAAAO,GAAY,wBACf,GACF,EACAV,EAACE,EAAA,CACC,QAAQ,OACR,UAAU,mDACV,QAAS,IAAM,CACbO,EAA2B,EAAI,CACjC,EAEC,SAAAG,GAAY,UACf,GACF,EAEAZ,EAACE,EAAA,CACC,QAAQ,OACR,UAAU,gCACV,QAAS,IAAM,CACbO,EAA2B,EAAI,CACjC,EAEC,SAAAG,GAAY,UACf,GACF,CAEJ,EAEA,IAAOC,EAAQP",
6
6
  "names": ["jsx", "jsxs", "Button", "Text", "useAiuiContext", "cn", "LearnMore", "props", "className", "setOpenShippingPolicyModal", "metafields", "trackingData", "shopCommon", "LearnMore_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as o,jsxs as i}from"react/jsx-runtime";import{formatPrice as u}from"../../utils/index.js";import{useAiuiContext as f}from"../../../AiuiProvider/index.js";import{Text as r}from"../../../../components/index.js";import{cn as t}from"../../../../helpers/index.js";import{ShippingMethodMode as g}from"./type.js";const y=({item:e,index:n,active:l,toggleShipping:p,currencyCode:d,metafields:s,className:x=""})=>{const{trackingData:m,locale:c="us"}=f(),b=m?.common?.copywriting;return i("div",{role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&p(e,n)},className:t("relative flex cursor-pointer items-center gap-[16px] overflow-hidden rounded-[8px] border border-[#E8E8E8] px-[16px] py-[24px] text-[#1F2021] md:py-[16px]",{"cursor-not-allowed opacity-60":e.disabled,"border-brand outline-1 outline-brand [outline-style:solid]":l},x),onClick:()=>p(e,n),children:[i("div",{className:"relative",children:[o(r,{className:t("text-[14px] font-bold leading-[1.4] laptop:text-[16px] lg-desktop:text-[18px]",{}),as:"p",html:e.title}),o(r,{className:t("mt-[8px] text-[12px] font-semibold leading-[1.4] text-[#999999] laptop:text-[14px]",{}),as:"p",html:e.subtitle})]}),o(r,{className:t("relative text-xl font-bold",{}),as:"p",html:e.price?u({amount:e.price,currencyCode:d,locale:c,removeTrailingZeros:!0}):b?.free}),e.mode!==g.FREE&&o("div",{className:t("absolute -right-[1px] -top-[1px] rounded-bl-[8px] rounded-tr-[8px] bg-brand px-[8px] py-[3px] text-[12px] font-bold leading-[1.4] text-white"),children:s?.memberOnly})]})};var w=y;export{w as default};
1
+ import{jsx as o,jsxs as p}from"react/jsx-runtime";import{formatPrice as u}from"../../utils/index.js";import{useAiuiContext as f}from"../../../AiuiProvider/index.js";import{Text as r}from"../../../../components/index.js";import{cn as t}from"../../../../helpers/index.js";import{ShippingMethodMode as g}from"./type.js";const v=({item:e,index:l,active:i,toggleShipping:n,currencyCode:d,metafields:s,className:x=""})=>{const{trackingData:m,locale:c="us"}=f(),b=m?.common?.copywriting;return p("div",{role:"button",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&n(e,l)},className:t("relative flex cursor-pointer items-center gap-[16px] overflow-hidden rounded-xl laptop:rounded-2xl border-[2px] border-[#E8E8E8] p-4 laptop:py-3 text-[#1F2021]",{"cursor-not-allowed opacity-60":e.disabled,"border-brand outline-1 outline-brand [outline-style:solid]":i},x),onClick:()=>n(e,l),children:[p("div",{className:"relative",children:[o(r,{className:t("text-[14px] font-bold leading-[1.4] laptop:text-[16px] lg-desktop:text-[18px]",{}),as:"p",html:e.title}),o(r,{className:t("mt-[8px] text-[12px] font-bold leading-[1.4] text-[#6D6D6F] laptop:text-[14px]",{}),as:"p",html:e.subtitle})]}),o(r,{className:t("relative text-xl font-bold",{}),as:"p",html:e.price?u({amount:e.price,currencyCode:d,locale:c,removeTrailingZeros:!0}):b?.free}),e.mode!==g.FREE&&o("div",{className:t("absolute -right-[1px] -top-[1px] rounded-bl-[8px] rounded-tr-[8px] bg-brand px-[8px] py-[3px] text-[12px] font-bold leading-[1.4] text-white"),children:s?.memberOnly})]})};var w=v;export{w as default};
2
2
  //# sourceMappingURL=ShippingMethod.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/biz-components/Listing/components/PaidShipping/ShippingMethod.tsx"],
4
- "sourcesContent": ["import { formatPrice } from '../../utils/index.js'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { Text } from '../../../../components/index.js'\nimport { cn } from '../../../../helpers/index.js'\nimport { ShippingMethodMode } from './type.js'\n\nconst ShippingMethod = ({\n item,\n index,\n active,\n toggleShipping,\n currencyCode,\n metafields,\n className = '',\n}: {\n item: any\n index: number\n active: boolean\n toggleShipping: (item: any, index: number) => void\n currencyCode: string\n metafields: any\n className?: string\n}) => {\n const { trackingData, locale = 'us' } = useAiuiContext()\n const shopCommon = trackingData?.common?.copywriting\n\n return (\n <div\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n toggleShipping(item, index)\n }\n }}\n className={cn(\n 'relative flex cursor-pointer items-center gap-[16px] overflow-hidden rounded-[8px] border border-[#E8E8E8] px-[16px] py-[24px] text-[#1F2021] md:py-[16px]',\n {\n 'cursor-not-allowed opacity-60': item.disabled,\n 'border-brand outline-1 outline-brand [outline-style:solid]': active,\n },\n className\n )}\n onClick={() => toggleShipping(item, index)}\n >\n <div className=\"relative\">\n <Text\n className={cn('text-[14px] font-bold leading-[1.4] laptop:text-[16px] lg-desktop:text-[18px]', {})}\n as=\"p\"\n html={item.title}\n />\n <Text\n className={cn('mt-[8px] text-[12px] font-semibold leading-[1.4] text-[#999999] laptop:text-[14px]', {})}\n as=\"p\"\n html={item.subtitle}\n />\n </div>\n\n <Text\n className={cn('relative text-xl font-bold', {})}\n as=\"p\"\n html={\n item.price\n ? formatPrice({\n amount: item.price,\n currencyCode,\n locale,\n removeTrailingZeros: true,\n })\n : shopCommon?.free\n }\n />\n {item.mode !== ShippingMethodMode.FREE && (\n <div\n className={cn(\n 'absolute -right-[1px] -top-[1px] rounded-bl-[8px] rounded-tr-[8px] bg-brand px-[8px] py-[3px] text-[12px] font-bold leading-[1.4] text-white'\n )}\n >\n {metafields?.memberOnly}\n </div>\n )}\n </div>\n )\n}\n\nexport default ShippingMethod"],
5
- "mappings": "AA6CM,OACE,OAAAA,EADF,QAAAC,MAAA,oBA7CN,OAAS,eAAAC,MAAmB,uBAC5B,OAAS,kBAAAC,MAAsB,iCAC/B,OAAS,QAAAC,MAAY,kCACrB,OAAS,MAAAC,MAAU,+BACnB,OAAS,sBAAAC,MAA0B,YAEnC,MAAMC,EAAiB,CAAC,CACtB,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,eAAAC,EACA,aAAAC,EACA,WAAAC,EACA,UAAAC,EAAY,EACd,IAQM,CACJ,KAAM,CAAE,aAAAC,EAAc,OAAAC,EAAS,IAAK,EAAIb,EAAe,EACjDc,EAAaF,GAAc,QAAQ,YAEzC,OACEd,EAAC,OACC,KAAK,SACL,SAAU,EACV,UAAWiB,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCP,EAAeH,EAAMC,CAAK,CAE9B,EACA,UAAWJ,EACT,6JACA,CACE,gCAAiCG,EAAK,SACtC,6DAA8DE,CAChE,EACAI,CACF,EACA,QAAS,IAAMH,EAAeH,EAAMC,CAAK,EAEzC,UAAAR,EAAC,OAAI,UAAU,WACb,UAAAD,EAACI,EAAA,CACC,UAAWC,EAAG,gFAAiF,CAAC,CAAC,EACjG,GAAG,IACH,KAAMG,EAAK,MACb,EACAR,EAACI,EAAA,CACC,UAAWC,EAAG,qFAAsF,CAAC,CAAC,EACtG,GAAG,IACH,KAAMG,EAAK,SACb,GACF,EAEAR,EAACI,EAAA,CACC,UAAWC,EAAG,6BAA8B,CAAC,CAAC,EAC9C,GAAG,IACH,KACEG,EAAK,MACDN,EAAY,CACV,OAAQM,EAAK,MACb,aAAAI,EACA,OAAAI,EACA,oBAAqB,EACvB,CAAC,EACDC,GAAY,KAEpB,EACCT,EAAK,OAASF,EAAmB,MAChCN,EAAC,OACC,UAAWK,EACT,8IACF,EAEC,SAAAQ,GAAY,WACf,GAEJ,CAEJ,EAEA,IAAOM,EAAQZ",
4
+ "sourcesContent": ["import { formatPrice } from '../../utils/index.js'\nimport { useAiuiContext } from '../../../AiuiProvider/index.js'\nimport { Text } from '../../../../components/index.js'\nimport { cn } from '../../../../helpers/index.js'\nimport { ShippingMethodMode } from './type.js'\n\nconst ShippingMethod = ({\n item,\n index,\n active,\n toggleShipping,\n currencyCode,\n metafields,\n className = '',\n}: {\n item: any\n index: number\n active: boolean\n toggleShipping: (item: any, index: number) => void\n currencyCode: string\n metafields: any\n className?: string\n}) => {\n const { trackingData, locale = 'us' } = useAiuiContext()\n const shopCommon = trackingData?.common?.copywriting\n\n return (\n <div\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n toggleShipping(item, index)\n }\n }}\n className={cn(\n 'relative flex cursor-pointer items-center gap-[16px] overflow-hidden rounded-xl laptop:rounded-2xl border-[2px] border-[#E8E8E8] p-4 laptop:py-3 text-[#1F2021]',\n {\n 'cursor-not-allowed opacity-60': item.disabled,\n 'border-brand outline-1 outline-brand [outline-style:solid]': active,\n },\n className\n )}\n onClick={() => toggleShipping(item, index)}\n >\n <div className=\"relative\">\n <Text\n className={cn('text-[14px] font-bold leading-[1.4] laptop:text-[16px] lg-desktop:text-[18px]', {})}\n as=\"p\"\n html={item.title}\n />\n <Text\n className={cn('mt-[8px] text-[12px] font-bold leading-[1.4] text-[#6D6D6F] laptop:text-[14px]', {})}\n as=\"p\"\n html={item.subtitle}\n />\n </div>\n\n <Text\n className={cn('relative text-xl font-bold', {})}\n as=\"p\"\n html={\n item.price\n ? formatPrice({\n amount: item.price,\n currencyCode,\n locale,\n removeTrailingZeros: true,\n })\n : shopCommon?.free\n }\n />\n {item.mode !== ShippingMethodMode.FREE && (\n <div\n className={cn(\n 'absolute -right-[1px] -top-[1px] rounded-bl-[8px] rounded-tr-[8px] bg-brand px-[8px] py-[3px] text-[12px] font-bold leading-[1.4] text-white'\n )}\n >\n {metafields?.memberOnly}\n </div>\n )}\n </div>\n )\n}\n\nexport default ShippingMethod"],
5
+ "mappings": "AA6CM,OACE,OAAAA,EADF,QAAAC,MAAA,oBA7CN,OAAS,eAAAC,MAAmB,uBAC5B,OAAS,kBAAAC,MAAsB,iCAC/B,OAAS,QAAAC,MAAY,kCACrB,OAAS,MAAAC,MAAU,+BACnB,OAAS,sBAAAC,MAA0B,YAEnC,MAAMC,EAAiB,CAAC,CACtB,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,eAAAC,EACA,aAAAC,EACA,WAAAC,EACA,UAAAC,EAAY,EACd,IAQM,CACJ,KAAM,CAAE,aAAAC,EAAc,OAAAC,EAAS,IAAK,EAAIb,EAAe,EACjDc,EAAaF,GAAc,QAAQ,YAEzC,OACEd,EAAC,OACC,KAAK,SACL,SAAU,EACV,UAAWiB,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCP,EAAeH,EAAMC,CAAK,CAE9B,EACA,UAAWJ,EACT,kKACA,CACE,gCAAiCG,EAAK,SACtC,6DAA8DE,CAChE,EACAI,CACF,EACA,QAAS,IAAMH,EAAeH,EAAMC,CAAK,EAEzC,UAAAR,EAAC,OAAI,UAAU,WACb,UAAAD,EAACI,EAAA,CACC,UAAWC,EAAG,gFAAiF,CAAC,CAAC,EACjG,GAAG,IACH,KAAMG,EAAK,MACb,EACAR,EAACI,EAAA,CACC,UAAWC,EAAG,iFAAkF,CAAC,CAAC,EAClG,GAAG,IACH,KAAMG,EAAK,SACb,GACF,EAEAR,EAACI,EAAA,CACC,UAAWC,EAAG,6BAA8B,CAAC,CAAC,EAC9C,GAAG,IACH,KACEG,EAAK,MACDN,EAAY,CACV,OAAQM,EAAK,MACb,aAAAI,EACA,OAAAI,EACA,oBAAqB,EACvB,CAAC,EACDC,GAAY,KAEpB,EACCT,EAAK,OAASF,EAAmB,MAChCN,EAAC,OACC,UAAWK,EACT,8IACF,EAEC,SAAAQ,GAAY,WACf,GAEJ,CAEJ,EAEA,IAAOM,EAAQZ",
6
6
  "names": ["jsx", "jsxs", "formatPrice", "useAiuiContext", "Text", "cn", "ShippingMethodMode", "ShippingMethod", "item", "index", "active", "toggleShipping", "currencyCode", "metafields", "className", "trackingData", "locale", "shopCommon", "e", "ShippingMethod_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Text as s,Link as m}from"../../../../components/index.js";import{Dialog as d,DialogContent as g}from"../../../../components/dialog";import{useRouter as x}from"next/router";import{useMemo as c}from"react";const S=({data:i,onClose:f,open:v})=>{const{asPath:o}=x(),a=c(()=>o?.split("?")?.[0]?.substring(1)?.replace(/\//g,"_"),[o]);return e(d,{children:e(g,{children:t("div",{className:"w-[729px] p-[40px] md:w-[358px] md:px-[24px]",children:[e(s,{className:"text-[32px] font-bold leading-[1.2] md:text-[20px]",html:i?.title}),t("div",{className:"mt-[16px]",children:[e(s,{className:"text-[20px] font-bold leading-[1.2] md:text-[16px]",html:i?.shippingCoupon?.title}),e("ul",{className:"mt-3 grid grid-flow-row gap-[4px] font-semibold leading-[1.4]",children:i?.shippingCoupon?.list.map((l,p)=>t("li",{className:"text-[16px]",children:[t("span",{children:[p+1,"."]}),e("span",{className:"ml-[4px]",children:l})]},p))}),t("div",{className:"mt-[24px] md:mt-[16px]",children:[e(s,{className:"text-[20px] font-bold leading-[1.2] md:text-[16px]",html:i?.shippingService?.title}),e("div",{className:"mt-[12px] grid w-full grid-cols-2 gap-[12px] md:grid-cols-1",children:i?.shippingService?.list.map((l,p)=>t("div",{className:"rounded-[12px] bg-[#F5F5F7] p-[16px] md:p-[12px]",children:[e(s,{as:"p",className:"text-[20px] font-bold leading-[1.2] md:text-[16px]",html:l.title}),e("div",{className:"mt-[12px] grid grid-flow-row gap-[4px]",children:l.list.map((n,r)=>e(s,{as:"p",className:"text-[16px] font-semibold leading-[1.2]",children:n},r))})]},p))})]}),e(m,{className:"mt-[16px] block text-[16px] font-semibold leading-[1.2] underline",href:`${i?.terms?.url}?ref=${a}`,children:i?.terms?.text})]})]})})})};export{S as ShippingPolicyModal};
1
+ import{jsx as e,jsxs as i}from"react/jsx-runtime";import{Text as l,Link as x}from"../../../../components/index.js";import{Dialog as d,DialogContent as c}from"../../../../components/dialog";import{useRouter as f}from"next/router";import{useMemo as v}from"react";const S=({data:t,onClose:a,open:n})=>{const{asPath:o}=f(),r=v(()=>o?.split("?")?.[0]?.substring(1)?.replace(/\//g,"_"),[o]);return e(d,{open:n,onOpenChange:a,children:i(c,{overlayClassName:"z-[70]",className:"tablet:max-w-[729px] max-w-[326px] mx-auto w-full border-none z-[80] overflow-hidden",children:[e(l,{className:"text-[32px] font-bold leading-[1.2] md:text-[20px]",html:t?.title}),i("div",{className:"mt-[16px]",children:[e(l,{className:"text-[20px] font-bold leading-[1.2] md:text-[16px]",html:t?.shippingCoupon?.title}),e("ul",{className:"mt-3 grid grid-flow-row gap-[4px] font-semibold leading-[1.4]",children:t?.shippingCoupon?.list.map((s,p)=>i("li",{className:"text-[16px]",children:[i("span",{children:[p+1,"."]}),e("span",{className:"ml-[4px]",children:s})]},p))}),i("div",{className:"mt-[24px] md:mt-[16px]",children:[e(l,{className:"text-[20px] font-bold leading-[1.2] md:text-[16px]",html:t?.shippingService?.title}),e("div",{className:"mt-[12px] grid w-full grid-cols-2 gap-[12px] md:grid-cols-1",children:t?.shippingService?.list.map((s,p)=>i("div",{className:"rounded-[12px] bg-[#F5F5F7] p-[16px] md:p-[12px]",children:[e(l,{as:"p",className:"text-[20px] font-bold leading-[1.2] md:text-[16px]",html:s.title}),e("div",{className:"mt-[12px] grid grid-flow-row gap-[4px]",children:s.list.map((m,g)=>e(l,{as:"p",className:"text-[16px] font-semibold leading-[1.2]",children:m},g))})]},p))})]}),e(x,{className:"mt-[16px] block text-[16px] font-semibold leading-[1.2] underline",href:`${t?.terms?.url}?ref=${r}`,children:t?.terms?.text})]})]})})};export{S as ShippingPolicyModal};
2
2
  //# sourceMappingURL=ShippingPolicyModal.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/biz-components/Listing/components/PaidShipping/ShippingPolicyModal.tsx"],
4
- "sourcesContent": ["import { Text, Link } from '../../../../components/index.js'\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '../../../../components/dialog'\nimport { useRouter } from 'next/router'\nimport { useMemo } from 'react'\n\ninterface Terms {\n text: string\n url: string\n}\n\ninterface List {\n title: string\n list: string[]\n}\n\ninterface ShippingService {\n title: string\n list: List[]\n}\n\ninterface Data {\n title: string\n shippingCoupon: List\n shippingService: ShippingService\n terms: Terms\n}\n\ninterface Props {\n data: Data\n onClose: () => void\n open: boolean\n}\n\nexport const ShippingPolicyModal = ({ data, onClose, open }: Props) => {\n const { asPath } = useRouter()\n const ref = useMemo(() => {\n return asPath?.split('?')?.[0]?.substring(1)?.replace(/\\//g, '_')\n }, [asPath])\n return (\n <Dialog>\n <DialogContent>\n <div\n className=\"w-[729px] p-[40px] md:w-[358px] md:px-[24px]\"\n // closeModal={onClose}\n // showModal={open}\n // stickyHeader={false}\n >\n <Text className=\"text-[32px] font-bold leading-[1.2] md:text-[20px]\" html={data?.title} />\n <div className=\"mt-[16px]\">\n <Text className=\"text-[20px] font-bold leading-[1.2] md:text-[16px]\" html={data?.shippingCoupon?.title} />\n <ul className=\"mt-3 grid grid-flow-row gap-[4px] font-semibold leading-[1.4]\">\n {data?.shippingCoupon?.list.map((item, index) => (\n <li className=\"text-[16px]\" key={index}>\n <span>{index + 1}.</span>\n <span className=\"ml-[4px]\">{item}</span>\n </li>\n ))}\n </ul>\n <div className=\"mt-[24px] md:mt-[16px]\">\n <Text\n className=\"text-[20px] font-bold leading-[1.2] md:text-[16px]\"\n html={data?.shippingService?.title}\n />\n <div className=\"mt-[12px] grid w-full grid-cols-2 gap-[12px] md:grid-cols-1\">\n {data?.shippingService?.list.map((item, index) => (\n <div className=\"rounded-[12px] bg-[#F5F5F7] p-[16px] md:p-[12px]\" key={index}>\n <Text as=\"p\" className=\"text-[20px] font-bold leading-[1.2] md:text-[16px]\" html={item.title} />\n <div className=\"mt-[12px] grid grid-flow-row gap-[4px]\">\n {item.list.map((subItem, subIndex) => (\n <Text as=\"p\" className=\"text-[16px] font-semibold leading-[1.2]\" key={subIndex}>\n {subItem}\n </Text>\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n\n <Link\n className=\"mt-[16px] block text-[16px] font-semibold leading-[1.2] underline\"\n href={`${data?.terms?.url}?ref=${ref}`}\n >\n {data?.terms?.text}\n </Link>\n </div>\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n"],
5
- "mappings": "AA+CU,cAAAA,EAMQ,QAAAC,MANR,oBA/CV,OAAS,QAAAC,EAAM,QAAAC,MAAY,kCAC3B,OAAS,UAAAC,EAAQ,iBAAAC,MAA+D,gCAChF,OAAS,aAAAC,MAAiB,cAC1B,OAAS,WAAAC,MAAe,QA8BjB,MAAMC,EAAsB,CAAC,CAAE,KAAAC,EAAM,QAAAC,EAAS,KAAAC,CAAK,IAAa,CACrE,KAAM,CAAE,OAAAC,CAAO,EAAIN,EAAU,EACvBO,EAAMN,EAAQ,IACXK,GAAQ,MAAM,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,QAAQ,MAAO,GAAG,EAC/D,CAACA,CAAM,CAAC,EACX,OACEZ,EAACI,EAAA,CACC,SAAAJ,EAACK,EAAA,CACC,SAAAJ,EAAC,OACC,UAAU,+CAKV,UAAAD,EAACE,EAAA,CAAK,UAAU,qDAAqD,KAAMO,GAAM,MAAO,EACxFR,EAAC,OAAI,UAAU,YACb,UAAAD,EAACE,EAAA,CAAK,UAAU,qDAAqD,KAAMO,GAAM,gBAAgB,MAAO,EACxGT,EAAC,MAAG,UAAU,gEACX,SAAAS,GAAM,gBAAgB,KAAK,IAAI,CAACK,EAAMC,IACrCd,EAAC,MAAG,UAAU,cACZ,UAAAA,EAAC,QAAM,UAAAc,EAAQ,EAAE,KAAC,EAClBf,EAAC,QAAK,UAAU,WAAY,SAAAc,EAAK,IAFFC,CAGjC,CACD,EACH,EACAd,EAAC,OAAI,UAAU,yBACb,UAAAD,EAACE,EAAA,CACC,UAAU,qDACV,KAAMO,GAAM,iBAAiB,MAC/B,EACAT,EAAC,OAAI,UAAU,8DACZ,SAAAS,GAAM,iBAAiB,KAAK,IAAI,CAACK,EAAMC,IACtCd,EAAC,OAAI,UAAU,mDACb,UAAAD,EAACE,EAAA,CAAK,GAAG,IAAI,UAAU,qDAAqD,KAAMY,EAAK,MAAO,EAC9Fd,EAAC,OAAI,UAAU,yCACZ,SAAAc,EAAK,KAAK,IAAI,CAACE,EAASC,IACvBjB,EAACE,EAAA,CAAK,GAAG,IAAI,UAAU,0CACpB,SAAAc,GADmEC,CAEtE,CACD,EACH,IARqEF,CASvE,CACD,EACH,GACF,EAEAf,EAACG,EAAA,CACC,UAAU,oEACV,KAAM,GAAGM,GAAM,OAAO,GAAG,QAAQI,CAAG,GAEnC,SAAAJ,GAAM,OAAO,KAChB,GACF,GACF,EACF,EACF,CAEJ",
4
+ "sourcesContent": ["import { Text, Link } from '../../../../components/index.js'\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '../../../../components/dialog'\nimport { useRouter } from 'next/router'\nimport { useMemo } from 'react'\n\ninterface Terms {\n text: string\n url: string\n}\n\ninterface List {\n title: string\n list: string[]\n}\n\ninterface ShippingService {\n title: string\n list: List[]\n}\n\ninterface Data {\n title: string\n shippingCoupon: List\n shippingService: ShippingService\n terms: Terms\n}\n\ninterface Props {\n data: Data\n onClose: () => void\n open: boolean\n}\n\nexport const ShippingPolicyModal = ({ data, onClose, open }: Props) => {\n const { asPath } = useRouter()\n const ref = useMemo(() => {\n return asPath?.split('?')?.[0]?.substring(1)?.replace(/\\//g, '_')\n }, [asPath])\n return (\n <Dialog open={open} onOpenChange={onClose}>\n <DialogContent overlayClassName=\"z-[70]\" className=\"tablet:max-w-[729px] max-w-[326px] mx-auto w-full border-none z-[80] overflow-hidden\">\n <Text className=\"text-[32px] font-bold leading-[1.2] md:text-[20px]\" html={data?.title} />\n <div className=\"mt-[16px]\">\n <Text className=\"text-[20px] font-bold leading-[1.2] md:text-[16px]\" html={data?.shippingCoupon?.title} />\n <ul className=\"mt-3 grid grid-flow-row gap-[4px] font-semibold leading-[1.4]\">\n {data?.shippingCoupon?.list.map((item, index) => (\n <li className=\"text-[16px]\" key={index}>\n <span>{index + 1}.</span>\n <span className=\"ml-[4px]\">{item}</span>\n </li>\n ))}\n </ul>\n <div className=\"mt-[24px] md:mt-[16px]\">\n <Text className=\"text-[20px] font-bold leading-[1.2] md:text-[16px]\" html={data?.shippingService?.title} />\n <div className=\"mt-[12px] grid w-full grid-cols-2 gap-[12px] md:grid-cols-1\">\n {data?.shippingService?.list.map((item, index) => (\n <div className=\"rounded-[12px] bg-[#F5F5F7] p-[16px] md:p-[12px]\" key={index}>\n <Text as=\"p\" className=\"text-[20px] font-bold leading-[1.2] md:text-[16px]\" html={item.title} />\n <div className=\"mt-[12px] grid grid-flow-row gap-[4px]\">\n {item.list.map((subItem, subIndex) => (\n <Text as=\"p\" className=\"text-[16px] font-semibold leading-[1.2]\" key={subIndex}>\n {subItem}\n </Text>\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n\n <Link\n className=\"mt-[16px] block text-[16px] font-semibold leading-[1.2] underline\"\n href={`${data?.terms?.url}?ref=${ref}`}\n >\n {data?.terms?.text}\n </Link>\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n"],
5
+ "mappings": "AAyCQ,cAAAA,EAMQ,QAAAC,MANR,oBAzCR,OAAS,QAAAC,EAAM,QAAAC,MAAY,kCAC3B,OAAS,UAAAC,E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EC,CAEtE,CACD,EACH,IARqEF,CASvE,CACD,EACH,GACF,EAEAf,EAACG,EAAA,CACC,UAAU,oEACV,KAAM,GAAGM,GAAM,OAAO,GAAG,QAAQI,CAAG,GAEnC,SAAAJ,GAAM,OAAO,KAChB,GACF,GACF,EACF,CAEJ",
6
6
  "names": ["jsx", "jsxs", "Text", "Link", "Dialog", "DialogContent", "useRouter", "useMemo", "ShippingPolicyModal", "data", "onClose", "open", "asPath", "ref", "item", "index", "subItem", "subIndex"]
7
7
  }
@@ -1,2 +1,2 @@
1
- import{jsx as o,jsxs as T}from"react/jsx-runtime";import{Text as c}from"../../../../components/index.js";import{useCallback as h,useEffect as O,useMemo as v,useState as g}from"react";import{cn as z}from"../../../../helpers";import D from"./ShippingMethod";import{ShippingPolicyModal as E}from"./ShippingPolicyModal";import{isWeightAvailable as b}from"./utils";import I from"./LearnMore";import{useBizProductContext as L}from"../../BizProductProvider.js";const V=({metafields:i,productList:m,onShippingInfoChange:u,variant:y,className:P})=>{const{isLogin:_,openSignInPopup:w}=L(),[C,M]=g(!1),[S,N]=g(!1),[k,f]=g(null),x=v(()=>m.reduce((e,t)=>e+(t?.variant?.weight||0),0),[m]),r=h((e,t,n)=>({id:`${e.__code}__${e.price}`,code:e.__code,mode:e.__mode,title:e.title,disabled:!b(t,e),price:e.price,subtitle:e.subtitle,tag:n!==0?i?.memberOnly:"",error:b(t,e)?"":i.overWeightError}),[i?.memberOnly,i.overWeightError]),l=v(()=>{const e=i?.list?.map((t,n)=>r(t,x,n));return e?.reduce((t,n)=>{const d=e.filter(p=>p.code==n.code);let s;return d.every(p=>p.disabled)?s=d[d.length-1]:s=d.find(p=>!p.disabled),t.find(p=>s.id===p.id)?t:[...t,s]},[])},[r,i?.list,x]),a=h(e=>{u({selected_delivery_code:e.code,selected_delivery_mode:e.mode})},[u]);O(()=>{if(i?.list?.length>0&&!S){const e=r(i?.list[0],0,0);f(e),a(e),N(!0)}},[r,i?.list,a,S]);const A=h(e=>{e.disabled||(f(e),a(e))},[_,l,y.sku,a,w]);return T("div",{className:z("mt-[40px]",P),children:[o("div",{className:"flex flex-wrap justify-between space-x-2 md:space-x-1",children:o(c,{className:"text-[20px] font-bold leading-[1.4] text-[#1F2021] md:text-[16px]",html:i?.title})}),T("div",{className:"mt-[16px] flex flex-wrap gap-[12px] overflow-hidden md:mt-[12px] desktop:flex-nowrap",children:[l.map((e,t)=>o(D,{index:t,item:e,active:k?.code===e.code,toggleShipping:()=>A(e),currencyCode:y.price.currencyCode,metafields:i,className:"w-full laptop:w-[calc(50%-6px)] desktop:flex-1"},t)),o(I,{setOpenShippingPolicyModal:M,metafields:i,className:"w-full laptop:w-[calc(50%-6px)] desktop:w-1/3"})]}),l.find(e=>e?.error)&&o(c,{className:"mt-[16px] font-bold leading-[1.4] text-[#D41435] md:mt-[12px]",html:l.find(e=>e.error)?.error,as:"p"}),i?.seeAvailableArea&&o(c,{as:"div",className:"mt-[16px] font-bold leading-[1.4] text-[#1F2021] [&_a]:text-[#595959] [&_a]:underline",html:i?.seeAvailableArea}),i?.shippingPolicy&&o(E,{data:i?.shippingPolicy,onClose:()=>M(!1),open:C})]})};var Q=V;export{Q as default};
1
+ import{jsx as o,jsxs as T}from"react/jsx-runtime";import{Text as c}from"../../../../components/index.js";import{useCallback as h,useEffect as O,useMemo as b,useState as g}from"react";import{cn as z}from"../../../../helpers";import D from"./ShippingMethod";import{ShippingPolicyModal as E}from"./ShippingPolicyModal";import{isWeightAvailable as v}from"./utils";import I from"./LearnMore";import{useBizProductContext as L}from"../../BizProductProvider.js";const V=({metafields:i,productList:u,onShippingInfoChange:m,variant:y,className:P})=>{const{isLogin:_,openSignInPopup:w}=L(),[C,x]=g(!1),[M,N]=g(!1),[k,S]=g(null),f=b(()=>u.reduce((e,p)=>e+(p?.variant?.weight||0),0),[u]),r=h((e,p,n)=>({id:`${e.__code}__${e.price}`,code:e.__code,mode:e.__mode,title:e.title,disabled:!v(p,e),price:e.price,subtitle:e.subtitle,tag:n!==0?i?.memberOnly:"",error:v(p,e)?"":i.overWeightError}),[i?.memberOnly,i.overWeightError]),l=b(()=>{const e=i?.list?.map((p,n)=>r(p,f,n));return e?.reduce((p,n)=>{const d=e.filter(t=>t.code==n.code);let s;return d.every(t=>t.disabled)?s=d[d.length-1]:s=d.find(t=>!t.disabled),p.find(t=>s.id===t.id)?p:[...p,s]},[])},[r,i?.list,f]),a=h(e=>{m({selected_delivery_code:e.code,selected_delivery_mode:e.mode})},[m]);O(()=>{if(i?.list?.length>0&&!M){const e=r(i?.list[0],0,0);S(e),a(e),N(!0)}},[r,i?.list,a,M]);const A=h(e=>{e.disabled||(S(e),a(e))},[_,l,y.sku,a,w]);return T("div",{id:"ipc-product-paid-shipping",className:z(" mt-[40px] px-4 tablet:px-0 pb-4 tablet:px-8 laptop:px-16 desktop:px-0",P),children:[o("div",{className:"flex flex-wrap justify-between space-x-2 md:space-x-1",children:o(c,{className:"text-[20px] font-bold leading-[1.4] text-[#1F2021] md:text-[16px]",html:i?.title})}),T("div",{className:"mt-[16px] flex flex-wrap gap-[12px] overflow-hidden md:mt-[12px] desktop:flex-nowrap",children:[l.map((e,p)=>o(D,{index:p,item:e,active:k?.code===e.code,toggleShipping:()=>A(e),currencyCode:y.price.currencyCode,metafields:i,className:"w-full laptop:w-[calc(50%-6px)] desktop:flex-1"},p)),o(I,{setOpenShippingPolicyModal:x,metafields:i,className:"w-full laptop:w-[calc(50%-6px)] desktop:w-1/3"})]}),l.find(e=>e?.error)&&o(c,{className:"mt-[16px] font-bold leading-[1.4] text-[#D41435] md:mt-[12px]",html:l.find(e=>e.error)?.error,as:"p"}),i?.seeAvailableArea&&o(c,{as:"div",className:"mt-[16px] font-bold leading-[1.4] text-[#1F2021] [&_a]:text-[#595959] [&_a]:underline",html:i?.seeAvailableArea}),i?.shippingPolicy&&o(E,{data:i?.shippingPolicy,onClose:()=>x(!1),open:C})]})};var Q=V;export{Q as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/biz-components/Listing/components/PaidShipping/index.tsx"],
4
- "sourcesContent": ["import { Container, Text } from '../../../../components/index.js'\nimport type { Product, ProductVariant } from '../../types/product'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport { cn } from '../../../../helpers'\n\nimport ShippingMethod from './ShippingMethod'\nimport { ShippingPolicyModal } from './ShippingPolicyModal'\nimport type { DeliveryCustom, shippingMetafields, ShippingMethodType } from './type'\nimport { isWeightAvailable } from './utils'\nimport LearnMore from './LearnMore'\nimport { useBizProductContext } from '../../BizProductProvider.js'\n\nconst PaidShipping = ({\n metafields,\n productList,\n onShippingInfoChange,\n variant,\n className,\n}: {\n metafields: any\n productList: Array<Product & { variant: ProductVariant }>\n variant: ProductVariant\n onShippingInfoChange: (deliveryCustom: DeliveryCustom) => void\n className?: string\n}) => {\n const { isLogin, openSignInPopup } = useBizProductContext()\n const [openShippingPolicyModal, setOpenShippingPolicyModal] = useState(false)\n const [init, setInit] = useState(false)\n\n const [selectedMethod, setSelectedMethod] = useState<ShippingMethodType | null>(null)\n\n const weight = useMemo(() => {\n return productList.reduce((acc, product) => acc + (product?.variant?.weight || 0), 0)\n }, [productList])\n\n const normalizedMethod = useCallback(\n (method: shippingMetafields, weight: number, index: number) => {\n return {\n id: `${method.__code}__${method.price}`,\n code: method.__code,\n mode: method.__mode,\n title: method.title,\n disabled: !isWeightAvailable(weight, method),\n price: method.price,\n subtitle: method.subtitle,\n tag: index !== 0 ? metafields?.memberOnly : '',\n error: !isWeightAvailable(weight, method) ? metafields.overWeightError : '',\n }\n },\n [metafields?.memberOnly, metafields.overWeightError],\n )\n\n const list = useMemo(() => {\n const normalizedList: ShippingMethodType[] = metafields?.list?.map((method: shippingMetafields, index: number) => normalizedMethod(method, weight, index))\n\n return normalizedList?.reduce((prev: ShippingMethodType[], method: ShippingMethodType) => {\n // \u5982\u679C\u8D85\u91CD\uFF0C\u540C\u4E00\u4E2A\u7269\u6D41\u9009\u9879\u7C7B\u578B\u4E0B\uFF0C\u5C55\u793A\u5176\u4E2D\u4E00\u4E2A\u4E14\u4E0D\u53EF\u9009\n const sameTypeMethod = normalizedList.filter((m: ShippingMethodType) => m.code == method.code)\n let availableMethod: ShippingMethodType\n // \u6240\u6709\u7269\u6D41\u9009\u9879\u90FD\u4E0D\u53EF\u9009\n if (sameTypeMethod.every((m: ShippingMethodType) => m.disabled)) {\n availableMethod = sameTypeMethod[sameTypeMethod.length - 1]\n } else {\n // \u53EF\u9009\u7269\u6D41\u9009\u9879\n availableMethod = sameTypeMethod.find((m: ShippingMethodType) => !m.disabled)!\n }\n // \u5F53\u524D\u7269\u6D41\u9009\u9879\u5DF2\u5B58\u5728\n const hasSameMethod = prev.find((m: ShippingMethodType) => availableMethod.id === m.id)\n if (!hasSameMethod) {\n return [...prev, availableMethod]\n } else {\n return prev\n }\n }, [] as ShippingMethodType[])\n }, [normalizedMethod, metafields?.list, weight])\n\n const handleChangeShippingInfo = useCallback(\n (selectedMethod: ShippingMethodType) => {\n onShippingInfoChange({\n selected_delivery_code: selectedMethod.code,\n selected_delivery_mode: selectedMethod.mode,\n })\n },\n [onShippingInfoChange],\n )\n\n useEffect(() => {\n // \u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u7269\u6D41\u9009\u9879\n if (metafields?.list?.length > 0 && !init) {\n const standardShippingMethod = normalizedMethod(metafields?.list[0], 0, 0)\n setSelectedMethod(standardShippingMethod)\n handleChangeShippingInfo(standardShippingMethod)\n setInit(true)\n }\n }, [normalizedMethod, metafields?.list, handleChangeShippingInfo, init])\n\n const toggleShipping = useCallback(\n (method: ShippingMethodType) => {\n if (method.disabled) {\n return\n }\n setSelectedMethod(method)\n handleChangeShippingInfo(method)\n // gaTrack({\n // event: 'ga4Event',\n // event_name: 'lp_button',\n // member_active_status: isLogin ? 'active' : 'not active', //\u7528\u4E8E\u8F93\u5165code\u6FC0\u6D3B\u4F1A\u5458\u5F39'\u7A97\u7684\u6309\u94AE\uFF0C\u533A\u5206\u4F1A\u5458\u6FC0\u6D3B\u72B6\u6001\uFF0C\u4F20active\u6216not active\n // event_parameters: {\n // page_group: 'Product Detail Page' + variant.sku, //\u5982\u679C\u662F\u9996\u9875\uFF0C\u5219\u4F20\"Home Page\";\u5982\u679C\u662Flisting\u7684\u9996\u5C4F\u6309\u94AE\uFF0C\u4F20Product Detail Page+$SKU\n // position: 'masterbanner1', //\u4F4D\u7F6E\u6807\u8BB0\u3002\u9996\u9875\u9996\u5C4F\u8F6E\u64AD\u4F4D\u7F6E\u4F20masterbanner1\u3001masterbanner2\u3001masterbanner3\uFF0C\u7B2C\u4E8C\u5C4F\u4F202nd_banner\uFF0C\u7B2C\u4E09\u5C4F\u4F203rd_banner\uFF0C\u6216\u8005\u53D6\u8BE5\u6A21\u5757\u5C0F\u6807\u9898\uFF0C\u6216\u80FD\u8BC6\u522B\u51FA\u662F\u54EA\u4E2A\u6A21\u5757\u4F4D\u7F6E\u7684\u6587\u6848\uFF0C\u5F39\u7A97\u4F20pop;\u5982\u679C\u662F\u8D2D\u7269\u8F66\u4FA7\u8FB9\u680F\uFF0C\u5219\u4F20\"Cart Pop Up\"\n // button_name: method.title, //\u53D6\u6309\u94AE\u6587\u6848\uFF0C\u6216\u80FD\u8BC6\u522B\u51FA\u662F\u54EA\u4E2A\u6309\u94AE\u7684\u6587\u6848,\u6BD4\u5982\u53F3\u4E0A\u89D2\u5173\u95ED\u4F20close,\u793E\u5A92\u5206\u4EAB\u56FE\u6807\u4F20\u5BF9\u5E94\u5E73\u53F0\u540D\u5B57\u5982Facebook,\u56FE\u7247\u5207\u6362\u5219\u4F20\u5BF9\u5E94\u5C55\u793A\u56FE\u7247\u7684\u540D\u5B57\n // info: '', //\u9ED8\u8BA4\u7A7A\u503C\uFF0C\u4E00\u822C\u4F20\u590D\u9009\u6846\u7684\u6587\u6848\u5185\u5BB9\uFF0C\u7279\u6B8A\u60C5\u51B5\u53EF\u6307\u5B9Ainfo\u503C\n // },\n // })\n },\n\n [isLogin, list, variant.sku, handleChangeShippingInfo, openSignInPopup],\n )\n\n return (\n <div className={cn('mt-[40px]', className)}>\n <div className='flex flex-wrap justify-between space-x-2 md:space-x-1'>\n <Text\n className='text-[20px] font-bold leading-[1.4] text-[#1F2021] md:text-[16px]'\n html={metafields?.title}\n ></Text>\n {/* <button\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n className='text-brand-color text-[16px] font-semibold text-[#595959] underline md:text-[14px]'\n >\n {metafields?.policy}\n </button> */}\n </div>\n <div className='mt-[16px] flex flex-wrap gap-[12px] overflow-hidden md:mt-[12px] desktop:flex-nowrap'>\n {list.map((method: ShippingMethodType, index: number) => (\n <ShippingMethod\n key={index}\n index={index}\n item={method}\n active={selectedMethod?.code === method.code}\n toggleShipping={() => toggleShipping(method)}\n currencyCode={variant.price.currencyCode}\n metafields={metafields}\n className='w-full laptop:w-[calc(50%-6px)] desktop:flex-1'\n />\n ))}\n {/* learn more \u5361\u7247 */}\n <LearnMore\n setOpenShippingPolicyModal={setOpenShippingPolicyModal}\n metafields={metafields}\n className='w-full laptop:w-[calc(50%-6px)] desktop:w-1/3'\n />\n </div>\n {list.find((method: ShippingMethodType) => method?.error) && (\n <Text\n className='mt-[16px] font-bold leading-[1.4] text-[#D41435] md:mt-[12px]'\n html={list.find((method: ShippingMethodType) => method.error)?.error as string}\n as='p'\n />\n )}\n\n {metafields?.seeAvailableArea && (\n <Text\n as='div'\n className='mt-[16px] font-bold leading-[1.4] text-[#1F2021] [&_a]:text-[#595959] [&_a]:underline'\n html={metafields?.seeAvailableArea}\n />\n )}\n {metafields?.shippingPolicy && (\n <ShippingPolicyModal\n data={metafields?.shippingPolicy}\n onClose={() => setOpenShippingPolicyModal(false)}\n open={openShippingPolicyModal}\n />\n )}\n </div>\n )\n}\n\nexport default PaidShipping"],
5
- "mappings": "AA0HQ,cAAAA,EAaF,QAAAC,MAbE,oBA1HR,OAAoB,QAAAC,MAAY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AOwB,EACP,KAAMD,EACN,OAAQN,GAAgB,OAASM,EAAO,KACxC,eAAgB,IAAMU,EAAeV,CAAM,EAC3C,aAAcd,EAAQ,MAAM,aAC5B,WAAYH,EACZ,UAAU,kDAPLkB,CAQP,CACD,EAEDhC,EAACW,EAAA,CACC,2BAA4BW,EAC5B,WAAYR,EACZ,UAAU,gDACZ,GACF,EACCmB,EAAK,KAAMF,GAA+BA,GAAQ,KAAK,GACtD/B,EAACE,EAAA,CACC,UAAU,gEACV,KAAM+B,EAAK,KAAMF,GAA+BA,EAAO,KAAK,GAAG,MAC/D,GAAG,IACL,EAGDjB,GAAY,kBACXd,EAACE,EAAA,CACC,GAAG,MACH,UAAU,wFACV,KAAMY,GAAY,iBACpB,EAEDA,GAAY,gBACXd,EAACS,EAAA,CACC,KAAMK,GAAY,eAClB,QAAS,IAAMQ,EAA2B,EAAK,EAC/C,KAAMD,EACR,GAEJ,CAEJ,EAEA,IAAOqB,EAAQ7B",
4
+ "sourcesContent": ["import { Container, Text } from '../../../../components/index.js'\nimport type { Product, ProductVariant } from '../../types/product'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport { cn } from '../../../../helpers'\n\nimport ShippingMethod from './ShippingMethod'\nimport { ShippingPolicyModal } from './ShippingPolicyModal'\nimport type { DeliveryCustom, shippingMetafields, ShippingMethodType } from './type'\nimport { isWeightAvailable } from './utils'\nimport LearnMore from './LearnMore'\nimport { useBizProductContext } from '../../BizProductProvider.js'\n\nconst PaidShipping = ({\n metafields,\n productList,\n onShippingInfoChange,\n variant,\n className,\n}: {\n metafields: any\n productList: Array<Product & { variant: ProductVariant }>\n variant: ProductVariant\n onShippingInfoChange: (deliveryCustom: DeliveryCustom) => void\n className?: string\n}) => {\n const { isLogin, openSignInPopup } = useBizProductContext()\n const [openShippingPolicyModal, setOpenShippingPolicyModal] = useState(false)\n const [init, setInit] = useState(false)\n\n const [selectedMethod, setSelectedMethod] = useState<ShippingMethodType | null>(null)\n\n const weight = useMemo(() => {\n return productList.reduce((acc, product) => acc + (product?.variant?.weight || 0), 0)\n }, [productList])\n\n const normalizedMethod = useCallback(\n (method: shippingMetafields, weight: number, index: number) => {\n return {\n id: `${method.__code}__${method.price}`,\n code: method.__code,\n mode: method.__mode,\n title: method.title,\n disabled: !isWeightAvailable(weight, method),\n price: method.price,\n subtitle: method.subtitle,\n tag: index !== 0 ? metafields?.memberOnly : '',\n error: !isWeightAvailable(weight, method) ? metafields.overWeightError : '',\n }\n },\n [metafields?.memberOnly, metafields.overWeightError],\n )\n\n const list = useMemo(() => {\n const normalizedList: ShippingMethodType[] = metafields?.list?.map((method: shippingMetafields, index: number) => normalizedMethod(method, weight, index))\n\n return normalizedList?.reduce((prev: ShippingMethodType[], method: ShippingMethodType) => {\n // \u5982\u679C\u8D85\u91CD\uFF0C\u540C\u4E00\u4E2A\u7269\u6D41\u9009\u9879\u7C7B\u578B\u4E0B\uFF0C\u5C55\u793A\u5176\u4E2D\u4E00\u4E2A\u4E14\u4E0D\u53EF\u9009\n const sameTypeMethod = normalizedList.filter((m: ShippingMethodType) => m.code == method.code)\n let availableMethod: ShippingMethodType\n // \u6240\u6709\u7269\u6D41\u9009\u9879\u90FD\u4E0D\u53EF\u9009\n if (sameTypeMethod.every((m: ShippingMethodType) => m.disabled)) {\n availableMethod = sameTypeMethod[sameTypeMethod.length - 1]\n } else {\n // \u53EF\u9009\u7269\u6D41\u9009\u9879\n availableMethod = sameTypeMethod.find((m: ShippingMethodType) => !m.disabled)!\n }\n // \u5F53\u524D\u7269\u6D41\u9009\u9879\u5DF2\u5B58\u5728\n const hasSameMethod = prev.find((m: ShippingMethodType) => availableMethod.id === m.id)\n if (!hasSameMethod) {\n return [...prev, availableMethod]\n } else {\n return prev\n }\n }, [] as ShippingMethodType[])\n }, [normalizedMethod, metafields?.list, weight])\n\n const handleChangeShippingInfo = useCallback(\n (selectedMethod: ShippingMethodType) => {\n onShippingInfoChange({\n selected_delivery_code: selectedMethod.code,\n selected_delivery_mode: selectedMethod.mode,\n })\n },\n [onShippingInfoChange],\n )\n\n useEffect(() => {\n // \u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u7269\u6D41\u9009\u9879\n if (metafields?.list?.length > 0 && !init) {\n const standardShippingMethod = normalizedMethod(metafields?.list[0], 0, 0)\n setSelectedMethod(standardShippingMethod)\n handleChangeShippingInfo(standardShippingMethod)\n setInit(true)\n }\n }, [normalizedMethod, metafields?.list, handleChangeShippingInfo, init])\n\n const toggleShipping = useCallback(\n (method: ShippingMethodType) => {\n if (method.disabled) {\n return\n }\n setSelectedMethod(method)\n handleChangeShippingInfo(method)\n // gaTrack({\n // event: 'ga4Event',\n // event_name: 'lp_button',\n // member_active_status: isLogin ? 'active' : 'not active', //\u7528\u4E8E\u8F93\u5165code\u6FC0\u6D3B\u4F1A\u5458\u5F39'\u7A97\u7684\u6309\u94AE\uFF0C\u533A\u5206\u4F1A\u5458\u6FC0\u6D3B\u72B6\u6001\uFF0C\u4F20active\u6216not active\n // event_parameters: {\n // page_group: 'Product Detail Page' + variant.sku, //\u5982\u679C\u662F\u9996\u9875\uFF0C\u5219\u4F20\"Home Page\";\u5982\u679C\u662Flisting\u7684\u9996\u5C4F\u6309\u94AE\uFF0C\u4F20Product Detail Page+$SKU\n // position: 'masterbanner1', //\u4F4D\u7F6E\u6807\u8BB0\u3002\u9996\u9875\u9996\u5C4F\u8F6E\u64AD\u4F4D\u7F6E\u4F20masterbanner1\u3001masterbanner2\u3001masterbanner3\uFF0C\u7B2C\u4E8C\u5C4F\u4F202nd_banner\uFF0C\u7B2C\u4E09\u5C4F\u4F203rd_banner\uFF0C\u6216\u8005\u53D6\u8BE5\u6A21\u5757\u5C0F\u6807\u9898\uFF0C\u6216\u80FD\u8BC6\u522B\u51FA\u662F\u54EA\u4E2A\u6A21\u5757\u4F4D\u7F6E\u7684\u6587\u6848\uFF0C\u5F39\u7A97\u4F20pop;\u5982\u679C\u662F\u8D2D\u7269\u8F66\u4FA7\u8FB9\u680F\uFF0C\u5219\u4F20\"Cart Pop Up\"\n // button_name: method.title, //\u53D6\u6309\u94AE\u6587\u6848\uFF0C\u6216\u80FD\u8BC6\u522B\u51FA\u662F\u54EA\u4E2A\u6309\u94AE\u7684\u6587\u6848,\u6BD4\u5982\u53F3\u4E0A\u89D2\u5173\u95ED\u4F20close,\u793E\u5A92\u5206\u4EAB\u56FE\u6807\u4F20\u5BF9\u5E94\u5E73\u53F0\u540D\u5B57\u5982Facebook,\u56FE\u7247\u5207\u6362\u5219\u4F20\u5BF9\u5E94\u5C55\u793A\u56FE\u7247\u7684\u540D\u5B57\n // info: '', //\u9ED8\u8BA4\u7A7A\u503C\uFF0C\u4E00\u822C\u4F20\u590D\u9009\u6846\u7684\u6587\u6848\u5185\u5BB9\uFF0C\u7279\u6B8A\u60C5\u51B5\u53EF\u6307\u5B9Ainfo\u503C\n // },\n // })\n },\n\n [isLogin, list, variant.sku, handleChangeShippingInfo, openSignInPopup],\n )\n\n return (\n <div\n id=\"ipc-product-paid-shipping\"\n className={cn(' mt-[40px] px-4 tablet:px-0 pb-4 tablet:px-8 laptop:px-16 desktop:px-0', className)}\n >\n <div className=\"flex flex-wrap justify-between space-x-2 md:space-x-1\">\n <Text\n className=\"text-[20px] font-bold leading-[1.4] text-[#1F2021] md:text-[16px]\"\n html={metafields?.title}\n ></Text>\n {/* <button\n onClick={() => {\n setOpenShippingPolicyModal(true)\n }}\n className='text-brand-color text-[16px] font-semibold text-[#595959] underline md:text-[14px]'\n >\n {metafields?.policy}\n </button> */}\n </div>\n <div className=\"mt-[16px] flex flex-wrap gap-[12px] overflow-hidden md:mt-[12px] desktop:flex-nowrap\">\n {list.map((method: ShippingMethodType, index: number) => (\n <ShippingMethod\n key={index}\n index={index}\n item={method}\n active={selectedMethod?.code === method.code}\n toggleShipping={() => toggleShipping(method)}\n currencyCode={variant.price.currencyCode}\n metafields={metafields}\n className=\"w-full laptop:w-[calc(50%-6px)] desktop:flex-1\"\n />\n ))}\n {/* learn more \u5361\u7247 */}\n <LearnMore\n setOpenShippingPolicyModal={setOpenShippingPolicyModal}\n metafields={metafields}\n className=\"w-full laptop:w-[calc(50%-6px)] desktop:w-1/3\"\n />\n </div>\n {list.find((method: ShippingMethodType) => method?.error) && (\n <Text\n className=\"mt-[16px] font-bold leading-[1.4] text-[#D41435] md:mt-[12px]\"\n html={list.find((method: ShippingMethodType) => method.error)?.error as string}\n as=\"p\"\n />\n )}\n\n {metafields?.seeAvailableArea && (\n <Text\n as=\"div\"\n className=\"mt-[16px] font-bold leading-[1.4] text-[#1F2021] [&_a]:text-[#595959] [&_a]:underline\"\n html={metafields?.seeAvailableArea}\n />\n )}\n {metafields?.shippingPolicy && (\n <ShippingPolicyModal\n data={metafields?.shippingPolicy}\n onClose={() => setOpenShippingPolicyModal(false)}\n open={openShippingPolicyModal}\n />\n )}\n </div>\n )\n}\n\nexport default PaidShipping"],
5
+ "mappings": "AA6HQ,cAAAA,EAaF,QAAAC,MAbE,oBA7HR,OAAoB,QAAAC,MAAY,kCAEhC,OAAS,eAAAC,EAAa,aAAAC,EAAW,WAAAC,EAAS,YAAAC,MAAgB,QAC1D,OAAS,MAAAC,MAAU,sBAEnB,OAAOC,MAAoB,mBAC3B,OAAS,uBAAAC,MAA2B,wBAEpC,OAAS,qBAAAC,MAAyB,UAClC,OAAOC,MAAe,cACtB,OAAS,wBAAAC,MAA4B,8BAErC,MAAMC,EAAe,CAAC,CACpB,WAAAC,EACA,YAAAC,EACA,qBAAAC,EACA,QAAAC,EACA,UAAAC,CACF,IAMM,CACJ,KAAM,CAAE,QAAAC,EAAS,gBAAAC,CAAgB,EAAIR,EAAqB,EACpD,CAACS,EAAyBC,CAA0B,EAAIhB,EAAS,EAAK,EACtE,CAACiB,EAAMC,CAAO,EAAIlB,EAAS,EAAK,EAEhC,CAACmB,EAAgBC,CAAiB,EAAIpB,EAAoC,IAAI,EAE9EqB,EAAStB,EAAQ,IACdU,EAAY,OAAO,CAACa,EAAKC,IAAYD,GAA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OqB,EAAQ7B",
6
6
  "names": ["jsx", "jsxs", "Text", "useCallback", "useEffect", "useMemo", "useState", "cn", "ShippingMethod", "ShippingPolicyModal", "isWeightAvailable", "LearnMore", "useBizProductContext", "PaidShipping", "metafields", "productList", "onShippingInfoChange", "variant", "className", "isLogin", "openSignInPopup", "openShippingPolicyModal", "setOpenShippingPolicyModal", "init", "setInit", "selectedMethod", "setSelectedMethod", "weight", "acc", "product", "normalizedMethod", "method", "index", "list", "normalizedList", "prev", "sameTypeMethod", "m", "availableMethod", "handleChangeShippingInfo", "standardShippingMethod", "toggleShipping", "PaidShipping_default"]
7
7
  }