@umituz/react-native-ai-generation-content 1.27.6 → 1.27.7
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.27.
|
|
3
|
+
"version": "1.27.7",
|
|
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,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Scenario validation utility
|
|
3
3
|
* Validates that scenario has required fields for wizard generation
|
|
4
|
+
* NOTE: aiPrompt is optional - can come from wizard data (text_input step)
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
import type { WizardScenarioData } from "../hooks/useWizardGeneration";
|
|
7
8
|
|
|
9
|
+
declare const __DEV__: boolean;
|
|
10
|
+
|
|
8
11
|
export interface ScenarioValidationResult {
|
|
9
12
|
isValid: boolean;
|
|
10
13
|
error?: string;
|
|
@@ -13,6 +16,7 @@ export interface ScenarioValidationResult {
|
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* Validates scenario data for wizard generation
|
|
19
|
+
* aiPrompt is optional - for TEXT_INPUT scenarios, prompt comes from wizard data
|
|
16
20
|
* @throws Error if scenario is invalid
|
|
17
21
|
*/
|
|
18
22
|
export const validateScenario = (
|
|
@@ -23,8 +27,6 @@ export const validateScenario = (
|
|
|
23
27
|
hasScenario: !!scenario,
|
|
24
28
|
scenarioId: scenario?.id,
|
|
25
29
|
hasAiPrompt: !!scenario?.aiPrompt,
|
|
26
|
-
aiPromptLength: scenario?.aiPrompt?.length,
|
|
27
|
-
hasModel: !!scenario?.model,
|
|
28
30
|
outputType: scenario?.outputType,
|
|
29
31
|
});
|
|
30
32
|
}
|
|
@@ -33,22 +35,12 @@ export const validateScenario = (
|
|
|
33
35
|
throw new Error("[validateScenario] Scenario is required");
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
38
|
-
console.error("[validateScenario] CRITICAL: Scenario missing aiPrompt!", {
|
|
39
|
-
scenarioId: scenario.id,
|
|
40
|
-
aiPrompt: scenario.aiPrompt,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
throw new Error(`[validateScenario] Scenario "${scenario.id}" must have aiPrompt field`);
|
|
44
|
-
}
|
|
45
|
-
|
|
38
|
+
// aiPrompt is optional - for TEXT_INPUT scenarios, prompt comes from wizard data
|
|
46
39
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
47
40
|
console.log("[validateScenario] Validation passed", {
|
|
48
41
|
scenarioId: scenario.id,
|
|
49
|
-
model: scenario.model,
|
|
50
42
|
outputType: scenario.outputType,
|
|
51
|
-
|
|
43
|
+
hasPrompt: !!scenario.aiPrompt,
|
|
52
44
|
});
|
|
53
45
|
}
|
|
54
46
|
|
|
@@ -1,138 +1,104 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Wizard Configurations
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Wizard Configurations - App-Agnostic
|
|
3
|
+
* Classifies features by INPUT REQUIREMENTS, not app-specific scenarios
|
|
4
|
+
* Apps can override inputType or provide custom step configurations
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { WizardFeatureConfig } from "../../generation/wizard/domain/entities/wizard-config.types";
|
|
8
8
|
|
|
9
|
+
declare const __DEV__: boolean;
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
+
* Input Type Classification
|
|
13
|
+
* Based on what inputs the wizard needs (photos, text)
|
|
14
|
+
* NOT based on app-specific scenario names
|
|
12
15
|
*/
|
|
13
|
-
export enum
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
export enum InputType {
|
|
17
|
+
/** Two images required (any two-person/two-image scenario) */
|
|
18
|
+
DUAL_IMAGE = "dual_image",
|
|
19
|
+
/** Single image required */
|
|
20
|
+
SINGLE_IMAGE = "single_image",
|
|
21
|
+
/** Text input only, no images */
|
|
22
|
+
TEXT_INPUT = "text_input",
|
|
23
|
+
/** Two images with face detection (face swap scenarios) */
|
|
24
|
+
DUAL_IMAGE_FACE = "dual_image_face",
|
|
18
25
|
}
|
|
19
26
|
|
|
27
|
+
/** @deprecated Use InputType instead */
|
|
28
|
+
export const FeatureType = InputType;
|
|
29
|
+
|
|
20
30
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
31
|
+
* Generic Input Detection Patterns
|
|
32
|
+
* Only patterns that describe input/output, NOT app-specific scenarios
|
|
23
33
|
*/
|
|
24
|
-
const
|
|
25
|
-
[
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/couple/i, // couple-future, couple-ai-baby
|
|
29
|
-
/partner/i, // partner scenarios
|
|
30
|
-
/wedding/i, // wedding scenarios
|
|
31
|
-
/anniversary/i,
|
|
32
|
-
/dance/i, // first-dance, etc.
|
|
33
|
-
/together/i,
|
|
34
|
-
/embrace/i,
|
|
35
|
-
/romance/i,
|
|
36
|
-
/love/i,
|
|
37
|
-
/relationship/i,
|
|
38
|
-
/years/i, // 5-years, 10-years (couple-future)
|
|
39
|
-
/age/i, // old-age (couple-future)
|
|
40
|
-
/future.*child/i, // future-child
|
|
41
|
-
/parenthood/i,
|
|
42
|
-
/proposal/i,
|
|
43
|
-
/engagement/i,
|
|
34
|
+
const INPUT_PATTERNS: Record<InputType, RegExp[]> = {
|
|
35
|
+
[InputType.DUAL_IMAGE]: [
|
|
36
|
+
// Empty - app must specify explicitly for dual image scenarios
|
|
37
|
+
// This prevents accidental matches with app-specific terms
|
|
44
38
|
],
|
|
45
39
|
|
|
46
|
-
[
|
|
47
|
-
|
|
48
|
-
/remove.*background/i,
|
|
49
|
-
/photo.*restore/i,
|
|
50
|
-
/restore.*photo/i,
|
|
40
|
+
[InputType.SINGLE_IMAGE]: [
|
|
41
|
+
/^image-to-video$/i,
|
|
51
42
|
/upscale/i,
|
|
52
|
-
/
|
|
53
|
-
/touch.*up/i,
|
|
43
|
+
/restore/i,
|
|
54
44
|
/enhance/i,
|
|
55
|
-
/
|
|
56
|
-
/
|
|
57
|
-
/
|
|
58
|
-
/
|
|
59
|
-
/
|
|
45
|
+
/remove-background/i,
|
|
46
|
+
/background-remove/i,
|
|
47
|
+
/remove-object/i,
|
|
48
|
+
/hd-touch/i,
|
|
49
|
+
/anime-selfie/i,
|
|
60
50
|
],
|
|
61
51
|
|
|
62
|
-
[
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/prompt
|
|
52
|
+
[InputType.TEXT_INPUT]: [
|
|
53
|
+
/^text-to-video$/i,
|
|
54
|
+
/^text-to-image$/i,
|
|
55
|
+
/prompt-to/i,
|
|
66
56
|
],
|
|
67
57
|
|
|
68
|
-
[
|
|
69
|
-
/face
|
|
70
|
-
/swap
|
|
58
|
+
[InputType.DUAL_IMAGE_FACE]: [
|
|
59
|
+
/face-swap/i,
|
|
60
|
+
/swap-face/i,
|
|
71
61
|
],
|
|
72
62
|
};
|
|
73
63
|
|
|
74
64
|
/**
|
|
75
|
-
* Detect
|
|
65
|
+
* Detect input type from scenario ID
|
|
66
|
+
* Only matches generic I/O patterns
|
|
67
|
+
* Returns SINGLE_IMAGE as safe default
|
|
76
68
|
*/
|
|
77
|
-
export const
|
|
78
|
-
|
|
69
|
+
export const detectInputType = (scenarioId: string): InputType => {
|
|
70
|
+
// Check patterns in priority order: TEXT_INPUT, SINGLE_IMAGE, DUAL_IMAGE_FACE
|
|
71
|
+
// DUAL_IMAGE has no patterns - must be explicitly specified
|
|
72
|
+
const checkOrder: InputType[] = [
|
|
73
|
+
InputType.TEXT_INPUT,
|
|
74
|
+
InputType.DUAL_IMAGE_FACE,
|
|
75
|
+
InputType.SINGLE_IMAGE,
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
for (const type of checkOrder) {
|
|
79
|
+
const patterns = INPUT_PATTERNS[type];
|
|
79
80
|
if (patterns.some((pattern) => pattern.test(scenarioId))) {
|
|
80
|
-
return type
|
|
81
|
+
return type;
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
|
-
// Default: COUPLE (most common in AI video generation apps)
|
|
84
|
-
return FeatureType.COUPLE;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Romantic Mood Options for Couple Scenarios
|
|
89
|
-
*/
|
|
90
|
-
const ROMANTIC_MOOD_OPTIONS = [
|
|
91
|
-
{ id: "romantic", label: "Romantic", icon: "❤️", value: "romantic" },
|
|
92
|
-
{ id: "mysterious", label: "Mysterious", icon: "🌙", value: "mysterious" },
|
|
93
|
-
{ id: "magical", label: "Magical", icon: "✨", value: "magical" },
|
|
94
|
-
{ id: "energetic", label: "Energetic", icon: "⚡", value: "energetic" },
|
|
95
|
-
{ id: "melancholic", label: "Melancholic", icon: "☁️", value: "melancholic" },
|
|
96
|
-
{ id: "passionate", label: "Passionate", icon: "🔥", value: "passionate" },
|
|
97
|
-
{ id: "nostalgic", label: "Nostalgic", icon: "📷", value: "nostalgic" },
|
|
98
|
-
{ id: "futuristic", label: "Futuristic", icon: "🚀", value: "futuristic" },
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Art Style Options for Couple Scenarios
|
|
103
|
-
*/
|
|
104
|
-
const ART_STYLE_OPTIONS = [
|
|
105
|
-
{ id: "original", label: "Original", icon: "🖼️", value: "original" },
|
|
106
|
-
{ id: "cubism", label: "Cubism", icon: "🔷", value: "cubism" },
|
|
107
|
-
{ id: "popArt", label: "Pop Art", icon: "🎨", value: "pop_art" },
|
|
108
|
-
{ id: "impressionism", label: "Impressionism", icon: "🖌️", value: "impressionism" },
|
|
109
|
-
{ id: "surrealism", label: "Surrealism", icon: "👁️", value: "surrealism" },
|
|
110
|
-
{ id: "renaissance", label: "Renaissance", icon: "🎭", value: "renaissance" },
|
|
111
|
-
];
|
|
112
84
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const ARTIST_STYLE_OPTIONS = [
|
|
117
|
-
{ id: "vanGogh", label: "Van Gogh", icon: "🖌️", value: "van_gogh" },
|
|
118
|
-
{ id: "picasso", label: "Picasso", icon: "🔷", value: "picasso" },
|
|
119
|
-
{ id: "fridaKahlo", label: "Frida Kahlo", icon: "🌺", value: "frida_kahlo" },
|
|
120
|
-
{ id: "daVinci", label: "Da Vinci", icon: "🎨", value: "da_vinci" },
|
|
121
|
-
];
|
|
85
|
+
// Safe default: SINGLE_IMAGE (most common use case)
|
|
86
|
+
return InputType.SINGLE_IMAGE;
|
|
87
|
+
};
|
|
122
88
|
|
|
123
89
|
/**
|
|
124
|
-
* Config Factory
|
|
125
|
-
* Generic
|
|
90
|
+
* Config Factory: DUAL_IMAGE (2 photos required)
|
|
91
|
+
* Generic labels - apps provide translations
|
|
126
92
|
*/
|
|
127
|
-
const
|
|
93
|
+
const createDualImageConfig = (scenarioId: string): WizardFeatureConfig => ({
|
|
128
94
|
id: scenarioId,
|
|
129
95
|
name: scenarioId,
|
|
130
96
|
steps: [
|
|
131
97
|
{
|
|
132
98
|
id: "photo_1",
|
|
133
99
|
type: "photo_upload",
|
|
134
|
-
titleKey: "photoUpload.
|
|
135
|
-
subtitleKey: "photoUpload.
|
|
100
|
+
titleKey: "photoUpload.first.title",
|
|
101
|
+
subtitleKey: "photoUpload.first.subtitle",
|
|
136
102
|
showFaceDetection: true,
|
|
137
103
|
showPhotoTips: true,
|
|
138
104
|
required: true,
|
|
@@ -140,50 +106,19 @@ const createCoupleConfig = (scenarioId: string): WizardFeatureConfig => ({
|
|
|
140
106
|
{
|
|
141
107
|
id: "photo_2",
|
|
142
108
|
type: "photo_upload",
|
|
143
|
-
titleKey: "photoUpload.
|
|
144
|
-
subtitleKey: "photoUpload.
|
|
109
|
+
titleKey: "photoUpload.second.title",
|
|
110
|
+
subtitleKey: "photoUpload.second.subtitle",
|
|
145
111
|
showFaceDetection: true,
|
|
146
112
|
showPhotoTips: true,
|
|
147
113
|
required: true,
|
|
148
114
|
},
|
|
149
|
-
{
|
|
150
|
-
id: "romantic_mood",
|
|
151
|
-
type: "selection",
|
|
152
|
-
selectionType: "custom",
|
|
153
|
-
titleKey: "selection.romanticMood.title",
|
|
154
|
-
subtitleKey: "selection.romanticMood.subtitle",
|
|
155
|
-
options: ROMANTIC_MOOD_OPTIONS,
|
|
156
|
-
multiSelect: true,
|
|
157
|
-
required: false,
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
id: "art_style",
|
|
161
|
-
type: "selection",
|
|
162
|
-
selectionType: "style",
|
|
163
|
-
titleKey: "selection.artStyle.title",
|
|
164
|
-
subtitleKey: "selection.artStyle.subtitle",
|
|
165
|
-
options: ART_STYLE_OPTIONS,
|
|
166
|
-
multiSelect: false,
|
|
167
|
-
required: false,
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
id: "artist_style",
|
|
171
|
-
type: "selection",
|
|
172
|
-
selectionType: "custom",
|
|
173
|
-
titleKey: "selection.artistStyle.title",
|
|
174
|
-
subtitleKey: "selection.artistStyle.subtitle",
|
|
175
|
-
options: ARTIST_STYLE_OPTIONS,
|
|
176
|
-
multiSelect: false,
|
|
177
|
-
required: false,
|
|
178
|
-
},
|
|
179
115
|
],
|
|
180
116
|
});
|
|
181
117
|
|
|
182
118
|
/**
|
|
183
|
-
* Config Factory
|
|
184
|
-
* Generic single photo step - label comes from translation
|
|
119
|
+
* Config Factory: SINGLE_IMAGE (1 photo required)
|
|
185
120
|
*/
|
|
186
|
-
const
|
|
121
|
+
const createSingleImageConfig = (scenarioId: string): WizardFeatureConfig => ({
|
|
187
122
|
id: scenarioId,
|
|
188
123
|
name: scenarioId,
|
|
189
124
|
steps: [
|
|
@@ -200,9 +135,9 @@ const createSinglePhotoConfig = (scenarioId: string): WizardFeatureConfig => ({
|
|
|
200
135
|
});
|
|
201
136
|
|
|
202
137
|
/**
|
|
203
|
-
* Config Factory
|
|
138
|
+
* Config Factory: TEXT_INPUT (text only, no photos)
|
|
204
139
|
*/
|
|
205
|
-
const
|
|
140
|
+
const createTextInputConfig = (scenarioId: string): WizardFeatureConfig => ({
|
|
206
141
|
id: scenarioId,
|
|
207
142
|
name: scenarioId,
|
|
208
143
|
steps: [
|
|
@@ -217,31 +152,21 @@ const createTextBasedConfig = (scenarioId: string): WizardFeatureConfig => ({
|
|
|
217
152
|
multiline: true,
|
|
218
153
|
required: true,
|
|
219
154
|
},
|
|
220
|
-
{
|
|
221
|
-
id: "style_selection",
|
|
222
|
-
type: "selection",
|
|
223
|
-
selectionType: "style",
|
|
224
|
-
titleKey: "styleSelection.title",
|
|
225
|
-
subtitleKey: "styleSelection.subtitle",
|
|
226
|
-
options: [], // Provided by app/feature
|
|
227
|
-
required: false,
|
|
228
|
-
},
|
|
229
155
|
],
|
|
230
156
|
});
|
|
231
157
|
|
|
232
158
|
/**
|
|
233
|
-
* Config Factory
|
|
234
|
-
* Specific labels for face replacement scenarios
|
|
159
|
+
* Config Factory: DUAL_IMAGE_FACE (2 photos with face detection)
|
|
235
160
|
*/
|
|
236
|
-
const
|
|
161
|
+
const createDualImageFaceConfig = (scenarioId: string): WizardFeatureConfig => ({
|
|
237
162
|
id: scenarioId,
|
|
238
163
|
name: scenarioId,
|
|
239
164
|
steps: [
|
|
240
165
|
{
|
|
241
166
|
id: "photo_1",
|
|
242
167
|
type: "photo_upload",
|
|
243
|
-
titleKey: "photoUpload.
|
|
244
|
-
subtitleKey: "photoUpload.
|
|
168
|
+
titleKey: "photoUpload.source.title",
|
|
169
|
+
subtitleKey: "photoUpload.source.subtitle",
|
|
245
170
|
showFaceDetection: true,
|
|
246
171
|
showPhotoTips: true,
|
|
247
172
|
required: true,
|
|
@@ -249,8 +174,8 @@ const createFaceSwapConfig = (scenarioId: string): WizardFeatureConfig => ({
|
|
|
249
174
|
{
|
|
250
175
|
id: "photo_2",
|
|
251
176
|
type: "photo_upload",
|
|
252
|
-
titleKey: "photoUpload.
|
|
253
|
-
subtitleKey: "photoUpload.
|
|
177
|
+
titleKey: "photoUpload.target.title",
|
|
178
|
+
subtitleKey: "photoUpload.target.subtitle",
|
|
254
179
|
showFaceDetection: false,
|
|
255
180
|
showPhotoTips: true,
|
|
256
181
|
required: true,
|
|
@@ -261,36 +186,27 @@ const createFaceSwapConfig = (scenarioId: string): WizardFeatureConfig => ({
|
|
|
261
186
|
/**
|
|
262
187
|
* Config Factories Registry
|
|
263
188
|
*/
|
|
264
|
-
const
|
|
265
|
-
[
|
|
266
|
-
[
|
|
267
|
-
[
|
|
268
|
-
[
|
|
189
|
+
const CONFIG_FACTORIES: Record<InputType, (id: string) => WizardFeatureConfig> = {
|
|
190
|
+
[InputType.DUAL_IMAGE]: createDualImageConfig,
|
|
191
|
+
[InputType.SINGLE_IMAGE]: createSingleImageConfig,
|
|
192
|
+
[InputType.TEXT_INPUT]: createTextInputConfig,
|
|
193
|
+
[InputType.DUAL_IMAGE_FACE]: createDualImageFaceConfig,
|
|
269
194
|
};
|
|
270
195
|
|
|
271
196
|
/**
|
|
272
197
|
* Explicit Wizard Configs (Optional)
|
|
273
|
-
*
|
|
274
|
-
* Most scenarios will use auto-generated configs from factories
|
|
198
|
+
* Apps can register custom configs for specific scenario IDs
|
|
275
199
|
*/
|
|
276
|
-
export const SCENARIO_WIZARD_CONFIGS: Record<string, WizardFeatureConfig> = {
|
|
277
|
-
// Add custom configs here only if needed
|
|
278
|
-
// Example:
|
|
279
|
-
// "special-scenario": {
|
|
280
|
-
// id: "special-scenario",
|
|
281
|
-
// steps: [...custom steps]
|
|
282
|
-
// }
|
|
283
|
-
};
|
|
200
|
+
export const SCENARIO_WIZARD_CONFIGS: Record<string, WizardFeatureConfig> = {};
|
|
284
201
|
|
|
285
202
|
/**
|
|
286
|
-
* Merge config overrides
|
|
203
|
+
* Merge config with overrides
|
|
287
204
|
*/
|
|
288
205
|
const mergeConfigOverrides = (
|
|
289
206
|
config: WizardFeatureConfig,
|
|
290
207
|
overrides?: Partial<WizardFeatureConfig>,
|
|
291
208
|
): WizardFeatureConfig => {
|
|
292
209
|
if (!overrides) return config;
|
|
293
|
-
|
|
294
210
|
return {
|
|
295
211
|
...config,
|
|
296
212
|
...overrides,
|
|
@@ -299,81 +215,97 @@ const mergeConfigOverrides = (
|
|
|
299
215
|
};
|
|
300
216
|
|
|
301
217
|
/**
|
|
302
|
-
*
|
|
303
|
-
*/
|
|
304
|
-
const applyConfigOptions = (
|
|
305
|
-
config: WizardFeatureConfig,
|
|
306
|
-
options?: WizardConfigOptions,
|
|
307
|
-
): WizardFeatureConfig => {
|
|
308
|
-
if (!options) return config;
|
|
309
|
-
|
|
310
|
-
let steps = [...config.steps];
|
|
311
|
-
|
|
312
|
-
// Filter out style selection steps if disabled
|
|
313
|
-
if (options.disableStyleSelections) {
|
|
314
|
-
const styleStepIds = ["romantic_mood", "art_style", "artist_style"];
|
|
315
|
-
steps = steps.filter((step) => !styleStepIds.includes(step.id));
|
|
316
|
-
|
|
317
|
-
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
318
|
-
console.log("[WizardConfig] Style selections disabled", {
|
|
319
|
-
filteredStepIds: styleStepIds,
|
|
320
|
-
remainingSteps: steps.map((s) => s.id),
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
return {
|
|
326
|
-
...config,
|
|
327
|
-
steps,
|
|
328
|
-
};
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Configuration Options for Wizard Behavior
|
|
218
|
+
* Configuration Options
|
|
333
219
|
*/
|
|
334
220
|
export interface WizardConfigOptions {
|
|
335
|
-
|
|
221
|
+
/** Explicit input type - highest priority */
|
|
222
|
+
readonly inputType?: InputType;
|
|
223
|
+
/** Additional steps to append */
|
|
224
|
+
readonly additionalSteps?: WizardFeatureConfig["steps"];
|
|
225
|
+
/** Custom overrides */
|
|
226
|
+
readonly overrides?: Partial<WizardFeatureConfig>;
|
|
336
227
|
}
|
|
337
228
|
|
|
338
229
|
/**
|
|
339
230
|
* Get wizard config for a scenario
|
|
340
|
-
* 1. Check for explicit config in SCENARIO_WIZARD_CONFIGS
|
|
341
|
-
* 2. Auto-detect feature type and generate config
|
|
342
|
-
* 3. Apply overrides if provided
|
|
343
|
-
* 4. Apply options to disable certain steps
|
|
344
231
|
*
|
|
345
|
-
*
|
|
232
|
+
* Priority:
|
|
233
|
+
* 1. Explicit inputType in options (highest)
|
|
234
|
+
* 2. Explicit config in SCENARIO_WIZARD_CONFIGS
|
|
235
|
+
* 3. Auto-detect from scenario ID patterns
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* // Auto-detect from ID
|
|
239
|
+
* getScenarioWizardConfig("text-to-video")
|
|
240
|
+
*
|
|
241
|
+
* // Explicit input type for app-specific scenarios
|
|
242
|
+
* getScenarioWizardConfig("ai-kiss", { inputType: InputType.DUAL_IMAGE })
|
|
346
243
|
*/
|
|
347
244
|
export const getScenarioWizardConfig = (
|
|
348
245
|
scenarioId: string,
|
|
349
246
|
options?: WizardConfigOptions,
|
|
350
|
-
overrides?: Partial<WizardFeatureConfig>,
|
|
351
247
|
): WizardFeatureConfig => {
|
|
352
|
-
// 1. Explicit
|
|
248
|
+
// 1. Explicit inputType (highest priority)
|
|
249
|
+
if (options?.inputType) {
|
|
250
|
+
const factory = CONFIG_FACTORIES[options.inputType];
|
|
251
|
+
let config = factory(scenarioId);
|
|
252
|
+
config = mergeConfigOverrides(config, options.overrides);
|
|
253
|
+
|
|
254
|
+
if (options.additionalSteps) {
|
|
255
|
+
config = { ...config, steps: [...config.steps, ...options.additionalSteps] };
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
259
|
+
console.log("[WizardConfig] Using explicit inputType", {
|
|
260
|
+
scenarioId,
|
|
261
|
+
inputType: options.inputType,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return config;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// 2. Explicit config in registry
|
|
353
269
|
if (SCENARIO_WIZARD_CONFIGS[scenarioId]) {
|
|
354
|
-
|
|
355
|
-
|
|
270
|
+
let config = SCENARIO_WIZARD_CONFIGS[scenarioId];
|
|
271
|
+
config = mergeConfigOverrides(config, options?.overrides);
|
|
272
|
+
|
|
273
|
+
if (options?.additionalSteps) {
|
|
274
|
+
config = { ...config, steps: [...config.steps, ...options.additionalSteps] };
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return config;
|
|
356
278
|
}
|
|
357
279
|
|
|
358
|
-
//
|
|
359
|
-
const
|
|
280
|
+
// 3. Auto-detect from scenario ID
|
|
281
|
+
const inputType = detectInputType(scenarioId);
|
|
360
282
|
|
|
361
283
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
362
|
-
console.log("[WizardConfig] Auto-detected
|
|
284
|
+
console.log("[WizardConfig] Auto-detected inputType", {
|
|
363
285
|
scenarioId,
|
|
364
|
-
|
|
286
|
+
inputType,
|
|
365
287
|
});
|
|
366
288
|
}
|
|
367
289
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
290
|
+
const factory = CONFIG_FACTORIES[inputType];
|
|
291
|
+
let config = factory(scenarioId);
|
|
292
|
+
config = mergeConfigOverrides(config, options?.overrides);
|
|
371
293
|
|
|
372
|
-
|
|
373
|
-
|
|
294
|
+
if (options?.additionalSteps) {
|
|
295
|
+
config = { ...config, steps: [...config.steps, ...options.additionalSteps] };
|
|
296
|
+
}
|
|
374
297
|
|
|
375
|
-
|
|
376
|
-
|
|
298
|
+
return config;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Register a custom wizard config for a scenario
|
|
303
|
+
*/
|
|
304
|
+
export const registerWizardConfig = (
|
|
305
|
+
scenarioId: string,
|
|
306
|
+
config: WizardFeatureConfig,
|
|
307
|
+
): void => {
|
|
308
|
+
SCENARIO_WIZARD_CONFIGS[scenarioId] = config;
|
|
377
309
|
};
|
|
378
310
|
|
|
379
311
|
/**
|
|
@@ -384,8 +316,14 @@ export const hasExplicitConfig = (scenarioId: string): boolean => {
|
|
|
384
316
|
};
|
|
385
317
|
|
|
386
318
|
/**
|
|
387
|
-
* Get
|
|
319
|
+
* Get input type for a scenario
|
|
388
320
|
*/
|
|
389
|
-
export const
|
|
390
|
-
return
|
|
321
|
+
export const getScenarioInputType = (scenarioId: string): InputType => {
|
|
322
|
+
return detectInputType(scenarioId);
|
|
391
323
|
};
|
|
324
|
+
|
|
325
|
+
/** @deprecated Use getScenarioInputType instead */
|
|
326
|
+
export const getScenarioFeatureType = getScenarioInputType;
|
|
327
|
+
|
|
328
|
+
/** @deprecated Use detectInputType instead */
|
|
329
|
+
export const detectFeatureType = detectInputType;
|
|
@@ -14,13 +14,18 @@ export { SCENARIOS } from "./infrastructure/ScenariosData";
|
|
|
14
14
|
// Utils
|
|
15
15
|
export { createStoryTemplate } from "./infrastructure/utils/scenario-utils";
|
|
16
16
|
|
|
17
|
-
// Wizard Configurations -
|
|
17
|
+
// Wizard Configurations - App-agnostic, classifies by INPUT REQUIREMENTS
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
InputType,
|
|
20
20
|
SCENARIO_WIZARD_CONFIGS,
|
|
21
|
-
|
|
21
|
+
detectInputType,
|
|
22
22
|
getScenarioWizardConfig,
|
|
23
23
|
hasExplicitConfig,
|
|
24
|
+
getScenarioInputType,
|
|
25
|
+
registerWizardConfig,
|
|
26
|
+
// Deprecated (backward compatibility)
|
|
27
|
+
FeatureType,
|
|
28
|
+
detectFeatureType,
|
|
24
29
|
getScenarioFeatureType,
|
|
25
30
|
} from "./configs/wizard-configs";
|
|
26
31
|
|