@umituz/react-native-subscription 2.24.3 → 2.24.4
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.24.
|
|
3
|
+
"version": "2.24.4",
|
|
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",
|
|
@@ -99,7 +99,26 @@ export function useFeatureGate(
|
|
|
99
99
|
|
|
100
100
|
// Step 1: Auth check
|
|
101
101
|
if (!authGate.requireAuth(() => {})) {
|
|
102
|
-
|
|
102
|
+
// Wrap action to re-check credits after auth succeeds
|
|
103
|
+
const postAuthAction = () => {
|
|
104
|
+
// Step 2: Subscription check (bypasses credits if subscribed)
|
|
105
|
+
if (hasSubscription) {
|
|
106
|
+
action();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Step 3: Credits check
|
|
111
|
+
if (!hasCredits) {
|
|
112
|
+
pendingActionRef.current = action;
|
|
113
|
+
isWaitingForPurchaseRef.current = true;
|
|
114
|
+
onShowPaywall(requiredCredits);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// All checks passed
|
|
119
|
+
action();
|
|
120
|
+
};
|
|
121
|
+
onShowAuthModal(postAuthAction);
|
|
103
122
|
return;
|
|
104
123
|
}
|
|
105
124
|
|
|
@@ -124,7 +143,10 @@ export function useFeatureGate(
|
|
|
124
143
|
authGate,
|
|
125
144
|
creditsGate,
|
|
126
145
|
hasSubscription,
|
|
146
|
+
hasCredits,
|
|
147
|
+
requiredCredits,
|
|
127
148
|
onShowAuthModal,
|
|
149
|
+
onShowPaywall,
|
|
128
150
|
]
|
|
129
151
|
);
|
|
130
152
|
|