refactor(billing): derive subscription product credits from shared tier map
This commit is contained in:
@@ -3,23 +3,27 @@ import {
|
|||||||
normalizePublicTier,
|
normalizePublicTier,
|
||||||
} from "./tier-credits";
|
} from "./tier-credits";
|
||||||
|
|
||||||
|
export const TIER_MONTHLY_CREDITS = {
|
||||||
|
...PUBLIC_TIER_MONTHLY_CREDITS,
|
||||||
|
} as const;
|
||||||
|
|
||||||
export const SUBSCRIPTION_PRODUCTS = {
|
export const SUBSCRIPTION_PRODUCTS = {
|
||||||
starter: {
|
starter: {
|
||||||
polarProductId: "81b6de07-cd41-430f-bd54-f0e7072deec6",
|
polarProductId: "81b6de07-cd41-430f-bd54-f0e7072deec6",
|
||||||
price: 8,
|
price: 8,
|
||||||
credits: 400,
|
credits: TIER_MONTHLY_CREDITS.starter,
|
||||||
label: "Starter",
|
label: "Starter",
|
||||||
},
|
},
|
||||||
pro: {
|
pro: {
|
||||||
polarProductId: "efb5cdb6-2cd6-4861-9073-7b43e29bc9f5",
|
polarProductId: "efb5cdb6-2cd6-4861-9073-7b43e29bc9f5",
|
||||||
price: 59,
|
price: 59,
|
||||||
credits: 3300,
|
credits: TIER_MONTHLY_CREDITS.pro,
|
||||||
label: "Pro",
|
label: "Pro",
|
||||||
},
|
},
|
||||||
max: {
|
max: {
|
||||||
polarProductId: "40b850a9-0a07-4284-a749-c410ef532e80",
|
polarProductId: "40b850a9-0a07-4284-a749-c410ef532e80",
|
||||||
price: 119,
|
price: 119,
|
||||||
credits: 6700,
|
credits: TIER_MONTHLY_CREDITS.max,
|
||||||
label: "Max",
|
label: "Max",
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
@@ -51,10 +55,6 @@ export const TOPUP_PRODUCTS = [
|
|||||||
},
|
},
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export const TIER_MONTHLY_CREDITS = {
|
|
||||||
...PUBLIC_TIER_MONTHLY_CREDITS,
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export function normalizeTier(tier: string | undefined | null): keyof typeof TIER_MONTHLY_CREDITS {
|
export function normalizeTier(tier: string | undefined | null): keyof typeof TIER_MONTHLY_CREDITS {
|
||||||
return normalizePublicTier(tier);
|
return normalizePublicTier(tier);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user