@umituz/react-native-ai-generation-content 1.26.11 → 1.26.13
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/domain/feature-config.types.ts +7 -0
- package/src/domains/scenarios/domain/scenario.types.ts +29 -0
- package/src/domains/scenarios/presentation/containers/CategoryNavigationContainer.tsx +15 -2
- package/src/domains/scenarios/presentation/screens/HierarchicalScenarioListScreen.tsx +25 -2
- package/src/presentation/hooks/generation/types.ts +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.13",
|
|
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",
|
|
@@ -59,3 +59,10 @@ export interface FeatureRegistration {
|
|
|
59
59
|
has(featureId: string): boolean;
|
|
60
60
|
unregister(featureId: string): void;
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Visual style modifiers for generation
|
|
65
|
+
*/
|
|
66
|
+
export interface VisualStyleConfig {
|
|
67
|
+
readonly [key: string]: string;
|
|
68
|
+
}
|
|
@@ -110,6 +110,35 @@ export interface ScenarioSubCategory {
|
|
|
110
110
|
readonly order: number;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Scenario selector configuration
|
|
115
|
+
*/
|
|
116
|
+
export interface ScenarioSelectorConfig {
|
|
117
|
+
readonly titleKey: string;
|
|
118
|
+
readonly subtitleKey: string;
|
|
119
|
+
readonly showCategoryFilter: boolean;
|
|
120
|
+
readonly enableSearch: boolean;
|
|
121
|
+
readonly pageSize: number;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Scenario preview translations
|
|
126
|
+
*/
|
|
127
|
+
export interface ScenarioPreviewTranslations {
|
|
128
|
+
readonly continueButton: string;
|
|
129
|
+
readonly whatToExpect: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Scenario application configuration
|
|
134
|
+
*/
|
|
135
|
+
export interface ScenarioConfig {
|
|
136
|
+
readonly id: string;
|
|
137
|
+
readonly aiPrompt: string;
|
|
138
|
+
readonly storyTemplate?: string;
|
|
139
|
+
readonly title: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
113
142
|
export interface ScenarioData {
|
|
114
143
|
readonly id: string;
|
|
115
144
|
readonly category?: string;
|
|
@@ -22,10 +22,13 @@ export interface CategoryNavigationContainerProps {
|
|
|
22
22
|
readonly scenarios: readonly ScenarioData[];
|
|
23
23
|
readonly onSelectScenario: (scenarioId: string) => void;
|
|
24
24
|
readonly onBack?: () => void;
|
|
25
|
+
readonly onSelectMainCategory?: (categoryId: string) => void;
|
|
26
|
+
readonly onSelectSubCategory?: (subCategoryId: string) => void;
|
|
25
27
|
readonly t: (key: string) => string;
|
|
26
28
|
readonly headerTitle?: string;
|
|
27
29
|
readonly headerDescription?: string;
|
|
28
30
|
readonly numColumns?: number;
|
|
31
|
+
readonly isLoading?: boolean;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
export const CategoryNavigationContainer: React.FC<
|
|
@@ -36,10 +39,13 @@ export const CategoryNavigationContainer: React.FC<
|
|
|
36
39
|
scenarios,
|
|
37
40
|
onSelectScenario,
|
|
38
41
|
onBack,
|
|
42
|
+
onSelectMainCategory,
|
|
43
|
+
onSelectSubCategory,
|
|
39
44
|
t,
|
|
40
45
|
headerTitle,
|
|
41
46
|
headerDescription,
|
|
42
47
|
numColumns = 2,
|
|
48
|
+
isLoading = false,
|
|
43
49
|
}) => {
|
|
44
50
|
const [currentStep, setCurrentStep] = useState<NavigationStep>("main_category");
|
|
45
51
|
const [selectedMainCategoryId, setSelectedMainCategoryId] = useState<string | null>(null);
|
|
@@ -76,7 +82,10 @@ export const CategoryNavigationContainer: React.FC<
|
|
|
76
82
|
}
|
|
77
83
|
setSelectedMainCategoryId(categoryId);
|
|
78
84
|
setCurrentStep("sub_category");
|
|
79
|
-
|
|
85
|
+
if (onSelectMainCategory) {
|
|
86
|
+
onSelectMainCategory(categoryId);
|
|
87
|
+
}
|
|
88
|
+
}, [onSelectMainCategory]);
|
|
80
89
|
|
|
81
90
|
const handleSelectSubCategory = useCallback((subCategoryId: string) => {
|
|
82
91
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
@@ -86,7 +95,10 @@ export const CategoryNavigationContainer: React.FC<
|
|
|
86
95
|
}
|
|
87
96
|
setSelectedSubCategoryId(subCategoryId);
|
|
88
97
|
setCurrentStep("scenario_list");
|
|
89
|
-
|
|
98
|
+
if (onSelectSubCategory) {
|
|
99
|
+
onSelectSubCategory(subCategoryId);
|
|
100
|
+
}
|
|
101
|
+
}, [onSelectSubCategory]);
|
|
90
102
|
|
|
91
103
|
const handleBackFromSubCategory = useCallback(() => {
|
|
92
104
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
@@ -162,6 +174,7 @@ export const CategoryNavigationContainer: React.FC<
|
|
|
162
174
|
onBack={handleBackFromScenarioList}
|
|
163
175
|
t={t}
|
|
164
176
|
numColumns={numColumns}
|
|
177
|
+
isLoading={isLoading}
|
|
165
178
|
/>
|
|
166
179
|
);
|
|
167
180
|
}
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
ScreenLayout,
|
|
21
21
|
NavigationHeader,
|
|
22
22
|
AtomicIcon,
|
|
23
|
+
AtomicSpinner,
|
|
23
24
|
type DesignTokens,
|
|
24
25
|
} from "@umituz/react-native-design-system";
|
|
25
26
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
@@ -33,6 +34,7 @@ export interface HierarchicalScenarioListScreenProps {
|
|
|
33
34
|
readonly onBack: () => void;
|
|
34
35
|
readonly t: (key: string) => string;
|
|
35
36
|
readonly numColumns?: number;
|
|
37
|
+
readonly isLoading?: boolean;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export const HierarchicalScenarioListScreen: React.FC<HierarchicalScenarioListScreenProps> = ({
|
|
@@ -43,6 +45,7 @@ export const HierarchicalScenarioListScreen: React.FC<HierarchicalScenarioListSc
|
|
|
43
45
|
onBack,
|
|
44
46
|
t,
|
|
45
47
|
numColumns = 2,
|
|
48
|
+
isLoading = false,
|
|
46
49
|
}) => {
|
|
47
50
|
const tokens = useAppDesignTokens();
|
|
48
51
|
const insets = useSafeAreaInsets();
|
|
@@ -68,7 +71,7 @@ export const HierarchicalScenarioListScreen: React.FC<HierarchicalScenarioListSc
|
|
|
68
71
|
|
|
69
72
|
const filtered = scenarios.filter((scenario) => {
|
|
70
73
|
if (!scenario.category) return false;
|
|
71
|
-
return subCategory.scenarioCategories
|
|
74
|
+
return subCategory.scenarioCategories?.includes(scenario.category) ?? false;
|
|
72
75
|
});
|
|
73
76
|
|
|
74
77
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
@@ -152,6 +155,18 @@ export const HierarchicalScenarioListScreen: React.FC<HierarchicalScenarioListSc
|
|
|
152
155
|
),
|
|
153
156
|
[t, styles.emptyState]
|
|
154
157
|
);
|
|
158
|
+
|
|
159
|
+
const LoadingComponent = useMemo(
|
|
160
|
+
() => (
|
|
161
|
+
<View style={styles.loadingContainer}>
|
|
162
|
+
<AtomicSpinner size="lg" color="primary" />
|
|
163
|
+
<AtomicText type="bodyMedium" style={{ marginTop: tokens.spacing.md }}>
|
|
164
|
+
{t("common.loading")}
|
|
165
|
+
</AtomicText>
|
|
166
|
+
</View>
|
|
167
|
+
),
|
|
168
|
+
[tokens, t, styles.loadingContainer]
|
|
169
|
+
);
|
|
155
170
|
|
|
156
171
|
if (!subCategory) {
|
|
157
172
|
return null;
|
|
@@ -213,7 +228,9 @@ export const HierarchicalScenarioListScreen: React.FC<HierarchicalScenarioListSc
|
|
|
213
228
|
renderItem={renderItem}
|
|
214
229
|
keyExtractor={(item) => item.id}
|
|
215
230
|
ListEmptyComponent={
|
|
216
|
-
|
|
231
|
+
isLoading
|
|
232
|
+
? LoadingComponent
|
|
233
|
+
: (filteredScenarios.length === 0 ? ListEmptyComponent : null)
|
|
217
234
|
}
|
|
218
235
|
contentContainerStyle={[
|
|
219
236
|
styles.listContent,
|
|
@@ -254,6 +271,12 @@ const createStyles = (
|
|
|
254
271
|
alignItems: "center",
|
|
255
272
|
paddingVertical: tokens.spacing.xl,
|
|
256
273
|
},
|
|
274
|
+
loadingContainer: {
|
|
275
|
+
flex: 1,
|
|
276
|
+
justifyContent: "center",
|
|
277
|
+
alignItems: "center",
|
|
278
|
+
paddingVertical: tokens.spacing.xl,
|
|
279
|
+
},
|
|
257
280
|
continueButton: {
|
|
258
281
|
flexDirection: "row",
|
|
259
282
|
alignItems: "center",
|
|
@@ -136,3 +136,23 @@ export interface UseGenerationOrchestratorReturn<TInput, TResult> {
|
|
|
136
136
|
result: TResult | null;
|
|
137
137
|
error: GenerationError | null;
|
|
138
138
|
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Generation error UI configuration
|
|
142
|
+
*/
|
|
143
|
+
export interface GenerationErrorConfig {
|
|
144
|
+
readonly showCreditInfo?: boolean;
|
|
145
|
+
readonly iconName?: string;
|
|
146
|
+
readonly iconSize?: number;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Generation error UI translations
|
|
151
|
+
*/
|
|
152
|
+
export interface GenerationErrorTranslations {
|
|
153
|
+
readonly title: string;
|
|
154
|
+
readonly tryAgain: string;
|
|
155
|
+
readonly chooseAnother: string;
|
|
156
|
+
readonly noCreditCharged: string;
|
|
157
|
+
}
|
|
158
|
+
|