@umituz/react-native-ai-generation-content 1.37.15 → 1.37.17
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.37.
|
|
3
|
+
"version": "1.37.17",
|
|
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",
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { Scenario, ScenarioOutputType } from "../domain/Scenario";
|
|
7
|
+
import { WizardInputType } from "../configs/wizard-input.types";
|
|
8
|
+
import { detectWizardInputType } from "../configs/wizard-input-detector";
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Configuration for creating app-specific scenarios
|
|
@@ -17,40 +19,30 @@ export interface AppScenarioConfig {
|
|
|
17
19
|
readonly excludeIds?: readonly string[];
|
|
18
20
|
/** Optional filter to include only certain category IDs */
|
|
19
21
|
readonly includeCategories?: readonly string[];
|
|
22
|
+
/** Optional filter to exclude wizard input types (uses pattern detection) */
|
|
23
|
+
readonly excludeWizardInputTypes?: readonly WizardInputType[];
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* Creates app-configured scenarios from package scenarios
|
|
24
|
-
* Apps use this to set their desired outputType and model
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* // Video generation app
|
|
28
|
-
* const scenarios = createScenariosForApp(SCENARIOS, {
|
|
29
|
-
* outputType: "video",
|
|
30
|
-
* model: "fal-ai/veo3/image-to-video"
|
|
31
|
-
* });
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* // Image generation app
|
|
35
|
-
* const scenarios = createScenariosForApp(SCENARIOS, {
|
|
36
|
-
* outputType: "image",
|
|
37
|
-
* model: "fal-ai/nano-banana/edit",
|
|
38
|
-
* excludeIds: ["custom"]
|
|
39
|
-
* });
|
|
40
28
|
*/
|
|
41
29
|
export const createScenariosForApp = (
|
|
42
30
|
scenarios: readonly Scenario[],
|
|
43
31
|
config: AppScenarioConfig,
|
|
44
32
|
): Scenario[] => {
|
|
45
|
-
const {
|
|
33
|
+
const {
|
|
34
|
+
outputType,
|
|
35
|
+
model,
|
|
36
|
+
excludeIds,
|
|
37
|
+
includeCategories,
|
|
38
|
+
excludeWizardInputTypes,
|
|
39
|
+
} = config;
|
|
46
40
|
|
|
47
41
|
return scenarios
|
|
48
42
|
.filter((scenario) => {
|
|
49
|
-
// Filter by excluded IDs
|
|
50
43
|
if (excludeIds?.includes(scenario.id)) {
|
|
51
44
|
return false;
|
|
52
45
|
}
|
|
53
|
-
// Filter by included categories
|
|
54
46
|
if (
|
|
55
47
|
includeCategories &&
|
|
56
48
|
includeCategories.length > 0 &&
|
|
@@ -59,6 +51,12 @@ export const createScenariosForApp = (
|
|
|
59
51
|
) {
|
|
60
52
|
return false;
|
|
61
53
|
}
|
|
54
|
+
if (excludeWizardInputTypes && excludeWizardInputTypes.length > 0) {
|
|
55
|
+
const detectedType = detectWizardInputType(scenario.id);
|
|
56
|
+
if (excludeWizardInputTypes.includes(detectedType)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
62
60
|
return true;
|
|
63
61
|
})
|
|
64
62
|
.map((scenario) => ({
|
|
@@ -69,11 +67,7 @@ export const createScenariosForApp = (
|
|
|
69
67
|
};
|
|
70
68
|
|
|
71
69
|
/**
|
|
72
|
-
* Filters scenarios by output type
|
|
73
|
-
* Useful for apps that have mixed scenarios with different output types
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* const videoScenarios = filterScenariosByOutputType(scenarios, "video");
|
|
70
|
+
* Filters scenarios by output type
|
|
77
71
|
*/
|
|
78
72
|
export const filterScenariosByOutputType = (
|
|
79
73
|
scenarios: readonly Scenario[],
|
|
@@ -82,21 +76,23 @@ export const filterScenariosByOutputType = (
|
|
|
82
76
|
|
|
83
77
|
/**
|
|
84
78
|
* Filters scenarios by category
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* const weddingScenarios = filterScenariosByCategory(scenarios, "wedding");
|
|
88
79
|
*/
|
|
89
80
|
export const filterScenariosByCategory = (
|
|
90
81
|
scenarios: readonly Scenario[],
|
|
91
82
|
category: string,
|
|
92
83
|
): Scenario[] => scenarios.filter((s) => s.category === category);
|
|
93
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Filters scenarios by wizard input type using pattern detection
|
|
87
|
+
*/
|
|
88
|
+
export const filterScenariosByWizardInputType = (
|
|
89
|
+
scenarios: readonly Scenario[],
|
|
90
|
+
inputTypes: readonly WizardInputType[],
|
|
91
|
+
): Scenario[] =>
|
|
92
|
+
scenarios.filter((s) => inputTypes.includes(detectWizardInputType(s.id)));
|
|
93
|
+
|
|
94
94
|
/**
|
|
95
95
|
* Gets unique categories from scenarios
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* const categories = getScenarioCategories(scenarios);
|
|
99
|
-
* // ["wedding", "fantasy", "adventure", ...]
|
|
100
96
|
*/
|
|
101
97
|
export const getScenarioCategories = (
|
|
102
98
|
scenarios: readonly Scenario[],
|
|
@@ -112,9 +108,6 @@ export const getScenarioCategories = (
|
|
|
112
108
|
|
|
113
109
|
/**
|
|
114
110
|
* Finds a scenario by ID
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* const scenario = findScenarioById(scenarios, "beach_wedding");
|
|
118
111
|
*/
|
|
119
112
|
export const findScenarioById = (
|
|
120
113
|
scenarios: readonly Scenario[],
|