@umituz/react-native-ai-generation-content 1.17.180 → 1.17.182

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.17.180",
3
+ "version": "1.17.182",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -10,6 +10,7 @@ import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
  import { DualImagePicker } from "../../../../presentation/components/image-picker/DualImagePicker";
11
11
  import { AIGenerationForm } from "../../../../presentation/components/AIGenerationForm";
12
12
  import { AIGenerationResult } from "../../../../presentation/components/display/AIGenerationResult";
13
+ import { GenerationProgressModal } from "../../../../presentation/components/GenerationProgressModal";
13
14
  import { useAIHugFeature } from "../hooks";
14
15
  import type {
15
16
  AIHugTranslations,
@@ -93,6 +94,21 @@ export const AIHugFeature: React.FC<AIHugFeatureProps> = ({
93
94
  );
94
95
  }
95
96
 
97
+ const defaultModal = (
98
+ <GenerationProgressModal
99
+ visible={feature.isProcessing}
100
+ progress={feature.progress}
101
+ icon="sparkles"
102
+ title={translations.modalTitle || "Creating your video"}
103
+ message={translations.modalMessage || "AI is working its magic..."}
104
+ hint={translations.modalHint || "This may take a moment"}
105
+ backgroundHint={translations.modalBackgroundHint || "Continue in background"}
106
+ onClose={() => {
107
+ // Allow continuing in background - just close modal
108
+ }}
109
+ />
110
+ );
111
+
96
112
  return (
97
113
  <>
98
114
  <ScrollView
@@ -123,7 +139,9 @@ export const AIHugFeature: React.FC<AIHugFeatureProps> = ({
123
139
  </AIGenerationForm>
124
140
  </ScrollView>
125
141
 
126
- {renderProcessingModal?.({ visible: feature.isProcessing, progress: feature.progress })}
142
+ {renderProcessingModal
143
+ ? renderProcessingModal({ visible: feature.isProcessing, progress: feature.progress })
144
+ : defaultModal}
127
145
  </>
128
146
  );
129
147
  };
@@ -10,6 +10,7 @@ import { useAppDesignTokens } from "@umituz/react-native-design-system";
10
10
  import { DualImagePicker } from "../../../../presentation/components/image-picker/DualImagePicker";
11
11
  import { AIGenerationForm } from "../../../../presentation/components/AIGenerationForm";
12
12
  import { AIGenerationResult } from "../../../../presentation/components/display/AIGenerationResult";
13
+ import { GenerationProgressModal } from "../../../../presentation/components/GenerationProgressModal";
13
14
  import { useAIKissFeature } from "../hooks";
14
15
  import type {
15
16
  AIKissTranslations,
@@ -87,6 +88,21 @@ export const AIKissFeature: React.FC<AIKissFeatureProps> = ({
87
88
  );
88
89
  }
89
90
 
91
+ const defaultModal = (
92
+ <GenerationProgressModal
93
+ visible={feature.isProcessing}
94
+ progress={feature.progress}
95
+ icon="sparkles"
96
+ title={translations.modalTitle || "Creating your video"}
97
+ message={translations.modalMessage || "AI is working its magic..."}
98
+ hint={translations.modalHint || "This may take a moment"}
99
+ backgroundHint={translations.modalBackgroundHint || "Continue in background"}
100
+ onClose={() => {
101
+ // Allow continuing in background - just close modal
102
+ }}
103
+ />
104
+ );
105
+
90
106
  return (
91
107
  <>
92
108
  <ScrollView
@@ -117,7 +133,9 @@ export const AIKissFeature: React.FC<AIKissFeatureProps> = ({
117
133
  </AIGenerationForm>
118
134
  </ScrollView>
119
135
 
120
- {renderProcessingModal?.({ visible: feature.isProcessing, progress: feature.progress })}
136
+ {renderProcessingModal
137
+ ? renderProcessingModal({ visible: feature.isProcessing, progress: feature.progress })
138
+ : defaultModal}
121
139
  </>
122
140
  );
123
141
  };
@@ -59,6 +59,14 @@ export interface DualImageVideoTranslations {
59
59
  successText: string;
60
60
  saveButtonText: string;
61
61
  tryAnotherText: string;
62
+ /** Modal title shown during processing */
63
+ modalTitle?: string;
64
+ /** Modal message shown during processing */
65
+ modalMessage?: string;
66
+ /** Modal hint/tip shown during processing */
67
+ modalHint?: string;
68
+ /** "Continue in background" text */
69
+ modalBackgroundHint?: string;
62
70
  }
63
71
 
64
72
  export interface UseDualImageVideoFeatureProps {
@@ -96,6 +96,7 @@ function defaultExtractVideoResult(result: unknown): string | undefined {
96
96
 
97
97
  /**
98
98
  * Execute any video feature using the active provider
99
+ * Uses subscribe for video features to handle long-running generation with progress updates
99
100
  */
100
101
  export async function executeVideoFeature(
101
102
  featureType: VideoFeatureType,
@@ -117,12 +118,11 @@ export async function executeVideoFeature(
117
118
  const model = provider.getVideoFeatureModel(featureType);
118
119
 
119
120
  if (__DEV__) {
120
-
121
121
  console.log(`[Video:${featureType}] Provider: ${provider.providerId}, Model: ${model}`);
122
122
  }
123
123
 
124
124
  try {
125
- onProgress?.(10);
125
+ onProgress?.(5);
126
126
 
127
127
  const inputData: VideoFeatureInputData = {
128
128
  sourceImageBase64: cleanBase64(request.sourceImageBase64),
@@ -131,13 +131,27 @@ export async function executeVideoFeature(
131
131
  options: request.options,
132
132
  };
133
133
 
134
- onProgress?.(30);
134
+ onProgress?.(10);
135
135
 
136
136
  const input = provider.buildVideoFeatureInput(featureType, inputData);
137
137
 
138
- onProgress?.(40);
139
-
140
- const result = await provider.run(model, input);
138
+ onProgress?.(15);
139
+
140
+ // Use subscribe for video features - provides queue updates and handles long-running tasks
141
+ const result = await provider.subscribe(model, input, {
142
+ timeoutMs: 300000, // 5 minutes timeout for video generation
143
+ onQueueUpdate: (status) => {
144
+ if (__DEV__) {
145
+ console.log(`[Video:${featureType}] Queue update:`, status.status);
146
+ }
147
+ // Map queue status to progress percentage
148
+ if (status.status === "IN_QUEUE") {
149
+ onProgress?.(20);
150
+ } else if (status.status === "IN_PROGRESS") {
151
+ onProgress?.(50);
152
+ }
153
+ },
154
+ });
141
155
 
142
156
  onProgress?.(90);
143
157
 
@@ -147,6 +161,9 @@ export async function executeVideoFeature(
147
161
  onProgress?.(100);
148
162
 
149
163
  if (!videoUrl) {
164
+ if (__DEV__) {
165
+ console.log(`[Video:${featureType}] No video URL found in result:`, JSON.stringify(result, null, 2));
166
+ }
150
167
  return { success: false, error: "No video in response" };
151
168
  }
152
169
 
@@ -156,10 +173,21 @@ export async function executeVideoFeature(
156
173
  requestId: (result as { requestId?: string })?.requestId,
157
174
  };
158
175
  } catch (error) {
159
- const message = error instanceof Error ? error.message : String(error);
176
+ // Extract detailed error message from FAL API errors
177
+ let message = "Processing failed";
178
+ if (error instanceof Error) {
179
+ message = error.message;
180
+ } else if (typeof error === "object" && error !== null) {
181
+ const errObj = error as Record<string, unknown>;
182
+ if (errObj.detail) {
183
+ message = JSON.stringify(errObj.detail);
184
+ } else if (errObj.message) {
185
+ message = String(errObj.message);
186
+ }
187
+ }
188
+
160
189
  if (__DEV__) {
161
-
162
- console.error(`[Video:${featureType}] Error:`, message);
190
+ console.error(`[Video:${featureType}] Error:`, message, error);
163
191
  }
164
192
  return { success: false, error: message };
165
193
  }