@anker-in/campaign-ui 0.2.1 → 0.2.2-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/hooks/useActivities.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useActivities.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useAlpcFetch.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useAlpcFetch.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.d.ts +7 -0
- package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js +2 -0
- package/dist/cjs/components/credits/context/hooks/useFunctionMemberPrice.js.map +7 -0
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useMyRewards.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js +1 -1
- package/dist/cjs/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
- 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/memberPriceConst.d.ts +10 -0
- package/dist/cjs/components/credits/context/memberPriceConst.js +2 -0
- package/dist/cjs/components/credits/context/memberPriceConst.js.map +7 -0
- package/dist/cjs/components/credits/context/memberPriceTypes.d.ts +46 -0
- package/dist/cjs/components/credits/context/memberPriceTypes.js +2 -0
- package/dist/cjs/components/credits/context/memberPriceTypes.js.map +7 -0
- package/dist/cjs/components/credits/context/provider.d.ts +4 -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/utils/atobID.d.ts +1 -0
- package/dist/cjs/components/credits/context/utils/atobID.js +2 -0
- package/dist/cjs/components/credits/context/utils/atobID.js.map +7 -0
- package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.d.ts +5 -0
- package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js +2 -0
- package/dist/cjs/components/credits/context/utils/functionDiscountCalculate.js.map +7 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.d.ts +8 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js +2 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPrice.js.map +7 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +9 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +2 -0
- package/dist/cjs/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +7 -0
- package/dist/cjs/components/credits/context/utils/variantGetCoupon.d.ts +6 -0
- package/dist/cjs/components/credits/context/utils/variantGetCoupon.js +2 -0
- package/dist/cjs/components/credits/context/utils/variantGetCoupon.js.map +7 -0
- package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.d.ts +4 -0
- package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +2 -0
- package/dist/cjs/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +7 -0
- package/dist/cjs/components/credits/creditsAnkersolixTask/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsAnkersolixTask/index.js +2 -0
- package/dist/cjs/components/credits/creditsAnkersolixTask/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsAnkersolixTask/type.d.ts +1 -0
- package/dist/cjs/components/credits/creditsAnkersolixTask/type.js +2 -0
- package/dist/cjs/components/credits/creditsAnkersolixTask/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsBanner/index.d.ts +2 -1
- package/dist/cjs/components/credits/creditsBanner/index.js +1 -1
- package/dist/cjs/components/credits/creditsBanner/index.js.map +3 -3
- package/dist/{esm/components/credits/creditsBenefits/benefitItem.d.ts → cjs/components/credits/creditsBenefits/BenefitItem.d.ts} +4 -1
- package/dist/cjs/components/credits/creditsBenefits/BenefitItem.js +2 -0
- package/dist/cjs/components/credits/creditsBenefits/BenefitItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsBenefits/{iconInfo.js → IconInfo.js} +1 -1
- package/dist/cjs/components/credits/creditsBenefits/{iconInfo.js.map → IconInfo.js.map} +2 -2
- package/dist/cjs/components/credits/creditsBenefits/index.d.ts +6 -2
- package/dist/cjs/components/credits/creditsBenefits/index.js +3 -3
- package/dist/cjs/components/credits/creditsBenefits/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsCash/CreditsCash.d.ts +2 -1
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/cjs/components/credits/creditsCash/CreditsCash.js.map +3 -3
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.js +1 -1
- package/dist/cjs/components/credits/creditsCash/RedeemableItem.js.map +2 -2
- package/dist/cjs/components/credits/creditsFaq/index.d.ts +2 -1
- package/dist/cjs/components/credits/creditsFaq/index.js +1 -1
- package/dist/cjs/components/credits/creditsFaq/index.js.map +3 -3
- package/dist/cjs/components/credits/creditsInfoCard/index.d.ts +2 -1
- 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.d.ts +5 -0
- package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js +2 -0
- package/dist/cjs/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +7 -0
- package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.d.ts +7 -0
- package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.js +2 -0
- package/dist/cjs/components/credits/creditsMemberPrice/MemberPriceItem.js.map +7 -0
- package/dist/cjs/components/credits/creditsMemberPrice/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsMemberPrice/index.js +2 -0
- package/dist/cjs/components/credits/creditsMemberPrice/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsMemberPrice/type.d.ts +64 -0
- package/dist/cjs/components/credits/creditsMemberPrice/type.js +2 -0
- package/dist/cjs/components/credits/creditsMemberPrice/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.d.ts +4 -0
- package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.js +2 -0
- package/dist/cjs/components/credits/creditsNavigation/CreditsNavigation.js.map +7 -0
- package/dist/cjs/components/credits/creditsNavigation/index.d.ts +2 -0
- package/dist/cjs/components/credits/creditsNavigation/index.js +2 -0
- package/dist/cjs/components/credits/creditsNavigation/index.js.map +7 -0
- package/dist/cjs/components/credits/creditsNavigation/type.d.ts +7 -0
- package/dist/cjs/components/credits/creditsNavigation/type.js +2 -0
- package/dist/cjs/components/credits/creditsNavigation/type.js.map +7 -0
- package/dist/cjs/components/credits/creditsRedeemList/CreditsRedeemList.d.ts +2 -1
- 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/RedeemProductModal/Error.js +1 -1
- package/dist/cjs/components/credits/creditsRedeemList/RedeemProductModal/Error.js.map +2 -2
- package/dist/cjs/components/credits/creditsRedeemList/type.d.ts +1 -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.d.ts +3 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/cjs/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
- package/dist/cjs/templates/{credits.d.ts → Credits.d.ts} +15 -1
- package/dist/cjs/templates/Credits.js +2 -0
- package/dist/cjs/templates/Credits.js.map +7 -0
- package/dist/cjs/templates/index.d.ts +1 -1
- package/dist/cjs/templates/index.js +1 -1
- package/dist/cjs/templates/index.js.map +1 -1
- package/dist/esm/components/credits/context/hooks/useActivities.js +1 -1
- package/dist/esm/components/credits/context/hooks/useActivities.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useAlpcFetch.js +1 -1
- package/dist/esm/components/credits/context/hooks/useAlpcFetch.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.d.ts +7 -0
- package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js +2 -0
- package/dist/esm/components/credits/context/hooks/useFunctionMemberPrice.js.map +7 -0
- package/dist/esm/components/credits/context/hooks/useMyRewards.js +1 -1
- package/dist/esm/components/credits/context/hooks/useMyRewards.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemCoupon.js.map +3 -3
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js +1 -1
- package/dist/esm/components/credits/context/hooks/useRedeemProduct.js.map +3 -3
- 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/memberPriceConst.d.ts +10 -0
- package/dist/esm/components/credits/context/memberPriceConst.js +2 -0
- package/dist/esm/components/credits/context/memberPriceConst.js.map +7 -0
- package/dist/esm/components/credits/context/memberPriceTypes.d.ts +46 -0
- package/dist/esm/components/credits/context/memberPriceTypes.js +1 -0
- package/dist/esm/components/credits/context/memberPriceTypes.js.map +7 -0
- package/dist/esm/components/credits/context/provider.d.ts +4 -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/utils/atobID.d.ts +1 -0
- package/dist/esm/components/credits/context/utils/atobID.js +2 -0
- package/dist/esm/components/credits/context/utils/atobID.js.map +7 -0
- package/dist/esm/components/credits/context/utils/functionDiscountCalculate.d.ts +5 -0
- package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js +2 -0
- package/dist/esm/components/credits/context/utils/functionDiscountCalculate.js.map +7 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.d.ts +8 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js +2 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPrice.js.map +7 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.d.ts +9 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js +2 -0
- package/dist/esm/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.js.map +7 -0
- package/dist/esm/components/credits/context/utils/variantGetCoupon.d.ts +6 -0
- package/dist/esm/components/credits/context/utils/variantGetCoupon.js +2 -0
- package/dist/esm/components/credits/context/utils/variantGetCoupon.js.map +7 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.d.ts +4 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js +2 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.js.map +7 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/index.js +2 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/index.js.map +7 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/type.d.ts +1 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/type.js +2 -0
- package/dist/esm/components/credits/creditsAnkersolixTask/type.js.map +7 -0
- package/dist/esm/components/credits/creditsBanner/index.d.ts +2 -1
- package/dist/esm/components/credits/creditsBanner/index.js +1 -1
- package/dist/esm/components/credits/creditsBanner/index.js.map +3 -3
- package/dist/{cjs/components/credits/creditsBenefits/benefitItem.d.ts → esm/components/credits/creditsBenefits/BenefitItem.d.ts} +4 -1
- package/dist/esm/components/credits/creditsBenefits/BenefitItem.js +2 -0
- package/dist/esm/components/credits/creditsBenefits/BenefitItem.js.map +7 -0
- package/dist/esm/components/credits/creditsBenefits/{iconInfo.js → IconInfo.js} +1 -1
- package/dist/esm/components/credits/creditsBenefits/{iconInfo.js.map → IconInfo.js.map} +2 -2
- package/dist/esm/components/credits/creditsBenefits/index.d.ts +6 -2
- package/dist/esm/components/credits/creditsBenefits/index.js +3 -3
- package/dist/esm/components/credits/creditsBenefits/index.js.map +3 -3
- package/dist/esm/components/credits/creditsCash/CreditsCash.d.ts +2 -1
- package/dist/esm/components/credits/creditsCash/CreditsCash.js +1 -1
- package/dist/esm/components/credits/creditsCash/CreditsCash.js.map +3 -3
- package/dist/esm/components/credits/creditsCash/RedeemableItem.js +1 -1
- package/dist/esm/components/credits/creditsCash/RedeemableItem.js.map +2 -2
- package/dist/esm/components/credits/creditsFaq/index.d.ts +2 -1
- package/dist/esm/components/credits/creditsFaq/index.js +1 -1
- package/dist/esm/components/credits/creditsFaq/index.js.map +3 -3
- package/dist/esm/components/credits/creditsInfoCard/index.d.ts +2 -1
- 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.d.ts +5 -0
- package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js +2 -0
- package/dist/esm/components/credits/creditsMemberPrice/CreditsMemberPrice.js.map +7 -0
- package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.d.ts +7 -0
- package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.js +2 -0
- package/dist/esm/components/credits/creditsMemberPrice/MemberPriceItem.js.map +7 -0
- package/dist/esm/components/credits/creditsMemberPrice/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsMemberPrice/index.js +2 -0
- package/dist/esm/components/credits/creditsMemberPrice/index.js.map +7 -0
- package/dist/esm/components/credits/creditsMemberPrice/type.d.ts +64 -0
- package/dist/esm/components/credits/creditsMemberPrice/type.js +1 -0
- package/dist/esm/components/credits/creditsMemberPrice/type.js.map +7 -0
- package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.d.ts +4 -0
- package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.js +2 -0
- package/dist/esm/components/credits/creditsNavigation/CreditsNavigation.js.map +7 -0
- package/dist/esm/components/credits/creditsNavigation/index.d.ts +2 -0
- package/dist/esm/components/credits/creditsNavigation/index.js +2 -0
- package/dist/esm/components/credits/creditsNavigation/index.js.map +7 -0
- package/dist/esm/components/credits/creditsNavigation/type.d.ts +7 -0
- package/dist/esm/components/credits/creditsNavigation/type.js +1 -0
- package/dist/esm/components/credits/creditsNavigation/type.js.map +7 -0
- package/dist/esm/components/credits/creditsRedeemList/CreditsRedeemList.d.ts +2 -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/RedeemProductModal/Error.js +1 -1
- package/dist/esm/components/credits/creditsRedeemList/RedeemProductModal/Error.js.map +2 -2
- package/dist/esm/components/credits/creditsRedeemList/type.d.ts +1 -0
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.d.ts +3 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js +1 -1
- package/dist/esm/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.js.map +3 -3
- package/dist/esm/templates/{credits.d.ts → Credits.d.ts} +15 -1
- package/dist/esm/templates/Credits.js +2 -0
- package/dist/esm/templates/Credits.js.map +7 -0
- package/dist/esm/templates/index.d.ts +1 -1
- package/dist/esm/templates/index.js +1 -1
- package/dist/esm/templates/index.js.map +1 -1
- package/package.json +4 -3
- package/src/components/credits/context/hooks/useActivities.ts +3 -2
- package/src/components/credits/context/hooks/useAlpcFetch.ts +8 -4
- package/src/components/credits/context/hooks/useFunctionMemberPrice.ts +33 -0
- package/src/components/credits/context/hooks/useMyRewards.ts +3 -2
- package/src/components/credits/context/hooks/useRedeemCoupon.ts +4 -1
- package/src/components/credits/context/hooks/useRedeemProduct.ts +4 -1
- package/src/components/credits/context/hooks/useRedeemableList.ts +3 -3
- package/src/components/credits/context/memberPriceConst.ts +13 -0
- package/src/components/credits/context/memberPriceTypes.ts +54 -0
- package/src/components/credits/context/provider.tsx +9 -0
- package/src/components/credits/context/utils/atobID.ts +8 -0
- package/src/components/credits/context/utils/functionDiscountCalculate.ts +57 -0
- package/src/components/credits/context/utils/getFunctionMemberPrice.ts +135 -0
- package/src/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.ts +51 -0
- package/src/components/credits/context/utils/variantGetCoupon.ts +34 -0
- package/src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx +270 -0
- package/src/components/credits/creditsAnkersolixTask/index.ts +2 -0
- package/src/components/credits/creditsAnkersolixTask/type.ts +7 -0
- package/src/components/credits/creditsBanner/index.tsx +2 -2
- package/src/components/credits/creditsBenefits/{benefitItem.tsx → BenefitItem.tsx} +28 -9
- package/src/components/credits/creditsBenefits/index.tsx +12 -3
- package/src/components/credits/creditsCash/CreditsCash.tsx +5 -3
- package/src/components/credits/creditsCash/RedeemableItem.tsx +19 -15
- package/src/components/credits/creditsFaq/index.tsx +2 -2
- package/src/components/credits/creditsInfoCard/index.tsx +2 -2
- package/src/components/credits/creditsMemberPrice/CreditsMemberPrice.tsx +389 -0
- package/src/components/credits/creditsMemberPrice/MemberPriceItem.tsx +158 -0
- package/src/components/credits/creditsMemberPrice/index.ts +2 -0
- package/src/components/credits/creditsMemberPrice/type.ts +75 -0
- package/src/components/credits/creditsNavigation/CreditsNavigation.tsx +123 -0
- package/src/components/credits/creditsNavigation/index.ts +2 -0
- package/src/components/credits/creditsNavigation/type.ts +10 -0
- package/src/components/credits/creditsRedeemList/CreditsRedeemList.tsx +17 -3
- package/src/components/credits/creditsRedeemList/RedeemProductModal/Error.tsx +1 -1
- package/src/components/credits/creditsRedeemList/type.ts +1 -0
- package/src/components/credits/creditsWaysToGetCredits/CreditsWaysToGetCredits.tsx +2 -2
- package/src/templates/{credits.tsx → Credits.tsx} +38 -7
- package/src/templates/index.ts +1 -1
- package/dist/cjs/components/credits/const.d.ts +0 -1
- package/dist/cjs/components/credits/const.js +0 -2
- package/dist/cjs/components/credits/const.js.map +0 -7
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js +0 -2
- package/dist/cjs/components/credits/creditsBenefits/benefitItem.js.map +0 -7
- package/dist/cjs/templates/credits.js +0 -2
- package/dist/cjs/templates/credits.js.map +0 -7
- package/dist/esm/components/credits/const.d.ts +0 -1
- package/dist/esm/components/credits/const.js +0 -2
- package/dist/esm/components/credits/const.js.map +0 -7
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js +0 -2
- package/dist/esm/components/credits/creditsBenefits/benefitItem.js.map +0 -7
- package/dist/esm/templates/credits.js +0 -2
- package/dist/esm/templates/credits.js.map +0 -7
- /package/dist/cjs/components/credits/creditsBenefits/{iconInfo.d.ts → IconInfo.d.ts} +0 -0
- /package/dist/esm/components/credits/creditsBenefits/{iconInfo.d.ts → IconInfo.d.ts} +0 -0
- /package/src/components/credits/creditsBenefits/{iconInfo.tsx → IconInfo.tsx} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useMyRewards.ts"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { isLoadingProfile, profile } = useCreditsContext()\n const { brand, locale, appName } = useHeadlessContext()\n const isLogin = !!profile\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const [currentPage, setCurrentPage] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n useEffect(() => {\n if (isLoadingProfile || !profile || isLoading) {\n return\n }\n\n if (page !== currentPage && page) {\n trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setCurrentPage(page)\n setTotal(responseData?.data?.total)\n setMyRewards(myRewards.concat(responseData?.data?.redeem_logs || []))\n },\n }\n )\n }\n }, [trigger, myRewards, consumeType, page, pageSize, currentPage, profile, isLoadingProfile, isLoading])\n\n const getMyRewards = useCallback(async () => {\n if (isLoadingProfile || !isLogin || !profile || isLoading) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n // \u4EC5\u652F\u63011\u9875\u7684\n onSuccess(responseData) {\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, isLoading, isLoadingProfile, page, pageSize, profile, trigger])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,oBAAAC,EAAkB,mBAAAC,MAAuB,WAClD,OAAS,mBAAAC,MAAuB,iBAEhC,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAE,iBAAAC,EAAkB,QAAAC,
|
|
6
|
-
"names": ["useCallback", "useEffect", "useState", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "useAlpcMutation", "useCreditsContext", "useHeadlessContext", "useMyRewards", "page", "pageSize", "consumeType", "isLoadingProfile", "profile", "
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { ALPC_COUNTRY_MAP, AlpcConsumeType } from '../const'\nimport { useAlpcMutation } from './useAlpcFetch'\nimport type { RedeemLogResponse } from '../response'\nimport { useCreditsContext } from '../provider'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useMyRewards({\n page,\n pageSize,\n consumeType,\n}: {\n page: number\n pageSize: number\n consumeType?: AlpcConsumeType\n}) {\n const { isLoadingProfile, profile, alpcBrand } = useCreditsContext()\n const { brand: headlessBrand, locale, appName } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n const isLogin = !!profile\n\n const [myRewards, setMyRewards] = useState<RedeemLogResponse[]>([])\n const [total, setTotal] = useState(0)\n\n const [currentPage, setCurrentPage] = useState(0)\n\n const { isMutating: isLoading, trigger } = useAlpcMutation<\n { data: { redeem_logs: RedeemLogResponse[]; total: number } },\n {\n page: number\n page_size: number\n consume_type: AlpcConsumeType\n user_id: string\n }\n >({\n url: `/v1/credit/log/coupon`,\n initData: {\n brand: brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n })\n\n useEffect(() => {\n if (isLoadingProfile || !profile || isLoading) {\n return\n }\n\n if (page !== currentPage && page) {\n trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n setCurrentPage(page)\n setTotal(responseData?.data?.total)\n setMyRewards(myRewards.concat(responseData?.data?.redeem_logs || []))\n },\n }\n )\n }\n }, [trigger, myRewards, consumeType, page, pageSize, currentPage, profile, isLoadingProfile, isLoading])\n\n const getMyRewards = useCallback(async () => {\n if (isLoadingProfile || !isLogin || !profile || isLoading) {\n return\n }\n await trigger(\n {\n consume_type: consumeType || AlpcConsumeType.Coupon,\n page,\n page_size: pageSize,\n user_id: profile?.user_id,\n },\n {\n // \u4EC5\u652F\u63011\u9875\u7684\n onSuccess(responseData) {\n setMyRewards(responseData?.data?.redeem_logs || [])\n },\n }\n )\n }, [consumeType, isLoading, isLoadingProfile, page, pageSize, profile, trigger])\n\n return {\n myRewards,\n isLoading,\n total,\n getMyRewards,\n canNext: total > myRewards.length && !isLoading,\n }\n}\n\nexport default useMyRewards\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,oBAAAC,EAAkB,mBAAAC,MAAuB,WAClD,OAAS,mBAAAC,MAAuB,iBAEhC,OAAS,qBAAAC,MAAyB,cAClC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,EAAa,CACpB,KAAAC,EACA,SAAAC,EACA,YAAAC,CACF,EAIG,CACD,KAAM,CAAE,iBAAAC,EAAkB,QAAAC,EAAS,UAAAC,CAAU,EAAIR,EAAkB,EAC7D,CAAE,MAAOS,EAAe,OAAAC,EAAQ,QAAAC,CAAQ,EAAIV,EAAmB,EAC/DW,EAAQJ,GAAaC,EACrBI,EAAU,CAAC,CAACN,EAEZ,CAACO,EAAWC,CAAY,EAAInB,EAA8B,CAAC,CAAC,EAC5D,CAACoB,EAAOC,CAAQ,EAAIrB,EAAS,CAAC,EAE9B,CAACsB,EAAaC,CAAc,EAAIvB,EAAS,CAAC,EAE1C,CAAE,WAAYwB,EAAW,QAAAC,CAAQ,EAAItB,EAQzC,CACA,IAAK,wBACL,SAAU,CACR,MAAOa,EACP,QAASf,EAAiB,IAAIa,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,CAAC,EAEDhB,EAAU,IAAM,CACVW,GAAoB,CAACC,GAAWa,GAIhCjB,IAASe,GAAef,GAC1BkB,EACE,CACE,aAAchB,GAAeP,EAAgB,OAC7C,KAAAK,EACA,UAAWC,EACX,QAASG,GAAS,OACpB,EACA,CACE,UAAUe,EAAc,CACtBH,EAAehB,CAAI,EACnBc,EAASK,GAAc,MAAM,KAAK,EAClCP,EAAaD,EAAU,OAAOQ,GAAc,MAAM,aAAe,CAAC,CAAC,CAAC,CACtE,CACF,CACF,CAEJ,EAAG,CAACD,EAASP,EAAWT,EAAaF,EAAMC,EAAUc,EAAaX,EAASD,EAAkBc,CAAS,CAAC,EAEvG,MAAMG,EAAe7B,EAAY,SAAY,CACvCY,GAAoB,CAACO,GAAW,CAACN,GAAWa,GAGhD,MAAMC,EACJ,CACE,aAAchB,GAAeP,EAAgB,OAC7C,KAAAK,EACA,UAAWC,EACX,QAASG,GAAS,OACpB,EACA,CAEE,UAAUe,EAAc,CACtBP,EAAaO,GAAc,MAAM,aAAe,CAAC,CAAC,CACpD,CACF,CACF,CACF,EAAG,CAACjB,EAAae,EAAWd,EAAkBH,EAAMC,EAAUG,EAASc,CAAO,CAAC,EAE/E,MAAO,CACL,UAAAP,EACA,UAAAM,EACA,MAAAJ,EACA,aAAAO,EACA,QAASP,EAAQF,EAAU,QAAU,CAACM,CACxC,CACF,CAEA,IAAOI,EAAQtB",
|
|
6
|
+
"names": ["useCallback", "useEffect", "useState", "ALPC_COUNTRY_MAP", "AlpcConsumeType", "useAlpcMutation", "useCreditsContext", "useHeadlessContext", "useMyRewards", "page", "pageSize", "consumeType", "isLoadingProfile", "profile", "alpcBrand", "headlessBrand", "locale", "appName", "brand", "isLogin", "myRewards", "setMyRewards", "total", "setTotal", "currentPage", "setCurrentPage", "isLoading", "trigger", "responseData", "getMyRewards", "useMyRewards_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ALPC_COUNTRY_MAP as
|
|
1
|
+
import{ALPC_COUNTRY_MAP as r}from"../const";import{useAlpcMutation as p}from"./useAlpcFetch";import{useHeadlessContext as a}from"@anker-in/lib";import{useCreditsContext as u}from"../provider";const l=(o={})=>{const{alpcBrand:n}=u(),{locale:e,appName:t,brand:s}=a();return p({url:"/v1/credit/redeem/coupon",initData:{brand:n||s,country:r.get(e)||e,app_name:t}},o)};export{l as useRedeemCoupon};
|
|
2
2
|
//# sourceMappingURL=useRedeemCoupon.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemCoupon.ts"],
|
|
4
|
-
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\n\ntype RedeemCouponResponse = {\n data: {\n success: boolean\n coupon_code: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemCoupon = (mutationOptions: UseMutationConfig<RedeemCouponResponse> = {}) => {\n const { locale, appName, brand } = useHeadlessContext()\n\n return useAlpcMutation<\n RedeemCouponResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/coupon`,\n initData: {\n brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,
|
|
6
|
-
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useRedeemCoupon", "mutationOptions", "locale", "appName", "
|
|
4
|
+
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemCouponResponse = {\n data: {\n success: boolean\n coupon_code: string\n }\n msg: string // \u62A5\u9519\u4FE1\u606F\n code: number // \u62A5\u9519\u7801\n}\n\nexport const useRedeemCoupon = (mutationOptions: UseMutationConfig<RedeemCouponResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemCouponResponse,\n {\n user_id?: string\n rule_id: number\n }\n >(\n {\n url: `/v1/credit/redeem/coupon`,\n initData: {\n brand,\n country: ALPC_COUNTRY_MAP.get(locale) || locale,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,cAW3B,MAAMC,EAAkB,CAACC,EAA2D,CAAC,IAAM,CAChG,KAAM,CAAE,UAAAC,CAAU,EAAIH,EAAkB,EAClC,CAAE,OAAAI,EAAQ,QAAAC,EAAS,MAAOC,CAAc,EAAIP,EAAmB,EAGrE,OAAOD,EAOL,CACE,IAAK,2BACL,SAAU,CACR,MAZQK,GAAaG,EAarB,QAAST,EAAiB,IAAIO,CAAM,GAAKA,EACzC,SAAUC,CACZ,CACF,EACAH,CACF,CACF",
|
|
6
|
+
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useCreditsContext", "useRedeemCoupon", "mutationOptions", "alpcBrand", "locale", "appName", "headlessBrand"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ALPC_COUNTRY_MAP as
|
|
1
|
+
import{ALPC_COUNTRY_MAP as a}from"../const";import{useAlpcMutation as d}from"./useAlpcFetch";import{useHeadlessContext as u}from"@anker-in/lib";import{useCreditsContext as i}from"../provider";const R=(o={})=>{const{alpcBrand:t}=i(),{storeDomain:n,locale:e,appName:r,brand:s}=u();return d({url:"/v1/credit/exchange/goods",initData:{quantity:1,brand:t||s,country:(a.get(e||"")||e)?.toUpperCase(),domain:n,app_name:r}},o)};export{R as useRedeemProduct};
|
|
2
2
|
//# sourceMappingURL=useRedeemProduct.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemProduct.ts"],
|
|
4
|
-
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\n\ntype RedeemProductResponse = {\n code: number\n data: {\n success: boolean\n }\n}\n\nexport const useRedeemProduct = (mutationOptions: UseMutationConfig<RedeemProductResponse> = {}) => {\n const { storeDomain, locale, appName, brand } = useHeadlessContext()\n\n return useAlpcMutation<\n RedeemProductResponse,\n {\n rule_id: number\n address: string\n }\n >(\n {\n url: `/v1/credit/exchange/goods`,\n initData: {\n quantity: 1,\n brand,\n country: (ALPC_COUNTRY_MAP.get(locale || '') || locale)?.toUpperCase(),\n domain: storeDomain,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,
|
|
6
|
-
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useRedeemProduct", "mutationOptions", "storeDomain", "locale", "appName", "
|
|
4
|
+
"sourcesContent": ["import { ALPC_COUNTRY_MAP } from '../const'\nimport { useAlpcMutation, type UseMutationConfig } from './useAlpcFetch'\nimport { useHeadlessContext } from '@anker-in/lib'\nimport { useCreditsContext } from '../provider'\n\ntype RedeemProductResponse = {\n code: number\n data: {\n success: boolean\n }\n}\n\nexport const useRedeemProduct = (mutationOptions: UseMutationConfig<RedeemProductResponse> = {}) => {\n const { alpcBrand } = useCreditsContext()\n const { storeDomain, locale, appName, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n return useAlpcMutation<\n RedeemProductResponse,\n {\n rule_id: number\n address: string\n }\n >(\n {\n url: `/v1/credit/exchange/goods`,\n initData: {\n quantity: 1,\n brand,\n country: (ALPC_COUNTRY_MAP.get(locale || '') || locale)?.toUpperCase(),\n domain: storeDomain,\n app_name: appName,\n },\n },\n mutationOptions\n )\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,oBAAAA,MAAwB,WACjC,OAAS,mBAAAC,MAA+C,iBACxD,OAAS,sBAAAC,MAA0B,gBACnC,OAAS,qBAAAC,MAAyB,cAS3B,MAAMC,EAAmB,CAACC,EAA4D,CAAC,IAAM,CAClG,KAAM,CAAE,UAAAC,CAAU,EAAIH,EAAkB,EAClC,CAAE,YAAAI,EAAa,OAAAC,EAAQ,QAAAC,EAAS,MAAOC,CAAc,EAAIR,EAAmB,EAGlF,OAAOD,EAOL,CACE,IAAK,4BACL,SAAU,CACR,SAAU,EACV,MAbQK,GAAaI,EAcrB,SAAUV,EAAiB,IAAIQ,GAAU,EAAE,GAAKA,IAAS,YAAY,EACrE,OAAQD,EACR,SAAUE,CACZ,CACF,EACAJ,CACF,CACF",
|
|
6
|
+
"names": ["ALPC_COUNTRY_MAP", "useAlpcMutation", "useHeadlessContext", "useCreditsContext", "useRedeemProduct", "mutationOptions", "alpcBrand", "storeDomain", "locale", "appName", "headlessBrand"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useCallback as
|
|
1
|
+
import{useCallback as R,useEffect as b,useState as x}from"react";import{useAlpcMutation as y}from"./useAlpcFetch";import{ALPC_COUNTRY_MAP as S}from"../const";import{useCreditsContext as A}from"../provider";import{useHeadlessContext as M}from"@anker-in/lib";function P(){let t="";const{profile:n,isLoadingProfile:c,alpcBrand:m}=A(),{locale:u,brand:p}=M(),_=m||p;u==="pl"?t="eu":t=u;const[f,g]=x([]),{isMutating:C,trigger:l}=y({url:"/v1/credit/consume_credit_rules",initData:{brand:_,page:1,page_size:20,country:(S.get(t)||t)?.toUpperCase()}}),s=R(()=>{l({user_id:n?.user_id},{onSuccess(L){let a=L.data.consume_credit_rules||[],r=a.filter(e=>e.consume_type==1)||[],o=a.filter(e=>e.consume_type==2)||[];r=r.sort((e,i)=>e.consume_credits-i.consume_credits),o=o.sort((e,i)=>e.consume_credits-i.consume_credits);const d=r.concat(o);g(d),localStorage?.setItem(`consume_credit_rules-${t}`,JSON.stringify({expire:Date.now()+10*60*1e3,consume_credit_rules:d}))}})},[n,l,t]);return b(()=>{c||s()},[s,c]),{listLoading:C,redeemableList:f,getRedeemableList:s}}var h=P;export{h as default};
|
|
2
2
|
//# sourceMappingURL=useRedeemableList.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/credits/context/hooks/useRedeemableList.ts"],
|
|
4
|
-
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList() {\n let locale = '' as string\n const { profile, isLoadingProfile } = useCreditsContext()\n const { locale: contextLocale, brand } = useHeadlessContext()\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { user_id?: string }\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 20,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n
|
|
5
|
-
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,oBAAAC,MAAwB,WACjC,OAAS,qBAAAC,MAAyB,cAElC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,GAAoB,CAC3B,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,
|
|
6
|
-
"names": ["useCallback", "useEffect", "useState", "useAlpcMutation", "ALPC_COUNTRY_MAP", "useCreditsContext", "useHeadlessContext", "useRedeemableList", "locale", "profile", "isLoadingProfile", "contextLocale", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list", "cList", "i", "pList", "prev", "next", "resultList", "useRedeemableList_default"]
|
|
4
|
+
"sourcesContent": ["import { useCallback, useEffect, useState } from 'react'\n\nimport { useAlpcMutation } from './useAlpcFetch'\nimport { ALPC_COUNTRY_MAP } from '../const'\nimport { useCreditsContext } from '../provider'\nimport type { ConsumeCreditRuleResponse } from '../response'\nimport { useHeadlessContext } from '@anker-in/lib'\n\nfunction useRedeemableList() {\n let locale = '' as string\n const { profile, isLoadingProfile, alpcBrand } = useCreditsContext()\n const { locale: contextLocale, brand: headlessBrand } = useHeadlessContext()\n const brand = alpcBrand || headlessBrand\n\n if (contextLocale === 'pl') {\n locale = 'eu'\n } else {\n locale = contextLocale\n }\n\n const [redeemableList, setRedeemableList] = useState<ConsumeCreditRuleResponse[]>([])\n const { isMutating: listLoading, trigger } = useAlpcMutation<\n {\n data: { consume_credit_rules: ConsumeCreditRuleResponse[] }\n },\n { user_id?: string }\n >({\n url: `/v1/credit/consume_credit_rules`,\n initData: {\n brand,\n page: 1,\n page_size: 20,\n country: (ALPC_COUNTRY_MAP.get(locale) || locale)?.toUpperCase(),\n },\n })\n\n const getRedeemableList = useCallback(() => {\n trigger(\n {\n user_id: profile?.user_id,\n },\n {\n onSuccess(responseData) {\n let list = responseData.data.consume_credit_rules || []\n let cList = list.filter(i => i.consume_type == 1) || []\n let pList = list.filter(i => i.consume_type == 2) || []\n cList = cList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n pList = pList.sort((prev, next) => prev.consume_credits - next.consume_credits)\n const resultList = cList.concat(pList)\n setRedeemableList(resultList)\n\n localStorage?.setItem(\n `consume_credit_rules-${locale}`,\n JSON.stringify({\n expire: Date.now() + 10 * 60 * 1000,\n consume_credit_rules: resultList,\n })\n )\n },\n }\n )\n }, [profile, trigger, locale])\n\n useEffect(() => {\n if (!isLoadingProfile) {\n getRedeemableList()\n }\n }, [getRedeemableList, isLoadingProfile])\n\n return {\n listLoading,\n redeemableList,\n getRedeemableList,\n }\n}\n\nexport default useRedeemableList\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,YAAAC,MAAgB,QAEjD,OAAS,mBAAAC,MAAuB,iBAChC,OAAS,oBAAAC,MAAwB,WACjC,OAAS,qBAAAC,MAAyB,cAElC,OAAS,sBAAAC,MAA0B,gBAEnC,SAASC,GAAoB,CAC3B,IAAIC,EAAS,GACb,KAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,UAAAC,CAAU,EAAIN,EAAkB,EAC7D,CAAE,OAAQO,EAAe,MAAOC,CAAc,EAAIP,EAAmB,EACrEQ,EAAQH,GAAaE,EAEvBD,IAAkB,KACpBJ,EAAS,KAETA,EAASI,EAGX,KAAM,CAACG,EAAgBC,CAAiB,EAAId,EAAsC,CAAC,CAAC,EAC9E,CAAE,WAAYe,EAAa,QAAAC,CAAQ,EAAIf,EAK3C,CACA,IAAK,kCACL,SAAU,CACR,MAAAW,EACA,KAAM,EACN,UAAW,GACX,SAAUV,EAAiB,IAAII,CAAM,GAAKA,IAAS,YAAY,CACjE,CACF,CAAC,EAEKW,EAAoBnB,EAAY,IAAM,CAC1CkB,EACE,CACE,QAAST,GAAS,OACpB,EACA,CACE,UAAUW,EAAc,CACtB,IAAIC,EAAOD,EAAa,KAAK,sBAAwB,CAAC,EAClDE,EAAQD,EAAK,OAAOE,GAAKA,EAAE,cAAgB,CAAC,GAAK,CAAC,EAClDC,EAAQH,EAAK,OAAOE,GAAKA,EAAE,cAAgB,CAAC,GAAK,CAAC,EACtDD,EAAQA,EAAM,KAAK,CAACG,EAAMC,IAASD,EAAK,gBAAkBC,EAAK,eAAe,EAC9EF,EAAQA,EAAM,KAAK,CAACC,EAAMC,IAASD,EAAK,gBAAkBC,EAAK,eAAe,EAC9E,MAAMC,EAAaL,EAAM,OAAOE,CAAK,EACrCR,EAAkBW,CAAU,EAE5B,cAAc,QACZ,wBAAwBnB,CAAM,GAC9B,KAAK,UAAU,CACb,OAAQ,KAAK,IAAI,EAAI,GAAK,GAAK,IAC/B,qBAAsBmB,CACxB,CAAC,CACH,CACF,CACF,CACF,CACF,EAAG,CAAClB,EAASS,EAASV,CAAM,CAAC,EAE7B,OAAAP,EAAU,IAAM,CACTS,GACHS,EAAkB,CAEtB,EAAG,CAACA,EAAmBT,CAAgB,CAAC,EAEjC,CACL,YAAAO,EACA,eAAAF,EACA,kBAAAI,CACF,CACF,CAEA,IAAOS,EAAQrB",
|
|
6
|
+
"names": ["useCallback", "useEffect", "useState", "useAlpcMutation", "ALPC_COUNTRY_MAP", "useCreditsContext", "useHeadlessContext", "useRedeemableList", "locale", "profile", "isLoadingProfile", "alpcBrand", "contextLocale", "headlessBrand", "brand", "redeemableList", "setRedeemableList", "listLoading", "trigger", "getRedeemableList", "responseData", "list", "cList", "i", "pList", "prev", "next", "resultList", "useRedeemableList_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var x=(r=>(r[r.Percentage=1]="Percentage",r[r.FixedAmount=2]="FixedAmount",r[r.FixedPrice=3]="FixedPrice",r))(x||{}),a=(r=>(r.RoundHighest="round_highest",r.RoundLowest="round_lowest",r.RoundNearest="round_nearest",r))(a||{});export{x as FunctionDiscountType,a as RoundSelected};
|
|
2
|
+
//# sourceMappingURL=memberPriceConst.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/context/memberPriceConst.ts"],
|
|
4
|
+
"sourcesContent": ["// Function \u6298\u6263\u7C7B\u578B\nexport enum FunctionDiscountType {\n Percentage = 1,\n FixedAmount,\n FixedPrice,\n}\n\n// \u5C0F\u6570\u4F4D\u53D6\u820D\u65B9\u5F0F\nexport enum RoundSelected {\n RoundHighest = 'round_highest',\n RoundLowest = 'round_lowest',\n RoundNearest = 'round_nearest',\n}\n"],
|
|
5
|
+
"mappings": "AACO,IAAKA,OACVA,IAAA,WAAa,GAAb,aACAA,IAAA,6BACAA,IAAA,2BAHUA,OAAA,IAOAC,OACVA,EAAA,aAAe,gBACfA,EAAA,YAAc,eACdA,EAAA,aAAe,gBAHLA,OAAA",
|
|
6
|
+
"names": ["FunctionDiscountType", "RoundSelected"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { FunctionDiscountType, RoundSelected } from './memberPriceConst';
|
|
2
|
+
export type PriceEndingConf = {
|
|
3
|
+
apply_price_ending: boolean;
|
|
4
|
+
one_decimal_place: string;
|
|
5
|
+
two_decimal_place: string;
|
|
6
|
+
round_selected: RoundSelected;
|
|
7
|
+
};
|
|
8
|
+
export type DiscountConfig = {
|
|
9
|
+
discount_type: FunctionDiscountType;
|
|
10
|
+
discount_value: number;
|
|
11
|
+
price_ending_conf?: PriceEndingConf;
|
|
12
|
+
};
|
|
13
|
+
export type FunctionMemberPriceConfig = {
|
|
14
|
+
rule_id: string;
|
|
15
|
+
result_detail: {
|
|
16
|
+
member_discounts?: {
|
|
17
|
+
user_identity: number;
|
|
18
|
+
main_products: {
|
|
19
|
+
all_store_variant: boolean;
|
|
20
|
+
variants: {
|
|
21
|
+
variant_id: string;
|
|
22
|
+
sku: string;
|
|
23
|
+
handle: string;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
discount_conf: DiscountConfig;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
discount_combinations: {
|
|
30
|
+
other_product_discounts: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type FunctionMemberPriceResult = {
|
|
34
|
+
hasMemberPrice: boolean;
|
|
35
|
+
useCoupon: boolean;
|
|
36
|
+
originalPrice: number;
|
|
37
|
+
originalPriceWithCurrency: string;
|
|
38
|
+
salePrice: number;
|
|
39
|
+
salePriceWithCurrency: string;
|
|
40
|
+
salePriceWithoutCoupon: number;
|
|
41
|
+
salePriceWithoutCouponWithCurrency: string;
|
|
42
|
+
savePrice: number;
|
|
43
|
+
savePriceWithCurrency: string;
|
|
44
|
+
savePriceWithoutCoupon: number;
|
|
45
|
+
savePriceWithoutCouponWithCurrency: string;
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=memberPriceTypes.js.map
|
|
@@ -2,6 +2,7 @@ import { PropsWithChildren } from 'react';
|
|
|
2
2
|
import type { DTC_TASK_TYPE } from './const';
|
|
3
3
|
import type { CreditInfoResponse } from './response';
|
|
4
4
|
import { CreditsPageCommon } from '../type';
|
|
5
|
+
import { FunctionMemberPriceConfig } from './memberPriceTypes';
|
|
5
6
|
type Context = {
|
|
6
7
|
profile: any;
|
|
7
8
|
isLoadingProfile: boolean;
|
|
@@ -17,8 +18,10 @@ type Context = {
|
|
|
17
18
|
pageGroup: string;
|
|
18
19
|
};
|
|
19
20
|
pageCommon: CreditsPageCommon;
|
|
21
|
+
memberPriceDiscount?: FunctionMemberPriceConfig[];
|
|
22
|
+
alpcBrand?: string;
|
|
20
23
|
};
|
|
21
24
|
export declare const CreditsContext: import("react").Context<Context>;
|
|
22
|
-
export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, }: PropsWithChildren<Context>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function CreditsProvider({ children, profile, removeProfile, isLoadingProfile, openSignInPopup, openSignUpPopup, taskIdToTypeMapping, creditInfo, customer, customerLoading, fetchCreditInfo, gtm, pageCommon, memberPriceDiscount, alpcBrand, }: PropsWithChildren<Context>): import("react/jsx-runtime").JSX.Element;
|
|
23
26
|
export declare function useCreditsContext(): Context;
|
|
24
27
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as x}from"react/jsx-runtime";import{createContext as P,useContext as l}from"react";const o=P({profile:null,isLoadingProfile:!1,taskIdToTypeMapping:{},removeProfile:()=>{},openSignInPopup:()=>{},openSignUpPopup:()=>{},creditInfo:void 0,customerLoading:!1,fetchCreditInfo:e=>{},gtm:{pageGroup:""},pageCommon:{},memberPriceDiscount:void 0,alpcBrand:void 0});function S({children:e,profile:r,removeProfile:n,isLoadingProfile:t,openSignInPopup:i,openSignUpPopup:p,taskIdToTypeMapping:d,creditInfo:s,customer:m,customerLoading:C,fetchCreditInfo:f,gtm:u,pageCommon:a,memberPriceDiscount:g,alpcBrand:c}){return x(o.Provider,{value:{profile:r,isLoadingProfile:t,removeProfile:n,openSignInPopup:i,openSignUpPopup:p,taskIdToTypeMapping:d,creditInfo:s,fetchCreditInfo:f,customer:m,customerLoading:C,gtm:u,pageCommon:a,memberPriceDiscount:g,alpcBrand:c},children:e})}function _(){const e=l(o);if(!e)throw new Error("useCreditsContext must be used within a CreditsProvider");return e}export{o as CreditsContext,S as CreditsProvider,_ as useCreditsContext};
|
|
2
2
|
//# sourceMappingURL=provider.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/credits/context/provider.tsx"],
|
|
4
|
-
"sourcesContent": ["import { createContext, PropsWithChildren, useContext } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n }\n pageCommon: CreditsPageCommon\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n },\n pageCommon: {},\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n}: PropsWithChildren<Context>) {\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "createContext", "useContext", "CreditsContext", "user_id", "CreditsProvider", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "useCreditsContext", "context"]
|
|
4
|
+
"sourcesContent": ["import { createContext, PropsWithChildren, useContext } from 'react'\nimport type { DTC_TASK_TYPE } from './const'\nimport type { CreditInfoResponse } from './response'\nimport { CreditsPageCommon } from '../type'\nimport { FunctionMemberPriceConfig } from './memberPriceTypes'\n\ntype Context = {\n profile: any\n isLoadingProfile: boolean\n removeProfile: () => void\n taskIdToTypeMapping: Record<string, DTC_TASK_TYPE>\n openSignInPopup: () => void\n openSignUpPopup: () => void\n creditInfo?: CreditInfoResponse\n customer?: any\n customerLoading: boolean\n fetchCreditInfo: (user_id: string) => void\n gtm: {\n pageGroup: string\n }\n pageCommon: CreditsPageCommon\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n alpcBrand?: string\n}\n\nexport const CreditsContext = createContext<Context>({\n profile: null,\n isLoadingProfile: false,\n taskIdToTypeMapping: {},\n removeProfile: () => {},\n openSignInPopup: () => {},\n openSignUpPopup: () => {},\n creditInfo: undefined,\n customerLoading: false,\n fetchCreditInfo: (user_id: string) => {},\n gtm: {\n pageGroup: '',\n },\n pageCommon: {},\n memberPriceDiscount: undefined,\n alpcBrand: undefined,\n})\n\nexport function CreditsProvider({\n children,\n profile,\n removeProfile,\n isLoadingProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n customer,\n customerLoading,\n fetchCreditInfo,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n}: PropsWithChildren<Context>) {\n return (\n <CreditsContext.Provider\n value={{\n profile,\n isLoadingProfile,\n removeProfile,\n openSignInPopup,\n openSignUpPopup,\n taskIdToTypeMapping,\n creditInfo,\n fetchCreditInfo,\n customer,\n customerLoading,\n gtm,\n pageCommon,\n memberPriceDiscount,\n alpcBrand,\n }}\n >\n {children}\n </CreditsContext.Provider>\n )\n}\n\nexport function useCreditsContext() {\n const context = useContext(CreditsContext)\n if (!context) {\n throw new Error('useCreditsContext must be used within a CreditsProvider')\n }\n return context\n}\n"],
|
|
5
|
+
"mappings": "AA6DI,cAAAA,MAAA,oBA7DJ,OAAS,iBAAAC,EAAkC,cAAAC,MAAkB,QAyBtD,MAAMC,EAAiBF,EAAuB,CACnD,QAAS,KACT,iBAAkB,GAClB,oBAAqB,CAAC,EACtB,cAAe,IAAM,CAAC,EACtB,gBAAiB,IAAM,CAAC,EACxB,gBAAiB,IAAM,CAAC,EACxB,WAAY,OACZ,gBAAiB,GACjB,gBAAkBG,GAAoB,CAAC,EACvC,IAAK,CACH,UAAW,EACb,EACA,WAAY,CAAC,EACb,oBAAqB,OACrB,UAAW,MACb,CAAC,EAEM,SAASC,EAAgB,CAC9B,SAAAC,EACA,QAAAC,EACA,cAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,SAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,IAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,CACF,EAA+B,CAC7B,OACEpB,EAACG,EAAe,SAAf,CACC,MAAO,CACL,QAAAI,EACA,iBAAAE,EACA,cAAAD,EACA,gBAAAE,EACA,gBAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,gBAAAG,EACA,SAAAF,EACA,gBAAAC,EACA,IAAAE,EACA,WAAAC,EACA,oBAAAC,EACA,UAAAC,CACF,EAEC,SAAAd,EACH,CAEJ,CAEO,SAASe,GAAoB,CAClC,MAAMC,EAAUpB,EAAWC,CAAc,EACzC,GAAI,CAACmB,EACH,MAAM,IAAI,MAAM,yDAAyD,EAE3E,OAAOA,CACT",
|
|
6
|
+
"names": ["jsx", "createContext", "useContext", "CreditsContext", "user_id", "CreditsProvider", "children", "profile", "removeProfile", "isLoadingProfile", "openSignInPopup", "openSignUpPopup", "taskIdToTypeMapping", "creditInfo", "customer", "customerLoading", "fetchCreditInfo", "gtm", "pageCommon", "memberPriceDiscount", "alpcBrand", "useCreditsContext", "context"]
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function atobID(id: string): string | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/context/utils/atobID.ts"],
|
|
4
|
+
"sourcesContent": ["// \u4ECE Shopify GraphQL ID \u4E2D\u63D0\u53D6\u6570\u5B57 ID\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\n"],
|
|
5
|
+
"mappings": "AACO,SAASA,EAAOC,EAAY,CACjC,OAAIA,GAAM,OAAOA,GAAO,UAAYA,EAAG,SAAS,GAAG,EAC1CA,EAAG,MAAM,GAAG,EAAE,IAAI,GAAG,MAAM,GAAG,GAAG,MAAM,EAEvCA,CAEX",
|
|
6
|
+
"names": ["atobID", "id"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{FunctionDiscountType as c,RoundSelected as i}from"../memberPriceConst";import n from"decimal.js";const b=({config:t,price:o})=>{const{apply_price_ending:r,one_decimal_place:a,two_decimal_place:u,round_selected:s}=t.price_ending_conf||{};let e=new n(o);switch(t.discount_type){case c.Percentage:e=e.mul(100-t.discount_value).div(100);break;case c.FixedAmount:e=e.sub(t.discount_value);break;case c.FixedPrice:e=new n(t.discount_value);break;default:break}if(r){switch(s){case i.RoundHighest:e=e.ceil();break;case i.RoundLowest:e=e.floor();break;case i.RoundNearest:e=e.round();break;default:e=new n(e.toFixed(2,n.ROUND_DOWN));break}const d=e.toString().split(".");e=new n(d[0]+"."+a+u)}return e.toNumber()};export{b as functionDiscountCalculate};
|
|
2
|
+
//# sourceMappingURL=functionDiscountCalculate.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/context/utils/functionDiscountCalculate.ts"],
|
|
4
|
+
"sourcesContent": ["import { FunctionDiscountType, RoundSelected } from '../memberPriceConst'\nimport { DiscountConfig } from '../memberPriceTypes'\nimport Decimal from 'decimal.js'\n\n// Function \u8BA1\u7B97\u6298\u540E\u4EF7\nexport const functionDiscountCalculate = ({\n config,\n price,\n}: {\n config: DiscountConfig\n price: number\n}) => {\n const { apply_price_ending, one_decimal_place, two_decimal_place, round_selected } =\n config.price_ending_conf || {}\n\n let salePrice = new Decimal(price)\n\n switch (config.discount_type) {\n // \u767E\u5206\u6BD4\u6298\u6263\n case FunctionDiscountType.Percentage:\n salePrice = salePrice.mul(100 - config.discount_value).div(100)\n break\n // \u56FA\u5B9A\u91D1\u989D\u6298\u6263\n case FunctionDiscountType.FixedAmount:\n salePrice = salePrice.sub(config.discount_value)\n break\n // \u56FA\u5B9A\u4EF7\u683C\u6298\u6263\n case FunctionDiscountType.FixedPrice:\n salePrice = new Decimal(config.discount_value)\n break\n default:\n break\n }\n\n if (apply_price_ending) {\n // \u5C0F\u6570\u4F4D\u53D6\u820D\n switch (round_selected) {\n case RoundSelected.RoundHighest:\n salePrice = salePrice.ceil()\n break\n case RoundSelected.RoundLowest:\n salePrice = salePrice.floor()\n break\n case RoundSelected.RoundNearest:\n salePrice = salePrice.round()\n break\n default:\n salePrice = new Decimal(salePrice.toFixed(2, Decimal.ROUND_DOWN))\n break\n }\n\n const priceEnding = salePrice.toString().split('.')\n salePrice = new Decimal(priceEnding[0] + '.' + one_decimal_place + two_decimal_place)\n }\n\n return salePrice.toNumber()\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,wBAAAA,EAAsB,iBAAAC,MAAqB,sBAEpD,OAAOC,MAAa,aAGb,MAAMC,EAA4B,CAAC,CACxC,OAAAC,EACA,MAAAC,CACF,IAGM,CACJ,KAAM,CAAE,mBAAAC,EAAoB,kBAAAC,EAAmB,kBAAAC,EAAmB,eAAAC,CAAe,EAC/EL,EAAO,mBAAqB,CAAC,EAE/B,IAAIM,EAAY,IAAIR,EAAQG,CAAK,EAEjC,OAAQD,EAAO,cAAe,CAE5B,KAAKJ,EAAqB,WACxBU,EAAYA,EAAU,IAAI,IAAMN,EAAO,cAAc,EAAE,IAAI,GAAG,EAC9D,MAEF,KAAKJ,EAAqB,YACxBU,EAAYA,EAAU,IAAIN,EAAO,cAAc,EAC/C,MAEF,KAAKJ,EAAqB,WACxBU,EAAY,IAAIR,EAAQE,EAAO,cAAc,EAC7C,MACF,QACE,KACJ,CAEA,GAAIE,EAAoB,CAEtB,OAAQG,EAAgB,CACtB,KAAKR,EAAc,aACjBS,EAAYA,EAAU,KAAK,EAC3B,MACF,KAAKT,EAAc,YACjBS,EAAYA,EAAU,MAAM,EAC5B,MACF,KAAKT,EAAc,aACjBS,EAAYA,EAAU,MAAM,EAC5B,MACF,QACEA,EAAY,IAAIR,EAAQQ,EAAU,QAAQ,EAAGR,EAAQ,UAAU,CAAC,EAChE,KACJ,CAEA,MAAMS,EAAcD,EAAU,SAAS,EAAE,MAAM,GAAG,EAClDA,EAAY,IAAIR,EAAQS,EAAY,CAAC,EAAI,IAAMJ,EAAoBC,CAAiB,CACtF,CAEA,OAAOE,EAAU,SAAS,CAC5B",
|
|
6
|
+
"names": ["FunctionDiscountType", "RoundSelected", "Decimal", "functionDiscountCalculate", "config", "price", "apply_price_ending", "one_decimal_place", "two_decimal_place", "round_selected", "salePrice", "priceEnding"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionMemberPriceConfig, FunctionMemberPriceResult } from '../memberPriceTypes';
|
|
2
|
+
import { ProductVariant } from '@anker-in/lib';
|
|
3
|
+
export declare const getFunctionMemberPrice: ({ memberPriceDiscount, currencyCode, variant, locale, }: {
|
|
4
|
+
memberPriceDiscount?: FunctionMemberPriceConfig[];
|
|
5
|
+
currencyCode?: string;
|
|
6
|
+
variant?: ProductVariant;
|
|
7
|
+
locale: string;
|
|
8
|
+
}) => false | FunctionMemberPriceResult;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{formatPrice as o}from"../utils";import{functionDiscountCalculate as b}from"./functionDiscountCalculate";import n from"decimal.js";import{getFunctionMemberPriceDiscountConfig as D}from"./getFunctionMemberPriceDiscountConfig";import d from"./variantGetCoupon";const V=({memberPriceDiscount:l,currencyCode:r,variant:e,locale:i})=>{const m=d({variant:e}),{memberPriceDiscountConfig:c,activeMemberPriceConfig:y}=D({config:l,variant:e}),s=!!y?.discount_combinations.other_product_discounts;if(!c)return!1;const u={amount:e?.price.amount||0,priceWithCurrency:o({amount:e?.price.amount||0,currencyCode:r||"USD",locale:i})},t=c?b({config:c,price:e?.price.amount||0}):e?.price.amount||0,a={amount:t,priceWithCurrency:o({amount:t,currencyCode:r||"USD",locale:i})};let p=t;if(m?.variant_price4wscode&&e&&s)if(s){const P=new n(e.price.amount).minus(m.variant_price4wscode);p=new n(t).minus(P).toNumber()}else{const P=new n(e.price.amount).minus(m.variant_price4wscode);if(t>P.toNumber())return!1}const C={amount:p,priceWithCurrency:o({amount:p,currencyCode:r||"USD",locale:i})},h=new n(u.amount).minus(C.amount).toNumber(),f={amount:h,priceWithCurrency:o({amount:h,currencyCode:r||"USD",locale:i,maximumFractionDigits:2})},W=new n(u.amount).minus(a.amount).toNumber(),g={amount:W,priceWithCurrency:o({amount:W,currencyCode:r||"USD",locale:i,maximumFractionDigits:2})};return{hasMemberPrice:!!c,useCoupon:s,originalPrice:u.amount,originalPriceWithCurrency:u.priceWithCurrency,salePrice:C.amount,salePriceWithCurrency:C.priceWithCurrency,salePriceWithoutCoupon:a.amount,salePriceWithoutCouponWithCurrency:a.priceWithCurrency,savePrice:f.amount,savePriceWithCurrency:f.priceWithCurrency,savePriceWithoutCoupon:g.amount,savePriceWithoutCouponWithCurrency:g.priceWithCurrency}};export{V as getFunctionMemberPrice};
|
|
2
|
+
//# sourceMappingURL=getFunctionMemberPrice.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/context/utils/getFunctionMemberPrice.ts"],
|
|
4
|
+
"sourcesContent": ["import { formatPrice } from '../utils'\nimport { FunctionMemberPriceConfig, FunctionMemberPriceResult } from '../memberPriceTypes'\nimport { ProductVariant } from '@anker-in/lib'\nimport { functionDiscountCalculate } from './functionDiscountCalculate'\nimport Decimal from 'decimal.js'\nimport { getFunctionMemberPriceDiscountConfig } from './getFunctionMemberPriceDiscountConfig'\nimport variantGetCoupon from './variantGetCoupon'\n\n// \u8BA1\u7B97\u5355\u4EF6\u5546\u54C1\u7684\u4F1A\u5458\u4EF7\nexport const getFunctionMemberPrice = ({\n memberPriceDiscount,\n currencyCode,\n variant,\n locale,\n}: {\n memberPriceDiscount?: FunctionMemberPriceConfig[]\n currencyCode?: string\n variant?: ProductVariant\n locale: string\n}) => {\n const couponData = variantGetCoupon({ variant })\n\n // variant\u5BF9\u5E94\u7684\u4F1A\u5458\u4EF7\u6298\u6263\u914D\u7F6E\n const { memberPriceDiscountConfig, activeMemberPriceConfig } = getFunctionMemberPriceDiscountConfig({\n config: memberPriceDiscount,\n variant,\n })\n\n const useCoupon = !!activeMemberPriceConfig?.discount_combinations.other_product_discounts\n\n if (!memberPriceDiscountConfig) {\n return false as false\n }\n\n const originalPrice = {\n amount: variant?.price.amount || 0,\n priceWithCurrency: formatPrice({\n amount: variant?.price.amount || 0,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n const salePriceWithoutCouponAmount = memberPriceDiscountConfig\n ? functionDiscountCalculate({\n config: memberPriceDiscountConfig,\n price: variant?.price.amount || 0,\n })\n : variant?.price.amount || 0\n const salePriceWithoutCoupon = {\n amount: salePriceWithoutCouponAmount,\n priceWithCurrency: formatPrice({\n amount: salePriceWithoutCouponAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n // function \u4F1A\u5458\u4EF7\u662F\u5728\u539F\u4EF7\u7684\u57FA\u7840\u4E0A\u8FDB\u884C\u8BA1\u7B97\uFF0C\u6682\u4E0D\u652F\u6301\u6298\u540E\u4EF7\n let salePriceAmount = salePriceWithoutCouponAmount\n\n // \u51CF\u53BBcode\u7684\u4F18\u60E0\n if (couponData?.variant_price4wscode && variant && useCoupon) {\n if (useCoupon) {\n // code\u7684\u4F18\u60E0\u91D1\u989D\n const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)\n salePriceAmount = new Decimal(salePriceWithoutCouponAmount).minus(codeSaveAmountDecimal).toNumber()\n } else {\n // \u4E0D\u80FD\u4E0E code \u540C\u65F6\u4F7F\u7528\uFF0C\u9700\u8981\u5224\u65AD\u4F1A\u5458\u4EF7\u662F\u5426\u5C0F\u4E8E code \u7684\u4F18\u60E0\u91D1\u989D\uFF0C\u5982\u679C\u5C0F\u4E8E\u5219\u5F53\u505A\u6CA1\u6709\u4F1A\u5458\u4EF7\n const codeSaveAmountDecimal = new Decimal(variant.price.amount).minus(couponData.variant_price4wscode)\n if (salePriceWithoutCouponAmount > codeSaveAmountDecimal.toNumber()) {\n return false as false\n }\n }\n }\n\n const salePrice = {\n amount: salePriceAmount,\n priceWithCurrency: formatPrice({\n amount: salePriceAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n }),\n }\n\n const savePriceAmount = new Decimal(originalPrice.amount).minus(salePrice.amount).toNumber()\n const savePrice = {\n amount: savePriceAmount,\n priceWithCurrency: formatPrice({\n amount: savePriceAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n maximumFractionDigits: 2,\n }),\n }\n\n const savePriceWithoutCouponAmount = new Decimal(originalPrice.amount)\n .minus(salePriceWithoutCoupon.amount)\n .toNumber()\n const savePriceWithoutCoupon = {\n amount: savePriceWithoutCouponAmount,\n priceWithCurrency: formatPrice({\n amount: savePriceWithoutCouponAmount,\n currencyCode: currencyCode || 'USD',\n locale,\n maximumFractionDigits: 2,\n }),\n }\n\n const result: FunctionMemberPriceResult = {\n // \u662F\u5426\u5B58\u5728\u4F1A\u5458\u4EF7\n hasMemberPrice: !!memberPriceDiscountConfig,\n useCoupon,\n // \u539F\u4EF7\n originalPrice: originalPrice.amount,\n originalPriceWithCurrency: originalPrice.priceWithCurrency as string,\n // \u4F7F\u7528\u5238\u540E\u7684\u6298\u540E\u4EF7\n salePrice: salePrice.amount,\n salePriceWithCurrency: salePrice.priceWithCurrency as string,\n\n // \u4E0D\u4F7F\u7528\u5238\u7684\u6298\u540E\u4EF7\n salePriceWithoutCoupon: salePriceWithoutCoupon.amount,\n salePriceWithoutCouponWithCurrency: salePriceWithoutCoupon.priceWithCurrency as string,\n\n // \u5305\u542B\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePrice: savePrice.amount,\n savePriceWithCurrency: savePrice.priceWithCurrency as string,\n\n // \u4E0D\u4F7F\u7528\u5238\u7684\u8282\u7701\u91D1\u989D\n savePriceWithoutCoupon: savePriceWithoutCoupon.amount,\n savePriceWithoutCouponWithCurrency: savePriceWithoutCoupon.priceWithCurrency as string,\n }\n\n return result\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,eAAAA,MAAmB,WAG5B,OAAS,6BAAAC,MAAiC,8BAC1C,OAAOC,MAAa,aACpB,OAAS,wCAAAC,MAA4C,yCACrD,OAAOC,MAAsB,qBAGtB,MAAMC,EAAyB,CAAC,CACrC,oBAAAC,EACA,aAAAC,EACA,QAAAC,EACA,OAAAC,CACF,IAKM,CACJ,MAAMC,EAAaN,EAAiB,CAAE,QAAAI,CAAQ,CAAC,EAGzC,CAAE,0BAAAG,EAA2B,wBAAAC,CAAwB,EAAIT,EAAqC,CAClG,OAAQG,EACR,QAAAE,CACF,CAAC,EAEKK,EAAY,CAAC,CAACD,GAAyB,sBAAsB,wBAEnE,GAAI,CAACD,EACH,MAAO,GAGT,MAAMG,EAAgB,CACpB,OAAQN,GAAS,MAAM,QAAU,EACjC,kBAAmBR,EAAY,CAC7B,OAAQQ,GAAS,MAAM,QAAU,EACjC,aAAcD,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAEMM,EAA+BJ,EACjCV,EAA0B,CACxB,OAAQU,EACR,MAAOH,GAAS,MAAM,QAAU,CAClC,CAAC,EACDA,GAAS,MAAM,QAAU,EACvBQ,EAAyB,CAC7B,OAAQD,EACR,kBAAmBf,EAAY,CAC7B,OAAQe,EACR,aAAcR,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAGA,IAAIQ,EAAkBF,EAGtB,GAAIL,GAAY,sBAAwBF,GAAWK,EACjD,GAAIA,EAAW,CAEb,MAAMK,EAAwB,IAAIhB,EAAQM,EAAQ,MAAM,MAAM,EAAE,MAAME,EAAW,oBAAoB,EACrGO,EAAkB,IAAIf,EAAQa,CAA4B,EAAE,MAAMG,CAAqB,EAAE,SAAS,CACpG,KAAO,CAEL,MAAMA,EAAwB,IAAIhB,EAAQM,EAAQ,MAAM,MAAM,EAAE,MAAME,EAAW,oBAAoB,EACrG,GAAIK,EAA+BG,EAAsB,SAAS,EAChE,MAAO,EAEX,CAGF,MAAMC,EAAY,CAChB,OAAQF,EACR,kBAAmBjB,EAAY,CAC7B,OAAQiB,EACR,aAAcV,GAAgB,MAC9B,OAAAE,CACF,CAAC,CACH,EAEMW,EAAkB,IAAIlB,EAAQY,EAAc,MAAM,EAAE,MAAMK,EAAU,MAAM,EAAE,SAAS,EACrFE,EAAY,CAChB,OAAQD,EACR,kBAAmBpB,EAAY,CAC7B,OAAQoB,EACR,aAAcb,GAAgB,MAC9B,OAAAE,EACA,sBAAuB,CACzB,CAAC,CACH,EAEMa,EAA+B,IAAIpB,EAAQY,EAAc,MAAM,EAClE,MAAME,EAAuB,MAAM,EACnC,SAAS,EACNO,EAAyB,CAC7B,OAAQD,EACR,kBAAmBtB,EAAY,CAC7B,OAAQsB,EACR,aAAcf,GAAgB,MAC9B,OAAAE,EACA,sBAAuB,CACzB,CAAC,CACH,EA0BA,MAxB0C,CAExC,eAAgB,CAAC,CAACE,EAClB,UAAAE,EAEA,cAAeC,EAAc,OAC7B,0BAA2BA,EAAc,kBAEzC,UAAWK,EAAU,OACrB,sBAAuBA,EAAU,kBAGjC,uBAAwBH,EAAuB,OAC/C,mCAAoCA,EAAuB,kBAG3D,UAAWK,EAAU,OACrB,sBAAuBA,EAAU,kBAGjC,uBAAwBE,EAAuB,OAC/C,mCAAoCA,EAAuB,iBAC7D,CAGF",
|
|
6
|
+
"names": ["formatPrice", "functionDiscountCalculate", "Decimal", "getFunctionMemberPriceDiscountConfig", "variantGetCoupon", "getFunctionMemberPrice", "memberPriceDiscount", "currencyCode", "variant", "locale", "couponData", "memberPriceDiscountConfig", "activeMemberPriceConfig", "useCoupon", "originalPrice", "salePriceWithoutCouponAmount", "salePriceWithoutCoupon", "salePriceAmount", "codeSaveAmountDecimal", "salePrice", "savePriceAmount", "savePrice", "savePriceWithoutCouponAmount", "savePriceWithoutCoupon"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DiscountConfig, FunctionMemberPriceConfig } from '../memberPriceTypes';
|
|
2
|
+
import { ProductVariant } from '@anker-in/lib';
|
|
3
|
+
export declare const getFunctionMemberPriceDiscountConfig: ({ config, variant, }: {
|
|
4
|
+
config?: FunctionMemberPriceConfig[];
|
|
5
|
+
variant?: ProductVariant;
|
|
6
|
+
}) => {
|
|
7
|
+
memberPriceDiscountConfig: DiscountConfig | undefined;
|
|
8
|
+
activeMemberPriceConfig: FunctionMemberPriceConfig | undefined;
|
|
9
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{atobID as f}from"./atobID";const b=({config:e,variant:t})=>{let i,r;if(!e||!t)return{memberPriceDiscountConfig:i,activeMemberPriceConfig:r};for(const o of e)if(i=o.result_detail.member_discounts?.find(n=>n.main_products.all_store_variant?n:n.main_products.variants.find(c=>String(c.variant_id)===f(t.id)))?.discount_conf,i){r=o;break}return i?{memberPriceDiscountConfig:i,activeMemberPriceConfig:r}:{memberPriceDiscountConfig:i,activeMemberPriceConfig:r}};export{b as getFunctionMemberPriceDiscountConfig};
|
|
2
|
+
//# sourceMappingURL=getFunctionMemberPriceDiscountConfig.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/context/utils/getFunctionMemberPriceDiscountConfig.ts"],
|
|
4
|
+
"sourcesContent": ["import { DiscountConfig, FunctionMemberPriceConfig } from '../memberPriceTypes'\nimport { ProductVariant } from '@anker-in/lib'\nimport { atobID } from './atobID'\n\n// \u83B7\u53D6\u4F1A\u5458\u4EF7\u6298\u6263\u914D\u7F6E\nexport const getFunctionMemberPriceDiscountConfig = ({\n config,\n variant,\n}: {\n config?: FunctionMemberPriceConfig[]\n variant?: ProductVariant\n}) => {\n let memberPriceDiscountConfig: DiscountConfig | undefined\n let activeMemberPriceConfig: FunctionMemberPriceConfig | undefined\n\n if (!config || !variant) {\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n }\n\n for (const configItem of config) {\n memberPriceDiscountConfig = configItem.result_detail.member_discounts?.find(discountItem => {\n if (discountItem.main_products.all_store_variant) {\n return discountItem\n }\n\n return discountItem.main_products.variants.find(\n variantConfig => String(variantConfig.variant_id) === atobID(variant.id as string)\n )\n })?.discount_conf\n\n if (memberPriceDiscountConfig) {\n activeMemberPriceConfig = configItem\n break\n }\n }\n\n if (!memberPriceDiscountConfig) {\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n }\n\n return {\n memberPriceDiscountConfig,\n activeMemberPriceConfig,\n }\n}\n"],
|
|
5
|
+
"mappings": "AAEA,OAAS,UAAAA,MAAc,WAGhB,MAAMC,EAAuC,CAAC,CACnD,OAAAC,EACA,QAAAC,CACF,IAGM,CACJ,IAAIC,EACAC,EAEJ,GAAI,CAACH,GAAU,CAACC,EACd,MAAO,CACL,0BAAAC,EACA,wBAAAC,CACF,EAGF,UAAWC,KAAcJ,EAWvB,GAVAE,EAA4BE,EAAW,cAAc,kBAAkB,KAAKC,GACtEA,EAAa,cAAc,kBACtBA,EAGFA,EAAa,cAAc,SAAS,KACzCC,GAAiB,OAAOA,EAAc,UAAU,IAAMR,EAAOG,EAAQ,EAAY,CACnF,CACD,GAAG,cAEAC,EAA2B,CAC7BC,EAA0BC,EAC1B,KACF,CAGF,OAAKF,EAOE,CACL,0BAAAA,EACA,wBAAAC,CACF,EATS,CACL,0BAAAD,EACA,wBAAAC,CACF,CAOJ",
|
|
6
|
+
"names": ["atobID", "getFunctionMemberPriceDiscountConfig", "config", "variant", "memberPriceDiscountConfig", "activeMemberPriceConfig", "configItem", "discountItem", "variantConfig"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{atobID as a}from"./atobID";const r=({variant:e,channel:i=""})=>{if(!e)return;const s="wsch";return(e?.metafields?.discountCodeApp||[])?.filter(t=>{const n=a(e.id);return(!t?.ends_at||new Date(t?.ends_at).getTime()>new Date().getTime())&&new Date(t?.starts_at).getTime()<=new Date().getTime()&&t.variant_shopify_id===+(n||"")&&(i?t?.title?.toLocaleLowerCase().includes(i):!t?.title?.toLocaleLowerCase().includes(s))})?.[0]};var f=r;export{f as default};
|
|
2
|
+
//# sourceMappingURL=variantGetCoupon.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/credits/context/utils/variantGetCoupon.ts"],
|
|
4
|
+
"sourcesContent": ["import { ProductVariant } from '@anker-in/lib'\nimport { atobID } from './atobID'\n\nconst variantGetCoupon = ({\n variant,\n channel = '',\n}: {\n variant?: ProductVariant\n channel?: string\n}) => {\n if (!variant) return undefined\n\n const hideChannel = 'wsch'\n const discountCodeApp = variant?.metafields?.discountCodeApp || []\n\n const results = discountCodeApp?.filter((coupon: any) => {\n const variantId = atobID(variant.id as string)\n const isActive =\n (!coupon?.ends_at || new Date(coupon?.ends_at).getTime() > new Date().getTime()) &&\n new Date(coupon?.starts_at).getTime() <= new Date().getTime() &&\n coupon.variant_shopify_id === +(variantId || '')\n\n return (\n isActive &&\n (channel\n ? coupon?.title?.toLocaleLowerCase().includes(channel)\n : !coupon?.title?.toLocaleLowerCase().includes(hideChannel))\n )\n })\n\n return results?.[0]\n}\n\nexport default variantGetCoupon\n"],
|
|
5
|
+
"mappings": "AACA,OAAS,UAAAA,MAAc,WAEvB,MAAMC,EAAmB,CAAC,CACxB,QAAAC,EACA,QAAAC,EAAU,EACZ,IAGM,CACJ,GAAI,CAACD,EAAS,OAEd,MAAME,EAAc,OAkBpB,OAjBwBF,GAAS,YAAY,iBAAmB,CAAC,IAEhC,OAAQG,GAAgB,CACvD,MAAMC,EAAYN,EAAOE,EAAQ,EAAY,EAM7C,OAJG,CAACG,GAAQ,SAAW,IAAI,KAAKA,GAAQ,OAAO,EAAE,QAAQ,EAAI,IAAI,KAAK,EAAE,QAAQ,IAC9E,IAAI,KAAKA,GAAQ,SAAS,EAAE,QAAQ,GAAK,IAAI,KAAK,EAAE,QAAQ,GAC5DA,EAAO,qBAAuB,EAAEC,GAAa,MAI5CH,EACGE,GAAQ,OAAO,kBAAkB,EAAE,SAASF,CAAO,EACnD,CAACE,GAAQ,OAAO,kBAAkB,EAAE,SAASD,CAAW,EAEhE,CAAC,IAEgB,CAAC,CACpB,EAEA,IAAOG,EAAQN",
|
|
6
|
+
"names": ["atobID", "variantGetCoupon", "variant", "channel", "hideChannel", "coupon", "variantId", "variantGetCoupon_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Fragment as A,jsx as e,jsxs as i}from"react/jsx-runtime";import{Button as y,Container as P,Heading as b,Picture as z,Text as _}from"@anker-in/headless-ui";import{ChevronDownIcon as E,ChevronUpIcon as H}from"@heroicons/react/24/outline";import{motion as j}from"framer-motion";import{useMemo as q,useState as d}from"react";import{TaskType as g}from"./type";import{useActions as V}from"../creditsWaysToGetCredits/useActions";import{useCreditsContext as G}from"../context/provider";import{classNames as h,useHeadlessContext as J,ROUNDED_BRANDS as K}from"@anker-in/lib";import{useRegistration as Q}from"../../registration";import{CreditsUploadReceiptModal as W}from"../modal/creditsUploadReceiptModal";import{CreditsSubscribeModal as X}from"../modal/subscribeModal";const re=({copy:s,classNames:Y,id:v})=>{const[l,k]=d(!1),{profile:M}=G(),{authCodeActivate:R}=Q(),{brand:L}=J(),p=K.includes(L),m=!!M,[T,C]=d(!1),[U,x]=d(!1),[F,O]=d(!1),[N,B]=d(!1),{actions:u}=V({copy:s,subscribe:{openSubscribePopup:()=>x(!0),isSuccess:F},uploadReceipt:{openUploadReceiptPopup:()=>C(!0),isSuccess:N}}),w=q(()=>{const t=s.list.map(n=>{if(!u[n.id])return;const{finished:o,notLogin:S,notFinished:f,completed:D}=u[n.id];let r="",c,I;return m?o?(r=D.buttonLabel,c=void 0):(r=f.buttonLabel,c=f.handleClick,I=f.link):(r=S.buttonLabel,c=S.handleClick),{...n,buttonLabel:r,handleClick:c,finished:o,link:I}}).filter(Boolean);return m?t.sort((n,o)=>n?.finished&&!o?.finished?1:!n?.finished&&o?.finished?-1:0):t},[u,s.list,m]),a=w.length>3;return i(P,{id:v,className:"[&>div]:l:!px-0 bg-[#F5F5F7]",children:[e(b,{as:"h2",size:"4",html:s.title,className:"md:px-[16px]"}),i("div",{className:h("mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden",p?"rounded-[8px]":"",!p&&"l:rounded-none"),style:{background:"linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)"},children:[e("div",{className:"absolute inset-0 pointer-events-none -z-10",style:{background:"radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)"}}),i("div",{className:"flex items-center justify-between h-[560px] md:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start",children:[i("div",{className:"flex flex-col gap-[8px]",children:[e(b,{as:"h3",size:4,html:s?.subtitle,className:"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]"}),e("div",{className:"flex items-center gap-[8px]",children:e("p",{className:"text-[48px] font-bold tracking-[-1.92px] leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]",dangerouslySetInnerHTML:{__html:s.equalCredits}})})]}),s.mainImage?.url&&e(z,{className:"w-full max-w-[50%] md:max-w-full md:mt-[24px] l:max-w-full l:mt-[24px]",source:s.mainImage.url})]}),i("div",{className:"relative",children:[i(j.div,{className:h("grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto"),initial:{height:a?512:"auto"},animate:{height:l||!a?"auto":512},transition:{duration:.3},onAnimationComplete:()=>{if(!l&&a&&window.screen.width<768){const t=document.getElementById(v||"ankersolix-task");t&&t.scrollIntoView({behavior:"smooth",block:"end"})}},children:[w.map(t=>i("div",{className:h("flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] md:p-[16px] l:p-[24px]",""),children:[i("div",{children:[e(b,{as:"h4",html:t.title,size:2,className:"text-[24px] font-bold text-[#080a0f] tracking-[-0.96px] leading-[1.2] text-pretty md:text-[18px] l:text-[20px]"}),i("div",{className:"mt-[8px] flex items-center gap-[4px]",children:[e(z,{className:"size-[24px] [&_path]:size-full",source:"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450"}),e(_,{as:"p",html:t.credits,size:2,className:"text-[18px] font-bold text-[#080a0f] tracking-[-0.36px] leading-[1.4] md:text-[16px]"})]})]}),t.handleClick&&!(t.id===g.UploadReceipt&&N)&&!(t.id===g.Activate&&R.isActivateSuccess)&&!(t.id===g.Subscribe&&F)?e(y,{as:t.link?"a":"button",...t.link&&{href:t.link},...t.handleClick&&{onClick:t.handleClick},variant:"primary",size:"lg",className:"mt-[24px] w-fit bg-[#080a0f] text-white text-[16px] font-bold tracking-[-0.64px] leading-[1.2]",children:t.buttonLabel}):e(y,{variant:"primary",size:"lg",className:"mt-[24px] w-fit bg-[#080a0f] text-white text-[16px] font-bold tracking-[-0.64px] leading-[1.2]",disabled:!0,children:t.buttonLabel})]},t.id)),!l&&a&&e("div",{className:"absolute inset-0 pointer-events-none min-md:hidden",style:{background:"linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)"}})]}),a&&e(A,{children:l?e("button",{className:"mx-auto mt-[12px] block w-fit min-md:hidden",onClick:()=>{k(!1)},children:e(H,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})}):e(A,{children:e("div",{className:"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden",children:e("button",{className:"w-fit",onClick:()=>k(!l),children:e(E,{className:"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]"})})})})})]})]}),s.receipt&&e(W,{isOpen:T,onClose:()=>{C(!1)},copy:s.receipt,onSuccess:()=>{B(!0)}}),s.subscribe&&e(X,{copy:s.subscribe,onSuccess:()=>{O(!0),setTimeout(()=>{x(!1)},3e3)},isOpen:U,onClose:()=>{x(!1)}})]})};export{re as CreditsAnkersolixTask};
|
|
2
|
+
//# sourceMappingURL=CreditsAnkersolixTask.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsAnkersolixTask/CreditsAnkersolixTask.tsx"],
|
|
4
|
+
"sourcesContent": ["import { Button, Container, Heading, Picture, Text } from '@anker-in/headless-ui'\nimport { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline'\nimport { motion } from 'framer-motion'\nimport { useMemo, useState } from 'react'\n\nimport { TaskType, type CreditsAnkersolixTaskProps } from './type'\nimport { useActions } from '../creditsWaysToGetCredits/useActions'\nimport { useCreditsContext } from '../context/provider'\nimport { classNames as cn, useHeadlessContext, ROUNDED_BRANDS } from '@anker-in/lib'\nimport { useRegistration } from '../../registration'\nimport { CreditsUploadReceiptModal } from '../modal/creditsUploadReceiptModal'\nimport { CreditsSubscribeModal } from '../modal/subscribeModal'\n\nexport const CreditsAnkersolixTask = ({ copy, classNames, id }: CreditsAnkersolixTaskProps & { id?: string }) => {\n const [showMore, setShowMore] = useState(false)\n const { profile } = useCreditsContext()\n const { authCodeActivate } = useRegistration()\n const { brand } = useHeadlessContext()\n const rounded = ROUNDED_BRANDS.includes(brand)\n const isLogin = !!profile\n\n const [isUploadReceiptModalOpen, setIsUploadReceiptModalOpen] = useState(false)\n const [isSubscribeModalOpen, setIsSubscribeModalOpen] = useState(false)\n const [isSubscribeSuccess, setIsSubscribeSuccess] = useState(false)\n const [isUploadReceiptSuccess, setIsUploadReceiptSuccess] = useState(false)\n\n const { actions } = useActions({\n copy,\n subscribe: {\n openSubscribePopup: () => setIsSubscribeModalOpen(true),\n isSuccess: isSubscribeSuccess,\n },\n uploadReceipt: {\n openUploadReceiptPopup: () => setIsUploadReceiptModalOpen(true),\n isSuccess: isUploadReceiptSuccess,\n },\n })\n const list = useMemo(() => {\n const list = copy.list\n .map(item => {\n if (!actions[item.id as keyof typeof actions]) {\n return undefined\n }\n const { finished, notLogin, notFinished, completed } = actions[item.id as keyof typeof actions]\n let buttonLabel = ''\n let handleClick = undefined\n let link = undefined\n if (!isLogin) {\n buttonLabel = notLogin.buttonLabel\n handleClick = notLogin.handleClick\n } else if (finished) {\n buttonLabel = completed.buttonLabel\n handleClick = undefined\n } else {\n buttonLabel = notFinished.buttonLabel\n handleClick = notFinished.handleClick\n link = (notFinished as { link: string }).link\n }\n return {\n ...item,\n buttonLabel,\n handleClick,\n finished,\n link,\n }\n })\n .filter(Boolean) as {\n title: string\n credits: string\n id: TaskType\n buttonLabel: string\n finished: boolean\n link: string\n handleClick: (() => void) | undefined\n }[]\n\n // \u767B\u5F55\u540E\uFF0C\u4FDD\u7559\u539F\u987A\u5E8F\uFF0C\u5C06\u5DF2\u5B8C\u6210\u7684\u4EFB\u52A1\u653E\u5728\u6700\u540E\n if (isLogin) {\n return list.sort((a, b) => {\n if (a?.finished && !b?.finished) {\n return 1 // a\u5DF2\u5B8C\u6210\uFF0Cb\u672A\u5B8C\u6210\uFF0Ca\u6392\u5728\u540E\u9762\n }\n if (!a?.finished && b?.finished) {\n return -1 // a\u672A\u5B8C\u6210\uFF0Cb\u5DF2\u5B8C\u6210\uFF0Ca\u6392\u5728\u524D\u9762\n }\n return 0 // \u90FD\u5DF2\u5B8C\u6210\u6216\u90FD\u672A\u5B8C\u6210\uFF0C\u4FDD\u6301\u539F\u987A\u5E8F\n })\n } else {\n return list\n }\n }, [actions, copy.list, isLogin])\n\n // \u53EA\u6709\u5927\u4E8E3\u4E2A\u4EFB\u52A1\u65F6\u624D\u663E\u793A\u8499\u5C42\n const shouldShowMask = list.length > 3\n\n return (\n <Container id={id} className=\"[&>div]:l:!px-0 bg-[#F5F5F7]\">\n <Heading as=\"h2\" size=\"4\" html={copy.title} className='md:px-[16px]'/>\n <div\n className={cn(\n 'mt-[24px] p-[32px] md-l:p-[32px] md:p-[16px] relative overflow-hidden',\n rounded ? 'rounded-[8px]' : '',\n !rounded && 'l:rounded-none'\n )}\n style={{\n background: 'linear-gradient(180deg, rgba(255, 241, 214, 0) 39.51%, #F4CA81 119.53%)',\n }}\n >\n {/* \u5F84\u5411\u6E10\u53D8\u80CC\u666F\u5C42 - \u4F7F\u7528\u4F2A\u5143\u7D20\u6A21\u62DF */}\n <div\n className=\"absolute inset-0 pointer-events-none -z-10\"\n style={{\n background: 'radial-gradient(ellipse 130% 205% at 45% -20%, #FFF6EA 0%, #FFFFFF 73%, #FFF1D6 100%)',\n }}\n />\n {/* \u526F\u6807\u9898\u548C\u88C5\u9970\u56FE\u90E8\u5206 */}\n <div className=\"flex items-center justify-between h-[560px] md:h-auto md:flex-col md:items-start l:h-auto l:mb-[16px] l:flex-col-reverse l:items-start\">\n <div className=\"flex flex-col gap-[8px]\">\n <Heading\n as=\"h3\"\n size={4}\n html={copy?.subtitle}\n className=\"text-[32px] font-bold text-[#080a0f] tracking-[-1.28px] leading-[1.2] xl:text-[24px]\"\n />\n <div className=\"flex items-center gap-[8px]\">\n <p\n className=\"text-[48px] font-bold tracking-[-1.92px] leading-none bg-gradient-to-r from-[#2c7ed0] via-[#00a9e1] via-43% to-[#00db84] bg-clip-text text-transparent xl-xxl:text-[40px] l-xl:text-[32px] l:text-[24px]\"\n dangerouslySetInnerHTML={{ __html: copy.equalCredits }}\n />\n </div>\n </div>\n {copy.mainImage?.url && (\n <Picture className=\"w-full max-w-[50%] md:max-w-full md:mt-[24px] l:max-w-full l:mt-[24px]\" source={copy.mainImage.url} />\n )}\n </div>\n\n {/* \u5361\u7247\u5217\u8868 */}\n <div className=\"relative\">\n <motion.div\n className={cn(\n 'grid grid-cols-3 gap-[16px] overflow-hidden md:grid-cols-1 md-l:grid-cols-2 min-md:!h-auto'\n )}\n initial={{ height: shouldShowMask ? 512 : 'auto' }}\n animate={{ height: showMore || !shouldShowMask ? 'auto' : 512 }}\n transition={{ duration: 0.3 }}\n onAnimationComplete={() => {\n if (!showMore && shouldShowMask && window.screen.width < 768) {\n const section = document.getElementById(id || 'ankersolix-task')\n if (section) {\n section.scrollIntoView({ behavior: 'smooth', block: 'end' })\n }\n }\n }}\n >\n {list.map(item => (\n <div\n key={item.id}\n className={cn(\n 'flex min-h-[241px] xl-xxl:min-h-[192px] l:min-h-[160px] l-xl:min-h-[170px] flex-col justify-between bg-white p-[32px] md:p-[16px] l:p-[24px]',\n rounded ? '' : ''\n )}\n >\n <div>\n <Heading\n as=\"h4\"\n html={item.title}\n size={2}\n className=\"text-[24px] font-bold text-[#080a0f] tracking-[-0.96px] leading-[1.2] text-pretty md:text-[18px] l:text-[20px]\"\n />\n <div className=\"mt-[8px] flex items-center gap-[4px]\">\n <Picture\n className=\"size-[24px] [&_path]:size-full\"\n source=\"https://cdn.shopify.com/s/files/1/0511/6346/3874/files/20250902-153351.png?v=1756798450\"\n />\n <Text\n as=\"p\"\n html={item.credits}\n size={2}\n className=\"text-[18px] font-bold text-[#080a0f] tracking-[-0.36px] leading-[1.4] md:text-[16px]\"\n />\n </div>\n </div>\n\n {item.handleClick &&\n !(item.id === TaskType.UploadReceipt && isUploadReceiptSuccess) &&\n !(item.id === TaskType.Activate && authCodeActivate.isActivateSuccess) &&\n !(item.id === TaskType.Subscribe && isSubscribeSuccess) ? (\n <Button\n as={item.link ? 'a' : 'button'}\n {...(item.link && { href: item.link })}\n {...(item.handleClick && { onClick: item.handleClick })}\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit bg-[#080a0f] text-white text-[16px] font-bold tracking-[-0.64px] leading-[1.2]\"\n >\n {item.buttonLabel}\n </Button>\n ) : (\n <Button\n variant=\"primary\"\n size=\"lg\"\n className=\"mt-[24px] w-fit bg-[#080a0f] text-white text-[16px] font-bold tracking-[-0.64px] leading-[1.2]\"\n disabled\n >\n {item.buttonLabel}\n </Button>\n )}\n </div>\n ))}\n {!showMore && shouldShowMask && (\n <div\n className=\"absolute inset-0 pointer-events-none min-md:hidden\"\n style={{ background: 'linear-gradient(180deg, rgba(244, 202, 129, 0) 66.37%, #f4ca81 100%)' }}\n ></div>\n )}\n </motion.div>\n {shouldShowMask && (\n <>\n {showMore ? (\n <button\n className=\"mx-auto mt-[12px] block w-fit min-md:hidden\"\n onClick={() => {\n setShowMore(false)\n }}\n >\n <ChevronUpIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronUpIcon>\n </button>\n ) : (\n <>\n <div className=\"absolute bottom-0 flex w-full translate-y-1/2 justify-center min-md:hidden\">\n <button className=\"w-fit\" onClick={() => setShowMore(!showMore)}>\n <ChevronDownIcon className=\"size-[40px] rounded-full bg-[#FFFFFF33] p-[8px]\"></ChevronDownIcon>\n </button>\n </div>\n </>\n )}\n </>\n )}\n </div>\n </div>\n {copy.receipt && (\n <CreditsUploadReceiptModal\n isOpen={isUploadReceiptModalOpen}\n onClose={() => {\n setIsUploadReceiptModalOpen(false)\n }}\n copy={copy.receipt}\n onSuccess={() => {\n setIsUploadReceiptSuccess(true)\n }}\n />\n )}\n {copy.subscribe && (\n <CreditsSubscribeModal\n copy={copy.subscribe}\n onSuccess={() => {\n setIsSubscribeSuccess(true)\n setTimeout(() => {\n setIsSubscribeModalOpen(false)\n }, 3000)\n }}\n isOpen={isSubscribeModalOpen}\n onClose={() => {\n setIsSubscribeModalOpen(false)\n }}\n />\n )}\n </Container>\n )\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "Button", "Container", "Heading", "Picture", "Text", "ChevronDownIcon", "ChevronUpIcon", "motion", "useMemo", "useState", "TaskType", "useActions", "useCreditsContext", "cn", "useHeadlessContext", "ROUNDED_BRANDS", "useRegistration", "CreditsUploadReceiptModal", "CreditsSubscribeModal", "CreditsAnkersolixTask", "copy", "classNames", "id", "showMore", "setShowMore", "profile", "authCodeActivate", "brand", "rounded", "isLogin", "isUploadReceiptModalOpen", "setIsUploadReceiptModalOpen", "isSubscribeModalOpen", "setIsSubscribeModalOpen", "isSubscribeSuccess", "setIsSubscribeSuccess", "isUploadReceiptSuccess", "setIsUploadReceiptSuccess", "actions", "list", "item", "finished", "notLogin", "notFinished", "completed", "buttonLabel", "handleClick", "link", "a", "b", "shouldShowMask", "section"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type BenefitItem, type CreditsWaysToGetCreditsCopy as CreditsAnkersolixTaskCopy, type CreditsWaysToGetCreditsProps as CreditsAnkersolixTaskProps, TaskType, } from '../creditsWaysToGetCredits/type';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/credits/creditsAnkersolixTask/type.ts"],
|
|
4
|
+
"sourcesContent": ["// \u76F4\u63A5\u5F15\u7528\u65E7\u7EC4\u4EF6\u7684\u7C7B\u578B\nexport {\n type BenefitItem,\n type CreditsWaysToGetCreditsCopy as CreditsAnkersolixTaskCopy,\n type CreditsWaysToGetCreditsProps as CreditsAnkersolixTaskProps,\n TaskType,\n} from '../creditsWaysToGetCredits/type'\n"],
|
|
5
|
+
"mappings": "AACA,OAIE,YAAAA,MACK",
|
|
6
|
+
"names": ["TaskType"]
|
|
7
|
+
}
|
|
@@ -17,7 +17,8 @@ export type CreditsBannerCopy = {
|
|
|
17
17
|
description: string;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export declare function CreditsBanner({ copy }: {
|
|
20
|
+
export declare function CreditsBanner({ copy, id }: {
|
|
21
21
|
copy: CreditsBannerCopy;
|
|
22
|
+
id?: string;
|
|
22
23
|
}): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as h,jsx as i,jsxs as l}from"react/jsx-runtime";import{Button as s,Container as d,Heading as c,Picture as u,Text as x}from"@anker-in/headless-ui";import f from"classnames";import{useCreditsContext as I}from"../context/provider";function w({copy:t,id:r}){const{profile:e,openSignInPopup:o,openSignUpPopup:g}=I(),n=e?Object.keys(e).length!==0:!1,m=e?.first_name?e?.first_name+" "+e?.last_name:e?.email?.split("@")[0],a=p=>{p==="primary"?g():o()};return i(h,{children:l("div",{id:r,className:" relative w-full",children:[i(u,{className:"aspect-h-[804] aspect-w-[1920] md:aspect-h-[660] md:aspect-w-[390] md-l:aspect-h-[660] md-l:aspect-w-[768]",source:`${t.pcImg?.url}, ${t.laptopImg?.url} 1024, ${t.mobileImg?.url} 768`,alt:t.pcImg?.alt,loading:"eager"}),n&&i("div",{className:"absolute inset-0 ",style:{background:"linear-gradient(180deg, rgba(245, 245, 247, 0) 70.31%, #F5F5F7 100%)"}}),i(d,{className:"l:h-auto !absolute inset-0 mx-auto grid h-full",asChild:!0,children:i("div",{className:"grid grid-cols-12",children:l("div",{className:"l:col-span-12 l:justify-start l:truncate l:pt-[64px] col-span-5 flex h-full flex-col justify-center text-[#1F2021]",children:[i(c,{as:"h1",size:"5",html:n?t.login.title?.replace("$name",m||""):t.unLogin.title}),i(x,{size:"3",className:"l:mt-[4px] l-xxl:text-[14px] mt-[16px]",html:n?t.login.description:t.unLogin.description}),!n&&l("div",{className:f("mt-[32px] grid w-fit grid-flow-col gap-[12px] l:mt-[24px]",n&&"hidden"),children:[i(s,{variant:"secondary",size:"lg",onClick:()=>{a("primary")},children:t.joinNow}),i(s,{variant:"primary",size:"lg",onClick:()=>{a("secondary")},children:t.loginIn})]})]})})})]})})}export{w as CreditsBanner};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|