@umituz/react-native-ai-generation-content 1.61.59 → 1.61.61
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.61.
|
|
3
|
+
"version": "1.61.61",
|
|
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",
|
|
@@ -89,6 +89,10 @@ export function useAIFeatureGate(
|
|
|
89
89
|
onNetworkError?.();
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
+
// Wait for credits to load before proceeding
|
|
93
|
+
if (!isCreditsLoaded) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
92
96
|
// Then auth/credit checks via subscription package
|
|
93
97
|
requireFeatureFromPackage(() => {
|
|
94
98
|
const result = action();
|
|
@@ -105,7 +109,7 @@ export function useAIFeatureGate(
|
|
|
105
109
|
}
|
|
106
110
|
});
|
|
107
111
|
},
|
|
108
|
-
[isOffline, onNetworkError, requireFeatureFromPackage, onSuccess, onError],
|
|
112
|
+
[isOffline, isCreditsLoaded, onNetworkError, requireFeatureFromPackage, onSuccess, onError],
|
|
109
113
|
);
|
|
110
114
|
|
|
111
115
|
return {
|
|
@@ -58,6 +58,9 @@ export const useGenerationOrchestrator = <TInput, TResult>(
|
|
|
58
58
|
|
|
59
59
|
const executeGeneration = useCallback(
|
|
60
60
|
async (input: TInput) => {
|
|
61
|
+
const creditDeducted = await deductCredit(strategy.getCreditCost());
|
|
62
|
+
if (!creditDeducted) throw createGenerationError("credits", alertMessages.creditFailed);
|
|
63
|
+
|
|
61
64
|
setState((prev) => ({ ...prev, status: "generating" }));
|
|
62
65
|
if (typeof __DEV__ !== "undefined" && __DEV__) console.log("[Orchestrator] Starting generation");
|
|
63
66
|
|
|
@@ -72,9 +75,6 @@ export const useGenerationOrchestrator = <TInput, TResult>(
|
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
const creditDeducted = await deductCredit(strategy.getCreditCost());
|
|
76
|
-
if (!creditDeducted) throw createGenerationError("credits", alertMessages.creditFailed);
|
|
77
|
-
|
|
78
78
|
if (isMountedRef.current) setState({ status: "success", isGenerating: false, result, error: null });
|
|
79
79
|
if (typeof __DEV__ !== "undefined" && __DEV__) console.log("[Orchestrator] Generation SUCCESS");
|
|
80
80
|
|