@umituz/react-native-ai-generation-content 1.55.0 → 1.56.0

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.55.0",
3
+ "version": "1.56.0",
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",
@@ -121,6 +121,7 @@ export const WizardFlowContent: React.FC<WizardFlowContentProps> = (props) => {
121
121
  setShowRatingPicker,
122
122
  onGenerationStart,
123
123
  onGenerationComplete,
124
+ onGenerationError,
124
125
  onBack,
125
126
  });
126
127
 
@@ -132,7 +133,7 @@ export const WizardFlowContent: React.FC<WizardFlowContentProps> = (props) => {
132
133
  alertMessages,
133
134
  creditCost,
134
135
  onSuccess: handlers.handleGenerationComplete,
135
- onError: onGenerationError,
136
+ onError: handlers.handleGenerationError,
136
137
  onCreditsExhausted,
137
138
  });
138
139
 
@@ -29,6 +29,7 @@ export interface UseWizardFlowHandlersProps {
29
29
  readonly setShowRatingPicker: (show: boolean) => void;
30
30
  readonly onGenerationStart?: (data: Record<string, unknown>, proceed: () => void) => void;
31
31
  readonly onGenerationComplete?: (result: unknown) => void;
32
+ readonly onGenerationError?: (error: string) => void;
32
33
  readonly onBack?: () => void;
33
34
  }
34
35
 
@@ -51,6 +52,7 @@ export function useWizardFlowHandlers(props: UseWizardFlowHandlersProps) {
51
52
  setShowRatingPicker,
52
53
  onGenerationStart,
53
54
  onGenerationComplete,
55
+ onGenerationError,
54
56
  onBack,
55
57
  } = props;
56
58
 
@@ -69,6 +71,30 @@ export function useWizardFlowHandlers(props: UseWizardFlowHandlersProps) {
69
71
  [setResult, setCurrentCreation, nextStep, onGenerationComplete, skipResultStep],
70
72
  );
71
73
 
74
+ const handleGenerationError = useCallback(
75
+ (errorMessage: string) => {
76
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
77
+ console.log("[WizardFlowHandlers] Generation error:", errorMessage);
78
+ }
79
+ // Translate error key if it looks like a translation key
80
+ const displayMessage = errorMessage.startsWith("error.")
81
+ ? t(errorMessage)
82
+ : errorMessage;
83
+ // Show error alert to user
84
+ alert.show(
85
+ AlertType.ERROR,
86
+ AlertMode.MODAL,
87
+ t("common.error"),
88
+ displayMessage,
89
+ );
90
+ // Notify parent component
91
+ onGenerationError?.(errorMessage);
92
+ // Close the wizard
93
+ onBack?.();
94
+ },
95
+ [alert, t, onGenerationError, onBack],
96
+ );
97
+
72
98
  const handleDismissGenerating = useCallback(() => {
73
99
  if (typeof __DEV__ !== "undefined" && __DEV__) {
74
100
  console.log("[WizardFlowHandlers] Dismissing - generation continues");
@@ -124,6 +150,7 @@ export function useWizardFlowHandlers(props: UseWizardFlowHandlersProps) {
124
150
 
125
151
  return {
126
152
  handleGenerationComplete,
153
+ handleGenerationError,
127
154
  handleDismissGenerating,
128
155
  handleBack,
129
156
  handleNextStep,