@umituz/react-native-ai-generation-content 1.74.1 → 1.74.3
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 +1 -1
- package/src/domains/generation/wizard/presentation/components/GenericWizardFlow.tsx +1 -0
- package/src/domains/generation/wizard/presentation/components/WizardFlow.types.ts +6 -0
- package/src/domains/generation/wizard/presentation/components/WizardFlowContent.tsx +1 -0
- package/src/domains/generation/wizard/presentation/components/WizardStepRenderer.tsx +1 -1
- package/src/domains/generation/wizard/presentation/components/step-renderers/renderTextInputStep.tsx +4 -0
- package/src/domains/generation/wizard/presentation/screens/TextInputScreen.tsx +4 -2
- package/src/domains/generation/wizard/presentation/screens/TextInputScreen.types.ts +2 -0
- package/src/domains/image-to-video/presentation/screens/ImageToVideoWizardFlow.tsx +4 -1
- package/src/domains/text-to-image/presentation/screens/TextToImageWizardFlow.tsx +4 -1
- package/src/domains/text-to-video/presentation/screens/TextToVideoWizardFlow.tsx +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.74.
|
|
3
|
+
"version": "1.74.3",
|
|
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",
|
|
@@ -35,6 +35,7 @@ export interface GenericWizardFlowProps {
|
|
|
35
35
|
readonly onGenerationStart?: (
|
|
36
36
|
data: Record<string, unknown>,
|
|
37
37
|
proceedToGenerating: () => void,
|
|
38
|
+
onError?: (error: string) => void,
|
|
38
39
|
) => void;
|
|
39
40
|
readonly onGenerationComplete?: (result: unknown) => void;
|
|
40
41
|
readonly onGenerationError?: (error: string, errorInfo?: GenerationErrorInfo) => void;
|
|
@@ -28,6 +28,12 @@ export interface BaseWizardFlowProps {
|
|
|
28
28
|
readonly calculateCredits?: CreditCalculatorFn;
|
|
29
29
|
/** Called when network is unavailable and generation is blocked */
|
|
30
30
|
readonly onNetworkError?: () => void;
|
|
31
|
+
/** Called when generation starts - APP handles credit deduction here */
|
|
32
|
+
readonly onGenerationStart?: (
|
|
33
|
+
data: Record<string, unknown>,
|
|
34
|
+
proceedToGenerating: () => void,
|
|
35
|
+
onError?: (error: string) => void,
|
|
36
|
+
) => void;
|
|
31
37
|
/** Called when generation completes */
|
|
32
38
|
readonly onGenerationComplete?: () => void;
|
|
33
39
|
/** Called on generation error with refund eligibility info */
|
|
@@ -36,6 +36,7 @@ export interface WizardFlowContentProps {
|
|
|
36
36
|
readonly onGenerationStart?: (
|
|
37
37
|
data: Record<string, unknown>,
|
|
38
38
|
proceedToGenerating: () => void,
|
|
39
|
+
onError?: (error: string) => void,
|
|
39
40
|
) => void;
|
|
40
41
|
readonly onGenerationComplete?: (result: unknown) => void;
|
|
41
42
|
readonly onGenerationError?: (error: string) => void;
|
|
@@ -93,7 +93,7 @@ export const WizardStepRenderer: React.FC<WizardStepRendererProps> = ({
|
|
|
93
93
|
return renderPhotoUploadStep({ key: step.id, step, customData, onBack, onPhotoContinue, t, creditCost });
|
|
94
94
|
|
|
95
95
|
case StepType.TEXT_INPUT:
|
|
96
|
-
return renderTextInputStep({ key: step.id, step, customData, onBack, onPhotoContinue, t, alertMessages });
|
|
96
|
+
return renderTextInputStep({ key: step.id, step, customData, onBack, onPhotoContinue, t, alertMessages, creditCost });
|
|
97
97
|
|
|
98
98
|
case StepType.FEATURE_SELECTION:
|
|
99
99
|
return renderSelectionStep({ key: step.id, step, customData, onBack, onPhotoContinue, t, creditCost });
|
package/src/domains/generation/wizard/presentation/components/step-renderers/renderTextInputStep.tsx
CHANGED
|
@@ -17,6 +17,8 @@ export interface TextInputStepProps {
|
|
|
17
17
|
readonly onPhotoContinue: (stepId: string, image: UploadedImage) => void;
|
|
18
18
|
readonly t: (key: string) => string;
|
|
19
19
|
readonly alertMessages?: AlertMessages;
|
|
20
|
+
/** Calculated credit cost from parent */
|
|
21
|
+
readonly creditCost?: number;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export function renderTextInputStep({
|
|
@@ -26,6 +28,7 @@ export function renderTextInputStep({
|
|
|
26
28
|
onPhotoContinue,
|
|
27
29
|
t,
|
|
28
30
|
alertMessages,
|
|
31
|
+
creditCost,
|
|
29
32
|
}: TextInputStepProps): React.ReactElement {
|
|
30
33
|
const textConfig = getTextInputConfig(step.config);
|
|
31
34
|
const titleKey = textConfig?.titleKey ?? `wizard.steps.${step.id}.title`;
|
|
@@ -53,6 +56,7 @@ export function renderTextInputStep({
|
|
|
53
56
|
multiline: textConfig?.multiline !== undefined ? textConfig.multiline : true,
|
|
54
57
|
}}
|
|
55
58
|
initialValue={existingText}
|
|
59
|
+
creditCost={creditCost}
|
|
56
60
|
onBack={onBack}
|
|
57
61
|
onContinue={(text) => {
|
|
58
62
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
AlertType,
|
|
18
18
|
AlertMode,
|
|
19
19
|
} from "@umituz/react-native-design-system";
|
|
20
|
-
import {
|
|
20
|
+
import { WizardContinueButton } from "../components/WizardContinueButton";
|
|
21
21
|
import { contentModerationService } from "../../../../../domains/content-moderation";
|
|
22
22
|
import type { TextInputScreenProps } from "./TextInputScreen.types";
|
|
23
23
|
|
|
@@ -33,6 +33,7 @@ export const TextInputScreen: React.FC<TextInputScreenProps> = ({
|
|
|
33
33
|
config,
|
|
34
34
|
examplePrompts = [],
|
|
35
35
|
initialValue = "",
|
|
36
|
+
creditCost,
|
|
36
37
|
onBack,
|
|
37
38
|
onContinue,
|
|
38
39
|
}) => {
|
|
@@ -99,10 +100,11 @@ export const TextInputScreen: React.FC<TextInputScreenProps> = ({
|
|
|
99
100
|
title=""
|
|
100
101
|
onBackPress={onBack}
|
|
101
102
|
rightElement={
|
|
102
|
-
<
|
|
103
|
+
<WizardContinueButton
|
|
103
104
|
label={translations.continueButton}
|
|
104
105
|
canContinue={canContinue}
|
|
105
106
|
onPress={handleContinue}
|
|
107
|
+
creditCost={creditCost}
|
|
106
108
|
/>
|
|
107
109
|
}
|
|
108
110
|
/>
|
|
@@ -25,6 +25,8 @@ export interface TextInputScreenProps {
|
|
|
25
25
|
readonly config?: TextInputScreenConfig;
|
|
26
26
|
readonly examplePrompts?: string[];
|
|
27
27
|
readonly initialValue?: string;
|
|
28
|
+
/** Calculated credit cost from parent */
|
|
29
|
+
readonly creditCost?: number;
|
|
28
30
|
readonly onBack: () => void;
|
|
29
31
|
readonly onContinue: (text: string) => void;
|
|
30
32
|
}
|
|
@@ -26,6 +26,7 @@ export const ImageToVideoWizardFlow: React.FC<ImageToVideoWizardFlowProps> = (pr
|
|
|
26
26
|
creditCost,
|
|
27
27
|
calculateCredits,
|
|
28
28
|
onNetworkError,
|
|
29
|
+
onGenerationStart: appOnGenerationStart,
|
|
29
30
|
onGenerationComplete,
|
|
30
31
|
onGenerationError,
|
|
31
32
|
onBack,
|
|
@@ -57,12 +58,14 @@ export const ImageToVideoWizardFlow: React.FC<ImageToVideoWizardFlowProps> = (pr
|
|
|
57
58
|
|
|
58
59
|
const defaultAlerts = useMemo(() => createDefaultAlerts(t), [t]);
|
|
59
60
|
|
|
60
|
-
const { handleGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
|
|
61
|
+
const { handleGenerationStart: defaultGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
|
|
61
62
|
requireFeature,
|
|
62
63
|
onGenerationComplete,
|
|
63
64
|
onBack,
|
|
64
65
|
});
|
|
65
66
|
|
|
67
|
+
const handleGenerationStart = appOnGenerationStart ?? defaultGenerationStart;
|
|
68
|
+
|
|
66
69
|
return (
|
|
67
70
|
<View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
|
|
68
71
|
<GenericWizardFlow
|
|
@@ -25,6 +25,7 @@ export const TextToImageWizardFlow: React.FC<TextToImageWizardFlowProps> = (prop
|
|
|
25
25
|
creditCost,
|
|
26
26
|
calculateCredits,
|
|
27
27
|
onNetworkError,
|
|
28
|
+
onGenerationStart: appOnGenerationStart,
|
|
28
29
|
onGenerationComplete,
|
|
29
30
|
onGenerationError,
|
|
30
31
|
onBack,
|
|
@@ -58,12 +59,14 @@ export const TextToImageWizardFlow: React.FC<TextToImageWizardFlowProps> = (prop
|
|
|
58
59
|
[model, t]
|
|
59
60
|
);
|
|
60
61
|
|
|
61
|
-
const { handleGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
|
|
62
|
+
const { handleGenerationStart: defaultGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
|
|
62
63
|
requireFeature,
|
|
63
64
|
onGenerationComplete,
|
|
64
65
|
onBack,
|
|
65
66
|
});
|
|
66
67
|
|
|
68
|
+
const handleGenerationStart = appOnGenerationStart ?? defaultGenerationStart;
|
|
69
|
+
|
|
67
70
|
return (
|
|
68
71
|
<View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
|
|
69
72
|
<GenericWizardFlow
|
|
@@ -26,6 +26,7 @@ export const TextToVideoWizardFlow: React.FC<TextToVideoWizardFlowProps> = (prop
|
|
|
26
26
|
creditCost,
|
|
27
27
|
calculateCredits,
|
|
28
28
|
onNetworkError,
|
|
29
|
+
onGenerationStart: appOnGenerationStart,
|
|
29
30
|
onGenerationComplete,
|
|
30
31
|
onGenerationError,
|
|
31
32
|
onBack,
|
|
@@ -57,12 +58,16 @@ export const TextToVideoWizardFlow: React.FC<TextToVideoWizardFlowProps> = (prop
|
|
|
57
58
|
|
|
58
59
|
const defaultAlerts = useMemo(() => createDefaultAlerts(t), [t]);
|
|
59
60
|
|
|
60
|
-
const { handleGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
|
|
61
|
+
const { handleGenerationStart: defaultGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
|
|
61
62
|
requireFeature,
|
|
62
63
|
onGenerationComplete,
|
|
63
64
|
onBack,
|
|
64
65
|
});
|
|
65
66
|
|
|
67
|
+
// Use app's onGenerationStart if provided (handles credit deduction),
|
|
68
|
+
// otherwise use default (just requireFeature check)
|
|
69
|
+
const handleGenerationStart = appOnGenerationStart ?? defaultGenerationStart;
|
|
70
|
+
|
|
66
71
|
return (
|
|
67
72
|
<View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
|
|
68
73
|
<GenericWizardFlow
|