@anker-in/campaign-ui 0.3.5 → 0.4.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/credits/context/const.d.ts +10 -2
- package/dist/cjs/components/credits/context/const.js +1 -1
- package/dist/cjs/components/credits/context/const.js.map +2 -2
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.d.ts +17 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemGoGift.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.d.ts +7 -2
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemableList.js.map +3 -3
- package/dist/cjs/components/credits/context/provider.d.ts +5 -1
- package/dist/cjs/components/credits/context/provider.js +1 -1
- package/dist/cjs/components/credits/context/provider.js.map +3 -3
- package/dist/cjs/components/credits/context/response.d.ts +1 -0
- package/dist/cjs/components/credits/context/response.js.map +1 -1
- package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
- package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +2 -2
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +2 -2
- package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.d.ts +5 -0
- package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.js +2 -0
- package/dist/cjs/components/credits/creditsGoGift/CreditsGoGift.js.map +7 -0
- package/dist/cjs/components/credits/creditsGoGift/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsGoGift/index.js +2 -0
- package/dist/cjs/components/credits/creditsGoGift/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsGoGift/type.d.ts +22 -0
- package/dist/cjs/components/credits/creditsGoGift/type.js +2 -0
- package/dist/cjs/components/credits/creditsGoGift/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsInfoCard/index.js +1 -1
- package/dist/cjs/components/credits/creditsInfoCard/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
- package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.d.ts +10 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.d.ts +10 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +4 -5
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +2 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +2 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +1 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +3 -4
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +2 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +4 -5
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.d.ts +10 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.d.ts +9 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.d.ts +8 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.js +2 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemVirtualProductModal.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +11 -0
- package/dist/cjs/components/credits/creditsRedeemList/type.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/type.js.map +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +2 -2
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.d.ts +2 -2
- package/dist/cjs/components/credits/creditsWaysToGetCredits/type.js.map +1 -1
- package/dist/cjs/components/credits/index.d.ts +2 -1
- package/dist/cjs/components/credits/index.js +1 -1
- package/dist/cjs/components/credits/index.js.map +3 -3
- package/dist/{esm/components/credits/modal/activitiesModal.d.ts → cjs/components/credits/modal/ActivitiesModal.d.ts} +1 -1
- package/dist/cjs/components/credits/modal/{activitiesModal.js → ActivitiesModal.js} +2 -2
- package/dist/cjs/components/credits/modal/{activitiesModal.js.map → ActivitiesModal.js.map} +3 -3
- package/dist/cjs/components/credits/modal/{creditsUploadReceiptModal.js → CreditsUploadReceiptModal.js} +2 -2
- package/dist/cjs/components/credits/modal/{creditsUploadReceiptModal.js.map → CreditsUploadReceiptModal.js.map} +3 -3
- package/dist/cjs/components/credits/modal/{loadingDots.js → LoadingDots.js} +1 -1
- package/dist/cjs/components/credits/modal/{loadingDots.js.map → LoadingDots.js.map} +2 -2
- 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/RewardsModal.d.ts +64 -0
- package/dist/cjs/components/credits/modal/RewardsModal.js +2 -0
- package/dist/cjs/components/credits/modal/RewardsModal.js.map +7 -0
- package/dist/cjs/components/credits/modal/{rulesModal.d.ts → RulesModal.d.ts} +1 -1
- package/dist/cjs/components/credits/modal/{rulesModal.js → RulesModal.js} +2 -2
- package/dist/cjs/components/credits/modal/{rulesModal.js.map → RulesModal.js.map} +3 -3
- package/dist/cjs/components/credits/modal/{subscribeModal.d.ts → SubscribeModal.d.ts} +1 -1
- package/dist/cjs/components/credits/modal/{subscribeModal.js → SubscribeModal.js} +2 -2
- package/dist/cjs/components/credits/modal/{subscribeModal.js.map → SubscribeModal.js.map} +3 -3
- package/dist/cjs/components/credits/modal/{tip.js → Tip.js} +1 -1
- package/dist/cjs/components/credits/modal/{tip.js.map → Tip.js.map} +2 -2
- package/dist/cjs/components/credits/type.d.ts +67 -5
- package/dist/cjs/components/credits/type.js +1 -1
- package/dist/cjs/components/credits/type.js.map +1 -1
- package/dist/cjs/templates/Credits.d.ts +1 -87
- package/dist/cjs/templates/Credits.js +1 -1
- package/dist/cjs/templates/Credits.js.map +3 -3
- package/dist/cjs/templates/Credits.types.d.ts +96 -0
- package/dist/cjs/templates/Credits.types.js +2 -0
- package/dist/cjs/templates/Credits.types.js.map +7 -0
- package/dist/esm/components/credits/context/const.d.ts +10 -2
- package/dist/esm/components/credits/context/const.js +1 -1
- package/dist/esm/components/credits/context/const.js.map +2 -2
- package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemGoGift.d.ts +17 -0
- package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js +2 -0
- package/dist/esm/components/credits/context/hooks/useRedeemGoGift.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useRedeemableList.d.ts +7 -2
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemableList.js.map +3 -3
- package/dist/esm/components/credits/context/provider.d.ts +5 -1
- package/dist/esm/components/credits/context/provider.js +1 -1
- package/dist/esm/components/credits/context/provider.js.map +3 -3
- package/dist/esm/components/credits/context/response.d.ts +1 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +1 -1
- package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +1 -1
- package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +1 -1
- package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.d.ts +5 -0
- package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.js +2 -0
- package/dist/esm/components/credits/creditsGoGift/CreditsGoGift.js.map +7 -0
- package/dist/esm/components/credits/creditsGoGift/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsGoGift/index.js +2 -0
- package/dist/esm/components/credits/creditsGoGift/index.js.map +7 -0
- package/dist/esm/components/credits/creditsGoGift/type.d.ts +22 -0
- package/dist/esm/components/credits/creditsGoGift/type.js +1 -0
- package/dist/esm/components/credits/creditsGoGift/type.js.map +7 -0
- package/dist/esm/components/credits/creditsInfoCard/index.js +1 -1
- package/dist/esm/components/credits/creditsInfoCard/index.js.map +3 -3
- package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js +1 -1
- package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +1 -1
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.d.ts +10 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.d.ts +10 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.d.ts +4 -5
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemCouponModal.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.d.ts +2 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Address.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.d.ts +2 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Init.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.d.ts +1 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.d.ts +3 -4
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.d.ts +2 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Success.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.d.ts +4 -5
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/index.js.map +3 -3
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.d.ts +10 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.d.ts +9 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.d.ts +8 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.js +2 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemVirtualProductModal.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemableItem.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/type.d.ts +11 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.d.ts +2 -2
- package/dist/esm/components/credits/creditsWaysToGetCredits/type.js.map +1 -1
- package/dist/esm/components/credits/index.d.ts +2 -1
- package/dist/esm/components/credits/index.js +1 -1
- package/dist/esm/components/credits/index.js.map +3 -3
- package/dist/{cjs/components/credits/modal/activitiesModal.d.ts → esm/components/credits/modal/ActivitiesModal.d.ts} +1 -1
- package/dist/esm/components/credits/modal/{activitiesModal.js → ActivitiesModal.js} +2 -2
- package/dist/esm/components/credits/modal/{activitiesModal.js.map → ActivitiesModal.js.map} +3 -3
- package/dist/esm/components/credits/modal/{creditsUploadReceiptModal.js → CreditsUploadReceiptModal.js} +2 -2
- package/dist/esm/components/credits/modal/{creditsUploadReceiptModal.js.map → CreditsUploadReceiptModal.js.map} +2 -2
- package/dist/esm/components/credits/modal/{loadingDots.js → LoadingDots.js} +1 -1
- package/dist/esm/components/credits/modal/{loadingDots.js.map → LoadingDots.js.map} +2 -2
- 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/RewardsModal.d.ts +64 -0
- package/dist/esm/components/credits/modal/RewardsModal.js +2 -0
- package/dist/esm/components/credits/modal/RewardsModal.js.map +7 -0
- package/dist/esm/components/credits/modal/{rulesModal.d.ts → RulesModal.d.ts} +1 -1
- package/dist/esm/components/credits/modal/{rulesModal.js → RulesModal.js} +2 -2
- package/dist/esm/components/credits/modal/{rulesModal.js.map → RulesModal.js.map} +3 -3
- package/dist/esm/components/credits/modal/{subscribeModal.d.ts → SubscribeModal.d.ts} +1 -1
- package/dist/esm/components/credits/modal/{subscribeModal.js → SubscribeModal.js} +2 -2
- package/dist/esm/components/credits/modal/{subscribeModal.js.map → SubscribeModal.js.map} +2 -2
- package/dist/esm/components/credits/modal/{tip.js → Tip.js} +1 -1
- package/dist/esm/components/credits/modal/{tip.js.map → Tip.js.map} +2 -2
- package/dist/esm/components/credits/type.d.ts +67 -5
- package/dist/esm/templates/Credits.d.ts +1 -87
- package/dist/esm/templates/Credits.js +1 -1
- package/dist/esm/templates/Credits.js.map +3 -3
- package/dist/esm/templates/Credits.types.d.ts +96 -0
- package/dist/esm/templates/Credits.types.js +2 -0
- package/dist/esm/templates/Credits.types.js.map +7 -0
- package/package.json +1 -1
- package/src/components/credits/context/const.ts +8 -0
- package/src/components/credits/context/hooks/useMyRewards.ts +7 -31
- package/src/components/credits/context/hooks/useRedeemGoGift.ts +36 -0
- package/src/components/credits/context/hooks/useRedeemableList.ts +13 -19
- package/src/components/credits/context/provider.tsx +17 -2
- package/src/components/credits/context/response.ts +1 -0
- package/src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx +2 -2
- package/src/components/credits/creditsCash/CreditsCash.tsx +1 -1
- package/src/components/credits/creditsGoGift/CreditsGoGift.tsx +210 -0
- package/src/components/credits/creditsGoGift/index.ts +2 -0
- package/src/components/credits/creditsGoGift/type.ts +23 -0
- package/src/components/credits/creditsInfoCard/index.tsx +5 -28
- package/src/components/credits/creditsMemberPrice/CreditsMemberPrice.tsx +1 -1
- package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +39 -17
- package/src/components/credits/creditsRedeemList/RedeemCouponModal/CouponInit.tsx +77 -0
- package/src/components/credits/creditsRedeemList/RedeemCouponModal/CouponSuccess.tsx +86 -0
- package/src/components/credits/creditsRedeemList/RedeemCouponModal.tsx +29 -138
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Address.tsx +5 -6
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Init.tsx +11 -12
- package/src/components/credits/creditsRedeemList/RedeemProductModal/NonProductValue.tsx +23 -14
- package/src/components/credits/creditsRedeemList/RedeemProductModal/ProductInfo.tsx +11 -9
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Success.tsx +4 -5
- package/src/components/credits/creditsRedeemList/RedeemProductModal/index.tsx +29 -28
- package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductInit.tsx +101 -0
- package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal/VirtualProductSuccess.tsx +65 -0
- package/src/components/credits/creditsRedeemList/RedeemVirtualProductModal.tsx +156 -0
- package/src/components/credits/creditsRedeemList/RedeemableItem.tsx +1 -1
- package/src/components/credits/creditsRedeemList/type.ts +11 -0
- package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +2 -2
- package/src/components/credits/creditsWaysToGetCredits/type.ts +2 -2
- package/src/components/credits/index.ts +2 -1
- package/src/components/credits/modal/{activitiesModal.tsx → ActivitiesModal.tsx} +2 -2
- package/src/components/credits/modal/{creditsUploadReceiptModal.tsx → CreditsUploadReceiptModal.tsx} +1 -1
- package/src/components/credits/modal/{modalContainer.tsx → ModalContainer.tsx} +1 -1
- package/src/components/credits/modal/{MyRewardsModal.tsx → RewardsModal.tsx} +145 -103
- package/src/components/credits/modal/{rulesModal.tsx → RulesModal.tsx} +1 -1
- package/src/components/credits/modal/{subscribeModal.tsx → SubscribeModal.tsx} +1 -1
- package/src/components/credits/type.ts +68 -5
- package/src/templates/Credits.tsx +110 -142
- package/src/templates/Credits.types.ts +110 -0
- package/dist/cjs/components/credits/modal/MyRewardsModal.d.ts +0 -32
- package/dist/cjs/components/credits/modal/MyRewardsModal.js +0 -2
- package/dist/cjs/components/credits/modal/MyRewardsModal.js.map +0 -7
- package/dist/cjs/components/credits/modal/modalContainer.js +0 -2
- package/dist/cjs/components/credits/modal/modalContainer.js.map +0 -7
- package/dist/cjs/stories/CartCard.stories.d.ts +0 -33
- package/dist/cjs/stories/CartCard.stories.js +0 -21
- package/dist/cjs/stories/CartCard.stories.js.map +0 -7
- package/dist/esm/components/credits/modal/MyRewardsModal.d.ts +0 -32
- package/dist/esm/components/credits/modal/MyRewardsModal.js +0 -2
- package/dist/esm/components/credits/modal/MyRewardsModal.js.map +0 -7
- package/dist/esm/components/credits/modal/modalContainer.js +0 -2
- package/dist/esm/components/credits/modal/modalContainer.js.map +0 -7
- package/dist/esm/stories/CartCard.stories.d.ts +0 -33
- package/dist/esm/stories/CartCard.stories.js +0 -21
- package/dist/esm/stories/CartCard.stories.js.map +0 -7
- package/dist/index.d.mts +0 -1305
- package/dist/index.d.ts +0 -1305
- package/dist/index.js +0 -26656
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -26641
- package/dist/index.mjs.map +0 -1
- /package/dist/cjs/components/credits/modal/{creditsUploadReceiptModal.d.ts → CreditsUploadReceiptModal.d.ts} +0 -0
- /package/dist/cjs/components/credits/modal/{loadingDots.d.ts → LoadingDots.d.ts} +0 -0
- /package/dist/cjs/components/credits/modal/{modalContainer.d.ts → ModalContainer.d.ts} +0 -0
- /package/dist/cjs/components/credits/modal/{tip.d.ts → Tip.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{creditsUploadReceiptModal.d.ts → CreditsUploadReceiptModal.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{loadingDots.d.ts → LoadingDots.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{modalContainer.d.ts → ModalContainer.d.ts} +0 -0
- /package/dist/esm/components/credits/modal/{tip.d.ts → Tip.d.ts} +0 -0
- /package/src/components/credits/modal/{loadingDots.tsx → LoadingDots.tsx} +0 -0
- /package/src/components/credits/modal/{tip.tsx → Tip.tsx} +0 -0
|
@@ -13,7 +13,8 @@ export declare enum ConsumeType {
|
|
|
13
13
|
}
|
|
14
14
|
export declare enum AlpcConsumeType {
|
|
15
15
|
Coupon = 1,
|
|
16
|
-
Product = 2
|
|
16
|
+
Product = 2,
|
|
17
|
+
ExternalProduct = 5
|
|
17
18
|
}
|
|
18
19
|
export declare enum TaskType {
|
|
19
20
|
Program = 1,
|
|
@@ -46,7 +47,14 @@ export declare enum RewardType {
|
|
|
46
47
|
ApproveFail = 3,
|
|
47
48
|
Unfulfilled = 4,
|
|
48
49
|
Fulfilled = 5,
|
|
49
|
-
Failed = 6
|
|
50
|
+
Failed = 6,
|
|
51
|
+
GogiftPending = 7,
|
|
52
|
+
GogiftApproved = 8,
|
|
53
|
+
GogiftSecondConfirm = 9,
|
|
54
|
+
GogiftRejected = 10,
|
|
55
|
+
GogiftCallbackPending = 11,
|
|
56
|
+
GogiftCallbackSuccess = 12,
|
|
57
|
+
GogiftCallbackTimeout = 13
|
|
50
58
|
}
|
|
51
59
|
export declare enum AlpcErrorCode {
|
|
52
60
|
CodeLpcRedeemFailed = 180001,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var z=(x,f)=>{for(var c in f)u(x,c,{get:f[c],enumerable:!0})},d=(x,f,c,t)=>{if(f&&typeof f=="object"||typeof f=="function")for(let i of I(f))!j.call(x,i)&&i!==c&&u(x,i,{get:()=>f[i],enumerable:!(t=B(f,i))||t.enumerable});return x};var q=x=>d(u({},"__esModule",{value:!0}),x);var H={};z(H,{ALPC_COUNTRY_MAP:()=>v,AlpcConsumeType:()=>L,AlpcErrorCode:()=>$,ApprovalStatus:()=>O,ConsumeType:()=>G,CouponType:()=>N,CreditType:()=>h,DTC_TASK_TYPE:()=>m,PRICE_SYMBOL:()=>D,RewardType:()=>M,TaskSubType:()=>F,TaskType:()=>U});module.exports=q(H);var h=(i=>(i[i.All=0]="All",i[i.Earned=1]="Earned",i[i.Deducted=2]="Deducted",i[i.Expired=3]="Expired",i))(h||{}),G=(P=>(P.Coupon="coupon",P.GiftCard="giftCard",P.GoGift="goGift",P.Product="product",P.ShippingCoupon="shippingCoupon",P))(G||{}),L=(t=>(t[t.Coupon=1]="Coupon",t[t.Product=2]="Product",t[t.ExternalProduct=5]="ExternalProduct",t))(L||{}),U=(t=>(t[t.Program=1]="Program",t[t.Operation=2]="Operation",t[t.Redeem=3]="Redeem",t))(U||{}),m=(t=>(t.FirstPurchase="firstPurchase",t.UploadReceipt="uploadReceipt",t.Shopping="shopping",t))(m||{}),F=(o=>(o[o.Activation=1]="Activation",o[o.UpdateName=2]="UpdateName",o[o.UpdatePhone=3]="UpdatePhone",o[o.UpdateBirthday=4]="UpdateBirthday",o[o.Subscription=5]="Subscription",o[o.UpadteAppName=7]="UpadteAppName",o[o.Refund=3e3]="Refund",o[o.ProductUnApproved=5e3]="ProductUnApproved",o))(F||{}),N=(c=>(c.FixedMount="fixed_amount",c.Percent="percent",c))(N||{}),M=(n=>(n[n.Received=0]="Received",n[n.Pending=1]="Pending",n[n.ApproveSuccess=2]="ApproveSuccess",n[n.ApproveFail=3]="ApproveFail",n[n.Unfulfilled=4]="Unfulfilled",n[n.Fulfilled=5]="Fulfilled",n[n.Failed=6]="Failed",n[n.GogiftPending=7]="GogiftPending",n[n.GogiftApproved=8]="GogiftApproved",n[n.GogiftSecondConfirm=9]="GogiftSecondConfirm",n[n.GogiftRejected=10]="GogiftRejected",n[n.GogiftCallbackPending=11]="GogiftCallbackPending",n[n.GogiftCallbackSuccess=12]="GogiftCallbackSuccess",n[n.GogiftCallbackTimeout=13]="GogiftCallbackTimeout",n))(M||{}),$=(g=>(g[g.CodeLpcRedeemFailed=180001]="CodeLpcRedeemFailed",g[g.CodeLpcUserNotFound=180002]="CodeLpcUserNotFound",g[g.CodeLpcCreditRuleNotFound=180003]="CodeLpcCreditRuleNotFound",g[g.CodeLpcUnknownError=180004]="CodeLpcUnknownError",g[g.CodeLpcNotEnoughCredits=180005]="CodeLpcNotEnoughCredits",g[g.CodeLpcUserMigrate=180006]="CodeLpcUserMigrate",g[g.CodeLpcRuleInventoryNotEnough=180007]="CodeLpcRuleInventoryNotEnough",g[g.CodeLpcShopifyCouponRuleRedeemLimit=180009]="CodeLpcShopifyCouponRuleRedeemLimit",g[g.CodeCrossSiteError=180011]="CodeCrossSiteError",g))($||{});const v=new Map([["eu-en","eu"],["eu-de","de"]]);var O=(i=>(i[i.Pending=0]="Pending",i[i.Success=1]="Success",i[i.Failed=2]="Failed",i[i.DoubleConfirm=3]="DoubleConfirm",i))(O||{});const D={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",pl:"z\u0142",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED",es:"\u20AC"};
|
|
2
2
|
//# sourceMappingURL=const.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/context/const.ts"],
|
|
4
|
-
"sourcesContent": ["export enum CreditType {\n All = 0,\n Earned = 1,\n Deducted = 2,\n Expired = 3,\n}\n\nexport enum ConsumeType {\n Coupon = 'coupon',\n GiftCard = 'giftCard',\n GoGift = 'goGift',\n Product = 'product',\n ShippingCoupon = 'shippingCoupon',\n}\n\nexport enum AlpcConsumeType {\n Coupon = 1,\n Product = 2,\n}\n\nexport enum TaskType {\n Program = 1,\n Operation = 2,\n Redeem = 3,\n}\n\nexport enum DTC_TASK_TYPE {\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shopping = 'shopping',\n}\n\nexport enum TaskSubType {\n Activation = 1, // \u6FC0\u6D3B\u4E8B\u4EF6\n UpdateName = 2, // \u5B8C\u5584\u59D3\u540D\n UpdatePhone = 3, // \u66F4\u65B0\u624B\u673A\u53F7\n UpdateBirthday = 4, // \u66F4\u65B0\u751F\u65E5\n Subscription = 5, // \u8BA2\u9605\n UpadteAppName = 7, // \u5B8C\u5584APP\u59D3\u540D\n Refund = 3000, // \u8D2D\u7269\u9001\u79EF\u5206\u4EFB\u52A1\u9000\u6B3E\n ProductUnApproved = 5000, // \u5151\u6362\u5546\u54C1\u5BA1\u6838\u4E0D\u901A\u8FC7\n}\n\nexport enum CouponType {\n FixedMount = 'fixed_amount',\n Percent = 'percent',\n}\n\nexport enum RewardType {\n Received = 0,\n Pending = 1,\n ApproveSuccess = 2,\n ApproveFail = 3,\n Unfulfilled = 4,\n Fulfilled = 5,\n Failed = 6,\n}\n\nexport enum AlpcErrorCode {\n CodeLpcRedeemFailed = 180001,\n //user not found\n CodeLpcUserNotFound = 180002,\n //credit rule not found\n CodeLpcCreditRuleNotFound = 180003,\n //unknown error\n CodeLpcUnknownError = 180004,\n // not enough credits\n CodeLpcNotEnoughCredits = 180005,\n // user migrate\n CodeLpcUserMigrate = 180006,\n // \u5E93\u5B58\u4E0D\u8DB3\n CodeLpcRuleInventoryNotEnough = 180007,\n // \u5151\u6362\u6B21\u6570\u9650\u5236\n CodeLpcShopifyCouponRuleRedeemLimit = 180009,\n // \u8DE8\u533A\u5151\u6362\u9519\u8BEF\uFF08\u975E\u6B27\u5151\u6362\u6B27\u6D32\u7684\uFF09\n CodeCrossSiteError = 180011,\n}\n\nexport const ALPC_COUNTRY_MAP = new Map<string, string>([\n ['eu-en', 'eu'],\n ['eu-de', 'de'],\n])\n\nexport enum ApprovalStatus {\n Pending = 0,\n Success = 1,\n Failed = 2,\n DoubleConfirm = 3,\n}\n\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n pl: 'z\u0142',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n es: '\u20AC',\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,oBAAAC,EAAA,kBAAAC,EAAA,mBAAAC,EAAA,gBAAAC,EAAA,eAAAC,EAAA,eAAAC,EAAA,kBAAAC,EAAA,iBAAAC,EAAA,eAAAC,EAAA,gBAAAC,EAAA,aAAAC,IAAA,eAAAC,EAAAd,GAAO,IAAKQ,OACVA,IAAA,IAAM,GAAN,MACAA,IAAA,OAAS,GAAT,SACAA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UAJUA,OAAA,IAOAF,OACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBALPA,OAAA,IAQAH,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA,QAAU,GAAV,
|
|
4
|
+
"sourcesContent": ["export enum CreditType {\n All = 0,\n Earned = 1,\n Deducted = 2,\n Expired = 3,\n}\n\nexport enum ConsumeType {\n Coupon = 'coupon',\n GiftCard = 'giftCard',\n GoGift = 'goGift',\n Product = 'product',\n ShippingCoupon = 'shippingCoupon',\n}\n\nexport enum AlpcConsumeType {\n Coupon = 1,\n Product = 2,\n ExternalProduct = 5,\n}\n\nexport enum TaskType {\n Program = 1,\n Operation = 2,\n Redeem = 3,\n}\n\nexport enum DTC_TASK_TYPE {\n FirstPurchase = 'firstPurchase',\n UploadReceipt = 'uploadReceipt',\n Shopping = 'shopping',\n}\n\nexport enum TaskSubType {\n Activation = 1, // \u6FC0\u6D3B\u4E8B\u4EF6\n UpdateName = 2, // \u5B8C\u5584\u59D3\u540D\n UpdatePhone = 3, // \u66F4\u65B0\u624B\u673A\u53F7\n UpdateBirthday = 4, // \u66F4\u65B0\u751F\u65E5\n Subscription = 5, // \u8BA2\u9605\n UpadteAppName = 7, // \u5B8C\u5584APP\u59D3\u540D\n Refund = 3000, // \u8D2D\u7269\u9001\u79EF\u5206\u4EFB\u52A1\u9000\u6B3E\n ProductUnApproved = 5000, // \u5151\u6362\u5546\u54C1\u5BA1\u6838\u4E0D\u901A\u8FC7\n}\n\nexport enum CouponType {\n FixedMount = 'fixed_amount',\n Percent = 'percent',\n}\n\nexport enum RewardType {\n Received = 0,\n Pending = 1,\n ApproveSuccess = 2,\n ApproveFail = 3,\n Unfulfilled = 4,\n Fulfilled = 5,\n Failed = 6,\n GogiftPending = 7,\n GogiftApproved = 8,\n GogiftSecondConfirm = 9,\n GogiftRejected = 10,\n GogiftCallbackPending = 11,\n GogiftCallbackSuccess = 12,\n GogiftCallbackTimeout = 13,\n}\n\nexport enum AlpcErrorCode {\n CodeLpcRedeemFailed = 180001,\n //user not found\n CodeLpcUserNotFound = 180002,\n //credit rule not found\n CodeLpcCreditRuleNotFound = 180003,\n //unknown error\n CodeLpcUnknownError = 180004,\n // not enough credits\n CodeLpcNotEnoughCredits = 180005,\n // user migrate\n CodeLpcUserMigrate = 180006,\n // \u5E93\u5B58\u4E0D\u8DB3\n CodeLpcRuleInventoryNotEnough = 180007,\n // \u5151\u6362\u6B21\u6570\u9650\u5236\n CodeLpcShopifyCouponRuleRedeemLimit = 180009,\n // \u8DE8\u533A\u5151\u6362\u9519\u8BEF\uFF08\u975E\u6B27\u5151\u6362\u6B27\u6D32\u7684\uFF09\n CodeCrossSiteError = 180011,\n}\n\nexport const ALPC_COUNTRY_MAP = new Map<string, string>([\n ['eu-en', 'eu'],\n ['eu-de', 'de'],\n])\n\nexport enum ApprovalStatus {\n Pending = 0,\n Success = 1,\n Failed = 2,\n DoubleConfirm = 3,\n}\n\nexport const PRICE_SYMBOL = {\n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QAAU,GAAV,UACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,YAAc,GAAd,cACAA,IAAA,YAAc,GAAd,cACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,oBAAsB,GAAtB,sBACAA,IAAA,eAAiB,IAAjB,iBACAA,IAAA,sBAAwB,IAAxB,wBACAA,IAAA,sBAAwB,IAAxB,wBACAA,IAAA,sBAAwB,IAAxB,wBAdUA,OAAA,IAiBAP,OACVA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,0BAA4B,QAA5B,4BAEAA,IAAA,oBAAsB,QAAtB,sBAEAA,IAAA,wBAA0B,QAA1B,0BAEAA,IAAA,mBAAqB,QAArB,qBAEAA,IAAA,8BAAgC,QAAhC,gCAEAA,IAAA,oCAAsC,QAAtC,sCAEAA,IAAA,mBAAqB,QAArB,qBAjBUA,OAAA,IAoBL,MAAMF,EAAmB,IAAI,IAAoB,CACtD,CAAC,QAAS,IAAI,EACd,CAAC,QAAS,IAAI,CAChB,CAAC,EAEM,IAAKG,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA,IAOL,MAAMK,EAAe,CAC1B,GAAI,IACJ,GAAI,OACJ,GAAI,IACJ,GAAI,SACJ,GAAI,UACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,IACJ,GAAI,IACJ,GAAI,MACJ,GAAI,QACN",
|
|
6
6
|
"names": ["const_exports", "__export", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "AlpcErrorCode", "ApprovalStatus", "ConsumeType", "CouponType", "CreditType", "DTC_TASK_TYPE", "PRICE_SYMBOL", "RewardType", "TaskSubType", "TaskType", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var T=(s,e)=>{for(var t in e)p(s,t,{get:e[t],enumerable:!0})},x=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of w(e))!L.call(s,o)&&o!==t&&p(s,o,{get:()=>e[o],enumerable:!(n=M(e,o))||n.enumerable});return s};var N=s=>x(p({},"__esModule",{value:!0}),s);var B={};T(B,{default:()=>z});module.exports=N(B);var r=require("react"),a=require("../const"),l=require("./useAlpcFetch"),g=require("../provider"),_=require("@anker-in/lib");function h({page:s,pageSize:e,consumeType:t}){const{profile:n,alpcBrand:o}=(0,g.useCreditsContext)(),{brand:f,locale:m,appName:y}=(0,_.useHeadlessContext)(),R=o||f,[i,C]=(0,r.useState)([]),[d,P]=(0,r.useState)(0),{isMutating:c,trigger:b}=(0,l.useAlpcMutation)({url:"/v1/credit/log/coupon",initData:{brand:R,country:a.ALPC_COUNTRY_MAP.get(m)||m,app_name:y}}),u=(0,r.useCallback)(async()=>{n?.user_id&&await b({consume_type:t||a.AlpcConsumeType.Coupon,page:s,page_size:e,user_id:n?.user_id},{onSuccess(A){C(A?.data?.redeem_logs||[])}})},[t,s,e,n?.user_id]);return(0,r.useEffect)(()=>{u()},[u]),{myRewards:i,isLoading:c,total:d,getMyRewards:u,canNext:d>i.length&&!c}}var z=h;
|
|
2
2
|
//# sourceMappingURL=useMyRewards.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useMyRewards.ts"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const {
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAkD,oBAClDC,EAAgC,0BAEhCC,EAAkC,uBAClCC,EAAmC,yBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,
|
|
6
|
-
"names": ["useMyRewards_exports", "__export", "useMyRewards_default", "__toCommonJS", "import_react", "import_const", "import_useAlpcFetch", "import_provider", "import_lib", "useMyRewards", "page", "pageSize", "consumeType", "
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { profile, alpcBrand } = useCreditsContext()\n const { brand: headlessBrand, locale, appName } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n const getMyRewards = useCallback(async () => {\n if (!profile?.user_id) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, page, pageSize, profile?.user_id])\n\n useEffect(() => {\n getMyRewards()\n }, [getMyRewards])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAkD,oBAClDC,EAAgC,0BAEhCC,EAAkC,uBAClCC,EAAmC,yBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAG,QAAAC,EAAS,UAAAC,CAAU,KAAI,qBAAkB,EAC5C,CAAE,MAAOC,EAAe,OAAAC,EAAQ,QAAAC,CAAQ,KAAI,sBAAmB,EAC/DC,EAAQJ,GAAaC,EAErB,CAACI,EAAWC,CAAY,KAAI,YAA8B,CAAC,CAAC,EAC5D,CAACC,EAAOC,CAAQ,KAAI,YAAS,CAAC,EAE9B,CAAE,WAAYC,EAAW,QAAAC,CAAQ,KAAI,mBAQzC,CACA,IAAK,wBACL,SAAU,CACR,MAAON,EACP,QAAS,mBAAiB,IAAIF,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,CAAC,EAEKQ,KAAe,eAAY,SAAY,CACtCZ,GAAS,SAGd,MAAMW,EACJ,CACE,aAAcZ,GAAe,kBAAgB,OAC7C,KAAAF,EACA,UAAWC,EACX,QAASE,GAAS,OACpB,EACA,CACE,UAAUa,EAAc,CACtBN,EAAaM,GAAc,MAAM,aAAe,CAAC,CAAC,CACpD,CACF,CACF,CACF,EAAG,CAACd,EAAaF,EAAMC,EAAUE,GAAS,OAAO,CAAC,EAElD,sBAAU,IAAM,CACdY,EAAa,CACf,EAAG,CAACA,CAAY,CAAC,EAEV,CACL,UAAAN,EACA,UAAAI,EACA,MAAAF,EACA,aAAAI,EACA,QAASJ,EAAQF,EAAU,QAAU,CAACI,CACxC,CACF,CAEA,IAAOrB,EAAQO",
|
|
6
|
+
"names": ["useMyRewards_exports", "__export", "useMyRewards_default", "__toCommonJS", "import_react", "import_const", "import_useAlpcFetch", "import_provider", "import_lib", "useMyRewards", "page", "pageSize", "consumeType", "profile", "alpcBrand", "headlessBrand", "locale", "appName", "brand", "myRewards", "setMyRewards", "total", "setTotal", "isLoading", "trigger", "getMyRewards", "responseData"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type UseMutationConfig } from './useAlpcFetch';
|
|
2
|
+
type RedeemGoGiftResponse = {
|
|
3
|
+
data: {
|
|
4
|
+
id: string;
|
|
5
|
+
};
|
|
6
|
+
msg: string;
|
|
7
|
+
code: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const useRedeemGoGift: (mutationOptions?: UseMutationConfig<RedeemGoGiftResponse>) => {
|
|
10
|
+
isMutating: boolean;
|
|
11
|
+
trigger: (fetchData: {
|
|
12
|
+
user_id?: string;
|
|
13
|
+
rule_id: number;
|
|
14
|
+
}, opts?: UseMutationConfig<RedeemGoGiftResponse>) => Promise<RedeemGoGiftResponse | undefined>;
|
|
15
|
+
data: RedeemGoGiftResponse | undefined;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var c=(t,e)=>{for(var o in e)s(t,o,{get:e[o],enumerable:!0})},g=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of u(e))!f.call(t,n)&&n!==o&&s(t,n,{get:()=>e[n],enumerable:!(r=p(e,n))||r.enumerable});return t};var l=t=>g(s({},"__esModule",{value:!0}),t);var R={};c(R,{useRedeemGoGift:()=>G});module.exports=l(R);var i=require("../const"),a=require("./useAlpcFetch"),d=require("@anker-in/lib"),m=require("../provider");const G=(t={})=>{const{alpcBrand:e}=(0,m.useCreditsContext)(),{locale:o,appName:r,brand:n}=(0,d.useHeadlessContext)();return(0,a.useAlpcMutation)({url:"/v1/credit/redeem/gogift",initData:{brand:e||n,country:i.ALPC_COUNTRY_MAP.get(o)||o,app_name:r}},t)};
|
|
2
|
+
//# sourceMappingURL=useRedeemGoGift.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemGoGift.ts"],
|
|
4
|
+
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemGoGiftResponse = {\n data: {\n id: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemGoGift = (mutationOptions: UseMutationConfig<RedeemGoGiftResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemGoGiftResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/gogift`,\n initData: {\n brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiC,oBACjCC,EAAwD,0BACxDC,EAAmC,yBACnCC,EAAkC,uBAU3B,MAAML,EAAkB,CAACM,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,CAAU,KAAI,qBAAkB,EAClC,CAAE,OAAAC,EAAQ,QAAAC,EAAS,MAAOC,CAAc,KAAI,sBAAmB,EAGrE,SAAO,mBAOL,CACE,IAAK,2BACL,SAAU,CACR,MAZQH,GAAaG,EAarB,QAAS,mBAAiB,IAAIF,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,EACAH,CACF,CACF",
|
|
6
|
+
"names": ["useRedeemGoGift_exports", "__export", "useRedeemGoGift", "__toCommonJS", "import_const", "import_useAlpcFetch", "import_lib", "import_provider", "mutationOptions", "alpcBrand", "locale", "appName", "headlessBrand"]
|
|
7
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { AlpcConsumeType } from '../const';
|
|
1
2
|
import type { ConsumeCreditRuleResponse } from '../response';
|
|
2
|
-
declare function useRedeemableList(
|
|
3
|
+
declare function useRedeemableList(props?: {
|
|
4
|
+
consumeType: AlpcConsumeType;
|
|
5
|
+
}): {
|
|
3
6
|
listLoading: boolean;
|
|
4
7
|
redeemableList: ConsumeCreditRuleResponse[];
|
|
5
|
-
getRedeemableList: (
|
|
8
|
+
getRedeemableList: (props?: {
|
|
9
|
+
consumeType?: AlpcConsumeType;
|
|
10
|
+
}) => void;
|
|
6
11
|
};
|
|
7
12
|
export default useRedeemableList;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var i=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var M=(s,e)=>{for(var t in e)i(s,t,{get:e[t],enumerable:!0})},P=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of A(e))!x.call(s,o)&&o!==t&&i(s,o,{get:()=>e[o],enumerable:!(r=b(e,o))||r.enumerable});return s};var B=s=>P(i({},"__esModule",{value:!0}),s);var h={};M(h,{default:()=>U});module.exports=B(h);var n=require("react"),a=require("./useAlpcFetch"),d=require("../const"),C=require("../provider"),f=require("@anker-in/lib");function S(s){let e="";const{profile:t,isLoadingProfile:r,alpcBrand:o}=(0,C.useCreditsContext)(),{locale:c,brand:y}=(0,f.useHeadlessContext)(),_=o||y;c==="pl"?e="eu":e=c;const[g,T]=(0,n.useState)([]),{isMutating:R,trigger:l}=(0,a.useAlpcMutation)({url:"/v1/credit/consume_credit_rules",initData:{brand:_,page:1,page_size:999,country:(d.ALPC_COUNTRY_MAP.get(e)||e)?.toUpperCase()}}),u=(0,n.useCallback)(m=>{l({user_id:t?.user_id,...m?.consumeType&&{consume_type:m.consumeType}},{onSuccess(p){console.log("responseData",p);let L=p.data.consume_credit_rules||[];T(L)}})},[t,l,e]);return(0,n.useEffect)(()=>{r||u({consumeType:s?.consumeType})},[u,r]),{listLoading:R,redeemableList:g,getRedeemableList:u}}var U=S;
|
|
2
2
|
//# sourceMappingURL=useRedeemableList.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemableList.ts"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList() {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { user_id?: string
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAgC,0BAChCC,
|
|
6
|
-
"names": ["useRedeemableList_exports", "__export", "useRedeemableList_default", "__toCommonJS", "import_react", "import_useAlpcFetch", "import_const", "import_provider", "import_lib", "useRedeemableList", "locale", "profile", "isLoadingProfile", "alpcBrand", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list"
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList(props?: { consumeType: AlpcConsumeType }) {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { consume_type?: AlpcConsumeType, user_id?: string}\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 999,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n },\n })\n\n const getRedeemableList = useCallback((props?: { consumeType?: AlpcConsumeType}) => {\n trigger(\n {\n user_id: profile?.user_id,\n ...(props?.consumeType && {consume_type: props.consumeType})\n },\n {\n onSuccess(responseData) {\n console.log('responseData', responseData)\n let list = responseData.data.consume_credit_rules || []\n // let cList = list.filter(i => i.consume_type == 1) || []\n // let pList = list.filter(i => i.consume_type == 2) || []\n // cList = cList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n // pList = pList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n // const resultList = cList.concat(pList)\n setRedeemableList(list)\n },\n }\n )\n }, [profile, trigger, locale])\n\n useEffect(() => {\n if (!isLoadingProfile) {\n getRedeemableList({ consumeType: props?.consumeType })\n }\n }, [getRedeemableList, isLoadingProfile])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAiD,iBAEjDC,EAAgC,0BAChCC,EAAkD,oBAClDC,EAAkC,uBAElCC,EAAmC,yBAEnC,SAASC,EAAkBC,EAA0C,CACnE,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,CAAU,KAAI,qBAAkB,EAC7D,CAAE,OAAQC,EAAe,MAAOC,CAAc,KAAI,sBAAmB,EACrEC,EAAQH,GAAaE,EAEvBD,IAAkB,KACpBJ,EAAS,KAETA,EAASI,EAGX,KAAM,CAACG,EAAgBC,CAAiB,KAAI,YAAsC,CAAC,CAAC,EAC9E,CAAE,WAAYC,EAAa,QAAAC,CAAQ,KAAI,mBAK3C,CACA,IAAK,kCACL,SAAU,CACR,MAAAJ,EACA,KAAM,EACN,UAAW,IACX,SAAU,mBAAiB,IAAIN,CAAM,GAAKA,IAAS,YAAY,CACjE,CACF,CAAC,EAEKW,KAAoB,eAAaZ,GAA6C,CAClFW,EACE,CACE,QAAST,GAAS,QAClB,GAAIF,GAAO,aAAe,CAAC,aAAcA,EAAM,WAAW,CAC5D,EACA,CACE,UAAUa,EAAc,CACtB,QAAQ,IAAI,eAAgBA,CAAY,EACxC,IAAIC,EAAOD,EAAa,KAAK,sBAAwB,CAAC,EAMtDJ,EAAkBK,CAAI,CACxB,CACF,CACF,CACF,EAAG,CAACZ,EAASS,EAASV,CAAM,CAAC,EAE7B,sBAAU,IAAM,CACTE,GACHS,EAAkB,CAAE,YAAaZ,GAAO,WAAY,CAAC,CAEzD,EAAG,CAACY,EAAmBT,CAAgB,CAAC,EAEjC,CACL,YAAAO,EACA,eAAAF,EACA,kBAAAI,CACF,CACF,CAEA,IAAOpB,EAAQO",
|
|
6
|
+
"names": ["useRedeemableList_exports", "__export", "useRedeemableList_default", "__toCommonJS", "import_react", "import_useAlpcFetch", "import_const", "import_provider", "import_lib", "useRedeemableList", "props", "locale", "profile", "isLoadingProfile", "alpcBrand", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list"]
|
|
7
7
|
}
|
|
@@ -35,8 +35,12 @@ type Context = {
|
|
|
35
35
|
discountCodes?: string[];
|
|
36
36
|
}) => void | Promise<any>;
|
|
37
37
|
};
|
|
38
|
+
openMyRewardsModal: boolean;
|
|
39
|
+
setOpenMyRewardsModal: (open: boolean) => void;
|
|
40
|
+
openActivitiesModal: boolean;
|
|
41
|
+
setOpenActivitiesModal: (open: boolean) => void;
|
|
38
42
|
};
|
|
39
43
|
export declare const CreditsContext: import("react").Context<Context>;
|
|
40
|
-
export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, cartConfig, }: PropsWithChildren<Context
|
|
44
|
+
export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, cartConfig, }: PropsWithChildren<Omit<Context, 'openMyRewardsModal' | 'setOpenMyRewardsModal' | 'openActivitiesModal' | 'setOpenActivitiesModal'>>): import("react/jsx-runtime").JSX.Element;
|
|
41
45
|
export declare function useCreditsContext(): Context;
|
|
42
46
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var s=Object.defineProperty;var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var I=(e,o)=>{for(var i in o)s(e,i,{get:o[i],enumerable:!0})},O=(e,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of w(o))!T.call(e,t)&&t!==i&&s(e,t,{get:()=>o[t],enumerable:!(r=R(o,t))||r.enumerable});return e};var h=e=>O(s({},"__esModule",{value:!0}),e);var L={};I(L,{CreditsContext:()=>a,CreditsProvider:()=>S,useCreditsContext:()=>_});module.exports=h(L);var d=require("react/jsx-runtime"),n=require("react");const a=(0,n.createContext)({profile:null,isLoadingProfile:!1,taskIdToTypeMapping:{},removeProfile:()=>{},openSignInPopup:()=>{},openSignUpPopup:()=>{},creditInfo:void 0,customerLoading:!1,fetchCreditInfo:e=>{},gtm:{pageGroup:"",pageHandle:""},pageCommon:{},memberPriceDiscount:void 0,alpcBrand:void 0,cartConfig:void 0,openMyRewardsModal:!1,setOpenMyRewardsModal:()=>{},openActivitiesModal:!1,setOpenActivitiesModal:()=>{}});function S({children:e,profile:o,removeProfile:i,isLoadingProfile:r,openSignInPopup:t,openSignUpPopup:p,taskIdToTypeMapping:l,creditInfo:c,customer:f,customerLoading:u,fetchCreditInfo:g,gtm:m,pageCommon:C,memberPriceDiscount:M,alpcBrand:v,cartConfig:P}){const[y,b]=(0,n.useState)(!1),[A,x]=(0,n.useState)(!1);return(0,d.jsx)(a.Provider,{value:{profile:o,isLoadingProfile:r,removeProfile:i,openSignInPopup:t,openSignUpPopup:p,taskIdToTypeMapping:l,creditInfo:c,fetchCreditInfo:g,customer:f,customerLoading:u,gtm:m,pageCommon:C,memberPriceDiscount:M,alpcBrand:v,cartConfig:P,openMyRewardsModal:y,setOpenMyRewardsModal:b,openActivitiesModal:A,setOpenActivitiesModal:x},children:e})}function _(){const e=(0,n.useContext)(a);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}
|
|
2
2
|
//# sourceMappingURL=provider.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/context/provider.tsx"],
|
|
4
|
-
"sourcesContent": ["import { createContext, PropsWithChildren, useContext } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n pageHandle: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n cartConfig: undefined,\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n}: PropsWithChildren<Context
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,oBAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,
|
|
6
|
-
"names": ["provider_exports", "__export", "CreditsContext", "CreditsProvider", "useCreditsContext", "__toCommonJS", "import_jsx_runtime", "import_react", "user_id", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "cartConfig", "context"]
|
|
4
|
+
"sourcesContent": ["import { createContext, PropsWithChildren, useContext, useState } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\n cartConfig?: {\n addToCart: (params: {\n variantList: Array<{\n variant: any\n quantity: number\n attributes?: Array<{ key: string; value: string }>\n }>\n cartAttributes?: Record<string, string>\n discountCodes?: string[]\n }) => void | Promise<any>\n }\n openMyRewardsModal: boolean\n setOpenMyRewardsModal: (open: boolean) => void\n openActivitiesModal: boolean\n setOpenActivitiesModal: (open: boolean) => void\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n pageHandle: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n cartConfig: undefined,\n openMyRewardsModal: false,\n setOpenMyRewardsModal: () => {},\n openActivitiesModal: false,\n setOpenActivitiesModal: () => {},\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n}: PropsWithChildren<Omit<Context, 'openMyRewardsModal' | 'setOpenMyRewardsModal' | 'openActivitiesModal' | 'setOpenActivitiesModal'>>) {\n const [openMyRewardsModal, setOpenMyRewardsModal] = useState(false)\n const [openActivitiesModal, setOpenActivitiesModal] = useState(false)\n\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n cartConfig,\n openMyRewardsModal,\n setOpenMyRewardsModal,\n openActivitiesModal,\n setOpenActivitiesModal,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,oBAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAL,GAuFI,IAAAM,EAAA,6BAvFJC,EAAuE,iBAyChE,MAAML,KAAiB,iBAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBM,GAAoB,CAAC,EACvC,IAAK,CACH,UAAW,GACX,WAAY,EACd,EACA,WAAY,CAAC,EACb,oBAAqB,OACrB,UAAW,OACX,WAAY,OACZ,mBAAoB,GACpB,sBAAuB,IAAM,CAAC,EAC9B,oBAAqB,GACrB,uBAAwB,IAAM,CAAC,CACjC,CAAC,EAEM,SAASL,EAAgB,CAC9B,SAAAM,EACA,QAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,IAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,CACF,EAAwI,CACtI,KAAM,CAACC,EAAoBC,CAAqB,KAAI,YAAS,EAAK,EAC5D,CAACC,EAAqBC,CAAsB,KAAI,YAAS,EAAK,EAEpE,SACE,OAAC1B,EAAe,SAAf,CACC,MAAO,CACL,QAAAQ,EACA,iBAAAE,EACA,cAAAD,EACA,gBAAAE,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,gBAAAG,EACA,SAAAF,EACA,gBAAAC,EACA,IAAAE,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,EACA,WAAAC,EACA,mBAAAC,EACA,sBAAAC,EACA,oBAAAC,EACA,uBAAAC,CACF,EAEC,SAAAnB,EACH,CAEJ,CAEO,SAASL,GAAoB,CAClC,MAAMyB,KAAU,cAAW3B,CAAc,EACzC,GAAI,CAAC2B,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
|
|
6
|
+
"names": ["provider_exports", "__export", "CreditsContext", "CreditsProvider", "useCreditsContext", "__toCommonJS", "import_jsx_runtime", "import_react", "user_id", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "cartConfig", "openMyRewardsModal", "setOpenMyRewardsModal", "openActivitiesModal", "setOpenActivitiesModal", "context"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/context/response.ts"],
|
|
4
|
-
"sourcesContent": ["import { ApprovalStatus, AlpcConsumeType, CreditType, TaskSubType, TaskType } from './const'\n\n// ALPC\u670D\u52A1\u54CD\u5E94\u6570\u636E\u7C7B\u578B\n\ninterface BaseResponse {\n brand: string\n}\n\nexport interface Task extends BaseResponse {\n goods_sku?: string\n task_type: TaskType\n task_sub_type: TaskSubType\n task_rule_id: number\n task_name: string\n task_note: string\n app_name: string\n}\n\n// \u79EF\u5206\u6D41\u6C34\nexport interface CreditLogResponse extends Task {\n credit: number\n task_name: string\n create_time: number\n credit_type: CreditType\n pending_time: number\n status: number\n expired_time?: number\n}\n\nexport interface ConsumeCreditRuleResponse extends BaseResponse {\n id: number\n name: string\n note: string\n consume_credits: number\n consume_type: AlpcConsumeType\n coupon_rule: string\n remaining_inventory: number\n is_limited: number\n sku_handle: string\n goods_sku: string\n goods_url: string\n extra?: string // discount, type\n}\n\nexport interface RedeemLogResponse extends BaseResponse {\n goods_title: string\n coupon_code: string\n order_number: string\n create_time: number\n consume_credits: number\n fulfillment_status: string\n approval_status: ApprovalStatus\n rule_id: number\n code_status: number\n}\n\nexport interface CreditTaskResponse extends Task {\n status: number\n is_enable: number\n id: number\n weight: number\n reward_type: number\n}\n\nexport interface CreditInfoResponse extends BaseResponse {\n total_credit: number\n available_credit: number\n pending_credit: number\n expired_credit: number\n cancel_credit: number\n consumed_credit: number\n}\n"],
|
|
4
|
+
"sourcesContent": ["import { ApprovalStatus, AlpcConsumeType, CreditType, TaskSubType, TaskType } from './const'\n\n// ALPC\u670D\u52A1\u54CD\u5E94\u6570\u636E\u7C7B\u578B\n\ninterface BaseResponse {\n brand: string\n}\n\nexport interface Task extends BaseResponse {\n goods_sku?: string\n task_type: TaskType\n task_sub_type: TaskSubType\n task_rule_id: number\n task_name: string\n task_note: string\n app_name: string\n}\n\n// \u79EF\u5206\u6D41\u6C34\nexport interface CreditLogResponse extends Task {\n credit: number\n task_name: string\n create_time: number\n credit_type: CreditType\n pending_time: number\n status: number\n expired_time?: number\n}\n\nexport interface ConsumeCreditRuleResponse extends BaseResponse {\n id: number\n name: string\n note: string\n consume_credits: number\n consume_type: AlpcConsumeType\n coupon_rule: string\n remaining_inventory: number\n is_limited: number\n sku_handle: string\n goods_sku: string\n goods_url: string\n extra?: string // discount, type\n}\n\nexport interface RedeemLogResponse extends BaseResponse {\n goods_title: string\n coupon_code: string\n order_number: string\n create_time: number\n consume_credits: number\n fulfillment_status: string\n approval_status: ApprovalStatus\n rule_id: number\n code_status: number\n link?: string\n}\n\nexport interface CreditTaskResponse extends Task {\n status: number\n is_enable: number\n id: number\n weight: number\n reward_type: number\n}\n\nexport interface CreditInfoResponse extends BaseResponse {\n total_credit: number\n available_credit: number\n pending_credit: number\n expired_credit: number\n cancel_credit: number\n consumed_credit: number\n}\n"],
|
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
6
|
"names": ["response_exports", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var F=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var J=(t,l)=>{for(var r in l)F(t,r,{get:l[r],enumerable:!0})},K=(t,l,r,o)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of V(l))!G.call(t,d)&&d!==r&&F(t,d,{get:()=>l[d],enumerable:!(o=q(l,d))||o.enumerable});return t};var Q=t=>K(F({},"__esModule",{value:!0}),t);var X={};J(X,{CreditsAnkersolixTask:()=>W});module.exports=Q(X);var e=require("react/jsx-runtime"),i=require("@anker-in/headless-ui"),b=require("@heroicons/react/24/outline"),n=require("react"),f=require("./type"),z=require("../creditsWaysToGetCredits/useActions"),R=require("../context/provider"),c=require("@anker-in/lib"),T=require("../../registration"),M=require("../modal/
|
|
1
|
+
"use strict";var F=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var J=(t,l)=>{for(var r in l)F(t,r,{get:l[r],enumerable:!0})},K=(t,l,r,o)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of V(l))!G.call(t,d)&&d!==r&&F(t,d,{get:()=>l[d],enumerable:!(o=q(l,d))||o.enumerable});return t};var Q=t=>K(F({},"__esModule",{value:!0}),t);var X={};J(X,{CreditsAnkersolixTask:()=>W});module.exports=Q(X);var e=require("react/jsx-runtime"),i=require("@anker-in/headless-ui"),b=require("@heroicons/react/24/outline"),n=require("react"),f=require("./type"),z=require("../creditsWaysToGetCredits/useActions"),R=require("../context/provider"),c=require("@anker-in/lib"),T=require("../../registration"),M=require("../modal/CreditsUploadReceiptModal"),A=require("../modal/SubscribeModal"),L=require("../../../constants");const W=({copy:t,classNames:l,id:r})=>{const[o,d]=(0,n.useState)(!1),{profile:U}=(0,R.useCreditsContext)(),{authCodeActivate:O}=(0,T.useRegistration)(),{brand:B}=(0,c.useHeadlessContext)(),h=L.ROUNDED_BRANDS.includes(B),g=!!U,[D,N]=(0,n.useState)(!1),[P,v]=(0,n.useState)(!1),[S,j]=(0,n.useState)(!1),[w,E]=(0,n.useState)(!1),{actions:k}=(0,z.useActions)({copy:t,subscribe:{openSubscribePopup:()=>v(!0),isSuccess:S},uploadReceipt:{openUploadReceiptPopup:()=>N(!0),isSuccess:w}}),p=(t?.list||[]).length>3;(0,n.useEffect)(()=>{if(!o&&p&&window.screen.width<768){const s=setTimeout(()=>{const a=document.getElementById(r||"ankersolix-task");a&&a.scrollIntoView({behavior:"smooth",block:"end"})},300);return()=>clearTimeout(s)}},[o,p,r]);const _=(0,n.useMemo)(()=>{const s=t.list.map(a=>{if(!k[a.id])return;const{finished:u,notLogin:I,notFinished:C,completed:H}=k[a.id];let x="",m,y;return g?u?(x=H.buttonLabel,m=void 0):(x=C.buttonLabel,m=C.handleClick,y=C.link):(x=I.buttonLabel,m=I.handleClick),{...a,buttonLabel:x,handleClick:m,finished:u,link:y}}).filter(Boolean);return g?s.sort((a,u)=>a?.finished&&!u?.finished?1:!a?.finished&&u?.finished?-1:0):s},[k,t.list,g]);return(0,e.jsxs)(i.Container,{id:r,className:"bg-[#F5F5F7]",children:[(0,e.jsx)(i.Heading,{as:"h2",size:"4",html:t.title}),(0,e.jsxs)("div",{className:(0,c.classNames)("mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden",h?"rounded-[8px]":"",!h&&"l:rounded-none"),style:{background:"linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)"},children:[(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none -z-10",style:{background:"radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)"}}),(0,e.jsxs)("div",{className:"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-[8px] l:mt-[8px]",children:[(0,e.jsx)(i.Heading,{as:"h3",size:4,html:t?.subtitle,className:"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]"}),(0,e.jsx)("div",{className:"flex items-center gap-[8px]",children:(0,e.jsx)("p",{className:"text-[48px] font-bold leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]",dangerouslySetInnerHTML:{__html:t.equalCredits}})})]}),t.mainImage?.url&&(0,e.jsx)(i.Picture,{className:"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]",imgClassName:"!h-full !object-contain",source:t.mainImage.url})]}),(0,e.jsxs)("div",{className:"relative mt-[24px]",children:[(0,e.jsxs)("div",{className:(0,c.classNames)("grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out"),style:{height:o||!p?"auto":"512px"},children:[_.map(s=>(0,e.jsxs)("div",{className:(0,c.classNames)("flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]",h?"rounded-[16px]":""),children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(i.Text,{as:"p",html:s.title,size:2,className:"text-pretty text-[24px] font-bold xxl:text-[20px]"}),(0,e.jsxs)("div",{className:"mt-[8px] l:mt-[4px] flex items-center",children:[(0,e.jsx)(i.Picture,{className:"size-[24px] xxl:size-[18px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),(0,e.jsx)(i.Text,{as:"p",html:s.credits,size:2,className:"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]"})]})]}),s.handleClick&&!(s.id===f.TaskType.UploadReceipt&&w)&&!(s.id===f.TaskType.Activate&&O.isActivateSuccess)&&!(s.id===f.TaskType.Subscribe&&S)?(0,e.jsx)(i.Button,{as:s.link?"a":"button",...s.link&&{href:s.link},...s.handleClick&&{onClick:s.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:s.buttonLabel}):(0,e.jsx)(i.Button,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:s.buttonLabel})]},s.id)),!o&&p&&(0,e.jsx)("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)"}})]}),p&&(0,e.jsx)(e.Fragment,{children:o?(0,e.jsx)("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{d(!1)},children:(0,e.jsx)(b.ChevronUpIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:(0,e.jsx)("button",{className:"w-fit",onClick:()=>d(!o),children:(0,e.jsx)(b.ChevronDownIcon,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})})]})]}),t.receipt&&(0,e.jsx)(M.CreditsUploadReceiptModal,{isOpen:D,onClose:()=>{N(!1)},copy:t.receipt,onSuccess:()=>{E(!0)}}),t.subscribe&&(0,e.jsx)(A.CreditsSubscribeModal,{copy:t.subscribe,onSuccess:()=>{j(!0),setTimeout(()=>{v(!1)},3e3)},isOpen:P,onClose:()=>{v(!1)}})]})};
|
|
2
2
|
//# sourceMappingURL=CreditsAnkersolixTask.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { useMemo, useState, useRef, useEffect } from 'react'\n\nimport { TaskType, type CreditsAnkersolixTaskProps } from './type'\nimport { useActions } from '../creditsWaysToGetCredits/useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsAnkersolixTask = ({ copy, classNames, id }: CreditsAnkersolixTaskProps & { id?: string }) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n\n const shouldShowMask = (copy?.list || []).length > 3\n\n // Handle scroll after collapse animation\n useEffect(() => {\n if (!showMore && shouldShowMask && window.screen.width < 768) {\n const timer = setTimeout(() => {\n const section = document.getElementById(id || 'ankersolix-task')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }, 300) // Match transition duration\n return () => clearTimeout(timer)\n }\n }, [showMore, shouldShowMask, id])\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id={id} className=\"bg-[#F5F5F7]\">\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n <div\n className={cn(\n 'mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden',\n rounded ? 'rounded-[8px]' : '',\n !rounded && 'l:rounded-none'\n )}\n style={{\n background: 'linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)',\n }}\n >\n {/* \u5F84\u5411\u6E10\u53D8\u80CC\u666F\u5C42 - \u4F7F\u7528\u4F2A\u5143\u7D20\u6A21\u62DF */}\n <div\n className=\"absolute inset-0 pointer-events-none -z-10\"\n style={{\n background: 'radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)',\n }}\n />\n {/* \u526F\u6807\u9898\u548C\u88C5\u9970\u56FE\u90E8\u5206 */}\n <div className=\"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start\">\n <div className=\"flex flex-col gap-[8px] l:mt-[8px]\">\n <Heading\n as=\"h3\"\n size={4}\n html={copy?.subtitle}\n className=\"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]\"\n />\n <div className=\"flex items-center gap-[8px]\">\n <p\n className=\"text-[48px] font-bold leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]\"\n dangerouslySetInnerHTML={{ __html: copy.equalCredits }}\n />\n </div>\n </div>\n {copy.mainImage?.url && (\n <Picture\n className=\"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]\"\n imgClassName=\"!h-full !object-contain\"\n source={copy.mainImage.url}\n />\n )}\n </div>\n\n {/* \u5361\u7247\u5217\u8868 */}\n <div className=\"relative mt-[24px]\">\n <div\n className={cn(\n 'grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out'\n )}\n style={{\n height: showMore || !shouldShowMask ? 'auto' : '512px',\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]',\n rounded ? 'rounded-[16px]' : ''\n )}\n >\n <div>\n <Text\n as=\"p\"\n html={item.title}\n size={2}\n className=\"text-pretty text-[24px] font-bold xxl:text-[20px]\"\n />\n <div className=\"mt-[8px] l:mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xxl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text\n as=\"p\"\n html={item.credits}\n size={2}\n className=\"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]\"\n />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && shouldShowMask && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)' }}\n ></div>\n )}\n </div>\n {shouldShowMask && (\n <>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
|
|
4
|
+
"sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { useMemo, useState, useRef, useEffect } from 'react'\n\nimport { TaskType, type CreditsAnkersolixTaskProps } from './type'\nimport { useActions } from '../creditsWaysToGetCredits/useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/CreditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/SubscribeModal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsAnkersolixTask = ({ copy, classNames, id }: CreditsAnkersolixTaskProps & { id?: string }) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n\n const shouldShowMask = (copy?.list || []).length > 3\n\n // Handle scroll after collapse animation\n useEffect(() => {\n if (!showMore && shouldShowMask && window.screen.width < 768) {\n const timer = setTimeout(() => {\n const section = document.getElementById(id || 'ankersolix-task')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }, 300) // Match transition duration\n return () => clearTimeout(timer)\n }\n }, [showMore, shouldShowMask, id])\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n return (\n <Container id={id} className=\"bg-[#F5F5F7]\">\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n <div\n className={cn(\n 'mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden',\n rounded ? 'rounded-[8px]' : '',\n !rounded && 'l:rounded-none'\n )}\n style={{\n background: 'linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)',\n }}\n >\n {/* \u5F84\u5411\u6E10\u53D8\u80CC\u666F\u5C42 - \u4F7F\u7528\u4F2A\u5143\u7D20\u6A21\u62DF */}\n <div\n className=\"absolute inset-0 pointer-events-none -z-10\"\n style={{\n background: 'radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)',\n }}\n />\n {/* \u526F\u6807\u9898\u548C\u88C5\u9970\u56FE\u90E8\u5206 */}\n <div className=\"flex items-center justify-between xl-xxl:h-[448px] l-xl:h-[336px] h-[560px] l:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start\">\n <div className=\"flex flex-col gap-[8px] l:mt-[8px]\">\n <Heading\n as=\"h3\"\n size={4}\n html={copy?.subtitle}\n className=\"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]\"\n />\n <div className=\"flex items-center gap-[8px]\">\n <p\n className=\"text-[48px] font-bold leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]\"\n dangerouslySetInnerHTML={{ __html: copy.equalCredits }}\n />\n </div>\n </div>\n {copy.mainImage?.url && (\n <Picture\n className=\"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]\"\n imgClassName=\"!h-full !object-contain\"\n source={copy.mainImage.url}\n />\n )}\n </div>\n\n {/* \u5361\u7247\u5217\u8868 */}\n <div className=\"relative mt-[24px]\">\n <div\n className={cn(\n 'grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto transition-all duration-300 ease-in-out'\n )}\n style={{\n height: showMore || !shouldShowMask ? 'auto' : '512px',\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] xl:p-[16px]',\n rounded ? 'rounded-[16px]' : ''\n )}\n >\n <div>\n <Text\n as=\"p\"\n html={item.title}\n size={2}\n className=\"text-pretty text-[24px] font-bold xxl:text-[20px]\"\n />\n <div className=\"mt-[8px] l:mt-[4px] flex items-center\">\n <Picture\n className=\"size-[24px] xxl:size-[18px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text\n as=\"p\"\n html={item.credits}\n size={2}\n className=\"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]\"\n />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button variant=\"primary\" size=\"lg\" className=\"mt-[24px] w-fit\" disabled>\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && shouldShowMask && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)' }}\n ></div>\n )}\n </div>\n {shouldShowMask && (\n <>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
|
|
5
5
|
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GA6GM,IAAAI,EAAA,6BA7GNC,EAA0D,iCAC1DC,EAA+C,uCAC/CC,EAAqD,iBAErDC,EAA0D,kBAC1DC,EAA2B,iDAC3BC,EAAkC,+BAClCC,EAAqD,yBACrDC,EAAgC,8BAChCC,EAA0C,8CAC1CC,EAAsC,mCACtCC,EAA+B,8BAExB,MAAMb,EAAwB,CAAC,CAAE,KAAAc,EAAM,WAAAC,EAAY,GAAAC,CAAG,IAAoD,CAC/G,KAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EACxC,CAAE,QAAAC,CAAQ,KAAI,qBAAkB,EAChC,CAAE,iBAAAC,CAAiB,KAAI,mBAAgB,EACvC,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EACvCE,EAAU,CAAC,CAACJ,EAEZ,CAACK,EAA0BC,CAA2B,KAAI,YAAS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ixTask_exports", "__export", "CreditsAnkersolixTask", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_outline", "import_react", "import_type", "import_useActions", "import_provider", "import_lib", "import_registration", "
|
|
6
|
+
"names": ["CreditsAnkersolixTask_exports", "__export", "CreditsAnkersolixTask", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_outline", "import_react", "import_type", "import_useActions", "import_provider", "import_lib", "import_registration", "import_CreditsUploadReceiptModal", "import_SubscribeModal", "import_constants", "copy", "classNames", "id", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "shouldShowMask", "timer", "section", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "b", "cn"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var B=Object.create;var l=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var P=(e,t)=>{for(var s in t)l(e,s,{get:t[s],enumerable:!0})},b=(e,t,s,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of H(t))!M.call(e,r)&&r!==s&&l(e,r,{get:()=>t[r],enumerable:!(o=F(t,r))||o.enumerable});return e};var C=(e,t,s)=>(s=e!=null?B(L(e)):{},b(t||!e||!e.__esModule?l(s,"default",{value:e,enumerable:!0}):s,e)),O=e=>b(l({},"__esModule",{value:!0}),e);var U={};P(U,{CreditsCash:()=>T});module.exports=O(U);var a=require("react/jsx-runtime"),c=require("@anker-in/headless-ui"),p=require("react"),h=C(require("./RedeemableItem")),y=C(require("../context/hooks/useRedeemableList")),v=C(require("../modal/
|
|
1
|
+
"use strict";var B=Object.create;var l=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var P=(e,t)=>{for(var s in t)l(e,s,{get:t[s],enumerable:!0})},b=(e,t,s,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of H(t))!M.call(e,r)&&r!==s&&l(e,r,{get:()=>t[r],enumerable:!(o=F(t,r))||o.enumerable});return e};var C=(e,t,s)=>(s=e!=null?B(L(e)):{},b(t||!e||!e.__esModule?l(s,"default",{value:e,enumerable:!0}):s,e)),O=e=>b(l({},"__esModule",{value:!0}),e);var U={};P(U,{CreditsCash:()=>T});module.exports=O(U);var a=require("react/jsx-runtime"),c=require("@anker-in/headless-ui"),p=require("react"),h=C(require("./RedeemableItem")),y=C(require("../context/hooks/useRedeemableList")),v=C(require("../modal/RulesModal")),u=require("@anker-in/lib"),g=require("@anker-in/lib"),N=require("../context/provider"),R=require("../../../constants");const T=({copy:e,id:t})=>{const[s,o]=(0,p.useState)(),{redeemableList:r}=(0,y.default)(),{pageCommon:D}=(0,N.useCreditsContext)(),{brand:I}=(0,u.useHeadlessContext)(),S=R.ROUNDED_BRANDS.includes(I),_=[],{data:f}=(0,u.useProductsByHandles)({handles:e?.list?.map(n=>n.products?.[0]?.handle)||[],metafieldIdentifiers:{variant:_}}),k=(0,p.useMemo)(()=>f?.map(n=>{const d=(e.list||[]).find(m=>m.products?.[0]?.handle===n.handle),i=r.find(m=>m.id?.toString()===d?.redeemId?.toString()),x=n.variants?.find(m=>m.sku===d?.products?.[0]?.sku)||n.variants?.[0];return!i||!x?null:{product:n,productVariant:x,alpcData:{id:i?.id,consumeCredits:i?.consume_credits,remainingInventory:i?.remaining_inventory,isLimited:i?.is_limited,consumeType:i?.consume_type,title:i?.name,desc:i?.note},config:d}}).filter(Boolean),[f,e.list,r]);return(0,a.jsxs)(c.Container,{id:t,className:(0,g.classNames)("bg-[#F5F5F5]"),children:[(0,a.jsx)(c.Heading,{as:"h2",size:"4",html:e.title}),(0,a.jsx)("div",{className:"relative mt-[24px] grid grid-cols-4 gap-[16px] l:gap-[12px] md:grid-cols-2 md-xl:grid-cols-3",children:k?.map((n,d)=>(0,a.jsx)(h.default,{copy:e,itemData:n,setRules:o,currencyCode:f?.[0]?.price.currencyCode||"USD"},d))}),s&&(0,a.jsx)(v.default,{overlayClassName:"md:px-[16px] md:items-center",className:(0,g.classNames)("md:h-fit md:rounded-b-[16px]",!S&&"md:rounded-none"),isOpen:s.length>0,onClose:()=>o([]),titleClassName:"border-b-transparent h-[56px]",rules:s,scrollClassName:"md:mt-[8px] md:mb-[24px] md:pt-0",title:D?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]})};
|
|
2
2
|
//# sourceMappingURL=CreditsCash.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/creditsCash/CreditsCash.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Container, Heading, Text } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport RedeemableItem from './RedeemableItem'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport RulesModal from '../modal/
|
|
4
|
+
"sourcesContent": ["import { Container, Heading, Text } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\n\nimport RedeemableItem from './RedeemableItem'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport RulesModal from '../modal/RulesModal'\nimport { useProductsByHandles, useHeadlessContext } from '@anker-in/lib'\nimport { CreditsCashCopy, RedeemItem } from './type'\nimport { Product, classNames as cn } from '@anker-in/lib'\nimport { useCreditsContext } from '../context/provider'\nimport { numberFormat } from '../context/utils'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport const CreditsCash = ({ copy, id }: { copy: CreditsCashCopy; id?: string }) => {\n const [rules, setRules] = useState<string | string[]>()\n const { redeemableList } = useRedeemableList()\n const { pageCommon } = useCreditsContext()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const variantMetafieldIdentifiers: any[] = []\n\n const { data: productByHandles } = useProductsByHandles({\n handles: copy?.list?.map(item => item.products?.[0]?.handle) || [],\n metafieldIdentifiers: {\n variant: variantMetafieldIdentifiers,\n },\n })\n\n const list = useMemo(() => {\n return productByHandles\n ?.map((product: Product) => {\n const config = (copy.list || []).find(item => item.products?.[0]?.handle === product.handle)\n const alpcData = redeemableList.find(item => item.id?.toString() === config?.redeemId?.toString())\n const productVariant =\n product.variants?.find((variant: any) => variant.sku === config?.products?.[0]?.sku) || product.variants?.[0]\n if (!alpcData || !productVariant) return null\n return {\n product,\n productVariant,\n alpcData: {\n id: alpcData?.id,\n consumeCredits: alpcData?.consume_credits,\n remainingInventory: alpcData?.remaining_inventory,\n isLimited: alpcData?.is_limited,\n consumeType: alpcData?.consume_type,\n title: alpcData?.name,\n desc: alpcData?.note,\n },\n config,\n }\n })\n .filter(Boolean) as unknown as RedeemItem[]\n }, [productByHandles, copy.list, redeemableList])\n\n return (\n <Container id={id} className={cn('bg-[#F5F5F5]')}>\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n\n <div className=\"relative mt-[24px] grid grid-cols-4 gap-[16px] l:gap-[12px] md:grid-cols-2 md-xl:grid-cols-3\">\n {list?.map((item, index: number) => (\n <RedeemableItem\n key={index}\n copy={copy}\n itemData={item}\n setRules={setRules}\n currencyCode={productByHandles?.[0]?.price.currencyCode || 'USD'}\n />\n ))}\n </div>\n\n {rules && (\n <RulesModal\n overlayClassName=\"md:px-[16px] md:items-center\"\n className={cn('md:h-fit md:rounded-b-[16px]', !rounded && 'md:rounded-none')}\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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WACrB,YAAaA,GAAU,aACvB,MAAOA,GAAU,KACjB,KAAMA,GAAU,IAClB,EACA,OAAAD,CACF,CACF,CAAC,EACA,OAAO,OAAO,EAChB,CAACJ,EAAkBV,EAAK,KAAMI,CAAc,CAAC,EAEhD,SACE,QAAC,aAAU,GAAIH,EAAI,aAAW,EAAAiB,YAAG,cAAc,EAC7C,oBAAC,WAAQ,GAAG,KAAK,KAAK,IAAI,KAAMlB,EAAK,MAAO,KAE5C,OAAC,OAAI,UAAU,+FACZ,SAAAY,GAAM,IAAI,CAACD,EAAMQ,OAChB,OAAC,EAAAC,QAAA,CAEC,KAAMpB,EACN,SAAUW,EACV,SAAUR,EACV,aAAcO,IAAmB,CAAC,GAAG,MAAM,cAAgB,OAJtDS,CAKP,CACD,EACH,EAECjB,MACC,OAAC,EAAAmB,QAAA,CACC,iBAAiB,+BACjB,aAAW,EAAAH,YAAG,+BAAgC,CAACV,GAAW,iBAAiB,EAC3E,OAAQN,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,CAAC,CAAC,EAC1B,eAAe,gCACf,MAAOD,EACP,gBAAgB,mCAChB,MAAOI,GAAY,UACnB,cAAc,2BAChB,GAEJ,CAEJ",
|
|
6
|
-
"names": ["CreditsCash_exports", "__export", "CreditsCash", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_react", "import_RedeemableItem", "import_useRedeemableList", "
|
|
6
|
+
"names": ["CreditsCash_exports", "__export", "CreditsCash", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_react", "import_RedeemableItem", "import_useRedeemableList", "import_RulesModal", "import_lib", "import_provider", "import_constants", "copy", "id", "rules", "setRules", "redeemableList", "useRedeemableList", "pageCommon", "brand", "rounded", "variantMetafieldIdentifiers", "productByHandles", "item", "list", "product", "config", "alpcData", "productVariant", "variant", "cn", "index", "RedeemableItem", "RulesModal"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var j=Object.create;var C=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var q=(e,l)=>{for(var s in l)C(e,s,{get:l[s],enumerable:!0})},I=(e,l,s,p)=>{if(l&&typeof l=="object"||typeof l=="function")for(let o of U(l))!V.call(e,o)&&o!==s&&C(e,o,{get:()=>l[o],enumerable:!(p=z(l,o))||p.enumerable});return e};var w=(e,l,s)=>(s=e!=null?j($(e)):{},I(l||!e||!e.__esModule?C(s,"default",{value:e,enumerable:!0}):s,e)),J=e=>I(C({},"__esModule",{value:!0}),e);var Q={};q(Q,{CreditsGoGift:()=>K});module.exports=J(Q);var t=require("react/jsx-runtime"),r=require("@anker-in/headless-ui"),d=require("react"),f=require("@anker-in/lib"),M=w(require("../creditsRedeemList/RedeemVirtualProductModal")),k=w(require("../context/hooks/useRedeemableList")),T=require("../context/provider"),O=require("../../../constants"),_=require("@anker-in/lib"),m=require("../context/const"),A=w(require("../modal/RulesModal")),G=require("../../../components/registration");const K=({copy:e,id:l})=>{const[s,p]=(0,d.useState)(!1),[o,u]=(0,d.useState)(),[v,E]=(0,d.useState)(),{redeemableList:N}=(0,k.default)({consumeType:m.AlpcConsumeType.ExternalProduct}),{pageCommon:n,profile:x,creditInfo:R,setOpenMyRewardsModal:H,openSignUpPopup:B}=(0,T.useCreditsContext)(),{authCodeActivate:L}=(0,G.useRegistration)(),{brand:y}=(0,_.useHeadlessContext)(),g=O.ROUNDED_BRANDS.includes(y),b=Object.keys(x||{}).length>0,F=n?.redeemModal||{};console.log("redeemableList",N);const c=(0,d.useMemo)(()=>{const i=N.find(a=>a.id?.toString()===e?.redeemId?.toString());return i?{alpc:{id:i.id.toString(),consumeCredits:i.consume_credits,remainingInventory:i.remaining_inventory,isLimited:!!i.is_limited,consumeType:i.consume_type,showCredit:!0,title:i.name},config:{title:e.cardTitle,desc:e.cardDesc,type:e.type,value:e.value||"",rules:e.rules,image:e.cardImg}}:null},[N,e]),P=i=>{const a=n?.redeemModal;i===m.AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit?u(a?.redeemLimitError):i===m.AlpcErrorCode.CodeLpcRuleInventoryNotEnough?u(a?.inventoryNotEnough):i===m.AlpcErrorCode.CodeLpcNotEnoughCredits?u(a?.creditsNotEnough):i===m.AlpcErrorCode.CodeCrossSiteError?u(a?.crossSiteError):u(a?.commonError)},S=(0,d.useMemo)(()=>x?.activated&&Number(c?.alpc?.consumeCredits)>Number(R?.available_credit||0),[x?.activated,c?.alpc?.consumeCredits,R?.available_credit]),h=Number(c?.alpc.remainingInventory)<=0,D=(0,d.useMemo)(()=>h?n?.soldOut||"Sold Out":b?e.redeemBtn:e.unlockRewards,[b,h,e,n]);return c?(0,t.jsxs)(r.Container,{id:l,children:[(0,t.jsx)(r.Heading,{as:"h2",size:"4",html:e.title}),(0,t.jsxs)("div",{className:(0,f.classNames)("mt-[24px] flex h-fit w-full items-center bg-[#eaeaec] p-[24px]","l:flex-col l:gap-[12px] l:p-[12px]","min-l:flex-row min-l:gap-[64px]",!g&&"rounded-none",g&&"rounded-[12px]"),children:[(0,t.jsx)("div",{className:"relative flex h-[200px] w-[304px] shrink-0 items-center justify-center overflow-hidden l:h-auto l:aspect-h-[120] l:aspect-w-[304] l:w-full",children:e.cardImg?.url&&(0,t.jsx)(r.Picture,{className:(0,f.classNames)("size-full",g&&"rounded-[12px]"),source:e.mCardImg?.url?`${e.cardImg.url},${e.mCardImg.url} 1024`:e.cardImg.url})}),(0,t.jsxs)("div",{className:"flex w-full items-end justify-between l:flex-col l:items-start l:gap-[24px]",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-[20px] l:w-full l:gap-[12px]",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-[4px]",children:[(0,t.jsx)(r.Text,{html:e.cardTitle,className:"text-[32px] font-bold leading-[1.2] text-[#1D1D1F] l:text-[18px]"}),(0,t.jsx)(r.Text,{html:e.cardDesc,className:"text-[18px] font-bold leading-[1.4] text-[#3D3D3F] l:text-[12px]"})]}),(0,t.jsx)(r.Text,{html:e.cardTip,className:"text-[18px] font-bold leading-[1.4] text-[#000] l:text-[12px]"})]}),(0,t.jsxs)("div",{className:"flex shrink-0 flex-col items-end l:w-full l:items-start",children:[(0,t.jsx)(r.Button,{variant:"primary",disabled:S||h,onClick:()=>{b?!x?.activated&&!L.isActivateSuccess?L.open():p(!0):B()},title:S?n.insufficientCredits:D,children:D}),o&&(0,t.jsx)("div",{className:"mt-[8px] text-[14px] font-bold leading-[1.2] text-[#FFC24D] l:text-[12px]",children:o}),(e.viewRedeemHistory||e.rulesLink)&&(0,t.jsxs)("div",{className:"mt-[18px] flex gap-[16px] text-[18px] font-bold leading-[1.4] l:mt-[12px] l:gap-0 l:text-[14px]",children:[e.viewRedeemHistory&&(0,t.jsx)(r.Text,{html:e.viewRedeemHistory,className:"cursor-pointer text-[#4794EC] font-bold underline",onClick:()=>H(!0)}),n.ruleLabel&&(0,t.jsx)(r.Text,{html:n.ruleLabel,className:(0,f.classNames)("cursor-pointer text-[#4794EC] font-bold underline",e.viewRedeemHistory&&"l:ml-[16px]"),onClick:()=>E(e.rules)})]})]})]})]}),s&&c&&(0,t.jsx)(M.default,{copy:F,onClose:()=>{p(!1),u(void 0)},item:c,onError:P}),v&&(0,t.jsx)(A.default,{overlayClassName:"md:px-[16px] md:items-center",className:(0,f.classNames)("md:h-fit md:rounded-b-[16px]",!g&&"md:rounded-none"),isOpen:v.length>0,onClose:()=>E(void 0),titleClassName:"border-b-transparent h-[56px]",rules:v,scrollClassName:"md:mt-[8px] mt-[8px] md:mb-[24px] md:pt-0",title:n?.ruleLabel,ruleClassName:"text-[#1d1d1f] font-bold"})]}):null};
|
|
2
|
+
//# sourceMappingURL=CreditsGoGift.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsGoGift/CreditsGoGift.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Container, Heading, Picture, Button, Text } from '@anker-in/headless-ui'\nimport { useMemo, useState } from 'react'\nimport { classNames as cn } from '@anker-in/lib'\n\nimport RedeemVirtualProductModal from '../creditsRedeemList/RedeemVirtualProductModal'\nimport useRedeemableList from '../context/hooks/useRedeemableList'\nimport { useCreditsContext } from '../context/provider'\nimport { ROUNDED_BRANDS } from '../../../constants'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { CreditsGoGiftCopy } from './type'\nimport { AlpcConsumeType, AlpcErrorCode } from '../context/const'\nimport RulesModal from '../modal/RulesModal'\nimport { useRegistration } from '../../../components/registration'\n\nexport const CreditsGoGift = ({ copy, id }: { copy: CreditsGoGiftCopy; id?: string }) => {\n const [showModal, setShowModal] = useState(false)\n const [redeemError, setRedeemError] = useState<string>()\n const [rules, setRules] = useState<string | string[]>()\n const { redeemableList } = useRedeemableList({ consumeType: AlpcConsumeType.ExternalProduct })\n const { pageCommon, profile, creditInfo, setOpenMyRewardsModal, openSignUpPopup } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const isLogin = Object.keys(profile || {}).length > 0\n\n const redeemModalCopy = pageCommon?.redeemModal || ({} as any)\n\n console.log('redeemableList', redeemableList)\n\n const item = useMemo(() => {\n // \u6839\u636E redeemId \u67E5\u8BE2 ExternalProduct \u7684 ALPC \u6570\u636E\n const alpcData = redeemableList.find(item => item.id?.toString() === copy?.redeemId?.toString())\n if (!alpcData) return null\n\n return {\n alpc: {\n id: alpcData.id.toString(),\n consumeCredits: alpcData.consume_credits,\n remainingInventory: alpcData.remaining_inventory,\n isLimited: !!alpcData.is_limited,\n consumeType: alpcData.consume_type,\n showCredit: true,\n title: alpcData.name,\n },\n config: {\n title: copy.cardTitle,\n desc: copy.cardDesc,\n type: copy.type,\n value: copy.value || '',\n rules: copy.rules,\n image: copy.cardImg,\n },\n }\n }, [redeemableList, copy])\n\n const handleRedeemError = (code: AlpcErrorCode) => {\n const redeemModalCopy = pageCommon?.redeemModal\n if (code === AlpcErrorCode.CodeLpcShopifyCouponRuleRedeemLimit) {\n setRedeemError(redeemModalCopy?.redeemLimitError)\n } else if (code === AlpcErrorCode.CodeLpcRuleInventoryNotEnough) {\n setRedeemError(redeemModalCopy?.inventoryNotEnough)\n } else if (code === AlpcErrorCode.CodeLpcNotEnoughCredits) {\n setRedeemError(redeemModalCopy?.creditsNotEnough)\n } else if (code === AlpcErrorCode.CodeCrossSiteError) {\n setRedeemError(redeemModalCopy?.crossSiteError)\n } else {\n setRedeemError(redeemModalCopy?.commonError)\n }\n }\n\n const inSufficientCredit = useMemo(() => {\n return (\n profile?.activated && Number(item?.alpc?.consumeCredits) > Number(creditInfo?.available_credit || 0)\n )\n }, [profile?.activated, item?.alpc?.consumeCredits, creditInfo?.available_credit])\n\n const soldOut = Number(item?.alpc.remainingInventory) <= 0\n\n const redeemButtonText = useMemo(() => {\n // \u7F3A\u8D27\u6587\u6848\n if (soldOut) {\n return pageCommon?.soldOut || 'Sold Out'\n } else if (!isLogin) {\n return copy.unlockRewards\n } else {\n return copy.redeemBtn\n }\n }, [isLogin, soldOut, copy, pageCommon])\n\n if (!item) return null\n\n return (\n <Container id={id}>\n <Heading as=\"h2\" size=\"4\" html={copy.title} />\n <div\n className={cn(\n 'mt-[24px] flex h-fit w-full items-center bg-[#eaeaec] p-[24px]',\n 'l:flex-col l:gap-[12px] l:p-[12px]',\n 'min-l:flex-row min-l:gap-[64px]',\n !rounded && 'rounded-none',\n rounded && 'rounded-[12px]'\n )}\n >\n {/* Card Image */}\n <div className=\"relative flex h-[200px] w-[304px] shrink-0 items-center justify-center overflow-hidden l:h-auto l:aspect-h-[120] l:aspect-w-[304] l:w-full\">\n {copy.cardImg?.url && (\n <Picture\n className={cn('size-full', rounded && 'rounded-[12px]')}\n source={copy.mCardImg?.url ? `${copy.cardImg.url},${copy.mCardImg.url} 1024` : copy.cardImg.url}\n />\n )}\n </div>\n\n {/* Content Section */}\n <div className=\"flex w-full items-end justify-between l:flex-col l:items-start l:gap-[24px]\">\n {/* Text Content */}\n <div className=\"flex flex-col gap-[20px] l:w-full l:gap-[12px]\">\n <div className=\"flex flex-col gap-[4px]\">\n <Text\n html={copy.cardTitle}\n className=\"text-[32px] font-bold leading-[1.2] text-[#1D1D1F] l:text-[18px]\"\n />\n <Text\n html={copy.cardDesc}\n className=\"text-[18px] font-bold leading-[1.4] text-[#3D3D3F] l:text-[12px]\"\n />\n </div>\n <Text\n html={copy.cardTip}\n className=\"text-[18px] font-bold leading-[1.4] text-[#000] l:text-[12px]\"\n />\n </div>\n\n {/* Button and Links */}\n <div className=\"flex shrink-0 flex-col items-end l:w-full l:items-start\">\n <Button\n variant=\"primary\"\n disabled={inSufficientCredit || soldOut}\n onClick={() => {\n if (!isLogin) {\n openSignUpPopup()\n } else if (!profile?.activated && !authCodeActivate.isActivateSuccess) {\n authCodeActivate.open()\n } else {\n setShowModal(true)\n }\n }}\n title={inSufficientCredit ? pageCommon.insufficientCredits : redeemButtonText}\n >\n {redeemButtonText}\n </Button>\n {redeemError && (\n <div className=\"mt-[8px] text-[14px] font-bold leading-[1.2] text-[#FFC24D] l:text-[12px]\">\n {redeemError}\n </div>\n )}\n {(copy.viewRedeemHistory || copy.rulesLink) && (\n <div className=\"mt-[18px] flex gap-[16px] text-[18px] font-bold leading-[1.4] l:mt-[12px] l:gap-0 l:text-[14px]\">\n {copy.viewRedeemHistory && (\n <Text\n html={copy.viewRedeemHistory}\n className=\"cursor-pointer text-[#4794EC] font-bold underline\"\n onClick={() => setOpenMyRewardsModal(true)}\n />\n )}\n {pageCommon.ruleLabel && (\n <Text\n html={pageCommon.ruleLabel}\n className={cn(\n 'cursor-pointer text-[#4794EC] font-bold underline',\n copy.viewRedeemHistory && 'l:ml-[16px]'\n )}\n onClick={() => setRules(copy.rules)}\n />\n )}\n </div>\n )}\n </div>\n </div>\n </div>\n\n {showModal && item && (\n <RedeemVirtualProductModal\n copy={redeemModalCopy}\n onClose={() => {\n setShowModal(false)\n setRedeemError(undefined)\n }}\n item={item}\n onError={handleRedeemError}\n />\n )}\n\n {rules && (\n <RulesModal\n overlayClassName=\"md:px-[16px] md:items-center\"\n className={cn('md:h-fit md:rounded-b-[16px]', !rounded && 'md:rounded-none')}\n isOpen={rules.length > 0}\n onClose={() => setRules(undefined)}\n titleClassName=\"border-b-transparent h-[56px]\"\n rules={rules}\n scrollClassName=\"md:mt-[8px] 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": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GA8FM,IAAAI,EAAA,6BA9FNC,EAA0D,iCAC1DC,EAAkC,iBAClCC,EAAiC,yBAEjCC,EAAsC,6DACtCC,EAA8B,iDAC9BC,EAAkC,+BAClCC,EAA+B,8BAC/BJ,EAAmC,yBAEnCK,EAA+C,4BAC/CC,EAAuB,kCACvBC,EAAgC,4CAEzB,MAAMZ,EAAgB,CAAC,CAAE,KAAAa,EAAM,GAAAC,CAAG,IAAgD,CACvF,KAAM,CAACC,EAAWC,CAAY,KAAI,YAAS,EAAK,EAC1C,CAACC,EAAaC,CAAc,KAAI,YAAiB,EACjD,CAACC,EAAOC,CAAQ,KAAI,YAA4B,EAChD,CAAE,eAAAC,CAAe,KAAI,EAAAC,SAAkB,CAAE,YAAa,kBAAgB,eAAgB,CAAC,EACvF,CAAE,WAAAC,EAAY,QAAAC,EAAS,WAAAC,EAAY,sBAAAC,EAAuB,gBAAAC,CAAgB,KAAI,qBAAkB,EAChG,CAAE,iBAAAC,CAAiB,KAAI,mBAAgB,EACvC,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EAEvCE,EAAU,OAAO,KAAKP,GAAW,CAAC,CAAC,EA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P,EAAK,KAAK,EACpC,GAEJ,GAEJ,GACF,GACF,EAECE,GAAakB,MACZ,OAAC,EAAAQ,QAAA,CACC,KAAMT,EACN,QAAS,IAAM,CACbhB,EAAa,EAAK,EAClBE,EAAe,MAAS,CAC1B,EACA,KAAMe,EACN,QAASE,EACX,EAGDhB,MACC,OAAC,EAAAuB,QAAA,CACC,iBAAiB,+BACjB,aAAW,EAAAF,YAAG,+BAAgC,CAACV,GAAW,iBAAiB,EAC3E,OAAQX,EAAM,OAAS,EACvB,QAAS,IAAMC,EAAS,MAAS,EACjC,eAAe,gCACf,MAAOD,EACP,gBAAgB,4CAChB,MAAOI,GAAY,UACnB,cAAc,2BAChB,GAEJ,EArHgB,IAuHpB",
|
|
6
|
+
"names": ["CreditsGoGift_exports", "__export", "CreditsGoGift", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_react", "import_lib", "import_RedeemVirtualProductModal", "import_useRedeemableList", "import_provider", "import_constants", "import_const", "import_RulesModal", "import_registration", "copy", "id", "showModal", "setShowModal", "redeemError", "setRedeemError", "rules", "setRules", "redeemableList", "useRedeemableList", "pageCommon", "profile", "creditInfo", "setOpenMyRewardsModal", "openSignUpPopup", "authCodeActivate", "brand", "rounded", "isLogin", "redeemModalCopy", "item", "alpcData", "handleRedeemError", "code", "inSufficientCredit", "soldOut", "redeemButtonText", "cn", "RedeemVirtualProductModal", "RulesModal"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var d=(o,t)=>{for(var r in t)p(o,r,{get:t[r],enumerable:!0})},m=(o,t,r,f)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of y(t))!C.call(o,e)&&e!==r&&p(o,e,{get:()=>t[e],enumerable:!(f=G(t,e))||f.enumerable});return o};var s=o=>m(p({},"__esModule",{value:!0}),o);var x={};d(x,{CreditsGoGift:()=>i.CreditsGoGift});module.exports=s(x);var i=require("./CreditsGoGift");
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsGoGift/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { CreditsGoGift } from './CreditsGoGift'\nexport type { CreditsGoGiftCopy } from './type'\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oDAAAE,EAAAF,GAAA,IAAAG,EAA8B",
|
|
6
|
+
"names": ["creditsGoGift_exports", "__export", "__toCommonJS", "import_CreditsGoGift"]
|
|
7
|
+
}
|