@umituz/react-native-subscription 2.17.5 → 2.17.6
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.17.
|
|
3
|
+
"version": "2.17.6",
|
|
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",
|
|
@@ -92,33 +92,10 @@ export function useCompletePendingPurchase({
|
|
|
92
92
|
}
|
|
93
93
|
}, [userId, purchasePackage, clearPendingPurchase, closePaywall, onPurchaseSuccess, onPurchaseError]);
|
|
94
94
|
|
|
95
|
-
//
|
|
95
|
+
// Track auth state for reference (no auto-trigger - caller must explicitly call completePendingPurchase)
|
|
96
96
|
useEffect(() => {
|
|
97
|
-
const wasAnonymous = wasAnonymousRef.current;
|
|
98
|
-
const isNowAuthenticated = userId && !isAnonymous;
|
|
99
97
|
wasAnonymousRef.current = isAnonymous;
|
|
100
|
-
|
|
101
|
-
if (__DEV__) {
|
|
102
|
-
console.log("[CompletePendingPurchase] Auth state check:", {
|
|
103
|
-
wasAnonymous,
|
|
104
|
-
isNowAuthenticated,
|
|
105
|
-
hasPending: pendingPurchaseControl.hasPending(),
|
|
106
|
-
pendingId: pendingPurchaseControl.get().package?.product.identifier,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Only trigger if user just authenticated AND there's a pending purchase
|
|
111
|
-
if (wasAnonymous && isNowAuthenticated && pendingPurchaseControl.hasPending()) {
|
|
112
|
-
if (__DEV__) {
|
|
113
|
-
console.log("[CompletePendingPurchase] Auth completed, auto-completing purchase");
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Execute in next microtask to ensure React state updates are flushed
|
|
117
|
-
queueMicrotask(() => {
|
|
118
|
-
completePendingPurchase();
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
}, [userId, isAnonymous, completePendingPurchase]);
|
|
98
|
+
}, [isAnonymous]);
|
|
122
99
|
|
|
123
100
|
return {
|
|
124
101
|
completePendingPurchase,
|