@anker-in/headless-ui 1.3.38 → 1.3.39-alpha.1784616869310
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.
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.d.ts +11 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.d.ts +23 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/index.d.ts +40 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/types.d.ts +107 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/types.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/AccessoryShelf/types.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/MainProductArea/index.d.ts +22 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/MainProductArea/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/MainProductArea/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/PromoBanner/index.d.ts +10 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/PromoBanner/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/PromoBanner/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/SectionHeader/index.d.ts +9 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/SectionHeader/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/components/SectionHeader/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/index.d.ts +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/index.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/index.js.map +7 -0
- package/dist/cjs/biz-components/AccessoriesShelf/types.d.ts +16 -0
- package/dist/cjs/biz-components/AccessoriesShelf/types.js +2 -0
- package/dist/cjs/biz-components/AccessoriesShelf/types.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/CartGiftSection.d.ts +14 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/CartGiftSection.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/CartGiftSection.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.d.ts +11 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.d.ts +13 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartGiftSection/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/CartItemRow.d.ts +54 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/CartItemRow.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/CartItemRow.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.d.ts +4 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.d.ts +9 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.d.ts +11 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.d.ts +12 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.d.ts +4 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.d.ts +11 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.d.ts +8 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartItemRow/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/CartPerksSection.d.ts +36 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/CartPerksSection.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/CartPerksSection.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPerksSection/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.d.ts +47 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartPriceSummary/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.d.ts +26 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartSummaryHeader/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/CartThirdParty.d.ts +10 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/CartThirdParty.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/CartThirdParty.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/index.d.ts +2 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/CartThirdParty/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/index.d.ts +16 -0
- package/dist/cjs/biz-components/CartDetail/index.js +2 -0
- package/dist/cjs/biz-components/CartDetail/index.js.map +7 -0
- package/dist/cjs/biz-components/CartDetail/types.d.ts +132 -0
- package/dist/cjs/biz-components/CartDetail/types.js +2 -0
- package/dist/cjs/biz-components/CartDetail/types.js.map +7 -0
- package/dist/cjs/biz-components/Listing/BizProductProvider.d.ts +13 -9
- package/dist/cjs/biz-components/Listing/BizProductProvider.js +1 -1
- package/dist/cjs/biz-components/Listing/BizProductProvider.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/CartActionButtons/index.d.ts +9 -1
- package/dist/cjs/biz-components/Listing/components/CartActionButtons/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/CartActionButtons/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +1 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.d.ts +48 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.d.ts +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +0 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +4 -4
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.d.ts +3 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.d.ts +115 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.js +2 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.js.map +7 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/index.d.ts +0 -1
- package/dist/cjs/biz-components/Listing/components/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/index.js.map +3 -3
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.d.ts +8 -2
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js +1 -1
- package/dist/cjs/biz-components/Listing/hooks/useBenefits.js.map +3 -3
- package/dist/cjs/biz-components/Listing/types/product.d.ts +0 -21
- package/dist/cjs/biz-components/Listing/types/product.js +1 -1
- package/dist/cjs/biz-components/Listing/types/product.js.map +1 -1
- package/dist/cjs/biz-components/NotifyMeDialog/NotifyMeDialog.d.ts +7 -0
- package/dist/cjs/biz-components/NotifyMeDialog/NotifyMeDialog.js +2 -0
- package/dist/cjs/biz-components/NotifyMeDialog/NotifyMeDialog.js.map +7 -0
- package/dist/cjs/biz-components/NotifyMeDialog/index.d.ts +2 -0
- package/dist/cjs/biz-components/NotifyMeDialog/index.js +2 -0
- package/dist/cjs/biz-components/NotifyMeDialog/index.js.map +7 -0
- package/dist/cjs/biz-components/NotifyMeDialog/types.d.ts +111 -0
- package/dist/cjs/biz-components/NotifyMeDialog/types.js +2 -0
- package/dist/cjs/biz-components/NotifyMeDialog/types.js.map +7 -0
- package/dist/cjs/biz-components/ShelfDisplay/index.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/index.js.map +3 -3
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +2 -2
- package/dist/cjs/biz-components/index.d.ts +11 -3
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/cjs/components/breadcrumb.d.ts +12 -0
- package/dist/cjs/components/breadcrumb.js +2 -0
- package/dist/cjs/components/breadcrumb.js.map +7 -0
- package/dist/cjs/components/index.d.ts +2 -0
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +3 -3
- package/dist/cjs/components/input-number.d.ts +22 -0
- package/dist/cjs/components/input-number.js +1 -1
- package/dist/cjs/components/input-number.js.map +3 -3
- package/dist/cjs/components/input.d.ts +5 -0
- package/dist/cjs/components/input.js +1 -1
- package/dist/cjs/components/input.js.map +3 -3
- package/dist/cjs/components/tabs.js +1 -1
- package/dist/cjs/components/tabs.js.map +3 -3
- package/dist/cjs/components/toast.d.ts +25 -0
- package/dist/cjs/components/toast.js +2 -0
- package/dist/cjs/components/toast.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.d.ts +11 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoriesProductGrid/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.d.ts +23 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/ProductCard.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/index.d.ts +40 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/types.d.ts +107 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/types.js +1 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/AccessoryShelf/types.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/MainProductArea/index.d.ts +22 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/MainProductArea/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/MainProductArea/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/PromoBanner/index.d.ts +10 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/PromoBanner/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/PromoBanner/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/SectionHeader/index.d.ts +9 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/SectionHeader/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/components/SectionHeader/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/index.d.ts +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/index.js +2 -0
- package/dist/esm/biz-components/AccessoriesShelf/index.js.map +7 -0
- package/dist/esm/biz-components/AccessoriesShelf/types.d.ts +16 -0
- package/dist/esm/biz-components/AccessoriesShelf/types.js +1 -0
- package/dist/esm/biz-components/AccessoriesShelf/types.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/CartGiftSection.d.ts +14 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/CartGiftSection.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/CartGiftSection.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.d.ts +11 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/GiftConfirmDialog.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftConfirmDialog/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.d.ts +13 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/GiftOptionRow.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/components/GiftOptionRow/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartGiftSection/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/CartItemRow.d.ts +54 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/CartItemRow.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/CartItemRow.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.d.ts +4 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/CartItemGiftShipping.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.d.ts +9 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.js +1 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemGiftShipping/types.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.d.ts +11 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/CartItemInfo.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemInfo/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.d.ts +12 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/CartItemKsp.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemKsp/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.d.ts +4 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/CartItemRemoveConfirm.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.d.ts +11 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.js +1 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemRemoveConfirm/types.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.d.ts +8 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/CartItemShipping.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/components/CartItemShipping/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartItemRow/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/CartPerksSection.d.ts +36 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/CartPerksSection.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/CartPerksSection.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartPerksSection/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.d.ts +47 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/CartPriceSummary.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartPriceSummary/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.d.ts +26 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/CartSummaryHeader.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartSummaryHeader/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/CartThirdParty.d.ts +10 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/CartThirdParty.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/CartThirdParty.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/index.d.ts +2 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/CartThirdParty/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/index.d.ts +16 -0
- package/dist/esm/biz-components/CartDetail/index.js +2 -0
- package/dist/esm/biz-components/CartDetail/index.js.map +7 -0
- package/dist/esm/biz-components/CartDetail/types.d.ts +132 -0
- package/dist/esm/biz-components/CartDetail/types.js +1 -0
- package/dist/esm/biz-components/CartDetail/types.js.map +7 -0
- package/dist/esm/biz-components/Listing/BizProductProvider.d.ts +13 -9
- package/dist/esm/biz-components/Listing/BizProductProvider.js +1 -1
- package/dist/esm/biz-components/Listing/BizProductProvider.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/CartActionButtons/index.d.ts +9 -1
- package/dist/esm/biz-components/Listing/components/CartActionButtons/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/CartActionButtons/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js +4 -4
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefits/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.d.ts +1 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.d.ts +48 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.js +1 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBundle/types.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.d.ts +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductCoupon/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.d.ts +0 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductExchangePurchase/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.d.ts +3 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js +2 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/index.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.d.ts +115 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.js +1 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.js.map +7 -0
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductSummary/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/index.d.ts +0 -1
- package/dist/esm/biz-components/Listing/components/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/hooks/useBenefits.d.ts +8 -2
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js +1 -1
- package/dist/esm/biz-components/Listing/hooks/useBenefits.js.map +3 -3
- package/dist/esm/biz-components/Listing/types/product.d.ts +0 -21
- package/dist/esm/biz-components/Listing/types/product.js.map +1 -1
- package/dist/esm/biz-components/NotifyMeDialog/NotifyMeDialog.d.ts +7 -0
- package/dist/esm/biz-components/NotifyMeDialog/NotifyMeDialog.js +2 -0
- package/dist/esm/biz-components/NotifyMeDialog/NotifyMeDialog.js.map +7 -0
- package/dist/esm/biz-components/NotifyMeDialog/index.d.ts +2 -0
- package/dist/esm/biz-components/NotifyMeDialog/index.js +2 -0
- package/dist/esm/biz-components/NotifyMeDialog/index.js.map +7 -0
- package/dist/esm/biz-components/NotifyMeDialog/types.d.ts +111 -0
- package/dist/esm/biz-components/NotifyMeDialog/types.js +1 -0
- package/dist/esm/biz-components/NotifyMeDialog/types.js.map +7 -0
- package/dist/esm/biz-components/ShelfDisplay/index.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/index.js.map +3 -3
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +2 -2
- package/dist/esm/biz-components/index.d.ts +11 -3
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +3 -3
- package/dist/esm/components/breadcrumb.d.ts +12 -0
- package/dist/esm/components/breadcrumb.js +2 -0
- package/dist/esm/components/breadcrumb.js.map +7 -0
- package/dist/esm/components/index.d.ts +2 -0
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +3 -3
- package/dist/esm/components/input-number.d.ts +22 -0
- package/dist/esm/components/input-number.js +1 -1
- package/dist/esm/components/input-number.js.map +3 -3
- package/dist/esm/components/input.d.ts +5 -0
- package/dist/esm/components/input.js +1 -1
- package/dist/esm/components/input.js.map +3 -3
- package/dist/esm/components/tabs.js +1 -1
- package/dist/esm/components/tabs.js.map +3 -3
- package/dist/esm/components/toast.d.ts +25 -0
- package/dist/esm/components/toast.js +2 -0
- package/dist/esm/components/toast.js.map +7 -0
- package/package.json +1 -1
- package/style.css +275 -0
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.d.ts +0 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js +0 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +0 -7
- package/dist/cjs/biz-components/Listing/components/ProductCard/index.d.ts +0 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/index.js +0 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/index.js.map +0 -7
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.d.ts +0 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js +0 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/index.js.map +0 -7
- package/dist/esm/biz-components/Listing/components/ProductCard/index.d.ts +0 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/index.js +0 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/index.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/biz-components/Listing/components/ProductCard/ProductSummary/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Text, Button, Grid, GridItem, Picture, Heading } from '../../../../../components/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useComponentData } from '../../../hooks/useComponentData.js'\nimport { useEffect, useMemo, useState } from 'react'\nimport { formatPrice } from '../../../utils/index.js'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport type { BundleListItem, ProductVariant, ProductPrice, ProductOption } from '../../../types/product'\nimport Decimal from 'decimal.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\nimport { withLayout } from '../../../../../shared/Styles.js'\nimport { ExposureDetector } from '../../../../../components/index.js'\nimport { gaTrack } from '../../../../../shared/track.js'\nimport CartActionButtons from '../../CartActionButtons/index.js'\n\nconst ProductSummary = () => {\n const { locale = 'us', copyWriting, trackingData } = useAiuiContext()\n const {\n product,\n variant,\n finalPrice,\n comparePrice,\n coupon,\n selectedOptions,\n selectedVariants,\n totalSavings,\n onAddToCart,\n onBuyNow,\n savingDetail,\n checkedBundle,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n setSavingDetail,\n addToCartLoading,\n buyNowLoading,\n profile,\n addOrder,\n setAddOrder,\n } = useBizProductContext()\n\n /** \u662F\u5426\u663E\u793A\u539F\u4EF7\uFF08\u5212\u7EBF\u4EF7\uFF09\uFF0C\u9ED8\u8BA4\u663E\u793A */\n const showComparePrice = trackingData?.showComparePrice ?? true\n\n const productSummaryData = useComponentData('ProductSummary') ?? {}\n\n const [currentProductVariant] = selectedVariants\n\n const summaryFinalPrice = useMemo(() => {\n const currentBundleVariant = checkedBundle?.variants.find(v => v.variant.sku === currentProductVariant?.sku)\n const currentBundlePrice = new Decimal(currentProductVariant?.price?.amount || 0)\n .minus(currentBundleVariant?.price || currentProductVariant?.price?.amount)\n .toNumber()\n let currentProductPrice = new Decimal(currentProductVariant?.price?.amount || 0)\n if (profile?.email) {\n currentProductPrice = currentProductPrice.minus(savingDetail?.member || 0)\n }\n const finalPrice = currentProductPrice.minus(savingDetail?.coupon).minus(currentBundlePrice).toNumber()\n return parseFloat(finalPrice.toFixed(2))\n }, [currentProductVariant, checkedBundle, profile, savingDetail?.member, savingDetail?.coupon])\n\n const { bundleVariant, giftVariant, exchangeVariant } = useRecommendBuyProducts() || {}\n\n const [initialRecommendBuyProducts, setInitialRecommendBuyProducts] = useState<{\n bundle?: BundleListItem\n gift?: ProductVariant\n exchange?: ProductVariant\n }>()\n\n useEffect(() => {\n setInitialRecommendBuyProducts({\n bundle: joinedRecommendBuyProducts.bundle?.value ? undefined : bundleVariant,\n gift: joinedRecommendBuyProducts.gift?.value ? undefined : giftVariant,\n exchange: joinedRecommendBuyProducts.exchange?.value ? undefined : exchangeVariant,\n })\n }, [bundleVariant, giftVariant, exchangeVariant, joinedRecommendBuyProducts])\n\n // \u6839\u636E\u6DFB\u52A0\u987A\u5E8F\u751F\u6210\u5DF2\u6DFB\u52A0\u4EA7\u54C1\u7684\u5217\u8868\n const orderedJoinedProducts = useMemo(() => {\n const result: Array<{ type: 'bundle' | 'gift' | 'exchange'; key: string }> = []\n\n // \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6DFB\u52A0\n if (addOrder) {\n addOrder.forEach((type, index) => {\n if (joinedRecommendBuyProducts[type]?.value) {\n result.push({ type, key: `${type}-${index}` })\n }\n })\n }\n\n return result\n }, [addOrder, joinedRecommendBuyProducts])\n\n const productOptionsText = useMemo(() => {\n const quantity = selectedOptions?.quantity || ''\n const color = selectedOptions?.color || selectedOptions?.colour || selectedOptions?.couleur || ''\n return `${quantity && color ? `${quantity} | ${color}` : quantity || color}`\n }, [selectedOptions?.quantity, selectedOptions?.color, selectedOptions?.colour, selectedOptions?.couleur])\n\n const variantImage = useMemo(() => {\n const { image_1920, image_1440, image_1024, image_768, image_390 } = productSummaryData?.thumbnail || {}\n const responsiveSource = productSummaryData?.thumbnail\n ? `${image_1920} 1920, ${image_1440} 1440, ${image_1024} 1024, ${image_768} 768, ${image_390} 390`\n : variant.image?.url\n return responsiveSource || variant.image?.url\n }, [productSummaryData?.thumbnail, variant.image?.url])\n\n const isAvailable = variant.availableForSale\n if (!isAvailable) return null\n\n return (\n <div className=\"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16\">\n <div className=\"laptop:rounded-2xl bg-[#F5F5F7]\">\n <Grid className=\"tablet:p-8 tablet:!pb-0 px-4 pt-6\">\n <GridItem className=\"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4\">\n <Heading\n className=\"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]\"\n html={productSummaryData?.readyWant?.replace?.('{title}', product?.title)}\n />\n <div className=\"\">\n <Picture\n source={variantImage}\n className=\"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]\"\n imgClassName=\"object-cover h-full\"\n />\n </div>\n </GridItem>\n <GridItem className=\"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6\">\n <div>\n <div className=\"flex flex-col gap-4\">\n <ExposureDetector\n exposureKey=\"listing_selector\"\n onExposure={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_impression',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`,\n component_type: 'image',\n component_name: 'listing_selector',\n position: 1,\n },\n })\n }}\n >\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={product.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={productOptionsText}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: summaryFinalPrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n {showComparePrice && summaryFinalPrice < variant?.price?.amount && (\n <Text\n className=\"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: variant?.price?.amount,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n </div>\n </ExposureDetector>\n {/* \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6E32\u67D3\u5DF2\u6DFB\u52A0\u7684\u4EA7\u54C1 */}\n {orderedJoinedProducts.map(({ type, key }) => {\n if (type === 'gift' && joinedRecommendBuyProducts?.gift?.value) {\n return (\n <ProductGiftSummary\n key={key}\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'gift'))\n }}\n status={!!joinedRecommendBuyProducts?.gift}\n gift={joinedRecommendBuyProducts?.gift?.value}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n />\n )\n }\n if (type === 'bundle' && joinedRecommendBuyProducts?.bundle?.value) {\n return (\n <ProductBundleSummary\n key={key}\n bundleOperation={bundle => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'bundle'))\n }}\n status={!!joinedRecommendBuyProducts?.bundle}\n bundleListItem={joinedRecommendBuyProducts?.bundle?.value}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n />\n )\n }\n if (type === 'exchange' && joinedRecommendBuyProducts?.exchange?.value) {\n return (\n <ProductExchangeSummary\n key={key}\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'exchange'))\n }}\n status={!!joinedRecommendBuyProducts?.exchange}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n exchange={joinedRecommendBuyProducts?.exchange?.value}\n />\n )\n }\n return null\n })}\n </div>\n {(initialRecommendBuyProducts?.bundle ||\n initialRecommendBuyProducts?.gift ||\n initialRecommendBuyProducts?.exchange) && (\n <div className=\"laptop-md:mt-8 mt-6\">\n <Text className=\"laptop-md:text-[18px] text-sm font-bold\" html={productSummaryData?.recommendBuy} />\n <div className=\"laptop-md:gap-4 mt-4 flex flex-col gap-6\">\n {initialRecommendBuyProducts?.exchange && (\n <ProductExchangeSummary\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: exchange,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'exchange'])\n }}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n status={!initialRecommendBuyProducts?.exchange}\n exchange={initialRecommendBuyProducts?.exchange}\n />\n )}\n {initialRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setSavingDetail?.({ ...savingDetail, exchangePurchase: 0 })\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: bundle,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'bundle'])\n }}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n status={!initialRecommendBuyProducts?.bundle}\n bundleListItem={initialRecommendBuyProducts?.bundle}\n />\n )}\n {initialRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: gift,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'gift'])\n }}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n status={!initialRecommendBuyProducts?.gift}\n gift={initialRecommendBuyProducts?.gift}\n />\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"text-right\">\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl text-right font-bold\"\n html={`${replaceTemplate(copyWriting?.totalPrice || '', { amount: formatPrice({ amount: parseFloat(finalPrice.toFixed(2)), currencyCode: variant.price.currencyCode, locale }) })}`}\n />\n\n {showComparePrice && totalSavings > 0 && (\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: comparePrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n <div className=\"mt-4 flex justify-end gap-3\">\n <CartActionButtons\n availableForSale={variant.availableForSale}\n addToCartText={copyWriting?.addToCart}\n buyNowText={copyWriting?.shopNow}\n addToCartLoading={addToCartLoading}\n buyNowLoading={buyNowLoading}\n addToCartClassName=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n buyNowClassName=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n />\n </div>\n </div>\n </GridItem>\n </Grid>\n </div>\n </div>\n )\n}\n\nconst useRecommendBuyProducts = () => {\n const { bundle, variant, checkedBundle, freeGift, checkedGift, exchangePurchase, checkedExchangePurchase } =\n useBizProductContext()\n let bundleVariant = undefined\n let giftVariant = undefined\n let exchangeVariant = undefined\n const { bundleList } = bundle || {}\n\n const { giftList = [] } = freeGift || {}\n const { giftList: exchangeList = [] } = exchangePurchase || {}\n\n const availableBundleList =\n bundleList?.filter(bundle =>\n bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n ) || []\n\n const [firstAvailableBundle] = availableBundleList\n bundleVariant = checkedBundle || firstAvailableBundle\n\n const [firstAvailableGift] = giftList?.filter(gift => gift.availableForSale) ?? []\n giftVariant = checkedGift || firstAvailableGift\n\n const [firstAvailableExchange] = exchangeList?.filter(exchange => exchange.availableForSale) ?? []\n exchangeVariant = checkedExchangePurchase || firstAvailableExchange\n\n return { bundleVariant, giftVariant, exchangeVariant }\n}\n\nconst ProductBundleSummary = ({\n bundleOperation,\n bundleListItem,\n canOperate,\n status,\n}: {\n bundleOperation: (bundle?: BundleListItem) => void\n bundleListItem?: BundleListItem\n canOperate?: boolean\n status?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { variant, setCheckedBundle } = useBizProductContext()\n const bundleVariants = bundleListItem?.variants.filter(v => v.variant.sku !== variant.sku)\n\n return (\n <div className=\"\">\n {bundleVariants?.map(bundleVariant => {\n return (\n <div className=\"flex items-center justify-between gap-4\" key={bundleVariant.variant.id}>\n <div className=\"flex items-center gap-4\">\n <Picture\n source={bundleVariant?.variant?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold\"\n html={bundleVariant.variant.product.title}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-1\">\n {!!bundleListItem && (\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: bundleVariant?.price || 0,\n locale,\n currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n })}\n />\n {bundleVariant.price < bundleVariant.variant.price.amount && (\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: bundleVariant.variant.price.amount || 0,\n locale,\n currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n })}\n />\n )}\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedBundle?.(status ? undefined : bundleListItem)\n bundleOperation?.(bundleListItem)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n })}\n </div>\n )\n}\n\nconst ProductGiftSummary = ({\n giftOperation,\n gift,\n status,\n canOperate,\n}: {\n giftOperation: (gift?: ProductVariant) => void\n gift?: ProductVariant\n status?: boolean\n canOperate?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { freeGift, setCheckedGift } = useBizProductContext()\n const { freeLabel } = freeGift || {}\n const { options } = gift || {}\n\n const giftOptionsText = useMemo(() => {\n const giftColorOption = (options?.find(\n option => option.name === 'color' || option.name === 'colour' || option.name === 'couleur'\n ) || {}) as ProductOption\n const giftQuantityOption = options?.find(option => option.name === 'quantity') || ({} as ProductOption)\n const giftColorOptionText = giftColorOption ? giftColorOption.values?.[0]?.label : ''\n const giftQuantityOptionText = giftQuantityOption ? giftQuantityOption.values?.[0]?.label : ''\n return `${giftColorOptionText && giftQuantityOptionText ? giftQuantityOptionText + ' | ' + giftColorOptionText : giftQuantityOptionText || giftColorOptionText} | ${freeLabel}`\n }, [freeLabel, options])\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={gift?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={gift?.product?.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={giftOptionsText}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!gift && (\n <div className=\"flex items-center gap-1\">\n <Text className=\"laptop-md:text-2xl text-base font-bold\" html={freeLabel} />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedGift?.(status ? undefined : gift)\n giftOperation(gift)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst ProductExchangeSummary = ({\n exchangeOperation,\n exchange,\n canOperate,\n status,\n}: {\n exchangeOperation: (exchange?: ProductVariant) => void\n exchange?: ProductVariant & { finalPrice?: ProductPrice }\n canOperate?: boolean\n status?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { setCheckedExchangePurchase } = useBizProductContext()\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={exchange?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={exchange?.product?.title}\n />\n <Text className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\" />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!exchange && (\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: exchange.finalPrice?.amount || 0,\n locale,\n currencyCode: exchange.price.currencyCode,\n })}\n />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: exchange.price?.amount || 0,\n locale,\n currencyCode: exchange.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedExchangePurchase?.(status ? undefined : exchange)\n exchangeOperation(exchange)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nexport default withLayout(ProductSummary)\n"],
|
|
5
|
-
"mappings": "AAgHU,OACE,OAAAA,EADF,QAAAC,MAAA,oBAhHV,OAAS,QAAAC,EAAM,UAAAC,EAAQ,QAAAC,GAAM,YAAAC,EAAU,WAAAC,EAAS,WAAAC,OAAe,qCAC/D,OAAS,wBAAAC,MAA4B,iCACrC,OAAS,oBAAAC,OAAwB,qCACjC,OAAS,aAAAC,GAAW,WAAAC,EAAS,YAAAC,OAAgB,QAC7C,OAAS,eAAAC,MAAmB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AC,OAAI,UAAU,+CACZ,WAAC,CAAC+E,GACD/E,EAAC,OAAI,UAAU,0BACb,UAAAD,EAACE,EAAA,CACC,UAAU,yCACV,KAAMW,EAAY,CAChB,OAAQmE,EAAS,YAAY,QAAU,EACvC,OAAA1D,EACA,aAAc0D,EAAS,MAAM,YAC/B,CAAC,EACH,EACAhF,EAACE,EAAA,CACC,UAAU,qEACV,KAAMW,EAAY,CAChB,OAAQmE,EAAS,OAAO,QAAU,EAClC,OAAA1D,EACA,aAAc0D,EAAS,MAAM,YAC/B,CAAC,EACH,GACF,EAEDc,GACC9F,EAACG,EAAA,CACC,KAAK,OACL,QAAQ,OACR,QAAS,IAAM,CACb0G,IAA6Bd,EAAS,OAAYf,CAAQ,EAC1D4B,EAAkB5B,CAAQ,CAC5B,EACA,UAAU,+BAET,SAAAe,EAASxE,GAAa,OAASA,GAAa,IAC/C,GAEJ,GACF,CAEJ,EAEA,IAAOuF,GAAQ7F,GAAWI,EAAc",
|
|
6
|
-
"names": ["jsx", "jsxs", "Text", "Button", "Grid", "GridItem", "Picture", "Heading", "useBizProductContext", "useComponentData", "useEffect", "useMemo", "useState", "formatPrice", "useAiuiContext", "Decimal", "replaceTemplate", "withLayout", "ExposureDetector", "gaTrack", "CartActionButtons", "ProductSummary", "locale", "copyWriting", "trackingData", "product", "variant", "finalPrice", "comparePrice", "coupon", "selectedOptions", "selectedVariants", "totalSavings", "onAddToCart", "onBuyNow", "savingDetail", "checkedBundle", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "setSavingDetail", "addToCartLoading", "buyNowLoading", "
|
|
4
|
+
"sourcesContent": ["import { Text, Button, Grid, GridItem, Picture, Heading } from '../../../../../components/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useComponentData } from '../../../hooks/useComponentData.js'\nimport { useEffect, useMemo, useState } from 'react'\nimport { formatPrice } from '../../../utils/index.js'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport type { ProductVariant, ProductPrice, ProductOption } from '../../../types/product'\nimport Decimal from 'decimal.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\nimport { withLayout } from '../../../../../shared/Styles.js'\nimport { ExposureDetector } from '../../../../../components/index.js'\nimport { gaTrack } from '../../../../../shared/track.js'\nimport CartActionButtons from '../../CartActionButtons/index.js'\n\nconst ProductSummary = () => {\n const { locale = 'us', copyWriting, trackingData } = useAiuiContext()\n const {\n product,\n variant,\n finalPrice,\n comparePrice,\n coupon,\n selectedOptions,\n selectedVariants,\n totalSavings,\n onAddToCart,\n onBuyNow,\n savingDetail,\n checkedBundle,\n joinedRecommendBuyProducts,\n setJoinedRecommendBuyProducts,\n setSavingDetail,\n addToCartLoading,\n buyNowLoading,\n notifyMeMode,\n onNotifyMeClick,\n profile,\n addOrder,\n setAddOrder,\n } = useBizProductContext()\n\n /** \u662F\u5426\u663E\u793A\u539F\u4EF7\uFF08\u5212\u7EBF\u4EF7\uFF09\uFF0C\u9ED8\u8BA4\u663E\u793A */\n const showComparePrice = trackingData?.showComparePrice ?? true\n\n const productSummaryData = useComponentData('ProductSummary') ?? {}\n\n const [currentProductVariant] = selectedVariants\n\n const summaryFinalPrice = useMemo(() => {\n // const currentBundleVariant = checkedBundle?.variants.find(v => v.variant.sku === currentProductVariant?.sku)\n // const currentBundlePrice = new Decimal(currentProductVariant?.price?.amount || 0)\n // .minus(currentBundleVariant?.price || currentProductVariant?.price?.amount)\n // .toNumber()\n let currentProductPrice = new Decimal(currentProductVariant?.price?.amount || 0)\n if (profile?.email) {\n currentProductPrice = currentProductPrice.minus(savingDetail?.member || 0)\n }\n const finalPrice = currentProductPrice.minus(savingDetail?.coupon).toNumber()\n return parseFloat(finalPrice.toFixed(2))\n }, [currentProductVariant, checkedBundle, profile, savingDetail?.member, savingDetail?.coupon])\n\n const { giftVariant } = useRecommendBuyProducts() || {}\n\n const [initialRecommendBuyProducts, setInitialRecommendBuyProducts] = useState<{\n // bundle?: BundleListItem\n gift?: ProductVariant\n // exchange?: ProductVariant\n }>()\n\n useEffect(() => {\n setInitialRecommendBuyProducts({\n // bundle: joinedRecommendBuyProducts.bundle?.value ? undefined : bundleVariant,\n gift: joinedRecommendBuyProducts.gift?.value ? undefined : giftVariant,\n // exchange: joinedRecommendBuyProducts.exchange?.value ? undefined : exchangeVariant,\n })\n }, [giftVariant, joinedRecommendBuyProducts])\n\n // \u6839\u636E\u6DFB\u52A0\u987A\u5E8F\u751F\u6210\u5DF2\u6DFB\u52A0\u4EA7\u54C1\u7684\u5217\u8868\n const orderedJoinedProducts = useMemo(() => {\n const result: Array<{ type: 'bundle' | 'gift' | 'exchange'; key: string }> = []\n\n // \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6DFB\u52A0\n if (addOrder) {\n addOrder.forEach((type, index) => {\n if (joinedRecommendBuyProducts[type]?.value) {\n result.push({ type, key: `${type}-${index}` })\n }\n })\n }\n\n return result\n }, [addOrder, joinedRecommendBuyProducts])\n\n const productOptionsText = useMemo(() => {\n const quantity = selectedOptions?.quantity || ''\n const color = selectedOptions?.color || selectedOptions?.colour || selectedOptions?.couleur || ''\n return `${quantity && color ? `${quantity} | ${color}` : quantity || color}`\n }, [selectedOptions?.quantity, selectedOptions?.color, selectedOptions?.colour, selectedOptions?.couleur])\n\n const variantImage = useMemo(() => {\n const { image_1920, image_1440, image_1024, image_768, image_390 } = productSummaryData?.thumbnail || {}\n const responsiveSource = productSummaryData?.thumbnail\n ? `${image_1920} 1920, ${image_1440} 1440, ${image_1024} 1024, ${image_768} 768, ${image_390} 390`\n : variant.image?.url\n return responsiveSource || variant.image?.url\n }, [productSummaryData?.thumbnail, variant.image?.url])\n\n const isAvailable = variant.availableForSale\n if (!isAvailable) return null\n\n return (\n <div className=\"ipc-product-summary laptop:px-16 laptop-md:px-0 laptop-md:mt-[96px] lg-desktop:mt-[128px] mt-16\">\n <div className=\"laptop:rounded-2xl bg-[#F5F5F7]\">\n <Grid className=\"tablet:p-8 tablet:!pb-0 px-4 pt-6\">\n <GridItem className=\"laptop:col-start-1 laptop:col-span-5 col-span-12 flex flex-col justify-between gap-4\">\n <Heading\n className=\"lg-desktop:text-[48px] laptop:text-[32px] laptop-md:text-[40px] mb-4 text-[24px] font-bold leading-none [&>span]:text-[#D1D1D1]\"\n html={productSummaryData?.readyWant?.replace?.('{title}', product?.title)}\n />\n <div className=\"\">\n <Picture\n source={variantImage}\n className=\"lg-desktop:aspect-[644/320] laptop-md:aspect-[503/270] laptop:aspect-[332/190] tablet:aspect-[704/380] aspect-[358/190]\"\n imgClassName=\"object-cover h-full\"\n />\n </div>\n </GridItem>\n <GridItem className=\"tablet:pb-8 laptop:col-start-7 laptop:mt-0 laptop:col-span-6 col-span-12 mt-8 flex flex-col justify-between gap-6 pb-6\">\n <div>\n <div className=\"flex flex-col gap-4\">\n <ExposureDetector\n exposureKey=\"listing_selector\"\n onExposure={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_impression',\n event_parameters: {\n page_group: `Product Detail Page${variant.sku}`,\n component_type: 'image',\n component_name: 'listing_selector',\n position: 1,\n },\n })\n }}\n >\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={variant.image?.url || product?.images?.[0]?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={product.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={productOptionsText}\n />\n </div>\n </div>\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"laptop-md:text-2xl text-base font-bold\"\n html={formatPrice({\n amount: summaryFinalPrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n {showComparePrice && summaryFinalPrice < variant?.price?.amount && (\n <Text\n className=\"laptop-md:text-2xl laptop:text-xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: variant?.price?.amount,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n </div>\n </div>\n </ExposureDetector>\n {/* \u6309\u7167\u6DFB\u52A0\u987A\u5E8F\u6E32\u67D3\u5DF2\u6DFB\u52A0\u7684\u4EA7\u54C1 */}\n {orderedJoinedProducts.map(({ type, key }) => {\n if (type === 'gift' && joinedRecommendBuyProducts?.gift?.value) {\n return (\n <ProductGiftSummary\n key={key}\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: undefined,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift })\n // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n setAddOrder?.(prev => prev.filter(t => t !== 'gift'))\n }}\n status={!!joinedRecommendBuyProducts?.gift}\n gift={joinedRecommendBuyProducts?.gift?.value}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n />\n )\n }\n // if (type === 'bundle' && joinedRecommendBuyProducts?.bundle?.value) {\n // return (\n // <ProductBundleSummary\n // key={key}\n // bundleOperation={bundle => {\n // setJoinedRecommendBuyProducts?.({\n // ...joinedRecommendBuyProducts,\n // bundle: {\n // value: undefined,\n // canOperate: true,\n // },\n // })\n // setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle })\n // // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n // setAddOrder?.(prev => prev.filter(t => t !== 'bundle'))\n // }}\n // status={!!joinedRecommendBuyProducts?.bundle}\n // bundleListItem={joinedRecommendBuyProducts?.bundle?.value}\n // canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n // />\n // )\n // }\n // if (type === 'exchange' && joinedRecommendBuyProducts?.exchange?.value) {\n // return (\n // <ProductExchangeSummary\n // key={key}\n // exchangeOperation={exchange => {\n // setJoinedRecommendBuyProducts?.({\n // ...joinedRecommendBuyProducts,\n // exchange: {\n // value: undefined,\n // canOperate: true,\n // },\n // })\n // setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange })\n // // \u4ECE\u6DFB\u52A0\u987A\u5E8F\u4E2D\u79FB\u9664\n // setAddOrder?.(prev => prev.filter(t => t !== 'exchange'))\n // }}\n // status={!!joinedRecommendBuyProducts?.exchange}\n // canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n // exchange={joinedRecommendBuyProducts?.exchange?.value}\n // />\n // )\n // }\n return null\n })}\n </div>\n {\n initialRecommendBuyProducts?.gift && (\n <div className=\"laptop-md:mt-8 mt-6\">\n <Text className=\"laptop-md:text-[18px] text-sm font-bold\" html={productSummaryData?.recommendBuy} />\n <div className=\"laptop-md:gap-4 mt-4 flex flex-col gap-6\">\n {/* {initialRecommendBuyProducts?.exchange && (\n <ProductExchangeSummary\n exchangeOperation={exchange => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n exchange: {\n value: exchange,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, exchange: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'exchange'])\n }}\n canOperate={joinedRecommendBuyProducts?.exchange?.canOperate}\n status={!initialRecommendBuyProducts?.exchange}\n exchange={initialRecommendBuyProducts?.exchange}\n />\n )} */}\n {/* {initialRecommendBuyProducts?.bundle && (\n <ProductBundleSummary\n bundleOperation={bundle => {\n setSavingDetail?.({ ...savingDetail, exchangePurchase: 0 })\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n bundle: {\n value: bundle,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, bundle: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'bundle'])\n }}\n canOperate={joinedRecommendBuyProducts?.bundle?.canOperate}\n status={!initialRecommendBuyProducts?.bundle}\n bundleListItem={initialRecommendBuyProducts?.bundle}\n />\n )} */}\n {initialRecommendBuyProducts?.gift && (\n <ProductGiftSummary\n giftOperation={gift => {\n setJoinedRecommendBuyProducts?.({\n ...joinedRecommendBuyProducts,\n gift: {\n value: gift,\n canOperate: true,\n },\n })\n setInitialRecommendBuyProducts?.({ ...initialRecommendBuyProducts, gift: undefined })\n // \u6DFB\u52A0\u5230\u987A\u5E8F\u6570\u7EC4\u7684\u672B\u5C3E\n setAddOrder?.(prev => [...prev, 'gift'])\n }}\n canOperate={joinedRecommendBuyProducts?.gift?.canOperate}\n status={!initialRecommendBuyProducts?.gift}\n gift={initialRecommendBuyProducts?.gift}\n />\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"text-right\">\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl text-right font-bold\"\n html={`${replaceTemplate(copyWriting?.totalPrice || '', { amount: formatPrice({ amount: parseFloat(finalPrice.toFixed(2)), currencyCode: variant.price.currencyCode, locale }) })}`}\n />\n\n {showComparePrice && totalSavings > 0 && (\n <Text\n className=\"laptop:text-xl laptop-md:text-2xl ml-1 text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: comparePrice,\n currencyCode: variant.price.currencyCode,\n locale,\n })}\n />\n )}\n <div className=\"mt-4 flex justify-end gap-3\">\n <CartActionButtons\n mode={notifyMeMode}\n availableForSale={variant.availableForSale}\n addToCartText={copyWriting?.addToCart}\n buyNowText={copyWriting?.shopNow}\n addToCartLoading={addToCartLoading}\n buyNowLoading={buyNowLoading}\n addToCartClassName=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n buyNowClassName=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n onNotifyMeClick={onNotifyMeClick}\n notifyMeText={copyWriting?.notifyMe}\n notifyMeClassName=\"tablet:w-auto laptop:w-1/2 laptop-md:w-auto w-1/2\"\n />\n </div>\n </div>\n </GridItem>\n </Grid>\n </div>\n </div>\n )\n}\n\nconst useRecommendBuyProducts = () => {\n const { bundle, variant, checkedBundle, freeGift, checkedGift } =\n useBizProductContext()\n// let bundleVariant = undefined\n let giftVariant = undefined\n// let exchangeVariant = undefined\n// const { bundleList } = bundle || {}\n\n const { giftList = [] } = freeGift || {}\n// const { giftList: exchangeList = [] } = exchangePurchase || {}\n\n// const availableBundleList =\n// bundleList?.filter(bundle =>\n// bundle.variants.slice(1, bundle.variants.length).every(v => v.variant.availableForSale)\n// ) || []\n\n// const [firstAvailableBundle] = availableBundleList\n// bundleVariant = checkedBundle || firstAvailableBundle\n\n const [firstAvailableGift] = giftList?.filter(gift => gift.availableForSale) ?? []\n giftVariant = checkedGift || firstAvailableGift\n\n// const [firstAvailableExchange] = exchangeList?.filter(exchange => exchange.availableForSale) ?? []\n// exchangeVariant = checkedExchangePurchase || firstAvailableExchange\n\n return { giftVariant }\n}\n\n// const ProductBundleSummary = ({\n// bundleOperation,\n// bundleListItem,\n// canOperate,\n// status,\n// }: {\n// bundleOperation: (bundle?: BundleListItem) => void\n// bundleListItem?: BundleListItem\n// canOperate?: boolean\n// status?: boolean\n// }) => {\n// const { locale = 'us', copyWriting } = useAiuiContext()\n// const { variant, setCheckedBundle } = useBizProductContext()\n// const bundleVariants = bundleListItem?.variants.filter(v => v.variant.sku !== variant.sku)\n\n// return (\n// <div className=\"\">\n// {bundleVariants?.map(bundleVariant => {\n// return (\n// <div className=\"flex items-center justify-between gap-4\" key={bundleVariant.variant.id}>\n// <div className=\"flex items-center gap-4\">\n// <Picture\n// source={bundleVariant?.variant?.image?.url}\n// className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n// />\n// <div className=\"tablet:max-w-none line-clamp-2 flex max-w-[178px] flex-col gap-[6px]\">\n// <Text\n// className=\"laptop-md:text-[16px] lg-desktop:text-[18px] text-[14px] font-bold\"\n// html={bundleVariant.variant.product.title}\n// />\n// </div>\n// </div>\n// <div className=\"flex flex-col items-end justify-center gap-1\">\n// {!!bundleListItem && (\n// <div className=\"flex items-center gap-1\">\n// <Text\n// className=\"laptop-md:text-2xl text-base font-bold\"\n// html={formatPrice({\n// amount: bundleVariant?.price || 0,\n// locale,\n// currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n// })}\n// />\n// {bundleVariant.price < bundleVariant.variant.price.amount && (\n// <Text\n// className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n// html={formatPrice({\n// amount: bundleVariant.variant.price.amount || 0,\n// locale,\n// currencyCode: bundleVariant.variant?.price?.currencyCode || '',\n// })}\n// />\n// )}\n// </div>\n// )}\n// {canOperate && (\n// <Button\n// size=\"icon\"\n// variant=\"link\"\n// onClick={() => {\n// setCheckedBundle?.(status ? undefined : bundleListItem)\n// bundleOperation?.(bundleListItem)\n// }}\n// className=\"size-auto shrink-0 underline\"\n// >\n// {status ? copyWriting?.remove : copyWriting?.add}\n// </Button>\n// )}\n// </div>\n// </div>\n// )\n// })}\n// </div>\n// )\n// }\n\nconst ProductGiftSummary = ({\n giftOperation,\n gift,\n status,\n canOperate,\n}: {\n giftOperation: (gift?: ProductVariant) => void\n gift?: ProductVariant\n status?: boolean\n canOperate?: boolean\n}) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n const { freeGift, setCheckedGift } = useBizProductContext()\n const { freeLabel } = freeGift || {}\n const { options } = gift || {}\n\n const giftOptionsText = useMemo(() => {\n const giftColorOption = (options?.find(\n option => option.name === 'color' || option.name === 'colour' || option.name === 'couleur'\n ) || {}) as ProductOption\n const giftQuantityOption = options?.find(option => option.name === 'quantity') || ({} as ProductOption)\n const giftColorOptionText = giftColorOption ? giftColorOption.values?.[0]?.label : ''\n const giftQuantityOptionText = giftQuantityOption ? giftQuantityOption.values?.[0]?.label : ''\n return `${giftColorOptionText && giftQuantityOptionText ? giftQuantityOptionText + ' | ' + giftColorOptionText : giftQuantityOptionText || giftColorOptionText} | ${freeLabel}`\n }, [freeLabel, options])\n\n return (\n <div className=\"flex items-center justify-between gap-6\">\n <div className=\"flex items-center gap-4\">\n <Picture\n source={gift?.image?.url}\n className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n />\n <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n <Text\n className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n html={gift?.product?.title}\n />\n <Text\n className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\"\n html={giftOptionsText}\n />\n </div>\n </div>\n <div className=\"flex flex-col items-end justify-center gap-2\">\n {!!gift && (\n <div className=\"flex items-center gap-1\">\n <Text className=\"laptop-md:text-2xl text-base font-bold\" html={freeLabel} />\n <Text\n className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n html={formatPrice({\n amount: gift.price.amount,\n locale,\n currencyCode: gift.price.currencyCode,\n })}\n />\n </div>\n )}\n {canOperate && (\n <Button\n size=\"icon\"\n variant=\"link\"\n onClick={() => {\n setCheckedGift?.(status ? undefined : gift)\n giftOperation(gift)\n }}\n className=\"size-auto shrink-0 underline\"\n >\n {status ? copyWriting?.remove : copyWriting?.add}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\n// const ProductExchangeSummary = ({\n// exchangeOperation,\n// exchange,\n// canOperate,\n// status,\n// }: {\n// exchangeOperation: (exchange?: ProductVariant) => void\n// exchange?: ProductVariant & { finalPrice?: ProductPrice }\n// canOperate?: boolean\n// status?: boolean\n// }) => {\n// const { locale = 'us', copyWriting } = useAiuiContext()\n// const { setCheckedExchangePurchase } = useBizProductContext()\n\n// return (\n// <div className=\"flex items-center justify-between gap-6\">\n// <div className=\"flex items-center gap-4\">\n// <Picture\n// source={exchange?.image?.url}\n// className=\"laptop:size-12 lg-desktop:size-16 border-1 size-10 shrink-0 rounded-lg border-[#E4E5E6] bg-[#EAEAEC] object-cover p-2\"\n// />\n// <div className=\"tablet:max-w-none flex max-w-[178px] flex-col gap-[6px]\">\n// <Text\n// className=\"laptop-md:text-[16px] lg-desktop:text-[18px] line-clamp-2 text-[14px] font-bold\"\n// html={exchange?.product?.title}\n// />\n// <Text className=\"laptop:text-[14px] laptop-md:text-[18px] text-[12px] font-bold text-[#6D6D6F]\" />\n// </div>\n// </div>\n// <div className=\"flex flex-col items-end justify-center gap-2\">\n// {!!exchange && (\n// <div className=\"flex items-center gap-1\">\n// <Text\n// className=\"laptop-md:text-2xl text-base font-bold\"\n// html={formatPrice({\n// amount: exchange.finalPrice?.amount || 0,\n// locale,\n// currencyCode: exchange.price.currencyCode,\n// })}\n// />\n// <Text\n// className=\"laptop-md:text-2xl text-base font-bold text-[#6D6D6F] line-through\"\n// html={formatPrice({\n// amount: exchange.price?.amount || 0,\n// locale,\n// currencyCode: exchange.price.currencyCode,\n// })}\n// />\n// </div>\n// )}\n// {canOperate && (\n// <Button\n// size=\"icon\"\n// variant=\"link\"\n// onClick={() => {\n// setCheckedExchangePurchase?.(status ? undefined : exchange)\n// exchangeOperation(exchange)\n// }}\n// className=\"size-auto shrink-0 underline\"\n// >\n// {status ? copyWriting?.remove : copyWriting?.add}\n// </Button>\n// )}\n// </div>\n// </div>\n// )\n// }\n\nexport default withLayout(ProductSummary)\n"],
|
|
5
|
+
"mappings": "AAkHU,OACE,OAAAA,EADF,QAAAC,MAAA,oBAlHV,OAAS,QAAAC,EAAM,UAAAC,EAAQ,QAAAC,EAAM,YAAAC,EAAU,WAAAC,EAAS,WAAAC,MAAe,qCAC/D,OAAS,wBAAAC,MAA4B,iCACrC,OAAS,oBAAAC,MAAwB,qCACjC,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yBF,EAAqBA,EAAmB,SAAS,CAAC,GAAG,MAAQ,GAC5F,MAAO,GAAGC,GAAuBC,EAAyBA,EAAyB,MAAQD,EAAsBC,GAA0BD,CAAmB,MAAMN,CAAS,EAC/K,EAAG,CAACA,EAAWC,CAAO,CAAC,EAEvB,OACEnF,EAAC,OAAI,UAAU,0CACb,UAAAA,EAAC,OAAI,UAAU,0BACb,UAAAD,EAACM,EAAA,CACC,OAAQiE,GAAM,OAAO,IACrB,UAAU,wHACZ,EACAtE,EAAC,OAAI,UAAU,0DACb,UAAAD,EAACE,EAAA,CACC,UAAU,kFACV,KAAMqE,GAAM,SAAS,MACvB,EACAvE,EAACE,EAAA,CACC,UAAU,gFACV,KAAMmF,EACR,GACF,GACF,EACApF,EAAC,OAAI,UAAU,+CACZ,WAAC,CAACsE,GACDtE,EAAC,OAAI,UAAU,0BACb,UAAAD,EAACE,EAAA,CAAK,UAAU,yCAAyC,KAAMiF,EAAW,EAC1EnF,EAACE,EAAA,CACC,UAAU,qEACV,KAAMW,EAAY,CAChB,OAAQ0D,EAAK,MAAM,OACnB,OAAAjD,EACA,aAAciD,EAAK,MAAM,YAC3B,CAAC,EACH,GACF,EAEDU,GACCjF,EAACG,EAAA,CACC,KAAK,OACL,QAAQ,OACR,QAAS,IAAM,CACb+E,IAAiBF,EAAS,OAAYT,CAAI,EAC1CQ,EAAcR,CAAI,CACpB,EACA,UAAU,+BAET,SAAAS,EAASzD,GAAa,OAASA,GAAa,IAC/C,GAEJ,GACF,CAEJ,EAsEA,IAAOoE,GAAQ1E,GAAWI,EAAc",
|
|
6
|
+
"names": ["jsx", "jsxs", "Text", "Button", "Grid", "GridItem", "Picture", "Heading", "useBizProductContext", "useComponentData", "useEffect", "useMemo", "useState", "formatPrice", "useAiuiContext", "Decimal", "replaceTemplate", "withLayout", "ExposureDetector", "gaTrack", "CartActionButtons", "ProductSummary", "locale", "copyWriting", "trackingData", "product", "variant", "finalPrice", "comparePrice", "coupon", "selectedOptions", "selectedVariants", "totalSavings", "onAddToCart", "onBuyNow", "savingDetail", "checkedBundle", "joinedRecommendBuyProducts", "setJoinedRecommendBuyProducts", "setSavingDetail", "addToCartLoading", "buyNowLoading", "notifyMeMode", "onNotifyMeClick", "profile", "addOrder", "setAddOrder", "showComparePrice", "productSummaryData", "currentProductVariant", "summaryFinalPrice", "currentProductPrice", "giftVariant", "useRecommendBuyProducts", "initialRecommendBuyProducts", "setInitialRecommendBuyProducts", "orderedJoinedProducts", "result", "type", "index", "productOptionsText", "quantity", "color", "variantImage", "image_1920", "image_1440", "image_1024", "image_768", "image_390", "key", "ProductGiftSummary", "gift", "prev", "t", "bundle", "freeGift", "checkedGift", "giftList", "firstAvailableGift", "giftOperation", "status", "canOperate", "setCheckedGift", "freeLabel", "options", "giftOptionsText", "giftColorOption", "option", "giftQuantityOption", "giftColorOptionText", "giftQuantityOptionText", "ProductSummary_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as o,jsxs as u}from"react/jsx-runtime";import{Text as n,Container as
|
|
1
|
+
import{jsx as o,jsxs as u}from"react/jsx-runtime";import{Text as n,Container as L}from"../../../../../components/index.js";import{useAiuiContext as E}from"../../../../AiuiProvider/index.js";import{useBizProductContext as R}from"../../../BizProductProvider.js";import{useMemo as C}from"react";import{formatPrice as d}from"../../../utils/index.js";import{replaceTemplate as y}from"../../../utils/textFormat.js";import{useBenefits as O}from"../../../hooks/useBenefits.js";import _ from"../../CartActionButtons/index.js";const j=({totalSavingsSlot:v}={})=>{const{copyWriting:e,locale:a="us",trackingData:N,currencyCode:l}=E(),{variant:t,finalPrice:h,totalSavings:r,isLogin:m,comparePrice:w,onAddToCart:S,onBuyNow:T,savingDetail:s,addToCartLoading:k,buyNowLoading:A,notifyMeMode:M,onNotifyMeClick:P,discount:q,memberFunctionResult:p}=R(),D=O({variant:t}),{commonCoupon:i,memberDiscount:c}=D,B=N?.showComparePrice??!0,F=C(()=>y(e?.totalSavings||"",{amount:d({amount:r,currencyCode:t.price.currencyCode,locale:l==="CAD"?"us":a||"us"})}),[e?.totalSavings,r,t.price.currencyCode,a]),x=C(()=>{if(!e?.unlockedSaving)return;const b=i?.enable?Number(i?.config?.fixed_value||0):0,f=c?.enable?c.config?.amount??0:0,g=Math.round((p?.withoutCouponMaxMemberTotalSave?Math.max(f,b):f+b)*100)/100;if(!(g<=0))return y(e.unlockedSaving,{amount:d({amount:g,currencyCode:t.price.currencyCode,locale:l==="CAD"?"us":a||"us"})})},[e?.unlockedSaving,i?.enable,i?.config?.fixed_value,c?.enable,c?.config?.amount,p,t.price.currencyCode,a]);return u(L,{childClassName:"tablet:flex tablet:justify-end tablet:gap-8 laptop-md:px-0 desktop:px-0 tablet:items-center tablet:gap-4",className:"laptop-md:border-none laptop-md:py-0 border-t border-[#E4E5E6] bg-white py-3",children:[t.availableForSale?u("div",{className:"laptop-md:items-end flex flex-col justify-between",children:[u("div",{className:"flex items-center gap-1",children:[o(n,{className:"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2]",html:d({amount:parseFloat(h.toFixed(2)),currencyCode:t.price.currencyCode,locale:l==="CAD"?"us":a||"us"})}),B&&(r>0||s?.member>0&&m)&&o(n,{className:"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2] text-[#4A4C56] line-through",html:d({amount:w,currencyCode:t.price.currencyCode,locale:l==="CAD"?"us":a||"us"})}),s?.member>0&&m&&o(n,{className:"bg-brand-0 rounded px-1 py-[2px] text-sm font-bold text-white",html:e?.memberPrice||"Member Price"})]}),v||(r>0||s?.member>0&&m?o(n,{className:"text-brand-0 tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:`${F}`}):x?o(n,{className:"text-info-quaternary tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]",html:x}):null)]}):o(n,{className:"text-[20px] font-bold text-[#999999]",html:e?.soldOut??"Sold Out"}),o("div",{className:"tablet:mt-0 mt-2 flex items-center gap-2",children:o(_,{mode:M,availableForSale:t.availableForSale,addToCartText:e?.addToCart??"Add to Cart",buyNowText:e?.buyNow??"Buy Now",addToCartLoading:k,buyNowLoading:A,onAddToCart:S,onBuyNow:T,onNotifyMeClick:P,notifyMeText:e?.notifyMe,notifyMeClassName:"w-full"})})]})};var K=j;export{K 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/PurchaseBar/ProductActions/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Text, Container } from '../../../../../components/index.js'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useMemo, type ReactNode } from 'react'\nimport { formatPrice } from '../../../utils/index.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\nimport { useBenefits } from '../../../hooks/useBenefits.js'\nimport CartActionButtons from '../../CartActionButtons/index.js'\n\nexport interface ProductActionsProps {\n /** \u81EA\u5B9A\u4E49\u603B\u8282\u7701\u7EC4\u4EF6\uFF0C\u4F20\u5165\u65F6\u4F1A\u66FF\u4EE3\u9ED8\u8BA4\u7684 totalSavings \u663E\u793A */\n totalSavingsSlot?: ReactNode\n}\n\nconst ProductActions = ({ totalSavingsSlot }: ProductActionsProps = {}) => {\n const { copyWriting, locale = 'us', trackingData, currencyCode } = useAiuiContext()\n const {\n variant,\n finalPrice,\n totalSavings,\n isLogin,\n comparePrice,\n onAddToCart,\n onBuyNow,\n savingDetail,\n addToCartLoading,\n buyNowLoading,\n discount,\n memberFunctionResult,\n } = useBizProductContext()\n const benefits = useBenefits({ variant })\n const { commonCoupon, memberDiscount } = benefits\n\n /** \u662F\u5426\u663E\u793A\u539F\u4EF7\uFF08\u5212\u7EBF\u4EF7\uFF09\uFF0C\u9ED8\u8BA4\u663E\u793A */\n const showComparePrice = trackingData?.showComparePrice ?? true\n\n const totalSavingsText = useMemo(() => {\n return replaceTemplate(copyWriting?.totalSavings || '', {\n amount: formatPrice({\n amount: totalSavings,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n }),\n })\n }, [copyWriting?.totalSavings, totalSavings, variant.price.currencyCode, locale])\n\n const unlockedSavingText = useMemo(() => {\n if (!copyWriting?.unlockedSaving) return undefined\n\n const couponSaving = commonCoupon?.enable ? Number(commonCoupon?.config?.fixed_value || 0) : 0\n const memberSaving = memberDiscount?.enable ? (memberDiscount.config?.amount ?? 0) : 0\n\n // \u4E0D\u53EF\u53E0\u52A0\u65F6\u53D6\u4F1A\u5458\u4EF7\u4E0E code \u6298\u6263\u7684\u6700\u5927\u503C\uFF0C\u53EF\u53E0\u52A0\u65F6\u53D6\u4E8C\u8005\u4E4B\u548C\n const totalUnlocked = Math.round((\n memberFunctionResult?.withoutCouponMaxMemberTotalSave\n ? Math.max(memberSaving, couponSaving)\n : memberSaving + couponSaving\n ) * 100) / 100\n\n if (totalUnlocked <= 0) return undefined\n\n return replaceTemplate(copyWriting.unlockedSaving, {\n amount: formatPrice({\n amount: totalUnlocked,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n }),\n })\n }, [\n copyWriting?.unlockedSaving,\n commonCoupon?.enable,\n commonCoupon?.config?.fixed_value,\n memberDiscount?.enable,\n memberDiscount?.config?.amount,\n memberFunctionResult,\n variant.price.currencyCode,\n locale,\n ])\n\n return (\n <Container\n childClassName=\"tablet:flex tablet:justify-end tablet:gap-8 laptop-md:px-0 desktop:px-0 tablet:items-center tablet:gap-4\"\n className=\"laptop-md:border-none laptop-md:py-0 border-t border-[#E4E5E6] bg-white py-3\"\n >\n {variant.availableForSale ? (\n <div className=\"laptop-md:items-end flex flex-col justify-between\">\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2]\"\n html={formatPrice({\n amount: parseFloat(finalPrice.toFixed(2)),\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n })}\n />\n {showComparePrice && (totalSavings > 0 || (savingDetail?.member > 0 && isLogin)) && (\n <Text\n className=\"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2] text-[#4A4C56] line-through\"\n html={formatPrice({\n amount: comparePrice,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n })}\n />\n )}\n {savingDetail?.member > 0 && isLogin && (\n <Text\n className=\"bg-brand-0 rounded px-1 py-[2px] text-sm font-bold text-white\"\n html={copyWriting?.memberPrice || 'Member Price'}\n />\n )}\n </div>\n {totalSavingsSlot ||\n (totalSavings > 0 || (savingDetail?.member > 0 && isLogin) ? (\n <Text\n className=\"text-brand-0 tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]\"\n html={`${totalSavingsText}`}\n />\n ) : unlockedSavingText ? (\n <Text\n className=\"text-info-quaternary tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]\"\n html={unlockedSavingText}\n />\n ) : null)}\n </div>\n ) : (\n <Text className=\"text-[20px] font-bold text-[#999999]\" html={copyWriting?.soldOut ?? 'Sold Out'} />\n )}\n <div className=\"tablet:mt-0 mt-2 flex items-center gap-2\">\n <CartActionButtons\n availableForSale={variant.availableForSale}\n addToCartText={copyWriting?.addToCart ?? 'Add to Cart'}\n buyNowText={copyWriting?.buyNow ?? 'Buy Now'}\n addToCartLoading={addToCartLoading}\n buyNowLoading={buyNowLoading}\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n />\n </div>\n </Container>\n )\n}\n\nexport default ProductActions\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "Text", "Container", "useAiuiContext", "useBizProductContext", "useMemo", "formatPrice", "replaceTemplate", "useBenefits", "CartActionButtons", "ProductActions", "totalSavingsSlot", "copyWriting", "locale", "trackingData", "currencyCode", "variant", "finalPrice", "totalSavings", "isLogin", "comparePrice", "onAddToCart", "onBuyNow", "savingDetail", "addToCartLoading", "buyNowLoading", "discount", "memberFunctionResult", "benefits", "commonCoupon", "memberDiscount", "showComparePrice", "totalSavingsText", "unlockedSavingText", "couponSaving", "memberSaving", "totalUnlocked", "ProductActions_default"]
|
|
4
|
+
"sourcesContent": ["import { Text, Container } from '../../../../../components/index.js'\nimport { useAiuiContext } from '../../../../AiuiProvider/index.js'\nimport { useBizProductContext } from '../../../BizProductProvider.js'\nimport { useMemo, type ReactNode } from 'react'\nimport { formatPrice } from '../../../utils/index.js'\nimport { replaceTemplate } from '../../../utils/textFormat.js'\nimport { useBenefits } from '../../../hooks/useBenefits.js'\nimport CartActionButtons from '../../CartActionButtons/index.js'\n\nexport interface ProductActionsProps {\n /** \u81EA\u5B9A\u4E49\u603B\u8282\u7701\u7EC4\u4EF6\uFF0C\u4F20\u5165\u65F6\u4F1A\u66FF\u4EE3\u9ED8\u8BA4\u7684 totalSavings \u663E\u793A */\n totalSavingsSlot?: ReactNode\n}\n\nconst ProductActions = ({ totalSavingsSlot }: ProductActionsProps = {}) => {\n const { copyWriting, locale = 'us', trackingData, currencyCode } = useAiuiContext()\n const {\n variant,\n finalPrice,\n totalSavings,\n isLogin,\n comparePrice,\n onAddToCart,\n onBuyNow,\n savingDetail,\n addToCartLoading,\n buyNowLoading,\n notifyMeMode,\n onNotifyMeClick,\n discount,\n memberFunctionResult,\n } = useBizProductContext()\n const benefits = useBenefits({ variant })\n const { commonCoupon, memberDiscount } = benefits\n\n /** \u662F\u5426\u663E\u793A\u539F\u4EF7\uFF08\u5212\u7EBF\u4EF7\uFF09\uFF0C\u9ED8\u8BA4\u663E\u793A */\n const showComparePrice = trackingData?.showComparePrice ?? true\n\n const totalSavingsText = useMemo(() => {\n return replaceTemplate(copyWriting?.totalSavings || '', {\n amount: formatPrice({\n amount: totalSavings,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n }),\n })\n }, [copyWriting?.totalSavings, totalSavings, variant.price.currencyCode, locale])\n\n const unlockedSavingText = useMemo(() => {\n if (!copyWriting?.unlockedSaving) return undefined\n\n const couponSaving = commonCoupon?.enable ? Number(commonCoupon?.config?.fixed_value || 0) : 0\n const memberSaving = memberDiscount?.enable ? (memberDiscount.config?.amount ?? 0) : 0\n\n // \u4E0D\u53EF\u53E0\u52A0\u65F6\u53D6\u4F1A\u5458\u4EF7\u4E0E code \u6298\u6263\u7684\u6700\u5927\u503C\uFF0C\u53EF\u53E0\u52A0\u65F6\u53D6\u4E8C\u8005\u4E4B\u548C\n const totalUnlocked = Math.round((\n memberFunctionResult?.withoutCouponMaxMemberTotalSave\n ? Math.max(memberSaving, couponSaving)\n : memberSaving + couponSaving\n ) * 100) / 100\n\n if (totalUnlocked <= 0) return undefined\n\n return replaceTemplate(copyWriting.unlockedSaving, {\n amount: formatPrice({\n amount: totalUnlocked,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n }),\n })\n }, [\n copyWriting?.unlockedSaving,\n commonCoupon?.enable,\n commonCoupon?.config?.fixed_value,\n memberDiscount?.enable,\n memberDiscount?.config?.amount,\n memberFunctionResult,\n variant.price.currencyCode,\n locale,\n ])\n\n return (\n <Container\n childClassName=\"tablet:flex tablet:justify-end tablet:gap-8 laptop-md:px-0 desktop:px-0 tablet:items-center tablet:gap-4\"\n className=\"laptop-md:border-none laptop-md:py-0 border-t border-[#E4E5E6] bg-white py-3\"\n >\n {variant.availableForSale ? (\n <div className=\"laptop-md:items-end flex flex-col justify-between\">\n <div className=\"flex items-center gap-1\">\n <Text\n className=\"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2]\"\n html={formatPrice({\n amount: parseFloat(finalPrice.toFixed(2)),\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n })}\n />\n {showComparePrice && (totalSavings > 0 || (savingDetail?.member > 0 && isLogin)) && (\n <Text\n className=\"tablet:text-2xl laptop-md:text-xl lg-desktop:text-2xl text-xl font-bold !leading-[1.2] text-[#4A4C56] line-through\"\n html={formatPrice({\n amount: comparePrice,\n currencyCode: variant.price.currencyCode,\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n })}\n />\n )}\n {savingDetail?.member > 0 && isLogin && (\n <Text\n className=\"bg-brand-0 rounded px-1 py-[2px] text-sm font-bold text-white\"\n html={copyWriting?.memberPrice || 'Member Price'}\n />\n )}\n </div>\n {totalSavingsSlot ||\n (totalSavings > 0 || (savingDetail?.member > 0 && isLogin) ? (\n <Text\n className=\"text-brand-0 tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]\"\n html={`${totalSavingsText}`}\n />\n ) : unlockedSavingText ? (\n <Text\n className=\"text-info-quaternary tablet:text-end laptop-md:text-xl lg-desktop:text-2xl whitespace-nowrap text-[18px] font-bold !leading-[1.2]\"\n html={unlockedSavingText}\n />\n ) : null)}\n </div>\n ) : (\n <Text className=\"text-[20px] font-bold text-[#999999]\" html={copyWriting?.soldOut ?? 'Sold Out'} />\n )}\n <div className=\"tablet:mt-0 mt-2 flex items-center gap-2\">\n <CartActionButtons\n mode={notifyMeMode}\n availableForSale={variant.availableForSale}\n addToCartText={copyWriting?.addToCart ?? 'Add to Cart'}\n buyNowText={copyWriting?.buyNow ?? 'Buy Now'}\n addToCartLoading={addToCartLoading}\n buyNowLoading={buyNowLoading}\n onAddToCart={onAddToCart}\n onBuyNow={onBuyNow}\n onNotifyMeClick={onNotifyMeClick}\n notifyMeText={copyWriting?.notifyMe}\n notifyMeClassName=\"w-full\"\n />\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ACR,EAEApC,EAACE,EAAA,CAAK,UAAU,uCAAuC,KAAMW,GAAa,SAAW,WAAY,EAEnGb,EAAC,OAAI,UAAU,2CACb,SAAAA,EAACU,EAAA,CACC,KAAMiB,EACN,iBAAkBV,EAAQ,iBAC1B,cAAeJ,GAAa,WAAa,cACzC,WAAYA,GAAa,QAAU,UACnC,iBAAkBY,EAClB,cAAeC,EACf,YAAaJ,EACb,SAAUC,EACV,gBAAiBK,EACjB,aAAcf,GAAa,SAC3B,kBAAkB,SACpB,EACF,GACF,CAEJ,EAEA,IAAO2B,EAAQ7B",
|
|
6
|
+
"names": ["jsx", "jsxs", "Text", "Container", "useAiuiContext", "useBizProductContext", "useMemo", "formatPrice", "replaceTemplate", "useBenefits", "CartActionButtons", "ProductActions", "totalSavingsSlot", "copyWriting", "locale", "trackingData", "currencyCode", "variant", "finalPrice", "totalSavings", "isLogin", "comparePrice", "onAddToCart", "onBuyNow", "savingDetail", "addToCartLoading", "buyNowLoading", "notifyMeMode", "onNotifyMeClick", "discount", "memberFunctionResult", "benefits", "commonCoupon", "memberDiscount", "showComparePrice", "totalSavingsText", "unlockedSavingText", "couponSaving", "memberSaving", "totalUnlocked", "ProductActions_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{default as o}from"./PurchaseBar/index.js";import{default as e}from"./PurchaseBar/ProductActions/index.js";
|
|
1
|
+
import{default as o}from"./PurchaseBar/index.js";import{default as e}from"./PurchaseBar/ProductActions/index.js";export{e as ProductActions,o as PurchaseBar};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/biz-components/Listing/components/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as PurchaseBar } from './PurchaseBar/index.js'\nexport { default as ProductActions } from './PurchaseBar/ProductActions/index.js'\
|
|
5
|
-
"mappings": "AAAA,OAAoB,WAAXA,MAA8B,yBACvC,OAAoB,WAAXA,MAAiC
|
|
4
|
+
"sourcesContent": ["export { default as PurchaseBar } from './PurchaseBar/index.js'\nexport { default as ProductActions } from './PurchaseBar/ProductActions/index.js'\n\n"],
|
|
5
|
+
"mappings": "AAAA,OAAoB,WAAXA,MAA8B,yBACvC,OAAoB,WAAXA,MAAiC",
|
|
6
6
|
"names": ["default"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { ProductVariant, FreeGift
|
|
1
|
+
import type { ProductVariant, FreeGift } from '../types/product';
|
|
2
|
+
import type { ProductFunctionFreeGiftProps } from '../components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.js';
|
|
3
|
+
import type { ProductBundleProps } from '../components/ProductCard/ProductDetail/ProductBundle/types.js';
|
|
2
4
|
interface BenefitsParams {
|
|
3
5
|
variant: ProductVariant;
|
|
4
6
|
}
|
|
@@ -15,10 +17,14 @@ interface BenefitsResult {
|
|
|
15
17
|
* 买赠
|
|
16
18
|
*/
|
|
17
19
|
freeGift: BenefitItemConfig<FreeGift>;
|
|
20
|
+
/**
|
|
21
|
+
* function买赠
|
|
22
|
+
*/
|
|
23
|
+
functionFreeGift: BenefitItemConfig<ProductFunctionFreeGiftProps>;
|
|
18
24
|
/**
|
|
19
25
|
* 捆绑折扣
|
|
20
26
|
*/
|
|
21
|
-
bundle: BenefitItemConfig<
|
|
27
|
+
bundle: BenefitItemConfig<ProductBundleProps>;
|
|
22
28
|
/**
|
|
23
29
|
* 会员价
|
|
24
30
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useBizProductContext as
|
|
1
|
+
import{useBizProductContext as P}from"../BizProductProvider.js";import{checkItemAvailableForProduct as C}from"../utils/helper.js";import{useDiscountEnable as h}from"./useDiscountEnable.js";import{useAiuiContext as G}from"../../AiuiProvider/index.js";const R=({variant:e})=>{const{coupon:i,product:a,bundle:c,freeGift:r,functionFreeGift:f,memberFunctionResult:t,creditsRedemption:m,profile:p}=P(),{amount:l}=m??{},{trackingData:o}=G(),d=Math.max(t?.withCouponMemberTotalSave??0,t?.withoutCouponMaxMemberTotalSave??0),u=h({profile:p,variant:e,memberFunctionResult:t,coupon:i}),g=!!(o?.paidShipping&&e.requiresShipping&&!e?.metafields?.global?.presell&&!e?.metafields?.global?.HideShipping),s=o?.freeGift,b=s?.excludeProducts?.map(n=>typeof n=="object"&&"sku"in n?n.sku:n)??[],B=o?.levelDiscount&&C({product:a,variant:e,item:o?.levelDiscount});return{commonCoupon:{enable:u.showCommonCoupon&&!!i,config:i??{}},freeGift:{enable:!!r&&!!r?.giftList?.length,config:r},functionFreeGift:{enable:!!f&&!!f?.giftItems?.length,config:f},bundle:{enable:!!c&&!!c?.bundleOptions?.length,config:c},memberDiscount:{enable:u.showMemberDiscount,config:{amount:d,description:t?.labels?.[0]}},creditsRedemption:{enable:!!l&&l>0,config:{amount:l,label:o?.creditsRedemptionLabel}},paidShipping:{enable:g,config:{}},fullGift:{enable:!!(s&&!b.includes(e.sku)),config:s??{}},levelDiscount:{enable:!!B,config:o?.levelDiscount??{}}}};export{R as useBenefits};
|
|
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.js'\nimport type { ProductVariant, FreeGift
|
|
5
|
-
"mappings": "AAAA,OAAS,wBAAAA,MAA4B,2BAErC,OAAS,gCAAAC,MAAoC,qBAC7C,OAAS,qBAAAC,MAAyB,yBAElC,OAAS,kBAAAC,MAAsB,
|
|
6
|
-
"names": ["useBizProductContext", "checkItemAvailableForProduct", "useDiscountEnable", "useAiuiContext", "useBenefits", "variant", "coupon", "product", "bundle", "freeGift", "memberFunctionResult", "creditsRedemption", "profile", "creditsRedemptionAmount", "trackingData", "total", "discountEnable", "showPaidShipping", "fullGift", "excludeProducts", "item", "showLevelDiscount"]
|
|
4
|
+
"sourcesContent": ["import { useBizProductContext } from '../BizProductProvider.js'\nimport type { ProductVariant, FreeGift } from '../types/product'\nimport { checkItemAvailableForProduct } from '../utils/helper.js'\nimport { useDiscountEnable } from './useDiscountEnable.js'\n\nimport { useAiuiContext } from '../../AiuiProvider/index.js'\nimport type { ProductFunctionFreeGiftProps } from '../components/ProductCard/ProductDetail/ProductFunctionFreeGift/types.js'\nimport type { ProductBundleProps } from '../components/ProductCard/ProductDetail/ProductBundle/types.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 * function\u4E70\u8D60\n */\n functionFreeGift: BenefitItemConfig<ProductFunctionFreeGiftProps>\n /**\n * \u6346\u7ED1\u6298\u6263\n */\n bundle: BenefitItemConfig<ProductBundleProps>\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, freeGift, functionFreeGift, memberFunctionResult, creditsRedemption, profile } = useBizProductContext()\n\n const { amount: creditsRedemptionAmount } = creditsRedemption ?? {}\n\n const { trackingData } = useAiuiContext()\n\n const total = Math.max(\n memberFunctionResult?.withCouponMemberTotalSave ?? 0,\n memberFunctionResult?.withoutCouponMaxMemberTotalSave ?? 0\n )\n\n const discountEnable = useDiscountEnable({ profile, variant, memberFunctionResult, coupon })\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 return {\n commonCoupon: {\n enable: discountEnable.showCommonCoupon && Boolean(coupon),\n config: coupon ?? {},\n },\n freeGift: {\n enable: Boolean(freeGift) && !!freeGift?.giftList?.length,\n config: freeGift,\n },\n functionFreeGift: {\n enable: Boolean(functionFreeGift) && !!functionFreeGift?.giftItems?.length,\n config: functionFreeGift,\n },\n bundle: {\n enable: Boolean(bundle) && !!bundle?.bundleOptions?.length,\n // Math.max(...(bundle?.bundleOptions?.map(item => item.savings ?? 0) ?? [])) > 0, // \u6709\u4F18\u60E0\u624D\u5C55\u793A\n config: bundle,\n },\n memberDiscount: {\n enable: discountEnable.showMemberDiscount,\n // enable: total > 0,\n config: {\n amount: total,\n description: memberFunctionResult?.labels?.[0],\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": "AAAA,OAAS,wBAAAA,MAA4B,2BAErC,OAAS,gCAAAC,MAAoC,qBAC7C,OAAS,qBAAAC,MAAyB,yBAElC,OAAS,kBAAAC,MAAsB,8BA4DxB,MAAMC,EAAc,CAAC,CAAE,QAAAC,CAAQ,IAAsC,CAC1E,KAAM,CAAE,OAAAC,EAAQ,QAAAC,EAAS,OAAAC,EAAQ,SAAAC,EAAU,iBAAAC,EAAkB,qBAAAC,EAAsB,kBAAAC,EAAmB,QAAAC,CAAQ,EAAIb,EAAqB,EAEjI,CAAE,OAAQc,CAAwB,EAAIF,GAAqB,CAAC,EAE5D,CAAE,aAAAG,CAAa,EAAIZ,EAAe,EAElCa,EAAQ,KAAK,IACjBL,GAAsB,2BAA6B,EACnDA,GAAsB,iCAAmC,CAC3D,EAEMM,EAAiBf,EAAkB,CAAE,QAAAW,EAAS,QAAAR,EAAS,qBAAAM,EAAsB,OAAAL,CAAO,CAAC,EAGrFY,EAAmB,GACvBH,GAAc,cACdV,EAAQ,kBACR,CAACA,GAAS,YAAY,QAAQ,SAC9B,CAACA,GAAS,YAAY,QAAQ,cAI1Bc,EAAWJ,GAAc,SACzBK,EACJD,GAAU,iBAAiB,IAAKE,GAAe,OAAOA,GAAS,UAAY,QAASA,EAAOA,EAAK,IAAMA,CAAK,GAAK,CAAC,EAE7GC,EACJP,GAAc,eAAiBd,EAA6B,CAAE,QAAAM,EAAS,QAAAF,EAAS,KAAMU,GAAc,aAAc,CAAC,EAErH,MAAO,CACL,aAAc,CACZ,OAAQE,EAAe,kBAAoB,EAAQX,EACnD,OAAQA,GAAU,CAAC,CACrB,EACA,SAAU,CACR,OAAQ,EAAQG,GAAa,CAAC,CAACA,GAAU,UAAU,OACnD,OAAQA,CACV,EACA,iBAAkB,CAChB,OAAQ,EAAQC,GAAqB,CAAC,CAACA,GAAkB,WAAW,OACpE,OAAQA,CACV,EACA,OAAQ,CACN,OAAQ,EAAQF,GAAW,CAAC,CAACA,GAAQ,eAAe,OAEpD,OAAQA,CACV,EACA,eAAgB,CACd,OAAQS,EAAe,mBAEvB,OAAQ,CACN,OAAQD,EACR,YAAaL,GAAsB,SAAS,CAAC,CAC/C,CACF,EACA,kBAAmB,CACjB,OAAQ,EAAQG,GAA4BA,EAA2B,EACvE,OAAQ,CAAE,OAAQA,EAAyB,MAAOC,GAAc,sBAAuB,CACzF,EACA,aAAc,CACZ,OAAQG,EACR,OAAQ,CAAC,CACX,EACA,SAAU,CACR,OAAQ,GAAQC,GAAY,CAACC,EAAgB,SAASf,EAAQ,GAAG,GACjE,OAAQc,GAAY,CAAC,CACvB,EACA,cAAe,CACb,OAAQ,EAAQG,EAChB,OAAQP,GAAc,eAAiB,CAAC,CAC1C,CACF,CACF",
|
|
6
|
+
"names": ["useBizProductContext", "checkItemAvailableForProduct", "useDiscountEnable", "useAiuiContext", "useBenefits", "variant", "coupon", "product", "bundle", "freeGift", "functionFreeGift", "memberFunctionResult", "creditsRedemption", "profile", "creditsRedemptionAmount", "trackingData", "total", "discountEnable", "showPaidShipping", "fullGift", "excludeProducts", "item", "showLevelDiscount"]
|
|
7
7
|
}
|
|
@@ -118,24 +118,3 @@ export type FreeGift = {
|
|
|
118
118
|
showCoupon: boolean;
|
|
119
119
|
[key: string]: any;
|
|
120
120
|
};
|
|
121
|
-
export type BundleListItem = {
|
|
122
|
-
id: string;
|
|
123
|
-
price: number;
|
|
124
|
-
comparePrice: number;
|
|
125
|
-
savings: number;
|
|
126
|
-
variants: {
|
|
127
|
-
price: number;
|
|
128
|
-
quantity: number;
|
|
129
|
-
label: string;
|
|
130
|
-
variant: ProductVariant;
|
|
131
|
-
}[];
|
|
132
|
-
};
|
|
133
|
-
export type Bundle = {
|
|
134
|
-
title: string;
|
|
135
|
-
soldOutLabel: string;
|
|
136
|
-
youSaveText: string;
|
|
137
|
-
showCoupon: boolean;
|
|
138
|
-
bundleList: BundleListItem[];
|
|
139
|
-
showAtListing: boolean;
|
|
140
|
-
[key: string]: any;
|
|
141
|
-
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/biz-components/Listing/types/product.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n CurrencyCode,\n Image,\n Media,\n Product as ShopifyProduct,\n ProductVariant as ShopifyProductVariant,\n} from './graphql'\nimport { DiscountType } from '../const.js'\n\nexport type ProductPrice = {\n amount: number\n currencyCode: CurrencyCode\n}\n\nexport type ProductOption = {\n __typename?: 'MultipleChoiceOption'\n id: string\n name: string\n values: ProductOptionValues[]\n}\n\nexport type ProductOptionValues = {\n label: string\n hexColors?: string[]\n}\n\nexport type ProductVariant = {\n id: string | number\n options: ProductOption[]\n sku: string\n metafields?: Record<string, any>\n price: ProductPrice\n product: Product\n coupons: VariantCoupon[]\n weight?: number\n payload?: any\n} & Omit<ShopifyProductVariant, 'options' | 'metafields' | 'price'>\n\nexport type Product = {\n path?: string\n images: Image[]\n media: ProductMedia[]\n variants: ProductVariant[]\n price: ProductPrice\n options: ProductOption[]\n metafields?: { [key: string]: any }\n slug: string\n payload?: any\n} & Omit<ShopifyProduct, 'metafields' | 'images' | 'variants' | 'price' | 'options' | 'media'>\n\nexport type GetProductBody = {\n handles: string\n locale?: string\n}\n\nexport type ProductTypes = {\n product: Product\n getBody: GetProductBody\n}\n\nexport type GetAllProductPathsOperation<T extends ProductTypes = ProductTypes> = {\n data: { products: Pick<T['product'], 'path'>[] }\n variables: { first?: number }\n}\n\nexport type GetAllProductsOperation<T extends ProductTypes = ProductTypes> = {\n data: { products: T['product'][] }\n variables: {\n relevance?: 'featured' | 'best_selling' | 'newest'\n ids?: string[]\n first?: number\n }\n}\n\nexport type GetProductOperation<T extends ProductTypes = ProductTypes> = {\n data: { product?: T['product'] }\n variables: { path: string; slug?: never } | { path?: never; slug: string }\n}\n\nexport type Options = Record<string, string>\n\nexport type ProductMedia = Media & {\n sources?: {\n url: string\n altText: string\n }[]\n image?: {\n url: string\n altText: string\n }\n}\n\nexport type VariantCoupon = {\n title: string\n starts_at: string // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\n ends_at: string | null // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\u6216 null\n variant_shopify_id: number\n value_type: DiscountType\n value: string // \u8D1F\u6570\u7684\u767E\u5206\u6BD4\u503C\n currency: string\n fixed_value: string // \u56FA\u5B9A\u503C\n value_style: string // \u5E26\u6709\u8D27\u5E01\u7B26\u53F7\u7684\u503C\n variant_price4wscode: number\n discount_type: string // \u5047\u8BBE discount_type \u662F\u4E00\u4E2A\u5B57\u7B26\u4E32\n amazon_deal: boolean\n cdi_id: number\n cdi_updated_at: string // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\n}\n\nexport type ScriptDiscount = {\n type: DiscountType\n excludeSkus: string[]\n discount: number\n}\n\nexport type FreeGift = {\n title: string\n note: string\n soldOutLabel: string\n freeLabel: string\n giftList: ProductVariant[]\n count: number\n showCoupon: boolean\n [key: string]: any\n}\n\
|
|
4
|
+
"sourcesContent": ["import type {\n CurrencyCode,\n Image,\n Media,\n Product as ShopifyProduct,\n ProductVariant as ShopifyProductVariant,\n} from './graphql'\nimport { DiscountType } from '../const.js'\n\nexport type ProductPrice = {\n amount: number\n currencyCode: CurrencyCode\n}\n\nexport type ProductOption = {\n __typename?: 'MultipleChoiceOption'\n id: string\n name: string\n values: ProductOptionValues[]\n}\n\nexport type ProductOptionValues = {\n label: string\n hexColors?: string[]\n}\n\nexport type ProductVariant = {\n id: string | number\n options: ProductOption[]\n sku: string\n metafields?: Record<string, any>\n price: ProductPrice\n product: Product\n coupons: VariantCoupon[]\n weight?: number\n payload?: any\n} & Omit<ShopifyProductVariant, 'options' | 'metafields' | 'price'>\n\nexport type Product = {\n path?: string\n images: Image[]\n media: ProductMedia[]\n variants: ProductVariant[]\n price: ProductPrice\n options: ProductOption[]\n metafields?: { [key: string]: any }\n slug: string\n payload?: any\n} & Omit<ShopifyProduct, 'metafields' | 'images' | 'variants' | 'price' | 'options' | 'media'>\n\nexport type GetProductBody = {\n handles: string\n locale?: string\n}\n\nexport type ProductTypes = {\n product: Product\n getBody: GetProductBody\n}\n\nexport type GetAllProductPathsOperation<T extends ProductTypes = ProductTypes> = {\n data: { products: Pick<T['product'], 'path'>[] }\n variables: { first?: number }\n}\n\nexport type GetAllProductsOperation<T extends ProductTypes = ProductTypes> = {\n data: { products: T['product'][] }\n variables: {\n relevance?: 'featured' | 'best_selling' | 'newest'\n ids?: string[]\n first?: number\n }\n}\n\nexport type GetProductOperation<T extends ProductTypes = ProductTypes> = {\n data: { product?: T['product'] }\n variables: { path: string; slug?: never } | { path?: never; slug: string }\n}\n\nexport type Options = Record<string, string>\n\nexport type ProductMedia = Media & {\n sources?: {\n url: string\n altText: string\n }[]\n image?: {\n url: string\n altText: string\n }\n}\n\nexport type VariantCoupon = {\n title: string\n starts_at: string // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\n ends_at: string | null // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\u6216 null\n variant_shopify_id: number\n value_type: DiscountType\n value: string // \u8D1F\u6570\u7684\u767E\u5206\u6BD4\u503C\n currency: string\n fixed_value: string // \u56FA\u5B9A\u503C\n value_style: string // \u5E26\u6709\u8D27\u5E01\u7B26\u53F7\u7684\u503C\n variant_price4wscode: number\n discount_type: string // \u5047\u8BBE discount_type \u662F\u4E00\u4E2A\u5B57\u7B26\u4E32\n amazon_deal: boolean\n cdi_id: number\n cdi_updated_at: string // ISO 8601 \u65E5\u671F\u5B57\u7B26\u4E32\n}\n\nexport type ScriptDiscount = {\n type: DiscountType\n excludeSkus: string[]\n discount: number\n}\n\nexport type FreeGift = {\n title: string\n note: string\n soldOutLabel: string\n freeLabel: string\n giftList: ProductVariant[]\n count: number\n showCoupon: boolean\n [key: string]: any\n}\n\n// export type BundleListItem = {\n// id: string\n// price: number\n// comparePrice: number\n// savings: number\n// variants: {\n// price: number\n// quantity: number\n// label: string\n// variant: ProductVariant\n// }[]\n// }\n\n// export type Bundle = {\n// title: string\n// soldOutLabel: string\n// youSaveText: string\n// showCoupon: boolean\n// bundleList: BundleListItem[]\n// showAtListing: boolean\n// [key: string]: any\n// }\n"],
|
|
5
5
|
"mappings": "AAOA,MAA6B",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NotifyMeDialogProps } from './types.js';
|
|
2
|
+
declare const NotifyMeDialog: {
|
|
3
|
+
({ open, onOpenChange, copy, classNames, checkboxes, subscriptionMeta, onSubmit, }: NotifyMeDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default NotifyMeDialog;
|
|
7
|
+
export type { NotifyMeDialogProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useCallback as y,useEffect as ae,useState as f}from"react";import{Button as L,Text as c,Dialog as oe,DialogContent as le,DialogHeader as re,DialogTitle as ie,DialogDescription as se,Input as ne,Checkbox as me,Heading as z}from"../../components/index.js";import{cn as s}from"../../helpers/index.js";import*as ce from"react";import{useExposure as de}from"../../hooks/useExposure.js";const H="copy",I="NotifyMeDialog",pe=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,R=({open:P,onOpenChange:v,copy:$,classNames:r,checkboxes:i=[],subscriptionMeta:D,onSubmit:N})=>{const{title:T,subTitle:k,emailLabel:j="Email address",emailPlaceholder:q="your@email.com",submitBtnText:A="Notify Me",errorEmpty:F,errorInvalidEmail:G,errorCheckboxRequired:W,errorSubmit:E="Something went wrong. Please try again.",errorSubmitDetail:X,successTitle:J,successDesc:w,successBtnText:C}=$,S=ce.useRef(null);de(S,{componentType:H,componentName:I,componentTitle:T,componentDescription:k});const[x,M]=f(""),[g,_]=f(()=>i.map(()=>!1)),[d,u]=f("idle"),[K,h]=f(()=>i.map(()=>!1)),[o,p]=f("idle"),[B,b]=f(null),Q=B?X?.find(e=>e.code===B)?.message??E:E,U=o!=="loading"&&o!=="success",V=y(e=>{_(l=>{const a=[...l];return a[e]=!a[e],a}),h(l=>{const a=[...l];return a[e]=!1,a}),d!=="idle"&&u("idle"),o==="error-submit"&&(p("idle"),b(null))},[d,o]),Y=y(e=>{M(e.target.value),d!=="idle"&&u("idle"),h(l=>l.some(Boolean)?l.map(()=>!1):l),o==="error-submit"&&(p("idle"),b(null))},[d,o]),Z=y(async()=>{let e=!1;x.trim()?pe.test(x.trim())?u("idle"):(u("error-format"),e=!0):(u("error-empty"),e=!0);const l=i.map((a,m)=>a.label&&a.required&&!g[m]?(e=!0,!0):!1);if(h(l),!e){p("loading");try{const a=i.map((m,te)=>m.checkbox_id!==void 0?{checkbox_id:m.checkbox_id,checked:g[te]}:null).filter(m=>m!==null);await N({email:x.trim(),checkedItems:a,meta:D}),p("success")}catch(a){const m=a&&typeof a=="object"&&"code"in a?String(a.code):null;b(m),p("error-submit")}}},[x,i,g,D,N]);ae(()=>{if(o!=="error-submit")return;const e=setTimeout(()=>{p("idle"),b(null)},3e3);return()=>clearTimeout(e)},[o]);const O=y(e=>{e||(M(""),_(i.map(()=>!1)),u("idle"),h(i.map(()=>!1)),p("idle"),b(null)),v(e)},[i,v]),ee=i.some(e=>e.label);return t(oe,{open:P,onOpenChange:O,children:n(le,{ref:S,"aria-describedby":"notify-me-content",className:s("laptop:max-w-[480px] laptop:[&_.dialog-close-icon]:size-6 laptop:gap-8 rounded-box laptop:p-8 max-h-[90vh] w-[calc(100%-32px)] gap-6 overflow-y-auto bg-white p-6 [&_.dialog-close-icon]:size-5",r?.root),children:[o!=="success"&&n(re,{className:s(r?.header),children:[t(ie,{children:t(z,{as:"h2",size:2,className:s("text-info-primary text-center font-bold",r?.title),children:T})}),k&&t(se,{asChild:!0,children:t(c,{as:"p",className:s("text-info-primary laptop:text-base mt-1 text-center text-sm",r?.subTitle),children:k})})]}),o==="success"?n("div",{className:s("flex flex-col items-center text-center",r?.successText),children:[t("div",{className:"flex size-20 items-center justify-center",children:n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"80",height:"80",viewBox:"0 0 80 80",fill:"none",children:[t("circle",{cx:"40",cy:"40",r:"35",fill:"#30D158"}),t("path",{d:"M23.3333 38.3333L36.6666 50L56.6666 30",stroke:"white",strokeWidth:"6.66667",strokeLinecap:"round",strokeLinejoin:"round"})]})}),n("div",{className:"mt-4",children:[t(z,{as:"h3",size:2,className:"text-info-primary font-bold",children:J}),w&&t(c,{as:"p",className:"text-info-primary laptop:text-base mt-1 text-sm",children:w})]}),C&&t(L,{variant:"primary",size:"lg",onClick:()=>v(!1),className:"laptop:mt-8 mt-6 w-full",children:C})]}):n("div",{className:"flex flex-col gap-4",children:[n("div",{className:r?.emailInput,children:[t(c,{as:"label",htmlFor:"notify-me-email",className:"text-info-primary laptop:text-base mb-2 block text-sm",children:j}),t(ne,{id:"notify-me-email",type:"email",placeholder:q,value:x,onChange:Y,disabled:o==="loading",className:s("placeholder:text-info-tertiary text-info-primary laptop:h-[54px] laptop:text-base laptop:p-4 border-lines-1 h-[44px] w-full bg-white p-3 text-sm font-bold placeholder:font-bold focus-visible:!outline-none",d!=="idle"&&"border-error-0")}),d==="error-empty"&&t(c,{as:"p",className:"text-error-0 laptop:text-base mt-2 text-sm",children:F}),d==="error-format"&&t(c,{as:"p",className:"text-error-0 laptop:text-base mt-2 text-sm",children:G})]}),ee&&t("div",{className:s("laptop:gap-4 flex flex-col gap-2",r?.checkboxes),children:i.map((e,l)=>e.label?n("div",{children:[n("label",{className:s("text-info-tertiary flex cursor-pointer items-start gap-2",r?.checkboxItem),children:[t(me,{checked:g[l],onCheckedChange:()=>V(l),"data-headless-type-name":`${H}#${I}`,"data-headless-title-desc-button":`''#''#${e.label}`,"data-headless-nav-position":"''#1",disabled:o==="loading",className:"border-info-secondary data-[state=checked]:bg-info-secondary mt-0.5 shrink-0"}),t(c,{as:"span",className:"text-info-tertiary laptop:text-base [&_a]:text-brand-0 text-sm leading-snug [&_a]:underline",html:e.label})]}),K[l]&&t(c,{as:"p",className:"text-error-0 laptop:text-base mt-2 text-sm",children:W})]},l):null)}),t(L,{variant:"primary",size:"lg",loading:o==="loading",disabled:!U,onClick:Z,className:s("w-full",r?.submitBtn),children:A}),o==="error-submit"&&t(c,{as:"p",className:s("text-error-0 laptop:text-base text-sm",r?.errorText),children:Q})]})]})})};R.displayName="NotifyMeDialog";var ge=R;export{ge as default};
|
|
2
|
+
//# sourceMappingURL=NotifyMeDialog.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/NotifyMeDialog/NotifyMeDialog.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { useCallback, useEffect, useState } from 'react'\nimport {\n Button,\n Text,\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n Input,\n Checkbox,\n Heading,\n} from '../../components/index.js'\nimport { cn } from '../../helpers/index.js'\nimport type { NotifyMeDialogProps } from './types.js'\nimport * as React from 'react'\nimport { useExposure } from '../../hooks/useExposure.js'\n\nconst componentType = 'copy'\nconst componentName = 'NotifyMeDialog'\n\ntype EmailState = 'idle' | 'error-empty' | 'error-format'\ntype SubmitState = 'idle' | 'loading' | 'success' | 'error-submit'\n\nconst EMAIL_REGEX = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\n\nconst NotifyMeDialog = ({\n open,\n onOpenChange,\n copy,\n classNames,\n checkboxes = [],\n subscriptionMeta,\n onSubmit,\n}: NotifyMeDialogProps) => {\n const {\n title,\n subTitle,\n emailLabel = 'Email address',\n emailPlaceholder = 'your@email.com',\n submitBtnText = 'Notify Me',\n errorEmpty,\n errorInvalidEmail,\n errorCheckboxRequired,\n errorSubmit = 'Something went wrong. Please try again.',\n errorSubmitDetail,\n successTitle,\n successDesc,\n successBtnText,\n } = copy\n\n const notifyMeDialogRef = React.useRef<HTMLDivElement>(null)\n useExposure(notifyMeDialogRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subTitle,\n })\n\n const [email, setEmail] = useState('')\n const [checkedStates, setCheckedStates] = useState<boolean[]>(() => checkboxes.map(() => false))\n const [emailState, setEmailState] = useState<EmailState>('idle')\n const [checkboxErrors, setCheckboxErrors] = useState<boolean[]>(() => checkboxes.map(() => false))\n const [submitState, setSubmitState] = useState<SubmitState>('idle')\n const [errorCode, setErrorCode] = useState<string | null>(null)\n\n // \u6839\u636E\u9519\u8BEF\u7801\u5339\u914D\u5BF9\u5E94\u6587\u6848\uFF0C\u672A\u5339\u914D\u5230\u5219\u56DE\u9000\u5230 errorSubmit\n const resolvedErrorMessage = errorCode\n ? (errorSubmitDetail?.find(d => d.code === errorCode)?.message ?? errorSubmit)\n : errorSubmit\n\n // \u662F\u5426\u53EF\u4EE5\u70B9\u51FB\u63D0\u4EA4\uFF08loading/success \u65F6\u7981\u7528\uFF09\n const canSubmit = submitState !== 'loading' && submitState !== 'success'\n\n // checkbox \u72B6\u6001\u53D8\u5316\n const updateCheckedState = useCallback(\n (index: number) => {\n setCheckedStates(prev => {\n const next = [...prev]\n next[index] = !next[index]\n return next\n })\n // \u6E05\u9664\u5F53\u524D checkbox \u7684\u9519\u8BEF\u72B6\u6001\n setCheckboxErrors(prev => {\n const next = [...prev]\n next[index] = false\n return next\n })\n // \u6E05\u9664\u90AE\u7BB1\u9519\u8BEF\u548C\u63D0\u4EA4\u9519\u8BEF\n if (emailState !== 'idle') setEmailState('idle')\n if (submitState === 'error-submit') {\n setSubmitState('idle')\n setErrorCode(null)\n }\n },\n [emailState, submitState]\n )\n\n // \u90AE\u7BB1\u8F93\u5165\u53D8\u5316\n const handleEmailChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setEmail(e.target.value)\n if (emailState !== 'idle') setEmailState('idle')\n setCheckboxErrors(prev => (prev.some(Boolean) ? prev.map(() => false) : prev))\n if (submitState === 'error-submit') {\n setSubmitState('idle')\n setErrorCode(null)\n }\n },\n [emailState, submitState]\n )\n\n /**\n * \u5BA2\u6237\u7AEF onSubmit \u8C03\u7528\u793A\u4F8B\n *\n * \u63A5\u53E3\u5931\u8D25\u65F6\u9700 throw { code } \u4EE5\u4FBF\u7EC4\u4EF6\u6309 errorSubmitDetail \u5339\u914D\u5BF9\u5E94\u63D0\u793A\u6587\u6848\uFF0C\n * code \u4E3A number \u7C7B\u578B\u65F6\u7EC4\u4EF6\u4F1A\u81EA\u52A8\u8F6C\u4E3A string \u8FDB\u884C\u5339\u914D\u3002\n *\n * @example\n * const handleNotifyMeSubmit = useCallback(\n * async (params) => {\n * const { email, checkedItems, meta } = params\n * const res = await fetch('/api/multipass/shopifyservices/product_arrival_notices', {\n * method: 'POST',\n * headers: {\n * 'Content-Type': 'application/json',\n * 'current-language': locale,\n * },\n * body: JSON.stringify({\n * email,\n * locale,\n * sku: variant.sku,\n * shop: shop.primaryDomain?.host,\n * }),\n * })\n * if (res.ok) {\n * if (checkedItems?.some?.((item) => item.checked && item.checkbox_id === 'subscribe')) {\n * subscribe({ email, dealsType: 'outStockNotify_subscribe_emails' })\n * }\n * } else {\n * throw { code: res.status }\n * }\n * },\n * [locale, variant.sku, shop.primaryDomain?.host, subscribe],\n * )\n */\n // \u70B9\u51FB\u63D0\u4EA4\n const handleSubmit = useCallback(async () => {\n let hasError = false\n\n // \u6821\u9A8C\u90AE\u7BB1\u975E\u7A7A\n if (!email.trim()) {\n setEmailState('error-empty')\n hasError = true\n } else if (!EMAIL_REGEX.test(email.trim())) {\n setEmailState('error-format')\n hasError = true\n } else {\n setEmailState('idle')\n }\n\n // \u6821\u9A8C required checkbox\n const newCheckboxErrors = checkboxes.map((cb, i) => {\n if (cb.label && cb.required && !checkedStates[i]) {\n hasError = true\n return true\n }\n return false\n })\n setCheckboxErrors(newCheckboxErrors)\n\n if (hasError) return\n\n setSubmitState('loading')\n try {\n const checkedItems = checkboxes\n .map((cb, i) =>\n cb.checkbox_id !== undefined ? { checkbox_id: cb.checkbox_id!, checked: checkedStates[i] } : null\n )\n .filter((item): item is { checkbox_id: string; checked: boolean } => item !== null)\n await onSubmit({ email: email.trim(), checkedItems, meta: subscriptionMeta })\n setSubmitState('success')\n } catch (err: unknown) {\n const code =\n err && typeof err === 'object' && 'code' in err ? String((err as Record<string, unknown>).code) : null\n setErrorCode(code)\n setSubmitState('error-submit')\n }\n }, [email, checkboxes, checkedStates, subscriptionMeta, onSubmit])\n\n // error-submit 3s \u540E\u81EA\u52A8\u6D88\u5931\n useEffect(() => {\n if (submitState !== 'error-submit') return\n const timer = setTimeout(() => {\n setSubmitState('idle')\n setErrorCode(null)\n }, 3000)\n return () => clearTimeout(timer)\n }, [submitState])\n\n // \u5173\u95ED\u5F39\u7A97\u65F6\u91CD\u7F6E\n const handleOpenChange = useCallback(\n (isOpen: boolean) => {\n if (!isOpen) {\n setEmail('')\n setCheckedStates(checkboxes.map(() => false))\n setEmailState('idle')\n setCheckboxErrors(checkboxes.map(() => false))\n setSubmitState('idle')\n setErrorCode(null)\n }\n onOpenChange(isOpen)\n },\n [checkboxes, onOpenChange]\n )\n\n const hasCheckboxes = checkboxes.some(cb => cb.label)\n\n return (\n <Dialog open={open} onOpenChange={handleOpenChange}>\n <DialogContent\n ref={notifyMeDialogRef}\n aria-describedby=\"notify-me-content\"\n className={cn(\n 'laptop:max-w-[480px] laptop:[&_.dialog-close-icon]:size-6 laptop:gap-8 rounded-box laptop:p-8 max-h-[90vh] w-[calc(100%-32px)] gap-6 overflow-y-auto bg-white p-6 [&_.dialog-close-icon]:size-5',\n classNames?.root\n )}\n >\n {submitState !== 'success' && (\n <DialogHeader className={cn(classNames?.header)}>\n <DialogTitle>\n <Heading as=\"h2\" size={2} className={cn('text-info-primary text-center font-bold', classNames?.title)}>\n {title}\n </Heading>\n </DialogTitle>\n {subTitle && (\n <DialogDescription asChild>\n <Text\n as=\"p\"\n className={cn('text-info-primary laptop:text-base mt-1 text-center text-sm', classNames?.subTitle)}\n >\n {subTitle}\n </Text>\n </DialogDescription>\n )}\n </DialogHeader>\n )}\n\n {submitState === 'success' ? (\n <div className={cn('flex flex-col items-center text-center', classNames?.successText)}>\n {/* \u6210\u529F\u56FE\u6807 */}\n <div className=\"flex size-20 items-center justify-center\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"80\" height=\"80\" viewBox=\"0 0 80 80\" fill=\"none\">\n <circle cx=\"40\" cy=\"40\" r=\"35\" fill=\"#30D158\" />\n <path\n d=\"M23.3333 38.3333L36.6666 50L56.6666 30\"\n stroke=\"white\"\n strokeWidth=\"6.66667\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </div>\n <div className=\"mt-4\">\n {/* \u6807\u9898 */}\n <Heading as=\"h3\" size={2} className=\"text-info-primary font-bold\">\n {successTitle}\n </Heading>\n {/* \u526F\u6587\u6848 */}\n {successDesc && (\n <Text as=\"p\" className=\"text-info-primary laptop:text-base mt-1 text-sm\">\n {successDesc}\n </Text>\n )}\n </div>\n {/* \u786E\u8BA4\u6309\u94AE */}\n {successBtnText && (\n <Button\n variant=\"primary\"\n size=\"lg\"\n onClick={() => onOpenChange(false)}\n className=\"laptop:mt-8 mt-6 w-full\"\n >\n {successBtnText}\n </Button>\n )}\n </div>\n ) : (\n <div className=\"flex flex-col gap-4\">\n {/* \u90AE\u7BB1\u8F93\u5165\u6846 */}\n <div className={classNames?.emailInput}>\n <Text\n as=\"label\"\n htmlFor=\"notify-me-email\"\n className=\"text-info-primary laptop:text-base mb-2 block text-sm\"\n >\n {emailLabel}\n </Text>\n <Input\n id=\"notify-me-email\"\n type=\"email\"\n placeholder={emailPlaceholder}\n value={email}\n onChange={handleEmailChange}\n disabled={submitState === 'loading'}\n className={cn(\n 'placeholder:text-info-tertiary text-info-primary laptop:h-[54px] laptop:text-base laptop:p-4 border-lines-1 h-[44px] w-full bg-white p-3 text-sm font-bold placeholder:font-bold focus-visible:!outline-none',\n emailState !== 'idle' && 'border-error-0'\n )}\n />\n {emailState === 'error-empty' && (\n <Text as=\"p\" className=\"text-error-0 laptop:text-base mt-2 text-sm\">\n {errorEmpty}\n </Text>\n )}\n {emailState === 'error-format' && (\n <Text as=\"p\" className=\"text-error-0 laptop:text-base mt-2 text-sm\">\n {errorInvalidEmail}\n </Text>\n )}\n </div>\n\n {/* Checkboxes \u5217\u8868 */}\n {hasCheckboxes && (\n <div className={cn('laptop:gap-4 flex flex-col gap-2', classNames?.checkboxes)}>\n {checkboxes.map((cb, i) => {\n if (!cb.label) return null\n return (\n <div key={i}>\n <label\n className={cn(\n 'text-info-tertiary flex cursor-pointer items-start gap-2',\n classNames?.checkboxItem\n )}\n >\n <Checkbox\n checked={checkedStates[i]}\n onCheckedChange={() => updateCheckedState(i)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`''#''#${cb.label}`}\n data-headless-nav-position={`''#1`}\n disabled={submitState === 'loading'}\n className=\"border-info-secondary data-[state=checked]:bg-info-secondary mt-0.5 shrink-0\"\n />\n <Text\n as=\"span\"\n className=\"text-info-tertiary laptop:text-base [&_a]:text-brand-0 text-sm leading-snug [&_a]:underline\"\n html={cb.label}\n />\n </label>\n {checkboxErrors[i] && (\n <Text as=\"p\" className=\"text-error-0 laptop:text-base mt-2 text-sm\">\n {errorCheckboxRequired}\n </Text>\n )}\n </div>\n )\n })}\n </div>\n )}\n\n {/* \u63D0\u4EA4\u6309\u94AE */}\n <Button\n variant=\"primary\"\n size=\"lg\"\n loading={submitState === 'loading'}\n disabled={!canSubmit}\n onClick={handleSubmit}\n className={cn('w-full', classNames?.submitBtn)}\n >\n {submitBtnText}\n </Button>\n\n {/* \u63D0\u4EA4\u9519\u8BEF\uFF08\u5F39\u7A97\u6700\u5E95\u90E8\uFF09 */}\n {submitState === 'error-submit' && (\n <Text as=\"p\" className={cn('text-error-0 laptop:text-base text-sm', classNames?.errorText)}>\n {resolvedErrorMessage}\n </Text>\n )}\n </div>\n )}\n </DialogContent>\n </Dialog>\n )\n}\n\nNotifyMeDialog.displayName = 'NotifyMeDialog'\n\nexport default NotifyMeDialog\nexport type { NotifyMeDialogProps }\n"],
|
|
5
|
+
"mappings": "aAuOU,OAEI,OAAAA,EAFJ,QAAAC,MAAA,oBArOV,OAAS,eAAAC,EAAa,aAAAC,GAAW,YAAAC,MAAgB,QACjD,OACE,UAAAC,EACA,QAAAC,EACA,UAAAC,GACA,iBAAAC,GACA,gBAAAC,GACA,eAAAC,GACA,qBAAAC,GACA,SAAAC,GACA,YAAAC,GACA,WAAAC,MACK,4BACP,OAAS,MAAAC,MAAU,yBAEnB,UAAYC,OAAW,QACvB,OAAS,eAAAC,OAAmB,6BAE5B,MAAMC,EAAgB,OAChBC,EAAgB,iBAKhBC,GAAc,6BAEdC,EAAiB,CAAC,CACtB,KAAAC,EACA,aAAAC,EACA,KAAAC,EACA,WAAAC,EACA,WAAAC,EAAa,CAAC,EACd,iBAAAC,EACA,SAAAC,CACF,IAA2B,CACzB,KAAM,CACJ,MAAAC,EACA,SAAAC,EACA,WAAAC,EAAa,gBACb,iBAAAC,EAAmB,iBACnB,cAAAC,EAAgB,YAChB,WAAAC,EACA,kBAAAC,EACA,sBAAAC,EACA,YAAAC,EAAc,0CACd,kBAAAC,EACA,aAAAC,EACA,YAAAC,EACA,eAAAC,CACF,EAAIjB,EAEEkB,EAAoB1B,GAAM,OAAuB,IAAI,EAC3DC,GAAYyB,EAAmB,CAC7B,cAAAxB,EACA,cAAAC,EACA,eAAgBU,EAChB,qBAAsBC,CACxB,CAAC,EAED,KAAM,CAACa,EAAOC,CAAQ,EAAIxC,E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AE5C,SAAAQ,EACH,EAGCkB,IAAgB,gBACfnD,EAACM,EAAA,CAAK,GAAG,IAAI,UAAWS,EAAG,wCAAyCU,GAAY,SAAS,EACtF,SAAA8B,EACH,GAEJ,GAEJ,EACF,CAEJ,EAEAlC,EAAe,YAAc,iBAE7B,IAAOuD,GAAQvD",
|
|
6
|
+
"names": ["jsx", "jsxs", "useCallback", "useEffect", "useState", "Button", "Text", "Dialog", "DialogContent", "DialogHeader", "DialogTitle", "DialogDescription", "Input", "Checkbox", "Heading", "cn", "React", "useExposure", "componentType", "componentName", "EMAIL_REGEX", "NotifyMeDialog", "open", "onOpenChange", "copy", "classNames", "checkboxes", "subscriptionMeta", "onSubmit", "title", "subTitle", "emailLabel", "emailPlaceholder", "submitBtnText", "errorEmpty", "errorInvalidEmail", "errorCheckboxRequired", "errorSubmit", "errorSubmitDetail", "successTitle", "successDesc", "successBtnText", "notifyMeDialogRef", "email", "setEmail", "checkedStates", "setCheckedStates", "emailState", "setEmailState", "checkboxErrors", "setCheckboxErrors", "submitState", "setSubmitState", "errorCode", "setErrorCode", "resolvedErrorMessage", "d", "canSubmit", "updateCheckedState", "index", "prev", "next", "handleEmailChange", "handleSubmit", "hasError", "newCheckboxErrors", "cb", "i", "checkedItems", "item", "err", "code", "timer", "handleOpenChange", "isOpen", "hasCheckboxes", "NotifyMeDialog_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/NotifyMeDialog/index.tsx"],
|
|
4
|
+
"sourcesContent": ["export { default as NotifyMeDialog } from './NotifyMeDialog.js'\nexport type {\n NotifyMeDialogProps,\n NotifyMeDialogCopy,\n NotifyMeDialogSemanticName,\n CheckboxConfig,\n ErrorDetail,\n SubscribeFormData,\n SubscriptionMeta,\n} from './types.js'\n"],
|
|
5
|
+
"mappings": "AAAA,OAAoB,WAAXA,MAAiC",
|
|
6
|
+
"names": ["default"]
|
|
7
|
+
}
|