@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/templates/Credits.tsx"],
|
|
4
|
-
"sourcesContent": ["import { classNames,
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Credits_exports", "__export", "
|
|
4
|
+
"sourcesContent": ["import { classNames, HeadlessProvider } from '@anker-in/lib'\nimport { RegistrationProvider } from '../components/registration/context/provider'\nimport { CreditsProvider, useCreditsContext } from '../components/credits/context/provider'\nimport { CreditsBanner } from '../components/credits/creditsBanner'\nimport { CreditsInfoCard } from '../components/credits/creditsInfoCard'\nimport { CreditsBenefits } from '../components/credits/creditsBenefits'\nimport { CreditsWaysToGetCredits } from '../components/credits/creditsWaysToGetCredits'\nimport { CreditsAnkersolixTask } from '../components/credits/creditsAnkersolixTask'\nimport { CreditsRedeemList } from '../components/credits/creditsRedeemList'\nimport { CreditsGoGift } from '../components/credits/creditsGoGift'\nimport { CreditsCash } from '../components/credits/creditsCash'\nimport { CreditsMemberPrice } from '../components/credits/creditsMemberPrice'\nimport { CreditsFaq } from '../components/credits/creditsFaq'\nimport { CreditsNavigation } from '../components/credits/creditsNavigation'\nimport ActivitiesModal from '../components/credits/modal/ActivitiesModal'\nimport RewardsModal from '../components/credits/modal/RewardsModal'\nimport { ComponentKey } from './Credits.types'\nimport type {\n CreditsTemplateProps,\n CreditsContentProps,\n CreditsBannerCopy,\n CreditsInfoCardCopy,\n CreditsBenefitsCopy,\n CreditsWaysToGetCreditsCopy,\n CreditsAnkersolixTaskCopy,\n CreditsRedeemListCopy,\n CreditsGoGiftCopy,\n CreditsCashCopy,\n CreditsMemberPriceCopy,\n CreditsFaqCopy,\n} from './Credits.types'\n\nconst CreditsContent = ({ headlessConfig, pageConfig, userContext }: CreditsContentProps) => {\n const { openMyRewardsModal, setOpenMyRewardsModal, openActivitiesModal, setOpenActivitiesModal, pageCommon } = useCreditsContext()\n\n return (\n <>\n {/* \u5BFC\u822A\u7EC4\u4EF6 - \u56FA\u5B9A\u4F4D\u7F6E\uFF0C\u4E0D\u53C2\u4E0E order \u6392\u5E8F */}\n {pageConfig.components[ComponentKey.Navigation] && (\n <CreditsNavigation copy={pageConfig.components[ComponentKey.Navigation]} />\n )}\n <div className={classNames('bg-[#f5f5f7] leading-[1.2]')}>\n {pageConfig.order.map(key => {\n // \u8DF3\u8FC7\u5BFC\u822A\u7EC4\u4EF6\uFF0C\u56E0\u4E3A\u5B83\u5DF2\u7ECF\u56FA\u5B9A\u6E32\u67D3\u5728\u4E0A\u65B9\n if (key === ComponentKey.Navigation) return null\n const componentCopy = pageConfig.components?.[key]\n if (!componentCopy) return null\n return (\n <>\n {key === ComponentKey.Banner && <CreditsBanner copy={componentCopy as CreditsBannerCopy} id={key} />}\n {key === ComponentKey.InfoCard && userContext?.profile && (\n <CreditsInfoCard copy={componentCopy as CreditsInfoCardCopy} id={key} />\n )}\n {key === ComponentKey.Benefits && (\n <CreditsBenefits copy={componentCopy as CreditsBenefitsCopy} id={key} />\n )}\n {key === ComponentKey.WaysToGetCredits && (\n <CreditsWaysToGetCredits\n copy={componentCopy as CreditsWaysToGetCreditsCopy}\n id={key}\n classNames={\n headlessConfig.brand === 'anker'\n ? {\n subtitle: 'text-white',\n equalCreditsText:\n 'bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent',\n }\n : {\n subtitle: 'text-[#D1D1D1]',\n equalCreditsText: 'text-[#F6EAD0]',\n }\n }\n />\n )}\n {key === ComponentKey.AnkersolixTask && (\n <CreditsAnkersolixTask copy={componentCopy as CreditsAnkersolixTaskCopy} id={key} />\n )}\n {key === ComponentKey.RedeemList && (\n <CreditsRedeemList copy={componentCopy as CreditsRedeemListCopy} id={key} />\n )}\n {key === ComponentKey.GoGift && <CreditsGoGift copy={componentCopy as CreditsGoGiftCopy} id={key} />}\n {key === ComponentKey.SpendCreditsLikeCash && (\n <CreditsCash copy={componentCopy as CreditsCashCopy} id={key} />\n )}\n {key === ComponentKey.MemberPrice && (\n <CreditsMemberPrice copy={componentCopy as CreditsMemberPriceCopy} id={key} />\n )}\n {key === ComponentKey.Faqs && <CreditsFaq copy={componentCopy as CreditsFaqCopy} id={key} />}\n {key !== ComponentKey.Banner && (\n <div className=\"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16\" />\n )}\n </>\n )\n })}\n </div>\n\n {/* Global Modals */}\n {pageCommon?.activitiesModal && (\n <ActivitiesModal\n isOpen={openActivitiesModal}\n data={pageCommon.activitiesModal}\n onClose={() => setOpenActivitiesModal(false)}\n />\n )}\n {pageCommon?.rewardsModal && (\n <RewardsModal\n isOpen={openMyRewardsModal}\n data={pageCommon.rewardsModal}\n onClose={() => setOpenMyRewardsModal(false)}\n />\n )}\n </>\n )\n}\n\nexport const CreditsTemplate = ({\n headlessConfig,\n siteConfig,\n creditsConfig,\n userContext,\n pageConfig,\n registrationContext,\n gtm,\n cartConfig,\n}: CreditsTemplateProps) => {\n return (\n <HeadlessProvider headlessConfig={headlessConfig}>\n <RegistrationProvider copy={siteConfig.registrationsSettings} email={userContext?.profile?.email}>\n <CreditsProvider\n profile={userContext?.profile}\n removeProfile={userContext?.removeProfile}\n isLoadingProfile={userContext?.isLoadingProfile}\n openSignInPopup={registrationContext.openSignInPopup}\n openSignUpPopup={registrationContext.openSignUpPopup}\n creditInfo={userContext?.creditInfo}\n taskIdToTypeMapping={siteConfig.taskIdToTypeMapping}\n customer={userContext?.customer}\n fetchCreditInfo={userContext?.fetchCreditInfo}\n customerLoading={userContext?.customerLoading}\n gtm={gtm}\n pageCommon={pageConfig.common}\n memberPriceDiscount={siteConfig.memberPriceDiscount}\n alpcBrand={creditsConfig?.alpcBrand}\n cartConfig={cartConfig}\n >\n <CreditsContent headlessConfig={headlessConfig} pageConfig={pageConfig} userContext={userContext} />\n </CreditsProvider>\n </RegistrationProvider>\n </HeadlessProvider>\n )\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAuCQ,IAAAI,EAAA,6BAvCRC,EAA6C,yBAC7CC,EAAqC,uDACrCA,EAAmD,kDACnDC,EAA8B,+CAC9BC,EAAgC,iDAChCC,EAAgC,iDAChCC,EAAwC,yDACxCC,EAAsC,uDACtCC,EAAkC,mDAClCC,EAA8B,+CAC9BC,EAA4B,6CAC5BC,EAAmC,oDACnCC,EAA2B,4CAC3BC,EAAkC,mDAClCC,EAA4B,0DAC5BC,EAAyB,uDACzBC,EAA6B,2BAgB7B,MAAMC,EAAiB,CAAC,CAAE,eAAAC,EAAgB,WAAAC,EAAY,YAAAC,CAAY,IAA2B,CAC3F,KAAM,CAAE,mBAAAC,EAAoB,sBAAAC,EAAuB,oBAAAC,EAAqB,uBAAAC,EAAwB,WAAAC,CAAW,KAAI,qBAAkB,EAEjI,SACE,oBAEG,UAAAN,EAAW,WAAW,eAAa,UAAU,MAC5C,OAAC,qBAAkB,KAAMA,EAAW,WAAW,eAAa,UAAU,EAAG,KAE3E,OAAC,OAAI,aAAW,cAAW,4BAA4B,EACpD,SAAAA,EAAW,MAAM,IAAIO,GAAO,CAE3B,GAAIA,IAAQ,eAAa,WAAY,OAAO,KAC5C,MAAMC,EAAgBR,EAAW,aAAaO,CAAG,EACjD,OAAKC,KAEH,oBACG,UAAAD,IAAQ,eAAa,WAAU,OAAC,iBAAc,KAAMC,EAAoC,GAAID,EAAK,EACjGA,IAAQ,eAAa,UAAYN,GAAa,YAC7C,OAAC,mBAAgB,KAAMO,EAAsC,GAAID,EAAK,EAEvEA,IAAQ,eAAa,aACpB,OAAC,mBAAgB,KAAMC,EAAsC,GAAID,EAAK,EAEvEA,IAAQ,eAAa,qBACpB,OAAC,2BACC,KAAMC,EACN,GAAID,EACJ,WACER,EAAe,QAAU,QACrB,CACA,SAAU,aACV,iBACE,4EACJ,EACE,CACA,SAAU,iBACV,iBAAkB,gBACpB,EAEN,EAEDQ,IAAQ,eAAa,mBACpB,OAAC,yBAAsB,KAAMC,EAA4C,GAAID,EAAK,EAEnFA,IAAQ,eAAa,eACpB,OAAC,qBAAkB,KAAMC,EAAwC,GAAID,EAAK,EAE3EA,IAAQ,eAAa,WAAU,OAAC,iBAAc,KAAMC,EAAoC,GAAID,EAAK,EACjGA,IAAQ,eAAa,yBACpB,OAAC,eAAY,KAAMC,EAAkC,GAAID,EAAK,EAE/DA,IAAQ,eAAa,gBACpB,OAAC,sBAAmB,KAAMC,EAAyC,GAAID,EAAK,EAE7EA,IAAQ,eAAa,SAAQ,OAAC,cAAW,KAAMC,EAAiC,GAAID,EAAK,EACzFA,IAAQ,eAAa,WACpB,OAAC,OAAI,UAAU,qEAAqE,GAExF,EA7CyB,IA+C7B,CAAC,EACH,EAGCD,GAAY,oBACX,OAAC,EAAAG,QAAA,CACC,OAAQL,EACR,KAAME,EAAW,gBACjB,QAAS,IAAMD,EAAuB,EAAK,EAC7C,EAEDC,GAAY,iBACX,OAAC,EAAAI,QAAA,CACC,OAAQR,EACR,KAAMI,EAAW,aACjB,QAAS,IAAMH,EAAsB,EAAK,EAC5C,GAEJ,CAEJ,EAEaxB,EAAkB,CAAC,CAC9B,eAAAoB,EACA,WAAAY,EACA,cAAAC,EACA,YAAAX,EACA,WAAAD,EACA,oBAAAa,EACA,IAAAC,EACA,WAAAC,CACF,OAEI,OAAC,oBAAiB,eAAgBhB,EAChC,mBAAC,wBAAqB,KAAMY,EAAW,sBAAuB,MAAOV,GAAa,SAAS,MACzF,mBAAC,mBACC,QAASA,GAAa,QACtB,cAAeA,GAAa,cAC5B,iBAAkBA,GAAa,iBAC/B,gBAAiBY,EAAoB,gBACrC,gBAAiBA,EAAoB,gBACrC,WAAYZ,GAAa,WACzB,oBAAqBU,EAAW,oBAChC,SAAUV,GAAa,SACvB,gBAAiBA,GAAa,gBAC9B,gBAAiBA,GAAa,gBAC9B,IAAKa,EACL,WAAYd,EAAW,OACvB,oBAAqBW,EAAW,oBAChC,UAAWC,GAAe,UAC1B,WAAYG,EAEZ,mBAACjB,EAAA,CAAe,eAAgBC,EAAgB,WAAYC,EAAY,YAAaC,EAAa,EACpG,EACF,EACF",
|
|
6
|
+
"names": ["Credits_exports", "__export", "CreditsTemplate", "__toCommonJS", "import_jsx_runtime", "import_lib", "import_provider", "import_creditsBanner", "import_creditsInfoCard", "import_creditsBenefits", "import_creditsWaysToGetCredits", "import_creditsAnkersolixTask", "import_creditsRedeemList", "import_creditsGoGift", "import_creditsCash", "import_creditsMemberPrice", "import_creditsFaq", "import_creditsNavigation", "import_ActivitiesModal", "import_RewardsModal", "import_Credits", "CreditsContent", "headlessConfig", "pageConfig", "userContext", "openMyRewardsModal", "setOpenMyRewardsModal", "openActivitiesModal", "setOpenActivitiesModal", "pageCommon", "key", "componentCopy", "ActivitiesModal", "RewardsModal", "siteConfig", "creditsConfig", "registrationContext", "gtm", "cartConfig"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { HeadlessConfig } from '@anker-in/lib';
|
|
2
|
+
import { DTC_TASK_TYPE } from '../components/credits/context/const';
|
|
3
|
+
import { CreditsPageCommon } from '../components/credits/type';
|
|
4
|
+
import { FunctionMemberPriceConfig } from '../components/credits/context/memberPriceTypes';
|
|
5
|
+
import { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type';
|
|
6
|
+
import type { CreditsBannerCopy } from '../components/credits/creditsBanner';
|
|
7
|
+
import type { CreditsInfoCardCopy } from '../components/credits/creditsInfoCard';
|
|
8
|
+
import type { CreditsBenefitsCopy } from '../components/credits/creditsBenefits';
|
|
9
|
+
import type { CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysToGetCredits';
|
|
10
|
+
import type { CreditsAnkersolixTaskCopy } from '../components/credits/creditsAnkersolixTask';
|
|
11
|
+
import type { CreditsRedeemListCopy } from '../components/credits/creditsRedeemList';
|
|
12
|
+
import type { CreditsGoGiftCopy } from '../components/credits/creditsGoGift';
|
|
13
|
+
import type { CreditsCashCopy } from '../components/credits/creditsCash';
|
|
14
|
+
import type { CreditsMemberPriceCopy } from '../components/credits/creditsMemberPrice';
|
|
15
|
+
import type { CreditsFaqCopy } from '../components/credits/creditsFaq';
|
|
16
|
+
import type { CreditsNavigationCopy } from '../components/credits/creditsNavigation';
|
|
17
|
+
export type { CreditsBannerCopy, CreditsInfoCardCopy, CreditsBenefitsCopy, CreditsWaysToGetCreditsCopy, CreditsAnkersolixTaskCopy, CreditsRedeemListCopy, CreditsGoGiftCopy, CreditsCashCopy, CreditsMemberPriceCopy, CreditsFaqCopy, CreditsNavigationCopy, };
|
|
18
|
+
export declare enum ComponentKey {
|
|
19
|
+
Navigation = "creditsNavigation",
|
|
20
|
+
Banner = "creditsBanner",
|
|
21
|
+
InfoCard = "creditsInfoCard",
|
|
22
|
+
Benefits = "creditsBenefits",
|
|
23
|
+
WaysToGetCredits = "creditsWaysToGetCredits",
|
|
24
|
+
AnkersolixTask = "creditsAnkersolixTask",
|
|
25
|
+
RedeemList = "creditsRedeemList",
|
|
26
|
+
GoGift = "creditsGoGift",
|
|
27
|
+
SpendCreditsLikeCash = "creditsCash",
|
|
28
|
+
MemberPrice = "creditsMemberPrice",
|
|
29
|
+
Faqs = "creditsFaq"
|
|
30
|
+
}
|
|
31
|
+
export type CreditsTemplateProps = {
|
|
32
|
+
headlessConfig: HeadlessConfig;
|
|
33
|
+
siteConfig: {
|
|
34
|
+
registrationsSettings: {
|
|
35
|
+
authCodeActivate: AuthCodeActivateCopy;
|
|
36
|
+
};
|
|
37
|
+
taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>;
|
|
38
|
+
memberPriceDiscount?: FunctionMemberPriceConfig[];
|
|
39
|
+
};
|
|
40
|
+
creditsConfig?: {
|
|
41
|
+
alpcBrand?: string;
|
|
42
|
+
};
|
|
43
|
+
pageConfig: {
|
|
44
|
+
order: ComponentKey[];
|
|
45
|
+
common: CreditsPageCommon;
|
|
46
|
+
components: {
|
|
47
|
+
[ComponentKey.Navigation]?: CreditsNavigationCopy;
|
|
48
|
+
[ComponentKey.Banner]?: CreditsBannerCopy;
|
|
49
|
+
[ComponentKey.InfoCard]?: CreditsInfoCardCopy;
|
|
50
|
+
[ComponentKey.Benefits]?: CreditsBenefitsCopy;
|
|
51
|
+
[ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy;
|
|
52
|
+
[ComponentKey.AnkersolixTask]?: CreditsAnkersolixTaskCopy;
|
|
53
|
+
[ComponentKey.RedeemList]?: CreditsRedeemListCopy;
|
|
54
|
+
[ComponentKey.GoGift]?: CreditsGoGiftCopy;
|
|
55
|
+
[ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy;
|
|
56
|
+
[ComponentKey.MemberPrice]?: CreditsMemberPriceCopy;
|
|
57
|
+
[ComponentKey.Faqs]?: CreditsFaqCopy;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
userContext: {
|
|
61
|
+
profile: any;
|
|
62
|
+
removeProfile: () => void;
|
|
63
|
+
isLoadingProfile: boolean;
|
|
64
|
+
creditInfo: any;
|
|
65
|
+
customer: any;
|
|
66
|
+
customerLoading: boolean;
|
|
67
|
+
fetchCreditInfo: () => void;
|
|
68
|
+
};
|
|
69
|
+
registrationContext: {
|
|
70
|
+
openSignUpPopup: () => void;
|
|
71
|
+
openSignInPopup: () => void;
|
|
72
|
+
};
|
|
73
|
+
gtm: {
|
|
74
|
+
pageGroup: string;
|
|
75
|
+
pageHandle?: string;
|
|
76
|
+
};
|
|
77
|
+
cartConfig?: {
|
|
78
|
+
addToCart: (params: {
|
|
79
|
+
variantList: Array<{
|
|
80
|
+
variant: any;
|
|
81
|
+
quantity: number;
|
|
82
|
+
attributes?: Array<{
|
|
83
|
+
key: string;
|
|
84
|
+
value: string;
|
|
85
|
+
}>;
|
|
86
|
+
}>;
|
|
87
|
+
cartAttributes?: Record<string, string>;
|
|
88
|
+
discountCodes?: string[];
|
|
89
|
+
}) => void | Promise<any>;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export type CreditsContentProps = {
|
|
93
|
+
headlessConfig: HeadlessConfig;
|
|
94
|
+
pageConfig: CreditsTemplateProps['pageConfig'];
|
|
95
|
+
userContext: CreditsTemplateProps['userContext'];
|
|
96
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var m=(i,t)=>{for(var o in t)s(i,o,{get:t[o],enumerable:!0})},c=(i,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of p(t))!a.call(i,r)&&r!==o&&s(i,r,{get:()=>t[r],enumerable:!(n=d(t,r))||n.enumerable});return i};var y=i=>c(s({},"__esModule",{value:!0}),i);var f={};m(f,{ComponentKey:()=>C});module.exports=y(f);var C=(e=>(e.Navigation="creditsNavigation",e.Banner="creditsBanner",e.InfoCard="creditsInfoCard",e.Benefits="creditsBenefits",e.WaysToGetCredits="creditsWaysToGetCredits",e.AnkersolixTask="creditsAnkersolixTask",e.RedeemList="creditsRedeemList",e.GoGift="creditsGoGift",e.SpendCreditsLikeCash="creditsCash",e.MemberPrice="creditsMemberPrice",e.Faqs="creditsFaq",e))(C||{});
|
|
2
|
+
//# sourceMappingURL=Credits.types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/templates/Credits.types.ts"],
|
|
4
|
+
"sourcesContent": ["import { HeadlessConfig } from '@anker-in/lib'\nimport { DTC_TASK_TYPE } from '../components/credits/context/const'\nimport { CreditsPageCommon } from '../components/credits/type'\nimport { FunctionMemberPriceConfig } from '../components/credits/context/memberPriceTypes'\nimport { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type'\nimport type { CreditsBannerCopy } from '../components/credits/creditsBanner'\nimport type { CreditsInfoCardCopy } from '../components/credits/creditsInfoCard'\nimport type { CreditsBenefitsCopy } from '../components/credits/creditsBenefits'\nimport type { CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysToGetCredits'\nimport type { CreditsAnkersolixTaskCopy } from '../components/credits/creditsAnkersolixTask'\nimport type { CreditsRedeemListCopy } from '../components/credits/creditsRedeemList'\nimport type { CreditsGoGiftCopy } from '../components/credits/creditsGoGift'\nimport type { CreditsCashCopy } from '../components/credits/creditsCash'\nimport type { CreditsMemberPriceCopy } from '../components/credits/creditsMemberPrice'\nimport type { CreditsFaqCopy } from '../components/credits/creditsFaq'\nimport type { CreditsNavigationCopy } from '../components/credits/creditsNavigation'\n\n// Re-export copy types for convenience\nexport type {\n CreditsBannerCopy,\n CreditsInfoCardCopy,\n CreditsBenefitsCopy,\n CreditsWaysToGetCreditsCopy,\n CreditsAnkersolixTaskCopy,\n CreditsRedeemListCopy,\n CreditsGoGiftCopy,\n CreditsCashCopy,\n CreditsMemberPriceCopy,\n CreditsFaqCopy,\n CreditsNavigationCopy,\n}\n\nexport enum ComponentKey {\n Navigation = 'creditsNavigation',\n Banner = 'creditsBanner',\n InfoCard = 'creditsInfoCard',\n Benefits = 'creditsBenefits',\n WaysToGetCredits = 'creditsWaysToGetCredits',\n AnkersolixTask = 'creditsAnkersolixTask',\n RedeemList = 'creditsRedeemList',\n GoGift = 'creditsGoGift',\n SpendCreditsLikeCash = 'creditsCash',\n MemberPrice = 'creditsMemberPrice',\n Faqs = 'creditsFaq',\n}\n\nexport type CreditsTemplateProps = {\n headlessConfig: HeadlessConfig\n siteConfig: {\n registrationsSettings: {\n authCodeActivate: AuthCodeActivateCopy\n }\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n }\n creditsConfig?: {\n alpcBrand?: string\n }\n pageConfig: {\n order: ComponentKey[]\n common: CreditsPageCommon\n components: {\n [ComponentKey.Navigation]?: CreditsNavigationCopy\n [ComponentKey.Banner]?: CreditsBannerCopy\n [ComponentKey.InfoCard]?: CreditsInfoCardCopy\n [ComponentKey.Benefits]?: CreditsBenefitsCopy\n [ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy\n [ComponentKey.AnkersolixTask]?: CreditsAnkersolixTaskCopy\n [ComponentKey.RedeemList]?: CreditsRedeemListCopy\n [ComponentKey.GoGift]?: CreditsGoGiftCopy\n [ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy\n [ComponentKey.MemberPrice]?: CreditsMemberPriceCopy\n [ComponentKey.Faqs]?: CreditsFaqCopy\n }\n }\n userContext: {\n profile: any\n removeProfile: () => void\n isLoadingProfile: boolean\n creditInfo: any\n customer: any\n customerLoading: boolean\n fetchCreditInfo: () => void\n }\n registrationContext: {\n openSignUpPopup: () => void\n openSignInPopup: () => void\n }\n gtm: {\n pageGroup: string\n pageHandle?: string\n }\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 type CreditsContentProps = {\n headlessConfig: HeadlessConfig\n pageConfig: CreditsTemplateProps['pageConfig']\n userContext: CreditsTemplateProps['userContext']\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAgCO,IAAKE,OACVA,EAAA,WAAa,oBACbA,EAAA,OAAS,gBACTA,EAAA,SAAW,kBACXA,EAAA,SAAW,kBACXA,EAAA,iBAAmB,0BACnBA,EAAA,eAAiB,wBACjBA,EAAA,WAAa,oBACbA,EAAA,OAAS,gBACTA,EAAA,qBAAuB,cACvBA,EAAA,YAAc,qBACdA,EAAA,KAAO,aAXGA,OAAA",
|
|
6
|
+
"names": ["Credits_types_exports", "__export", "ComponentKey", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -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
|
-
var
|
|
1
|
+
var c=(g=>(g[g.All=0]="All",g[g.Earned=1]="Earned",g[g.Deducted=2]="Deducted",g[g.Expired=3]="Expired",g))(c||{}),P=(f=>(f.Coupon="coupon",f.GiftCard="giftCard",f.GoGift="goGift",f.Product="product",f.ShippingCoupon="shippingCoupon",f))(P||{}),u=(t=>(t[t.Coupon=1]="Coupon",t[t.Product=2]="Product",t[t.ExternalProduct=5]="ExternalProduct",t))(u||{}),h=(t=>(t[t.Program=1]="Program",t[t.Operation=2]="Operation",t[t.Redeem=3]="Redeem",t))(h||{}),G=(t=>(t.FirstPurchase="firstPurchase",t.UploadReceipt="uploadReceipt",t.Shopping="shopping",t))(G||{}),L=(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))(L||{}),U=(x=>(x.FixedMount="fixed_amount",x.Percent="percent",x))(U||{}),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||{}),F=(i=>(i[i.CodeLpcRedeemFailed=180001]="CodeLpcRedeemFailed",i[i.CodeLpcUserNotFound=180002]="CodeLpcUserNotFound",i[i.CodeLpcCreditRuleNotFound=180003]="CodeLpcCreditRuleNotFound",i[i.CodeLpcUnknownError=180004]="CodeLpcUnknownError",i[i.CodeLpcNotEnoughCredits=180005]="CodeLpcNotEnoughCredits",i[i.CodeLpcUserMigrate=180006]="CodeLpcUserMigrate",i[i.CodeLpcRuleInventoryNotEnough=180007]="CodeLpcRuleInventoryNotEnough",i[i.CodeLpcShopifyCouponRuleRedeemLimit=180009]="CodeLpcShopifyCouponRuleRedeemLimit",i[i.CodeCrossSiteError=180011]="CodeCrossSiteError",i))(F||{});const M=new Map([["eu-en","eu"],["eu-de","de"]]);var N=(g=>(g[g.Pending=0]="Pending",g[g.Success=1]="Success",g[g.Failed=2]="Failed",g[g.DoubleConfirm=3]="DoubleConfirm",g))(N||{});const $={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",pl:"z\u0142",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED",es:"\u20AC"};export{M as ALPC_COUNTRY_MAP,u as AlpcConsumeType,F as AlpcErrorCode,N as ApprovalStatus,P as ConsumeType,U as CouponType,c as CreditType,G as DTC_TASK_TYPE,$ as PRICE_SYMBOL,m as RewardType,L as TaskSubType,h as TaskType};
|
|
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": "AAAO,IAAKA,OACVA,IAAA,IAAM,GAAN,MACAA,IAAA,OAAS,GAAT,SACAA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UAJUA,OAAA,IAOAC,OACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBALPA,OAAA,IAQAC,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 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": "AAAO,IAAKA,OACVA,IAAA,IAAM,GAAN,MACAA,IAAA,OAAS,GAAT,SACAA,IAAA,SAAW,GAAX,WACAA,IAAA,QAAU,GAAV,UAJUA,OAAA,IAOAC,OACVA,EAAA,OAAS,SACTA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,QAAU,UACVA,EAAA,eAAiB,iBALPA,OAAA,IAQAC,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA,QAAU,GAAV,UACAA,IAAA,gBAAkB,GAAlB,kBAHUA,OAAA,IAMAC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SAHUA,OAAA,IAMAC,OACVA,EAAA,cAAgB,gBAChBA,EAAA,cAAgB,gBAChBA,EAAA,SAAW,WAHDA,OAAA,IAMAC,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,WAAa,GAAb,aACAA,IAAA,YAAc,GAAd,cACAA,IAAA,eAAiB,GAAjB,iBACAA,IAAA,aAAe,GAAf,eACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,OAAS,KAAT,SACAA,IAAA,kBAAoB,KAApB,oBARUA,OAAA,IAWAC,OACVA,EAAA,WAAa,eACbA,EAAA,QAAU,UAFAA,OAAA,IAKAC,OACVA,IAAA,SAAW,GAAX,WACAA,IAAA,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,IAiBAC,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,MAAMC,EAAmB,IAAI,IAAoB,CACtD,CAAC,QAAS,IAAI,EACd,CAAC,QAAS,IAAI,CAChB,CAAC,EAEM,IAAKC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA,IAOL,MAAMC,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": ["CreditType", "ConsumeType", "AlpcConsumeType", "TaskType", "DTC_TASK_TYPE", "TaskSubType", "CouponType", "RewardType", "AlpcErrorCode", "ALPC_COUNTRY_MAP", "ApprovalStatus", "PRICE_SYMBOL"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useCallback as
|
|
1
|
+
import{useCallback as y,useEffect as R,useState as m}from"react";import{ALPC_COUNTRY_MAP as C,AlpcConsumeType as b}from"../const";import{useAlpcMutation as A}from"./useAlpcFetch";import{useCreditsContext as M}from"../provider";import{useHeadlessContext as w}from"@anker-in/lib";function L({page:t,pageSize:o,consumeType:r}){const{profile:e,alpcBrand:i}=M(),{brand:d,locale:n,appName:c}=w(),l=i||d,[a,g]=m([]),[u,T]=m(0),{isMutating:p,trigger:_}=A({url:"/v1/credit/log/coupon",initData:{brand:l,country:C.get(n)||n,app_name:c}}),s=y(async()=>{e?.user_id&&await _({consume_type:r||b.Coupon,page:t,page_size:o,user_id:e?.user_id},{onSuccess(f){g(f?.data?.redeem_logs||[])}})},[r,t,o,e?.user_id]);return R(()=>{s()},[s]),{myRewards:a,isLoading:p,total:u,getMyRewards:s,canNext:u>a.length&&!p}}var P=L;export{P as default};
|
|
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": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,oBAAAC,EAAkB,mBAAAC,MAAuB,WAClD,OAAS,mBAAAC,MAAuB,iBAEhC,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,
|
|
6
|
-
"names": ["useCallback", "useEffect", "useState", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "useAlpcMutation", "useCreditsContext", "useHeadlessContext", "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": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,oBAAAC,EAAkB,mBAAAC,MAAuB,WAClD,OAAS,mBAAAC,MAAuB,iBAEhC,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAG,QAAAC,EAAS,UAAAC,CAAU,EAAIP,EAAkB,EAC5C,CAAE,MAAOQ,EAAe,OAAAC,EAAQ,QAAAC,CAAQ,EAAIT,EAAmB,EAC/DU,EAAQJ,GAAaC,EAErB,CAACI,EAAWC,CAAY,EAAIjB,EAA8B,CAAC,CAAC,EAC5D,CAACkB,EAAOC,CAAQ,EAAInB,EAAS,CAAC,EAE9B,CAAE,WAAYoB,EAAW,QAAAC,CAAQ,EAAIlB,EAQzC,CACA,IAAK,wBACL,SAAU,CACR,MAAOY,EACP,QAASd,EAAiB,IAAIY,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,CAAC,EAEKQ,EAAexB,EAAY,SAAY,CACtCY,GAAS,SAGd,MAAMW,EACJ,CACE,aAAcZ,GAAeP,EAAgB,OAC7C,KAAAK,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,OAAAX,EAAU,IAAM,CACduB,EAAa,CACf,EAAG,CAACA,CAAY,CAAC,EAEV,CACL,UAAAN,EACA,UAAAI,EACA,MAAAF,EACA,aAAAI,EACA,QAASJ,EAAQF,EAAU,QAAU,CAACI,CACxC,CACF,CAEA,IAAOI,EAAQlB",
|
|
6
|
+
"names": ["useCallback", "useEffect", "useState", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "useAlpcMutation", "useCreditsContext", "useHeadlessContext", "useMyRewards", "page", "pageSize", "consumeType", "profile", "alpcBrand", "headlessBrand", "locale", "appName", "brand", "myRewards", "setMyRewards", "total", "setTotal", "isLoading", "trigger", "getMyRewards", "responseData", "useMyRewards_default"]
|
|
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
|
+
import{ALPC_COUNTRY_MAP as s}from"../const";import{useAlpcMutation as i}from"./useAlpcFetch";import{useHeadlessContext as a}from"@anker-in/lib";import{useCreditsContext as d}from"../provider";const g=(t={})=>{const{alpcBrand:o}=d(),{locale:e,appName:n,brand:r}=a();return i({url:"/v1/credit/redeem/gogift",initData:{brand:o||r,country:s.get(e)||e,app_name:n}},t)};export{g as useRedeemGoGift};
|
|
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": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,cAU3B,MAAMC,EAAkB,CAACC,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,CAAU,EAAIH,EAAkB,EAClC,CAAE,OAAAI,EAAQ,QAAAC,EAAS,MAAOC,CAAc,EAAIP,EAAmB,EAGrE,OAAOD,EAOL,CACE,IAAK,2BACL,SAAU,CACR,MAZQK,GAAaG,EAarB,QAAST,EAAiB,IAAIO,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,EACAH,CACF,CACF",
|
|
6
|
+
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useCreditsContext", "useRedeemGoGift", "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
|
-
import{useCallback as
|
|
1
|
+
import{useCallback as y,useEffect as _,useState as g}from"react";import{useAlpcMutation as T}from"./useAlpcFetch";import{ALPC_COUNTRY_MAP as R}from"../const";import{useCreditsContext as L}from"../provider";import{useHeadlessContext as b}from"@anker-in/lib";function A(c){let e="";const{profile:t,isLoadingProfile:o,alpcBrand:l}=L(),{locale:n,brand:m}=b(),p=l||m;n==="pl"?e="eu":e=n;const[a,d]=g([]),{isMutating:C,trigger:r}=T({url:"/v1/credit/consume_credit_rules",initData:{brand:p,page:1,page_size:999,country:(R.get(e)||e)?.toUpperCase()}}),s=y(u=>{r({user_id:t?.user_id,...u?.consumeType&&{consume_type:u.consumeType}},{onSuccess(i){console.log("responseData",i);let f=i.data.consume_credit_rules||[];d(f)}})},[t,r,e]);return _(()=>{o||s({consumeType:c?.consumeType})},[s,o]),{listLoading:C,redeemableList:a,getRedeemableList:s}}var h=A;export{h as default};
|
|
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": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,oBAAAC,
|
|
6
|
-
"names": ["useCallback", "useEffect", "useState", "useAlpcMutation", "ALPC_COUNTRY_MAP", "useCreditsContext", "useHeadlessContext", "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": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,oBAAAC,MAAyC,WAClD,OAAS,qBAAAC,MAAyB,cAElC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAkBC,EAA0C,CACnE,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,CAAU,EAAIP,EAAkB,EAC7D,CAAE,OAAQQ,EAAe,MAAOC,CAAc,EAAIR,EAAmB,EACrES,EAAQH,GAAaE,EAEvBD,IAAkB,KACpBJ,EAAS,KAETA,EAASI,EAGX,KAAM,CAACG,EAAgBC,CAAiB,EAAIf,EAAsC,CAAC,CAAC,EAC9E,CAAE,WAAYgB,EAAa,QAAAC,CAAQ,EAAIhB,EAK3C,CACA,IAAK,kCACL,SAAU,CACR,MAAAY,EACA,KAAM,EACN,UAAW,IACX,SAAUX,EAAiB,IAAIK,CAAM,GAAKA,IAAS,YAAY,CACjE,CACF,CAAC,EAEKW,EAAoBpB,EAAaQ,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,OAAAR,EAAU,IAAM,CACTU,GACHS,EAAkB,CAAE,YAAaZ,GAAO,WAAY,CAAC,CAEzD,EAAG,CAACY,EAAmBT,CAAgB,CAAC,EAEjC,CACL,YAAAO,EACA,eAAAF,EACA,kBAAAI,CACF,CACF,CAEA,IAAOG,EAAQhB",
|
|
6
|
+
"names": ["useCallback", "useEffect", "useState", "useAlpcMutation", "ALPC_COUNTRY_MAP", "useCreditsContext", "useHeadlessContext", "useRedeemableList", "props", "locale", "profile", "isLoadingProfile", "alpcBrand", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list", "useRedeemableList_default"]
|
|
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
|
-
import{jsx as
|
|
1
|
+
import{jsx as R}from"react/jsx-runtime";import{createContext as A,useContext as x,useState as o}from"react";const t=A({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 _({children:e,profile:n,removeProfile:i,isLoadingProfile:r,openSignInPopup:s,openSignUpPopup:a,taskIdToTypeMapping:d,creditInfo:p,customer:l,customerLoading:c,fetchCreditInfo:f,gtm:u,pageCommon:g,memberPriceDiscount:m,alpcBrand:C,cartConfig:M}){const[v,P]=o(!1),[y,b]=o(!1);return R(t.Provider,{value:{profile:n,isLoadingProfile:r,removeProfile:i,openSignInPopup:s,openSignUpPopup:a,taskIdToTypeMapping:d,creditInfo:p,fetchCreditInfo:f,customer:l,customerLoading:c,gtm:u,pageCommon:g,memberPriceDiscount:m,alpcBrand:C,cartConfig:M,openMyRewardsModal:v,setOpenMyRewardsModal:P,openActivitiesModal:y,setOpenActivitiesModal:b},children:e})}function L(){const e=x(t);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}export{t as CreditsContext,_ as CreditsProvider,L as useCreditsContext};
|
|
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": "
|
|
6
|
-
"names": ["jsx", "createContext", "useContext", "CreditsContext", "user_id", "CreditsProvider", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "cartConfig", "useCreditsContext", "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": "AAuFI,cAAAA,MAAA,oBAvFJ,OAAS,iBAAAC,EAAkC,cAAAC,EAAY,YAAAC,MAAgB,QAyChE,MAAMC,EAAiBH,EAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBI,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,SAASC,EAAgB,CAC9B,SAAAC,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,EAAIrB,EAAS,EAAK,EAC5D,CAACsB,EAAqBC,CAAsB,EAAIvB,EAAS,EAAK,EAEpE,OACEH,EAACI,EAAe,SAAf,CACC,MAAO,CACL,QAAAI,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,SAASoB,GAAoB,CAClC,MAAMC,EAAU1B,EAAWE,CAAc,EACzC,GAAI,CAACwB,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
|
|
6
|
+
"names": ["jsx", "createContext", "useContext", "useState", "CreditsContext", "user_id", "CreditsProvider", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "cartConfig", "openMyRewardsModal", "setOpenMyRewardsModal", "openActivitiesModal", "setOpenActivitiesModal", "useCreditsContext", "context"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as R,jsx as e,jsxs as l}from"react/jsx-runtime";import{Button as w,Container as j,Heading as I,Picture as y,Text as z}from"@anker-in/headless-ui";import{ChevronDownIcon as E,ChevronUpIcon as _}from"@heroicons/react/24/outline";import{useMemo as H,useState as r,useEffect as q}from"react";import{TaskType as h}from"./type";import{useActions as V}from"../creditsWaysToGetCredits/useActions";import{useCreditsContext as G}from"../context/provider";import{classNames as g,useHeadlessContext as J}from"@anker-in/lib";import{useRegistration as K}from"../../registration";import{CreditsUploadReceiptModal as Q}from"../modal/
|
|
1
|
+
import{Fragment as R,jsx as e,jsxs as l}from"react/jsx-runtime";import{Button as w,Container as j,Heading as I,Picture as y,Text as z}from"@anker-in/headless-ui";import{ChevronDownIcon as E,ChevronUpIcon as _}from"@heroicons/react/24/outline";import{useMemo as H,useState as r,useEffect as q}from"react";import{TaskType as h}from"./type";import{useActions as V}from"../creditsWaysToGetCredits/useActions";import{useCreditsContext as G}from"../context/provider";import{classNames as g,useHeadlessContext as J}from"@anker-in/lib";import{useRegistration as K}from"../../registration";import{CreditsUploadReceiptModal as Q}from"../modal/CreditsUploadReceiptModal";import{CreditsSubscribeModal as W}from"../modal/SubscribeModal";import{ROUNDED_BRANDS as X}from"../../../constants";const ce=({copy:s,classNames:Y,id:p})=>{const[n,v]=r(!1),{profile:T}=G(),{authCodeActivate:M}=K(),{brand:A}=J(),u=X.includes(A),x=!!T,[L,k]=r(!1),[U,m]=r(!1),[C,O]=r(!1),[F,B]=r(!1),{actions:f}=V({copy:s,subscribe:{openSubscribePopup:()=>m(!0),isSuccess:C},uploadReceipt:{openUploadReceiptPopup:()=>k(!0),isSuccess:F}}),o=(s?.list||[]).length>3;q(()=>{if(!n&&o&&window.screen.width<768){const t=setTimeout(()=>{const i=document.getElementById(p||"ankersolix-task");i&&i.scrollIntoView({behavior:"smooth",block:"end"})},300);return()=>clearTimeout(t)}},[n,o,p]);const D=H(()=>{const t=s.list.map(i=>{if(!f[i.id])return;const{finished:a,notLogin:N,notFinished:b,completed:P}=f[i.id];let d="",c,S;return x?a?(d=P.buttonLabel,c=void 0):(d=b.buttonLabel,c=b.handleClick,S=b.link):(d=N.buttonLabel,c=N.handleClick),{...i,buttonLabel:d,handleClick:c,finished:a,link:S}}).filter(Boolean);return x?t.sort((i,a)=>i?.finished&&!a?.finished?1:!i?.finished&&a?.finished?-1:0):t},[f,s.list,x]);return l(j,{id:p,className:"bg-[#F5F5F7]",children:[e(I,{as:"h2",size:"4",html:s.title}),l("div",{className:g("mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden",u?"rounded-[8px]":"",!u&&"l:rounded-none"),style:{background:"linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)"},children:[e("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%)"}}),l("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:[l("div",{className:"flex flex-col gap-[8px] l:mt-[8px]",children:[e(I,{as:"h3",size:4,html:s?.subtitle,className:"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]"}),e("div",{className:"flex items-center gap-[8px]",children:e("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:s.equalCredits}})})]}),s.mainImage?.url&&e(y,{className:"h-full object-contain l:mx-auto md:h-auto md:w-full md-l:h-[302px]",imgClassName:"!h-full !object-contain",source:s.mainImage.url})]}),l("div",{className:"relative mt-[24px]",children:[l("div",{className:g("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:n||!o?"auto":"512px"},children:[D.map(t=>l("div",{className:g("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]",u?"rounded-[16px]":""),children:[l("div",{children:[e(z,{as:"p",html:t.title,size:2,className:"text-pretty text-[24px] font-bold xxl:text-[20px]"}),l("div",{className:"mt-[8px] l:mt-[4px] flex items-center",children:[e(y,{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"}),e(z,{as:"p",html:t.credits,size:2,className:"ml-[4px] mt-[6px] text-[18px] xxl:text-[14px]"})]})]}),t.handleClick&&!(t.id===h.UploadReceipt&&F)&&!(t.id===h.Activate&&M.isActivateSuccess)&&!(t.id===h.Subscribe&&C)?e(w,{as:t.link?"a":"button",...t.link&&{href:t.link},...t.handleClick&&{onClick:t.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit",children:t.buttonLabel}):e(w,{variant:"primary",size:"lg",className:"mt-[24px] w-fit",disabled:!0,children:t.buttonLabel})]},t.id)),!n&&o&&e("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%)"}})]}),o&&e(R,{children:n?e("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{v(!1)},children:e(_,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):e(R,{children:e("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:e("button",{className:"w-fit",onClick:()=>v(!n),children:e(E,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})})]})]}),s.receipt&&e(Q,{isOpen:L,onClose:()=>{k(!1)},copy:s.receipt,onSuccess:()=>{B(!0)}}),s.subscribe&&e(W,{copy:s.subscribe,onSuccess:()=>{O(!0),setTimeout(()=>{m(!1)},3e3)},isOpen:U,onClose:()=>{m(!1)}})]})};export{ce as CreditsAnkersolixTask};
|
|
2
2
|
//# sourceMappingURL=CreditsAnkersolixTask.js.map
|