@umituz/react-native-subscription 2.26.12 → 2.26.13
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.26.
|
|
3
|
+
"version": "2.26.13",
|
|
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",
|
|
@@ -41,6 +41,8 @@ export interface UseCreditsGateResult {
|
|
|
41
41
|
requireCredits: (action: () => void | Promise<void>) => boolean;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
declare const __DEV__: boolean;
|
|
45
|
+
|
|
44
46
|
export function useCreditsGate(
|
|
45
47
|
params: UseCreditsGateParams
|
|
46
48
|
): UseCreditsGateResult {
|
|
@@ -49,13 +51,26 @@ export function useCreditsGate(
|
|
|
49
51
|
|
|
50
52
|
const requireCredits = useCallback(
|
|
51
53
|
(_action: () => void | Promise<void>): boolean => {
|
|
54
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
55
|
+
console.log("[useCreditsGate] requireCredits called", {
|
|
56
|
+
hasCredits,
|
|
57
|
+
creditBalance,
|
|
58
|
+
requiredCredits,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
52
61
|
if (!hasCredits) {
|
|
62
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
63
|
+
console.log("[useCreditsGate] No credits, showing paywall");
|
|
64
|
+
}
|
|
53
65
|
onCreditsRequired(requiredCredits);
|
|
54
66
|
return false;
|
|
55
67
|
}
|
|
68
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
69
|
+
console.log("[useCreditsGate] Has credits, allowing action");
|
|
70
|
+
}
|
|
56
71
|
return true;
|
|
57
72
|
},
|
|
58
|
-
[hasCredits, requiredCredits, onCreditsRequired]
|
|
73
|
+
[hasCredits, creditBalance, requiredCredits, onCreditsRequired]
|
|
59
74
|
);
|
|
60
75
|
|
|
61
76
|
return {
|
|
@@ -123,6 +123,14 @@ export function useFeatureGate(
|
|
|
123
123
|
|
|
124
124
|
const requireFeature = useCallback(
|
|
125
125
|
(action: () => void | Promise<void>) => {
|
|
126
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
127
|
+
console.log("[useFeatureGate] requireFeature called", {
|
|
128
|
+
isAuthenticated,
|
|
129
|
+
hasSubscription,
|
|
130
|
+
hasCredits,
|
|
131
|
+
creditBalance,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
126
134
|
|
|
127
135
|
// Step 1: Auth check
|
|
128
136
|
if (!authGate.requireAuth(() => {})) {
|