@umituz/react-native-ai-generation-content 1.83.13 → 1.83.15
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.83.
|
|
3
|
+
"version": "1.83.15",
|
|
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",
|
|
@@ -16,7 +16,7 @@ interface ModerationHandlerParams<TInput, TResult> {
|
|
|
16
16
|
readonly resetState: () => void;
|
|
17
17
|
readonly executeGeneration: (input: TInput) => Promise<TResult>;
|
|
18
18
|
readonly showError: (title: string, message: string) => void;
|
|
19
|
-
readonly onError?: (error: GenerationError) => void
|
|
19
|
+
readonly onError?: (error: GenerationError) => void | Promise<void>;
|
|
20
20
|
readonly handleLifecycleComplete: (status: "success" | "error", result?: TResult, error?: GenerationError) => void;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -54,13 +54,13 @@ export async function handleModeration<TInput, TResult>(
|
|
|
54
54
|
},
|
|
55
55
|
() => {
|
|
56
56
|
// Return the promise to allow proper error handling chain
|
|
57
|
-
return executeGeneration(input).catch((err) => {
|
|
57
|
+
return executeGeneration(input).catch(async (err) => {
|
|
58
58
|
const error = parseError(err);
|
|
59
59
|
if (isMountedRef.current) {
|
|
60
60
|
setState({ status: "error", isGenerating: false, result: null, error });
|
|
61
61
|
}
|
|
62
62
|
showError("Error", getAlertMessage(error, alertMessages));
|
|
63
|
-
onError?.(error);
|
|
63
|
+
await onError?.(error);
|
|
64
64
|
handleLifecycleComplete("error", undefined, error);
|
|
65
65
|
throw error; // Re-throw to allow caller to handle
|
|
66
66
|
}).finally(() => {
|
|
@@ -109,7 +109,7 @@ export const useGenerationOrchestrator = <TInput, TResult>(
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
if (alertMessages.success) showSuccess("Success", alertMessages.success);
|
|
112
|
-
onSuccess?.(result);
|
|
112
|
+
await onSuccess?.(result);
|
|
113
113
|
handleLifecycleComplete("success", result);
|
|
114
114
|
return result;
|
|
115
115
|
},
|
|
@@ -201,7 +201,7 @@ export const useGenerationOrchestrator = <TInput, TResult>(
|
|
|
201
201
|
if (typeof __DEV__ !== "undefined" && __DEV__) console.log("[Orchestrator] Error:", error);
|
|
202
202
|
if (isMountedRef.current) setState({ status: "error", isGenerating: false, result: null, error });
|
|
203
203
|
showError("Error", getAlertMessage(error, alertMessages));
|
|
204
|
-
onError?.(error);
|
|
204
|
+
await onError?.(error);
|
|
205
205
|
handleLifecycleComplete("error", undefined, error);
|
|
206
206
|
throw error;
|
|
207
207
|
} finally {
|
|
@@ -54,8 +54,8 @@ export interface LifecycleConfig {
|
|
|
54
54
|
export interface GenerationConfig {
|
|
55
55
|
readonly userId: string | undefined;
|
|
56
56
|
readonly alertMessages: AlertMessages;
|
|
57
|
-
readonly onSuccess?: (result: unknown) => void
|
|
58
|
-
readonly onError?: (error: GenerationError) => void
|
|
57
|
+
readonly onSuccess?: (result: unknown) => void | Promise<void>;
|
|
58
|
+
readonly onError?: (error: GenerationError) => void | Promise<void>;
|
|
59
59
|
readonly moderation?: ModerationCallbacks;
|
|
60
60
|
readonly lifecycle?: LifecycleConfig;
|
|
61
61
|
}
|