@anker-in/campaign-ui 0.3.4 → 0.4.0-beta.1
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/components/LiveChatWidget/LiveChatWidget.js +1 -1
- package/dist/cjs/components/LiveChatWidget/LiveChatWidget.js.map +3 -3
- package/dist/cjs/components/LiveChatWidget/components/MessageContent/PromotionList.js.map +2 -2
- package/dist/cjs/components/LiveChatWidget/components/MessageList.js +3 -3
- package/dist/cjs/components/LiveChatWidget/components/MessageList.js.map +3 -3
- package/dist/cjs/components/LiveChatWidget/hooks/useChatState.d.ts +2 -1
- package/dist/cjs/components/LiveChatWidget/hooks/useChatState.js +1 -1
- package/dist/cjs/components/LiveChatWidget/hooks/useChatState.js.map +2 -2
- package/dist/cjs/components/LiveChatWidget/types.d.ts +2 -1
- package/dist/cjs/components/LiveChatWidget/types.js.map +1 -1
- package/dist/cjs/components/credits/context/const.d.ts +10 -2
- package/dist/cjs/components/credits/context/const.js +1 -1
- package/dist/cjs/components/credits/context/const.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.d.ts +7 -0
- package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.d.ts +17 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.d.ts +7 -2
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +3 -3
- package/dist/cjs/components/credits/context/provider.d.ts +5 -1
- package/dist/cjs/components/credits/context/provider.js +1 -1
- package/dist/cjs/components/credits/context/provider.js.map +3 -3
- package/dist/cjs/components/credits/context/response.d.ts +1 -0
- package/dist/cjs/components/credits/context/response.js.map +1 -1
- package/dist/cjs/components/credits/context/utils/atobID.d.ts +1 -0
- package/dist/cjs/components/credits/context/utils/atobID.js +2 -0
- package/dist/cjs/components/credits/context/utils/atobID.js.map +7 -0
- package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.d.ts +5 -0
- package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js +2 -0
- package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js.map +7 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.d.ts +8 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js +2 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js.map +7 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +9 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +2 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +7 -0
- package/dist/cjs/components/credits/context/utils/variantGetCoupon.d.ts +6 -0
- package/dist/cjs/components/credits/context/utils/variantGetCoupon.js +2 -0
- package/dist/cjs/components/credits/context/utils/variantGetCoupon.js.map +7 -0
- package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
- package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +2 -2
- package/dist/cjs/components/credits/creditsBanner/index.js +2 -2
- package/dist/cjs/components/credits/creditsBanner/index.js.map +2 -2
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +2 -2
- package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.d.ts +5 -0
- package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.js +2 -0
- package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.js.map +7 -0
- package/dist/cjs/components/credits/creditsGoGift/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsGoGift/index.js +2 -0
- package/dist/cjs/components/credits/creditsGoGift/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsGoGift/type.d.ts +22 -0
- package/dist/cjs/components/credits/creditsGoGift/type.js +2 -0
- package/dist/cjs/components/credits/creditsGoGift/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsGofit/CreditsGofit.d.ts +5 -0
- package/dist/cjs/components/credits/creditsGofit/CreditsGofit.js +2 -0
- package/dist/cjs/components/credits/creditsGofit/CreditsGofit.js.map +7 -0
- package/dist/cjs/components/credits/creditsGofit/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsGofit/index.js +2 -0
- package/dist/cjs/components/credits/creditsGofit/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsGofit/type.d.ts +22 -0
- package/dist/cjs/components/credits/creditsGofit/type.js +2 -0
- package/dist/cjs/components/credits/creditsGofit/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
- package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
- package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.d.ts +10 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.d.ts +10 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +4 -5
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +2 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +2 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +1 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +3 -4
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +2 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +4 -5
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.d.ts +10 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.d.ts +9 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.d.ts +8 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +11 -0
- package/dist/cjs/components/credits/creditsRedeemList/type.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/type.js.map +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +2 -2
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +2 -2
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js.map +1 -1
- package/dist/cjs/components/credits/index.d.ts +2 -1
- package/dist/cjs/components/credits/index.js +1 -1
- package/dist/cjs/components/credits/index.js.map +3 -3
- package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +16 -0
- package/dist/cjs/components/credits/modal/MyRewardsModal.js +1 -1
- package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +3 -3
- package/dist/cjs/components/credits/modal/RewardsModal.d.ts +64 -0
- package/dist/cjs/components/credits/modal/RewardsModal.js +2 -0
- package/dist/cjs/components/credits/modal/RewardsModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/activitiesModal.d.ts +1 -1
- package/dist/cjs/components/credits/modal/activitiesModal.js +2 -2
- package/dist/cjs/components/credits/modal/activitiesModal.js.map +3 -3
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +2 -2
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +3 -3
- package/dist/cjs/components/credits/modal/loadingDots.js +1 -1
- package/dist/cjs/components/credits/modal/loadingDots.js.map +2 -2
- package/dist/cjs/components/credits/modal/modalContainer.js +2 -2
- package/dist/cjs/components/credits/modal/modalContainer.js.map +4 -4
- package/dist/cjs/components/credits/modal/rulesModal.d.ts +1 -1
- package/dist/cjs/components/credits/modal/rulesModal.js +2 -2
- package/dist/cjs/components/credits/modal/rulesModal.js.map +3 -3
- package/dist/cjs/components/credits/modal/subscribeModal.d.ts +1 -1
- package/dist/cjs/components/credits/modal/subscribeModal.js +2 -2
- package/dist/cjs/components/credits/modal/subscribeModal.js.map +3 -3
- package/dist/cjs/components/credits/modal/tip.js +1 -1
- package/dist/cjs/components/credits/modal/tip.js.map +2 -2
- package/dist/cjs/components/credits/type.d.ts +67 -5
- package/dist/cjs/components/credits/type.js +1 -1
- package/dist/cjs/components/credits/type.js.map +1 -1
- package/dist/cjs/stories/LiveChatWidget.stories.js +2 -9
- package/dist/cjs/stories/LiveChatWidget.stories.js.map +2 -2
- package/dist/cjs/templates/Credits.d.ts +1 -87
- package/dist/cjs/templates/Credits.js +1 -1
- package/dist/cjs/templates/Credits.js.map +3 -3
- package/dist/cjs/templates/Credits.types.d.ts +96 -0
- package/dist/cjs/templates/Credits.types.js +2 -0
- package/dist/cjs/templates/Credits.types.js.map +7 -0
- package/dist/esm/components/LiveChatWidget/LiveChatWidget.js +1 -1
- package/dist/esm/components/LiveChatWidget/LiveChatWidget.js.map +3 -3
- package/dist/esm/components/LiveChatWidget/components/MessageContent/PromotionList.js.map +2 -2
- package/dist/esm/components/LiveChatWidget/components/MessageList.js +3 -3
- package/dist/esm/components/LiveChatWidget/components/MessageList.js.map +3 -3
- package/dist/esm/components/LiveChatWidget/hooks/useChatState.d.ts +2 -1
- package/dist/esm/components/LiveChatWidget/hooks/useChatState.js +1 -1
- package/dist/esm/components/LiveChatWidget/hooks/useChatState.js.map +2 -2
- package/dist/esm/components/LiveChatWidget/types.d.ts +2 -1
- package/dist/esm/components/credits/context/const.d.ts +10 -2
- package/dist/esm/components/credits/context/const.js +1 -1
- package/dist/esm/components/credits/context/const.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.d.ts +7 -0
- package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js +2 -0
- package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemGoGift.d.ts +17 -0
- package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemableList.d.ts +7 -2
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +3 -3
- package/dist/esm/components/credits/context/provider.d.ts +5 -1
- package/dist/esm/components/credits/context/provider.js +1 -1
- package/dist/esm/components/credits/context/provider.js.map +3 -3
- package/dist/esm/components/credits/context/response.d.ts +1 -0
- package/dist/esm/components/credits/context/utils/atobID.d.ts +1 -0
- package/dist/esm/components/credits/context/utils/atobID.js +2 -0
- package/dist/esm/components/credits/context/utils/atobID.js.map +7 -0
- package/dist/esm/components/credits/context/utils/functionDiscountCalculate.d.ts +5 -0
- package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js +2 -0
- package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js.map +7 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.d.ts +8 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js +2 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js.map +7 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +9 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +2 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +7 -0
- package/dist/esm/components/credits/context/utils/variantGetCoupon.d.ts +6 -0
- package/dist/esm/components/credits/context/utils/variantGetCoupon.js +2 -0
- package/dist/esm/components/credits/context/utils/variantGetCoupon.js.map +7 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
- package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +1 -1
- package/dist/esm/components/credits/creditsBanner/index.js +2 -2
- package/dist/esm/components/credits/creditsBanner/index.js.map +2 -2
- package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +1 -1
- package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.d.ts +5 -0
- package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.js +2 -0
- package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.js.map +7 -0
- package/dist/esm/components/credits/creditsGoGift/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsGoGift/index.js +2 -0
- package/dist/esm/components/credits/creditsGoGift/index.js.map +7 -0
- package/dist/esm/components/credits/creditsGoGift/type.d.ts +22 -0
- package/dist/esm/components/credits/creditsGoGift/type.js +1 -0
- package/dist/esm/components/credits/creditsGoGift/type.js.map +7 -0
- package/dist/esm/components/credits/creditsGofit/CreditsGofit.d.ts +5 -0
- package/dist/esm/components/credits/creditsGofit/CreditsGofit.js +2 -0
- package/dist/esm/components/credits/creditsGofit/CreditsGofit.js.map +7 -0
- package/dist/esm/components/credits/creditsGofit/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsGofit/index.js +2 -0
- package/dist/esm/components/credits/creditsGofit/index.js.map +7 -0
- package/dist/esm/components/credits/creditsGofit/type.d.ts +22 -0
- package/dist/esm/components/credits/creditsGofit/type.js +1 -0
- package/dist/esm/components/credits/creditsGofit/type.js.map +7 -0
- package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
- package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
- package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
- package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +1 -1
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.d.ts +10 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.d.ts +10 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +4 -5
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +2 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +2 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +1 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +3 -4
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +2 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +4 -5
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.d.ts +10 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.d.ts +9 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.d.ts +8 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/type.d.ts +11 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +2 -2
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +1 -1
- package/dist/esm/components/credits/index.d.ts +2 -1
- package/dist/esm/components/credits/index.js +1 -1
- package/dist/esm/components/credits/index.js.map +3 -3
- package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +16 -0
- package/dist/esm/components/credits/modal/MyRewardsModal.js +1 -1
- package/dist/esm/components/credits/modal/MyRewardsModal.js.map +3 -3
- package/dist/esm/components/credits/modal/RewardsModal.d.ts +64 -0
- package/dist/esm/components/credits/modal/RewardsModal.js +2 -0
- package/dist/esm/components/credits/modal/RewardsModal.js.map +7 -0
- package/dist/esm/components/credits/modal/activitiesModal.d.ts +1 -1
- package/dist/esm/components/credits/modal/activitiesModal.js +2 -2
- package/dist/esm/components/credits/modal/activitiesModal.js.map +3 -3
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +2 -2
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +2 -2
- package/dist/esm/components/credits/modal/loadingDots.js +1 -1
- package/dist/esm/components/credits/modal/loadingDots.js.map +2 -2
- package/dist/esm/components/credits/modal/modalContainer.js +2 -2
- package/dist/esm/components/credits/modal/modalContainer.js.map +3 -3
- package/dist/esm/components/credits/modal/rulesModal.d.ts +1 -1
- package/dist/esm/components/credits/modal/rulesModal.js +2 -2
- package/dist/esm/components/credits/modal/rulesModal.js.map +3 -3
- package/dist/esm/components/credits/modal/subscribeModal.d.ts +1 -1
- package/dist/esm/components/credits/modal/subscribeModal.js +2 -2
- package/dist/esm/components/credits/modal/subscribeModal.js.map +2 -2
- package/dist/esm/components/credits/modal/tip.js +1 -1
- package/dist/esm/components/credits/modal/tip.js.map +2 -2
- package/dist/esm/components/credits/type.d.ts +67 -5
- package/dist/esm/stories/LiveChatWidget.stories.js +1 -8
- package/dist/esm/stories/LiveChatWidget.stories.js.map +2 -2
- package/dist/esm/templates/Credits.d.ts +1 -87
- package/dist/esm/templates/Credits.js +1 -1
- package/dist/esm/templates/Credits.js.map +3 -3
- package/dist/esm/templates/Credits.types.d.ts +96 -0
- package/dist/esm/templates/Credits.types.js +2 -0
- package/dist/esm/templates/Credits.types.js.map +7 -0
- package/package.json +2 -2
- package/src/components/LiveChatWidget/LiveChatWidget.tsx +20 -0
- package/src/components/LiveChatWidget/components/MessageContent/PromotionList.tsx +1 -1
- package/src/components/LiveChatWidget/components/MessageList.tsx +39 -44
- package/src/components/LiveChatWidget/hooks/useChatState.ts +4 -3
- package/src/components/LiveChatWidget/types.ts +2 -1
- package/src/components/credits/context/const.ts +8 -0
- package/src/components/credits/context/hooks/useMyRewards.ts +7 -31
- package/src/components/credits/context/hooks/useRedeemGoGift.ts +36 -0
- package/src/components/credits/context/hooks/useRedeemableList.ts +13 -19
- package/src/components/credits/context/provider.tsx +17 -2
- package/src/components/credits/context/response.ts +1 -0
- package/src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx +2 -2
- package/src/components/credits/creditsBanner/index.tsx +5 -5
- package/src/components/credits/creditsCash/CreditsCash.tsx +1 -1
- package/src/components/credits/creditsGoGift/CreditsGoGift.tsx +210 -0
- package/src/components/credits/creditsGoGift/index.ts +2 -0
- package/src/components/credits/creditsGoGift/type.ts +23 -0
- package/src/components/credits/creditsInfoCard/index.tsx +5 -28
- package/src/components/credits/creditsMemberPrice/CreditsMemberPrice.tsx +1 -1
- package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +39 -17
- package/src/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.tsx +77 -0
- package/src/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.tsx +86 -0
- package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +29 -138
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +5 -6
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +11 -12
- package/src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx +23 -14
- package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +11 -9
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +4 -5
- package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +29 -28
- package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.tsx +101 -0
- package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.tsx +65 -0
- package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal.tsx +156 -0
- package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +1 -1
- package/src/components/credits/creditsRedeemList/type.ts +11 -0
- package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +2 -2
- package/src/components/credits/creditsWaysToGetCredits/type.ts +2 -2
- package/src/components/credits/index.ts +2 -1
- package/src/components/credits/modal/{activitiesModal.tsx → ActivitiesModal.tsx} +2 -2
- package/src/components/credits/modal/{creditsUploadReceiptModal.tsx → CreditsUploadReceiptModal.tsx} +1 -1
- package/src/components/credits/modal/{modalContainer.tsx → ModalContainer.tsx} +1 -1
- package/src/components/credits/modal/{MyRewardsModal.tsx → RewardsModal.tsx} +145 -103
- package/src/components/credits/modal/{rulesModal.tsx → RulesModal.tsx} +1 -1
- package/src/components/credits/modal/{subscribeModal.tsx → SubscribeModal.tsx} +1 -1
- package/src/components/credits/type.ts +68 -5
- package/src/stories/LiveChatWidget.stories.tsx +7 -12
- package/src/styles/livechat.css +29 -0
- package/src/templates/Credits.tsx +110 -142
- package/src/templates/Credits.types.ts +110 -0
- package/dist/index.d.mts +0 -1305
- package/dist/index.d.ts +0 -1305
- package/dist/index.js +0 -26656
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -26641
- package/dist/index.mjs.map +0 -1
- /package/src/components/credits/modal/{loadingDots.tsx → LoadingDots.tsx} +0 -0
- /package/src/components/credits/modal/{tip.tsx → Tip.tsx} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import classNames from 'classnames'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport { useCreditsContext } from '../../context/provider'\nimport useCountries from '../../context/hooks/useCountries'\nimport { AlpcErrorCode } from '../../context/const'\nimport { useAddressValidate } from '../../context/hooks/useAddressValidate'\nimport { useRedeemProduct } from '../../context/hooks/useRedeemProduct'\nimport type { ModalContainerProps } from '../../modal/
|
|
5
|
-
"mappings": "AAsJI,
|
|
6
|
-
"names": ["jsx", "jsxs", "classNames", "useCallback", "useEffect", "useMemo", "useState", "useCreditsContext", "useCountries", "AlpcErrorCode", "useAddressValidate", "useRedeemProduct", "CreditsModalContainer", "useHeadlessContext", "Error", "Success", "Address", "Init", "RedeemProductModal", "item", "copy", "onError", "props", "fetchCreditInfo", "profile", "
|
|
4
|
+
"sourcesContent": ["import classNames from 'classnames'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\nimport { useCreditsContext } from '../../context/provider'\nimport useCountries from '../../context/hooks/useCountries'\nimport { AlpcErrorCode } from '../../context/const'\nimport { useAddressValidate } from '../../context/hooks/useAddressValidate'\nimport { useRedeemProduct } from '../../context/hooks/useRedeemProduct'\nimport type { ModalContainerProps } from '../../modal/ModalContainer'\nimport { CreditsModalContainer } from '../../modal/ModalContainer'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { Error } from './Error'\nimport { Success } from './Success'\nimport { Address } from './Address'\nimport { Init } from './Init'\n\ntype RedeemProductModalProps = Omit<ModalContainerProps, 'isOpen'> & {\n item: RedeemableItemType\n copy: RedeemModalCommon\n onError: (code: AlpcErrorCode) => void\n}\n\nfunction RedeemProductModal({ item, copy, onError, ...props }: RedeemProductModalProps) {\n const { fetchCreditInfo, profile, pageCommon } = useCreditsContext()\n const { storeDomain } = useHeadlessContext()\n\n const { shippingAddress, shippingProduct } = copy.product\n\n const [status, setStatus] = useState<'init' | 'address' | 'success' | 'error'>('init')\n const [address, setAddress] = useState<any>()\n const [errorInfo, setErrorInfo] = useState({\n code: 0,\n message: '',\n imageUrl: '',\n })\n const [disabled, setDisabled] = useState(false)\n\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n const { isMutating: loading, trigger } = useRedeemProduct({\n onSuccess(responseData) {\n if (!responseData) {\n setStatus('error')\n setErrorInfo({\n code: 0,\n imageUrl: copy.errorImageUrl || '',\n message: copy.commonError || '',\n })\n return\n }\n\n if (responseData?.code === 0) {\n fetchCreditInfo(profile?.user_id)\n setStatus('success')\n } else {\n let errorMsg\n let errorImage\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.inventoryNotEnough\n setDisabled(true)\n errorImage = copy.inventoryNotEnough\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.crossSiteError\n setDisabled(true)\n }\n\n setStatus('error')\n setErrorInfo({\n code: responseData.code,\n imageUrl: errorImage || copy.errorImageUrl || '',\n message: errorMsg || copy.commonError || '',\n })\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setStatus('error')\n setErrorInfo({\n code: 0,\n imageUrl: copy.errorImageUrl || '',\n message: copy.commonError || '',\n })\n },\n })\n\n const stateInputKey = useMemo(() => {\n const stateInput = copy?.product.form?.flat().find(item => item.type === 'state')\n return stateInput?.key\n }, [copy?.product.form])\n\n const { validate: validateAddress, errors: validateErrors } = useAddressValidate({\n address: address,\n validatorInfo: pageCommon?.validatorInfo,\n formData: copy?.product.form?.flat() || [],\n errorLabel: {\n require: copy.product.required,\n email: copy.product.invalidEmail,\n },\n })\n\n const handlePayment = useCallback(async () => {\n const ignoreKeys: string[] = []\n\n if (stateInputKey) {\n const provinces = countries.find(item => item.code === address.country)?.provinces || []\n\n if (!provinces.length) {\n ignoreKeys.push(stateInputKey as never)\n }\n }\n\n if (\n validateAddress({\n force: true,\n ignoreKeys,\n })\n ) {\n // \u5730\u5740\u6821\u9A8C\u9519\u8BEF\n return\n }\n let requestAddress = { ...address }\n if (requestAddress.name) {\n delete requestAddress.name\n }\n if (requestAddress.country === 'UK') {\n requestAddress.country = 'GB'\n }\n trigger({\n address: btoa(JSON.stringify(requestAddress)),\n rule_id: Number(item.alpc?.id),\n })\n }, [item, trigger, stateInputKey, validateAddress, address, countries])\n\n useEffect(() => {\n return () => {\n setDisabled(false)\n setErrorInfo({ code: 0, message: '', imageUrl: '' })\n setStatus('init')\n setAddress(undefined)\n }\n }, [])\n\n return (\n <CreditsModalContainer\n {...props}\n isOpen={!!item}\n className={classNames(\n 'w-[540px] md:h-auto min-md:max-h-[calc(100vh-40px)]',\n status !== 'init' && 'w-[740px] md:w-full'\n )}\n scrollClassName=\"mb-0 min-l:px-0 md:mb-0 px-0\"\n titleClassName={classNames('h-[56px]', status === 'init' && 'bg-[#F5F5F7]')}\n title={status === 'address' ? 'Order Confirmation' : ''}\n >\n {status === 'error' && <Error errorInfo={errorInfo} />}\n {status === 'success' && (\n <Success\n copy={copy}\n shippingProduct={shippingProduct}\n loading={loading}\n address={address}\n disabled={disabled}\n onClose={props.onClose}\n item={item}\n />\n )}\n {status === 'address' && (\n <Address\n copy={copy}\n shippingAddress={shippingAddress}\n setAddress={setAddress}\n validateAddress={validateAddress}\n validateErrors={validateErrors}\n shippingProduct={shippingProduct}\n loading={loading}\n address={address}\n disabled={disabled}\n handlePayment={handlePayment}\n item={item}\n />\n )}\n {status === 'init' && (\n <Init item={item} copy={copy} loading={loading} disabled={disabled} setStatus={setStatus} />\n )}\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemProductModal\n"],
|
|
5
|
+
"mappings": "AAsJI,OAWyB,OAAAA,EAXzB,QAAAC,MAAA,oBAtJJ,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,aAAAC,EAAW,WAAAC,EAAS,YAAAC,MAAgB,QAC1D,OAAS,qBAAAC,MAAyB,yBAClC,OAAOC,MAAkB,mCACzB,OAAS,iBAAAC,MAAqB,sBAC9B,OAAS,sBAAAC,MAA0B,yCACnC,OAAS,oBAAAC,MAAwB,uCAEjC,OAAS,yBAAAC,MAA6B,6BAEtC,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,SAAAC,MAAa,UACtB,OAAS,WAAAC,MAAe,YACxB,OAAS,WAAAC,MAAe,YACxB,OAAS,QAAAC,MAAY,SAQrB,SAASC,EAAmB,CAAE,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAS,GAAGC,CAAM,EAA4B,CACtF,KAAM,CAAE,gBAAAC,EAAiB,QAAAC,EAAS,WAAAC,CAAW,EAAIlB,EAAkB,EAC7D,CAAE,YAAAmB,CAAY,EAAIb,EAAmB,EAErC,CAAE,gBAAAc,EAAiB,gBAAAC,CAAgB,EAAIR,EAAK,QAE5C,CAACS,EAAQC,CAAS,EAAIxB,EAAmD,MAAM,EAC/E,CAACyB,EAASC,CAAU,EAAI1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AY,qBAAuB,GAEpD,UAAAA,IAAW,SAAW7B,EAACc,EAAA,CAAM,UAAWmB,EAAW,EACnDJ,IAAW,WACV7B,EAACe,EAAA,CACC,KAAMK,EACN,gBAAiBQ,EACjB,QAASW,EACT,QAASR,EACT,SAAUI,EACV,QAASb,EAAM,QACf,KAAMH,EACR,EAEDU,IAAW,WACV7B,EAACgB,EAAA,CACC,KAAMI,EACN,gBAAiBO,EACjB,WAAYK,EACZ,gBAAiBc,EACjB,eAAgBC,EAChB,gBAAiBnB,EACjB,QAASW,EACT,QAASR,EACT,SAAUI,EACV,cAAea,EACf,KAAM7B,EACR,EAEDU,IAAW,QACV7B,EAACiB,EAAA,CAAK,KAAME,EAAM,KAAMC,EAAM,QAASmB,EAAS,SAAUJ,EAAU,UAAWL,EAAW,GAE9F,CAEJ,CAEA,IAAOqB,GAAQjC",
|
|
6
|
+
"names": ["jsx", "jsxs", "classNames", "useCallback", "useEffect", "useMemo", "useState", "useCreditsContext", "useCountries", "AlpcErrorCode", "useAddressValidate", "useRedeemProduct", "CreditsModalContainer", "useHeadlessContext", "Error", "Success", "Address", "Init", "RedeemProductModal", "item", "copy", "onError", "props", "fetchCreditInfo", "profile", "pageCommon", "storeDomain", "shippingAddress", "shippingProduct", "status", "setStatus", "address", "setAddress", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "countries", "countriesLoading", "loading", "trigger", "responseData", "errorMsg", "errorImage", "error", "stateInputKey", "validateAddress", "validateErrors", "handlePayment", "ignoreKeys", "requestAddress", "RedeemProductModal_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type';
|
|
2
|
+
type VirtualProductInitProps = {
|
|
3
|
+
item: RedeemableItemType;
|
|
4
|
+
copy: RedeemModalCommon;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
onConfirm: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const VirtualProductInit: ({ item, copy, loading, disabled, onConfirm }: VirtualProductInitProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as b,jsx as t,jsxs as e}from"react/jsx-runtime";import{Button as c,Picture as d,Text as p}from"@anker-in/headless-ui";import s from"classnames";import{Fragment as u}from"react";import{numberFormat as f}from"../../context/utils";import{NoneProductValue as v}from"../RedeemProductModal/NonProductValue";import{useCreditsContext as g}from"../../context/provider";const F=({item:l,copy:m,loading:x,disabled:r,onConfirm:n})=>{const{pageCommon:a}=g();return e(b,{children:[e("div",{className:s("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:[e("div",{className:"relative mx-auto h-[164px] w-[324px]",children:[a?.imageMapping?.[l.config?.type]?.url&&t(d,{source:a.imageMapping[l.config.type].url,className:"h-full [&_img]:h-full"}),t("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:l.config.value?t(v,{item:l}):t(p,{size:3,html:l.alpc?.title})})]}),e(p,{as:"p",className:s("mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]"),children:[f(l.alpc?.consumeCredits)," ",a?.pointUnit]}),m?.virtualProduct?.steps&&m.virtualProduct.steps.length>0&&e("div",{className:"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]",children:[t("div",{className:"text-[16px] font-bold leading-[1.4]",children:m.virtualProduct.stepTitle}),t("div",{className:"mt-[4px] flex items-center justify-center",children:m.virtualProduct.steps.map((i,o)=>e(u,{children:[e("div",{className:"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]",children:[t(d,{source:i.imageUrl,className:"mb-[4px] h-[58px] w-[58px]"}),t("div",{className:"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]",children:i.title})]}),o!==m.virtualProduct.steps.length-1&&t(d,{source:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150",className:"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]"})]},o))})]}),l.config?.rules?.length>0&&e("div",{className:"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]",children:[e("div",{className:"mb-[4px]",children:[a?.ruleLabel,":"]}),t("ul",{className:"ml-4 grid grid-flow-row gap-[4px]",children:l.config?.rules?.map((i,o)=>t("li",{className:"list-disc",children:t(p,{html:i})},o))})]})]}),e("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:[t(p,{className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:m.confirmTitle}),t(c,{loading:x,variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:n,disabled:r,children:m.confirmButton})]})]})};export{F as VirtualProductInit};
|
|
2
|
+
//# sourceMappingURL=VirtualProductInit.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { Fragment } from 'react'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../../type'\nimport { NoneProductValue } from '../RedeemProductModal/NonProductValue'\nimport { useCreditsContext } from '../../context/provider'\n\ntype VirtualProductInitProps = {\n item: RedeemableItemType\n copy: RedeemModalCommon\n loading: boolean\n disabled: boolean\n onConfirm: () => void\n}\n\nexport const VirtualProductInit = ({ item, copy, loading, disabled, onConfirm }: VirtualProductInitProps) => {\n const { pageCommon } = useCreditsContext()\n\n return (\n <>\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {pageCommon?.imageMapping?.[item.config?.type]?.url && (\n <Picture source={pageCommon.imageMapping[item.config.type].url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <NoneProductValue item={item} />\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n <Text\n as=\"p\"\n className={classNames(\n 'mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}\n </Text>\n {copy?.virtualProduct?.steps && copy.virtualProduct.steps.length > 0 && (\n <div className=\"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{copy.virtualProduct.stepTitle}</div>\n <div className=\"mt-[4px] flex items-center justify-center\">\n {copy.virtualProduct.steps.map((step, index) => (\n <Fragment key={index}>\n <div className=\"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]\">\n <Picture source={step.imageUrl} className=\"mb-[4px] h-[58px] w-[58px]\"></Picture>\n <div className=\"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]\">\n {step.title}\n </div>\n </div>\n {index !== copy.virtualProduct.steps!.length - 1 && (\n <Picture\n source=\"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/step-arrow.png?v=1690458150\"\n className=\"mb-[20px] h-[10px] w-[20px] md:mb-[30px] md:h-[5px] md:w-[12px]\"\n ></Picture>\n )}\n </Fragment>\n ))}\n </div>\n </div>\n )}\n {item.config?.rules?.length > 0 && (\n <div className=\"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]\">\n <div className=\"mb-[4px]\">{pageCommon?.ruleLabel}:</div>\n <ul className=\"ml-4 grid grid-flow-row gap-[4px]\">\n {item.config?.rules?.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text html={text} />\n </li>\n ))}\n </ul>\n </div>\n )}\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n <Text\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={onConfirm}\n disabled={disabled}\n >\n {copy.confirmButton}\n </Button>\n </div>\n </>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAoBI,mBAAAA,EAQQ,OAAAC,EAFJ,QAAAC,MANJ,oBApBJ,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,YAAAN,MAAgB,QACzB,OAAS,gBAAAO,MAAoB,sBAE7B,OAAS,oBAAAC,MAAwB,wCACjC,OAAS,qBAAAC,MAAyB,yBAU3B,MAAMC,EAAqB,CAAC,CAAE,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAS,SAAAC,EAAU,UAAAC,CAAU,IAA+B,CAC3G,KAAM,CAAE,WAAAC,CAAW,EAAIP,EAAkB,EAEzC,OACEP,EAAAF,EAAA,CACE,UAAAE,EAAC,OACC,UAAWI,EACT,8FACF,EAEA,UAAAJ,EAAC,OAAI,UAAU,uCACZ,UAAAc,GAAY,eAAeL,EAAK,QAAQ,IAAI,GAAG,KAC9CV,EAACG,EAAA,CAAQ,OAAQY,EAAW,aAAaL,EAAK,OAAO,IAAI,EAAE,IAAK,UAAU,wBAAwB,EAEpGV,EAAC,OAAI,UAAU,8DACZ,SAAAU,EAAK,OAAO,MACXV,EAACO,EAAA,CAAiB,KAAMG,EAAM,EAE9BV,EAACI,EAAA,CAAK,KAAM,EAAG,KAAMM,EAAK,MAAM,MAAO,EAE3C,GACF,EACAT,EAACG,EAAA,CACC,GAAG,IACH,UAAWC,EACT,wGACF,EAEC,UAAAC,EAAaI,EAAK,MAAM,cAAc,EAAE,IAAEK,GAAY,WACzD,EACCJ,GAAM,gBAAgB,OAASA,EAAK,eAAe,MAAM,OAAS,GACjEV,EAAC,OAAI,UAAU,sEACb,UAAAD,EAAC,OAAI,UAAU,sCAAuC,SAAAW,EAAK,eAAe,UAAU,EACpFX,EAAC,OAAI,UAAU,4CACZ,SAAAW,EAAK,eAAe,MAAM,IAAI,CAACK,EAAMC,IACpChB,EAACF,EAAA,CACC,UAAAE,EAAC,OAAI,UAAU,8EACb,UAAAD,EAACG,EAAA,CAAQ,OAAQa,EAAK,SAAU,UAAU,6BAA6B,EACvEhB,EAAC,OAAI,UAAU,gFACZ,SAAAgB,EAAK,MACR,GACF,EACCC,IAAUN,EAAK,eAAe,MAAO,OAAS,GAC7CX,EAACG,EAAA,CACC,OAAO,qFACP,UAAU,kEACX,IAXUc,CAaf,CACD,EACH,GACF,EAEDP,EAAK,QAAQ,OAAO,OAAS,GAC5BT,EAAC,OAAI,UAAU,kGACb,UAAAA,EAAC,OAAI,UAAU,WAAY,UAAAc,GAAY,UAAU,KAAC,EAClDf,EAAC,MAAG,UAAU,oCACX,SAAAU,EAAK,QAAQ,OAAO,IAAI,CAACQ,EAAMD,IAC9BjB,EAAC,MAAG,UAAU,YACZ,SAAAA,EAACI,EAAA,CAAK,KAAMc,EAAM,GADWD,CAE/B,CACD,EACH,GACF,GAEJ,EACAhB,EAAC,OAAI,UAAU,wDACb,UAAAD,EAACI,EAAA,CACC,UAAU,4EACV,KAAMO,EAAK,aACZ,EACDX,EAACE,EAAA,CACC,QAASU,EACT,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAASE,EACT,SAAUD,EAET,SAAAF,EAAK,cACR,GACF,GACF,CAEJ",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "numberFormat", "NoneProductValue", "useCreditsContext", "VirtualProductInit", "item", "copy", "loading", "disabled", "onConfirm", "pageCommon", "step", "index", "text"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RedeemModalCommon, RedeemableItem as RedeemableItemType } from '../../type';
|
|
2
|
+
type VirtualProductSuccessProps = {
|
|
3
|
+
item: RedeemableItemType;
|
|
4
|
+
copy: RedeemModalCommon;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const VirtualProductSuccess: ({ item, copy, disabled, onClose }: VirtualProductSuccessProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as f,jsx as e,jsxs as l}from"react/jsx-runtime";import{Button as c,Picture as r,Text as a}from"@anker-in/headless-ui";import d from"classnames";import{useHeadlessContext as u}from"@anker-in/lib";import{NoneProductValue as x}from"../RedeemProductModal/NonProductValue";import{useCreditsContext as n}from"../../context/provider";const P=({item:t,copy:o,disabled:m,onClose:i})=>{const{locale:p}=u(),{pageCommon:s}=n();return l(f,{children:[e("div",{className:d("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:l("div",{className:"relative mx-auto h-[164px] w-[324px]",children:[s?.imageMapping?.[t.config?.type]?.url&&e(r,{source:s.imageMapping[t.config.type].url,className:"h-full [&_img]:h-full"}),e("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value?e(x,{item:t}):e(a,{size:3,html:t.alpc?.title})})]})}),l("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:[l("div",{className:"flex flex-col",children:[e(a,{className:"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]",html:o.virtualProduct.successTitle}),e(a,{className:"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]",html:o.virtualProduct.successDesc})]}),e(c,{variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:()=>{window.location.href=o.virtualProduct.successButtonUrl||`/${p}`,i()},disabled:m,children:o.virtualProduct.successButton})]})]})};export{P as VirtualProductSuccess};
|
|
2
|
+
//# sourceMappingURL=VirtualProductSuccess.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport type { RedeemModalCommon, RedeemableItem as RedeemableItemType } from '../../type'\nimport { NoneProductValue } from '../RedeemProductModal/NonProductValue'\nimport { useCreditsContext } from '../../context/provider'\n\ntype VirtualProductSuccessProps = {\n item: RedeemableItemType\n copy: RedeemModalCommon\n disabled: boolean\n onClose: () => void\n}\n\nexport const VirtualProductSuccess = ({ item, copy, disabled, onClose }: VirtualProductSuccessProps) => {\n const { locale } = useHeadlessContext()\n const { pageCommon } = useCreditsContext()\n\n return (\n <>\n <div\n className={classNames(\n 'max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]'\n )}\n >\n <div className=\"relative mx-auto h-[164px] w-[324px]\">\n {pageCommon?.imageMapping?.[item.config?.type]?.url && (\n <Picture source={pageCommon.imageMapping[item.config.type].url} className=\"h-full [&_img]:h-full\" />\n )}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value ? (\n <NoneProductValue item={item} />\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n </div>\n <div className=\"bg-white px-[48px] pt-[24px] text-center md:px-[16px]\">\n <div className=\"flex flex-col\">\n <Text\n className=\"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]\"\n html={copy.virtualProduct.successTitle}\n ></Text>\n <Text\n className=\"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]\"\n html={copy.virtualProduct.successDesc}\n ></Text>\n </div>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={() => {\n window.location.href = copy.virtualProduct.successButtonUrl || `/${locale}`\n onClose()\n }}\n disabled={disabled}\n >\n {copy.virtualProduct.successButton}\n </Button>\n </div>\n </>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAmBI,mBAAAA,EAQQ,OAAAC,EAFJ,QAAAC,MANJ,oBAnBJ,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,sBAAAC,MAA0B,gBAEnC,OAAS,oBAAAC,MAAwB,wCACjC,OAAS,qBAAAC,MAAyB,yBAS3B,MAAMC,EAAwB,CAAC,CAAE,KAAAC,EAAM,KAAAC,EAAM,SAAAC,EAAU,QAAAC,CAAQ,IAAkC,CACtG,KAAM,CAAE,OAAAC,CAAO,EAAIR,EAAmB,EAChC,CAAE,WAAAS,CAAW,EAAIP,EAAkB,EAEzC,OACEP,EAAAF,EAAA,CACE,UAAAC,EAAC,OACC,UAAWK,EACT,8FACF,EAEA,SAAAJ,EAAC,OAAI,UAAU,uCACZ,UAAAc,GAAY,eAAeL,EAAK,QAAQ,IAAI,GAAG,KAC9CV,EAACG,EAAA,CAAQ,OAAQY,EAAW,aAAaL,EAAK,OAAO,IAAI,EAAE,IAAK,UAAU,wBAAwB,EAEpGV,EAAC,OAAI,UAAU,8DACZ,SAAAU,EAAK,OAAO,MACXV,EAACO,EAAA,CAAiB,KAAMG,EAAM,EAE9BV,EAACI,EAAA,CAAK,KAAM,EAAG,KAAMM,EAAK,MAAM,MAAO,EAE3C,GACF,EACF,EACAT,EAAC,OAAI,UAAU,wDACb,UAAAA,EAAC,OAAI,UAAU,gBACb,UAAAD,EAACI,EAAA,CACC,UAAU,8DACV,KAAMO,EAAK,eAAe,aAC3B,EACDX,EAACI,EAAA,CACC,UAAU,oEACV,KAAMO,EAAK,eAAe,YAC3B,GACH,EACAX,EAACE,EAAA,CACC,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAAS,IAAM,CACb,OAAO,SAAS,KAAOS,EAAK,eAAe,kBAAoB,IAAIG,CAAM,GACzED,EAAQ,CACV,EACA,SAAUD,EAET,SAAAD,EAAK,eAAe,cACvB,GACF,GACF,CAEJ",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useHeadlessContext", "NoneProductValue", "useCreditsContext", "VirtualProductSuccess", "item", "copy", "disabled", "onClose", "locale", "pageCommon"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ModalContainerProps } from '../modal/ModalContainer';
|
|
2
|
+
import type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../type';
|
|
3
|
+
declare function RedeemVirtualProductModal({ item, copy, onError, ...props }: Omit<ModalContainerProps, 'isOpen'> & {
|
|
4
|
+
item: RedeemableItemType;
|
|
5
|
+
copy: RedeemModalCommon;
|
|
6
|
+
onError: (code: number) => void;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default RedeemVirtualProductModal;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as m,jsxs as V}from"react/jsx-runtime";import{Text as S}from"@anker-in/headless-ui";import{useCallback as P,useEffect as v,useState as f}from"react";import{useCreditsContext as L}from"../context/provider";import{useRedeemGoGift as _}from"../context/hooks/useRedeemGoGift";import{useRedeemProduct as F}from"../context/hooks/useRedeemProduct";import{AlpcErrorCode as n,ConsumeType as G}from"../context/const";import{CreditsModalContainer as O}from"../modal/ModalContainer";import{VirtualProductInit as T}from"./RedeemVirtualProductModal/VirtualProductInit";import{VirtualProductSuccess as w}from"./RedeemVirtualProductModal/VirtualProductSuccess";function A({item:o,copy:r,onError:c,...p}){const[R,a]=f(),[C,i]=f(),[g,d]=f(!1),{profile:t,fetchCreditInfo:l}=L(),u=o.config?.type===G.GoGift,x=o.config?.type===G.GiftCard,{isMutating:M,trigger:b}=_({onSuccess(e){if(!e){i(r?.commonError);return}e?.data?.id?(a(e.data.id),l(t?.user_id)):h(e.code)},onError(e){i(e.message||r?.commonError)}}),{isMutating:y,trigger:E}=F({onSuccess(e){if(!e){i(r?.commonError);return}e?.code===0?(a("success"),l(t?.user_id)):h(e.code)},onError(){i(r?.commonError)}}),N=u?M:y,h=e=>{let s;e===n.CodeLpcShopifyCouponRuleRedeemLimit?(s=r?.redeemLimitError,d(!0)):e===n.CodeLpcRuleInventoryNotEnough?(s=r?.inventoryNotEnough,d(!0)):e===n.CodeLpcNotEnoughCredits?(s=r?.creditsNotEnough,d(!0),l(t?.user_id)):e===n.CodeCrossSiteError&&(s=r?.crossSiteError,d(!0)),i(s||r?.commonError||""),c&&c(e)},I=P(async()=>{if(i(""),u)b({user_id:t?.user_id,rule_id:Number(o.alpc?.id)});else if(x){const e={email:t?.email||"",firstName:t?.firstName||"",lastName:t?.lastName||"",address1:"Default Address",city:"Default City",province:"Default Province",country:"US",zip:"00000"};E({address:btoa(JSON.stringify(e)),rule_id:Number(o.alpc?.id)})}},[o,t,b,E,u,x]);return v(()=>()=>{d(!1),i(""),a(void 0)},[]),V(O,{...p,isOpen:!!o,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-0 md:mb-[24px] px-0",titleClassName:"h-[56px] bg-[#F5F5F7]",children:[R&&!N?m(w,{item:o,copy:r,disabled:g,onClose:p.onClose}):m(T,{item:o,copy:r,loading:N,disabled:g,onConfirm:I}),C&&m("div",{className:"mx-auto max-w-full bg-white px-[48px] py-[12px] text-center text-[#FF0000] md:px-[16px]",children:m(S,{className:"text-[14px] font-semibold text-[#1F2021]",html:C})})]})}var Y=A;export{Y as default};
|
|
2
|
+
//# sourceMappingURL=RedeemVirtualProductModal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsRedeemList/RedeemVirtualProductModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { ModalContainerProps } from '../modal/ModalContainer'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemGoGift } from '../context/hooks/useRedeemGoGift'\nimport { useRedeemProduct } from '../context/hooks/useRedeemProduct'\nimport { AlpcErrorCode, ConsumeType } from '../context/const'\nimport { CreditsModalContainer } from '../modal/ModalContainer'\nimport type { RedeemableItem as RedeemableItemType, RedeemModalCommon } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { VirtualProductInit } from './RedeemVirtualProductModal/VirtualProductInit'\nimport { VirtualProductSuccess } from './RedeemVirtualProductModal/VirtualProductSuccess'\n\nfunction RedeemVirtualProductModal({\n item,\n copy,\n onError,\n ...props\n}: Omit<ModalContainerProps, 'isOpen'> & {\n item: RedeemableItemType\n copy: RedeemModalCommon\n onError: (code: number) => void\n}) {\n const [giftCardId, setGiftCardId] = useState<string>()\n const [errorInfo, setErrorInfo] = useState<string>()\n\n const [disabled, setDisabled] = useState(false)\n\n const { profile, fetchCreditInfo } = useCreditsContext()\n\n // \u5224\u65AD\u662F GoGift \u8FD8\u662F GiftCard \u7C7B\u578B\n const isGoGift = item.config?.type === ConsumeType.GoGift\n const isGiftCard = item.config?.type === ConsumeType.GiftCard\n\n // GoGift \u4F7F\u7528\u4E13\u7528\u63A5\u53E3\n const { isMutating: goGiftLoading, trigger: triggerGoGift } = useRedeemGoGift({\n onSuccess(responseData) {\n if (!responseData) {\n setErrorInfo(copy?.commonError)\n return\n }\n\n if (responseData?.data?.id) {\n setGiftCardId(responseData.data.id)\n fetchCreditInfo(profile?.user_id)\n } else {\n handleRedeemError(responseData.code)\n }\n },\n onError(error) {\n setErrorInfo(error.message || copy?.commonError)\n },\n })\n\n // GiftCard \u4F7F\u7528 Product \u63A5\u53E3\uFF0C\u4F46\u4E0D\u9700\u8981\u5730\u5740\n const { isMutating: productLoading, trigger: triggerProduct } = useRedeemProduct({\n onSuccess(responseData) {\n if (!responseData) {\n setErrorInfo(copy?.commonError)\n return\n }\n\n if (responseData?.code === 0) {\n setGiftCardId('success')\n fetchCreditInfo(profile?.user_id)\n } else {\n handleRedeemError(responseData.code)\n }\n },\n onError() {\n setErrorInfo(copy?.commonError)\n },\n })\n\n const loading = isGoGift ? goGiftLoading : productLoading\n\n const handleRedeemError = (code: number) => {\n let errorMsg: string | undefined\n if (code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy?.redeemLimitError\n setDisabled(true)\n } else if (code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy?.inventoryNotEnough\n setDisabled(true)\n } else if (code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy?.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy?.crossSiteError\n setDisabled(true)\n }\n\n setErrorInfo(errorMsg || copy?.commonError || '')\n onError && onError(code)\n }\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n\n if (isGoGift) {\n // GoGift \u7C7B\u578B\u4F7F\u7528\u4E13\u7528\u63A5\u53E3\n triggerGoGift({\n user_id: profile?.user_id,\n rule_id: Number(item.alpc?.id),\n })\n } else if (isGiftCard) {\n // GiftCard \u7C7B\u578B\u4F7F\u7528 Product \u63A5\u53E3\uFF0C\u4F20\u9012\u9ED8\u8BA4\u5730\u5740\n const defaultAddress = {\n email: profile?.email || '',\n firstName: profile?.firstName || '',\n lastName: profile?.lastName || '',\n address1: 'Default Address',\n city: 'Default City',\n province: 'Default Province',\n country: 'US',\n zip: '00000',\n }\n triggerProduct({\n address: btoa(JSON.stringify(defaultAddress)),\n rule_id: Number(item.alpc?.id),\n })\n }\n }, [item, profile, triggerGoGift, triggerProduct, isGoGift, isGiftCard])\n\n useEffect(() => {\n return () => {\n setDisabled(false)\n setErrorInfo('')\n setGiftCardId(undefined)\n }\n }, [])\n\n return (\n <CreditsModalContainer\n {...props}\n isOpen={!!item}\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-0 md:mb-[24px] px-0\"\n titleClassName=\"h-[56px] bg-[#F5F5F7]\"\n >\n {giftCardId && !loading ? (\n <VirtualProductSuccess item={item} copy={copy} disabled={disabled} onClose={props.onClose} />\n ) : (\n <VirtualProductInit item={item} copy={copy} loading={loading} disabled={disabled} onConfirm={handleConfirm} />\n )}\n {errorInfo && (\n <div className=\"mx-auto max-w-full bg-white px-[48px] py-[12px] text-center text-[#FF0000] md:px-[16px]\">\n <Text className=\"text-[14px] font-semibold text-[#1F2021]\" html={errorInfo} />\n </div>\n )}\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemVirtualProductModal\n"],
|
|
5
|
+
"mappings": "AAsII,OAQI,OAAAA,EARJ,QAAAC,MAAA,oBAtIJ,OAAS,QAAAC,MAAY,wBACrB,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,mBAAAC,MAAuB,mCAChC,OAAS,oBAAAC,MAAwB,oCACjC,OAAS,iBAAAC,EAAe,eAAAC,MAAmB,mBAC3C,OAAS,yBAAAC,MAA6B,0BAGtC,OAAS,sBAAAC,MAA0B,iDACnC,OAAS,yBAAAC,MAA6B,oDAEtC,SAASC,EAA0B,CACjC,KAAAC,EACA,KAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAIG,CACD,KAAM,CAACC,EAAYC,CAAa,EAAIf,EAAiB,EAC/C,CAACgB,EAAWC,CAAY,EAAIjB,EAAiB,EAE7C,CAACkB,EAAUC,CAAW,EAAInB,EAAS,EAAK,EAExC,CAAE,QAAAoB,EAAS,gBAAAC,CAAgB,EAAIp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CACZ,QAASL,GAAS,QAClB,QAAS,OAAOV,EAAK,MAAM,EAAE,CAC/B,CAAC,UACQa,EAAY,CAErB,MAAMY,EAAiB,CACrB,MAAOf,GAAS,OAAS,GACzB,UAAWA,GAAS,WAAa,GACjC,SAAUA,GAAS,UAAY,GAC/B,SAAU,kBACV,KAAM,eACN,SAAU,mBACV,QAAS,KACT,IAAK,OACP,EACAU,EAAe,CACb,QAAS,KAAK,KAAK,UAAUK,CAAc,CAAC,EAC5C,QAAS,OAAOzB,EAAK,MAAM,EAAE,CAC/B,CAAC,CACH,CACF,EAAG,CAACA,EAAMU,EAASK,EAAeK,EAAgBR,EAAUC,CAAU,CAAC,EAEvE,OAAAxB,EAAU,IACD,IAAM,CACXoB,EAAY,EAAK,EACjBF,EAAa,EAAE,EACfF,EAAc,MAAS,CACzB,EACC,CAAC,CAAC,EAGHnB,EAACU,EAAA,CACE,GAAGO,EACJ,OAAQ,CAAC,CAACH,EACV,UAAU,sBACV,gBAAgB,yCAChB,eAAe,wBAEd,UAAAI,GAAc,CAACiB,EACdpC,EAACa,EAAA,CAAsB,KAAME,EAAM,KAAMC,EAAM,SAAUO,EAAU,QAASL,EAAM,QAAS,EAE3FlB,EAACY,EAAA,CAAmB,KAAMG,EAAM,KAAMC,EAAM,QAASoB,EAAS,SAAUb,EAAU,UAAWgB,EAAe,EAE7GlB,GACCrB,EAAC,OAAI,UAAU,0FACb,SAAAA,EAACE,EAAA,CAAK,UAAU,2CAA2C,KAAMmB,EAAW,EAC9E,GAEJ,CAEJ,CAEA,IAAOoB,EAAQ3B",
|
|
6
|
+
"names": ["jsx", "jsxs", "Text", "useCallback", "useEffect", "useState", "useCreditsContext", "useRedeemGoGift", "useRedeemProduct", "AlpcErrorCode", "ConsumeType", "CreditsModalContainer", "VirtualProductInit", "VirtualProductSuccess", "RedeemVirtualProductModal", "item", "copy", "onError", "props", "giftCardId", "setGiftCardId", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "profile", "fetchCreditInfo", "isGoGift", "isGiftCard", "goGiftLoading", "triggerGoGift", "responseData", "handleRedeemError", "error", "productLoading", "triggerProduct", "loading", "code", "errorMsg", "handleConfirm", "defaultAddress", "RedeemVirtualProductModal_default"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Button as I,Text as f,Picture as s}from"@anker-in/headless-ui";import{useMemo as d}from"react";import c from"classnames";import{useCreditsContext as k}from"../context/provider";import{AlpcConsumeType as v,ConsumeType as g}from"../context/const";import{numberFormat as P,extractVariantId as b}from"../context/utils";import{gaTrack as y,useHeadlessContext as S}from"@anker-in/lib";import{NoneProductValue as $}from"./NonProductValue";import{ROUNDED_BRANDS as z}from"../../../constants";function M({copy:a,className:h,item:e,onRulesOpen:_,onRedeem:N}){const{creditInfo:u,profile:l,gtm:{pageGroup:m,pageHandle:n},pageCommon:r}=k(),{brand:C}=S(),i=Object.keys(l||{}).length>0,R=z.includes(C),T=d(()=>!!(e.alpc?.remainingInventory<=0&&e.alpc?.isLimited||e.alpc?.consumeType===v.Product&&!e.variant?.availableForSale||i&&l?.activated&&e.alpc?.consumeCredits>Number(u?.available_credit||0)),[e.alpc?.remainingInventory,e.alpc?.isLimited,e.alpc?.consumeType,e.alpc?.consumeCredits,i,l?.activated,u?.available_credit,e.variant?.availableForSale]),x=d(()=>i?e.alpc?.consumeType===v.Product?e.variant?.availableForSale?a.btnRedeem:r?.soldOut||"Sold Out":a.btnRedeem:a.unlockRewards,[i,e.alpc?.consumeType,e.variant?.availableForSale,a.btnRedeem,a.unlockRewards,r?.soldOut]),w=d(()=>{if(!(e.config?.type!==g.Product||!e.product?.handle))return b(e.variant?.id)?`/products/${e.product.handle}?variant=${b(e.variant?.id)}${n?`&ref=${n}`:""}`:`/products/${e.product.handle}${n?`?ref=${n}`:""}`},[e.config?.type,e.product?.handle,e.variant?.id,n]);return o("div",{className:c("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",!R&&"rounded-none md:rounded-none",h),children:[e.config?.type===g.Product?t("a",{href:w,className:c("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:t(s,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product
|
|
1
|
+
import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Button as I,Text as f,Picture as s}from"@anker-in/headless-ui";import{useMemo as d}from"react";import c from"classnames";import{useCreditsContext as k}from"../context/provider";import{AlpcConsumeType as v,ConsumeType as g}from"../context/const";import{numberFormat as P,extractVariantId as b}from"../context/utils";import{gaTrack as y,useHeadlessContext as S}from"@anker-in/lib";import{NoneProductValue as $}from"./NonProductValue";import{ROUNDED_BRANDS as z}from"../../../constants";function M({copy:a,className:h,item:e,onRulesOpen:_,onRedeem:N}){const{creditInfo:u,profile:l,gtm:{pageGroup:m,pageHandle:n},pageCommon:r}=k(),{brand:C}=S(),i=Object.keys(l||{}).length>0,R=z.includes(C),T=d(()=>!!(e.alpc?.remainingInventory<=0&&e.alpc?.isLimited||e.alpc?.consumeType===v.Product&&!e.variant?.availableForSale||i&&l?.activated&&e.alpc?.consumeCredits>Number(u?.available_credit||0)),[e.alpc?.remainingInventory,e.alpc?.isLimited,e.alpc?.consumeType,e.alpc?.consumeCredits,i,l?.activated,u?.available_credit,e.variant?.availableForSale]),x=d(()=>i?e.alpc?.consumeType===v.Product?e.variant?.availableForSale?a.btnRedeem:r?.soldOut||"Sold Out":a.btnRedeem:a.unlockRewards,[i,e.alpc?.consumeType,e.variant?.availableForSale,a.btnRedeem,a.unlockRewards,r?.soldOut]),w=d(()=>{if(!(e.config?.type!==g.Product||!e.product?.handle))return b(e.variant?.id)?`/products/${e.product.handle}?variant=${b(e.variant?.id)}${n?`&ref=${n}`:""}`:`/products/${e.product.handle}${n?`?ref=${n}`:""}`},[e.config?.type,e.product?.handle,e.variant?.id,n]);return o("div",{className:c("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",!R&&"rounded-none md:rounded-none",h),children:[e.config?.type===g.Product?t("a",{href:w,className:c("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:t(s,{className:"h-full w-auto [&_img]:h-full [&_img]:object-contain",source:e.config?.image?.url||e.product?.images?.[0]?.url})}):o("div",{className:"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]",children:[t(s,{source:r?.imageMapping?.[e.config?.type]?.url,className:"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),t($,{item:e})]}),o("div",{className:c("mt-[10px] xl:mt-[8px] flex w-full flex-1 flex-col justify-between"),children:[t(f,{html:e.config?.title||e.alpc?.title,title:e.config?.title||e.alpc?.title,size:2,className:"line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:h-[40px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]"}),e.config?.rules?.length>0&&t("button",{type:"button",onClick:()=>{_(e.config?.rules||[]),y({event:"ga4Event",event_name:"lp_button",member_active_status:l?.activated?"active":"not active",event_parameters:{page_group:m,position:a.title,button_name:r?.ruleLabel,info:e.alpc?.id?.toString()}})},className:"mt-[8px] w-fit text-[16px] font-bold underline md:text-[14px] l:mt-0",tabIndex:0,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&p.preventDefault()},children:r?.ruleLabel}),o("div",{children:[o("div",{className:"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]",children:[t(s,{className:"size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783"}),t(f,{html:`${P(e.alpc?.consumeCredits)}`,size:2,as:"p",className:"ml-[4px] text-[24px] font-bold mt-[4px] leading-none l-xxl:text-[20px] l:text-[16px] "})]}),t(I,{disabled:T,variant:"primary",size:"lg",className:"mt-[8px] md:px-[8px] l:w-full",onClick:()=>{N(e),y({event:"ga4Event",event_name:"lp_button",member_active_status:l?.activated?"active":"not active",event_parameters:{page_group:m,position:a.title,button_name:x,info:e.alpc?.id?.toString()}})},children:x})]})]})]})}export{M as RedeemableItem};
|
|
2
2
|
//# sourceMappingURL=RedeemableItem.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsRedeemList/RedeemableItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Button, Text, Picture } from '@anker-in/headless-ui'\n\nimport { useMemo } from 'react'\n\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { AlpcConsumeType, ConsumeType } from '../context/const'\nimport { numberFormat, extractVariantId } from '../context/utils'\nimport type { CreditsRedeemListCopy } from './type'\nimport { gaTrack, useHeadlessContext } from '@anker-in/lib'\nimport { NoneProductValue } from './NonProductValue'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport function RedeemableItem({\n copy,\n className,\n item,\n onRulesOpen,\n onRedeem,\n}: {\n copy: CreditsRedeemListCopy\n className?: string\n item: RedeemableItemType\n onRulesOpen: (rules: string[]) => void\n onRedeem: (item: RedeemableItemType) => void\n}) {\n const {\n creditInfo,\n profile,\n gtm: { pageGroup, pageHandle },\n pageCommon,\n } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const isLogin = Object.keys(profile || {}).length > 0\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const isDisabled = useMemo(() => {\n if (item.alpc?.remainingInventory <= 0 && item.alpc?.isLimited) {\n // \u6709\u5E93\u5B58\u9650\u5236\n return true\n }\n\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n if (!item.variant?.availableForSale) {\n return true\n }\n }\n if (isLogin && profile?.activated && item.alpc?.consumeCredits > Number(creditInfo?.available_credit || 0)) {\n return true\n }\n return false\n }, [\n item.alpc?.remainingInventory,\n item.alpc?.isLimited,\n item.alpc?.consumeType,\n item.alpc?.consumeCredits,\n isLogin,\n profile?.activated,\n creditInfo?.available_credit,\n item.variant?.availableForSale,\n ])\n\n const redeemButtonText = useMemo(() => {\n if (!isLogin) {\n return copy.unlockRewards\n }\n\n // \u7F3A\u8D27\u6587\u6848\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n return item.variant?.availableForSale ? copy.btnRedeem : pageCommon?.soldOut || 'Sold Out'\n }\n return copy.btnRedeem\n }, [\n isLogin,\n item.alpc?.consumeType,\n item.variant?.availableForSale,\n copy.btnRedeem,\n copy.unlockRewards,\n pageCommon?.soldOut,\n ])\n\n // \u751F\u6210\u4EA7\u54C1 listing \u9875\u9762\u94FE\u63A5\n const productUrl = useMemo(() => {\n if (item.config?.type !== ConsumeType.Product || !item.product?.handle) {\n return undefined\n }\n return extractVariantId(item.variant?.id)\n ? `/products/${item.product.handle}?variant=${extractVariantId(item.variant?.id)}${pageHandle ? `&ref=${pageHandle}` : ''}`\n : `/products/${item.product.handle}${pageHandle ? `?ref=${pageHandle}` : ''}`\n }, [item.config?.type, item.product?.handle, item.variant?.id, pageHandle])\n\n return (\n <div\n className={classNames(\n 'flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]',\n !rounded && 'rounded-none md:rounded-none',\n className\n )}\n >\n {item.config?.type === ConsumeType.Product ? (\n <a\n href={productUrl}\n className={classNames('relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]')}\n >\n <Picture\n className=\"h-full w-auto [&_img]:h-full [&_img]:object-contain\"\n source={item.config?.image?.url || item.product
|
|
5
|
-
"mappings": "AAyGU,cAAAA,EAMF,QAAAC,MANE,oBAzGV,OAAS,UAAAC,EAAQ,QAAAC,EAAM,WAAAC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AQ,IAAM,CAC/B,GAAI,EAAAc,EAAK,QAAQ,OAASV,EAAY,SAAW,CAACU,EAAK,SAAS,QAGhE,OAAOR,EAAiBQ,EAAK,SAAS,EAAE,EACpC,aAAaA,EAAK,QAAQ,MAAM,YAAYR,EAAiBQ,EAAK,SAAS,EAAE,CAAC,GAAGM,EAAa,QAAQA,CAAU,GAAK,EAAE,GACvH,aAAaN,EAAK,QAAQ,MAAM,GAAGM,EAAa,QAAQA,CAAU,GAAK,EAAE,EAC/E,EAAG,CAACN,EAAK,QAAQ,KAAMA,EAAK,SAAS,OAAQA,EAAK,SAAS,GAAIM,CAAU,CAAC,EAE1E,OACExB,EAAC,OACC,UAAWK,EACT,6HACA,CAACuB,GAAW,+BACZX,CACF,EAEC,UAAAC,EAAK,QAAQ,OAASV,EAAY,QACjCT,EAAC,KACC,KAAMgC,EACN,UAAW1B,EAAW,2EAA2E,EAEjG,SAAAN,EAACI,EAAA,CACC,UAAU,sDACV,OAAQe,EAAK,QAAQ,OAAO,KAAOA,EAAK,
|
|
4
|
+
"sourcesContent": ["import { Button, Text, Picture } from '@anker-in/headless-ui'\n\nimport { useMemo } from 'react'\n\nimport classNames from 'classnames'\nimport { useCreditsContext } from '../context/provider'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { AlpcConsumeType, ConsumeType } from '../context/const'\nimport { numberFormat, extractVariantId } from '../context/utils'\nimport type { CreditsRedeemListCopy } from './type'\nimport { gaTrack, useHeadlessContext } from '@anker-in/lib'\nimport { NoneProductValue } from './NonProductValue'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport function RedeemableItem({\n copy,\n className,\n item,\n onRulesOpen,\n onRedeem,\n}: {\n copy: CreditsRedeemListCopy\n className?: string\n item: RedeemableItemType\n onRulesOpen: (rules: string[]) => void\n onRedeem: (item: RedeemableItemType) => void\n}) {\n const {\n creditInfo,\n profile,\n gtm: { pageGroup, pageHandle },\n pageCommon,\n } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const isLogin = Object.keys(profile || {}).length > 0\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const isDisabled = useMemo(() => {\n if (item.alpc?.remainingInventory <= 0 && item.alpc?.isLimited) {\n // \u6709\u5E93\u5B58\u9650\u5236\n return true\n }\n\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n if (!item.variant?.availableForSale) {\n return true\n }\n }\n if (isLogin && profile?.activated && item.alpc?.consumeCredits > Number(creditInfo?.available_credit || 0)) {\n return true\n }\n return false\n }, [\n item.alpc?.remainingInventory,\n item.alpc?.isLimited,\n item.alpc?.consumeType,\n item.alpc?.consumeCredits,\n isLogin,\n profile?.activated,\n creditInfo?.available_credit,\n item.variant?.availableForSale,\n ])\n\n const redeemButtonText = useMemo(() => {\n if (!isLogin) {\n return copy.unlockRewards\n }\n\n // \u7F3A\u8D27\u6587\u6848\n if (item.alpc?.consumeType === AlpcConsumeType.Product) {\n return item.variant?.availableForSale ? copy.btnRedeem : pageCommon?.soldOut || 'Sold Out'\n }\n return copy.btnRedeem\n }, [\n isLogin,\n item.alpc?.consumeType,\n item.variant?.availableForSale,\n copy.btnRedeem,\n copy.unlockRewards,\n pageCommon?.soldOut,\n ])\n\n // \u751F\u6210\u4EA7\u54C1 listing \u9875\u9762\u94FE\u63A5\n const productUrl = useMemo(() => {\n if (item.config?.type !== ConsumeType.Product || !item.product?.handle) {\n return undefined\n }\n return extractVariantId(item.variant?.id)\n ? `/products/${item.product.handle}?variant=${extractVariantId(item.variant?.id)}${pageHandle ? `&ref=${pageHandle}` : ''}`\n : `/products/${item.product.handle}${pageHandle ? `?ref=${pageHandle}` : ''}`\n }, [item.config?.type, item.product?.handle, item.variant?.id, pageHandle])\n\n return (\n <div\n className={classNames(\n 'flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]',\n !rounded && 'rounded-none md:rounded-none',\n className\n )}\n >\n {item.config?.type === ConsumeType.Product ? (\n <a\n href={productUrl}\n className={classNames('relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]')}\n >\n <Picture\n className=\"h-full w-auto [&_img]:h-full [&_img]:object-contain\"\n source={item.config?.image?.url || item.product?.images?.[0]?.url}\n ></Picture>\n </a>\n ) : (\n <div className=\"relative mx-auto my-[30px] h-[164px] md:my-0 md:h-[66px] l-xxl:h-[138px] md-l:h-[80px]\">\n <Picture\n source={pageCommon?.imageMapping?.[item.config?.type]?.url}\n className=\"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n\n <NoneProductValue item={item} />\n </div>\n )}\n <div className={classNames('mt-[10px] xl:mt-[8px] flex w-full flex-1 flex-col justify-between')}>\n <Text\n html={item.config?.title || item.alpc?.title}\n title={item.config?.title || item.alpc?.title}\n size={2}\n className=\"line-clamp-2 h-[58px] text-[24px] leading-[1.2] l:h-[40px] l:text-[16px] l-xxl:h-[48px] l-xxl:text-[20px]\"\n />\n {item.config?.rules?.length > 0 && (\n <button\n type=\"button\"\n onClick={() => {\n onRulesOpen(item.config?.rules || [])\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: pageCommon?.ruleLabel,\n info: item.alpc?.id?.toString(),\n },\n })\n }}\n className=\"mt-[8px] w-fit text-[16px] font-bold underline md:text-[14px] l:mt-0\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {pageCommon?.ruleLabel}\n </button>\n )}\n <div>\n <div className=\"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]\">\n <Picture\n className=\"size-[24px] l-xxl:size-[22px] md-l:size-[18px] md:size-[16px]\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/icon_hire_purchase.png?v=1757496783\"\n />\n <Text\n html={`${numberFormat(item.alpc?.consumeCredits)}`}\n size={2}\n as=\"p\"\n className=\"ml-[4px] text-[24px] font-bold mt-[4px] leading-none l-xxl:text-[20px] l:text-[16px] \"\n />\n </div>\n\n <Button\n disabled={isDisabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[8px] md:px-[8px] l:w-full\"\n onClick={() => {\n onRedeem(item)\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_button',\n member_active_status: profile?.activated ? 'active' : 'not active',\n event_parameters: {\n page_group: pageGroup,\n position: copy.title,\n button_name: redeemButtonText,\n info: item.alpc?.id?.toString(),\n },\n })\n }}\n >\n {redeemButtonText}\n </Button>\n </div>\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAyGU,cAAAA,EAMF,QAAAC,MANE,oBAzGV,OAAS,UAAAC,EAAQ,QAAAC,EAAM,WAAAC,MAAe,wBAEtC,OAAS,WAAAC,MAAe,QAExB,OAAOC,MAAgB,aACvB,OAAS,qBAAAC,MAAyB,sBAElC,OAAS,mBAAAC,EAAiB,eAAAC,MAAmB,mBAC7C,OAAS,gBAAAC,EAAc,oBAAAC,MAAwB,mBAE/C,OAAS,WAAAC,EAAS,sBAAAC,MAA0B,gBAC5C,OAAS,oBAAAC,MAAwB,oBACjC,OAAS,kBAAAC,MAAsB,qBAExB,SAASC,EAAe,CAC7B,KAAAC,EACA,UAAAC,EACA,KAAAC,EACA,YAAAC,EACA,SAAAC,CACF,EAMG,CACD,KAAM,CACJ,WAAAC,EACA,QAAAC,EACA,IAAK,CAAE,UAAAC,EAAW,WAAAC,CAAW,EAC7B,WAAAC,CACF,EAAInB,EAAkB,EAChB,CAAE,MAAAoB,CAAM,EAAId,EAAmB,EAC/Be,EAAU,OAAO,KAAKL,GAAW,CAAC,CAAC,EAAE,OAAS,EAC9CM,EAAUd,EAAe,SAASY,CAAK,EAEvCG,EAAazB,EAAQ,IACrB,GAAAc,EAAK,MAAM,oBAAsB,GAAKA,EAAK,MAAM,WAKjDA,EAAK,MAAM,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AM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EAEC,SAAAY,EACH,GACF,GACF,GACF,CAEJ",
|
|
6
6
|
"names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "classNames", "useCreditsContext", "AlpcConsumeType", "ConsumeType", "numberFormat", "extractVariantId", "gaTrack", "useHeadlessContext", "NoneProductValue", "ROUNDED_BRANDS", "RedeemableItem", "copy", "className", "item", "onRulesOpen", "onRedeem", "creditInfo", "profile", "pageGroup", "pageHandle", "pageCommon", "brand", "isLogin", "rounded", "isDisabled", "redeemButtonText", "productUrl", "e"]
|
|
7
7
|
}
|
|
@@ -27,6 +27,17 @@ export type CreditsRedeemListCopy = {
|
|
|
27
27
|
successButton: string;
|
|
28
28
|
successButtonUrl: string;
|
|
29
29
|
};
|
|
30
|
+
virtualProduct: {
|
|
31
|
+
successDesc: string;
|
|
32
|
+
successTitle: string;
|
|
33
|
+
successButton: string;
|
|
34
|
+
successButtonUrl: string;
|
|
35
|
+
stepTitle?: string;
|
|
36
|
+
steps?: {
|
|
37
|
+
imageUrl: string;
|
|
38
|
+
title: string;
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
30
41
|
product: {
|
|
31
42
|
required: string;
|
|
32
43
|
invalidEmail: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as Z,jsx as t,jsxs as i}from"react/jsx-runtime";import{Button as z,Container as E,Heading as f,Picture as b,Text as I}from"@anker-in/headless-ui";import{ChevronDownIcon as W,ChevronUpIcon as G}from"@heroicons/react/24/outline";import{useEffect as H,useMemo as _,useRef as j,useState as a}from"react";import{TaskType as h}from"./type";import{useActions as q}from"./useActions";import{useCreditsContext as V}from"../context/provider";import{classNames as p,useHeadlessContext as J}from"@anker-in/lib";import{useRegistration as K}from"../../registration";import{CreditsUploadReceiptModal as Q}from"../modal/
|
|
1
|
+
import{Fragment as Z,jsx as t,jsxs as i}from"react/jsx-runtime";import{Button as z,Container as E,Heading as f,Picture as b,Text as I}from"@anker-in/headless-ui";import{ChevronDownIcon as W,ChevronUpIcon as G}from"@heroicons/react/24/outline";import{useEffect as H,useMemo as _,useRef as j,useState as a}from"react";import{TaskType as h}from"./type";import{useActions as q}from"./useActions";import{useCreditsContext as V}from"../context/provider";import{classNames as p,useHeadlessContext as J}from"@anker-in/lib";import{useRegistration as K}from"../../registration";import{CreditsUploadReceiptModal as Q}from"../modal/CreditsUploadReceiptModal";import{CreditsSubscribeModal as X}from"../modal/SubscribeModal";import{ROUNDED_BRANDS as Y}from"../../../constants";const pe=({copy:s,classNames:v,id:R})=>{const[l,g]=a(!1),T=j(null),{profile:y}=V(),{authCodeActivate:D}=K(),{brand:L}=J(),k=Y.includes(L),c=!!y,[M,C]=a(!1),[U,u]=a(!1),[N,O]=a(!1),[w,B]=a(!1),{actions:m}=q({copy:s,subscribe:{openSubscribePopup:()=>u(!0),isSuccess:N},uploadReceipt:{openUploadReceiptPopup:()=>C(!0),isSuccess:w}}),A=_(()=>{const e=(s.list||[]).map(n=>{if(!m[n.id])return;const{finished:o,notLogin:F,notFinished:x,completed:P}=m[n.id];let d="",r,S;return c?o?(d=P.buttonLabel,r=void 0):(d=x.buttonLabel,r=x.handleClick,S=x.link):(d=F.buttonLabel,r=F.handleClick),{...n,buttonLabel:d,handleClick:r,finished:o,link:S}}).filter(Boolean);return c?e.sort((n,o)=>n?.finished&&!o?.finished?1:!n?.finished&&o?.finished?-1:0):e},[m,s.list,c]);return H(()=>{if(!l&&window.innerWidth<768){const e=document.getElementById("ways-to-get-credits");if(e){const n=setTimeout(()=>{e.scrollIntoView({behavior:"smooth",block:"end"})},300);return()=>clearTimeout(n)}}},[l]),i(E,{id:R,className:" bg-[#F5F5F7] [&>div]:l:!px-0",children:[i("div",{className:p("rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]",!k&&"rounded-none"),children:[t(f,{as:"h2",size:4,html:s?.title,className:"text-center l:pl-[16px] l:text-left"}),i("div",{className:"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]",children:[i("div",{className:"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]",children:[t(f,{size:3,as:"h3",html:s.subtitle,className:v?.subtitle}),i("div",{className:"mt-[8px] flex items-center",children:[s.creditsIcon?.url&&t(b,{className:"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand",source:s.creditsIcon.url,alt:s.creditsIcon.alt||"credits"}),t(f,{html:s.equalCredits,size:4,as:"h3",className:p("mt-2 text-white md:text-[24px]",v?.equalCreditsText)})]})]}),t(b,{className:"w-full laptop:w-[50%]",source:s.mainImage?.url})]}),i("div",{className:"relative",children:[i("div",{ref:T,className:p("relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden transition-all duration-300 md:mt-[16px] md:grid-cols-1 l:gap-[12px] md-l:mt-[32px] md-l:grid-cols-2",l?"min-md:!h-auto md:h-auto":"md:h-[512px] min-md:!h-auto"),children:[A.map(e=>i("div",{className:p("flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]",!k&&"rounded-none"),children:[i("div",{children:[t(I,{as:"p",html:e.title,size:2,className:"text-pretty text-[24px] font-bold xl:text-[20px]"}),i("div",{className:"mt-[4px] flex items-center",children:[t(b,{className:"size-[24px] xl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),t(I,{as:"p",html:e.credits,size:2,className:"ml-[4px] mt-[6px] text-[18px] l:text-[14px]"})]})]}),e.handleClick&&!(e.id===h.UploadReceipt&&w)&&!(e.id===h.Activate&&D.isActivateSuccess)&&!(e.id===h.Subscribe&&N)?t(z,{as:e.link?"a":"button",...e.link&&{href:e.link},...e.handleClick&&{onClick:e.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:e.buttonLabel}):t(z,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:e.buttonLabel})]},e.id)),!l&&t("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)"}})]}),l?t("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{g(!1)},children:t(G,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):t(Z,{children:t("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:t("button",{className:"w-fit",onClick:()=>g(!l),children:t(W,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})]})]}),s.receipt&&t(Q,{isOpen:M,onClose:()=>{C(!1)},copy:s.receipt,onSuccess:()=>{B(!0)}}),s.subscribe&&t(X,{copy:s.subscribe,onSuccess:()=>{O(!0),setTimeout(()=>{u(!1)},3e3)},isOpen:U,onClose:()=>{u(!1)}})]})};export{pe as CreditsWaysToGetCredits};
|
|
2
2
|
//# sourceMappingURL=CreditsWaysToGetCredits.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { useEffect, useMemo, useRef, useState } from 'react'\n\nimport { TaskType, type CreditsWaysToGetCreditsProps } from './type'\nimport { useActions } from './useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsWaysToGetCredits = ({ copy, classNames, id }: CreditsWaysToGetCreditsProps & { id?: string }) => {\n const [showMore, setShowMore] = useState(false)\n const containerRef = useRef<HTMLDivElement>(null)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n const list = useMemo(() => {\n const list = (copy.list || [])\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n useEffect(() => {\n if (!showMore && window.innerWidth < 768) {\n const section = document.getElementById('ways-to-get-credits')\n if (section) {\n const timer = setTimeout(() => {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }, 300)\n return () => clearTimeout(timer)\n }\n }\n }, [showMore])\n\n return (\n <Container id={id} className=\" bg-[#F5F5F7] [&>div]:l:!px-0\">\n <div\n className={cn(\n 'rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]',\n !rounded && 'rounded-none'\n )}\n >\n <Heading as=\"h2\" size={4} html={copy?.title} className=\"text-center l:pl-[16px] l:text-left\" />\n <div className=\"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]\">\n <div className=\"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]\">\n <Heading size={3} as=\"h3\" html={copy.subtitle} className={classNames?.subtitle} />\n <div className=\"mt-[8px] flex items-center\">\n {copy.creditsIcon?.url && (\n <Picture\n className=\"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand\"\n source={copy.creditsIcon.url}\n alt={copy.creditsIcon.alt || 'credits'}\n />\n )}\n <Heading\n html={copy.equalCredits}\n size={4}\n as=\"h3\"\n className={cn('mt-2 text-white md:text-[24px]', classNames?.equalCreditsText)}\n />\n </div>\n </div>\n <Picture className=\"w-full laptop:w-[50%]\" source={copy.mainImage?.url} />\n </div>\n\n <div className=\"relative\">\n <div\n ref={containerRef}\n className={cn(\n 'relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden transition-all duration-300 md:mt-[16px] md:grid-cols-1 l:gap-[12px] md-l:mt-[32px] md-l:grid-cols-2',\n showMore ? 'min-md:!h-auto md:h-auto' : 'md:h-[512px] min-md:!h-auto'\n )}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]',\n !rounded && 'rounded-none'\n )}\n >\n <div>\n <Text\n as=\"p\"\n html={item.title}\n size={2}\n className=\"text-pretty text-[24px] font-bold xl:text-[20px]\"\n />\n <div className=\"mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text\n as=\"p\"\n html={item.credits}\n size={2}\n className=\"ml-[4px] mt-[6px] text-[18px] l:text-[14px]\"\n />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)' }}\n ></div>\n )}\n </div>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
|
|
4
|
+
"sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { useEffect, useMemo, useRef, useState } from 'react'\n\nimport { TaskType, type CreditsWaysToGetCreditsProps } from './type'\nimport { useActions } from './useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/CreditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/SubscribeModal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsWaysToGetCredits = ({ copy, classNames, id }: CreditsWaysToGetCreditsProps & { id?: string }) => {\n const [showMore, setShowMore] = useState(false)\n const containerRef = useRef<HTMLDivElement>(null)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n const list = useMemo(() => {\n const list = (copy.list || [])\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n useEffect(() => {\n if (!showMore && window.innerWidth < 768) {\n const section = document.getElementById('ways-to-get-credits')\n if (section) {\n const timer = setTimeout(() => {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }, 300)\n return () => clearTimeout(timer)\n }\n }\n }, [showMore])\n\n return (\n <Container id={id} className=\" bg-[#F5F5F7] [&>div]:l:!px-0\">\n <div\n className={cn(\n 'rounded-[16px] bg-[#1D1D1F] py-[64px] px-[140px] text-white md:px-[16px] l:rounded-none md-l:px-[32px] l-xl:px-[77px]',\n !rounded && 'rounded-none'\n )}\n >\n <Heading as=\"h2\" size={4} html={copy?.title} className=\"text-center l:pl-[16px] l:text-left\" />\n <div className=\"mt-[64px] flex items-center justify-between md:mt-[64px] l:mt-[24px] l:flex-col-reverse l:items-start md-l:mt-[32px]\">\n <div className=\"pl-[16px] l:mt-[40px] desktop:pl-[24px] lg-desktop:pl-[32px]\">\n <Heading size={3} as=\"h3\" html={copy.subtitle} className={classNames?.subtitle} />\n <div className=\"mt-[8px] flex items-center\">\n {copy.creditsIcon?.url && (\n <Picture\n className=\"size-[48px] mr-[8px] stroke-brand xl:size-[30px] [&_path]:stroke-brand\"\n source={copy.creditsIcon.url}\n alt={copy.creditsIcon.alt || 'credits'}\n />\n )}\n <Heading\n html={copy.equalCredits}\n size={4}\n as=\"h3\"\n className={cn('mt-2 text-white md:text-[24px]', classNames?.equalCreditsText)}\n />\n </div>\n </div>\n <Picture className=\"w-full laptop:w-[50%]\" source={copy.mainImage?.url} />\n </div>\n\n <div className=\"relative\">\n <div\n ref={containerRef}\n className={cn(\n 'relative mt-[64px] grid grid-cols-3 gap-[16px] overflow-hidden transition-all duration-300 md:mt-[16px] md:grid-cols-1 l:gap-[12px] md-l:mt-[32px] md-l:grid-cols-2',\n showMore ? 'min-md:!h-auto md:h-auto' : 'md:h-[512px] min-md:!h-auto'\n )}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[160px] flex-col justify-between rounded-[16px] bg-white p-[16px] text-[#1D1D1F] desktop:min-h-[192px] desktop:p-[24px] lg-desktop:min-h-[240px] lg-desktop:p-[32px]',\n !rounded && 'rounded-none'\n )}\n >\n <div>\n <Text\n as=\"p\"\n html={item.title}\n size={2}\n className=\"text-pretty text-[24px] font-bold xl:text-[20px]\"\n />\n <div className=\"mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text\n as=\"p\"\n html={item.credits}\n size={2}\n className=\"ml-[4px] mt-[6px] text-[18px] l:text-[14px]\"\n />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(29, 29, 31, 0) 66.37%, #1D1D1F 100%)' }}\n ></div>\n )}\n </div>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
|
|
5
5
|
"mappings": "AAiHQ,OAkGI,YAAAA,EAlGJ,OAAAC,EAII,QAAAC,MAJJ,oBAjHR,OAAS,UAAAC,EAAQ,aAAAC,EAAW,WAAAC,EAAS,WAAAC,EAAS,QAAAC,MAAY,wBAC1D,OAAS,mBAAAC,EAAiB,iBAAAC,MAAqB,8BAC/C,OAAS,aAAAC,EAAW,WAAAC,EAAS,UAAAC,EAAQ,YAAAC,MAAgB,QAErD,OAAS,YAAAC,MAAmD,SAC5D,OAAS,cAAAC,MAAkB,eAC3B,OAAS,qBAAAC,MAA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QAAS,IAAM,CACb2B,EAAY,EAAK,CACnB,EAEA,SAAA3B,EAACQ,EAAA,CAAc,UAAU,kDAAkD,EAC7E,EAEAR,EAAAD,EAAA,CACE,SAAAC,EAAC,OAAI,UAAU,6EACb,SAAAA,EAAC,UAAO,UAAU,QAAQ,QAAS,IAAM2B,EAAY,CAACD,CAAQ,EAC5D,SAAA1B,EAACO,EAAA,CAAgB,UAAU,kDAAkD,EAC/E,EACF,EACF,GAEJ,GACF,EACCgB,EAAK,SACJvB,EAACmB,EAAA,CACC,OAAQe,EACR,QAAS,IAAM,CACbC,EAA4B,EAAK,CACnC,EACA,KAAMZ,EAAK,QACX,UAAW,IAAM,CACfkB,EAA0B,EAAI,CAChC,EACF,EAEDlB,EAAK,WACJvB,EAACoB,EAAA,CACC,KAAMG,EAAK,UACX,UAAW,IAAM,CACfgB,EAAsB,EAAI,EAC1B,WAAW,IAAM,CACfF,EAAwB,EAAK,CAC/B,EAAG,GAAI,CACT,EACA,OAAQD,EACR,QAAS,IAAM,CACbC,EAAwB,EAAK,CAC/B,EACF,GAEJ,CAEJ",
|
|
6
6
|
"names": ["Fragment", "jsx", "jsxs", "Button", "Container", "Heading", "Picture", "Text", "ChevronDownIcon", "ChevronUpIcon", "useEffect", "useMemo", "useRef", "useState", "TaskType", "useActions", "useCreditsContext", "cn", "useHeadlessContext", "useRegistration", "CreditsUploadReceiptModal", "CreditsSubscribeModal", "ROUNDED_BRANDS", "CreditsWaysToGetCredits", "copy", "classNames", "id", "showMore", "setShowMore", "containerRef", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b", "section", "timer"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReceiptCopy } from '../modal/
|
|
2
|
-
import type { CreditsSubscribeModalCopy } from '../modal/
|
|
1
|
+
import type { ReceiptCopy } from '../modal/CreditsUploadReceiptModal';
|
|
2
|
+
import type { CreditsSubscribeModalCopy } from '../modal/SubscribeModal';
|
|
3
3
|
export type BenefitItem = {
|
|
4
4
|
title: string;
|
|
5
5
|
credits: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsWaysToGetCredits/type.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ReceiptCopy } from '../modal/
|
|
4
|
+
"sourcesContent": ["import type { ReceiptCopy } from '../modal/CreditsUploadReceiptModal'\nimport type { CreditsSubscribeModalCopy } from '../modal/SubscribeModal'\n\nexport type BenefitItem = {\n title: string\n credits: string\n id: string\n}\n\nexport type CreditsWaysToGetCreditsCopy = {\n title: string\n subtitle: string\n equalCredits: string\n musicIcon: string\n list: BenefitItem[]\n mainImage: {\n url: string\n alt: string\n }\n joinNow: string\n activate: string\n completed: string\n completeProfile: string\n makeFirstPurchase: string\n goShopLink: string\n uploadReceipt: string\n shopNow: string\n subscribeLabel: string\n sendEmailSuccess: string\n creditsIcon: {\n url: string\n alt: string\n }\n receipt: ReceiptCopy\n subscribe: CreditsSubscribeModalCopy\n}\n\nexport enum TaskType {\n Activate = 'activate',\n Subscribe = 'subscribe',\n CompleteProfile = 'completeProfile',\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shop = 'shop',\n}\n\nexport type CreditsWaysToGetCreditsProps = {\n copy: CreditsWaysToGetCreditsCopy\n classNames?: {\n equalCreditsText?: string\n subtitle?: string\n }\n}\n"],
|
|
5
5
|
"mappings": "AAqCO,IAAKA,OACVA,EAAA,SAAW,WACXA,EAAA,UAAY,YACZA,EAAA,gBAAkB,kBAClBA,EAAA,cAAgB,gBAChBA,EAAA,cAAgB,gBAChBA,EAAA,KAAO,OANGA,OAAA",
|
|
6
6
|
"names": ["TaskType"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { CreditsProvider, useCreditsContext } from './context/provider';
|
|
2
2
|
export { useUploadReceipt as useCreditsUploadReceipt } from './context/hooks/useUploadReceipt';
|
|
3
|
-
export { CreditsUploadReceiptModal } from './modal/
|
|
3
|
+
export { CreditsUploadReceiptModal } from './modal/CreditsUploadReceiptModal';
|
|
4
4
|
export { CreditsBanner } from './creditsBanner';
|
|
5
5
|
export { CreditsBenefits } from './creditsBenefits';
|
|
6
6
|
export { CreditsInfoCard } from './creditsInfoCard';
|
|
@@ -8,3 +8,4 @@ export { CreditsWaysToGetCredits } from './creditsWaysToGetCredits';
|
|
|
8
8
|
export { CreditsFaq } from './creditsFaq';
|
|
9
9
|
export { CreditsCash } from './creditsCash';
|
|
10
10
|
export { CreditsRedeemList } from './creditsRedeemList';
|
|
11
|
+
export { CreditsGoGift } from './creditsGoGift';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{CreditsProvider as t,useCreditsContext as o}from"./context/provider";import{useUploadReceipt as d}from"./context/hooks/useUploadReceipt";import{CreditsUploadReceiptModal as p}from"./modal/
|
|
1
|
+
import{CreditsProvider as t,useCreditsContext as o}from"./context/provider";import{useUploadReceipt as d}from"./context/hooks/useUploadReceipt";import{CreditsUploadReceiptModal as p}from"./modal/CreditsUploadReceiptModal";import{CreditsBanner as f}from"./creditsBanner";import{CreditsBenefits as x}from"./creditsBenefits";import{CreditsInfoCard as n}from"./creditsInfoCard";import{CreditsWaysToGetCredits as R}from"./creditsWaysToGetCredits";import{CreditsFaq as u}from"./creditsFaq";import{CreditsCash as U}from"./creditsCash";import{CreditsRedeemList as h}from"./creditsRedeemList";import{CreditsGoGift as v}from"./creditsGoGift";export{f as CreditsBanner,x as CreditsBenefits,U as CreditsCash,u as CreditsFaq,v as CreditsGoGift,n as CreditsInfoCard,t as CreditsProvider,h as CreditsRedeemList,p as CreditsUploadReceiptModal,R as CreditsWaysToGetCredits,o as useCreditsContext,d as useCreditsUploadReceipt};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/credits/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { CreditsProvider, useCreditsContext } from './context/provider'\n\nexport { useUploadReceipt as useCreditsUploadReceipt } from './context/hooks/useUploadReceipt'\nexport { CreditsUploadReceiptModal } from './modal/
|
|
5
|
-
"mappings": "AAAA,OAAS,mBAAAA,EAAiB,qBAAAC,MAAyB,qBAEnD,OAA6B,oBAApBC,MAAmD,mCAC5D,OAAS,6BAAAC,MAAiC,oCAC1C,OAAS,iBAAAC,MAAqB,kBAC9B,OAAS,mBAAAC,MAAuB,oBAChC,OAAS,mBAAAC,MAAuB,oBAChC,OAAS,2BAAAC,MAA+B,4BACxC,OAAS,cAAAC,MAAkB,eAC3B,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,qBAAAC,MAAyB",
|
|
6
|
-
"names": ["CreditsProvider", "useCreditsContext", "useUploadReceipt", "CreditsUploadReceiptModal", "CreditsBanner", "CreditsBenefits", "CreditsInfoCard", "CreditsWaysToGetCredits", "CreditsFaq", "CreditsCash", "CreditsRedeemList"]
|
|
4
|
+
"sourcesContent": ["export { CreditsProvider, useCreditsContext } from './context/provider'\n\nexport { useUploadReceipt as useCreditsUploadReceipt } from './context/hooks/useUploadReceipt'\nexport { CreditsUploadReceiptModal } from './modal/CreditsUploadReceiptModal'\nexport { CreditsBanner } from './creditsBanner'\nexport { CreditsBenefits } from './creditsBenefits'\nexport { CreditsInfoCard } from './creditsInfoCard'\nexport { CreditsWaysToGetCredits } from './creditsWaysToGetCredits'\nexport { CreditsFaq } from './creditsFaq'\nexport { CreditsCash } from './creditsCash'\nexport { CreditsRedeemList } from './creditsRedeemList'\nexport { CreditsGoGift } from './creditsGoGift'\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,EAAiB,qBAAAC,MAAyB,qBAEnD,OAA6B,oBAApBC,MAAmD,mCAC5D,OAAS,6BAAAC,MAAiC,oCAC1C,OAAS,iBAAAC,MAAqB,kBAC9B,OAAS,mBAAAC,MAAuB,oBAChC,OAAS,mBAAAC,MAAuB,oBAChC,OAAS,2BAAAC,MAA+B,4BACxC,OAAS,cAAAC,MAAkB,eAC3B,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,iBAAAC,MAAqB",
|
|
6
|
+
"names": ["CreditsProvider", "useCreditsContext", "useUploadReceipt", "CreditsUploadReceiptModal", "CreditsBanner", "CreditsBenefits", "CreditsInfoCard", "CreditsWaysToGetCredits", "CreditsFaq", "CreditsCash", "CreditsRedeemList", "CreditsGoGift"]
|
|
7
7
|
}
|
|
@@ -8,6 +8,7 @@ export interface MyRewardsMetafields {
|
|
|
8
8
|
approveSuccessLabel: string;
|
|
9
9
|
couponTab: string;
|
|
10
10
|
productTab: string;
|
|
11
|
+
gogiftTab?: string;
|
|
11
12
|
pendingLabel: string;
|
|
12
13
|
unfulfilledLabel: string;
|
|
13
14
|
fulfilledLabel: string;
|
|
@@ -20,6 +21,21 @@ export interface MyRewardsMetafields {
|
|
|
20
21
|
code: string;
|
|
21
22
|
copied: string;
|
|
22
23
|
copy: string;
|
|
24
|
+
redeemLinkLabel?: string;
|
|
25
|
+
gogiftPendingLabel?: string;
|
|
26
|
+
gogiftApprovedLabel?: string;
|
|
27
|
+
gogiftSecondConfirmLabel?: string;
|
|
28
|
+
gogiftRejectedLabel?: string;
|
|
29
|
+
gogiftCallbackPendingLabel?: string;
|
|
30
|
+
gogiftCallbackSuccessLabel?: string;
|
|
31
|
+
gogiftCallbackTimeoutLabel?: string;
|
|
32
|
+
gogiftPendingTip?: string;
|
|
33
|
+
gogiftApprovedTip?: string;
|
|
34
|
+
gogiftSecondConfirmTip?: string;
|
|
35
|
+
gogiftRejectedTip?: string;
|
|
36
|
+
gogiftCallbackPendingTip?: string;
|
|
37
|
+
gogiftCallbackSuccessTip?: string;
|
|
38
|
+
gogiftCallbackTimeoutTip?: string;
|
|
23
39
|
emptyListImage: {
|
|
24
40
|
url: string;
|
|
25
41
|
alt?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l,jsxs as r}from"react/jsx-runtime";import{Tabs as V,TabsList as J,TabsTrigger as Q,Picture as W}from"@anker-in/headless-ui";import b from"classnames";import X from"copy-to-clipboard";import Z from"dayjs";import{useCallback as w,useMemo as g,useState as p}from"react";import{ApprovalStatus as m,AlpcConsumeType as n,RewardType as i}from"../context/const";import{CreditsModalContainer as ee}from"./modalContainer";import ie from"./tip";import oe from"./loadingDots";import v from"../context/hooks/useMyRewards";import{useHeadlessContext as te}from"@anker-in/lib";import{ROUNDED_BRANDS as ne}from"../../../constants";function le({data:o,...a}){const[s,A]=p(n.Coupon),{brand:M}=te(),C=ne.includes(M),[c,F]=p(1),[d,D]=p(1),[f,h]=p(1),[j,T]=p(-1),O=g(()=>{const e=[];return o.couponTab&&e.push({title:o.couponTab,type:n.Coupon}),o.productTab&&e.push({title:o.productTab,type:n.Product}),o.gogiftTab&&e.push({title:o.gogiftTab,type:n.ExternalProduct}),e},[o.couponTab,o.productTab,o.gogiftTab]),E=g(()=>({page:a.isOpen?d:0,pageSize:1e3,consumeType:n.Product}),[a.isOpen,d]),I=g(()=>({page:a.isOpen?c:0,pageSize:1e3,consumeType:n.Coupon}),[a.isOpen,c]),U=g(()=>({page:a.isOpen?f:0,pageSize:1e3,consumeType:n.ExternalProduct}),[a.isOpen,f]),{myRewards:x=[],canNext:L,isLoading:Y}=v(I),{myRewards:y=[],canNext:P,isLoading:z}=v(E),{myRewards:N=[],canNext:k,isLoading:H}=v(U),S=g(()=>s===n.Coupon?x.map(e=>({title:e.goods_title,value:e.consume_credits,type:i.Received,date:new Date(e.create_time*1e3),couponCode:e.coupon_code,orderNumber:"",link:""})):s===n.Product?y.map(e=>{let t=i.Pending;return e.fulfillment_status&&e.fulfillment_status!=="null"?e.fulfillment_status==="fulfilled"?t=i.Fulfilled:t=i.Unfulfilled:e.approval_status===m.Success||e.approval_status===m.DoubleConfirm?t=i.ApproveSuccess:e.approval_status===m.Failed&&(t=i.Failed),{title:e.goods_title,value:e.consume_credits,type:t,date:new Date(e.create_time*1e3),orderNumber:e.order_number,couponCode:"",link:""}}):s===n.ExternalProduct?N.map(e=>{let t=i.GogiftPending;return e.gogift_status===0?t=i.GogiftPending:e.gogift_status===1?t=i.GogiftApproved:e.gogift_status===2?t=i.GogiftSecondConfirm:e.gogift_status===3?t=i.GogiftRejected:e.gogift_status===4?t=i.GogiftCallbackPending:e.gogift_status===5?t=i.GogiftCallbackSuccess:e.gogift_status===6&&(t=i.GogiftCallbackTimeout),{title:e.goods_title,value:e.consume_credits,type:t,date:new Date(e.create_time*1e3),orderNumber:"",couponCode:"",link:e.link||""}}):[],[s,y,x,N]),G=g(()=>s===n.Coupon?L:s===n.Product?P:s===n.ExternalProduct?k:!1,[s,L,P,k]),$=g(()=>({[i.Received]:o.receivedLabel,[i.Pending]:o.pendingLabel,[i.ApproveFail]:o.failedLabel,[i.ApproveSuccess]:o.approveSuccessLabel,[i.Unfulfilled]:o.unfulfilledLabel,[i.Fulfilled]:o.fulfilledLabel,[i.Failed]:o.failedLabel,[i.GogiftPending]:o.gogiftPendingLabel||o.pendingLabel,[i.GogiftApproved]:o.gogiftApprovedLabel||o.approveSuccessLabel,[i.GogiftSecondConfirm]:o.gogiftSecondConfirmLabel||o.approveSuccessLabel,[i.GogiftRejected]:o.gogiftRejectedLabel||o.failedLabel,[i.GogiftCallbackPending]:o.gogiftCallbackPendingLabel||o.pendingLabel,[i.GogiftCallbackSuccess]:o.gogiftCallbackSuccessLabel||o.receivedLabel,[i.GogiftCallbackTimeout]:o.gogiftCallbackTimeoutLabel||o.failedLabel}),[o]),R=g(()=>({[i.Received]:"",[i.Pending]:o.pendingTip,[i.ApproveFail]:"",[i.ApproveSuccess]:o.confirmedTip,[i.Unfulfilled]:o.processingTip,[i.Fulfilled]:o.ShippedTip,[i.Failed]:"",[i.GogiftPending]:o.gogiftPendingTip||"",[i.GogiftApproved]:o.gogiftApprovedTip||"",[i.GogiftSecondConfirm]:o.gogiftSecondConfirmTip||"",[i.GogiftRejected]:o.gogiftRejectedTip||"",[i.GogiftCallbackPending]:o.gogiftCallbackPendingTip||"",[i.GogiftCallbackSuccess]:o.gogiftCallbackSuccessTip||"",[i.GogiftCallbackTimeout]:o.gogiftCallbackTimeoutTip||""}),[o]),q=g(()=>({[i.Received]:"#52C41A",[i.Pending]:"#999",[i.ApproveFail]:"#F84D4F",[i.ApproveSuccess]:"#999",[i.Unfulfilled]:"#999",[i.Fulfilled]:"#999",[i.Failed]:"#F84D4F",[i.GogiftPending]:"#999",[i.GogiftApproved]:"#999",[i.GogiftSecondConfirm]:"#999",[i.GogiftRejected]:"#F84D4F",[i.GogiftCallbackPending]:"#999",[i.GogiftCallbackSuccess]:"#52C41A",[i.GogiftCallbackTimeout]:"#F84D4F"}),[]),B=w(()=>{G&&(s===n.Coupon?F(c+1):s===n.Product?D(d+1):s===n.ExternalProduct&&h(f+1))},[s,d,c,f,G]),K=w((e,t)=>{T(t),X(e),setTimeout(()=>{T(-1)},2e3)},[]),_=s===n.Coupon?Y:s===n.Product?z:H;return r(ee,{title:o.title,className:b("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"md:mb-0",...a,onScrollEnd:B,children:[l("div",{className:"",children:l(V,{align:"left",shape:C?"rounded":"square",value:s.toString(),onValueChange:e=>{A(Number(e))},children:l(J,{children:O.map(e=>l(Q,{value:e.type.toString(),children:e.title},e.type))})})}),_&&l("div",{className:"flex h-full flex-col items-center justify-center",children:l(oe,{})}),!_&&l("div",{className:"mt-[24px] overflow-auto overscroll-contain",children:S.length>0?l("div",{className:"grid gap-[18px] md:gap-[12px]",children:S.map((e,t)=>r("div",{className:"grid gap-[8px]",children:[e?.orderNumber&&r("div",{className:"text-[15px] font-semibold leading-[1.4] text-[#777]",children:[o.orderNumberLabel,": ",e.orderNumber]}),r("div",{className:b("flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]",!C&&"rounded-none"),children:[r("div",{className:"grid gap-[4px]",children:[l("div",{className:"text-[16px] font-bold leading-[1.4]",children:e.title}),r("div",{className:"text-[14px] font-semibold text-[#999]",children:[o.valueLabel,": ",e.value," ",o?.pointUnit]}),r("div",{className:"text-[14px] font-semibold text-[#999]",children:[e?.couponCode?`${o?.code||"Code"}: ${e.couponCode} `:"",e?.couponCode&&l("span",{className:"cursor-pointer text-[14px] font-semibold text-brand underline",onClick:()=>{K(e.couponCode,t)},role:"button",tabIndex:0,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&u.preventDefault()},children:j===t?o?.copied||"COPIED":o?.copy||"COPY"})]}),e?.link&&l("div",{className:"text-[14px] font-semibold text-[#999]",children:l("a",{href:e.link,target:"_blank",rel:"noopener noreferrer",className:"text-brand underline",children:o?.redeemLinkLabel||"Redeem Link"})})]}),r("div",{className:"grid gap-[4px] text-right",children:[r("div",{className:b("flex items-center justify-end text-[16px] font-bold leading-[1.4]",`text-[${q[e.type]}]`),children:[l("span",{children:$[e.type]}),R[e.type]&&l(ie,{info:R[e.type],index:t})]}),l("div",{className:"text-[14px] font-semibold text-[#999]",children:Z(e.date).format("YYYY-MM-DD HH:mm").toString()})]})]})]},t))}):r("div",{className:"flex h-full flex-col items-center justify-center",children:[l(W,{className:"mb-[12px] w-[160px]",source:o?.emptyListImage?.url,alt:o?.emptyListImage?.alt||"empty list image"}),l("div",{className:"text-[16px] font-semibold leading-[1.4]",children:o?.emptyListLabel})]})})]})}var Ce=le;export{Ce as default};
|
|
2
2
|
//# sourceMappingURL=MyRewardsModal.js.map
|