@umituz/react-native-subscription 2.12.30 → 2.12.32
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.12.
|
|
3
|
+
"version": "2.12.32",
|
|
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",
|
|
@@ -30,6 +30,16 @@ export async function initializeSDK(
|
|
|
30
30
|
userId: string,
|
|
31
31
|
apiKey?: string
|
|
32
32
|
): Promise<InitializeResult> {
|
|
33
|
+
if (__DEV__) {
|
|
34
|
+
console.log('[DEBUG RevenueCatInitializer] initializeSDK called', {
|
|
35
|
+
userId,
|
|
36
|
+
hasApiKey: !!apiKey,
|
|
37
|
+
isAlreadyConfigured: isPurchasesConfigured,
|
|
38
|
+
isInitialized: deps.isInitialized(),
|
|
39
|
+
currentUserId: deps.getCurrentUserId(),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
33
43
|
addPackageBreadcrumb("subscription", "SDK initialization started", {
|
|
34
44
|
userId,
|
|
35
45
|
hasApiKey: !!apiKey,
|
|
@@ -82,7 +92,20 @@ export async function initializeSDK(
|
|
|
82
92
|
|
|
83
93
|
// Case 3: First time configuration
|
|
84
94
|
const key = apiKey || resolveApiKey(deps.config);
|
|
95
|
+
if (__DEV__) {
|
|
96
|
+
console.log('[DEBUG RevenueCatInitializer] Resolved API key', {
|
|
97
|
+
hasKey: !!key,
|
|
98
|
+
keyPrefix: key ? key.substring(0, 10) + '...' : 'null',
|
|
99
|
+
isTestStore: deps.isUsingTestStore(),
|
|
100
|
+
configApiKey: deps.config.apiKey ? deps.config.apiKey.substring(0, 10) + '...' : 'null',
|
|
101
|
+
configTestStoreKey: deps.config.testStoreKey ? deps.config.testStoreKey.substring(0, 10) + '...' : 'null',
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
85
105
|
if (!key) {
|
|
106
|
+
if (__DEV__) {
|
|
107
|
+
console.log('[DEBUG RevenueCatInitializer] ERROR: No API key available!');
|
|
108
|
+
}
|
|
86
109
|
const error = new Error("No RevenueCat API key available");
|
|
87
110
|
trackPackageError(error, {
|
|
88
111
|
packageName: "subscription",
|
|
@@ -93,11 +116,21 @@ export async function initializeSDK(
|
|
|
93
116
|
}
|
|
94
117
|
|
|
95
118
|
try {
|
|
119
|
+
if (__DEV__) {
|
|
120
|
+
console.log('[DEBUG RevenueCatInitializer] Calling Purchases.configure', {
|
|
121
|
+
apiKey: key.substring(0, 10) + '...',
|
|
122
|
+
appUserID: userId,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
96
125
|
await Purchases.configure({ apiKey: key, appUserID: userId });
|
|
97
126
|
isPurchasesConfigured = true;
|
|
98
127
|
deps.setInitialized(true);
|
|
99
128
|
deps.setCurrentUserId(userId);
|
|
100
129
|
|
|
130
|
+
if (__DEV__) {
|
|
131
|
+
console.log('[DEBUG RevenueCatInitializer] Purchases.configure succeeded, fetching data...');
|
|
132
|
+
}
|
|
133
|
+
|
|
101
134
|
const [customerInfo, offerings] = await Promise.all([
|
|
102
135
|
Purchases.getCustomerInfo(),
|
|
103
136
|
Purchases.getOfferings(),
|
|
@@ -105,6 +138,20 @@ export async function initializeSDK(
|
|
|
105
138
|
|
|
106
139
|
const packagesCount = offerings.current?.availablePackages?.length ?? 0;
|
|
107
140
|
|
|
141
|
+
if (__DEV__) {
|
|
142
|
+
console.log('[DEBUG RevenueCatInitializer] Data fetched', {
|
|
143
|
+
hasCurrent: !!offerings.current,
|
|
144
|
+
currentIdentifier: offerings.current?.identifier,
|
|
145
|
+
packagesCount,
|
|
146
|
+
allOfferingsCount: Object.keys(offerings.all).length,
|
|
147
|
+
allOfferingIds: Object.keys(offerings.all),
|
|
148
|
+
packages: offerings.current?.availablePackages?.map(p => ({
|
|
149
|
+
identifier: p.identifier,
|
|
150
|
+
packageType: p.packageType,
|
|
151
|
+
})),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
108
155
|
addPackageBreadcrumb("subscription", "Offerings fetched", {
|
|
109
156
|
userId,
|
|
110
157
|
hasCurrent: !!offerings.current,
|
|
@@ -119,6 +166,14 @@ export async function initializeSDK(
|
|
|
119
166
|
} catch (error) {
|
|
120
167
|
const errorMessage = getErrorMessage(error, "RevenueCat init failed");
|
|
121
168
|
|
|
169
|
+
if (__DEV__) {
|
|
170
|
+
console.log('[DEBUG RevenueCatInitializer] ERROR during initialization', {
|
|
171
|
+
error,
|
|
172
|
+
errorMessage,
|
|
173
|
+
errorType: error instanceof Error ? error.constructor.name : typeof error,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
122
177
|
trackPackageError(
|
|
123
178
|
error instanceof Error ? error : new Error(errorMessage),
|
|
124
179
|
{
|
|
@@ -31,15 +31,35 @@ export function shouldUseTestStore(config: RevenueCatConfig): boolean {
|
|
|
31
31
|
export function resolveApiKey(config: RevenueCatConfig): string | null {
|
|
32
32
|
const useTestStore = shouldUseTestStore(config);
|
|
33
33
|
|
|
34
|
+
if (__DEV__) {
|
|
35
|
+
console.log('[DEBUG ApiKeyResolver] resolveApiKey called', {
|
|
36
|
+
useTestStore,
|
|
37
|
+
hasTestStoreKey: !!config.testStoreKey,
|
|
38
|
+
hasApiKey: !!config.apiKey,
|
|
39
|
+
testStoreKeyPrefix: config.testStoreKey ? config.testStoreKey.substring(0, 10) + '...' : 'null',
|
|
40
|
+
apiKeyPrefix: config.apiKey ? config.apiKey.substring(0, 10) + '...' : 'null',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
if (useTestStore) {
|
|
45
|
+
if (__DEV__) {
|
|
46
|
+
console.log('[DEBUG ApiKeyResolver] Using Test Store key');
|
|
47
|
+
}
|
|
35
48
|
return config.testStoreKey ?? null;
|
|
36
49
|
}
|
|
37
50
|
|
|
38
51
|
const key = config.apiKey;
|
|
39
52
|
|
|
40
53
|
if (!key || key === "" || key.includes("YOUR_")) {
|
|
54
|
+
if (__DEV__) {
|
|
55
|
+
console.log('[DEBUG ApiKeyResolver] No valid production API key');
|
|
56
|
+
}
|
|
41
57
|
return null;
|
|
42
58
|
}
|
|
43
59
|
|
|
60
|
+
if (__DEV__) {
|
|
61
|
+
console.log('[DEBUG ApiKeyResolver] Using production API key');
|
|
62
|
+
}
|
|
63
|
+
|
|
44
64
|
return key;
|
|
45
65
|
}
|