@anker-in/campaign-ui 0.1.10 → 0.2.0-beta.2
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/chat/action.js +1 -1
- package/dist/cjs/components/chat/action.js.map +1 -1
- package/dist/cjs/components/chat/button.d.ts +1 -1
- package/dist/cjs/components/chat/button.js +1 -1
- package/dist/cjs/components/chat/button.js.map +1 -1
- package/dist/cjs/components/chat/index.js +1 -1
- package/dist/cjs/components/chat/index.js.map +3 -3
- package/dist/cjs/components/chat/{Messages.d.ts → messages.d.ts} +1 -1
- package/dist/cjs/components/chat/messages.js +1 -1
- package/dist/cjs/components/chat/messages.js.map +2 -2
- package/dist/cjs/components/chat/props.js +1 -1
- package/dist/cjs/components/chat/props.js.map +2 -2
- package/dist/cjs/components/chat/response.js +1 -1
- package/dist/cjs/components/chat/response.js.map +2 -2
- package/dist/cjs/components/chat/suggestions.d.ts +1 -1
- package/dist/cjs/components/chat/suggestions.js.map +1 -1
- package/dist/cjs/components/credits/const.d.ts +1 -0
- package/dist/cjs/components/credits/const.js +2 -0
- package/dist/cjs/components/credits/const.js.map +7 -0
- package/dist/cjs/components/credits/context/const.d.ts +82 -0
- package/dist/cjs/components/credits/context/const.js +2 -0
- package/dist/cjs/components/credits/context/const.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useActivities.d.ts +12 -0
- package/dist/cjs/components/credits/context/hooks/useActivities.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useActivities.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useAddressValidate.d.ts +34 -0
- package/dist/cjs/components/credits/context/hooks/useAddressValidate.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useAddressValidate.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useAlpcFetch.d.ts +23 -0
- package/dist/cjs/components/credits/context/hooks/useAlpcFetch.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useAlpcFetch.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useClickOutside.d.ts +3 -0
- package/dist/cjs/components/credits/context/hooks/useClickOutside.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useClickOutside.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useCopy.d.ts +5 -0
- package/dist/cjs/components/credits/context/hooks/useCopy.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useCopy.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useCountries.d.ts +8 -0
- package/dist/cjs/components/credits/context/hooks/useCountries.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useCountries.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useFirstPurchaseFinished.d.ts +1 -0
- package/dist/cjs/components/credits/context/hooks/useFirstPurchaseFinished.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useFirstPurchaseFinished.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useMyRewards.d.ts +14 -0
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useReceiptUploaded.d.ts +2 -0
- package/dist/cjs/components/credits/context/hooks/useReceiptUploaded.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useReceiptUploaded.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.d.ts +9 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemAndBuy.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.d.ts +18 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.d.ts +16 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.d.ts +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useSubscribed.d.ts +1 -0
- package/dist/cjs/components/credits/context/hooks/useSubscribed.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useSubscribed.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useUploadReceipt.d.ts +14 -0
- package/dist/cjs/components/credits/context/hooks/useUploadReceipt.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useUploadReceipt.js.map +7 -0
- package/dist/cjs/components/credits/context/provider.d.ts +24 -0
- package/dist/cjs/components/credits/context/provider.js +2 -0
- package/dist/cjs/components/credits/context/provider.js.map +7 -0
- package/dist/cjs/components/credits/context/response.d.ts +63 -0
- package/dist/cjs/components/credits/context/response.js +2 -0
- package/dist/cjs/components/credits/context/response.js.map +7 -0
- package/dist/cjs/components/credits/context/utils.d.ts +25 -0
- package/dist/cjs/components/credits/context/utils.js +2 -0
- package/dist/cjs/components/credits/context/utils.js.map +7 -0
- package/dist/cjs/components/credits/creditsBanner/index.d.ts +23 -0
- package/dist/cjs/components/credits/creditsBanner/index.js +2 -0
- package/dist/cjs/components/credits/creditsBanner/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.d.ts +19 -0
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +2 -0
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsBenefits/iconInfo.d.ts +2 -0
- package/dist/cjs/components/credits/creditsBenefits/iconInfo.js +2 -0
- package/dist/cjs/components/credits/creditsBenefits/iconInfo.js.map +7 -0
- package/dist/cjs/components/credits/creditsBenefits/index.d.ts +11 -0
- package/dist/cjs/components/credits/creditsBenefits/index.js +4 -0
- package/dist/cjs/components/credits/creditsBenefits/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsCash/CreditsCash.d.ts +4 -0
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js +2 -0
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +7 -0
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.d.ts +9 -0
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +2 -0
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsCash/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsCash/index.js +2 -0
- package/dist/cjs/components/credits/creditsCash/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsCash/type.d.ts +47 -0
- package/dist/cjs/components/credits/creditsCash/type.js +2 -0
- package/dist/cjs/components/credits/creditsCash/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.d.ts +13 -0
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js +2 -0
- package/dist/cjs/components/credits/creditsFaq/faqItem/FaqItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsFaq/index.d.ts +16 -0
- package/dist/cjs/components/credits/creditsFaq/index.js +2 -0
- package/dist/cjs/components/credits/creditsFaq/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +16 -0
- package/dist/cjs/components/credits/creditsInfoCard/index.js +2 -0
- package/dist/cjs/components/credits/creditsInfoCard/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.d.ts +14 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/FormItem.d.ts +6 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/FormItem.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/FormItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/Input.d.ts +13 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/Input.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/Input.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.d.ts +15 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/type.d.ts +26 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/type.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/AddressForm/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.d.ts +4 -0
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.d.ts +4 -0
- package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/NonProductValue.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +9 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +20 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.d.ts +8 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +11 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +6 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +8 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +13 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +11 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.d.ts +9 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/index.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +63 -0
- package/dist/cjs/components/credits/creditsRedeemList/type.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.d.ts +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +7 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +49 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.d.ts +105 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js +2 -0
- package/dist/cjs/components/credits/creditsWaysToGetCredits/useActions.js.map +7 -0
- package/dist/cjs/components/credits/index.d.ts +10 -0
- package/dist/cjs/components/credits/index.js +2 -0
- package/dist/cjs/components/credits/index.js.map +7 -0
- package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +32 -0
- package/dist/cjs/components/credits/modal/MyRewardsModal.js +2 -0
- package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/activitiesModal.d.ts +32 -0
- package/dist/cjs/components/credits/modal/activitiesModal.js +2 -0
- package/dist/cjs/components/credits/modal/activitiesModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.d.ts +24 -0
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js +2 -0
- package/dist/cjs/components/credits/modal/creditsUploadReceiptModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/loadingDots.d.ts +6 -0
- package/dist/cjs/components/credits/modal/loadingDots.js +2 -0
- package/dist/cjs/components/credits/modal/loadingDots.js.map +7 -0
- package/dist/cjs/components/credits/modal/modalContainer.d.ts +15 -0
- package/dist/cjs/components/credits/modal/modalContainer.js +2 -0
- package/dist/cjs/components/credits/modal/modalContainer.js.map +7 -0
- package/dist/cjs/components/credits/modal/rulesModal.d.ts +7 -0
- package/dist/cjs/components/credits/modal/rulesModal.js +2 -0
- package/dist/cjs/components/credits/modal/rulesModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/subscribeModal.d.ts +15 -0
- package/dist/cjs/components/credits/modal/subscribeModal.js +2 -0
- package/dist/cjs/components/credits/modal/subscribeModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/tip.d.ts +5 -0
- package/dist/cjs/components/credits/modal/tip.js +2 -0
- package/dist/cjs/components/credits/modal/tip.js.map +7 -0
- package/dist/cjs/components/credits/type.d.ts +72 -0
- package/dist/cjs/components/credits/type.js +2 -0
- package/dist/cjs/components/credits/type.js.map +7 -0
- package/dist/cjs/components/index.d.ts +4 -2
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +3 -3
- package/dist/cjs/components/registration/authCodeActivate/Message.d.ts +4 -0
- package/dist/cjs/components/registration/authCodeActivate/Message.js +2 -0
- package/dist/cjs/components/registration/authCodeActivate/Message.js.map +7 -0
- package/dist/cjs/components/registration/authCodeActivate/index.d.ts +3 -0
- package/dist/cjs/components/registration/authCodeActivate/index.js +2 -0
- package/dist/cjs/components/registration/authCodeActivate/index.js.map +7 -0
- package/dist/cjs/components/registration/authCodeActivate/type.d.ts +23 -0
- package/dist/cjs/components/registration/authCodeActivate/type.js +2 -0
- package/dist/cjs/components/registration/authCodeActivate/type.js.map +7 -0
- package/dist/cjs/components/registration/context/index.d.ts +1 -0
- package/dist/cjs/components/registration/context/index.js +2 -0
- package/dist/cjs/components/registration/context/index.js.map +7 -0
- package/dist/cjs/components/registration/context/provider.d.ts +25 -0
- package/dist/cjs/components/registration/context/provider.js +2 -0
- package/dist/cjs/components/registration/context/provider.js.map +7 -0
- package/dist/cjs/components/registration/index.d.ts +2 -0
- package/dist/cjs/components/registration/index.js +2 -0
- package/dist/cjs/components/registration/index.js.map +7 -0
- package/dist/cjs/components/registration/modalContainer.d.ts +15 -0
- package/dist/cjs/components/registration/modalContainer.js +2 -0
- package/dist/cjs/components/registration/modalContainer.js.map +7 -0
- package/dist/cjs/debug-env.d.ts +7 -0
- package/dist/cjs/debug-env.js +2 -0
- package/dist/cjs/debug-env.js.map +7 -0
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/stories/chat.stories.d.ts +1 -1
- package/dist/cjs/stories/chat.stories.js +1 -1
- package/dist/cjs/stories/chat.stories.js.map +3 -3
- package/dist/cjs/templates/credits.d.ts +58 -0
- package/dist/cjs/templates/credits.js +2 -0
- package/dist/cjs/templates/credits.js.map +7 -0
- package/dist/cjs/templates/index.d.ts +1 -0
- package/dist/cjs/templates/index.js +2 -0
- package/dist/cjs/templates/index.js.map +7 -0
- package/dist/esm/components/chat/action.js +1 -1
- package/dist/esm/components/chat/action.js.map +1 -1
- package/dist/esm/components/chat/button.d.ts +1 -1
- package/dist/esm/components/chat/button.js +1 -1
- package/dist/esm/components/chat/button.js.map +1 -1
- package/dist/esm/components/chat/index.js +1 -1
- package/dist/esm/components/chat/index.js.map +2 -2
- package/dist/esm/components/chat/{Messages.d.ts → messages.d.ts} +1 -1
- package/dist/esm/components/chat/messages.js +1 -1
- package/dist/esm/components/chat/messages.js.map +2 -2
- package/dist/esm/components/chat/props.js +0 -1
- package/dist/esm/components/chat/props.js.map +3 -3
- package/dist/esm/components/chat/response.js +1 -1
- package/dist/esm/components/chat/response.js.map +2 -2
- package/dist/esm/components/chat/suggestions.d.ts +1 -1
- package/dist/esm/components/chat/suggestions.js.map +1 -1
- package/dist/esm/components/credits/const.d.ts +1 -0
- package/dist/esm/components/credits/const.js +2 -0
- package/dist/esm/components/credits/const.js.map +7 -0
- package/dist/esm/components/credits/context/const.d.ts +82 -0
- package/dist/esm/components/credits/context/const.js +2 -0
- package/dist/esm/components/credits/context/const.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useActivities.d.ts +12 -0
- package/dist/esm/components/credits/context/hooks/useActivities.js +2 -0
- package/dist/esm/components/credits/context/hooks/useActivities.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useAddressValidate.d.ts +34 -0
- package/dist/esm/components/credits/context/hooks/useAddressValidate.js +2 -0
- package/dist/esm/components/credits/context/hooks/useAddressValidate.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useAlpcFetch.d.ts +23 -0
- package/dist/esm/components/credits/context/hooks/useAlpcFetch.js +2 -0
- package/dist/esm/components/credits/context/hooks/useAlpcFetch.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useClickOutside.d.ts +3 -0
- package/dist/esm/components/credits/context/hooks/useClickOutside.js +2 -0
- package/dist/esm/components/credits/context/hooks/useClickOutside.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useCopy.d.ts +5 -0
- package/dist/esm/components/credits/context/hooks/useCopy.js +2 -0
- package/dist/esm/components/credits/context/hooks/useCopy.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useCountries.d.ts +8 -0
- package/dist/esm/components/credits/context/hooks/useCountries.js +2 -0
- package/dist/esm/components/credits/context/hooks/useCountries.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useFirstPurchaseFinished.d.ts +1 -0
- package/dist/esm/components/credits/context/hooks/useFirstPurchaseFinished.js +2 -0
- package/dist/esm/components/credits/context/hooks/useFirstPurchaseFinished.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useMyRewards.d.ts +14 -0
- package/dist/esm/components/credits/context/hooks/useMyRewards.js +2 -0
- package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useReceiptUploaded.d.ts +2 -0
- package/dist/esm/components/credits/context/hooks/useReceiptUploaded.js +2 -0
- package/dist/esm/components/credits/context/hooks/useReceiptUploaded.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.d.ts +9 -0
- package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemAndBuy.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.d.ts +18 -0
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.d.ts +16 -0
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemableList.d.ts +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useSubscribed.d.ts +1 -0
- package/dist/esm/components/credits/context/hooks/useSubscribed.js +2 -0
- package/dist/esm/components/credits/context/hooks/useSubscribed.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useUploadReceipt.d.ts +14 -0
- package/dist/esm/components/credits/context/hooks/useUploadReceipt.js +2 -0
- package/dist/esm/components/credits/context/hooks/useUploadReceipt.js.map +7 -0
- package/dist/esm/components/credits/context/provider.d.ts +24 -0
- package/dist/esm/components/credits/context/provider.js +2 -0
- package/dist/esm/components/credits/context/provider.js.map +7 -0
- package/dist/esm/components/credits/context/response.d.ts +63 -0
- package/dist/esm/components/credits/context/response.js +1 -0
- package/dist/esm/components/credits/context/utils.d.ts +25 -0
- package/dist/esm/components/credits/context/utils.js +2 -0
- package/dist/esm/components/credits/context/utils.js.map +7 -0
- package/dist/esm/components/credits/creditsBanner/index.d.ts +23 -0
- package/dist/esm/components/credits/creditsBanner/index.js +2 -0
- package/dist/esm/components/credits/creditsBanner/index.js.map +7 -0
- package/dist/esm/components/credits/creditsBenefits/benefitItem.d.ts +19 -0
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js +2 -0
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +7 -0
- package/dist/esm/components/credits/creditsBenefits/iconInfo.d.ts +2 -0
- package/dist/esm/components/credits/creditsBenefits/iconInfo.js +2 -0
- package/dist/esm/components/credits/creditsBenefits/iconInfo.js.map +7 -0
- package/dist/esm/components/credits/creditsBenefits/index.d.ts +11 -0
- package/dist/esm/components/credits/creditsBenefits/index.js +4 -0
- package/dist/esm/components/credits/creditsBenefits/index.js.map +7 -0
- package/dist/esm/components/credits/creditsCash/CreditsCash.d.ts +4 -0
- package/dist/esm/components/credits/creditsCash/CreditsCash.js +2 -0
- package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +7 -0
- package/dist/esm/components/credits/creditsCash/RedeemableItem.d.ts +9 -0
- package/dist/esm/components/credits/creditsCash/RedeemableItem.js +2 -0
- package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +7 -0
- package/dist/esm/components/credits/creditsCash/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsCash/index.js +2 -0
- package/dist/esm/components/credits/creditsCash/index.js.map +7 -0
- package/dist/esm/components/credits/creditsCash/type.d.ts +47 -0
- package/dist/esm/components/credits/creditsCash/type.js +1 -0
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.d.ts +13 -0
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js +2 -0
- package/dist/esm/components/credits/creditsFaq/faqItem/FaqItem.js.map +7 -0
- package/dist/esm/components/credits/creditsFaq/index.d.ts +16 -0
- package/dist/esm/components/credits/creditsFaq/index.js +2 -0
- package/dist/esm/components/credits/creditsFaq/index.js.map +7 -0
- package/dist/esm/components/credits/creditsInfoCard/index.d.ts +16 -0
- package/dist/esm/components/credits/creditsInfoCard/index.js +2 -0
- package/dist/esm/components/credits/creditsInfoCard/index.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.d.ts +14 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/CountrySelect.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.d.ts +6 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/FormItem.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.d.ts +13 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/Input.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.d.ts +15 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/StateSelect.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/index.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.d.ts +26 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.js +1 -0
- package/dist/esm/components/credits/creditsRedeemList/AddressForm/type.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.d.ts +4 -0
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/NonProductValue.d.ts +4 -0
- package/dist/esm/components/credits/creditsRedeemList/NonProductValue.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/NonProductValue.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +9 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +20 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.d.ts +8 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +11 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +6 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +8 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +13 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +11 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.d.ts +9 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsRedeemList/index.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/index.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/type.d.ts +63 -0
- package/dist/esm/components/credits/creditsRedeemList/type.js +1 -0
- package/dist/esm/components/credits/creditsRedeemList/type.js.map +7 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.d.ts +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +7 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/index.js +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/index.js.map +7 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +49 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.js +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +7 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.d.ts +105 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js +2 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/useActions.js.map +7 -0
- package/dist/esm/components/credits/index.d.ts +10 -0
- package/dist/esm/components/credits/index.js +2 -0
- package/dist/esm/components/credits/index.js.map +7 -0
- package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +32 -0
- package/dist/esm/components/credits/modal/MyRewardsModal.js +2 -0
- package/dist/esm/components/credits/modal/MyRewardsModal.js.map +7 -0
- package/dist/esm/components/credits/modal/activitiesModal.d.ts +32 -0
- package/dist/esm/components/credits/modal/activitiesModal.js +2 -0
- package/dist/esm/components/credits/modal/activitiesModal.js.map +7 -0
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.d.ts +24 -0
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js +2 -0
- package/dist/esm/components/credits/modal/creditsUploadReceiptModal.js.map +7 -0
- package/dist/esm/components/credits/modal/loadingDots.d.ts +6 -0
- package/dist/esm/components/credits/modal/loadingDots.js +2 -0
- package/dist/esm/components/credits/modal/loadingDots.js.map +7 -0
- package/dist/esm/components/credits/modal/modalContainer.d.ts +15 -0
- package/dist/esm/components/credits/modal/modalContainer.js +2 -0
- package/dist/esm/components/credits/modal/modalContainer.js.map +7 -0
- package/dist/esm/components/credits/modal/rulesModal.d.ts +7 -0
- package/dist/esm/components/credits/modal/rulesModal.js +2 -0
- package/dist/esm/components/credits/modal/rulesModal.js.map +7 -0
- package/dist/esm/components/credits/modal/subscribeModal.d.ts +15 -0
- package/dist/esm/components/credits/modal/subscribeModal.js +2 -0
- package/dist/esm/components/credits/modal/subscribeModal.js.map +7 -0
- package/dist/esm/components/credits/modal/tip.d.ts +5 -0
- package/dist/esm/components/credits/modal/tip.js +2 -0
- package/dist/esm/components/credits/modal/tip.js.map +7 -0
- package/dist/esm/components/credits/type.d.ts +72 -0
- package/dist/esm/components/credits/type.js +1 -0
- package/dist/esm/components/credits/type.js.map +7 -0
- package/dist/esm/components/index.d.ts +4 -2
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +2 -2
- package/dist/esm/components/registration/authCodeActivate/Message.d.ts +4 -0
- package/dist/esm/components/registration/authCodeActivate/Message.js +2 -0
- package/dist/esm/components/registration/authCodeActivate/Message.js.map +7 -0
- package/dist/esm/components/registration/authCodeActivate/index.d.ts +3 -0
- package/dist/esm/components/registration/authCodeActivate/index.js +2 -0
- package/dist/esm/components/registration/authCodeActivate/index.js.map +7 -0
- package/dist/esm/components/registration/authCodeActivate/type.d.ts +23 -0
- package/dist/esm/components/registration/authCodeActivate/type.js +1 -0
- package/dist/esm/components/registration/authCodeActivate/type.js.map +7 -0
- package/dist/esm/components/registration/context/index.d.ts +1 -0
- package/dist/esm/components/registration/context/index.js +2 -0
- package/dist/esm/components/registration/context/index.js.map +7 -0
- package/dist/esm/components/registration/context/provider.d.ts +25 -0
- package/dist/esm/components/registration/context/provider.js +2 -0
- package/dist/esm/components/registration/context/provider.js.map +7 -0
- package/dist/esm/components/registration/index.d.ts +2 -0
- package/dist/esm/components/registration/index.js +2 -0
- package/dist/esm/components/registration/index.js.map +7 -0
- package/dist/esm/components/registration/modalContainer.d.ts +15 -0
- package/dist/esm/components/registration/modalContainer.js +2 -0
- package/dist/esm/components/registration/modalContainer.js.map +7 -0
- package/dist/esm/debug-env.d.ts +7 -0
- package/dist/esm/debug-env.js +2 -0
- package/dist/esm/debug-env.js.map +7 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/stories/chat.stories.d.ts +1 -1
- package/dist/esm/stories/chat.stories.js +1 -1
- package/dist/esm/stories/chat.stories.js.map +2 -2
- package/dist/esm/templates/credits.d.ts +58 -0
- package/dist/esm/templates/credits.js +2 -0
- package/dist/esm/templates/credits.js.map +7 -0
- package/dist/esm/templates/index.d.ts +1 -0
- package/dist/esm/templates/index.js +2 -0
- package/dist/esm/templates/index.js.map +7 -0
- package/package.json +47 -33
- package/src/components/chat/button.tsx +1 -1
- package/src/components/chat/index.tsx +6 -6
- package/src/components/chat/messages.tsx +2 -2
- package/src/components/chat/response.tsx +1 -4
- package/src/components/chat/suggestions.tsx +1 -1
- package/src/components/credits/const.ts +1 -0
- package/src/components/credits/context/const.ts +104 -0
- package/src/components/credits/context/hooks/useActivities.ts +70 -0
- package/src/components/credits/context/hooks/useAddressValidate.ts +281 -0
- package/src/components/credits/context/hooks/useAlpcFetch.ts +295 -0
- package/src/components/credits/context/hooks/useClickOutside.ts +34 -0
- package/src/components/credits/context/hooks/useCopy.ts +35 -0
- package/src/components/credits/context/hooks/useCountries.ts +55 -0
- package/src/components/credits/context/hooks/useFirstPurchaseFinished.ts +24 -0
- package/src/components/credits/context/hooks/useMyRewards.ts +97 -0
- package/src/components/credits/context/hooks/useReceiptUploaded.ts +24 -0
- package/src/components/credits/context/hooks/useRedeemAndBuy.ts +57 -0
- package/src/components/credits/context/hooks/useRedeemCoupon.ts +34 -0
- package/src/components/credits/context/hooks/useRedeemProduct.ts +34 -0
- package/src/components/credits/context/hooks/useRedeemableList.ts +77 -0
- package/src/components/credits/context/hooks/useSubscribed.ts +36 -0
- package/src/components/credits/context/hooks/useUploadReceipt.tsx +29 -0
- package/src/components/credits/context/provider.tsx +85 -0
- package/src/components/credits/context/response.ts +72 -0
- package/src/components/credits/context/utils.ts +149 -0
- package/src/components/credits/creditsBanner/index.tsx +103 -0
- package/src/components/credits/creditsBenefits/benefitItem.tsx +91 -0
- package/src/components/credits/creditsBenefits/iconInfo.tsx +23 -0
- package/src/components/credits/creditsBenefits/index.tsx +116 -0
- package/src/components/credits/creditsCash/CreditsCash.tsx +85 -0
- package/src/components/credits/creditsCash/RedeemableItem.tsx +207 -0
- package/src/components/credits/creditsCash/index.ts +2 -0
- package/src/components/credits/creditsCash/type.ts +46 -0
- package/src/components/credits/creditsFaq/faqItem/FaqItem.tsx +95 -0
- package/src/components/credits/creditsFaq/index.tsx +89 -0
- package/src/components/credits/creditsInfoCard/index.tsx +184 -0
- package/src/components/credits/creditsRedeemList/AddressForm/CountrySelect.tsx +116 -0
- package/src/components/credits/creditsRedeemList/AddressForm/FormItem.tsx +23 -0
- package/src/components/credits/creditsRedeemList/AddressForm/Input.tsx +58 -0
- package/src/components/credits/creditsRedeemList/AddressForm/StateSelect.tsx +131 -0
- package/src/components/credits/creditsRedeemList/AddressForm/index.tsx +157 -0
- package/src/components/credits/creditsRedeemList/AddressForm/type.ts +24 -0
- package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +178 -0
- package/src/components/credits/creditsRedeemList/NonProductValue.tsx +39 -0
- package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +211 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +74 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Error.tsx +14 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +123 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx +25 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +74 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +49 -0
- package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +195 -0
- package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +183 -0
- package/src/components/credits/creditsRedeemList/index.ts +2 -0
- package/src/components/credits/creditsRedeemList/type.ts +63 -0
- package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +235 -0
- package/src/components/credits/creditsWaysToGetCredits/index.ts +2 -0
- package/src/components/credits/creditsWaysToGetCredits/type.ts +53 -0
- package/src/components/credits/creditsWaysToGetCredits/useActions.ts +228 -0
- package/src/components/credits/index.ts +11 -0
- package/src/components/credits/modal/MyRewardsModal.tsx +330 -0
- package/src/components/credits/modal/activitiesModal.tsx +264 -0
- package/src/components/credits/modal/creditsUploadReceiptModal.tsx +150 -0
- package/src/components/credits/modal/loadingDots.tsx +19 -0
- package/src/components/credits/modal/modalContainer.tsx +117 -0
- package/src/components/credits/modal/rulesModal.tsx +44 -0
- package/src/components/credits/modal/subscribeModal.tsx +224 -0
- package/src/components/credits/modal/tip.tsx +102 -0
- package/src/components/credits/type.ts +77 -0
- package/src/components/index.ts +6 -4
- package/src/components/registration/authCodeActivate/Message.tsx +43 -0
- package/src/components/registration/authCodeActivate/index.tsx +298 -0
- package/src/components/registration/authCodeActivate/type.ts +24 -0
- package/src/components/registration/context/index.tsx +1 -0
- package/src/components/registration/context/provider.tsx +77 -0
- package/src/components/registration/index.ts +2 -0
- package/src/components/registration/modalContainer.tsx +112 -0
- package/src/debug-env.ts +18 -0
- package/src/index.ts +2 -1
- package/src/stories/chat.stories.tsx +1 -1
- package/{dist/esm/styles/chat.css → src/styles/global.css} +1 -0
- package/src/templates/credits.tsx +124 -0
- package/src/templates/index.ts +1 -0
- package/style.css +1 -0
- package/tailwind.config.ts +82 -0
- package/dist/cjs/components/animation/CodeEditor.d.ts +0 -7
- package/dist/cjs/components/animation/CodeEditor.js +0 -2
- package/dist/cjs/components/animation/CodeEditor.js.map +0 -7
- package/dist/cjs/components/animation/Preview.d.ts +0 -5
- package/dist/cjs/components/animation/Preview.js +0 -2
- package/dist/cjs/components/animation/Preview.js.map +0 -7
- package/dist/cjs/components/animation/bannerAni.d.ts +0 -16
- package/dist/cjs/components/animation/bannerAni.js +0 -59
- package/dist/cjs/components/animation/bannerAni.js.map +0 -7
- package/dist/cjs/components/animation/libs.d.js +0 -2
- package/dist/cjs/components/animation/textAni.d.ts +0 -9
- package/dist/cjs/components/animation/textAni.js +0 -2
- package/dist/cjs/components/animation/textAni.js.map +0 -7
- package/dist/cjs/components/chat/message.d.ts +0 -2
- package/dist/cjs/components/chat/response copy.d.ts +0 -2
- package/dist/cjs/components/chat/rresponse.d.ts +0 -2
- package/dist/cjs/components/theme.d.ts +0 -13
- package/dist/cjs/helpers/component-props.d.ts +0 -7
- package/dist/cjs/helpers/component-props.js +0 -2
- package/dist/cjs/helpers/component-props.js.map +0 -7
- package/dist/cjs/helpers/constants.d.ts +0 -2
- package/dist/cjs/helpers/constants.js +0 -2
- package/dist/cjs/helpers/constants.js.map +0 -7
- package/dist/cjs/helpers/fetchResponse.d.ts +0 -14
- package/dist/cjs/helpers/fetchResponse.js +0 -2
- package/dist/cjs/helpers/fetchResponse.js.map +0 -7
- package/dist/cjs/helpers/fetcher.d.ts +0 -2
- package/dist/cjs/helpers/fetcher.js +0 -2
- package/dist/cjs/helpers/fetcher.js.map +0 -7
- package/dist/cjs/helpers/index.d.ts +0 -2
- package/dist/cjs/helpers/index.js +0 -2
- package/dist/cjs/helpers/index.js.map +0 -7
- package/dist/cjs/helpers/utils.d.ts +0 -3
- package/dist/cjs/helpers/utils.js +0 -2
- package/dist/cjs/helpers/utils.js.map +0 -7
- package/dist/cjs/tsconfig.tsbuildinfo +0 -1
- package/dist/esm/components/animation/CodeEditor.d.ts +0 -7
- package/dist/esm/components/animation/CodeEditor.js +0 -2
- package/dist/esm/components/animation/CodeEditor.js.map +0 -7
- package/dist/esm/components/animation/Preview.d.ts +0 -5
- package/dist/esm/components/animation/Preview.js +0 -2
- package/dist/esm/components/animation/Preview.js.map +0 -7
- package/dist/esm/components/animation/bannerAni.d.ts +0 -16
- package/dist/esm/components/animation/bannerAni.js +0 -59
- package/dist/esm/components/animation/bannerAni.js.map +0 -7
- package/dist/esm/components/animation/libs.d.js +0 -2
- package/dist/esm/components/animation/libs.d.js.map +0 -7
- package/dist/esm/components/animation/textAni.d.ts +0 -9
- package/dist/esm/components/animation/textAni.js +0 -2
- package/dist/esm/components/animation/textAni.js.map +0 -7
- package/dist/esm/components/chat/Markdown.d.ts +0 -5
- package/dist/esm/components/chat/marksdown.d.ts +0 -5
- package/dist/esm/components/chat/message.d.ts +0 -2
- package/dist/esm/components/chat/response copy.d.ts +0 -2
- package/dist/esm/components/chat/rresponse.d.ts +0 -2
- package/dist/esm/components/theme.d.ts +0 -13
- package/dist/esm/helpers/component-props.d.ts +0 -7
- package/dist/esm/helpers/component-props.js +0 -1
- package/dist/esm/helpers/constants.d.ts +0 -2
- package/dist/esm/helpers/constants.js +0 -2
- package/dist/esm/helpers/constants.js.map +0 -7
- package/dist/esm/helpers/fetchResponse.d.ts +0 -14
- package/dist/esm/helpers/fetchResponse.js +0 -2
- package/dist/esm/helpers/fetchResponse.js.map +0 -7
- package/dist/esm/helpers/fetcher.d.ts +0 -2
- package/dist/esm/helpers/fetcher.js +0 -2
- package/dist/esm/helpers/fetcher.js.map +0 -7
- package/dist/esm/helpers/index.d.ts +0 -2
- package/dist/esm/helpers/index.js +0 -2
- package/dist/esm/helpers/index.js.map +0 -7
- package/dist/esm/helpers/utils.d.ts +0 -3
- package/dist/esm/helpers/utils.js +0 -2
- package/dist/esm/helpers/utils.js.map +0 -7
- package/dist/esm/styles/css/animations.css +0 -35
- package/dist/esm/styles/css/button.css +0 -56
- package/dist/esm/styles/css/colors.css +0 -12
- package/dist/esm/styles/css/console.css +0 -134
- package/dist/esm/styles/css/header.css +0 -43
- package/dist/esm/styles/css/input.css +0 -89
- package/dist/esm/styles/css/markdown.css +0 -131
- package/dist/esm/styles/css/messages.css +0 -73
- package/dist/esm/styles/css/panel.css +0 -23
- package/dist/esm/styles/css/popup.css +0 -44
- package/dist/esm/styles/css/response.css +0 -26
- package/dist/esm/styles/css/sidebar.css +0 -31
- package/dist/esm/styles/css/suggestions.css +0 -35
- package/dist/esm/styles/css/window.css +0 -60
- package/dist/esm/styles/index.css +0 -1
- package/dist/esm/tsconfig.tsbuildinfo +0 -1
- package/src/helpers/fetchResponse.ts +0 -35
- package/src/helpers/fetcher.ts +0 -44
- package/src/helpers/index.ts +0 -2
- package/src/helpers/utils.ts +0 -8
- /package/dist/cjs/components/chat/{Markdown.d.ts → markdown.d.ts} +0 -0
- /package/dist/cjs/components/chat/{Response.d.ts → response.d.ts} +0 -0
- /package/dist/{cjs/components/chat/marksdown.d.ts → esm/components/chat/markdown.d.ts} +0 -0
- /package/dist/esm/components/chat/{Response.d.ts → response.d.ts} +0 -0
- /package/dist/{cjs/components/animation/libs.d.js.map → esm/components/credits/context/response.js.map} +0 -0
- /package/dist/esm/{helpers/component-props.js.map → components/credits/creditsCash/type.js.map} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CreditsRedeemListCopy } from '../type';
|
|
2
|
+
type ShippingCountry = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
code: string;
|
|
6
|
+
provinces: {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
code: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
export interface AddressFormProps {
|
|
13
|
+
form: CreditsRedeemListCopy['redeemModal']['product']['addressForm'];
|
|
14
|
+
onChange: (address: any) => void;
|
|
15
|
+
validate: (args: {
|
|
16
|
+
force?: boolean;
|
|
17
|
+
ignoreKeys?: string[];
|
|
18
|
+
}) => boolean;
|
|
19
|
+
errors: {
|
|
20
|
+
key: string;
|
|
21
|
+
message: string;
|
|
22
|
+
}[];
|
|
23
|
+
countries: ShippingCountry[];
|
|
24
|
+
countriesLoading: boolean;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=type.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as o,jsxs as Z}from"react/jsx-runtime";import{Container as S,Heading as F,Tabs as H,TabsList as z,TabsTrigger as B}from"@anker-in/headless-ui";import u from"classnames";import{useCallback as D,useMemo as L,useState as c}from"react";import j from"./RedeemCouponModal";import q from"./RedeemProductModal";import{useCreditsContext as w}from"../context/provider";import G from"../context/hooks/useRedeemableList";import{AlpcConsumeType as g,AlpcErrorCode as U}from"../context/const";import{useHeadlessContext as V,useProductsByHandles as J}from"@anker-in/lib";import{RedeemableItem as K}from"./RedeemableItem";import Q from"../modal/rulesModal";import{gaTrack as W}from"@anker-in/lib";import{useRegistration as X}from"../../../components/registration";import{roundedBrands as Y}from"../const";const fe=({copy:s})=>{const{profile:f,openSignUpPopup:x,gtm:{pageGroup:k},pageCommon:_}=w(),{authCodeActivate:b}=X(),{brand:N}=V(),I=Y.includes(N),E=Object.keys(f||{}).length>0,[d,A]=c(s.list[0].label),[n,l]=c(void 0),[m,C]=c(),{listLoading:M,redeemableList:v,getRedeemableList:R}=G(),a=L(()=>v.map(e=>({id:e.id.toString(),title:e.name,consumeCredits:e.consume_credits,remainingInventory:e.remaining_inventory,isLimited:!!e.is_limited,consumeType:e.consume_type,handle:e.sku_handle,sku:e.goods_sku,image:e.goods_url})),[s.list,d,v]),P=a.map(e=>e.handle),{data:y}=J({handles:P}),O=L(()=>s.list.find(t=>t.label===d)?.list.filter(t=>a.some(i=>i.id===t.id)).map(t=>{const i=a.find(r=>r.id===t.id),p=y?.find(r=>r.handle===i?.handle),h=p?.variants.find(r=>r.sku===i?.sku);return i?.consumeType===g.Product&&(!p||!h)?null:{alpc:a.find(r=>r.id===t.id),config:t,product:p,variant:h}}).filter(t=>t!==null),[a,y]),T=D(e=>{e===U.CodeLpcRuleInventoryNotEnough&&R()},[R]);return Z(S,{className:u("relative bg-[#F5F5F7]"),children:[o(F,{as:"h2",size:"4",html:s.title}),o(H,{shape:I?"rounded":"square",align:"left",className:u("sticky top-0 z-20 py-[24px] md:justify-center"),value:d.toString(),onValueChange:e=>{A(e),W({event:"ga4Event",event_name:"lp_navigation",event_parameters:{navigation:e,page_group:k}})},children:o(z,{children:s.list.map(e=>o(B,{value:e.label,children:e.label},e.label))})}),!!a?.length&&!M&&o("div",{className:u("relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3"),children:O?.map(e=>o(K,{copy:s,item:e,onRedeem:t=>{E?!f?.activated&&!b.isActivateSuccess?b.open():l(t):x()},onRulesOpen:C},e?.alpc?.id))}),n?.alpc?.consumeType===g.Coupon&&s?.redeemModal?.coupon&&n&&o(j,{isOpen:!!n,item:n,copy:s,onError:T,onClose:()=>{l(void 0)}}),n?.alpc?.consumeType===g.Product&&s?.redeemModal&&n&&o(q,{isOpen:!!n,item:n,copy:s,onError:T,onClose:()=>{l(void 0)}}),m&&o(Q,{overlayClassName:"md:px-[16px] md:items-center",className:"md:h-fit md:rounded-b-[16px]",isOpen:m.length>0,onClose:()=>C([]),titleClassName:"border-b-transparent h-[56px]",rules:m,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:_?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};export{fe as CreditsRedeemList};
|
|
2
|
+
//# sourceMappingURL=CreditsRedeemList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsRedeemList/CreditsRedeemList.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Container, Heading, Tabs, TabsList, TabsTrigger } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport RedeemCouponModal from './RedeemCouponModal'\nimport RedeemProductModal from './RedeemProductModal'\nimport { useCreditsContext } from '../context/provider'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport { AlpcConsumeType, AlpcErrorCode } from '../context/const'\nimport { useHeadlessContext, useProductsByHandles } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { RedeemableItem } from './RedeemableItem'\nimport RulesModal from '../modal/rulesModal'\nimport { CreditsRedeemListCopy } from './type'\nimport { gaTrack } from '@anker-in/lib'\nimport { useRegistration } from '../../../components/registration'\nimport { roundedBrands } from '../const'\n\nexport const CreditsRedeemList = ({ copy }: { copy: CreditsRedeemListCopy }) => {\n const {\n profile,\n openSignUpPopup,\n gtm: { pageGroup },\n pageCommon,\n } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = roundedBrands.includes(brand)\n\n const isLogin = Object.keys(profile || {}).length > 0\n\n const [activeTab, setActiveTab] = useState<string>(copy.list[0].label)\n\n const [popRedeemData, setPopRedeemData] = useState<RedeemableItemType | undefined>(undefined)\n\n const [rules, setRules] = useState<string | string[]>()\n\n const { listLoading, redeemableList, getRedeemableList } = useRedeemableList()\n\n const alpcList = useMemo(() => {\n return redeemableList.map(item => {\n return {\n id: item.id.toString(),\n title: item.name,\n consumeCredits: item.consume_credits,\n remainingInventory: item.remaining_inventory,\n isLimited: !!item.is_limited,\n consumeType: item.consume_type,\n handle: item.sku_handle,\n sku: item.goods_sku,\n image: item.goods_url,\n }\n })\n }, [copy.list, activeTab, redeemableList])\n\n const handles = alpcList.map(item => item.handle)\n const { data: products } = useProductsByHandles({ handles })\n\n const list = useMemo(() => {\n const currentList = copy.list.find(item => item.label === activeTab)\n return currentList?.list\n .filter(item => alpcList.some(alpcItem => alpcItem.id === item.id))\n .map(item => {\n const alpcItem = alpcList.find(alpcItem => alpcItem.id === item.id)\n const product = products?.find(product => product.handle === alpcItem?.handle)\n const variant = product?.variants.find(variant => variant.sku === alpcItem?.sku)\n if (alpcItem?.consumeType === AlpcConsumeType.Product && (!product || !variant)) return null\n return {\n alpc: alpcList.find(alpcItem => alpcItem.id === item.id),\n config: item,\n product,\n variant,\n }\n })\n .filter(item => item !== null) as unknown as RedeemableItemType[]\n }, [alpcList, products])\n\n const handleRedeemError = useCallback(\n (errorCode: AlpcErrorCode) => {\n if (errorCode === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n getRedeemableList()\n }\n },\n [getRedeemableList]\n )\n\n return (\n <Container className={classNames('relative bg-[#F5F5F7]')}>\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n\n <Tabs\n shape={rounded ? 'rounded' : 'square'}\n align=\"left\"\n className={classNames('sticky top-0 z-20 py-[24px] md:justify-center')}\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(value)\n gaTrack({\n event: 'ga4Event',\n event_name: 'lp_navigation',\n event_parameters: {\n navigation: value,\n page_group: pageGroup,\n },\n })\n }}\n >\n <TabsList>\n {copy.list.map(item => (\n <TabsTrigger key={item.label} value={item.label}>\n {item.label}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n {/* PC\u7AEF */}\n {!!alpcList?.length && !listLoading && (\n <div\n className={classNames('relative grid grid-cols-4 gap-[16px] md:grid-cols-2 md:gap-[12px] md-xl:grid-cols-3')}\n >\n {list?.map(item => (\n <RedeemableItem\n key={item?.alpc?.id}\n copy={copy}\n item={item}\n onRedeem={(item: RedeemableItemType) => {\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !authCodeActivate.isActivateSuccess) {\n authCodeActivate.open()\n } else {\n setPopRedeemData(item)\n }\n }}\n onRulesOpen={setRules}\n />\n ))}\n </div>\n )}\n\n {popRedeemData?.alpc?.consumeType === AlpcConsumeType.Coupon && copy?.redeemModal?.coupon && popRedeemData && (\n <RedeemCouponModal\n isOpen={!!popRedeemData}\n item={popRedeemData}\n copy={copy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {popRedeemData?.alpc?.consumeType === AlpcConsumeType.Product && copy?.redeemModal && popRedeemData && (\n <RedeemProductModal\n isOpen={!!popRedeemData}\n item={popRedeemData}\n copy={copy}\n onError={handleRedeemError}\n onClose={() => {\n setPopRedeemData(undefined)\n }}\n />\n )}\n {rules && (\n <RulesModal\n overlayClassName=\"md:px-[16px] md:items-center\"\n className=\"md:h-fit md:rounded-b-[16px]\"\n isOpen={rules.length > 0}\n onClose={() => setRules([])}\n titleClassName=\"border-b-transparent h-[56px]\"\n rules={rules}\n scrollClassName=\"md:mt-[8px] md:mb-[24px] md:pt-0\"\n title={pageCommon?.ruleLabel}\n ruleClassName=\"text-[#1d1d1f] font-bold\"\n />\n )}\n </Container>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAuFI,OACE,OAAAA,EADF,QAAAC,MAAA,oBAvFJ,OAAS,aAAAC,EAAW,WAAAC,EAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,MAAmB,wBAChE,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,WAAAC,EAAS,YAAAC,MAAgB,QAE/C,OAAOC,MAAuB,sBAC9B,OAAOC,MAAwB,uBAC/B,OAAS,qBAAAC,MAAyB,sBAClC,OAAOC,MAAuB,qCAC9B,OAAS,mBAAAC,EAAiB,iBAAAC,MAAqB,mBAC/C,OAAS,sBA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,CAACH,GACtBxC,EAAC,OACC,UAAWO,EAAW,qFAAqF,EAE1G,SAAAwC,GAAM,IAAIH,GACT5C,EAACmB,EAAA,CAEC,KAAMM,EACN,KAAMmB,EACN,SAAWA,GAA6B,CACjCX,EAEM,CAACP,GAAS,WAAa,CAACI,EAAiB,kBAClDA,EAAiB,KAAK,EAEtBO,EAAiBO,CAAI,EAJrBjB,EAAgB,CAMpB,EACA,YAAaY,GAZRK,GAAM,MAAM,EAanB,CACD,EACH,EAGDR,GAAe,MAAM,cAAgBrB,EAAgB,QAAUU,GAAM,aAAa,QAAUW,GAC3FpC,EAACW,EAAA,CACC,OAAQ,CAAC,CAACyB,EACV,KAAMA,EACN,KAAMX,EACN,QAAS0B,EACT,QAAS,IAAM,CACbd,EAAiB,MAAS,CAC5B,EACF,EAEDD,GAAe,MAAM,cAAgBrB,EAAgB,SAAWU,GAAM,aAAeW,GACpFpC,EAACY,EAAA,CACC,OAAQ,CAAC,CAACwB,EACV,KAAMA,EACN,KAAMX,EACN,QAAS0B,EACT,QAAS,IAAM,CACbd,EAAiB,MAAS,CAC5B,EACF,EAEDC,GACCtC,EAACoB,EAAA,CACC,iBAAiB,+BACjB,UAAU,+BACV,OAAQkB,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOT,GAAY,UACnB,cAAc,2BAChB,GAEJ,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Container", "Heading", "Tabs", "TabsList", "TabsTrigger", "classNames", "useCallback", "useMemo", "useState", "RedeemCouponModal", "RedeemProductModal", "useCreditsContext", "useRedeemableList", "AlpcConsumeType", "AlpcErrorCode", "useHeadlessContext", "useProductsByHandles", "RedeemableItem", "RulesModal", "gaTrack", "useRegistration", "roundedBrands", "CreditsRedeemList", "copy", "profile", "openSignUpPopup", "pageGroup", "pageCommon", "authCodeActivate", "brand", "rounded", "isLogin", "activeTab", "setActiveTab", "popRedeemData", "setPopRedeemData", "rules", "setRules", "listLoading", "redeemableList", "getRedeemableList", "alpcList", "item", "handles", "products", "list", "alpcItem", "product", "variant", "handleRedeemError", "errorCode", "value"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as m}from"react/jsx-runtime";import{Text as l}from"@anker-in/headless-ui";import{ConsumeType as o}from"../context/const";import{useCreditsContext as p}from"../context/provider";const s=({item:t})=>{const{pageCommon:x}=p();return t.config?.type===o.ShippingCoupon?e("div",{className:"absolute left-[16px] l-xxl:left-[12px] bottom-[8px] l:left-[8px] font-extrabold text-white md:bottom-[4px] md:left-[5px]",children:e(l,{className:"text-[32px] font-bold leading-none md:text-[12px] l-xxl:text-[20px] w-[70%] md:w-full md-l:text-[14px]",html:t.config?.value,as:"p"})}):e("div",{className:"absolute left-[16px] l-xxl:left-[12px] l:left-[8px] bottom-[8px] font-extrabold text-white md:bottom-[4px] md:left-[5px]",children:t.config?.value?m("div",{className:"flex items-end",children:[e(l,{className:"text-[64px] font-extrabold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]",html:t.config?.value.toString()}),e(l,{className:"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]",html:t.config?.type===o.GiftCard?x?.giftCardLabel:x?.off})]}):e(l,{className:"text-[24px] w-[70%] font-bold leading-none",html:t.config?.title,as:"p"})})};export{s as NoneProductValue};
|
|
2
|
+
//# sourceMappingURL=NonProductValue.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsRedeemList/NonProductValue.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { RedeemableItem } from '../type'\nimport { ConsumeType } from '../context/const'\nimport { useCreditsContext } from '../context/provider'\n\nexport const NoneProductValue = ({ item }: { item: RedeemableItem }) => {\n const { pageCommon } = useCreditsContext()\n // shipping coupon \u4EC5\u5C55\u793A\u6587\u6848\n if (item.config?.type === ConsumeType.ShippingCoupon) {\n return (\n <div className=\"absolute left-[16px] l-xxl:left-[12px] bottom-[8px] l:left-[8px] font-extrabold text-white md:bottom-[4px] md:left-[5px]\">\n <Text\n className=\"text-[32px] font-bold leading-none md:text-[12px] l-xxl:text-[20px] w-[70%] md:w-full md-l:text-[14px]\"\n html={item.config?.value}\n as=\"p\"\n />\n </div>\n )\n } else {\n return (\n <div className=\"absolute left-[16px] l-xxl:left-[12px] l:left-[8px] bottom-[8px] font-extrabold text-white md:bottom-[4px] md:left-[5px]\">\n {item.config?.value ? (\n <div className=\"flex items-end\">\n <Text\n className=\"text-[64px] font-extrabold leading-none md:text-[20px] l-xxl:text-[40px] md-l:text-[22px]\"\n html={item.config?.value.toString()}\n />\n <Text\n className=\"ml-[4px] text-[24px] font-bold leading-[2] md:ml-[2px] l:text-[12px] xxl:leading-[1.4] l-xxl:text-[20px]\"\n html={item.config?.type === ConsumeType.GiftCard ? pageCommon?.giftCardLabel : pageCommon?.off}\n />\n </div>\n ) : (\n <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.title} as=\"p\" />\n )}\n </div>\n )\n }\n}\n"],
|
|
5
|
+
"mappings": "AAWQ,cAAAA,EAWE,QAAAC,MAXF,oBAXR,OAAS,QAAAC,MAAY,wBAErB,OAAS,eAAAC,MAAmB,mBAC5B,OAAS,qBAAAC,MAAyB,sBAE3B,MAAMC,EAAmB,CAAC,CAAE,KAAAC,CAAK,IAAgC,CACtE,KAAM,CAAE,WAAAC,CAAW,EAAIH,EAAkB,EAEzC,OAAIE,EAAK,QAAQ,OAASH,EAAY,eAElCH,EAAC,OAAI,UAAU,2HACb,SAAAA,EAACE,EAAA,CACC,UAAU,yGACV,KAAMI,EAAK,QAAQ,MACnB,GAAG,IACL,EACF,EAIAN,EAAC,OAAI,UAAU,2HACZ,SAAAM,EAAK,QAAQ,MACZL,EAAC,OAAI,UAAU,iBACb,UAAAD,EAACE,EAAA,CACC,UAAU,4FACV,KAAMI,EAAK,QAAQ,MAAM,SAAS,EACpC,EACAN,EAACE,EAAA,CACC,UAAU,2GACV,KAAMI,EAAK,QAAQ,OAASH,EAAY,SAAWI,GAAY,cAAgBA,GAAY,IAC7F,GACF,EAEAP,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMI,EAAK,QAAQ,MAAO,GAAG,IAAI,EAElG,CAGN",
|
|
6
|
+
"names": ["jsx", "jsxs", "Text", "ConsumeType", "useCreditsContext", "NoneProductValue", "item", "pageCommon"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ModalContainerProps } from '../modal/modalContainer';
|
|
2
|
+
import type { RedeemableItem as RedeemableItemType } from '../type';
|
|
3
|
+
import { CreditsRedeemListCopy } from './type';
|
|
4
|
+
declare function RedeemCouponModal({ item, copy, onError, ...props }: ModalContainerProps & {
|
|
5
|
+
item: RedeemableItemType;
|
|
6
|
+
copy: CreditsRedeemListCopy;
|
|
7
|
+
onError: (code: number) => void;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default RedeemCouponModal;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as E,jsx as t,jsxs as l}from"react/jsx-runtime";import{Button as y,Picture as k,Text as i}from"@anker-in/headless-ui";import u from"classnames";import{useCallback as I,useEffect as L,useState as f}from"react";import _ from"../context/hooks/useCopy";import{useCreditsContext as B}from"../context/provider";import{useRedeemCoupon as S}from"../context/hooks/useRedeemCoupon";import{AlpcErrorCode as x}from"../context/const";import{CreditsModalContainer as P}from"../modal/modalContainer";import{numberFormat as z}from"../context/utils";import{useHeadlessContext as O}from"@anker-in/lib";import{NoneProductValue as U}from"./RedeemProductModal/NonProductValue";function A({item:d,copy:o,onError:g,...a}){const{locale:w}=O(),[s,F]=f(),[C,n]=f(),[b,p]=f(!1),{copy:R,copied:v}=_(),{profile:c,fetchCreditInfo:N,pageCommon:m}=B(),{isMutating:h,trigger:M}=S({onSuccess(e){if(!e){n(o.redeemModal.commonError);return}if(e?.data?.success)F(e.data.coupon_code),N(c?.user_id);else{let r;e.code===x.CodeLpcShopifyCouponRuleRedeemLimit?(r=o.redeemModal.redeemLimitError,p(!0)):e.code===x.CodeLpcRuleInventoryNotEnough?(r=o.redeemModal.inventoryNotEnough,p(!0)):e.code===x.CodeLpcNotEnoughCredits?(r=o.redeemModal.creditsNotEnough,p(!0),N(c?.user_id)):e.code===x.CodeCrossSiteError&&(r=o.redeemModal.crossSiteError,p(!0)),n(r||o.redeemModal.commonError||""),g&&g(e.code)}},onError(e){n(e.message||o.redeemModal.commonError)}}),T=I(async()=>{n(""),M({user_id:c?.user_id,rule_id:Number(d.alpc?.id)})},[d,c,M]);return L(()=>{a.isOpen||(p(!1),n(""))},[a.isOpen]),l(P,{...a,className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-0 md:mb-[24px] px-0",titleClassName:"h-[56px] bg-[#F5F5F7]",children:[l("div",{className:u("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:[m?.imageMapping?.[d.config?.type]?.url&&t(k,{source:m.imageMapping[d.config.type].url,className:"h-full [&_img]:h-full"}),t("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:d.config.value?t(U,{item:d,copy:o}):t(i,{size:3,html:d.alpc?.title})})]}),s?l("div",{className:"mt-[30px] flex items-center justify-center md:mt-[18px]",children:[t("div",{className:"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]",children:s}),t("div",{className:u("cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]",v?"pointer-events-none":"pointer-events-auto"),onClick:()=>{R(s)},role:"button",tabIndex:0,onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.preventDefault()},children:v?m?.copied:m?.copy})]}):l(i,{as:"p",className:u("mt-[30px] text-center text-[24px] font-bold leading-[1.2] md:mt-[18px] md:text-[20px] md:leading-[1.2]"),children:[z(d.alpc?.consumeCredits)," ",m?.pointUnit]}),!s&&d.config?.rules?.length>0&&l("div",{className:"mt-[18px] w-full text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px] md:text-[14px]",children:[l("div",{className:"mb-[4px]",children:[m?.ruleLabel,":"]}),t("ul",{className:"ml-4 grid grid-flow-row gap-[4px]",children:d.config?.rules?.map((e,r)=>t("li",{className:"list-disc",children:t(i,{html:e})},r))})]})]}),l("div",{className:"bg-white px-[48px] pt-[24px] text-center md:px-[16px]",children:[s&&!h?l(E,{children:[l("div",{className:"flex flex-col",children:[t(i,{className:"mb-[4px] text-[24px] font-bold leading-[1.2] md:text-[20px]",html:o.redeemModal.coupon.successTitle}),t(i,{className:"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]",html:o.redeemModal.coupon.successDesc})]}),t(y,{variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:()=>{window.location.href=o.redeemModal.coupon.successButtonUrl||`/${w}`,a.onClose&&a.onClose()},disabled:b,children:o.redeemModal.coupon.successButton})]}):l(E,{children:[t(i,{className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:o.redeemModal.confirmTitle}),t(y,{loading:h,variant:"primary",size:"lg",className:"mt-[16px] w-full",onClick:T,disabled:b,children:o.redeemModal.confirmButton})]}),C&&t("div",{className:"mx-auto max-w-full py-[12px] text-center text-[#FF0000]",children:t(i,{className:"text-[14px] font-semibold text-[#1F2021]",html:C})})]})]})}var Z=A;export{Z as default};
|
|
2
|
+
//# sourceMappingURL=RedeemCouponModal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsRedeemList/RedeemCouponModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { ModalContainerProps } from '../modal/modalContainer'\nimport useCopy from '../context/hooks/useCopy'\nimport { useCreditsContext } from '../context/provider'\nimport { useRedeemCoupon } from '../context/hooks/useRedeemCoupon'\nimport { AlpcErrorCode } from '../context/const'\nimport { CreditsModalContainer } from '../modal/modalContainer'\nimport { numberFormat } from '../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { CreditsRedeemListCopy } from './type'\nimport { NoneProductValue } from './RedeemProductModal/NonProductValue'\n\nfunction RedeemCouponModal({\n item,\n copy,\n onError,\n ...props\n}: ModalContainerProps & {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n onError: (code: number) => void\n}) {\n const { locale } = useHeadlessContext()\n const [couponCode, setCouponCode] = useState<string>()\n const [errorInfo, setErrorInfo] = useState<string>()\n\n const [disabled, setDisabled] = useState(false)\n const { copy: copyText, copied: copiedStatus } = useCopy()\n\n const { profile, fetchCreditInfo, pageCommon } = useCreditsContext()\n\n const { isMutating: loading, trigger } = useRedeemCoupon({\n onSuccess(responseData) {\n if (!responseData) {\n setErrorInfo(copy.redeemModal.commonError)\n return\n }\n\n if (responseData?.data?.success) {\n setCouponCode(responseData.data.coupon_code)\n fetchCreditInfo(profile?.user_id)\n } else {\n let errorMsg\n if (responseData.code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n errorMsg = copy.redeemModal.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.redeemModal.inventoryNotEnough\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.redeemModal.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.redeemModal.crossSiteError\n setDisabled(true)\n }\n\n setErrorInfo(errorMsg || copy.redeemModal.commonError || '')\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setErrorInfo(error.message || copy.redeemModal.commonError)\n },\n })\n\n const handleConfirm = useCallback(async () => {\n setErrorInfo('')\n trigger({\n user_id: profile?.user_id,\n rule_id: Number(item.alpc?.id),\n })\n }, [item, profile, trigger])\n\n useEffect(() => {\n if (!props.isOpen) {\n setDisabled(false)\n setErrorInfo('')\n }\n }, [props.isOpen])\n\n return (\n <CreditsModalContainer\n {...props}\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 <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} copy={copy} />\n ) : (\n <Text size={3} html={item.alpc?.title} />\n )}\n </div>\n </div>\n {couponCode ? (\n <div className=\"mt-[30px] flex items-center justify-center md:mt-[18px]\">\n <div className=\"mr-[10px] text-[24px] font-bold leading-[1.4] md:leading-[1.2]\">{couponCode}</div>\n <div\n className={classNames(\n 'cursor-pointer text-[16px] font-bold leading-[1.2] underline md:text-[14px]',\n copiedStatus ? 'pointer-events-none' : 'pointer-events-auto'\n )}\n onClick={() => {\n copyText(couponCode)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copiedStatus ? pageCommon?.copied : pageCommon?.copy}\n </div>\n </div>\n ) : (\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 )}\n {!couponCode && 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 {couponCode && !loading ? (\n <>\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.redeemModal.coupon.successTitle}\n ></Text>\n <Text\n className=\"text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:text-[14px]\"\n html={copy.redeemModal.coupon.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.redeemModal.coupon.successButtonUrl || `/${locale}`\n if (props.onClose) {\n props.onClose()\n }\n }}\n disabled={disabled}\n >\n {copy.redeemModal.coupon.successButton}\n </Button>\n </>\n ) : (\n <>\n <Text\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full\"\n onClick={handleConfirm}\n disabled={disabled}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </>\n )}\n {errorInfo && (\n <div className=\"mx-auto max-w-full py-[12px] text-center text-[#FF0000]\">\n <Text className=\"text-[14px] font-semibold text-[#1F2021]\" html={errorInfo} />\n </div>\n )}\n </div>\n </CreditsModalContainer>\n )\n}\n\nexport default RedeemCouponModal\n"],
|
|
5
|
+
"mappings": "AAiGQ,OA2DE,YAAAA,EAzDE,OAAAC,EAFJ,QAAAC,MAAA,oBAjGR,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,eAAAC,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAOC,MAAa,2BACpB,OAAS,qBAAAC,MAAyB,sBAClC,OAAS,mBAAAC,MAAuB,mCAChC,OAAS,iBAAAC,MAAqB,mBAC9B,OAAS,yBAAAC,MAA6B,0BACtC,OAAS,gBAAAC,MAAoB,mBAE7B,OAAS,sBAAAC,MAA0B,gBAEnC,OAAS,oBAAAC,MAAwB,uCAEjC,SAASC,EAAkB,CACzB,KAAAC,EACA,KAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAIG,CACD,KAAM,CAAE,OAAAC,CAAO,EAAIP,EAAmB,EAChC,CAACQ,EAAYC,CAAa,EAAIhB,EAAiB,EAC/C,CAACiB,EAAWC,CAAY,EAAIlB,EAAiB,EAE7C,CAACmB,EAAUC,CAAW,EAAIpB,EAAS,EAAK,EACxC,CAAE,KAAMqB,EAAU,OAAQC,CAAa,EAAIrB,EAAQ,EAEnD,CAAE,QAAAsB,EAAS,gBAAAC,EAAiB,WAAAC,CAAW,EAAIvB,EAAkB,EAE7D,CAAE,WAAYwB,EAAS,QAAAC,CAAQ,EAAIxB,EAAgB,CACvD,UAAUyB,EAAc,CACtB,GAAI,CAACA,EAAc,CACjBV,EAAaP,EAAK,YAAY,WAAW,EACzC,MACF,CAEA,GAAIiB,GAAc,MAAM,QACtBZ,EAAcY,EAAa,KAAK,WAAW,EAC3CJ,EAAgBD,GAAS,OAAO,MAC3B,CACL,IAAIM,EACAD,EAAa,OAASxB,EAAc,qCACtCyB,EAAWl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AUM,EAET,SAAAR,EAAK,YAAY,OAAO,cAC3B,GACF,EAEAlB,EAAAF,EAAA,CACE,UAAAC,EAACI,EAAA,CACC,UAAU,4EACV,KAAMe,EAAK,YAAY,aACxB,EACDnB,EAACE,EAAA,CACC,QAASgC,EACT,QAAQ,UACR,KAAK,KACL,UAAU,mBACV,QAASK,EACT,SAAUZ,EAET,SAAAR,EAAK,YAAY,cACpB,GACF,EAEDM,GACCzB,EAAC,OAAI,UAAU,0DACb,SAAAA,EAACI,EAAA,CAAK,UAAU,2CAA2C,KAAMqB,EAAW,EAC9E,GAEJ,GACF,CAEJ,CAEA,IAAOiB,EAAQzB",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useCallback", "useEffect", "useState", "useCopy", "useCreditsContext", "useRedeemCoupon", "AlpcErrorCode", "CreditsModalContainer", "numberFormat", "useHeadlessContext", "NoneProductValue", "RedeemCouponModal", "item", "copy", "onError", "props", "locale", "couponCode", "setCouponCode", "errorInfo", "setErrorInfo", "disabled", "setDisabled", "copyText", "copiedStatus", "profile", "fetchCreditInfo", "pageCommon", "loading", "trigger", "responseData", "errorMsg", "error", "handleConfirm", "text", "index", "RedeemCouponModal_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RedeemableItem as RedeemableItemType } from '../../type';
|
|
2
|
+
import { CreditsRedeemListCopy } from '../type';
|
|
3
|
+
type AddressProps = {
|
|
4
|
+
copy: CreditsRedeemListCopy;
|
|
5
|
+
shippingAddress: string;
|
|
6
|
+
setAddress: (address: Record<string, any>) => void;
|
|
7
|
+
validateAddress: (address: Record<string, any>) => boolean;
|
|
8
|
+
validateErrors: {
|
|
9
|
+
key: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}[];
|
|
12
|
+
item: RedeemableItemType;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
address: Record<string, any> | undefined;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
handlePayment: () => void;
|
|
17
|
+
shippingProduct: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const Address: ({ copy, shippingAddress, setAddress, validateAddress, validateErrors, shippingProduct, loading, address, disabled, handlePayment, item, }: AddressProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Button as h,Text as r}from"@anker-in/headless-ui";import i from"classnames";import{AddressForm as C}from"../AddressForm";import{useHeadlessContext as N}from"@anker-in/lib";import{ProductInfo as R}from"./ProductInfo";import A from"../../context/hooks/useCountries";import{roundedBrands as F}from"../../const";const E=({copy:t,shippingAddress:d,setAddress:m,validateAddress:a,validateErrors:n,shippingProduct:s,loading:p,address:l,disabled:x,handlePayment:c,item:u})=>{const{storeDomain:f,brand:y}=N(),v=F.includes(y),{countries:b=[],isLoading:g}=A({shopifyStoreDomain:f});return o("div",{className:"relative",children:[e("div",{className:i("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:o("div",{children:[d&&e(r,{className:"mb-5 text-[16px] font-bold",html:d}),e(C,{onChange:m,validate:a,errors:n,form:t.redeemModal.product.addressForm,countries:b,countriesLoading:g})]})}),o("div",{className:"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]",children:[o("div",{className:i("flex w-full items-center bg-[#F5F5F7] p-[16px]",!v&&"rounded-none"),children:[s&&e(r,{className:"mb-5 text-[16px] font-bold",html:s}),e(R,{item:u,copy:t})]}),e(h,{loading:p||!l,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:c,disabled:x,children:t.redeemModal.product.paymentButton})]})]})};export{E as Address};
|
|
2
|
+
//# sourceMappingURL=Address.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { AddressForm } from '../AddressForm'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport useCountries from '../../context/hooks/useCountries'\nimport { roundedBrands } from '../../const'\n\ntype AddressProps = {\n copy: CreditsRedeemListCopy\n shippingAddress: string\n setAddress: (address: Record<string, any>) => void\n validateAddress: (address: Record<string, any>) => boolean\n validateErrors: { key: string; message: string }[]\n item: RedeemableItemType\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n handlePayment: () => void\n shippingProduct: string\n}\n\nexport const Address = ({\n copy,\n shippingAddress,\n setAddress,\n validateAddress,\n validateErrors,\n shippingProduct,\n loading,\n address,\n disabled,\n handlePayment,\n item,\n}: AddressProps) => {\n const { storeDomain, brand } = useHeadlessContext()\n const rounded = roundedBrands.includes(brand)\n const { countries = [], isLoading: countriesLoading } = useCountries({ shopifyStoreDomain: storeDomain })\n\n return (\n <div className=\"relative\">\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div>\n {shippingAddress && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingAddress}></Text>}\n <AddressForm\n onChange={setAddress}\n validate={validateAddress}\n errors={validateErrors}\n form={copy.redeemModal.product.addressForm}\n countries={countries}\n countriesLoading={countriesLoading}\n ></AddressForm>\n </div>\n </div>\n <div className=\"sticky bottom-0 flex flex-col items-center justify-center bg-white px-[48px] py-[24px] l:px-[16px]\">\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n <ProductInfo item={item} copy={copy} />\n </div>\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={handlePayment}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "AA4CQ,OACsB,OAAAA,EADtB,QAAAC,MAAA,oBA5CR,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aACvB,OAAS,eAAAC,MAAmB,iBAC5B,OAAS,sBAAAC,MAA0B,gBAGnC,OAAS,eAAAC,MAAmB,gBAC5B,OAAOC,MAAkB,mCACzB,OAAS,iBAAAC,MAAqB,cAgBvB,MAAMC,EAAU,CAAC,CACtB,KAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,QAAAC,EACA,SAAAC,EACA,cAAAC,EACA,KAAAC,CACF,IAAoB,CAClB,KAAM,CAAE,YAAAC,EAAa,MAAAC,CAAM,EAAIjB,EAAmB,EAC5CkB,EAAUf,EAAc,SAASc,CAAK,EACtC,CAAE,UAAAE,EAAY,CAAC,EAAG,UAAWC,CAAiB,EAAIlB,EAAa,CAAE,mBAAoBc,CAAY,CAAC,EAExG,OACErB,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OACE,UAAAW,GAAmBZ,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMS,EAAiB,EACxFZ,EAACK,EAAA,CACC,SAAUQ,EACV,SAAUC,EACV,OAAQC,EACR,KAAMJ,EAAK,YAAY,QAAQ,YAC/B,UAAWc,EACX,iBAAkBC,EACnB,GACH,EACF,EACAzB,EAAC,OAAI,UAAU,qGACb,UAAAA,EAAC,OAAI,UAAWG,EAAW,iDAAkD,CAACoB,GAAW,cAAc,EACpG,UAAAR,GAAmBhB,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMa,EAAiB,EACxFhB,EAACO,EAAA,CAAY,KAAMc,EAAM,KAAMV,EAAM,GACvC,EACAX,EAACE,EAAA,CACC,QAASe,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAR,EAAK,YAAY,QAAQ,cAC5B,GACF,GACF,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Button", "Text", "classNames", "AddressForm", "useHeadlessContext", "ProductInfo", "useCountries", "roundedBrands", "Address", "copy", "shippingAddress", "setAddress", "validateAddress", "validateErrors", "shippingProduct", "loading", "address", "disabled", "handlePayment", "item", "storeDomain", "brand", "rounded", "countries", "countriesLoading"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Picture as t,Text as s}from"@anker-in/headless-ui";const x=({errorInfo:r})=>a("div",{className:"mx-auto max-w-[404px] text-[16px] text-black/40",children:[e(t,{className:"mx-auto mb-[12px] h-[140px] w-[220px]",source:r.imageUrl}),e(s,{as:"div",className:"mt-[16px] text-center",html:r.message})]});export{x as Error};
|
|
2
|
+
//# sourceMappingURL=Error.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Error.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Picture, Text } from '@anker-in/headless-ui'\n\ntype ErrorProps = {\n errorInfo: { imageUrl: string; message: string }\n}\n\nexport const Error = ({ errorInfo }: ErrorProps) => {\n return (\n <div className=\"mx-auto max-w-[404px] text-[16px] text-black/40\">\n <Picture className=\"mx-auto mb-[12px] h-[140px] w-[220px]\" source={errorInfo.imageUrl} />\n <Text as=\"div\" className=\"mt-[16px] text-center\" html={errorInfo.message} />\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAQI,OACE,OAAAA,EADF,QAAAC,MAAA,oBARJ,OAAS,WAAAC,EAAS,QAAAC,MAAY,wBAMvB,MAAMC,EAAQ,CAAC,CAAE,UAAAC,CAAU,IAE9BJ,EAAC,OAAI,UAAU,kDACb,UAAAD,EAACE,EAAA,CAAQ,UAAU,wCAAwC,OAAQG,EAAU,SAAU,EACvFL,EAACG,EAAA,CAAK,GAAG,MAAM,UAAU,wBAAwB,KAAME,EAAU,QAAS,GAC5E",
|
|
6
|
+
"names": ["jsx", "jsxs", "Picture", "Text", "Error", "errorInfo"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RedeemableItem as RedeemableItemType } from '../../type';
|
|
2
|
+
import { CreditsRedeemListCopy } from '../type';
|
|
3
|
+
type InitProps = {
|
|
4
|
+
copy: CreditsRedeemListCopy;
|
|
5
|
+
item: RedeemableItemType;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
setStatus: (status: 'address' | 'init' | 'success' | 'error') => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const Init: ({ copy, item, loading, disabled, setStatus }: InitProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as w,jsx as e,jsxs as o}from"react/jsx-runtime";import{Button as u,Picture as m,Text as i}from"@anker-in/headless-ui";import a from"classnames";import{Fragment as f,useMemo as g}from"react";import{numberFormat as v}from"../../context/utils";import{ConsumeType as b}from"../../context/const";import{NoneProductValue as N}from"./NonProductValue";import{useCreditsContext as h}from"../../context/provider";const B=({copy:s,item:t,loading:x,disabled:n,setStatus:c})=>{const{pageCommon:p}=h(),r=g(()=>t.config.rules?.length?t.config.rules:[...t.config.desc?.split("<br>")||[],...s.redeemModal.product.rules||[]],[t.config.rules,t.config.desc,s.redeemModal.product.rules]);return o("div",{className:"flex flex-col",children:[e("div",{className:a("max-h-[500px] overflow-y-auto bg-[#F5F5F7] px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:o(w,{children:[o("div",{className:"relative mx-auto h-[164px] w-fit",children:[e(m,{source:t.config?.type===b.Product?t.product.images[0]?.url:p?.imageMapping?.[t.config.type]?.url||t.config.image?.url,className:"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),e("div",{className:"absolute bottom-[8px] left-[16px] font-extrabold text-white",children:t.config.value&&e(N,{item:t,copy:s})})]}),o("div",{className:"mt-[30px] md:mt-[18px]",children:[t.config.type==="product"&&e("div",{className:a("mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:t.config.title}),o(i,{as:"p",className:a(" text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]"),children:[v(t.alpc?.consumeCredits)," ",p?.pointUnit]})]}),o("div",{className:"mt-[16px] w-full text-[14px] font-semibold text-[#777] md:mt-[12px]",children:[e("div",{className:"text-[16px] font-bold leading-[1.4]",children:s.redeemModal.product.stepTitle}),e("div",{className:"mt-[4px] flex items-center justify-center",children:s.redeemModal.product.steps?.map((d,l)=>o(f,{children:[o("div",{className:"flex w-[76px] flex-col items-center text-center md:h-[94px] min-l:w-[130px]",children:[e(m,{source:d.imageUrl,className:"mb-[4px] h-[58px] w-[58px]"}),e("div",{className:"min-h-[34px] text-[14px] font-bold text-[#777] md:min-h-[28px] md:text-[12px]",children:d.title})]}),l!==s.redeemModal.product.steps.length-1&&e(m,{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]"})]},l))}),e("div",{className:"overflow-auto",children:r?.length&&e("ul",{className:"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]",children:r.map((d,l)=>e("li",{className:"list-disc",children:e(i,{as:"div",html:d,className:"font-bold"})},l))})})]})]})}),o("div",{className:"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]",children:[e(i,{as:"p",className:"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]",html:s.redeemModal.confirmTitle}),e(u,{loading:x,disabled:n,variant:"primary",size:"lg",className:"mt-[16px] w-full md:mt-[12px]",onClick:()=>{c("address")},children:s.redeemModal.confirmButton})]})]})};export{B as Init};
|
|
2
|
+
//# sourceMappingURL=Init.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Button, Picture, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport { Fragment, useMemo } from 'react'\nimport { numberFormat } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\nimport { NoneProductValue } from './NonProductValue'\nimport { useCreditsContext } from '../../context/provider'\n\ntype InitProps = {\n copy: CreditsRedeemListCopy\n item: RedeemableItemType\n loading: boolean\n disabled: boolean\n setStatus: (status: 'address' | 'init' | 'success' | 'error') => void\n}\n\nexport const Init = ({ copy, item, loading, disabled, setStatus }: InitProps) => {\n const { pageCommon } = useCreditsContext()\n const rules = useMemo(() => {\n if (item.config.rules?.length) {\n return item.config.rules\n }\n const descriptions = item.config.desc?.split('<br>') || []\n return [...descriptions, ...(copy.redeemModal.product.rules || [])]\n }, [item.config.rules, item.config.desc, copy.redeemModal.product.rules])\n\n return (\n <div className=\"flex flex-col\">\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 <>\n <div className=\"relative mx-auto h-[164px] w-fit\">\n <Picture\n source={\n item.config?.type === ConsumeType.Product\n ? item.product.images[0]?.url\n : pageCommon?.imageMapping?.[item.config.type]?.url || item.config.image?.url\n }\n className=\"h-full w-auto [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n ></Picture>\n {/* \u793C\u54C1\u5361\u5C55\u793A */}\n <div className=\"absolute bottom-[8px] left-[16px] font-extrabold text-white\">\n {item.config.value && <NoneProductValue item={item} copy={copy} />}\n </div>\n </div>\n <div className=\"mt-[30px] md:mt-[18px]\">\n {item.config.type === 'product' && (\n <div\n className={classNames(\n 'mb-[4px] text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]'\n )}\n >\n {item.config.title}\n </div>\n )}\n <Text\n as=\"p\"\n className={classNames(' text-center text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]')}\n >\n {numberFormat(item.alpc?.consumeCredits)} {pageCommon?.pointUnit}\n </Text>\n </div>\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.redeemModal.product.stepTitle}</div>\n <div className=\"mt-[4px] flex items-center justify-center\">\n {copy.redeemModal.product.steps?.map((item, 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={item.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 {item.title}\n </div>\n </div>\n {index !== copy.redeemModal.product.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 className=\"overflow-auto\">\n {rules?.length && (\n <ul className=\"ml-[18px] mt-[16px] grid grid-flow-row gap-[4px] text-[16px] font-bold leading-[1.4] text-[#6D6D6F] md:mt-[12px]\">\n {rules.map((text, index) => (\n <li className=\"list-disc\" key={index}>\n <Text as=\"div\" html={text} className=\"font-bold\" />\n </li>\n ))}\n </ul>\n )}\n </div>\n </div>\n </>\n </div>\n <div className=\"flex-1 bg-white px-[48px] py-[24px] text-center md:px-[16px]\">\n <Text\n as=\"p\"\n className=\"block text-[24px] font-bold leading-[1.2] md:text-[20px] md:leading-[1.2]\"\n html={copy.redeemModal.confirmTitle}\n ></Text>\n <Button\n loading={loading}\n disabled={disabled}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[16px] w-full md:mt-[12px]\"\n onClick={() => {\n setStatus('address')\n }}\n >\n {copy.redeemModal.confirmButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAmCQ,mBAAAA,EAEI,OAAAC,EADF,QAAAC,MADF,oBAnCR,OAAS,UAAAC,EAAQ,WAAAC,EAAS,QAAAC,MAAY,wBACtC,OAAOC,MAAgB,aACvB,OAAS,YAAAN,EAAU,WAAAO,MAAe,QAClC,OAAS,gBAAAC,MAAoB,sBAG7B,OAAS,eAAAC,MAAmB,sBAC5B,OAAS,oBAAAC,MAAwB,oBACjC,OAAS,qBAAAC,MAAyB,yBAU3B,MAAMC,EAAO,CAAC,CAAE,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAS,SAAAC,EAAU,UAAAC,CAAU,IAAiB,CAC/E,KAAM,CAAE,WAAAC,CAAW,EAAIP,EAAkB,EACnCQ,EAAQZ,EAAQ,IAChBO,EAAK,OAAO,OAAO,OACdA,EAAK,OAAO,MAGd,CAAC,GADaA,EAAK,OAAO,MAAM,MAAM,MAAM,GAAK,CAAC,EAChC,GAAID,EAAK,YAAY,QAAQ,OAAS,CAAC,CAAE,EACjE,CAACC,EAAK,OAAO,MAAOA,EAAK,OAAO,KAAMD,EAAK,YAAY,QAAQ,KAAK,CAAC,EAExE,OACEX,EAAC,OAAI,UAAU,gBACb,UAAAD,EAAC,OACC,UAAWK,EACT,8FACF,EAEA,SAAAJ,EAAAF,EAAA,CACE,UAAAE,EAAC,OAAI,U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UAAU,YAAY,GADpBD,CAE/B,CACD,EACH,EAEJ,GACF,GACF,EACF,EACAlB,EAAC,OAAI,UAAU,+DACb,UAAAD,EAACI,EAAA,CACC,GAAG,IACH,UAAU,4EACV,KAAMQ,EAAK,YAAY,aACxB,EACDZ,EAACE,EAAA,CACC,QAASY,EACT,SAAUC,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbC,EAAU,SAAS,CACrB,EAEC,SAAAJ,EAAK,YAAY,cACpB,GACF,GACF,CAEJ",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "Button", "Picture", "Text", "classNames", "useMemo", "numberFormat", "ConsumeType", "NoneProductValue", "useCreditsContext", "Init", "copy", "item", "loading", "disabled", "setStatus", "pageCommon", "rules", "index", "text"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as t,jsxs as p}from"react/jsx-runtime";import{Text as o}from"@anker-in/headless-ui";import{ConsumeType as l}from"../../context/const";import{useCreditsContext as a}from"../../context/provider";const x=({item:e,copy:i})=>{const{pageCommon:n}=a();return e.config?.type===l.ShippingCoupon?t(o,{className:"text-[24px] w-[70%] font-bold leading-none",html:e.config?.value,as:"p"}):e.config?.value?p("div",{className:"flex items-end gap-[4px]",children:[t(o,{className:"text-[64px] font-extrabold leading-none",html:e.config.value.toString()}),t(o,{className:"text-[24px] font-bold leading-[2]",html:e.config.type===l.Coupon?n?.off:n?.giftCardLabel})]}):t(o,{className:"text-[24px] w-[70%] font-bold leading-none",html:e.config?.title,as:"p"})};export{x as NoneProductValue};
|
|
2
|
+
//# sourceMappingURL=NonProductValue.js.map
|
package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { RedeemableItem } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ConsumeType } from '../../context/const'\nimport { useCreditsContext } from '../../context/provider'\n\nexport const NoneProductValue = ({ item, copy }: { item: RedeemableItem; copy: CreditsRedeemListCopy }) => {\n const { pageCommon } = useCreditsContext()\n // shipping coupon \u4EC5\u5C55\u793A\u6587\u6848\n if (item.config?.type === ConsumeType.ShippingCoupon) {\n return <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.value} as=\"p\" />\n } else {\n return item.config?.value ? (\n <div className=\"flex items-end gap-[4px]\">\n <Text className=\"text-[64px] font-extrabold leading-none\" html={item.config.value.toString()} />\n <Text\n className=\"text-[24px] font-bold leading-[2]\"\n html={item.config.type === ConsumeType.Coupon ? pageCommon?.off : pageCommon?.giftCardLabel}\n />\n </div>\n ) : (\n <Text className=\"text-[24px] w-[70%] font-bold leading-none\" html={item.config?.title} as=\"p\" />\n )\n }\n}\n"],
|
|
5
|
+
"mappings": "AAUW,cAAAA,EAGL,QAAAC,MAHK,oBAVX,OAAS,QAAAC,MAAY,wBAGrB,OAAS,eAAAC,MAAmB,sBAC5B,OAAS,qBAAAC,MAAyB,yBAE3B,MAAMC,EAAmB,CAAC,CAAE,KAAAC,EAAM,KAAAC,CAAK,IAA6D,CACzG,KAAM,CAAE,WAAAC,CAAW,EAAIJ,EAAkB,EAEzC,OAAIE,EAAK,QAAQ,OAASH,EAAY,eAC7BH,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMI,EAAK,QAAQ,MAAO,GAAG,IAAI,EAE9FA,EAAK,QAAQ,MAClBL,EAAC,OAAI,UAAU,2BACb,UAAAD,EAACE,EAAA,CAAK,UAAU,0CAA0C,KAAMI,EAAK,OAAO,MAAM,SAAS,EAAG,EAC9FN,EAACE,EAAA,CACC,UAAU,oCACV,KAAMI,EAAK,OAAO,OAASH,EAAY,OAASK,GAAY,IAAMA,GAAY,cAChF,GACF,EAEAR,EAACE,EAAA,CAAK,UAAU,6CAA6C,KAAMI,EAAK,QAAQ,MAAO,GAAG,IAAI,CAGpG",
|
|
6
|
+
"names": ["jsx", "jsxs", "Text", "ConsumeType", "useCreditsContext", "NoneProductValue", "item", "copy", "pageCommon"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RedeemableItem as RedeemableItemType } from '../../type';
|
|
2
|
+
import { CreditsRedeemListCopy } from '../type';
|
|
3
|
+
type ProductInfoProps = {
|
|
4
|
+
item: RedeemableItemType;
|
|
5
|
+
copy: CreditsRedeemListCopy;
|
|
6
|
+
};
|
|
7
|
+
export declare const ProductInfo: ({ item, copy }: ProductInfoProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as a,jsxs as e}from"react/jsx-runtime";import{Picture as m}from"@anker-in/headless-ui";import{formatPrice as i}from"../../context/utils";import{useHeadlessContext as r}from"@anker-in/lib";import{useCreditsContext as o}from"../../context/provider";const v=({item:t,copy:d})=>{const{locale:s}=r(),{pageCommon:l}=o();return e("div",{className:"flex w-full items-center justify-center md:items-start md:justify-start",children:[a(m,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),e("div",{className:"md:flex md:flex-col",children:[e("div",{className:"md:flex md:items-center",children:[a(m,{className:"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",source:t.variant.image?.url||t.product?.images[0]?.url,alt:t.product.title}),a("div",{className:"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden",title:t.product.title,children:t.product.title})]}),e("div",{className:"mt-[16px] md:mt-[12px]",children:[a("div",{className:"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden",title:t.product.title,children:t.product.title}),e("div",{className:"flex font-semibold leading-[1.4] md:flex-col",children:[e("div",{className:"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.variantLabel,": "]}),a("span",{className:"ml-1",children:t.variant.title||""})]}),e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.shippingFeeLabel,": "]}),a("span",{className:"ml-1",children:i({amount:0,currencyCode:t.product.price?.currencyCode,locale:s||"us"})})]})]}),e("div",{className:"text-[15px] font-bold text-[#777] md:text-[12px]",children:[e("div",{className:"mb-[8px] flex items-center md:mb-[4px]",children:[e("span",{children:[d.redeemModal.product.quantityLabel,": "]}),a("span",{className:"ml-1",children:"1"})]}),e("div",{className:"l:flex l:items-center l:justify-between",children:[e("span",{children:[d.redeemModal.product.totalPriceLabel,": "]}),e("span",{className:"ml-1",children:[t.alpc?.consumeCredits," ",l?.pointUnit]})]})]})]})]})]})]})};export{v as ProductInfo};
|
|
2
|
+
//# sourceMappingURL=ProductInfo.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Picture } from '@anker-in/headless-ui'\nimport { formatPrice } from '../../context/utils'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../../context/provider'\n\ntype ProductInfoProps = {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n}\n\nexport const ProductInfo = ({ item, copy }: ProductInfoProps) => {\n const { locale } = useHeadlessContext()\n const { pageCommon } = useCreditsContext()\n\n return (\n <div className=\"flex w-full items-center justify-center md:items-start md:justify-start\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:hidden md:size-[44px] [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"md:flex md:flex-col\">\n <div className=\"md:flex md:items-center\">\n <Picture\n className=\"mr-[16px] size-[100px] shrink-0 md:mr-[12px] md:size-[44px] min-md:hidden [&_img]:h-full [&_img]:w-auto [&_img]:object-contain\"\n source={item.variant.image?.url || item.product?.images[0]?.url}\n alt={item.product.title}\n ></Picture>\n <div className=\"flex-1 text-[16px] font-bold leading-[1.4] min-l:!hidden\" title={item.product.title}>\n {item.product.title}\n </div>\n </div>\n\n <div className=\"mt-[16px] md:mt-[12px]\">\n <div className=\"mb-[12px] line-clamp-1 text-[16px] font-bold l:!hidden\" title={item.product.title}>\n {item.product.title}\n </div>\n <div className=\"flex font-semibold leading-[1.4] md:flex-col\">\n <div className=\"mr-[40px] text-[15px] font-bold text-[#777] md:mr-0 md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.variantLabel}: </span>\n <span className=\"ml-1\">{item.variant.title || ''}</span>\n </div>\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.shippingFeeLabel}: </span>\n <span className=\"ml-1\">\n {formatPrice({\n amount: 0,\n currencyCode: item.product.price?.currencyCode!,\n locale: locale || 'us',\n })}\n </span>\n </div>\n </div>\n <div className=\"text-[15px] font-bold text-[#777] md:text-[12px]\">\n <div className=\"mb-[8px] flex items-center md:mb-[4px]\">\n <span>{copy.redeemModal.product.quantityLabel}: </span>\n <span className=\"ml-1\">1</span>\n </div>\n <div className=\"l:flex l:items-center l:justify-between\">\n <span>{copy.redeemModal.product.totalPriceLabel}: </span>\n <span className=\"ml-1\">\n {item.alpc?.consumeCredits} {pageCommon?.pointUnit}\n </span>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n )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AAK,UAAU,OACb,SAAAG,EAAY,CACX,OAAQ,EACR,aAAcI,EAAK,QAAQ,OAAO,aAClC,OAAQE,GAAU,IACpB,CAAC,EACH,GACF,GACF,EACAR,EAAC,OAAI,UAAU,mDACb,UAAAA,EAAC,OAAI,UAAU,yCACb,UAAAA,EAAC,QAAM,UAAAO,EAAK,YAAY,QAAQ,cAAc,MAAE,EAChDR,EAAC,QAAK,UAAU,OAAO,aAAC,GAC1B,EACAC,EAAC,OAAI,UAAU,0CACb,UAAAA,EAAC,QAAM,UAAAO,EAAK,YAAY,QAAQ,gBAAgB,MAAE,EAClDP,EAAC,QAAK,UAAU,OACb,UAAAM,EAAK,MAAM,eAAe,IAAEG,GAAY,WAC3C,GACF,GACF,GACF,GACF,GACF,GACF,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Picture", "formatPrice", "useHeadlessContext", "useCreditsContext", "ProductInfo", "item", "copy", "locale", "pageCommon"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RedeemableItem as RedeemableItemType } from '../../type';
|
|
2
|
+
import { CreditsRedeemListCopy } from '../type';
|
|
3
|
+
type SuccessProps = {
|
|
4
|
+
copy: CreditsRedeemListCopy;
|
|
5
|
+
shippingProduct: string;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
address: Record<string, any> | undefined;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
item: RedeemableItemType;
|
|
11
|
+
};
|
|
12
|
+
export declare const Success: ({ copy, shippingProduct, loading, address, disabled, onClose, item }: SuccessProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as e,jsxs as v}from"react/jsx-runtime";import{Button as u,Text as d}from"@anker-in/headless-ui";import m from"classnames";import{ProductInfo as f}from"./ProductInfo";import{useHeadlessContext as b}from"@anker-in/lib";import{roundedBrands as y}from"../../const";const B=({copy:t,shippingProduct:o,loading:s,address:r,disabled:a,onClose:p,item:i})=>{const{brand:l}=b(),n=y.includes(l);return e("div",{className:m("max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]"),children:v("div",{className:"flex flex-col items-center",children:[e("div",{className:"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]",children:t.redeemModal.product.successDesc.map((x,c)=>e(d,{className:"text-[18px] font-bold leading-[1.4] md:text-[14px]",html:x},c))}),o&&e(d,{className:"mb-5 text-[16px] font-bold",html:o}),e("div",{className:m("flex w-full items-center bg-[#F5F5F7] p-[16px]",!n&&"rounded-none"),children:e(f,{item:i,copy:t})}),e(u,{loading:s||!r,variant:"primary",className:"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full",onClick:p,disabled:a,children:t.redeemModal.product.paymentButton})]})})};export{B as Success};
|
|
2
|
+
//# sourceMappingURL=Success.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Button, Text } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { CreditsRedeemListCopy } from '../type'\nimport { ProductInfo } from './ProductInfo'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { roundedBrands } from '../../const'\n\ntype SuccessProps = {\n copy: CreditsRedeemListCopy\n shippingProduct: string\n loading: boolean\n address: Record<string, any> | undefined\n disabled: boolean\n onClose: () => void\n item: RedeemableItemType\n}\n\nexport const Success = ({ copy, shippingProduct, loading, address, disabled, onClose, item }: SuccessProps) => {\n const { brand } = useHeadlessContext()\n const rounded = roundedBrands.includes(brand)\n return (\n <div className={classNames('max-h-[500px] overflow-y-auto px-[48px] pb-[24px] md:max-h-[400px] md:px-[16px]')}>\n <div className=\"flex flex-col items-center\">\n <div className=\"mb-[16px] grid grid-flow-row gap-y-[4px] md:mb-[12px]\">\n {copy.redeemModal.product.successDesc.map((description: string, index: number) => (\n <Text key={index} className=\"text-[18px] font-bold leading-[1.4] md:text-[14px]\" html={description}></Text>\n ))}\n </div>\n\n {shippingProduct && <Text className=\"mb-5 text-[16px] font-bold\" html={shippingProduct}></Text>}\n\n <div className={classNames('flex w-full items-center bg-[#F5F5F7] p-[16px]', !rounded && 'rounded-none')}>\n <ProductInfo item={item} copy={copy} />\n </div>\n\n <Button\n loading={loading || !address}\n variant=\"primary\"\n className=\"mx-auto mt-[16px] w-[444px] md:mt-[12px] md:w-full\"\n onClick={onClose}\n disabled={disabled}\n >\n {copy.redeemModal.product.paymentButton}\n </Button>\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "AAuBM,OAGM,OAAAA,EAHN,QAAAC,MAAA,oBAvBN,OAAS,UAAAC,EAAQ,QAAAC,MAAY,wBAC7B,OAAOC,MAAgB,aAGvB,OAAS,eAAAC,MAAmB,gBAC5B,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,iBAAAC,MAAqB,cAYvB,MAAMC,EAAU,CAAC,CAAE,KAAAC,EAAM,gBAAAC,EAAiB,QAAAC,EAAS,QAAAC,EAAS,SAAAC,EAAU,QAAAC,EAAS,KAAAC,CAAK,IAAoB,CAC7G,KAAM,CAAE,MAAAC,CAAM,EAAIV,EAAmB,EAC/BW,EAAUV,EAAc,SAASS,CAAK,EAC5C,OACEhB,EAAC,OAAI,UAAWI,EAAW,iFAAiF,EAC1G,SAAAH,EAAC,OAAI,UAAU,6BACb,UAAAD,EAAC,OAAI,UAAU,wDACZ,SAAAS,EAAK,YAAY,QAAQ,YAAY,IAAI,CAACS,EAAqBC,IAC9DnB,EAACG,EAAA,CAAiB,UAAU,qDAAqD,KAAMe,GAA5EC,CAAyF,CACrG,EACH,EAECT,GAAmBV,EAACG,EAAA,CAAK,UAAU,6BAA6B,KAAMO,EAAiB,EAExFV,EAAC,OAAI,UAAWI,EAAW,iDAAkD,CAACa,GAAW,cAAc,EACrG,SAAAjB,EAACK,EAAA,CAAY,KAAMU,EAAM,KAAMN,EAAM,EACvC,EAEAT,EAACE,EAAA,CACC,QAASS,GAAW,CAACC,EACrB,QAAQ,UACR,UAAU,qDACV,QAASE,EACT,SAAUD,EAET,SAAAJ,EAAK,YAAY,QAAQ,cAC5B,GACF,EACF,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Button", "Text", "classNames", "ProductInfo", "useHeadlessContext", "roundedBrands", "Success", "copy", "shippingProduct", "loading", "address", "disabled", "onClose", "item", "brand", "rounded", "description", "index"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AlpcErrorCode } from '../../context/const';
|
|
2
|
+
import type { ModalContainerProps } from '../../modal/modalContainer';
|
|
3
|
+
import type { RedeemableItem as RedeemableItemType } from '../../type';
|
|
4
|
+
import { CreditsRedeemListCopy } from '../type';
|
|
5
|
+
type RedeemProductModalProps = ModalContainerProps & {
|
|
6
|
+
item: RedeemableItemType;
|
|
7
|
+
copy: CreditsRedeemListCopy;
|
|
8
|
+
onError: (code: AlpcErrorCode) => void;
|
|
9
|
+
};
|
|
10
|
+
declare function RedeemProductModal({ item, copy, onError, ...props }: RedeemProductModalProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default RedeemProductModal;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as u,jsxs as X}from"react/jsx-runtime";import R from"classnames";import{useCallback as F,useEffect as K,useMemo as _,useState as l}from"react";import{useCreditsContext as A}from"../../context/provider";import k from"../../context/hooks/useCountries";import{AlpcErrorCode as c}from"../../context/const";import{useAddressValidate as T}from"../../context/hooks/useAddressValidate";import{useRedeemProduct as B}from"../../context/hooks/useRedeemProduct";import{CreditsModalContainer as G}from"../../modal/modalContainer";import{useHeadlessContext as H}from"@anker-in/lib";import{Error as J}from"./Error";import{Success as V}from"./Success";import{Address as z}from"./Address";import{Init as Q}from"./Init";function W({item:s,copy:e,onError:h,...m}){const{fetchCreditInfo:E,profile:I}=A(),{storeDomain:N,locale:y}=H(),{pageCommon:L}=A(),{shippingAddress:S,shippingProduct:v}=e.redeemModal.product,[d,i]=l("init"),[t,x]=l(),[U,n]=l({code:0,message:"",imageUrl:""}),[f,a]=l(!1),{countries:b=[],isLoading:Y}=k({shopifyStoreDomain:N}),{isMutating:p,trigger:P}=B({onSuccess(r){if(!r){i("error"),n({code:0,imageUrl:e.redeemModal.errorImageUrl||"",message:e.redeemModal.commonError||""});return}if(r?.code===0)E(I?.user_id),i("success");else{let o,M;r.code===c.CodeLpcShopifyCouponRuleRedeemLimit?(o=e.redeemModal.redeemLimitError,a(!0)):r.code===c.CodeLpcRuleInventoryNotEnough?(o=e.redeemModal.inventoryNotEnough,a(!0),M=e.redeemModal.inventoryNotEnough):r.code===c.CodeLpcNotEnoughCredits?(o=e.redeemModal.creditsNotEnough,a(!0),E(I?.user_id)):r.code===c.CodeCrossSiteError&&(o=e.redeemModal.crossSiteError,a(!0)),i("error"),n({code:r.code,imageUrl:M||e.redeemModal.errorImageUrl||"",message:o||e.redeemModal.commonError||""}),h&&h(r.code)}},onError(r){i("error"),n({code:0,imageUrl:e.redeemModal.errorImageUrl||"",message:e.redeemModal.commonError||""})}}),g=_(()=>e?.redeemModal.product.form?.flat().find(o=>o.type==="state")?.key,[e?.redeemModal.product.form]),{validate:C,errors:O}=T({address:t,validatorInfo:L?.validatorInfo,formData:e?.redeemModal.product.form?.flat()||[],errorLabel:{require:e.redeemModal.product.required,email:e.redeemModal.product.invalidEmail}}),q=F(async()=>{const r=[];if(g&&((b.find(w=>w.code===t.country)?.provinces||[]).length||r.push(g)),C({force:!0,ignoreKeys:r}))return;let o={...t};o.name&&delete o.name,o.country==="UK"&&(o.country="GB"),P({address:btoa(JSON.stringify(o)),rule_id:Number(s.alpc?.id)})},[s,P,g,C,t,b]);return K(()=>{m.isOpen||(a(!1),n({code:0,message:"",imageUrl:""}))},[m.isOpen,y]),X(G,{...m,className:R("w-[540px] md:h-auto min-md:max-h-[calc(100vh-40px)]",d!=="init"&&"w-[740px] md:w-full"),scrollClassName:"mb-0 min-l:px-0 md:mb-0 px-0",titleClassName:R("h-[56px]",d==="init"&&"bg-[#F5F5F7]"),title:d==="address"?"Order Confirmation":"",children:[d==="error"&&u(J,{errorInfo:U}),d==="success"&&u(V,{copy:e,shippingProduct:v,loading:p,address:t,disabled:f,onClose:m.onClose,item:s}),d==="address"&&u(z,{copy:e,shippingAddress:S,setAddress:x,validateAddress:C,validateErrors:O,shippingProduct:v,loading:p,address:t,disabled:f,handlePayment:q,item:s}),d==="init"&&u(Q,{item:s,copy:e,loading:p,disabled:f,setStatus:i})]})}var ce=W;export{ce as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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/modalContainer'\nimport { CreditsModalContainer } from '../../modal/modalContainer'\nimport type { RedeemableItem as RedeemableItemType } from '../../type'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { CreditsRedeemListCopy } from '../type'\nimport { Error } from './Error'\nimport { Success } from './Success'\nimport { Address } from './Address'\nimport { Init } from './Init'\n\ntype RedeemProductModalProps = ModalContainerProps & {\n item: RedeemableItemType\n copy: CreditsRedeemListCopy\n onError: (code: AlpcErrorCode) => void\n}\n\nfunction RedeemProductModal({ item, copy, onError, ...props }: RedeemProductModalProps) {\n const { fetchCreditInfo, profile } = useCreditsContext()\n const { storeDomain, locale } = useHeadlessContext()\n\n const { pageCommon } = useCreditsContext()\n const { shippingAddress, shippingProduct } = copy.redeemModal.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.redeemModal.errorImageUrl || '',\n message: copy.redeemModal.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.redeemModal.redeemLimitError\n setDisabled(true)\n } else if (responseData.code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n errorMsg = copy.redeemModal.inventoryNotEnough\n setDisabled(true)\n errorImage = copy.redeemModal.inventoryNotEnough\n } else if (responseData.code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n errorMsg = copy.redeemModal.creditsNotEnough\n setDisabled(true)\n fetchCreditInfo(profile?.user_id)\n } else if (responseData.code === AlpcErrorCode.CodeCrossSiteError) {\n errorMsg = copy.redeemModal.crossSiteError\n setDisabled(true)\n }\n\n setStatus('error')\n setErrorInfo({\n code: responseData.code,\n imageUrl: errorImage || copy.redeemModal.errorImageUrl || '',\n message: errorMsg || copy.redeemModal.commonError || '',\n })\n onError && onError(responseData.code)\n }\n },\n onError(error) {\n setStatus('error')\n setErrorInfo({\n code: 0,\n imageUrl: copy.redeemModal.errorImageUrl || '',\n message: copy.redeemModal.commonError || '',\n })\n },\n })\n\n const stateInputKey = useMemo(() => {\n const stateInput = copy?.redeemModal.product.form?.flat().find(item => item.type === 'state')\n return stateInput?.key\n }, [copy?.redeemModal.product.form])\n\n const { validate: validateAddress, errors: validateErrors } = useAddressValidate({\n address: address,\n validatorInfo: pageCommon?.validatorInfo,\n formData: copy?.redeemModal.product.form?.flat() || [],\n errorLabel: {\n require: copy.redeemModal.product.required,\n email: copy.redeemModal.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 if (!props.isOpen) {\n setDisabled(false)\n setErrorInfo({ code: 0, message: '', imageUrl: '' })\n }\n }, [props.isOpen, locale])\n\n return (\n <CreditsModalContainer\n {...props}\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,OAUyB,OAAAA,EAVzB,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,gBAEnC,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,CAAQ,EAAIjB,EAAkB,EACjD,CAAE,YAAAkB,EAAa,OAAAC,CAAO,EAAIb,EAAmB,EAE7C,CAAE,WAAAc,CAAW,EAAIpB,EAAkB,EACnC,CAAE,gBAAAqB,EAAiB,gBAAAC,CAAgB,EAAIT,EAAK,YAAY,QAExD,CAACU,EAAQC,CAAS,EAAIzB,EAAmD,MAAM,EAC/E,CAAC0B,EAASC,CAAU,EAAI3B,EAAc,EACtC,CAAC4B,EAAWC,CAAY,EAAI7B,EAAS,CACzC,KAAM,EACN,QAAS,GACT,SAAU,EACZ,CAAC,EACK,CAAC8B,EAAUC,CAAW,EAAI/B,EAAS,EAAK,EAExC,CAAE,UAAAgC,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EAACe,EAAA,CACC,KAAMK,EACN,gBAAiBS,EACjB,QAASW,EACT,QAASR,EACT,SAAUI,EACV,QAASd,EAAM,QACf,KAAMH,EACR,EAEDW,IAAW,WACV9B,EAACgB,EAAA,CACC,KAAMI,EACN,gBAAiBQ,EACjB,WAAYK,EACZ,gBAAiBc,EACjB,eAAgBC,EAChB,gBAAiBnB,EACjB,QAASW,EACT,QAASR,EACT,SAAUI,EACV,cAAea,EACf,KAAM9B,EACR,EAEDW,IAAW,QACV9B,EAACiB,EAAA,CAAK,KAAME,EAAM,KAAMC,EAAM,QAASoB,EAAS,SAAUJ,EAAU,UAAWL,EAAW,GAE9F,CAEJ,CAEA,IAAOqB,GAAQlC",
|
|
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", "storeDomain", "locale", "pageCommon", "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
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RedeemableItem as RedeemableItemType } from '../type';
|
|
2
|
+
import type { CreditsRedeemListCopy } from './type';
|
|
3
|
+
export declare function RedeemableItem({ copy, className, item, onRulesOpen, onRedeem, }: {
|
|
4
|
+
copy: CreditsRedeemListCopy;
|
|
5
|
+
className?: string;
|
|
6
|
+
item: RedeemableItemType;
|
|
7
|
+
onRulesOpen: (rules: string[]) => void;
|
|
8
|
+
onRedeem: (item: RedeemableItemType) => void;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as t,jsxs as o}from"react/jsx-runtime";import{Button as N,Text as u,Picture as p}from"@anker-in/headless-ui";import{useMemo as x}from"react";import s from"classnames";import{useCreditsContext as R}from"../context/provider";import{AlpcConsumeType as f,ConsumeType as T}from"../context/const";import{numberFormat as w}from"../context/utils";import{gaTrack as v,useHeadlessContext as I}from"@anker-in/lib";import{NoneProductValue as k}from"./NonProductValue";import{roundedBrands as z}from"../const";function D({copy:l,className:g,item:e,onRulesOpen:b,onRedeem:y}){const{creditInfo:m,profile:a,gtm:{pageGroup:d},pageCommon:n}=R(),{brand:_}=I(),i=Object.keys(a||{}).length>0,h=z.includes(_),C=x(()=>!!(e.alpc?.remainingInventory<=0&&e.alpc?.isLimited||e.alpc?.consumeType===f.Product&&!e.variant?.availableForSale||i&&a?.activated&&e.alpc?.consumeCredits>Number(m?.available_credit||0)),[e.alpc?.remainingInventory,e.alpc?.isLimited,e.alpc?.consumeType,e.alpc?.consumeCredits,i,a?.activated,m?.available_credit,e.variant?.availableForSale]),c=x(()=>i?e.alpc?.consumeType===f.Product?e.variant?.availableForSale?l.btnRedeem:n?.soldOut||"Sold Out":l.btnRedeem:l.unlockRewards,[i,e.alpc?.consumeType,e.variant?.availableForSale,l.btnRedeem,l.unlockRewards,n?.soldOut]);return o("div",{className:s("flex flex-col items-center rounded-[16px] bg-[#EAEAEC] p-[24px] md:rounded-[12px] md:px-[8px] xl:py-[16px] md-xl:px-[16px]",!h&&"rounded-none md:rounded-none",g),children:[e.config?.type===T.Product?t("div",{className:s("relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]"),children:t(p,{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(p,{source:n?.imageMapping?.[e.config?.type]?.url,className:"h-full [&_img]:h-full [&_img]:w-auto [&_img]:object-contain"}),t(k,{item:e})]}),o("div",{className:s("mt-[22px] flex w-full flex-1 flex-col justify-between"),children:[t(u,{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:()=>{b(e.config?.rules||[]),v({event:"ga4Event",event_name:"lp_button",member_active_status:a?.activated?"active":"not active",event_parameters:{page_group:d,position:l.title,button_name:n?.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:r=>{(r.key==="Enter"||r.key===" ")&&r.preventDefault()},children:n?.ruleLabel}),o("div",{children:[o("div",{className:"mt-[26px] flex items-center l:mt-[12px] l-xl:mt-[16px]",children:[t(p,{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(u,{html:`${w(e.alpc?.consumeCredits)}`,size:2,as:"p",className:"ml-[4px] text-[28px] font-bold mt-[4px] leading-none md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] "})]}),t(N,{disabled:C,variant:"primary",size:"lg",className:"mt-[8px] md:px-[8px] l:w-full",onClick:()=>{y(e),v({event:"ga4Event",event_name:"lp_button",member_active_status:a?.activated?"active":"not active",event_parameters:{page_group:d,position:l.title,button_name:c,info:e.alpc?.id?.toString()}})},children:c})]})]})]})}export{D as RedeemableItem};
|
|
2
|
+
//# sourceMappingURL=RedeemableItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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 } from '../context/utils'\nimport type { CreditsRedeemListCopy } from './type'\nimport { gaTrack, useHeadlessContext } from '@anker-in/lib'\nimport { NoneProductValue } from './NonProductValue'\nimport { roundedBrands } from '../const'\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 },\n pageCommon,\n } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const isLogin = Object.keys(profile || {}).length > 0\n const rounded = roundedBrands.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 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 <div className={classNames('relative mx-auto h-[224px] w-fit md:my-[10px] l:h-[120px] l-xxl:h-[138px]')}>\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 </div>\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-[22px] 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-[28px] font-bold mt-[4px] leading-none md:text-[18px] l-xxl:text-[24px] md-l:text-[20px] \"\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": "AA4FU,cAAAA,EAMF,QAAAC,MANE,oBA5FV,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,MAAoB,mBAE7B,OAAS,WAAAC,EAAS,sBAAAC,MAA0B,gBAC5C,OAAS,oBAAAC,MAAwB,oBACjC,OAAS,iBAAAC,MAAqB,WAEvB,SAASC,EAAe,CAC7B,KAAAC,EACA,UAAAC,EACA,KAAAC,EACA,YAAAC,EACA,SAAAC,CACF,EAMG,CACD,KAAM,CACJ,WAAAC,EACA,QAAAC,EACA,IAAK,CAAE,UAAAC,CAAU,EACjB,WAAAC,CACF,EAAIjB,EAAkB,EAChB,CAAE,MAAAkB,CAAM,EAAIb,EAAmB,EAC/Bc,E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MAAM,MACvC,MAAOA,EAAK,QAAQ,OAASA,EAAK,MAAM,MACxC,KAAM,EACN,UAAU,4GACZ,EACCA,EAAK,QAAQ,OAAO,OAAS,GAC5BlB,EAAC,UACC,KAAK,SACL,QAAS,IAAM,CACbmB,EAAYD,EAAK,QAAQ,OAAS,CAAC,CAAC,EACpCP,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBW,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EACZ,SAAUP,EAAK,MACf,YAAaQ,GAAY,UACzB,KAAMN,EAAK,MAAM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EACA,UAAU,uEACV,SAAU,EACV,UAAWY,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EAEC,SAAAN,GAAY,UACf,EAEFvB,EAAC,OACC,UAAAA,EAAC,OAAI,UAAU,yDACb,UAAAD,EAACI,EAAA,CACC,UAAU,gEACV,OAAO,6FACT,EACAJ,EAACG,EAAA,CACC,KAAM,GAAGO,EAAaQ,EAAK,MAAM,cAAc,CAAC,GAChD,KAAM,EACN,GAAG,IACH,UAAU,0GACZ,GACF,EAEAlB,EAACE,EAAA,CACC,SAAU0B,EACV,QAAQ,UACR,KAAK,KACL,UAAU,gCACV,QAAS,IAAM,CACbR,EAASF,CAAI,EACbP,EAAQ,CACN,MAAO,WACP,WAAY,YACZ,qBAAsBW,GAAS,UAAY,SAAW,aACtD,iBAAkB,CAChB,WAAYC,EACZ,SAAUP,EAAK,MACf,YAAaa,EACb,KAAMX,EAAK,MAAM,IAAI,SAAS,CAChC,CACF,CAAC,CACH,EAEC,SAAAW,EACH,GACF,GACF,GACF,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Button", "Text", "Picture", "useMemo", "classNames", "useCreditsContext", "AlpcConsumeType", "ConsumeType", "numberFormat", "gaTrack", "useHeadlessContext", "NoneProductValue", "roundedBrands", "RedeemableItem", "copy", "className", "item", "onRulesOpen", "onRedeem", "creditInfo", "profile", "pageGroup", "pageCommon", "brand", "isLogin", "rounded", "isDisabled", "redeemButtonText", "e"]
|
|
7
|
+
}
|