@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
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var M=Object.create;var d=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var k=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})},C=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of R(t))!H.call(e,l)&&l!==n&&d(e,l,{get:()=>t[l],enumerable:!(r=E(t,l))||r.enumerable});return e};var S=(e,t,n)=>(n=e!=null?M(D(e)):{},C(t||!e||!e.__esModule?d(n,"default",{value:e,enumerable:!0}):n,e)),Z=e=>C(d({},"__esModule",{value:!0}),e);var I={};k(I,{CreditsModalContainer:()=>A});module.exports=Z(I);var o=require("react/jsx-runtime"),i=require("@anker-in/lib"),m=require("react"),f=S(require("react-modal")),v=require("../../../constants");const A=({isOpen:e,title:t,className:n="",overlayClassName:r="",scrollClassName:l="",onClose:c,onScrollEnd:p,children:u,useAnimation:x,animationClassName:h,titleClassName:L="",...g})=>{const[b,w]=(0,m.useState)(!1);(0,m.useEffect)(()=>{x&&requestAnimationFrame(()=>{w(e??!1)})},[e,x]);const{brand:N}=(0,i.useHeadlessContext)(),y=v.ROUNDED_BRANDS.includes(N);return(0,o.jsxs)(f.default,{isOpen:e,overlayClassName:(0,i.classNames)("fixed inset-0 z-[999] flex items-center justify-center bg-black/70 leading-[1.2] md:items-end",r),className:(0,i.classNames)("min-md:max-h-[calc(100vh-96px)] relative flex min-h-[200px] flex-col overflow-hidden rounded-[16px] bg-white outline-none transition-all duration-300 md:h-[88.27vh] md:w-full md:rounded-b-none",!y&&"rounded-none",b?"":h,n),onRequestClose:c,...g,children:[(0,o.jsxs)("div",{className:(0,i.classNames)("flex w-full shrink-0 items-center justify-between",t?"min-l:px-[32px] h-[70px] border-b border-[#e2e2e2] px-[24px]":"h-[48px] px-[16px]",L),children:[(0,o.jsx)("div",{className:"text-[18px] font-bold",children:t}),(0,o.jsx)("div",{className:"size-[22px] cursor-pointer",onClick:c,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),c?.())},role:"button",tabIndex:0,children:(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",children:(0,o.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.8525 5.31015C16.4558 4.91337 15.8125 4.91338 15.4157 5.31015L11.1268 9.5991L6.83815 5.31049C6.44138 4.91372 5.79808 4.91372 5.40131 5.31049C5.00454 5.70726 5.00455 6.35055 5.40131 6.74732L9.68993 11.0359L5.40105 15.3248C5.00428 15.7216 5.00428 16.3649 5.40105 16.7616C5.79782 17.1584 6.44111 17.1584 6.83788 16.7616L11.1268 12.4728L15.416 16.762C15.8128 17.1588 16.456 17.1588 16.8528 16.762C17.2496 16.3652 17.2496 15.7219 16.8528 15.3252L12.5636 11.0359L16.8525 6.74698C17.2493 6.35021 17.2493 5.70692 16.8525 5.31015ZM16.921 6.02856C16.921 6.22992 16.8441 6.43127 16.6905 6.5849L14.465 8.8104L12.2395 11.0359L12.2395 11.0359L16.6905 6.58493C16.8441 6.43129 16.921 6.22993 16.921 6.02856ZM5.34966 6.19087C5.37992 6.3354 5.45115 6.47307 5.56336 6.58528L10.014 11.0359L10.014 11.0359L5.56336 6.58524C5.45116 6.47304 5.37992 6.33539 5.34966 6.19087ZM5.35087 16.2121C5.38193 16.3541 5.45267 16.4891 5.56309 16.5996C5.87037 16.9068 6.36856 16.9068 6.67583 16.5996L11.1268 12.1486L15.578 16.5999C15.8853 16.9072 16.3835 16.9072 16.6908 16.5999C16.8498 16.4409 16.9265 16.2307 16.9209 16.0223C16.9265 16.2307 16.8498 16.4409 16.6908 16.5999C16.3835 16.9072 15.8853 16.9072 15.578 16.5999L11.1268 12.1487L6.67583 16.5996C6.36856 16.9069 5.87037 16.9069 5.56309 16.5996C5.45267 16.4892 5.38192 16.3541 5.35087 16.2121Z",fill:"#333333"})})})]}),(0,o.jsx)("div",{className:(0,i.classNames)("my-[32px] flex-1 overflow-auto overscroll-contain px-[24px] md:mb-[48px]",!t&&"mt-0","min-l:px-[32px]",l),onScroll:s=>{const a=s.target;a.scrollHeight<=a.clientHeight||a.scrollTop+a.clientHeight>=a.scrollHeight-50&&p&&p(s)},children:u})]})};
|
|
2
|
+
//# sourceMappingURL=ModalContainer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/modal/ModalContainer.tsx"],
|
|
4
|
+
"sourcesContent": ["import { classNames as cn, useHeadlessContext } from '@anker-in/lib'\nimport { useEffect, useState, type UIEvent } from 'react'\nimport ReactModal from 'react-modal'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport type ModalContainerProps = {\n overlayClassName?: string\n className?: string\n scrollClassName?: string\n title?: string\n titleClassName?: string\n useAnimation?: boolean // \u4F7F\u7528\u52A8\u753B\u5C55\u793A\n animationClassName?: string // \u52A8\u753B\u5C55\u793A\u63A7\u5236\u7684classname\n isOpen: boolean\n children?: any\n onClose: () => void\n onScrollEnd?: (event: UIEvent<HTMLDivElement>) => void\n}\n\nexport const CreditsModalContainer = ({\n isOpen,\n title,\n className = '',\n overlayClassName = '',\n scrollClassName = '',\n onClose,\n onScrollEnd,\n children,\n useAnimation,\n animationClassName,\n titleClassName = '',\n ...props\n}: ModalContainerProps): React.ReactElement => {\n const [animationShow, setAnimationShow] = useState(false)\n\n useEffect(() => {\n if (!useAnimation) {\n return\n }\n requestAnimationFrame(() => {\n setAnimationShow(isOpen ?? false)\n })\n }, [isOpen, useAnimation])\n\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n return (\n <ReactModal\n isOpen={isOpen}\n overlayClassName={cn(\n 'fixed inset-0 z-[999] flex items-center justify-center bg-black/70 leading-[1.2] md:items-end',\n overlayClassName\n )}\n className={cn(\n 'min-md:max-h-[calc(100vh-96px)] relative flex min-h-[200px] flex-col overflow-hidden rounded-[16px] bg-white outline-none transition-all duration-300 md:h-[88.27vh] md:w-full md:rounded-b-none',\n !rounded && 'rounded-none',\n animationShow ? '' : animationClassName,\n className\n )}\n onRequestClose={onClose}\n {...props}\n >\n <div\n className={cn(\n 'flex w-full shrink-0 items-center justify-between',\n title ? 'min-l:px-[32px] h-[70px] border-b border-[#e2e2e2] px-[24px]' : 'h-[48px] px-[16px]',\n titleClassName\n )}\n >\n <div className=\"text-[18px] font-bold\">{title}</div>\n <div\n className=\"size-[22px] cursor-pointer\"\n onClick={onClose}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onClose?.()\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" fill=\"none\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M16.8525 5.31015C16.4558 4.91337 15.8125 4.91338 15.4157 5.31015L11.1268 9.5991L6.83815 5.31049C6.44138 4.91372 5.79808 4.91372 5.40131 5.31049C5.00454 5.70726 5.00455 6.35055 5.40131 6.74732L9.68993 11.0359L5.40105 15.3248C5.00428 15.7216 5.00428 16.3649 5.40105 16.7616C5.79782 17.1584 6.44111 17.1584 6.83788 16.7616L11.1268 12.4728L15.416 16.762C15.8128 17.1588 16.456 17.1588 16.8528 16.762C17.2496 16.3652 17.2496 15.7219 16.8528 15.3252L12.5636 11.0359L16.8525 6.74698C17.2493 6.35021 17.2493 5.70692 16.8525 5.31015ZM16.921 6.02856C16.921 6.22992 16.8441 6.43127 16.6905 6.5849L14.465 8.8104L12.2395 11.0359L12.2395 11.0359L16.6905 6.58493C16.8441 6.43129 16.921 6.22993 16.921 6.02856ZM5.34966 6.19087C5.37992 6.3354 5.45115 6.47307 5.56336 6.58528L10.014 11.0359L10.014 11.0359L5.56336 6.58524C5.45116 6.47304 5.37992 6.33539 5.34966 6.19087ZM5.35087 16.2121C5.38193 16.3541 5.45267 16.4891 5.56309 16.5996C5.87037 16.9068 6.36856 16.9068 6.67583 16.5996L11.1268 12.1486L15.578 16.5999C15.8853 16.9072 16.3835 16.9072 16.6908 16.5999C16.8498 16.4409 16.9265 16.2307 16.9209 16.0223C16.9265 16.2307 16.8498 16.4409 16.6908 16.5999C16.3835 16.9072 15.8853 16.9072 15.578 16.5999L11.1268 12.1487L6.67583 16.5996C6.36856 16.9069 5.87037 16.9069 5.56309 16.5996C5.45267 16.4892 5.38192 16.3541 5.35087 16.2121Z\"\n fill=\"#333333\"\n />\n </svg>\n </div>\n </div>\n <div\n className={cn(\n 'my-[32px] flex-1 overflow-auto overscroll-contain px-[24px] md:mb-[48px]',\n !title && 'mt-0',\n 'min-l:px-[32px]',\n scrollClassName\n )}\n onScroll={event => {\n const targetElement = event.target as HTMLDivElement\n\n if (targetElement.scrollHeight <= targetElement.clientHeight) {\n return\n }\n\n if (targetElement.scrollTop + targetElement.clientHeight >= targetElement.scrollHeight - 50) {\n onScrollEnd && onScrollEnd(event)\n }\n }}\n >\n {children}\n </div>\n </ReactModal>\n )\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GA+DM,IAAAI,EAAA,6BA/DNC,EAAqD,yBACrDC,EAAkD,iBAClDC,EAAuB,0BACvBC,EAA+B,8BAgBxB,MAAMN,EAAwB,CAAC,CACpC,OAAAO,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aAAe,IACvFd,GAAeA,EAAYa,CAAK,CAEpC,EAEC,SAAAZ,EACH,GACF,CAEJ",
|
|
6
|
+
"names": ["ModalContainer_exports", "__export", "CreditsModalContainer", "__toCommonJS", "import_jsx_runtime", "import_lib", "import_react", "import_react_modal", "import_constants", "isOpen", "title", "className", "overlayClassName", "scrollClassName", "onClose", "onScrollEnd", "children", "useAnimation", "animationClassName", "titleClassName", "props", "animationShow", "setAnimationShow", "brand", "rounded", "ReactModal", "cn", "e", "event", "targetElement"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type ModalContainerProps } from './ModalContainer';
|
|
2
|
+
export interface RewardsCopy {
|
|
3
|
+
title: string;
|
|
4
|
+
orderNumberLabel: string;
|
|
5
|
+
valueLabel: string;
|
|
6
|
+
receivedLabel: string;
|
|
7
|
+
failedLabel: string;
|
|
8
|
+
approveSuccessLabel: string;
|
|
9
|
+
couponTab: string;
|
|
10
|
+
productTab: string;
|
|
11
|
+
externalProductTab?: string;
|
|
12
|
+
pendingLabel: string;
|
|
13
|
+
unfulfilledLabel: string;
|
|
14
|
+
fulfilledLabel: string;
|
|
15
|
+
confirmedTip: string;
|
|
16
|
+
pendingTip: string;
|
|
17
|
+
processingTip: string;
|
|
18
|
+
ShippedTip: string;
|
|
19
|
+
emptyListLabel: string;
|
|
20
|
+
pointUnit: string;
|
|
21
|
+
code: string;
|
|
22
|
+
copied: string;
|
|
23
|
+
copy: string;
|
|
24
|
+
redeemLinkLabel?: string;
|
|
25
|
+
goGiftStatus?: {
|
|
26
|
+
pending?: {
|
|
27
|
+
label: string;
|
|
28
|
+
tip: string;
|
|
29
|
+
};
|
|
30
|
+
approved?: {
|
|
31
|
+
label: string;
|
|
32
|
+
tip: string;
|
|
33
|
+
};
|
|
34
|
+
secondConfirm?: {
|
|
35
|
+
label: string;
|
|
36
|
+
tip: string;
|
|
37
|
+
};
|
|
38
|
+
rejected?: {
|
|
39
|
+
label: string;
|
|
40
|
+
tip: string;
|
|
41
|
+
};
|
|
42
|
+
callbackPending?: {
|
|
43
|
+
label: string;
|
|
44
|
+
tip: string;
|
|
45
|
+
};
|
|
46
|
+
callbackSuccess?: {
|
|
47
|
+
label: string;
|
|
48
|
+
tip: string;
|
|
49
|
+
};
|
|
50
|
+
callbackTimeout?: {
|
|
51
|
+
label: string;
|
|
52
|
+
tip: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
emptyListImage: {
|
|
56
|
+
url: string;
|
|
57
|
+
alt?: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
interface RewardsModalProps extends ModalContainerProps {
|
|
61
|
+
data: RewardsCopy;
|
|
62
|
+
}
|
|
63
|
+
declare function RewardsModal({ data, ...props }: RewardsModalProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
export default RewardsModal;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var H=Object.create;var u=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var B=(t,r)=>{for(var n in r)u(t,n,{get:r[n],enumerable:!0})},k=(t,r,n,d)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of $(r))!z.call(t,a)&&a!==n&&u(t,a,{get:()=>r[a],enumerable:!(d=O(r,a))||d.enumerable});return t};var c=(t,r,n)=>(n=t!=null?H(q(t)):{},k(r||!t||!t.__esModule?u(n,"default",{value:t,enumerable:!0}):n,t)),K=t=>k(u({},"__esModule",{value:!0}),t);var Q={};B(Q,{default:()=>J});module.exports=K(Q);var o=require("react/jsx-runtime"),p=require("@anker-in/headless-ui"),g=c(require("classnames")),N=c(require("copy-to-clipboard")),P=c(require("dayjs")),l=require("react"),e=require("../context/const"),R=require("./ModalContainer"),F=c(require("./Tip")),A=c(require("./LoadingDots")),w=c(require("../context/hooks/useMyRewards")),D=require("@anker-in/lib"),M=require("../../../constants");function V({data:t,...r}){const[n,d]=(0,l.useState)(e.AlpcConsumeType.Coupon),{brand:a}=(0,D.useHeadlessContext)(),b=M.ROUNDED_BRANDS.includes(a),[_,m]=(0,l.useState)(1),[h,v]=(0,l.useState)(-1),j=(0,l.useMemo)(()=>[{title:t.couponTab,type:e.AlpcConsumeType.Coupon},{title:t.productTab,type:e.AlpcConsumeType.Product},{title:t.externalProductTab,type:e.AlpcConsumeType.ExternalProduct}].filter(i=>!!i.title),[t.couponTab,t.productTab,t.externalProductTab]);(0,l.useEffect)(()=>{m(1)},[n]);const{myRewards:x=[],canNext:C,isLoading:y}=(0,w.default)({page:_,pageSize:1e3,consumeType:n}),G=(0,l.useCallback)(i=>i.fulfillment_status&&i.fulfillment_status!=="null"?i.fulfillment_status==="fulfilled"?e.RewardType.Fulfilled:e.RewardType.Unfulfilled:i.approval_status===e.ApprovalStatus.Success||i.approval_status===e.ApprovalStatus.DoubleConfirm?e.RewardType.ApproveSuccess:i.approval_status===e.ApprovalStatus.Failed?e.RewardType.Failed:e.RewardType.Pending,[]),S=(0,l.useCallback)(i=>{const s={0:e.RewardType.GogiftPending,1:e.RewardType.GogiftApproved,2:e.RewardType.GogiftSecondConfirm,3:e.RewardType.GogiftRejected,4:e.RewardType.GogiftCallbackPending,5:e.RewardType.GogiftCallbackSuccess,6:e.RewardType.GogiftCallbackTimeout};return i!==void 0?s[i]??e.RewardType.GogiftPending:e.RewardType.GogiftPending},[]),T=(0,l.useMemo)(()=>x.map(i=>{const s={title:i.goods_title,value:i.consume_credits,date:new Date(i.create_time*1e3)};return n===e.AlpcConsumeType.Coupon?{...s,type:e.RewardType.Received,couponCode:i.coupon_code,orderNumber:"",link:""}:n===e.AlpcConsumeType.Product?{...s,type:G(i),orderNumber:i.order_number,couponCode:"",link:""}:n===e.AlpcConsumeType.ExternalProduct?{...s,type:S(i.approval_status),orderNumber:"",couponCode:"",link:i.link||""}:{...s,type:e.RewardType.Received,couponCode:"",orderNumber:"",link:""}}),[n,x,G,S]),E=(0,l.useMemo)(()=>({[e.RewardType.Received]:t.receivedLabel,[e.RewardType.Pending]:t.pendingLabel,[e.RewardType.ApproveFail]:t.failedLabel,[e.RewardType.ApproveSuccess]:t.approveSuccessLabel,[e.RewardType.Unfulfilled]:t.unfulfilledLabel,[e.RewardType.Fulfilled]:t.fulfilledLabel,[e.RewardType.Failed]:t.failedLabel,[e.RewardType.GogiftPending]:t.goGiftStatus?.pending?.label||t.pendingLabel,[e.RewardType.GogiftApproved]:t.goGiftStatus?.approved?.label||t.approveSuccessLabel,[e.RewardType.GogiftSecondConfirm]:t.goGiftStatus?.secondConfirm?.label||t.approveSuccessLabel,[e.RewardType.GogiftRejected]:t.goGiftStatus?.rejected?.label||t.failedLabel,[e.RewardType.GogiftCallbackPending]:t.goGiftStatus?.callbackPending?.label||t.pendingLabel,[e.RewardType.GogiftCallbackSuccess]:t.goGiftStatus?.callbackSuccess?.label||t.receivedLabel,[e.RewardType.GogiftCallbackTimeout]:t.goGiftStatus?.callbackTimeout?.label||t.failedLabel}),[t]),L=(0,l.useMemo)(()=>({[e.RewardType.Received]:"",[e.RewardType.Pending]:t.pendingTip,[e.RewardType.ApproveFail]:"",[e.RewardType.ApproveSuccess]:t.confirmedTip,[e.RewardType.Unfulfilled]:t.processingTip,[e.RewardType.Fulfilled]:t.ShippedTip,[e.RewardType.Failed]:"",[e.RewardType.GogiftPending]:t.goGiftStatus?.pending?.tip||"",[e.RewardType.GogiftApproved]:t.goGiftStatus?.approved?.tip||"",[e.RewardType.GogiftSecondConfirm]:t.goGiftStatus?.secondConfirm?.tip||"",[e.RewardType.GogiftRejected]:t.goGiftStatus?.rejected?.tip||"",[e.RewardType.GogiftCallbackPending]:t.goGiftStatus?.callbackPending?.tip||"",[e.RewardType.GogiftCallbackSuccess]:t.goGiftStatus?.callbackSuccess?.tip||"",[e.RewardType.GogiftCallbackTimeout]:t.goGiftStatus?.callbackTimeout?.tip||""}),[t]),U=(0,l.useMemo)(()=>({[e.RewardType.Received]:"#52C41A",[e.RewardType.Pending]:"#999",[e.RewardType.ApproveFail]:"#F84D4F",[e.RewardType.ApproveSuccess]:"#999",[e.RewardType.Unfulfilled]:"#999",[e.RewardType.Fulfilled]:"#999",[e.RewardType.Failed]:"#F84D4F",[e.RewardType.GogiftPending]:"#999",[e.RewardType.GogiftApproved]:"#999",[e.RewardType.GogiftSecondConfirm]:"#999",[e.RewardType.GogiftRejected]:"#F84D4F",[e.RewardType.GogiftCallbackPending]:"#999",[e.RewardType.GogiftCallbackSuccess]:"#52C41A",[e.RewardType.GogiftCallbackTimeout]:"#F84D4F"}),[]),I=(0,l.useCallback)(()=>{C&&m(i=>i+1)},[C]),Y=(0,l.useCallback)((i,s)=>{v(s),(0,N.default)(i),setTimeout(()=>{v(-1)},2e3)},[]);return(0,o.jsxs)(R.CreditsModalContainer,{title:t.title,className:(0,g.default)("h-[800px] w-[640px]"),useAnimation:!0,animationClassName:"md:translate-y-[100vh]",scrollClassName:"md:mb-0",...r,onScrollEnd:I,children:[(0,o.jsx)("div",{className:"",children:(0,o.jsx)(p.Tabs,{align:"left",shape:b?"rounded":"square",value:n.toString(),onValueChange:i=>{d(Number(i))},children:(0,o.jsx)(p.TabsList,{children:j.map(i=>(0,o.jsx)(p.TabsTrigger,{value:i.type.toString(),children:i.title},i.type))})})}),y&&(0,o.jsx)("div",{className:"flex h-full flex-col items-center justify-center",children:(0,o.jsx)(A.default,{})}),!y&&(0,o.jsx)("div",{className:"mt-[24px] overflow-auto overscroll-contain",children:T.length>0?(0,o.jsx)("div",{className:"grid gap-[18px] md:gap-[12px]",children:T.map((i,s)=>(0,o.jsxs)("div",{className:"grid gap-[8px]",children:[i?.orderNumber&&(0,o.jsxs)("div",{className:"text-[15px] font-semibold leading-[1.4] text-[#777]",children:[t.orderNumberLabel,": ",i.orderNumber]}),(0,o.jsxs)("div",{className:(0,g.default)("flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]",!b&&"rounded-none"),children:[(0,o.jsxs)("div",{className:"grid gap-[4px]",children:[(0,o.jsx)("div",{className:"text-[16px] font-bold leading-[1.4]",children:i.title}),(0,o.jsxs)("div",{className:"text-[14px] font-semibold text-[#999]",children:[t.valueLabel,": ",i.value," ",t?.pointUnit]}),(0,o.jsxs)("div",{className:"text-[14px] font-semibold text-[#999]",children:[i?.couponCode?`${t?.code||"Code"}: ${i.couponCode} `:"",i?.couponCode&&(0,o.jsx)("span",{className:"cursor-pointer text-[14px] font-semibold text-brand underline",onClick:()=>{Y(i.couponCode,s)},role:"button",tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&f.preventDefault()},children:h===s?t?.copied||"COPIED":t?.copy||"COPY"})]}),i?.link&&(0,o.jsx)("div",{className:"text-[14px] font-semibold text-[#999]",children:(0,o.jsx)("a",{href:i.link,target:"_blank",rel:"noopener noreferrer",className:"text-brand underline",children:t?.redeemLinkLabel||"Redeem Link"})})]}),(0,o.jsxs)("div",{className:"grid gap-[4px] text-right",children:[(0,o.jsxs)("div",{className:(0,g.default)("flex items-center justify-end text-[16px] font-bold leading-[1.4]",`text-[${U[i.type]}]`),children:[(0,o.jsx)("span",{children:E[i.type]}),L[i.type]&&(0,o.jsx)(F.default,{info:L[i.type],index:s})]}),(0,o.jsx)("div",{className:"text-[14px] font-semibold text-[#999]",children:(0,P.default)(i.date).format("YYYY-MM-DD HH:mm").toString()})]})]})]},s))}):(0,o.jsxs)("div",{className:"flex h-full flex-col items-center justify-center",children:[(0,o.jsx)(p.Picture,{className:"mb-[12px] w-[160px]",source:t?.emptyListImage?.url,alt:t?.emptyListImage?.alt||"empty list image"}),(0,o.jsx)("div",{className:"text-[16px] font-semibold leading-[1.4]",children:t?.emptyListLabel})]})})]})}var J=V;
|
|
2
|
+
//# sourceMappingURL=RewardsModal.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/modal/RewardsModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Tabs, TabsList, TabsTrigger, Picture } from '@anker-in/headless-ui'\nimport classNames from 'classnames'\nimport clipboard from 'copy-to-clipboard'\nimport dayjs from 'dayjs'\nimport { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { ApprovalStatus, AlpcConsumeType, RewardType } from '../context/const'\nimport { CreditsModalContainer, type ModalContainerProps } from './ModalContainer'\nimport Tip from './Tip'\nimport LoadingDots from './LoadingDots'\nimport useMyRewards from '../context/hooks/useMyRewards'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nexport interface RewardsCopy {\n title: string\n orderNumberLabel: string\n valueLabel: string\n receivedLabel: string\n failedLabel: string\n approveSuccessLabel: string\n couponTab: string\n productTab: string\n externalProductTab?: string\n pendingLabel: string\n unfulfilledLabel: string\n fulfilledLabel: string\n confirmedTip: string\n pendingTip: string\n processingTip: string\n ShippedTip: string\n emptyListLabel: string\n pointUnit: string\n code: string\n copied: string\n copy: string\n redeemLinkLabel?: string\n goGiftStatus?: {\n pending?: {\n label: string\n tip: string\n }\n approved?: {\n label: string\n tip: string\n }\n secondConfirm?: {\n label: string\n tip: string\n }\n rejected?: {\n label: string\n tip: string\n }\n callbackPending?: {\n label: string\n tip: string\n }\n callbackSuccess?: {\n label: string\n tip: string\n }\n callbackTimeout?: {\n label: string\n tip: string\n }\n }\n emptyListImage: {\n url: string\n alt?: string\n }\n}\ninterface RewardsModalProps extends ModalContainerProps {\n data: RewardsCopy\n}\n\nfunction RewardsModal({ data, ...props }: RewardsModalProps) {\n const [activeTab, setActiveTab] = useState(AlpcConsumeType.Coupon)\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n const [page, setPage] = useState(1)\n const [copied, setCopied] = useState(-1)\n\n const tabs = useMemo(() => {\n return [\n { title: data.couponTab, type: AlpcConsumeType.Coupon },\n { title: data.productTab, type: AlpcConsumeType.Product },\n { title: data.externalProductTab, type: AlpcConsumeType.ExternalProduct },\n ].filter((tab): tab is { title: string; type: number } => !!tab.title)\n }, [data.couponTab, data.productTab, data.externalProductTab])\n\n // Reset page when switching tabs\n useEffect(() => {\n setPage(1)\n }, [activeTab])\n\n const { myRewards = [], canNext, isLoading } = useMyRewards({\n page,\n pageSize: 1000,\n consumeType: activeTab,\n })\n\n const getProductType = useCallback((item: any) => {\n if (item.fulfillment_status && item.fulfillment_status !== 'null') {\n return item.fulfillment_status === 'fulfilled' ? RewardType.Fulfilled : RewardType.Unfulfilled\n }\n\n if (item.approval_status === ApprovalStatus.Success || item.approval_status === ApprovalStatus.DoubleConfirm) {\n return RewardType.ApproveSuccess\n }\n\n if (item.approval_status === ApprovalStatus.Failed) {\n return RewardType.Failed\n }\n\n return RewardType.Pending\n }, [])\n\n const getGoGiftType = useCallback((status?: number) => {\n const statusMap: Record<number, RewardType> = {\n 0: RewardType.GogiftPending,\n 1: RewardType.GogiftApproved,\n 2: RewardType.GogiftSecondConfirm,\n 3: RewardType.GogiftRejected,\n 4: RewardType.GogiftCallbackPending,\n 5: RewardType.GogiftCallbackSuccess,\n 6: RewardType.GogiftCallbackTimeout,\n }\n return status !== undefined ? (statusMap[status] ?? RewardType.GogiftPending) : RewardType.GogiftPending\n }, [])\n\n const list = useMemo(() => {\n return myRewards.map(item => {\n const base = {\n title: item.goods_title,\n value: item.consume_credits,\n date: new Date(item.create_time * 1000),\n }\n\n if (activeTab === AlpcConsumeType.Coupon) {\n return {\n ...base,\n type: RewardType.Received,\n couponCode: item.coupon_code,\n orderNumber: '',\n link: '',\n }\n }\n\n if (activeTab === AlpcConsumeType.Product) {\n return {\n ...base,\n type: getProductType(item),\n orderNumber: item.order_number,\n couponCode: '',\n link: '',\n }\n }\n\n if (activeTab === AlpcConsumeType.ExternalProduct) {\n return {\n ...base,\n type: getGoGiftType(item.approval_status),\n orderNumber: '',\n couponCode: '',\n link: item.link || '',\n }\n }\n\n return { ...base, type: RewardType.Received, couponCode: '', orderNumber: '', link: '' }\n })\n }, [activeTab, myRewards, getProductType, getGoGiftType])\n\n\n const TypeMap = useMemo(() => {\n return {\n [RewardType.Received]: data.receivedLabel,\n [RewardType.Pending]: data.pendingLabel,\n [RewardType.ApproveFail]: data.failedLabel,\n [RewardType.ApproveSuccess]: data.approveSuccessLabel,\n [RewardType.Unfulfilled]: data.unfulfilledLabel,\n [RewardType.Fulfilled]: data.fulfilledLabel,\n [RewardType.Failed]: data.failedLabel,\n [RewardType.GogiftPending]: data.goGiftStatus?.pending?.label || data.pendingLabel,\n [RewardType.GogiftApproved]: data.goGiftStatus?.approved?.label || data.approveSuccessLabel,\n [RewardType.GogiftSecondConfirm]: data.goGiftStatus?.secondConfirm?.label || data.approveSuccessLabel,\n [RewardType.GogiftRejected]: data.goGiftStatus?.rejected?.label || data.failedLabel,\n [RewardType.GogiftCallbackPending]: data.goGiftStatus?.callbackPending?.label || data.pendingLabel,\n [RewardType.GogiftCallbackSuccess]: data.goGiftStatus?.callbackSuccess?.label || data.receivedLabel,\n [RewardType.GogiftCallbackTimeout]: data.goGiftStatus?.callbackTimeout?.label || data.failedLabel,\n }\n }, [data])\n\n const TipMap = useMemo(() => {\n return {\n [RewardType.Received]: '',\n [RewardType.Pending]: data.pendingTip,\n [RewardType.ApproveFail]: '',\n [RewardType.ApproveSuccess]: data.confirmedTip,\n [RewardType.Unfulfilled]: data.processingTip,\n [RewardType.Fulfilled]: data.ShippedTip,\n [RewardType.Failed]: '',\n [RewardType.GogiftPending]: data.goGiftStatus?.pending?.tip || '',\n [RewardType.GogiftApproved]: data.goGiftStatus?.approved?.tip || '',\n [RewardType.GogiftSecondConfirm]: data.goGiftStatus?.secondConfirm?.tip || '',\n [RewardType.GogiftRejected]: data.goGiftStatus?.rejected?.tip || '',\n [RewardType.GogiftCallbackPending]: data.goGiftStatus?.callbackPending?.tip || '',\n [RewardType.GogiftCallbackSuccess]: data.goGiftStatus?.callbackSuccess?.tip || '',\n [RewardType.GogiftCallbackTimeout]: data.goGiftStatus?.callbackTimeout?.tip || '',\n }\n }, [data])\n\n const ColorMap = useMemo(() => {\n return {\n [RewardType.Received]: '#52C41A',\n [RewardType.Pending]: '#999',\n [RewardType.ApproveFail]: '#F84D4F',\n [RewardType.ApproveSuccess]: '#999',\n [RewardType.Unfulfilled]: '#999',\n [RewardType.Fulfilled]: '#999',\n [RewardType.Failed]: '#F84D4F',\n [RewardType.GogiftPending]: '#999',\n [RewardType.GogiftApproved]: '#999',\n [RewardType.GogiftSecondConfirm]: '#999',\n [RewardType.GogiftRejected]: '#F84D4F',\n [RewardType.GogiftCallbackPending]: '#999',\n [RewardType.GogiftCallbackSuccess]: '#52C41A',\n [RewardType.GogiftCallbackTimeout]: '#F84D4F',\n }\n }, [])\n\n const handleScrollEnd = useCallback(() => {\n if (canNext) {\n setPage(prev => prev + 1)\n }\n }, [canNext])\n\n const handleCopy = useCallback((code: string, idx: number) => {\n setCopied(idx)\n clipboard(code)\n setTimeout(() => {\n setCopied(-1)\n }, 2000)\n }, [])\n\n\n return (\n <CreditsModalContainer\n title={data.title}\n className={classNames('h-[800px] w-[640px]')}\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n scrollClassName=\"md:mb-0\"\n {...props}\n onScrollEnd={handleScrollEnd}\n >\n <div className=\"\">\n <Tabs\n align=\"left\"\n shape={rounded ? 'rounded' : 'square'}\n value={activeTab.toString()}\n onValueChange={value => {\n setActiveTab(Number(value))\n }}\n >\n <TabsList>\n {tabs.map(tab => (\n <TabsTrigger key={tab.type} value={tab.type.toString()}>\n {tab.title}\n </TabsTrigger>\n ))}\n </TabsList>\n </Tabs>\n </div>\n\n {isLoading && (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <LoadingDots />\n </div>\n )}\n\n {!isLoading && (\n <div className=\"mt-[24px] overflow-auto overscroll-contain\">\n {list.length > 0 ? (\n <div className=\"grid gap-[18px] md:gap-[12px]\">\n {list.map((item, index) => (\n <div key={index} className=\"grid gap-[8px]\">\n {item?.orderNumber && (\n <div className=\"text-[15px] font-semibold leading-[1.4] text-[#777]\">\n {data.orderNumberLabel}: {item.orderNumber}\n </div>\n )}\n <div\n className={classNames(\n 'flex items-center justify-between rounded-[8px] bg-[#f7f8f9] px-[16px] py-[20px]',\n !rounded && 'rounded-none'\n )}\n >\n <div className=\"grid gap-[4px]\">\n <div className=\"text-[16px] font-bold leading-[1.4]\">{item.title}</div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {data.valueLabel}: {item.value} {data?.pointUnit}\n </div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {item?.couponCode ? `${data?.code || 'Code'}: ${item.couponCode} ` : ''}\n {item?.couponCode && (\n <span\n className=\"cursor-pointer text-[14px] font-semibold text-brand underline\"\n onClick={() => {\n handleCopy(item.couponCode, index)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n >\n {copied === index ? data?.copied || 'COPIED' : data?.copy || 'COPY'}\n </span>\n )}\n </div>\n {item?.link && (\n <div className=\"text-[14px] font-semibold text-[#999]\">\n <a\n href={item.link}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"text-brand underline\"\n >\n {data?.redeemLinkLabel || 'Redeem Link'}\n </a>\n </div>\n )}\n </div>\n <div className=\"grid gap-[4px] text-right\">\n <div\n className={classNames(\n 'flex items-center justify-end text-[16px] font-bold leading-[1.4]',\n `text-[${ColorMap[item.type]}]`\n )}\n >\n <span>{TypeMap[item.type]}</span>\n {TipMap[item.type] && <Tip info={TipMap[item.type]} index={index} />}\n </div>\n <div className=\"text-[14px] font-semibold text-[#999]\">\n {dayjs(item.date).format('YYYY-MM-DD HH:mm').toString()}\n </div>\n </div>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"flex h-full flex-col items-center justify-center\">\n <Picture\n className=\"mb-[12px] w-[160px]\"\n source={data?.emptyListImage?.url}\n alt={data?.emptyListImage?.alt || 'empty list image'}\n ></Picture>\n <div className=\"text-[16px] font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AAAgC,SACT,oEACA,SAASP,EAASR,EAAK,IAAI,CAAC,GAC9B,EAEA,oBAAC,QAAM,SAAAM,EAAQN,EAAK,IAAI,EAAE,EACzBO,EAAOP,EAAK,IAAI,MAAK,OAAC,EAAAoB,QAAA,CAAI,KAAMb,EAAOP,EAAK,IAAI,EAAG,MAAOkB,EAAO,GACpE,KACA,OAAC,OAAI,UAAU,wCACZ,cAAAG,SAAMrB,EAAK,IAAI,EAAE,OAAO,kBAAkB,EAAE,SAAS,EACxD,GACF,GACF,IAhEQkB,CAiEV,CACD,EACH,KAEA,QAAC,OAAI,UAAU,mDACb,oBAAC,WACC,UAAU,sBACV,OAAQnC,GAAM,gBAAgB,IAC9B,IAAKA,GAAM,gBAAgB,KAAO,mBACnC,KACD,OAAC,OAAI,UAAU,0CAA2C,SAAAA,GAAM,eAAe,GACjF,EAEJ,GAEJ,CAEJ,CAEA,IAAOhB,EAAQe",
|
|
6
|
+
"names": ["RewardsModal_exports", "__export", "RewardsModal_default", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_classnames", "import_copy_to_clipboard", "import_dayjs", "import_react", "import_const", "import_ModalContainer", "import_Tip", "import_LoadingDots", "import_useMyRewards", "import_lib", "import_constants", "RewardsModal", "data", "props", "activeTab", "setActiveTab", "brand", "rounded", "page", "setPage", "copied", "setCopied", "tabs", "tab", "myRewards", "canNext", "isLoading", "useMyRewards", "getProductType", "item", "getGoGiftType", "status", "statusMap", "list", "base", "TypeMap", "TipMap", "ColorMap", "handleScrollEnd", "prev", "handleCopy", "code", "idx", "clipboard", "classNames", "value", "LoadingDots", "index", "e", "Tip", "dayjs"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:!0})},C=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of f(e))!g.call(t,s)&&s!==o&&r(t,s,{get:()=>e[s],enumerable:!(n=c(e,s))||n.enumerable});return t};var M=t=>C(r({},"__esModule",{value:!0}),t);var b={};u(b,{default:()=>h});module.exports=M(b);var a=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),m=require("react"),p=require("./
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
"use strict";var r=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:!0})},C=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of f(e))!g.call(t,s)&&s!==o&&r(t,s,{get:()=>e[s],enumerable:!(n=c(e,s))||n.enumerable});return t};var M=t=>C(r({},"__esModule",{value:!0}),t);var b={};u(b,{default:()=>h});module.exports=M(b);var a=require("react/jsx-runtime"),l=require("@anker-in/headless-ui"),m=require("react"),p=require("./ModalContainer"),i=require("@anker-in/lib");function N({rules:t,className:e,ruleClassName:o,...n}){const s=(0,m.useMemo)(()=>typeof t=="string"?(0,a.jsx)(l.Text,{className:(0,i.classNames)("text-[16px] font-semibold",o),html:t}):(0,a.jsx)("ul",{className:"ml-4 text-[16px]",children:t?.map((d,x)=>(0,a.jsx)("li",{className:(0,i.classNames)("mb-[10px] list-disc"),children:(0,a.jsx)(l.Text,{as:"div",className:(0,i.classNames)("text-[16px] font-semibold leading-[1.4] text-[#777777]",o),html:d})},x))}),[o,t]);return(0,a.jsx)(p.CreditsModalContainer,{className:(0,i.classNames)("max-h-[90vh] w-[640px]",e),...n,children:s})}var h=N;
|
|
2
|
+
//# sourceMappingURL=RulesModal.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/components/credits/modal/
|
|
4
|
-
"sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { useMemo } from 'react'\n\nimport { CreditsModalContainer, type ModalContainerProps } from './
|
|
3
|
+
"sources": ["../../../../../src/components/credits/modal/RulesModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Text } from '@anker-in/headless-ui'\nimport { useMemo } from 'react'\n\nimport { CreditsModalContainer, type ModalContainerProps } from './ModalContainer'\nimport { classNames as cn } from '@anker-in/lib'\n\nfunction RulesModal({\n rules,\n className,\n ruleClassName,\n ...props\n}: {\n rules: string | string[]\n ruleClassName?: string\n className?: string\n} & ModalContainerProps) {\n const rulesComponent = useMemo(() => {\n if (typeof rules === 'string') {\n return <Text className={cn('text-[16px] font-semibold', ruleClassName)} html={rules}></Text>\n } else {\n return (\n <ul className=\"ml-4 text-[16px]\">\n {rules?.map((rule, index) => (\n <li key={index} className={cn('mb-[10px] list-disc')}>\n <Text\n as=\"div\"\n className={cn('text-[16px] font-semibold leading-[1.4] text-[#777777]', ruleClassName)}\n html={rule}\n ></Text>\n </li>\n ))}\n </ul>\n )\n }\n }, [ruleClassName, rules])\n\n return (\n <CreditsModalContainer className={cn('max-h-[90vh] w-[640px]', className)} {...props}>\n {rulesComponent}\n </CreditsModalContainer>\n )\n}\n\nexport default RulesModal\n"],
|
|
5
5
|
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAkBa,IAAAI,EAAA,6BAlBbC,EAAqB,iCACrBC,EAAwB,iBAExBC,EAAgE,4BAChEC,EAAiC,yBAEjC,SAASC,EAAW,CAClB,MAAAC,EACA,UAAAC,EACA,cAAAC,EACA,GAAGC,CACL,EAIyB,CACvB,MAAMC,KAAiB,WAAQ,IACzB,OAAOJ,GAAU,YACZ,OAAC,QAAK,aAAW,EAAAK,YAAG,4BAA6BH,CAAa,EAAG,KAAMF,EAAO,KAGnF,OAAC,MAAG,UAAU,mBACX,SAAAA,GAAO,IAAI,CAACM,EAAMC,OACjB,OAAC,MAAe,aAAW,EAAAF,YAAG,qBAAqB,EACjD,mBAAC,QACC,GAAG,MACH,aAAW,EAAAA,YAAG,yDAA0DH,CAAa,EACrF,KAAMI,EACP,GALMC,CAMT,CACD,EACH,EAGH,CAACL,EAAeF,CAAK,CAAC,EAEzB,SACE,OAAC,yBAAsB,aAAW,EAAAK,YAAG,yBAA0BJ,CAAS,EAAI,GAAGE,EAC5E,SAAAC,EACH,CAEJ,CAEA,IAAOZ,EAAQO",
|
|
6
|
-
"names": ["
|
|
6
|
+
"names": ["RulesModal_exports", "__export", "RulesModal_default", "__toCommonJS", "import_jsx_runtime", "import_headless_ui", "import_react", "import_ModalContainer", "import_lib", "RulesModal", "rules", "className", "ruleClassName", "props", "rulesComponent", "cn", "rule", "index"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var B=Object.create;var f=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},N=(e,t,r,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of H(t))!O.call(e,l)&&l!==r&&f(e,l,{get:()=>t[l],enumerable:!(c=F(t,l))||c.enumerable});return e};var T=(e,t,r)=>(r=e!=null?B(q(e)):{},N(t||!e||!e.__esModule?f(r,"default",{value:e,enumerable:!0}):r,e)),V=e=>N(f({},"__esModule",{value:!0}),e);var J={};U(J,{CreditsSubscribeModal:()=>G});module.exports=V(J);var s=require("react/jsx-runtime"),a=require("react"),M=require("next/router"),o=require("@anker-in/headless-ui"),i=require("@anker-in/lib"),n=T(require("js-cookie")),w=require("query-string"),S=T(require("crypto-js/sha256")),E=require("../context/provider"),P=require("../../../constants"),k=require("../context/utils"),A=require("./
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
"use strict";var B=Object.create;var f=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},N=(e,t,r,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of H(t))!O.call(e,l)&&l!==r&&f(e,l,{get:()=>t[l],enumerable:!(c=F(t,l))||c.enumerable});return e};var T=(e,t,r)=>(r=e!=null?B(q(e)):{},N(t||!e||!e.__esModule?f(r,"default",{value:e,enumerable:!0}):r,e)),V=e=>N(f({},"__esModule",{value:!0}),e);var J={};U(J,{CreditsSubscribeModal:()=>G});module.exports=V(J);var s=require("react/jsx-runtime"),a=require("react"),M=require("next/router"),o=require("@anker-in/headless-ui"),i=require("@anker-in/lib"),n=T(require("js-cookie")),w=require("query-string"),S=T(require("crypto-js/sha256")),E=require("../context/provider"),P=require("../../../constants"),k=require("../context/utils"),A=require("./ModalContainer");const z=()=>{if(typeof window>"u")return{register_source:""};const{search:e,href:t}=window.location||{},r=(0,w.parse)(e);return{fbuy_ref_code:n.default.get("fbuy_ref_code"),affiliate:n.default.get("affiliate"),ref:n.default.get("ref_ads"),inviter_code:r.ic||r.inviter_code||n.default.get("inviter_code"),register_source:r.redirect||n.default.get("reg_source")||t,deals_type:n.default.get("deal"),transfer_id:n.default.get("transfer_id")}};function G({copy:e,onSuccess:t,...r}){const{brand:c}=(0,i.useHeadlessContext)(),l=P.ROUNDED_BRANDS.includes(c),{locale:g}=(0,M.useRouter)(),[m,D]=(0,a.useState)(!1),[d,h]=(0,a.useState)(""),[v,p]=(0,a.useState)(""),[_,C]=(0,a.useState)(""),[I,y]=(0,a.useState)(!1),{profile:u}=(0,E.useCreditsContext)(),L=(0,a.useCallback)(x=>{p(""),h(x.target?.value?.trim())},[]),R=(0,a.useCallback)(async()=>{if(p(""),!d)return p("Please fill in your email");if(!(0,k.emailValidate)(d))return p("Invalid email address");if(!m)return p("Please agree to the policy");y(!0);const{register_source:x}=z(),b=await(0,i.fetcher)({locale:g,action:"subscribe",url:"/api/multipass/subscribe/subscribe_emails",method:"POST",body:{email:d,register_source:x,brand:c,deals_type:e.dealsType||"vip_subscribe"},headers:{},type:""});y(!1),b.errors?p(b.errors||b.statusText):(C(e.successTips||"Subscribed successfully!"),t&&t(),setTimeout(()=>{C("")},3e3),(0,i.gaTrack)({subscribe_hashed_email:d?(0,S.default)(d):""}),(0,i.gaTrack)({event:"ga4Event",event_name:"subscribe",event_parameters:{page_group:e.dealsType||"vip_subscribe",position:"pop_up"}}),(0,i.gaTrack)({event:"uaEvent",eventCategory:"subscribe",eventAction:e.dealsType||"vip_subscribe",eventLabel:"pop_up",nonInteraction:!1}))},[d,m,g,c,e.dealsType,e.successTips,t]);return(0,a.useEffect)(()=>{u&&u?.email&&h(u?.email)},[u]),(0,s.jsx)(A.CreditsModalContainer,{className:"w-[540px] md:h-auto",scrollClassName:"mb-[40px] min-l:px-[48px] md:mb-[24px]",titleClassName:"h-[56px]",useAnimation:!0,animationClassName:"md:translate-y-[100vh]",...r,children:(0,s.jsxs)("div",{className:"flex flex-col gap-[16px] text-center min-l:px-[16px]",children:[(0,s.jsx)("div",{children:(0,s.jsx)(o.Text,{className:(0,i.classNames)("mb-[24px] text-[22px] font-bold"),html:e.title})}),e.desc&&(0,s.jsx)(o.Text,{className:"mb-[8px] text-left text-[16px] font-semibold leading-[1.4] text-[#1F2021]",html:e.desc}),(0,s.jsxs)("div",{className:(0,i.classNames)("relative flex h-[52px] w-full overflow-hidden rounded-[2px] md:grid md:h-auto md:grid-rows-1 md:gap-[16px]",!l&&"rounded-none"),children:[(0,s.jsx)("input",{className:(0,i.classNames)("h-full flex-1 rounded-l-[2px] border-[1px] border-[#d8d8d8] px-[14px] py-[17px] text-[16px] font-semibold leading-[1] outline-none placeholder:text-[#999] md:h-[52px] md:rounded-[2px]",!l&&"rounded-none"),placeholder:e.placeholder,value:d,onChange:L}),(0,s.jsx)(o.Button,{variant:"primary",onClick:R,loading:I,className:(0,i.classNames)("legacy-headless-ui-primary-button !h-full !min-w-0 !rounded-l-none !rounded-r-[2px] !px-[40px] !py-[13px]",!l&&"rounded-none"),children:(0,s.jsx)(o.Picture,{source:"https://cdn.shopify.com/s/files/1/0512/8568/8505/files/icon_email.png?v=1697527383",className:"h-[24px] w-[24px]",alt:"email"})})]}),(0,s.jsxs)("div",{className:"flex w-full",children:[(0,s.jsx)(o.Checkbox,{checked:m,onCheckedChange:()=>D(!m),required:!0,className:"border-[#1d1d1f]"}),(0,s.jsx)("label",{className:"text-left ml-2 text-[14px] font-semibold text-[#777] [&_a]:underline",dangerouslySetInnerHTML:{__html:e?.policy||""}})]}),(0,s.jsx)("div",{className:(0,i.classNames)("w-full text-left text-[16px] font-semibold",v&&"text-[#F84D4F]",_&&"text-[#52C41A]"),children:(0,s.jsx)(o.Text,{html:_||v||""})})]})})}
|
|
2
|
+
//# sourceMappingURL=SubscribeModal.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/components/credits/modal/
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\nimport { useRouter } from 'next/router'\nimport { Button, Checkbox, Picture, Text } from '@anker-in/headless-ui'\nimport { classNames, fetcher, gaTrack, useHeadlessContext } from '@anker-in/lib'\nimport Cookies from 'js-cookie'\nimport { parse } from 'query-string'\nimport sha256 from 'crypto-js/sha256'\nimport { useCreditsContext } from '../context/provider'\nimport { ROUNDED_BRANDS } from '../../../constants'\nimport { emailValidate } from '../context/utils'\nimport { CreditsModalContainer, type ModalContainerProps } from './
|
|
3
|
+
"sources": ["../../../../../src/components/credits/modal/SubscribeModal.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\nimport { useRouter } from 'next/router'\nimport { Button, Checkbox, Picture, Text } from '@anker-in/headless-ui'\nimport { classNames, fetcher, gaTrack, useHeadlessContext } from '@anker-in/lib'\nimport Cookies from 'js-cookie'\nimport { parse } from 'query-string'\nimport sha256 from 'crypto-js/sha256'\nimport { useCreditsContext } from '../context/provider'\nimport { ROUNDED_BRANDS } from '../../../constants'\nimport { emailValidate } from '../context/utils'\nimport { CreditsModalContainer, type ModalContainerProps } from './ModalContainer'\n\nexport type CreditsSubscribeModalCopy = {\n title: string\n desc?: string\n placeholder: string\n policy?: string\n successTips?: string\n dealsType?: string\n}\n\ninterface CreditsSubscribeModalProps extends ModalContainerProps {\n copy: CreditsSubscribeModalCopy\n onSuccess?: () => void\n}\n\nconst getAdCookie = () => {\n if (typeof window === 'undefined') {\n return { register_source: '' }\n }\n const { search, href } = window.location || {}\n const query = parse(search)\n\n return {\n fbuy_ref_code: Cookies.get('fbuy_ref_code'),\n affiliate: Cookies.get('affiliate'),\n ref: Cookies.get('ref_ads'),\n inviter_code: query.ic || query.inviter_code || Cookies.get('inviter_code'),\n register_source: query.redirect || Cookies.get('reg_source') || href,\n deals_type: Cookies.get('deal'),\n transfer_id: Cookies.get('transfer_id'),\n }\n}\n\nexport function CreditsSubscribeModal({ copy, onSuccess, ...props }: CreditsSubscribeModalProps) {\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const { locale } = useRouter()\n const [policy, setPolicy] = useState(false)\n const [email, setEmail] = useState('')\n const [errorMessage, setErrorMessage] = useState('')\n const [successMessage, setSuccessMessage] = useState('')\n const [loading, setLoading] = useState(false)\n const { profile } = useCreditsContext()\n\n const handleEmailChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setErrorMessage('')\n setEmail(event.target?.value?.trim())\n }, [])\n\n const handleSubmit = useCallback(async () => {\n setErrorMessage('')\n if (!email) {\n return setErrorMessage('Please fill in your email')\n }\n\n if (!emailValidate(email)) {\n return setErrorMessage('Invalid email address')\n }\n\n if (!policy) {\n return setErrorMessage('Please agree to the policy')\n }\n\n setLoading(true)\n const { register_source } = getAdCookie()\n\n const result = await fetcher({\n locale,\n action: 'subscribe',\n url: '/api/multipass/subscribe/subscribe_emails',\n method: 'POST',\n body: {\n email,\n register_source,\n brand,\n deals_type: copy.dealsType || 'vip_subscribe',\n },\n headers: {},\n type: '',\n })\n setLoading(false)\n\n if (!result.errors) {\n setSuccessMessage(copy.successTips || 'Subscribed successfully!')\n if (onSuccess) {\n onSuccess()\n }\n setTimeout(() => {\n setSuccessMessage('')\n }, 3000)\n gaTrack({\n subscribe_hashed_email: email ? sha256(email) : '',\n })\n gaTrack({\n event: 'ga4Event',\n event_name: 'subscribe',\n event_parameters: {\n page_group: copy.dealsType || 'vip_subscribe',\n position: 'pop_up',\n },\n })\n gaTrack({\n event: 'uaEvent',\n eventCategory: 'subscribe',\n eventAction: copy.dealsType || 'vip_subscribe',\n eventLabel: 'pop_up',\n nonInteraction: false,\n })\n } else {\n setErrorMessage(result.errors || result.statusText)\n }\n }, [email, policy, locale, brand, copy.dealsType, copy.successTips, onSuccess])\n\n useEffect(() => {\n if (profile && profile?.email) {\n setEmail(profile?.email)\n }\n }, [profile])\n\n return (\n <CreditsModalContainer\n className=\"w-[540px] md:h-auto\"\n scrollClassName=\"mb-[40px] min-l:px-[48px] md:mb-[24px]\"\n titleClassName=\"h-[56px]\"\n useAnimation\n animationClassName=\"md:translate-y-[100vh]\"\n {...props}\n >\n <div className=\"flex flex-col gap-[16px] text-center min-l:px-[16px]\">\n <div>\n <Text className={classNames('mb-[24px] text-[22px] font-bold')} html={copy.title}></Text>\n </div>\n {copy.desc && (\n <Text\n className=\"mb-[8px] text-left text-[16px] font-semibold leading-[1.4] text-[#1F2021]\"\n html={copy.desc}\n ></Text>\n )}\n <div\n className={classNames(\n 'relative flex h-[52px] w-full overflow-hidden rounded-[2px] md:grid md:h-auto md:grid-rows-1 md:gap-[16px]',\n !rounded && 'rounded-none'\n )}\n >\n <input\n className={classNames(\n 'h-full flex-1 rounded-l-[2px] border-[1px] border-[#d8d8d8] px-[14px] py-[17px] text-[16px] font-semibold leading-[1] outline-none placeholder:text-[#999] md:h-[52px] md:rounded-[2px]',\n !rounded && 'rounded-none'\n )}\n placeholder={copy.placeholder}\n value={email}\n onChange={handleEmailChange}\n />\n <Button\n variant=\"primary\"\n onClick={handleSubmit}\n loading={loading}\n className={classNames(\n 'legacy-headless-ui-primary-button !h-full !min-w-0 !rounded-l-none !rounded-r-[2px] !px-[40px] !py-[13px]',\n !rounded && 'rounded-none'\n )}\n >\n <Picture\n source=\"https://cdn.shopify.com/s/files/1/0512/8568/8505/files/icon_email.png?v=1697527383\"\n className=\"h-[24px] w-[24px]\"\n alt=\"email\"\n />\n </Button>\n </div>\n <div className=\"flex w-full\">\n <Checkbox checked={policy} onCheckedChange={() => setPolicy(!policy)} required className=\"border-[#1d1d1f]\" />\n <label\n className=\"text-left ml-2 text-[14px] font-semibold text-[#777] [&_a]:underline\"\n dangerouslySetInnerHTML={{\n __html: copy?.policy || '',\n }}\n />\n </div>\n <div\n className={classNames(\n 'w-full text-left text-[16px] font-semibold',\n errorMessage && 'text-[#F84D4F]',\n successMessage && 'text-[#52C41A]'\n )}\n >\n <Text html={successMessage || errorMessage || ''} />\n </div>\n </div>\n </CreditsModalContainer>\n )\n}\n"],
|
|
5
5
|
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,IAAA,eAAAC,EAAAH,GA6IU,IAAAI,EAAA,6BA7IVC,EAAiD,iBACjDC,EAA0B,uBAC1BC,EAAgD,iCAChDC,EAAiE,yBACjEC,EAAoB,wBACpBC,EAAsB,wBACtBC,EAAmB,+BACnBC,EAAkC,+BAClCC,EAA+B,8BAC/BC,EAA8B,4BAC9BC,EAAgE,4BAgBhE,MAAMC,EAAc,IAAM,CACxB,GAAI,OAAO,OAAW,IACpB,MAAO,CAAE,gBAAiB,EAAG,EAE/B,KAAM,CAAE,OAAAC,EAAQ,KAAAC,CAAK,EAAI,OAAO,UAAY,CAAC,EACvCC,KAAQ,SAAMF,CAAM,EAE1B,MAAO,CACL,cAAe,EAAAG,QAAQ,IAAI,eAAe,EAC1C,UAAW,EAAAA,QAAQ,IAAI,WAAW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,qFACP,UAAU,oBACV,IAAI,QACN,EACF,GACF,KACA,QAAC,OAAI,UAAU,cACb,oBAAC,YAAS,QAASE,EAAQ,gBAAiB,IAAMC,EAAU,CAACD,CAAM,EAAG,SAAQ,GAAC,UAAU,mBAAmB,KAC5G,OAAC,SACC,UAAU,uEACV,wBAAyB,CACvB,OAAQN,GAAM,QAAU,EAC1B,EACF,GACF,KACA,OAAC,OACC,aAAW,cACT,6CACAU,GAAgB,iBAChBE,GAAkB,gBACpB,EAEA,mBAAC,QAAK,KAAMA,GAAkBF,GAAgB,GAAI,EACpD,GACF,EACF,CAEJ",
|
|
6
|
-
"names": ["
|
|
6
|
+
"names": ["SubscribeModal_exports", "__export", "CreditsSubscribeModal", "__toCommonJS", "import_jsx_runtime", "import_react", "import_router", "import_headless_ui", "import_lib", "import_js_cookie", "import_query_string", "import_sha256", "import_provider", "import_constants", "import_utils", "import_ModalContainer", "getAdCookie", "search", "href", "query", "Cookies", "copy", "onSuccess", "props", "brand", "rounded", "locale", "policy", "setPolicy", "email", "setEmail", "errorMessage", "setErrorMessage", "successMessage", "setSuccessMessage", "loading", "setLoading", "profile", "handleEmailChange", "event", "handleSubmit", "register_source", "result", "sha256"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";var m=Object.create;var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var h=(e,o)=>{for(var t in o)l(e,t,{get:o[t],enumerable:!0})},i=(e,o,t,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of c(o))!C.call(e,p)&&p!==t&&l(e,p,{get:()=>o[p],enumerable:!(s=u(o,p))||s.enumerable});return e};var v=(e,o,t)=>(t=e!=null?m(g(e)):{},i(o||!e||!e.__esModule?l(t,"default",{value:e,enumerable:!0}):t,e)),w=e=>i(l({},"__esModule",{value:!0}),e);var y={};h(y,{default:()=>k});module.exports=w(y);var r=require("react/jsx-runtime"),d=require("@anker-in/lib"),a=v(require("classnames")),x=require("react"),b=require("../../../constants");function N({info:e,index:o}){const[t,s]=(0,x.useState)(!1),{brand:p}=(0,d.useHeadlessContext)(),f=b.ROUNDED_BRANDS.includes(p);return(0,r.jsxs)("div",{className:"relative ml-[6px] cursor-pointer",onClick:()=>{s(!t)},role:"button",tabIndex:0,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&n.preventDefault()},onMouseOver:()=>{s(!0)},onFocus:()=>{s(!0)},onMouseLeave:()=>{s(!1)},onBlur:()=>{s(!1)},children:[(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:(0,r.jsx)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9 18C13.9706 18 18 13.9706 18 9C18 4.02944 13.9706 0 9 0C4.02944 0 0 4.02944 0 9C0 13.9706 4.02944 18 9 18ZM9.765 10.7118H8.316C8.316 9.71658 8.95624 9.11788 9.5487 8.56386C10.0589 8.08679 10.5336 7.64285 10.5336 7.0074C10.5336 6.2766 9.9918 5.9112 9.1854 5.9112C8.3916 5.9112 7.7994 6.327 7.5474 7.0704L6.3 6.3648C6.7788 5.13 7.938 4.5 9.2232 4.5C10.6218 4.5 11.9826 5.3316 11.9826 6.9192C11.9826 7.95842 11.3297 8.58584 10.7324 9.15979C10.2289 9.64359 9.765 10.0894 9.765 10.7118ZM9.9918 12.69C9.9918 13.2066 9.5634 13.635 9.0468 13.635C8.5176 13.635 8.1018 13.2066 8.1018 12.69C8.1018 12.1608 8.5176 11.745 9.0468 11.745C9.5634 11.745 9.9918 12.1608 9.9918 12.69Z",fill:"#999999"})}),(0,r.jsxs)("div",{className:(0,a.default)("absolute -right-[14px] hidden min-w-[300px] shadow-[0px_1px_12px_0px_rgba(0,0,0,0.12)]",o===0?"top-[33px]":"bottom-[33px]",t&&"!block"),children:[(0,r.jsx)("i",{className:"absolute right-[8px] blur-[12px]",style:o===0?{top:"-9px",borderRight:"16px solid transparent ",borderLeft:"16px solid transparent ",borderBottom:"8px solid rgba(0,0,0,0.12)"}:{bottom:"-9px",borderRight:"16px solid transparent ",borderLeft:"16px solid transparent ",borderTop:"8px solid rgba(0,0,0,0.12)"}}),(0,r.jsx)("i",{className:"absolute right-[8px]",style:o===0?{top:"-7px",borderRight:"16px solid transparent ",borderLeft:"16px solid transparent ",borderBottom:"8px solid #fff "}:{bottom:"-7px",borderRight:"16px solid transparent ",borderLeft:"16px solid transparent ",borderTop:"8px solid #fff "}}),(0,r.jsx)("p",{className:(0,a.default)("relative block rounded-[4px] bg-white px-[14px] py-[12px]",!f&&"rounded-none"),children:(0,r.jsx)("span",{className:"block text-left text-[14px] font-semibold leading-[1.4] text-[#333]",children:e})})]})]})}var k=N;
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=Tip.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../../src/components/credits/modal/
|
|
3
|
+
"sources": ["../../../../../src/components/credits/modal/Tip.tsx"],
|
|
4
4
|
"sourcesContent": ["import { useHeadlessContext } from '@anker-in/lib'\nimport classNames from 'classnames'\nimport { useState } from 'react'\nimport { ROUNDED_BRANDS } from '../../../constants'\n\nfunction Tip({ info, index }: { info: string; index: number }) {\n const [show, setShow] = useState(false)\n\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n\n return (\n <div\n className=\"relative ml-[6px] cursor-pointer\"\n onClick={() => {\n setShow(!show)\n }}\n role=\"button\"\n tabIndex={0}\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n }\n }}\n onMouseOver={() => {\n setShow(true)\n }}\n onFocus={() => {\n setShow(true)\n }}\n onMouseLeave={() => {\n setShow(false)\n }}\n onBlur={() => {\n setShow(false)\n }}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 18 18\" fill=\"none\">\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M9 18C13.9706 18 18 13.9706 18 9C18 4.02944 13.9706 0 9 0C4.02944 0 0 4.02944 0 9C0 13.9706 4.02944 18 9 18ZM9.765 10.7118H8.316C8.316 9.71658 8.95624 9.11788 9.5487 8.56386C10.0589 8.08679 10.5336 7.64285 10.5336 7.0074C10.5336 6.2766 9.9918 5.9112 9.1854 5.9112C8.3916 5.9112 7.7994 6.327 7.5474 7.0704L6.3 6.3648C6.7788 5.13 7.938 4.5 9.2232 4.5C10.6218 4.5 11.9826 5.3316 11.9826 6.9192C11.9826 7.95842 11.3297 8.58584 10.7324 9.15979C10.2289 9.64359 9.765 10.0894 9.765 10.7118ZM9.9918 12.69C9.9918 13.2066 9.5634 13.635 9.0468 13.635C8.5176 13.635 8.1018 13.2066 8.1018 12.69C8.1018 12.1608 8.5176 11.745 9.0468 11.745C9.5634 11.745 9.9918 12.1608 9.9918 12.69Z\"\n fill=\"#999999\"\n />\n </svg>\n <div\n className={classNames(\n 'absolute -right-[14px] hidden min-w-[300px] shadow-[0px_1px_12px_0px_rgba(0,0,0,0.12)]',\n index === 0 ? 'top-[33px]' : 'bottom-[33px]',\n show && '!block'\n )}\n >\n <i\n className=\"absolute right-[8px] blur-[12px]\"\n style={\n index === 0\n ? {\n top: '-9px',\n borderRight: '16px solid transparent ',\n borderLeft: '16px solid transparent ',\n borderBottom: '8px solid rgba(0,0,0,0.12)',\n }\n : {\n bottom: '-9px',\n borderRight: '16px solid transparent ',\n borderLeft: '16px solid transparent ',\n borderTop: '8px solid rgba(0,0,0,0.12)',\n }\n }\n ></i>\n <i\n className=\"absolute right-[8px]\"\n style={\n index === 0\n ? {\n top: '-7px',\n borderRight: '16px solid transparent ',\n borderLeft: '16px solid transparent ',\n borderBottom: '8px solid #fff ',\n }\n : {\n bottom: '-7px',\n borderRight: '16px solid transparent ',\n borderLeft: '16px solid transparent ',\n borderTop: '8px solid #fff ',\n }\n }\n ></i>\n <p\n className={classNames(\n 'relative block rounded-[4px] bg-white px-[14px] py-[12px]',\n !rounded && 'rounded-none'\n )}\n >\n <span className=\"block text-left text-[14px] font-semibold leading-[1.4] text-[#333]\">{info}</span>\n </p>\n </div>\n </div>\n )\n}\n\nexport default Tip\n"],
|
|
5
5
|
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAsCQ,IAAAI,EAAA,6BAtCRC,EAAmC,yBACnCC,EAAuB,yBACvBC,EAAyB,iBACzBC,EAA+B,8BAE/B,SAASC,EAAI,CAAE,KAAAC,EAAM,MAAAC,CAAM,EAAoC,CAC7D,KAAM,CAACC,EAAMC,CAAO,KAAI,YAAS,EAAK,EAEhC,CAAE,MAAAC,CAAM,KAAI,sBAAmB,EAC/BC,EAAU,iBAAe,SAASD,CAAK,EAE7C,SACE,QAAC,OACC,UAAU,mCACV,QAAS,IAAM,CACbD,EAAQ,CAACD,CAAI,CACf,EACA,KAAK,SACL,SAAU,EACV,UAAWI,GAAK,EACVA,EAAE,MAAQ,SAAWA,EAAE,MAAQ,MACjCA,EAAE,eAAe,CAErB,EACA,YAAa,IAAM,CACjBH,EAAQ,EAAI,CACd,EACA,QAAS,IAAM,CACbA,EAAQ,EAAI,CACd,EACA,aAAc,IAAM,CAClBA,EAAQ,EAAK,CACf,EACA,OAAQ,IAAM,CACZA,EAAQ,EAAK,CACf,EAEA,oBAAC,OAAI,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACtF,mBAAC,QACC,YAAU,UACV,YAAU,UACV,EAAE,8pBACF,KAAK,UACP,EACF,KACA,QAAC,OACC,aAAW,EAAAI,SACT,yFACAN,IAAU,EAAI,aAAe,gBAC7BC,GAAQ,QACV,EAEA,oBAAC,KACC,UAAU,mCACV,MACED,IAAU,EACN,CACE,IAAK,OACL,YAAa,0BACb,WAAY,0BACZ,aAAc,4BAChB,EACA,CACE,OAAQ,OACR,YAAa,0BACb,WAAY,0BACZ,UAAW,4BACb,EAEP,KACD,OAAC,KACC,UAAU,uBACV,MACEA,IAAU,EACN,CACE,IAAK,OACL,YAAa,0BACb,WAAY,0BACZ,aAAc,iBAChB,EACA,CACE,OAAQ,OACR,YAAa,0BACb,WAAY,0BACZ,UAAW,iBACb,EAEP,KACD,OAAC,KACC,aAAW,EAAAM,SACT,4DACA,CAACF,GAAW,cACd,EAEA,mBAAC,QAAK,UAAU,sEAAuE,SAAAL,EAAK,EAC9F,GACF,GACF,CAEJ,CAEA,IAAOR,EAAQO",
|
|
6
|
-
"names": ["
|
|
6
|
+
"names": ["Tip_exports", "__export", "Tip_default", "__toCommonJS", "import_jsx_runtime", "import_lib", "import_classnames", "import_react", "import_constants", "Tip", "info", "index", "show", "setShow", "brand", "rounded", "e", "classNames"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Product, ProductVariant } from '@anker-in/lib';
|
|
2
2
|
import type { AlpcConsumeType, ConsumeType } from './context/const';
|
|
3
|
-
import { MyActivitiesMetafields } from './modal/
|
|
4
|
-
import {
|
|
3
|
+
import { MyActivitiesMetafields } from './modal/ActivitiesModal';
|
|
4
|
+
import { RewardsCopy } from './modal/RewardsModal';
|
|
5
5
|
export interface Subscription {
|
|
6
6
|
preference: {
|
|
7
7
|
subscribe: boolean;
|
|
@@ -28,8 +28,8 @@ export type RedeemableItem = {
|
|
|
28
28
|
showCredit: boolean;
|
|
29
29
|
title: string;
|
|
30
30
|
};
|
|
31
|
-
product
|
|
32
|
-
variant
|
|
31
|
+
product?: Product;
|
|
32
|
+
variant?: ProductVariant;
|
|
33
33
|
};
|
|
34
34
|
export interface ShippingCountry {
|
|
35
35
|
id: string;
|
|
@@ -45,6 +45,66 @@ export interface ShippingZone {
|
|
|
45
45
|
name: string;
|
|
46
46
|
countries: ShippingCountry[];
|
|
47
47
|
}
|
|
48
|
+
export type RedeemModalCommon = {
|
|
49
|
+
confirmTitle: string;
|
|
50
|
+
confirmButton: string;
|
|
51
|
+
commonError: string;
|
|
52
|
+
redeemLimitError: string;
|
|
53
|
+
inventoryNotEnough: string;
|
|
54
|
+
creditsNotEnough: string;
|
|
55
|
+
crossSiteError: string;
|
|
56
|
+
errorImageUrl: string;
|
|
57
|
+
coupon: {
|
|
58
|
+
successDesc: string;
|
|
59
|
+
successTitle: string;
|
|
60
|
+
successButton: string;
|
|
61
|
+
successButtonUrl: string;
|
|
62
|
+
};
|
|
63
|
+
virtualProduct: {
|
|
64
|
+
successDesc: string;
|
|
65
|
+
successTitle: string;
|
|
66
|
+
successButton: string;
|
|
67
|
+
successButtonUrl: string;
|
|
68
|
+
stepTitle?: string;
|
|
69
|
+
steps?: {
|
|
70
|
+
imageUrl: string;
|
|
71
|
+
title: string;
|
|
72
|
+
}[];
|
|
73
|
+
};
|
|
74
|
+
product: {
|
|
75
|
+
required: string;
|
|
76
|
+
invalidEmail: string;
|
|
77
|
+
shippingAddress: string;
|
|
78
|
+
shippingProduct: string;
|
|
79
|
+
addressForm: {
|
|
80
|
+
key: string;
|
|
81
|
+
type: string;
|
|
82
|
+
label: string;
|
|
83
|
+
isSelect: boolean;
|
|
84
|
+
required: boolean;
|
|
85
|
+
placeholder: string;
|
|
86
|
+
}[][];
|
|
87
|
+
form: {
|
|
88
|
+
key: string;
|
|
89
|
+
type: string;
|
|
90
|
+
isSelect: boolean;
|
|
91
|
+
required: boolean;
|
|
92
|
+
placeholder: string;
|
|
93
|
+
}[][];
|
|
94
|
+
successDesc: string[];
|
|
95
|
+
rules: string[];
|
|
96
|
+
steps: {
|
|
97
|
+
imageUrl: string;
|
|
98
|
+
title: string;
|
|
99
|
+
}[];
|
|
100
|
+
quantityLabel: string;
|
|
101
|
+
totalPriceLabel: string;
|
|
102
|
+
variantLabel: string;
|
|
103
|
+
shippingFeeLabel: string;
|
|
104
|
+
paymentButton: string;
|
|
105
|
+
stepTitle: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
48
108
|
export type CreditsPageCommon = {
|
|
49
109
|
pointUnit?: string;
|
|
50
110
|
infoIcon?: string;
|
|
@@ -54,13 +114,15 @@ export type CreditsPageCommon = {
|
|
|
54
114
|
off?: string;
|
|
55
115
|
copy?: string;
|
|
56
116
|
giftCardLabel?: string;
|
|
117
|
+
goGiftLabel?: string;
|
|
57
118
|
imageMapping?: {
|
|
58
119
|
[key in ConsumeType]: {
|
|
59
120
|
url: string;
|
|
60
121
|
};
|
|
61
122
|
};
|
|
62
123
|
activitiesModal?: MyActivitiesMetafields;
|
|
63
|
-
rewardsModal?:
|
|
124
|
+
rewardsModal?: RewardsCopy;
|
|
125
|
+
redeemModal?: RedeemModalCommon;
|
|
64
126
|
insufficientCredits?: string;
|
|
65
127
|
validatorInfo?: {
|
|
66
128
|
addressInfo: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var a=(r,t,n,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of g(t))!c.call(r,i)&&i!==n&&s(r,i,{get:()=>t[i],enumerable:!(e=o(t,i))||e.enumerable});return r};var l=r=>a(s({},"__esModule",{value:!0}),r);var p={};module.exports=l(p);
|
|
2
2
|
//# sourceMappingURL=type.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/credits/type.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Product, ProductVariant } from '@anker-in/lib'\nimport type { AlpcConsumeType, ConsumeType } from './context/const'\nimport { MyActivitiesMetafields } from './modal/
|
|
4
|
+
"sourcesContent": ["import type { Product, ProductVariant } from '@anker-in/lib'\nimport type { AlpcConsumeType, ConsumeType } from './context/const'\nimport { MyActivitiesMetafields } from './modal/ActivitiesModal'\nimport { RewardsCopy } from './modal/RewardsModal'\n\nexport interface Subscription {\n preference: {\n subscribe: boolean\n brand: string\n }[]\n}\n\nexport type RedeemableItem = {\n config: {\n title: string\n desc: string\n rules: string[]\n image: {\n url: string\n }\n type: ConsumeType\n value: string\n }\n alpc: {\n id: string\n consumeCredits: number\n remainingInventory: number\n isLimited: boolean\n consumeType: AlpcConsumeType\n showCredit: boolean\n title: string\n }\n product?: Product\n variant?: ProductVariant\n}\n\nexport interface ShippingCountry {\n id: string\n name: string\n code: string\n provinces: {\n id: string\n name: string\n code: string\n }[]\n}\n\nexport interface ShippingZone {\n name: string\n countries: ShippingCountry[]\n}\n\nexport type RedeemModalCommon = {\n confirmTitle: string\n confirmButton: string\n commonError: string\n redeemLimitError: string\n inventoryNotEnough: string\n creditsNotEnough: string\n crossSiteError: string\n errorImageUrl: string\n coupon: {\n successDesc: string\n successTitle: string\n successButton: string\n successButtonUrl: string\n }\n virtualProduct: {\n successDesc: string\n successTitle: string\n successButton: string\n successButtonUrl: string\n stepTitle?: string\n steps?: {\n imageUrl: string\n title: string\n }[]\n }\n product: {\n required: string\n invalidEmail: string\n shippingAddress: string\n shippingProduct: string\n addressForm: {\n key: string\n type: string\n label: string\n isSelect: boolean\n required: boolean\n placeholder: string\n }[][]\n form: {\n key: string\n type: string\n isSelect: boolean\n required: boolean\n placeholder: string\n }[][]\n successDesc: string[]\n rules: string[]\n steps: {\n imageUrl: string\n title: string\n }[]\n quantityLabel: string\n totalPriceLabel: string\n variantLabel: string\n shippingFeeLabel: string\n paymentButton: string\n stepTitle: string\n }\n}\n\nexport type CreditsPageCommon = {\n pointUnit?: string\n infoIcon?: string\n ruleLabel?: string\n soldOut?: string\n copied?: string\n off?: string\n copy?: string\n giftCardLabel?: string\n goGiftLabel?: string\n imageMapping?: {\n [key in ConsumeType]: {\n url: string\n }\n }\n activitiesModal?: MyActivitiesMetafields\n rewardsModal?: RewardsCopy\n redeemModal?: RedeemModalCommon\n insufficientCredits?: string\n validatorInfo?: {\n addressInfo: {\n name: string\n country: string\n province: string\n city: string\n address: string\n }\n }\n}\n"],
|
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
6
|
"names": ["type_exports", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,88 +1,2 @@
|
|
|
1
|
-
import {
|
|
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 { CreditsBannerCopy } from '../components/credits/creditsBanner';
|
|
6
|
-
import { CreditsInfoCardCopy } from '../components/credits/creditsInfoCard';
|
|
7
|
-
import { CreditsBenefitsCopy } from '../components/credits/creditsBenefits';
|
|
8
|
-
import { CreditsWaysToGetCreditsCopy } from '../components/credits/creditsWaysToGetCredits';
|
|
9
|
-
import { CreditsAnkersolixTaskCopy } from '../components/credits/creditsAnkersolixTask';
|
|
10
|
-
import { CreditsRedeemListCopy } from '../components/credits/creditsRedeemList';
|
|
11
|
-
import { CreditsCashCopy } from '../components/credits/creditsCash';
|
|
12
|
-
import { CreditsMemberPriceCopy } from '../components/credits/creditsMemberPrice';
|
|
13
|
-
import { CreditsFaqCopy } from '../components/credits/creditsFaq';
|
|
14
|
-
import { CreditsNavigationCopy } from '../components/credits/creditsNavigation';
|
|
15
|
-
import { AuthCodeActivateCopy } from 'src/components/registration/authCodeActivate/type';
|
|
16
|
-
export declare enum ComponentKey {
|
|
17
|
-
Navigation = "creditsNavigation",
|
|
18
|
-
Banner = "creditsBanner",
|
|
19
|
-
InfoCard = "creditsInfoCard",
|
|
20
|
-
Benefits = "creditsBenefits",
|
|
21
|
-
WaysToGetCredits = "creditsWaysToGetCredits",
|
|
22
|
-
AnkersolixTask = "creditsAnkersolixTask",
|
|
23
|
-
RedeemList = "creditsRedeemList",
|
|
24
|
-
SpendCreditsLikeCash = "creditsCash",
|
|
25
|
-
MemberPrice = "creditsMemberPrice",
|
|
26
|
-
Faqs = "creditsFaq"
|
|
27
|
-
}
|
|
28
|
-
export type CreditsTemplateProps = {
|
|
29
|
-
headlessConfig: HeadlessConfig;
|
|
30
|
-
siteConfig: {
|
|
31
|
-
registrationsSettings: {
|
|
32
|
-
authCodeActivate: AuthCodeActivateCopy;
|
|
33
|
-
};
|
|
34
|
-
taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>;
|
|
35
|
-
memberPriceDiscount?: FunctionMemberPriceConfig[];
|
|
36
|
-
};
|
|
37
|
-
creditsConfig?: {
|
|
38
|
-
alpcBrand?: string;
|
|
39
|
-
};
|
|
40
|
-
pageConfig: {
|
|
41
|
-
order: ComponentKey[];
|
|
42
|
-
common: CreditsPageCommon;
|
|
43
|
-
components: {
|
|
44
|
-
[ComponentKey.Navigation]?: CreditsNavigationCopy;
|
|
45
|
-
[ComponentKey.Banner]?: CreditsBannerCopy;
|
|
46
|
-
[ComponentKey.InfoCard]?: CreditsInfoCardCopy;
|
|
47
|
-
[ComponentKey.Benefits]?: CreditsBenefitsCopy;
|
|
48
|
-
[ComponentKey.WaysToGetCredits]?: CreditsWaysToGetCreditsCopy;
|
|
49
|
-
[ComponentKey.AnkersolixTask]?: CreditsAnkersolixTaskCopy;
|
|
50
|
-
[ComponentKey.RedeemList]?: CreditsRedeemListCopy;
|
|
51
|
-
[ComponentKey.SpendCreditsLikeCash]?: CreditsCashCopy;
|
|
52
|
-
[ComponentKey.MemberPrice]?: CreditsMemberPriceCopy;
|
|
53
|
-
[ComponentKey.Faqs]?: CreditsFaqCopy;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
userContext: {
|
|
57
|
-
profile: any;
|
|
58
|
-
removeProfile: () => void;
|
|
59
|
-
isLoadingProfile: boolean;
|
|
60
|
-
creditInfo: any;
|
|
61
|
-
customer: any;
|
|
62
|
-
customerLoading: boolean;
|
|
63
|
-
fetchCreditInfo: () => void;
|
|
64
|
-
};
|
|
65
|
-
registrationContext: {
|
|
66
|
-
openSignUpPopup: () => void;
|
|
67
|
-
openSignInPopup: () => void;
|
|
68
|
-
};
|
|
69
|
-
gtm: {
|
|
70
|
-
pageGroup: string;
|
|
71
|
-
pageHandle?: string;
|
|
72
|
-
};
|
|
73
|
-
cartConfig?: {
|
|
74
|
-
addToCart: (params: {
|
|
75
|
-
variantList: Array<{
|
|
76
|
-
variant: any;
|
|
77
|
-
quantity: number;
|
|
78
|
-
attributes?: Array<{
|
|
79
|
-
key: string;
|
|
80
|
-
value: string;
|
|
81
|
-
}>;
|
|
82
|
-
}>;
|
|
83
|
-
cartAttributes?: Record<string, string>;
|
|
84
|
-
discountCodes?: string[];
|
|
85
|
-
}) => void | Promise<any>;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
1
|
+
import type { CreditsTemplateProps } from './Credits.types';
|
|
88
2
|
export declare const CreditsTemplate: ({ headlessConfig, siteConfig, creditsConfig, userContext, pageConfig, registrationContext, gtm, cartConfig, }: CreditsTemplateProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var N=Object.create;var m=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var S=(r,i)=>{for(var d in i)m(r,d,{get:i[d],enumerable:!0})},P=(r,i,d,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of q(i))!x.call(r,a)&&a!==d&&m(r,a,{get:()=>i[a],enumerable:!(s=F(i,a))||s.enumerable});return r};var y=(r,i,d)=>(d=r!=null?N(w(r)):{},P(i||!r||!r.__esModule?m(d,"default",{value:r,enumerable:!0}):d,r)),O=r=>P(m({},"__esModule",{value:!0}),r);var U={};S(U,{CreditsTemplate:()=>H});module.exports=O(U);var e=require("react/jsx-runtime"),l=require("@anker-in/lib"),g=require("../components/registration/context/provider"),c=require("../components/credits/context/provider"),v=require("../components/credits/creditsBanner"),M=require("../components/credits/creditsInfoCard"),T=require("../components/credits/creditsBenefits"),u=require("../components/credits/creditsWaysToGetCredits"),b=require("../components/credits/creditsAnkersolixTask"),h=require("../components/credits/creditsRedeemList"),G=require("../components/credits/creditsGoGift"),I=require("../components/credits/creditsCash"),B=require("../components/credits/creditsMemberPrice"),A=require("../components/credits/creditsFaq"),L=require("../components/credits/creditsNavigation"),R=y(require("../components/credits/modal/ActivitiesModal")),D=y(require("../components/credits/modal/RewardsModal")),t=require("./Credits.types");const W=({headlessConfig:r,pageConfig:i,userContext:d})=>{const{openMyRewardsModal:s,setOpenMyRewardsModal:a,openActivitiesModal:C,setOpenActivitiesModal:f,pageCommon:n}=(0,c.useCreditsContext)();return(0,e.jsxs)(e.Fragment,{children:[i.components[t.ComponentKey.Navigation]&&(0,e.jsx)(L.CreditsNavigation,{copy:i.components[t.ComponentKey.Navigation]}),(0,e.jsx)("div",{className:(0,l.classNames)("bg-[#f5f5f7] leading-[1.2]"),children:i.order.map(o=>{if(o===t.ComponentKey.Navigation)return null;const p=i.components?.[o];return p?(0,e.jsxs)(e.Fragment,{children:[o===t.ComponentKey.Banner&&(0,e.jsx)(v.CreditsBanner,{copy:p,id:o}),o===t.ComponentKey.InfoCard&&d?.profile&&(0,e.jsx)(M.CreditsInfoCard,{copy:p,id:o}),o===t.ComponentKey.Benefits&&(0,e.jsx)(T.CreditsBenefits,{copy:p,id:o}),o===t.ComponentKey.WaysToGetCredits&&(0,e.jsx)(u.CreditsWaysToGetCredits,{copy:p,id:o,classNames:r.brand==="anker"?{subtitle:"text-white",equalCreditsText:"bg-gradient-to-r from-[#3AD1FF] to-[#008CD6] bg-clip-text text-transparent"}:{subtitle:"text-[#D1D1D1]",equalCreditsText:"text-[#F6EAD0]"}}),o===t.ComponentKey.AnkersolixTask&&(0,e.jsx)(b.CreditsAnkersolixTask,{copy:p,id:o}),o===t.ComponentKey.RedeemList&&(0,e.jsx)(h.CreditsRedeemList,{copy:p,id:o}),o===t.ComponentKey.GoGift&&(0,e.jsx)(G.CreditsGoGift,{copy:p,id:o}),o===t.ComponentKey.SpendCreditsLikeCash&&(0,e.jsx)(I.CreditsCash,{copy:p,id:o}),o===t.ComponentKey.MemberPrice&&(0,e.jsx)(B.CreditsMemberPrice,{copy:p,id:o}),o===t.ComponentKey.Faqs&&(0,e.jsx)(A.CreditsFaq,{copy:p,id:o}),o!==t.ComponentKey.Banner&&(0,e.jsx)("div",{className:"laptop:h-16 desktop:h-[96px] lg-desktop:h-[128px] tablet:h-16 h-16"})]}):null})}),n?.activitiesModal&&(0,e.jsx)(R.default,{isOpen:C,data:n.activitiesModal,onClose:()=>f(!1)}),n?.rewardsModal&&(0,e.jsx)(D.default,{isOpen:s,data:n.rewardsModal,onClose:()=>a(!1)})]})},H=({headlessConfig:r,siteConfig:i,creditsConfig:d,userContext:s,pageConfig:a,registrationContext:C,gtm:f,cartConfig:n})=>(0,e.jsx)(l.HeadlessProvider,{headlessConfig:r,children:(0,e.jsx)(g.RegistrationProvider,{copy:i.registrationsSettings,email:s?.profile?.email,children:(0,e.jsx)(c.CreditsProvider,{profile:s?.profile,removeProfile:s?.removeProfile,isLoadingProfile:s?.isLoadingProfile,openSignInPopup:C.openSignInPopup,openSignUpPopup:C.openSignUpPopup,creditInfo:s?.creditInfo,taskIdToTypeMapping:i.taskIdToTypeMapping,customer:s?.customer,fetchCreditInfo:s?.fetchCreditInfo,customerLoading:s?.customerLoading,gtm:f,pageCommon:a.common,memberPriceDiscount:i.memberPriceDiscount,alpcBrand:d?.alpcBrand,cartConfig:n,children:(0,e.jsx)(W,{headlessConfig:r,pageConfig:a,userContext:s})})})});
|
|
2
2
|
//# sourceMappingURL=Credits.js.map
|