@umituz/react-native-ai-generation-content 1.75.4 → 1.75.5

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.75.4",
3
+ "version": "1.75.5",
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",
@@ -67,6 +67,7 @@ export function extractTrimmedString(value: unknown): string | undefined {
67
67
  /**
68
68
  * Extracts number from various input formats:
69
69
  * - Direct number: 5
70
+ * - Numeric string: "5", "6s"
70
71
  * - Object with value field: { value: 5 }
71
72
  * - Object with selection field: { selection: 5 }
72
73
  */
@@ -75,12 +76,31 @@ export function extractNumber(value: unknown): number | undefined {
75
76
  return value;
76
77
  }
77
78
 
79
+ // Handle numeric strings (e.g., "6", "10s")
80
+ if (typeof value === "string") {
81
+ const match = value.match(/^(\d+)s?$/);
82
+ if (match) {
83
+ const parsed = parseInt(match[1], 10);
84
+ if (!Number.isNaN(parsed) && parsed > 0) return parsed;
85
+ }
86
+ }
87
+
78
88
  if (isObject(value)) {
79
89
  if (hasProperty(value, "value") && typeof value.value === "number") {
80
90
  return value.value;
81
91
  }
82
- if (hasProperty(value, "selection") && typeof value.selection === "number") {
83
- return value.selection;
92
+ if (hasProperty(value, "selection")) {
93
+ // selection can be number or numeric string
94
+ if (typeof value.selection === "number") {
95
+ return value.selection;
96
+ }
97
+ if (typeof value.selection === "string") {
98
+ const match = value.selection.match(/^(\d+)s?$/);
99
+ if (match) {
100
+ const parsed = parseInt(match[1], 10);
101
+ if (!Number.isNaN(parsed) && parsed > 0) return parsed;
102
+ }
103
+ }
84
104
  }
85
105
  }
86
106
 
@@ -23,7 +23,7 @@ export interface UseWizardFlowHandlersProps {
23
23
  readonly setCurrentCreation: (creation: Creation | null) => void;
24
24
  readonly setHasRated: (hasRated: boolean) => void;
25
25
  readonly setShowRatingPicker: (show: boolean) => void;
26
- readonly onGenerationStart?: (data: Record<string, unknown>, proceed: () => void) => void;
26
+ readonly onGenerationStart?: (data: Record<string, unknown>, proceed: () => void, onError?: (error: string) => void) => void;
27
27
  readonly onGenerationComplete?: (result: unknown) => void;
28
28
  readonly onGenerationError?: (error: string, errorInfo?: GenerationErrorInfo) => void;
29
29
  readonly onBack?: () => void;