@umituz/react-native-ai-generation-content 1.72.8 → 1.72.10
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-ai-generation-content",
|
|
3
|
-
"version": "1.72.
|
|
3
|
+
"version": "1.72.10",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@typescript-eslint/parser": "^8.54.0",
|
|
72
72
|
"@umituz/react-native-design-system": "latest",
|
|
73
73
|
"@umituz/react-native-firebase": "latest",
|
|
74
|
-
"@umituz/react-native-subscription": "
|
|
74
|
+
"@umituz/react-native-subscription": "^2.35.3",
|
|
75
75
|
"eslint": "^9.39.2",
|
|
76
76
|
"eslint-plugin-react": "^7.37.5",
|
|
77
77
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
@@ -79,7 +79,7 @@ export function useAIFeatureGate(options: AIFeatureGateOptions): AIFeatureGateRe
|
|
|
79
79
|
);
|
|
80
80
|
|
|
81
81
|
const requireFeature = useCallback(
|
|
82
|
-
(action: () => void | Promise<void>):
|
|
82
|
+
(action: () => void | Promise<void>): boolean => {
|
|
83
83
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
84
84
|
console.log("[AIFeatureGate] requireFeature called:", {
|
|
85
85
|
isOffline,
|
|
@@ -97,26 +97,28 @@ export function useAIFeatureGate(options: AIFeatureGateOptions): AIFeatureGateRe
|
|
|
97
97
|
console.log("[AIFeatureGate] BLOCKED: User is offline");
|
|
98
98
|
}
|
|
99
99
|
onNetworkError?.();
|
|
100
|
-
return;
|
|
100
|
+
return false;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
if (isAuthenticated && !isCreditsLoaded) {
|
|
104
104
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
105
105
|
console.log("[AIFeatureGate] BLOCKED: User authenticated but credits not loaded yet");
|
|
106
106
|
}
|
|
107
|
-
return;
|
|
107
|
+
return false;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
111
111
|
console.log("[AIFeatureGate] Calling requireFeatureFromPackage");
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
requireFeatureFromPackage(() => {
|
|
114
|
+
const executed = requireFeatureFromPackage(() => {
|
|
115
115
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
116
116
|
console.log("[AIFeatureGate] Inside requireFeatureFromPackage callback - executing action");
|
|
117
117
|
}
|
|
118
118
|
handlePromiseResult(action(), onSuccess, onError);
|
|
119
119
|
});
|
|
120
|
+
|
|
121
|
+
return executed;
|
|
120
122
|
},
|
|
121
123
|
[isOffline, isAuthenticated, isCreditsLoaded, isPremium, creditBalance, creditCost, hasCredits, onNetworkError, requireFeatureFromPackage, onSuccess, onError],
|
|
122
124
|
);
|
|
@@ -34,8 +34,9 @@ export interface AIFeatureGateReturn {
|
|
|
34
34
|
/**
|
|
35
35
|
* Function to execute protected feature
|
|
36
36
|
* Handles all access control checks (auth, premium, credits, paywall)
|
|
37
|
+
* @returns true if action was executed, false if blocked by gate
|
|
37
38
|
*/
|
|
38
|
-
requireFeature: (action: () => void | Promise<void>) =>
|
|
39
|
+
requireFeature: (action: () => void | Promise<void>) => boolean;
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* Whether user can access this feature (all checks passed)
|