@umituz/react-native-subscription 2.14.75 → 2.14.76
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.14.
|
|
3
|
+
"version": "2.14.76",
|
|
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",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Apps just call initializeSubscription with config
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { Platform } from "react-native";
|
|
7
8
|
import type { CustomerInfo } from "react-native-purchases";
|
|
8
9
|
import type { CreditsConfig } from "../../domain/entities/Credits";
|
|
9
10
|
import { configureCreditsRepository, getCreditsRepository } from "../repositories/CreditsRepositoryProvider";
|
|
@@ -23,7 +24,12 @@ export interface CreditPackageConfig {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export interface SubscriptionInitConfig {
|
|
26
|
-
|
|
27
|
+
/** API key for RevenueCat (can provide single key or platform-specific keys) */
|
|
28
|
+
apiKey?: string;
|
|
29
|
+
/** iOS-specific API key (overrides apiKey if provided on iOS) */
|
|
30
|
+
apiKeyIos?: string;
|
|
31
|
+
/** Android-specific API key (overrides apiKey if provided on Android) */
|
|
32
|
+
apiKeyAndroid?: string;
|
|
27
33
|
testStoreKey?: string;
|
|
28
34
|
entitlementId: string;
|
|
29
35
|
credits: CreditsConfig;
|
|
@@ -83,6 +89,8 @@ export const initializeSubscription = async (
|
|
|
83
89
|
): Promise<void> => {
|
|
84
90
|
const {
|
|
85
91
|
apiKey,
|
|
92
|
+
apiKeyIos,
|
|
93
|
+
apiKeyAndroid,
|
|
86
94
|
testStoreKey,
|
|
87
95
|
entitlementId,
|
|
88
96
|
credits,
|
|
@@ -95,7 +103,12 @@ export const initializeSubscription = async (
|
|
|
95
103
|
authStateTimeoutMs = 2000,
|
|
96
104
|
} = config;
|
|
97
105
|
|
|
98
|
-
|
|
106
|
+
// Resolve API key based on platform
|
|
107
|
+
const resolvedApiKey = Platform.OS === "ios"
|
|
108
|
+
? (apiKeyIos || apiKey || "")
|
|
109
|
+
: (apiKeyAndroid || apiKey || "");
|
|
110
|
+
|
|
111
|
+
if (!resolvedApiKey) {
|
|
99
112
|
throw new Error("RevenueCat API key is required");
|
|
100
113
|
}
|
|
101
114
|
|
|
@@ -180,7 +193,7 @@ export const initializeSubscription = async (
|
|
|
180
193
|
|
|
181
194
|
SubscriptionManager.configure({
|
|
182
195
|
config: {
|
|
183
|
-
apiKey,
|
|
196
|
+
apiKey: resolvedApiKey,
|
|
184
197
|
testStoreKey,
|
|
185
198
|
entitlementIdentifier: entitlementId,
|
|
186
199
|
consumableProductIdentifiers: consumableIdentifiers,
|
|
@@ -188,7 +201,7 @@ export const initializeSubscription = async (
|
|
|
188
201
|
onCreditsUpdated,
|
|
189
202
|
onPurchaseCompleted: handlePurchaseCompleted,
|
|
190
203
|
},
|
|
191
|
-
apiKey,
|
|
204
|
+
apiKey: resolvedApiKey,
|
|
192
205
|
getAnonymousUserId,
|
|
193
206
|
});
|
|
194
207
|
|