@umituz/react-native-ai-generation-content 1.83.7 → 1.83.9
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.9",
|
|
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",
|
|
@@ -109,6 +109,8 @@ export function usePhotoBlockingGeneration(
|
|
|
109
109
|
const duration = typeof inputData?.duration === "number" ? inputData.duration : undefined;
|
|
110
110
|
const resolution = typeof inputData?.resolution === "string" ? inputData.resolution : undefined;
|
|
111
111
|
|
|
112
|
+
const aspectRatio = typeof inputData?.aspectRatio === "string" ? inputData.aspectRatio : undefined;
|
|
113
|
+
|
|
112
114
|
const result = await persistence.saveAsProcessing(userId, {
|
|
113
115
|
scenarioId: scenario.id,
|
|
114
116
|
scenarioTitle: scenario.title || scenario.id,
|
|
@@ -116,6 +118,9 @@ export function usePhotoBlockingGeneration(
|
|
|
116
118
|
duration,
|
|
117
119
|
resolution,
|
|
118
120
|
creditCost,
|
|
121
|
+
aspectRatio,
|
|
122
|
+
provider: "fal",
|
|
123
|
+
outputType: scenario.outputType,
|
|
119
124
|
});
|
|
120
125
|
creationIdRef.current = result.creationId;
|
|
121
126
|
|
|
@@ -132,7 +137,7 @@ export function usePhotoBlockingGeneration(
|
|
|
132
137
|
// Start blocking generation
|
|
133
138
|
await generate(input);
|
|
134
139
|
},
|
|
135
|
-
[userId, scenario, persistence, generate],
|
|
140
|
+
[userId, scenario, persistence, creditCost, generate],
|
|
136
141
|
);
|
|
137
142
|
|
|
138
143
|
return { isGenerating, startGeneration };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
1
|
+
import { useCallback, useRef } from "react";
|
|
2
2
|
import { AlertType, AlertMode, useAlert } from "@umituz/react-native-design-system";
|
|
3
3
|
import { StepType, type StepDefinition } from "../../../../../domain/entities/flow-config.types";
|
|
4
4
|
import type { UploadedImage } from "../../../../../presentation/hooks/generation/useAIGenerateState";
|
|
@@ -53,9 +53,12 @@ export function useWizardFlowHandlers(props: UseWizardFlowHandlersProps) {
|
|
|
53
53
|
} = props;
|
|
54
54
|
|
|
55
55
|
const alert = useAlert();
|
|
56
|
+
// Guard: prevent multiple onGenerationStart calls from auto-advancing steps
|
|
57
|
+
const generationStartedRef = useRef(false);
|
|
56
58
|
|
|
57
59
|
const handleGenerationComplete = useCallback(
|
|
58
60
|
(result: unknown) => {
|
|
61
|
+
generationStartedRef.current = false;
|
|
59
62
|
setResult(result);
|
|
60
63
|
setCurrentCreation(isCreation(result) ? result : null);
|
|
61
64
|
onGenerationComplete?.(result);
|
|
@@ -66,6 +69,7 @@ export function useWizardFlowHandlers(props: UseWizardFlowHandlersProps) {
|
|
|
66
69
|
|
|
67
70
|
const handleGenerationError = useCallback(
|
|
68
71
|
(errorMessage: string) => {
|
|
72
|
+
generationStartedRef.current = false;
|
|
69
73
|
const safeErrorMessage = errorMessage?.trim() || "error.generation.unknown";
|
|
70
74
|
const displayMessage = safeErrorMessage.startsWith("error.") ? t(safeErrorMessage) : safeErrorMessage;
|
|
71
75
|
|
|
@@ -112,6 +116,8 @@ export function useWizardFlowHandlers(props: UseWizardFlowHandlersProps) {
|
|
|
112
116
|
});
|
|
113
117
|
}
|
|
114
118
|
if (nextStepDef?.type === StepType.GENERATING && onGenerationStart) {
|
|
119
|
+
if (generationStartedRef.current) return;
|
|
120
|
+
generationStartedRef.current = true;
|
|
115
121
|
onGenerationStart(mergedData, nextStep, handleGenerationError);
|
|
116
122
|
return;
|
|
117
123
|
}
|