feat: implement billing and subscription management screen with RevenueCat integration
This commit is contained in:
@@ -81,10 +81,10 @@ const getBillingCopy = (language: Language) => {
|
||||
freePlanName: 'Free',
|
||||
freePlanPrice: '0 EUR / Monat',
|
||||
proPlanName: 'Pro',
|
||||
proPlanPrice: '4.99 EUR / Monat',
|
||||
proPlanPrice: '4,99 € / Monat',
|
||||
proBadgeText: 'EMPFOHLEN',
|
||||
proYearlyPlanName: 'Pro',
|
||||
proYearlyPlanPrice: '39.99 EUR / Jahr',
|
||||
proYearlyPlanPrice: '39,99 € / Jahr',
|
||||
proYearlyBadgeText: 'SPAREN',
|
||||
proBenefits: [
|
||||
'250 Credits jeden Monat',
|
||||
|
||||
@@ -308,6 +308,18 @@ const getValidProEntitlement = (customerInfo) => {
|
||||
return proEntitlement;
|
||||
}
|
||||
|
||||
// Fallback: entitlement is active but backed by a non-subscription product (e.g. a topup
|
||||
// that was previously misconfigured to grant the pro entitlement). If the user also has a
|
||||
// supported subscription product in their purchase history, honour the entitlement anyway.
|
||||
const purchased = Array.isArray(customerInfo?.allPurchasedProductIdentifiers)
|
||||
? customerInfo.allPurchasedProductIdentifiers
|
||||
: [];
|
||||
const hasSubscription = purchased.some((id) => SUPPORTED_SUBSCRIPTION_PRODUCTS.has(id));
|
||||
if (hasSubscription) {
|
||||
console.warn('[Billing] Pro entitlement backed by unsupported product but subscription found — honouring entitlement', summarizeRevenueCatCustomerInfo(customerInfo));
|
||||
return proEntitlement;
|
||||
}
|
||||
|
||||
console.warn('[Billing] Ignoring unsupported RevenueCat pro entitlement', summarizeRevenueCatCustomerInfo(customerInfo));
|
||||
return null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user