@umituz/react-native-ai-generation-content 1.37.8 → 1.37.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 +1 -1
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +5 -22
- package/src/domains/creations/presentation/screens/creations-gallery.styles.ts +11 -0
- package/src/domains/creations/presentation/screens/creations-gallery.types.ts +18 -0
- package/src/domains/generation/infrastructure/flow/scenario-configs.ts +69 -0
- package/src/domains/generation/infrastructure/flow/{step-builder.ts → step-builders.ts} +3 -86
- package/src/domains/generation/wizard/configs/image-to-video.config.ts +1 -1
- package/src/domains/generation/wizard/configs/text-to-image.config.ts +2 -1
- package/src/domains/generation/wizard/configs/text-to-video.config.ts +1 -1
- package/src/domains/generation/wizard/domain/entities/wizard-feature.types.ts +118 -0
- package/src/domains/generation/wizard/domain/entities/wizard-step.types.ts +96 -0
- package/src/domains/generation/wizard/index.ts +7 -3
- package/src/domains/generation/wizard/infrastructure/builders/dynamic-step-builder.ts +2 -5
- package/src/domains/generation/wizard/infrastructure/utils/index.ts +4 -1
- package/src/domains/generation/wizard/infrastructure/utils/primitive-extractors.ts +119 -0
- package/src/domains/generation/wizard/infrastructure/utils/wizard-field-extractors.ts +65 -0
- package/src/domains/generation/wizard/presentation/components/GenericWizardFlow.tsx +1 -1
- package/src/domains/generation/wizard/presentation/components/WizardFlowContent.tsx +1 -1
- package/src/domains/generation/wizard/presentation/components/WizardStepRenderer.utils.ts +1 -1
- package/src/domains/generation/wizard/presentation/hooks/useWizardGeneration.ts +17 -50
- package/src/domains/generation/wizard/presentation/hooks/wizard-generation.types.ts +39 -0
- package/src/domains/scenarios/configs/wizard-config-resolver.ts +1 -1
- package/src/domains/scenarios/configs/wizard-input.types.ts +1 -1
- package/src/domains/scenarios/configs/wizard-step-factories.ts +1 -1
- package/src/domains/scenarios/domain/scenario.types.ts +3 -24
- package/src/features/image-to-video/presentation/hooks/image-to-video-feature.types.ts +59 -0
- package/src/features/image-to-video/presentation/hooks/useImageToVideoFeature.ts +15 -55
- package/src/domains/generation/wizard/domain/entities/wizard-config.types.ts +0 -230
- package/src/domains/generation/wizard/infrastructure/utils/wizard-data-extractors.ts +0 -232
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.37.
|
|
3
|
+
"version": "1.37.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",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useMemo, useCallback, useEffect, useRef } from "react";
|
|
2
|
-
import { View, FlatList, RefreshControl
|
|
2
|
+
import { View, FlatList, RefreshControl } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
useAppDesignTokens,
|
|
5
5
|
FilterSheet,
|
|
@@ -16,20 +16,10 @@ import { usePendingJobs } from "../../../../presentation/hooks/use-pending-jobs"
|
|
|
16
16
|
import { MEDIA_FILTER_OPTIONS, STATUS_FILTER_OPTIONS } from "../../domain/types/creation-filter";
|
|
17
17
|
import { getPreviewUrl } from "../../domain/utils";
|
|
18
18
|
import type { Creation } from "../../domain/entities/Creation";
|
|
19
|
-
import type {
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
readonly userId: string | null;
|
|
24
|
-
readonly repository: ICreationsRepository;
|
|
25
|
-
readonly config: CreationsConfig;
|
|
26
|
-
readonly t: (key: string) => string;
|
|
27
|
-
readonly initialCreationId?: string;
|
|
28
|
-
readonly onEmptyAction?: () => void;
|
|
29
|
-
readonly emptyActionLabel?: string;
|
|
30
|
-
readonly showFilter?: boolean;
|
|
31
|
-
readonly showPendingJobs?: boolean;
|
|
32
|
-
}
|
|
19
|
+
import type { CreationsGalleryScreenProps } from "./creations-gallery.types";
|
|
20
|
+
import { creationsGalleryStyles as styles } from "./creations-gallery.styles";
|
|
21
|
+
|
|
22
|
+
export type { CreationsGalleryScreenProps } from "./creations-gallery.types";
|
|
33
23
|
|
|
34
24
|
export function CreationsGalleryScreen({
|
|
35
25
|
userId,
|
|
@@ -51,7 +41,6 @@ export function CreationsGalleryScreen({
|
|
|
51
41
|
const { jobs: pendingJobs } = usePendingJobs();
|
|
52
42
|
const deleteMutation = useDeleteCreation({ userId, repository });
|
|
53
43
|
|
|
54
|
-
// Auto-select creation when initialCreationId is provided
|
|
55
44
|
useEffect(() => {
|
|
56
45
|
if (initialCreationId && creations && creations.length > 0 && !hasAutoSelectedRef.current) {
|
|
57
46
|
const creation = creations.find((c) => c.id === initialCreationId);
|
|
@@ -200,9 +189,3 @@ export function CreationsGalleryScreen({
|
|
|
200
189
|
</ScreenLayout>
|
|
201
190
|
);
|
|
202
191
|
}
|
|
203
|
-
|
|
204
|
-
const styles = StyleSheet.create({
|
|
205
|
-
header: { borderBottomWidth: 1 },
|
|
206
|
-
listContent: { paddingHorizontal: 16, paddingTop: 16 },
|
|
207
|
-
emptyContent: { flexGrow: 1 },
|
|
208
|
-
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creations Gallery Screen Styles
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { StyleSheet } from "react-native";
|
|
6
|
+
|
|
7
|
+
export const creationsGalleryStyles = StyleSheet.create({
|
|
8
|
+
header: { borderBottomWidth: 1 },
|
|
9
|
+
listContent: { paddingHorizontal: 16, paddingTop: 16 },
|
|
10
|
+
emptyContent: { flexGrow: 1 },
|
|
11
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creations Gallery Screen Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { CreationsConfig } from "../../domain/value-objects/CreationsConfig";
|
|
6
|
+
import type { ICreationsRepository } from "../../domain/repositories/ICreationsRepository";
|
|
7
|
+
|
|
8
|
+
export interface CreationsGalleryScreenProps {
|
|
9
|
+
readonly userId: string | null;
|
|
10
|
+
readonly repository: ICreationsRepository;
|
|
11
|
+
readonly config: CreationsConfig;
|
|
12
|
+
readonly t: (key: string) => string;
|
|
13
|
+
readonly initialCreationId?: string;
|
|
14
|
+
readonly onEmptyAction?: () => void;
|
|
15
|
+
readonly emptyActionLabel?: string;
|
|
16
|
+
readonly showFilter?: boolean;
|
|
17
|
+
readonly showPendingJobs?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scenario Configurations
|
|
3
|
+
* Pre-defined step configurations for common scenarios
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { ScenarioStepConfig } from "../../../../domain/entities/step-config.types";
|
|
7
|
+
|
|
8
|
+
export const SCENARIO_CONFIGS: Record<string, ScenarioStepConfig> = {
|
|
9
|
+
"romantic-kiss": {
|
|
10
|
+
photoUploads: {
|
|
11
|
+
count: 2,
|
|
12
|
+
labels: ["First Partner", "Second Partner"],
|
|
13
|
+
showFaceDetection: true,
|
|
14
|
+
showNameInput: false,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
"couple-hug": {
|
|
18
|
+
photoUploads: {
|
|
19
|
+
count: 2,
|
|
20
|
+
labels: ["Partner A", "Partner B"],
|
|
21
|
+
showFaceDetection: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
"image-to-video": {
|
|
25
|
+
photoUploads: {
|
|
26
|
+
count: 1,
|
|
27
|
+
labels: ["Your Photo"],
|
|
28
|
+
showFaceDetection: false,
|
|
29
|
+
},
|
|
30
|
+
styleSelection: {
|
|
31
|
+
enabled: true,
|
|
32
|
+
required: true,
|
|
33
|
+
},
|
|
34
|
+
durationSelection: {
|
|
35
|
+
enabled: true,
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
"text-to-video": {
|
|
40
|
+
textInput: {
|
|
41
|
+
enabled: true,
|
|
42
|
+
required: true,
|
|
43
|
+
minLength: 10,
|
|
44
|
+
maxLength: 500,
|
|
45
|
+
},
|
|
46
|
+
styleSelection: {
|
|
47
|
+
enabled: true,
|
|
48
|
+
required: true,
|
|
49
|
+
},
|
|
50
|
+
durationSelection: {
|
|
51
|
+
enabled: true,
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
"advanced-generation": {
|
|
56
|
+
photoUploads: {
|
|
57
|
+
count: 1,
|
|
58
|
+
labels: ["Base Image"],
|
|
59
|
+
},
|
|
60
|
+
textInput: {
|
|
61
|
+
enabled: true,
|
|
62
|
+
required: false,
|
|
63
|
+
},
|
|
64
|
+
styleSelection: {
|
|
65
|
+
enabled: true,
|
|
66
|
+
required: true,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Step Builders
|
|
3
|
+
* Functions for building step definitions from configuration
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { StepType } from "../../../../domain/entities/flow-config.types";
|
|
@@ -12,7 +12,6 @@ import type {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Build steps from scenario configuration
|
|
15
|
-
* Automatically creates photo upload steps, text input, etc. based on config
|
|
16
15
|
*/
|
|
17
16
|
export const buildStepsFromScenario = (
|
|
18
17
|
scenarioId: string,
|
|
@@ -20,7 +19,6 @@ export const buildStepsFromScenario = (
|
|
|
20
19
|
): DynamicStepDefinition[] => {
|
|
21
20
|
const steps: DynamicStepDefinition[] = [];
|
|
22
21
|
|
|
23
|
-
// Add photo upload steps (dynamic count)
|
|
24
22
|
if (config.photoUploads && config.photoUploads.count > 0) {
|
|
25
23
|
for (let i = 0; i < config.photoUploads.count; i++) {
|
|
26
24
|
const photoConfig: PhotoUploadStepConfig = {
|
|
@@ -34,14 +32,13 @@ export const buildStepsFromScenario = (
|
|
|
34
32
|
|
|
35
33
|
steps.push({
|
|
36
34
|
id: `PHOTO_UPLOAD_${i}`,
|
|
37
|
-
type: StepType.PARTNER_UPLOAD,
|
|
35
|
+
type: StepType.PARTNER_UPLOAD,
|
|
38
36
|
config: photoConfig,
|
|
39
37
|
required: true,
|
|
40
38
|
});
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
// Add text input step
|
|
45
42
|
if (config.textInput?.enabled) {
|
|
46
43
|
steps.push({
|
|
47
44
|
id: "TEXT_INPUT",
|
|
@@ -56,7 +53,6 @@ export const buildStepsFromScenario = (
|
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
55
|
|
|
59
|
-
// Add style selection step
|
|
60
56
|
if (config.styleSelection?.enabled) {
|
|
61
57
|
steps.push({
|
|
62
58
|
id: "STYLE_SELECTION",
|
|
@@ -70,7 +66,6 @@ export const buildStepsFromScenario = (
|
|
|
70
66
|
});
|
|
71
67
|
}
|
|
72
68
|
|
|
73
|
-
// Add duration selection step
|
|
74
69
|
if (config.durationSelection?.enabled) {
|
|
75
70
|
steps.push({
|
|
76
71
|
id: "DURATION_SELECTION",
|
|
@@ -89,13 +84,11 @@ export const buildStepsFromScenario = (
|
|
|
89
84
|
|
|
90
85
|
/**
|
|
91
86
|
* Build steps with conditional navigation
|
|
92
|
-
* Allows data-driven next step decisions
|
|
93
87
|
*/
|
|
94
88
|
export const buildStepsWithNavigation = (
|
|
95
89
|
baseSteps: DynamicStepDefinition[],
|
|
96
90
|
): DynamicStepDefinition[] => {
|
|
97
91
|
return baseSteps.map((step, index) => {
|
|
98
|
-
// Auto-link to next step if not specified
|
|
99
92
|
if (!step.nextStep && index < baseSteps.length - 1) {
|
|
100
93
|
return {
|
|
101
94
|
...step,
|
|
@@ -120,7 +113,6 @@ export const resolveNextStep = (
|
|
|
120
113
|
const currentStep = steps.find((s) => s.id === currentStepId);
|
|
121
114
|
if (!currentStep) return null;
|
|
122
115
|
|
|
123
|
-
// If nextStep is a function, call it
|
|
124
116
|
if (typeof currentStep.nextStep === "function") {
|
|
125
117
|
return currentStep.nextStep({
|
|
126
118
|
values: context.values,
|
|
@@ -129,12 +121,10 @@ export const resolveNextStep = (
|
|
|
129
121
|
});
|
|
130
122
|
}
|
|
131
123
|
|
|
132
|
-
// If nextStep is a string, return it
|
|
133
124
|
if (typeof currentStep.nextStep === "string") {
|
|
134
125
|
return currentStep.nextStep;
|
|
135
126
|
}
|
|
136
127
|
|
|
137
|
-
// Default: next step in array
|
|
138
128
|
const currentIndex = steps.findIndex((s) => s.id === currentStepId);
|
|
139
129
|
if (currentIndex >= 0 && currentIndex < steps.length - 1) {
|
|
140
130
|
return steps[currentIndex + 1].id;
|
|
@@ -142,76 +132,3 @@ export const resolveNextStep = (
|
|
|
142
132
|
|
|
143
133
|
return null;
|
|
144
134
|
};
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Example scenario configurations
|
|
148
|
-
*/
|
|
149
|
-
export const SCENARIO_CONFIGS: Record<string, ScenarioStepConfig> = {
|
|
150
|
-
// Couple/Partner scenarios (2 photos)
|
|
151
|
-
"romantic-kiss": {
|
|
152
|
-
photoUploads: {
|
|
153
|
-
count: 2,
|
|
154
|
-
labels: ["First Partner", "Second Partner"],
|
|
155
|
-
showFaceDetection: true,
|
|
156
|
-
showNameInput: false,
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
"couple-hug": {
|
|
160
|
-
photoUploads: {
|
|
161
|
-
count: 2,
|
|
162
|
-
labels: ["Partner A", "Partner B"],
|
|
163
|
-
showFaceDetection: true,
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
// Single photo scenarios
|
|
168
|
-
"image-to-video": {
|
|
169
|
-
photoUploads: {
|
|
170
|
-
count: 1,
|
|
171
|
-
labels: ["Your Photo"],
|
|
172
|
-
showFaceDetection: false,
|
|
173
|
-
},
|
|
174
|
-
styleSelection: {
|
|
175
|
-
enabled: true,
|
|
176
|
-
required: true,
|
|
177
|
-
},
|
|
178
|
-
durationSelection: {
|
|
179
|
-
enabled: true,
|
|
180
|
-
required: true,
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
// Text-only scenarios
|
|
185
|
-
"text-to-video": {
|
|
186
|
-
textInput: {
|
|
187
|
-
enabled: true,
|
|
188
|
-
required: true,
|
|
189
|
-
minLength: 10,
|
|
190
|
-
maxLength: 500,
|
|
191
|
-
},
|
|
192
|
-
styleSelection: {
|
|
193
|
-
enabled: true,
|
|
194
|
-
required: true,
|
|
195
|
-
},
|
|
196
|
-
durationSelection: {
|
|
197
|
-
enabled: true,
|
|
198
|
-
required: true,
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
// Complex scenario with optional steps
|
|
203
|
-
"advanced-generation": {
|
|
204
|
-
photoUploads: {
|
|
205
|
-
count: 1,
|
|
206
|
-
labels: ["Base Image"],
|
|
207
|
-
},
|
|
208
|
-
textInput: {
|
|
209
|
-
enabled: true,
|
|
210
|
-
required: false, // Optional
|
|
211
|
-
},
|
|
212
|
-
styleSelection: {
|
|
213
|
-
enabled: true,
|
|
214
|
-
required: true,
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Config-driven wizard steps for image-to-video generation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { WizardFeatureConfig } from "../domain/entities/wizard-
|
|
6
|
+
import type { WizardFeatureConfig } from "../domain/entities/wizard-feature.types";
|
|
7
7
|
|
|
8
8
|
export const IMAGE_TO_VIDEO_WIZARD_CONFIG: WizardFeatureConfig = {
|
|
9
9
|
id: "image-to-video",
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Config-driven wizard steps for text-to-image generation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { WizardFeatureConfig
|
|
6
|
+
import type { WizardFeatureConfig } from "../domain/entities/wizard-feature.types";
|
|
7
|
+
import type { TextInputStepConfig } from "../domain/entities/wizard-step.types";
|
|
7
8
|
|
|
8
9
|
const promptStep: TextInputStepConfig = {
|
|
9
10
|
id: "prompt",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Config-driven wizard steps for text-to-video generation
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { WizardFeatureConfig } from "../domain/entities/wizard-
|
|
6
|
+
import type { WizardFeatureConfig } from "../domain/entities/wizard-feature.types";
|
|
7
7
|
|
|
8
8
|
export const TEXT_TO_VIDEO_WIZARD_CONFIG: WizardFeatureConfig = {
|
|
9
9
|
id: "text-to-video",
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wizard Feature Configuration Types
|
|
3
|
+
* Feature-level configs and builder utilities
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { WizardStepConfig } from "./wizard-step.types";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Feature Flow Configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface WizardFeatureConfig {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly steps: readonly WizardStepConfig[];
|
|
15
|
+
readonly translations?: {
|
|
16
|
+
readonly [key: string]: string | Record<string, string>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Scenario-based Configuration Builder
|
|
22
|
+
*/
|
|
23
|
+
export interface ScenarioBasedConfig {
|
|
24
|
+
readonly photoCount?: number;
|
|
25
|
+
readonly photoLabels?: readonly string[];
|
|
26
|
+
readonly requireText?: boolean;
|
|
27
|
+
readonly requireStyleSelection?: boolean;
|
|
28
|
+
readonly requireDurationSelection?: boolean;
|
|
29
|
+
readonly customSteps?: readonly WizardStepConfig[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Build wizard config from scenario shorthand
|
|
34
|
+
*/
|
|
35
|
+
export const buildWizardConfigFromScenario = (
|
|
36
|
+
scenarioId: string,
|
|
37
|
+
config: ScenarioBasedConfig,
|
|
38
|
+
): WizardFeatureConfig => {
|
|
39
|
+
const steps: WizardStepConfig[] = [];
|
|
40
|
+
|
|
41
|
+
if (config.photoCount && config.photoCount > 0) {
|
|
42
|
+
const maxPhotos = Math.min(config.photoCount, 2);
|
|
43
|
+
for (let i = 0; i < maxPhotos; i++) {
|
|
44
|
+
steps.push({
|
|
45
|
+
id: `photo_${i + 1}`,
|
|
46
|
+
type: "photo_upload",
|
|
47
|
+
label: config.photoLabels?.[i] || `Photo ${i + 1}`,
|
|
48
|
+
showFaceDetection: true,
|
|
49
|
+
showPhotoTips: true,
|
|
50
|
+
required: true,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (config.requireText) {
|
|
56
|
+
steps.push({
|
|
57
|
+
id: "text_input",
|
|
58
|
+
type: "text_input",
|
|
59
|
+
required: true,
|
|
60
|
+
minLength: 10,
|
|
61
|
+
maxLength: 500,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (config.requireStyleSelection) {
|
|
66
|
+
steps.push({
|
|
67
|
+
id: "style_selection",
|
|
68
|
+
type: "selection",
|
|
69
|
+
selectionType: "style",
|
|
70
|
+
options: [],
|
|
71
|
+
required: true,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (config.requireDurationSelection) {
|
|
76
|
+
steps.push({
|
|
77
|
+
id: "duration_selection",
|
|
78
|
+
type: "selection",
|
|
79
|
+
selectionType: "duration",
|
|
80
|
+
options: [
|
|
81
|
+
{ id: "5s", label: "5 seconds", value: 5 },
|
|
82
|
+
{ id: "10s", label: "10 seconds", value: 10 },
|
|
83
|
+
{ id: "15s", label: "15 seconds", value: 15 },
|
|
84
|
+
],
|
|
85
|
+
required: true,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (config.customSteps) {
|
|
90
|
+
steps.push(...config.customSteps);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
id: scenarioId,
|
|
95
|
+
name: scenarioId,
|
|
96
|
+
steps,
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Pre-configured scenarios for common use cases
|
|
102
|
+
*/
|
|
103
|
+
export const WIZARD_PRESETS = {
|
|
104
|
+
TWO_PHOTOS: {
|
|
105
|
+
photoCount: 2,
|
|
106
|
+
},
|
|
107
|
+
SINGLE_PHOTO: {
|
|
108
|
+
photoCount: 1,
|
|
109
|
+
requireStyleSelection: true,
|
|
110
|
+
requireDurationSelection: true,
|
|
111
|
+
},
|
|
112
|
+
TEXT_ONLY: {
|
|
113
|
+
photoCount: 0,
|
|
114
|
+
requireText: true,
|
|
115
|
+
requireStyleSelection: true,
|
|
116
|
+
requireDurationSelection: true,
|
|
117
|
+
},
|
|
118
|
+
} as const;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wizard Step Configuration Types
|
|
3
|
+
* Generic step configs for all wizard features
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { StepType } from "../../../../../domain/entities/flow-config.types";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generic Step Configuration - Base interface for all step configs
|
|
10
|
+
*/
|
|
11
|
+
export interface BaseStepConfig {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly type: StepType | string;
|
|
14
|
+
readonly enabled?: boolean;
|
|
15
|
+
readonly required?: boolean;
|
|
16
|
+
readonly titleKey?: string;
|
|
17
|
+
readonly subtitleKey?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Photo Upload Step Configuration
|
|
22
|
+
*/
|
|
23
|
+
export interface PhotoUploadStepConfig extends BaseStepConfig {
|
|
24
|
+
readonly type: "photo_upload";
|
|
25
|
+
readonly label?: string;
|
|
26
|
+
readonly showFaceDetection?: boolean;
|
|
27
|
+
readonly showNameInput?: boolean;
|
|
28
|
+
readonly showPhotoTips?: boolean;
|
|
29
|
+
readonly maxFileSizeMB?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Text Input Step Configuration
|
|
34
|
+
*/
|
|
35
|
+
export interface TextInputStepConfig extends BaseStepConfig {
|
|
36
|
+
readonly type: "text_input";
|
|
37
|
+
readonly placeholderKey?: string;
|
|
38
|
+
readonly minLength?: number;
|
|
39
|
+
readonly maxLength?: number;
|
|
40
|
+
readonly multiline?: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Selection Step Configuration
|
|
45
|
+
*/
|
|
46
|
+
export interface SelectionStepConfig extends BaseStepConfig {
|
|
47
|
+
readonly type: "selection";
|
|
48
|
+
readonly selectionType: "style" | "duration" | "aspect_ratio" | "quality" | "resolution" | "custom";
|
|
49
|
+
readonly options: readonly {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly label: string;
|
|
52
|
+
readonly icon?: string;
|
|
53
|
+
readonly value: unknown;
|
|
54
|
+
}[];
|
|
55
|
+
readonly multiSelect?: boolean;
|
|
56
|
+
readonly defaultValue?: string | string[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Preview Step Configuration
|
|
61
|
+
*/
|
|
62
|
+
export interface PreviewStepConfig extends BaseStepConfig {
|
|
63
|
+
readonly type: "preview";
|
|
64
|
+
readonly previewType: "scenario" | "settings" | "custom";
|
|
65
|
+
readonly showContinueButton?: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Auth Gate Step Configuration
|
|
70
|
+
*/
|
|
71
|
+
export interface AuthGateStepConfig extends BaseStepConfig {
|
|
72
|
+
readonly type: "auth_gate";
|
|
73
|
+
readonly allowAnonymous?: boolean;
|
|
74
|
+
readonly messageKey?: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Credit Gate Step Configuration
|
|
79
|
+
*/
|
|
80
|
+
export interface CreditGateStepConfig extends BaseStepConfig {
|
|
81
|
+
readonly type: "credit_gate";
|
|
82
|
+
readonly requiredCredits: number;
|
|
83
|
+
readonly messageKey?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Union of all step config types
|
|
88
|
+
*/
|
|
89
|
+
export type WizardStepConfig =
|
|
90
|
+
| AuthGateStepConfig
|
|
91
|
+
| CreditGateStepConfig
|
|
92
|
+
| PhotoUploadStepConfig
|
|
93
|
+
| TextInputStepConfig
|
|
94
|
+
| SelectionStepConfig
|
|
95
|
+
| PreviewStepConfig
|
|
96
|
+
| BaseStepConfig;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Works for ALL features - NO feature-specific code!
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
// Domain Entities -
|
|
7
|
+
// Domain Entities - Step Types
|
|
8
8
|
export type {
|
|
9
9
|
BaseStepConfig,
|
|
10
10
|
AuthGateStepConfig,
|
|
@@ -14,11 +14,15 @@ export type {
|
|
|
14
14
|
SelectionStepConfig,
|
|
15
15
|
PreviewStepConfig,
|
|
16
16
|
WizardStepConfig,
|
|
17
|
+
} from "./domain/entities/wizard-step.types";
|
|
18
|
+
|
|
19
|
+
// Domain Entities - Feature Types
|
|
20
|
+
export type {
|
|
17
21
|
WizardFeatureConfig,
|
|
18
22
|
ScenarioBasedConfig,
|
|
19
|
-
} from "./domain/entities/wizard-
|
|
23
|
+
} from "./domain/entities/wizard-feature.types";
|
|
20
24
|
|
|
21
|
-
export { buildWizardConfigFromScenario, WIZARD_PRESETS } from "./domain/entities/wizard-
|
|
25
|
+
export { buildWizardConfigFromScenario, WIZARD_PRESETS } from "./domain/entities/wizard-feature.types";
|
|
22
26
|
|
|
23
27
|
// Infrastructure - Builders
|
|
24
28
|
export {
|
|
@@ -6,11 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import { StepType } from "../../../../../domain/entities/flow-config.types";
|
|
8
8
|
import type { StepDefinition } from "../../../../../domain/entities/flow-config.types";
|
|
9
|
-
import type {
|
|
10
|
-
|
|
11
|
-
WizardStepConfig,
|
|
12
|
-
ScenarioBasedConfig,
|
|
13
|
-
} from "../../domain/entities/wizard-config.types";
|
|
9
|
+
import type { WizardStepConfig } from "../../domain/entities/wizard-step.types";
|
|
10
|
+
import type { WizardFeatureConfig, ScenarioBasedConfig } from "../../domain/entities/wizard-feature.types";
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
13
|
* Convert wizard step config to flow step definition
|
|
@@ -3,8 +3,11 @@ export {
|
|
|
3
3
|
extractTrimmedString,
|
|
4
4
|
extractNumber,
|
|
5
5
|
extractSelection,
|
|
6
|
+
} from "./primitive-extractors";
|
|
7
|
+
|
|
8
|
+
export {
|
|
6
9
|
extractPrompt,
|
|
7
10
|
extractDuration,
|
|
8
11
|
extractAspectRatio,
|
|
9
12
|
extractResolution,
|
|
10
|
-
} from "./wizard-
|
|
13
|
+
} from "./wizard-field-extractors";
|