@umituz/react-native-subscription 2.27.44 → 2.27.46
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.46",
|
|
4
4
|
"description": "Complete subscription management with RevenueCat, paywall UI, and credits system for React Native apps",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -8,6 +8,7 @@ import React, { useMemo, useEffect } from "react";
|
|
|
8
8
|
import { usePaywallVisibility } from "../../../presentation/hooks/usePaywallVisibility";
|
|
9
9
|
import { useSubscriptionPackages } from "../../../revenuecat/presentation/hooks/useSubscriptionPackages";
|
|
10
10
|
import { useRevenueCatTrialEligibility } from "../../../revenuecat/presentation/hooks/useRevenueCatTrialEligibility";
|
|
11
|
+
import { createCreditAmountsFromPackages } from "../../../utils/creditMapper";
|
|
11
12
|
import { PaywallModal, type TrialEligibilityInfo } from "./PaywallModal";
|
|
12
13
|
import { usePaywallActions } from "../hooks/usePaywallActions";
|
|
13
14
|
import type { PaywallContainerProps } from "./PaywallContainer.types";
|
|
@@ -19,8 +20,9 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = (props) => {
|
|
|
19
20
|
features,
|
|
20
21
|
heroImage,
|
|
21
22
|
bestValueIdentifier,
|
|
22
|
-
creditAmounts,
|
|
23
|
+
creditAmounts: providedCreditAmounts,
|
|
23
24
|
creditsLabel,
|
|
25
|
+
packageAllocations,
|
|
24
26
|
source,
|
|
25
27
|
onPurchaseSuccess,
|
|
26
28
|
onPurchaseError,
|
|
@@ -87,6 +89,13 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = (props) => {
|
|
|
87
89
|
return result;
|
|
88
90
|
}, [eligibilityMap, trialConfig?.enabled, trialConfig?.durationDays]);
|
|
89
91
|
|
|
92
|
+
// Compute credit amounts from packageAllocations if not provided directly
|
|
93
|
+
const creditAmounts = useMemo(() => {
|
|
94
|
+
if (providedCreditAmounts) return providedCreditAmounts;
|
|
95
|
+
if (!packageAllocations || packages.length === 0) return undefined;
|
|
96
|
+
return createCreditAmountsFromPackages(packages, packageAllocations);
|
|
97
|
+
}, [providedCreditAmounts, packageAllocations, packages]);
|
|
98
|
+
|
|
90
99
|
if (!isVisible) return null;
|
|
91
100
|
|
|
92
101
|
return (
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import type { ImageSourcePropType } from "react-native";
|
|
7
7
|
import type { PaywallTranslations, PaywallLegalUrls, SubscriptionFeature } from "../entities";
|
|
8
|
-
import type { PurchaseSource } from "../../../domain/entities/Credits";
|
|
8
|
+
import type { PurchaseSource, PackageAllocationMap } from "../../../domain/entities/Credits";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Trial display configuration
|
|
@@ -33,10 +33,12 @@ export interface PaywallContainerProps {
|
|
|
33
33
|
readonly heroImage?: ImageSourcePropType;
|
|
34
34
|
/** Best value package identifier for badge */
|
|
35
35
|
readonly bestValueIdentifier?: string;
|
|
36
|
-
/** Credit amounts per product identifier */
|
|
36
|
+
/** Credit amounts per product identifier (takes precedence over packageAllocations) */
|
|
37
37
|
readonly creditAmounts?: Record<string, number>;
|
|
38
38
|
/** Credits label text (e.g., "credits") */
|
|
39
39
|
readonly creditsLabel?: string;
|
|
40
|
+
/** Package allocations for auto-computing creditAmounts (used when creditAmounts not provided) */
|
|
41
|
+
readonly packageAllocations?: PackageAllocationMap;
|
|
40
42
|
/** Source of the paywall - affects pending purchase handling */
|
|
41
43
|
readonly source?: PurchaseSource;
|
|
42
44
|
/** Callback when purchase succeeds */
|