@umituz/react-native-ai-generation-content 1.58.1 → 1.58.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/step-renderers/renderSelectionStep.tsx +18 -0
- package/src/domains/generation/wizard/presentation/hooks/useWizardFlowHandlers.ts +10 -5
- package/src/domains/generation/wizard/presentation/hooks/useWizardGeneration.ts +4 -3
- package/src/domains/generation/wizard/presentation/screens/SelectionScreen.tsx +25 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.58.
|
|
3
|
+
"version": "1.58.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",
|
package/src/domains/generation/wizard/presentation/components/step-renderers/renderSelectionStep.tsx
CHANGED
|
@@ -16,6 +16,8 @@ export interface SelectionStepProps {
|
|
|
16
16
|
readonly t: (key: string) => string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
declare const __DEV__: boolean;
|
|
20
|
+
|
|
19
21
|
export function renderSelectionStep({
|
|
20
22
|
step,
|
|
21
23
|
customData,
|
|
@@ -35,6 +37,22 @@ export function renderSelectionStep({
|
|
|
35
37
|
const autoSelectValue = isRequired && options.length === 1 ? options[0].id : undefined;
|
|
36
38
|
const initialValue = existingValue ?? configDefault ?? autoSelectValue;
|
|
37
39
|
|
|
40
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
41
|
+
console.log("[renderSelectionStep] Step config:", {
|
|
42
|
+
stepId: step.id,
|
|
43
|
+
stepType: step.type,
|
|
44
|
+
hasConfig: !!step.config,
|
|
45
|
+
configType: (step.config as Record<string, unknown>)?.type,
|
|
46
|
+
hasSelectionConfig: !!selectionConfig,
|
|
47
|
+
configDefault,
|
|
48
|
+
existingValue,
|
|
49
|
+
autoSelectValue,
|
|
50
|
+
initialValue,
|
|
51
|
+
isRequired,
|
|
52
|
+
optionsCount: options.length,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
38
56
|
return (
|
|
39
57
|
<SelectionScreen
|
|
40
58
|
stepId={step.id}
|
|
@@ -73,13 +73,18 @@ export function useWizardFlowHandlers(props: UseWizardFlowHandlersProps) {
|
|
|
73
73
|
|
|
74
74
|
const handleGenerationError = useCallback(
|
|
75
75
|
(errorMessage: string) => {
|
|
76
|
+
// Ensure we have a meaningful error message
|
|
77
|
+
const safeErrorMessage = errorMessage?.trim() || "error.generation.unknown";
|
|
76
78
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
77
|
-
console.log("[WizardFlowHandlers] Generation error:",
|
|
79
|
+
console.log("[WizardFlowHandlers] Generation error:", {
|
|
80
|
+
original: errorMessage,
|
|
81
|
+
safe: safeErrorMessage,
|
|
82
|
+
});
|
|
78
83
|
}
|
|
79
84
|
// Translate error key if it looks like a translation key
|
|
80
|
-
const displayMessage =
|
|
81
|
-
? t(
|
|
82
|
-
:
|
|
85
|
+
const displayMessage = safeErrorMessage.startsWith("error.")
|
|
86
|
+
? t(safeErrorMessage)
|
|
87
|
+
: safeErrorMessage;
|
|
83
88
|
// Show error alert to user
|
|
84
89
|
alert.show(
|
|
85
90
|
AlertType.ERROR,
|
|
@@ -88,7 +93,7 @@ export function useWizardFlowHandlers(props: UseWizardFlowHandlersProps) {
|
|
|
88
93
|
displayMessage,
|
|
89
94
|
);
|
|
90
95
|
// Notify parent component
|
|
91
|
-
onGenerationError?.(
|
|
96
|
+
onGenerationError?.(safeErrorMessage);
|
|
92
97
|
// Close the wizard
|
|
93
98
|
onBack?.();
|
|
94
99
|
},
|
|
@@ -164,11 +164,12 @@ export const useWizardGeneration = (
|
|
|
164
164
|
dispatch({ type: "COMPLETE" });
|
|
165
165
|
})
|
|
166
166
|
.catch((error) => {
|
|
167
|
+
const errorMsg = error?.message || "error.generation.unknown";
|
|
167
168
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
168
|
-
console.error("[WizardGeneration] Build input error:", error
|
|
169
|
+
console.error("[WizardGeneration] Build input error:", errorMsg, error);
|
|
169
170
|
}
|
|
170
|
-
dispatch({ type: "ERROR", error:
|
|
171
|
-
onError?.(
|
|
171
|
+
dispatch({ type: "ERROR", error: errorMsg });
|
|
172
|
+
onError?.(errorMsg);
|
|
172
173
|
});
|
|
173
174
|
}
|
|
174
175
|
|
|
@@ -23,8 +23,10 @@ export type {
|
|
|
23
23
|
SelectionScreenProps,
|
|
24
24
|
} from "./SelectionScreen.types";
|
|
25
25
|
|
|
26
|
+
declare const __DEV__: boolean;
|
|
27
|
+
|
|
26
28
|
export const SelectionScreen: React.FC<SelectionScreenProps> = ({
|
|
27
|
-
stepId
|
|
29
|
+
stepId,
|
|
28
30
|
translations,
|
|
29
31
|
options,
|
|
30
32
|
config,
|
|
@@ -34,9 +36,17 @@ export const SelectionScreen: React.FC<SelectionScreenProps> = ({
|
|
|
34
36
|
}) => {
|
|
35
37
|
const tokens = useAppDesignTokens();
|
|
36
38
|
const [selected, setSelected] = useState<string | string[]>(() => {
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
39
|
+
const initialState = initialValue ? initialValue : (config?.multiSelect ? [] : "");
|
|
40
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
41
|
+
console.log("[SelectionScreen] Initial state:", {
|
|
42
|
+
stepId,
|
|
43
|
+
initialValue,
|
|
44
|
+
initialState,
|
|
45
|
+
hasInitialValue: !!initialValue,
|
|
46
|
+
multiSelect: config?.multiSelect,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return initialState;
|
|
40
50
|
});
|
|
41
51
|
|
|
42
52
|
const isMultiSelect = config?.multiSelect ?? false;
|
|
@@ -45,6 +55,17 @@ export const SelectionScreen: React.FC<SelectionScreenProps> = ({
|
|
|
45
55
|
? isMultiSelect ? (selected as string[]).length > 0 : selected !== ""
|
|
46
56
|
: true;
|
|
47
57
|
|
|
58
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
59
|
+
console.log("[SelectionScreen] Render state:", {
|
|
60
|
+
stepId,
|
|
61
|
+
selected,
|
|
62
|
+
isRequired,
|
|
63
|
+
isMultiSelect,
|
|
64
|
+
canContinue,
|
|
65
|
+
optionIds: options.map(o => o.id),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
48
69
|
const handleSelect = useCallback((optionId: string) => {
|
|
49
70
|
if (isMultiSelect) {
|
|
50
71
|
setSelected((prev) => {
|