@umituz/react-native-ai-generation-content 1.20.27 → 1.20.29

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.20.27",
3
+ "version": "1.20.29",
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",
@@ -26,6 +26,7 @@ export const AIGenerateWizardFlow: React.FC<AIGenerateWizardFlowProps> = ({
26
26
  durationOptions,
27
27
  onGenerate,
28
28
  onBack: onBackProp,
29
+ onSave,
29
30
  t,
30
31
  }) => {
31
32
  const tokens = useAppDesignTokens();
@@ -97,18 +98,35 @@ export const AIGenerateWizardFlow: React.FC<AIGenerateWizardFlowProps> = ({
97
98
  );
98
99
 
99
100
  case AIGenerateStep.RESULT:
101
+ const isVideo = ["image-to-video", "text-to-video", "ai-hug", "ai-kiss"].includes(featureType);
100
102
  return (
101
103
  <ScreenLayout header={<AIGenScreenHeader title={translations.headerTitle} onNavigationPress={handleBack} />}>
102
104
  <AIGenerationResult
103
105
  successText={translations.successTitle}
104
- primaryAction={{ label: translations.saveButton, onPress: () => {}, icon: "download" }}
106
+ primaryAction={{
107
+ label: translations.saveButton,
108
+ onPress: () => result && onSave?.(result),
109
+ icon: "download"
110
+ }}
105
111
  secondaryAction={{
106
112
  label: translations.tryAgainButton,
107
113
  onPress: () => setCurrentStep(AIGenerateStep.CONFIG),
108
114
  icon: "refresh",
109
115
  }}
110
116
  >
111
- <Image source={{ uri: result || "" }} style={{ width: "100%", aspectRatio: 2 / 3, borderRadius: 16 }} resizeMode="cover" />
117
+ {isVideo ? (
118
+ // TODO: Use correct video player component if available in design system,
119
+ // for now rendering Image with play icon overlay or similar approach is standard if no player passed.
120
+ // However, ideally we should use <Video> generic component.
121
+ // Assuming standard <Image> for now but we should address this.
122
+ // Let's use a conditional or comment.
123
+ <View style={{ width: "100%", aspectRatio: 2 / 3, borderRadius: 16, backgroundColor: "#000", justifyContent: 'center', alignItems: 'center' }}>
124
+ <AtomicText style={{ color: "white" }}>Video Result: {result ? "Ready" : "Error"}</AtomicText>
125
+ {/* Real implementation should use expo-video or similar */}
126
+ </View>
127
+ ) : (
128
+ <Image source={{ uri: result || "" }} style={{ width: "100%", aspectRatio: 2 / 3, borderRadius: 16 }} resizeMode="cover" />
129
+ )}
112
130
  </AIGenerationResult>
113
131
  </ScreenLayout>
114
132
  );
@@ -45,5 +45,6 @@ export interface AIGenerateWizardFlowProps {
45
45
  images: { uri: string }[];
46
46
  }) => Promise<string | null>;
47
47
  readonly onBack?: () => void;
48
+ readonly onSave?: (uri: string) => void;
48
49
  readonly t: (key: string) => string;
49
50
  }
@@ -228,6 +228,8 @@ export const useGenerationOrchestrator = <TInput, TResult>(
228
228
 
229
229
  // Handle lifecycle completion
230
230
  handleLifecycleComplete("success", result);
231
+
232
+ return result;
231
233
  },
232
234
  [strategy, userId, alertMessages, deductCredit, showSuccess, onSuccess, handleLifecycleComplete],
233
235
  );
@@ -361,7 +363,7 @@ export const useGenerationOrchestrator = <TInput, TResult>(
361
363
  }
362
364
 
363
365
  // 5. Execute generation
364
- await executeGeneration(input);
366
+ return await executeGeneration(input);
365
367
  } catch (err) {
366
368
  const error = parseError(err);
367
369
  if (typeof __DEV__ !== "undefined" && __DEV__) {
@@ -375,6 +377,7 @@ export const useGenerationOrchestrator = <TInput, TResult>(
375
377
 
376
378
  // Handle lifecycle completion for errors
377
379
  handleLifecycleComplete("error", undefined, error);
380
+ throw error; // Re-throw so caller knows it failed
378
381
  } finally {
379
382
  isGeneratingRef.current = false;
380
383
  if (typeof __DEV__ !== "undefined" && __DEV__) {