@umituz/react-native-subscription 2.27.33 → 2.27.34

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.33",
3
+ "version": "2.27.34",
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",
@@ -38,7 +38,24 @@ const waitForAuthState = async (getAuth: () => FirebaseAuthLike | null, timeoutM
38
38
  export const initializeSubscription = async (config: SubscriptionInitConfig): Promise<void> => {
39
39
  const { apiKey, apiKeyIos, apiKeyAndroid, testStoreKey, entitlementId, credits, getAnonymousUserId, getFirebaseAuth, showAuthModal, onCreditsUpdated, creditPackages, timeoutMs = 10000, authStateTimeoutMs = 2000 } = config;
40
40
 
41
+ if (__DEV__) {
42
+ console.log('[DEBUG initializeSubscription] Config received:', {
43
+ hasApiKey: !!apiKey,
44
+ hasApiKeyIos: !!apiKeyIos,
45
+ hasApiKeyAndroid: !!apiKeyAndroid,
46
+ hasTestStoreKey: !!testStoreKey,
47
+ apiKeyPrefix: apiKey?.substring(0, 10),
48
+ testStoreKeyPrefix: testStoreKey?.substring(0, 10),
49
+ platform: Platform.OS,
50
+ });
51
+ }
52
+
41
53
  const key = Platform.OS === "ios" ? (apiKeyIos || apiKey || "") : (apiKeyAndroid || apiKey || "");
54
+
55
+ if (__DEV__) {
56
+ console.log('[DEBUG initializeSubscription] Resolved key:', key ? key.substring(0, 10) + '...' : 'empty');
57
+ }
58
+
42
59
  if (!key) throw new Error("API key required");
43
60
 
44
61
  configureCreditsRepository({ ...credits, creditPackageAmounts: creditPackages?.amounts });
@@ -188,6 +205,15 @@ export const initializeSubscription = async (config: SubscriptionInitConfig): Pr
188
205
  }
189
206
  };
190
207
 
208
+ if (__DEV__) {
209
+ console.log('[DEBUG initializeSubscription] Configuring SubscriptionManager with:', {
210
+ apiKeyPrefix: key.substring(0, 10),
211
+ hasTestStoreKey: !!testStoreKey,
212
+ testStoreKeyPrefix: testStoreKey?.substring(0, 10),
213
+ entitlementId,
214
+ });
215
+ }
216
+
191
217
  SubscriptionManager.configure({
192
218
  config: {
193
219
  apiKey: key,
@@ -121,9 +121,25 @@ export async function initializeSDK(
121
121
  return { success: false, offering: null, hasPremium: false };
122
122
  }
123
123
 
124
+ if (__DEV__) {
125
+ console.log('[DEBUG RevenueCatInitializer] Config received:', {
126
+ hasApiKey: !!deps.config.apiKey,
127
+ hasTestStoreKey: !!deps.config.testStoreKey,
128
+ apiKeyPrefix: deps.config.apiKey?.substring(0, 10),
129
+ testStoreKeyPrefix: deps.config.testStoreKey?.substring(0, 10),
130
+ });
131
+ }
132
+
124
133
  const key = apiKey || resolveApiKey(deps.config);
125
134
 
135
+ if (__DEV__) {
136
+ console.log('[DEBUG RevenueCatInitializer] Resolved key:', key ? key.substring(0, 10) + '...' : 'null');
137
+ }
138
+
126
139
  if (!key) {
140
+ if (__DEV__) {
141
+ console.log('[DEBUG RevenueCatInitializer] No API key available, returning failure');
142
+ }
127
143
  return { success: false, offering: null, hasPremium: false };
128
144
  }
129
145
 
@@ -7,6 +7,8 @@
7
7
  import type { RevenueCatConfig } from '../../domain/value-objects/RevenueCatConfig';
8
8
  import { isTestStoreEnvironment } from "./ExpoGoDetector";
9
9
 
10
+ declare const __DEV__: boolean;
11
+
10
12
  /**
11
13
  * Check if Test Store key should be used
12
14
  * CRITICAL: Never use test store in production builds
@@ -31,15 +33,33 @@ export function shouldUseTestStore(config: RevenueCatConfig): boolean {
31
33
  export function resolveApiKey(config: RevenueCatConfig): string | null {
32
34
  const useTestStore = shouldUseTestStore(config);
33
35
 
36
+ if (__DEV__) {
37
+ console.log('[DEBUG resolveApiKey] called', {
38
+ useTestStore,
39
+ hasTestStoreKey: !!config.testStoreKey,
40
+ hasApiKey: !!config.apiKey,
41
+ apiKeyPrefix: config.apiKey?.substring(0, 10),
42
+ });
43
+ }
44
+
34
45
  if (useTestStore) {
46
+ if (__DEV__) {
47
+ console.log('[DEBUG resolveApiKey] Using test store key');
48
+ }
35
49
  return config.testStoreKey ?? null;
36
50
  }
37
51
 
38
52
  const key = config.apiKey;
39
53
 
40
54
  if (!key || key === "" || key.includes("YOUR_")) {
55
+ if (__DEV__) {
56
+ console.log('[DEBUG resolveApiKey] No valid API key found');
57
+ }
41
58
  return null;
42
59
  }
43
60
 
61
+ if (__DEV__) {
62
+ console.log('[DEBUG resolveApiKey] Using production API key:', key.substring(0, 10) + '...');
63
+ }
44
64
  return key;
45
65
  }