@umituz/react-native-subscription 2.37.89 → 2.37.91
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.37.
|
|
3
|
+
"version": "2.37.91",
|
|
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",
|
|
@@ -199,8 +199,11 @@ export async function handleInitialConfiguration(
|
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
// Sync premium status via callback (if configured)
|
|
203
|
-
|
|
202
|
+
// Sync premium status via callback (if configured).
|
|
203
|
+
// Only when we have a real Firebase UID — skip for pre-auth anonymous state
|
|
204
|
+
// to avoid writing to Firestore with a RevenueCat-generated ID that doesn't
|
|
205
|
+
// match request.auth.uid.
|
|
206
|
+
if (deps.config.onPremiumStatusChanged && normalizedUserId) {
|
|
204
207
|
try {
|
|
205
208
|
const premiumEntitlement = getPremiumEntitlement(
|
|
206
209
|
customerInfo,
|
|
@@ -209,7 +212,7 @@ export async function handleInitialConfiguration(
|
|
|
209
212
|
|
|
210
213
|
if (premiumEntitlement) {
|
|
211
214
|
await deps.config.onPremiumStatusChanged(
|
|
212
|
-
|
|
215
|
+
normalizedUserId,
|
|
213
216
|
true,
|
|
214
217
|
premiumEntitlement.productIdentifier,
|
|
215
218
|
premiumEntitlement.expirationDate ?? undefined,
|
|
@@ -218,7 +221,7 @@ export async function handleInitialConfiguration(
|
|
|
218
221
|
);
|
|
219
222
|
} else {
|
|
220
223
|
await deps.config.onPremiumStatusChanged(
|
|
221
|
-
|
|
224
|
+
normalizedUserId,
|
|
222
225
|
false,
|
|
223
226
|
undefined,
|
|
224
227
|
undefined,
|
|
@@ -74,6 +74,15 @@ export async function startBackgroundInitialization(config: SubscriptionInitConf
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
debounceTimer = setTimeout(async () => {
|
|
77
|
+
// Don't initialize when there's no user and no previous user.
|
|
78
|
+
// This is the initial signed-out state before auth resolves, not a logout.
|
|
79
|
+
if (!revenueCatUserId && !lastUserId) {
|
|
80
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
81
|
+
console.log('[BackgroundInitializer] No user and no previous user, waiting for auth');
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
77
86
|
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
78
87
|
console.log('[BackgroundInitializer] Auth state listener triggered, reinitializing with userId:', revenueCatUserId || '(undefined - anonymous)');
|
|
79
88
|
}
|