@umituz/react-native-ai-generation-content 1.88.8 → 1.88.10

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.88.8",
3
+ "version": "1.88.10",
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",
@@ -60,7 +60,7 @@ export const SOLO_VIDEO_WIZARD_CONFIG: WizardFeatureConfig = {
60
60
  },
61
61
  ],
62
62
  required: true,
63
- defaultValue: "normal", // Default to normal mode (opt-in for draft)
63
+ defaultValue: "draft", // Default to draft mode for faster generation and reduced timeouts
64
64
  layout: "list",
65
65
  },
66
66
  ],
@@ -54,6 +54,11 @@ function buildGenericInput(input: WizardVideoInput): Record<string, unknown> {
54
54
  modelInput.audio = input.audioUrl;
55
55
  }
56
56
 
57
+ // Quality mode: "draft" → draft=true (faster, cheaper), "normal" → draft=false (higher quality)
58
+ if (input.qualityMode === "draft" || input.qualityMode === "normal") {
59
+ modelInput.draft = input.qualityMode === "draft";
60
+ }
61
+
57
62
  return modelInput;
58
63
  }
59
64
 
@@ -7,7 +7,7 @@
7
7
  import type { WizardScenarioData } from "../../presentation/hooks/useWizardGeneration";
8
8
  import type { WizardStrategy } from "./wizard-strategy.types";
9
9
  import { VIDEO_PROCESSING_PROMPTS } from "./wizard-strategy.constants";
10
- import { extractPrompt, extractDuration, extractAspectRatio, extractResolution } from "../utils";
10
+ import { extractPrompt, extractDuration, extractAspectRatio, extractResolution, extractQualityMode } from "../utils";
11
11
  import { extractPhotosAsBase64 } from "./shared/photo-extraction.utils";
12
12
  import type { WizardVideoInput, CreateVideoStrategyOptions } from "./video-generation.types";
13
13
  import { validatePhotoCount, validateWizardVideoInput } from "./video-generation.types";
@@ -58,6 +58,8 @@ export async function buildVideoInput(
58
58
  });
59
59
  }
60
60
  const finalPrompt = extractPrompt(wizardData, scenario.aiPrompt) || scenario.aiPrompt || "";
61
+ const qualityMode = extractQualityMode(wizardData);
62
+
61
63
  return {
62
64
  sourceImageBase64: scenario.preGeneratedImageUrl,
63
65
  prompt: finalPrompt,
@@ -65,6 +67,7 @@ export async function buildVideoInput(
65
67
  aspectRatio: extractAspectRatio(wizardData),
66
68
  resolution: extractResolution(wizardData),
67
69
  audioUrl,
70
+ qualityMode,
68
71
  };
69
72
  }
70
73
 
@@ -98,6 +101,8 @@ export async function buildVideoInput(
98
101
  });
99
102
  }
100
103
 
104
+ const qualityMode = extractQualityMode(wizardData);
105
+
101
106
  return {
102
107
  sourceImageBase64: photos[0] || undefined,
103
108
  targetImageBase64: photos[1] || photos[0] || undefined,
@@ -106,6 +111,7 @@ export async function buildVideoInput(
106
111
  aspectRatio: extractAspectRatio(wizardData),
107
112
  resolution: extractResolution(wizardData),
108
113
  audioUrl,
114
+ qualityMode,
109
115
  };
110
116
  }
111
117
 
@@ -21,6 +21,8 @@ export interface WizardVideoInput {
21
21
  readonly resolution?: string;
22
22
  /** Audio file as base64 or URL for background music / audio-driven video */
23
23
  readonly audioUrl?: string;
24
+ /** Quality mode: "draft" (faster, cheaper) or "normal" (higher quality) */
25
+ readonly qualityMode?: "draft" | "normal";
24
26
  }
25
27
 
26
28
  export interface CreateVideoStrategyOptions {
@@ -64,6 +64,23 @@ export function extractResolution(value: unknown): string | undefined {
64
64
  return undefined;
65
65
  }
66
66
 
67
+ /**
68
+ * Extract quality mode value from customData
69
+ * Handles "draft" and "normal" values
70
+ * Also handles selection format objects from wizard steps
71
+ *
72
+ * @param value - Raw value from customData
73
+ * @returns Normalized quality mode string, or undefined if invalid
74
+ */
75
+ export function extractQualityMode(value: unknown): "draft" | "normal" | undefined {
76
+ const unwrapped = unwrapSelection(value);
77
+
78
+ if (unwrapped === "draft" || unwrapped === "normal") {
79
+ return unwrapped;
80
+ }
81
+ return undefined;
82
+ }
83
+
67
84
  /**
68
85
  * Extract default duration from wizard feature config
69
86
  * Finds the duration selection step and resolves its default option value
@@ -7,4 +7,5 @@ export {
7
7
  extractDuration,
8
8
  extractAspectRatio,
9
9
  extractResolution,
10
+ extractQualityMode,
10
11
  } from "./wizard-field-extractors";
@@ -63,3 +63,18 @@ export function extractResolution(
63
63
  const resolutionData = wizardData.resolution;
64
64
  return extractTrimmedString(resolutionData);
65
65
  }
66
+
67
+ /**
68
+ * Extracts quality mode from wizard data
69
+ * Values: "draft" (faster, cheaper), "normal" (higher quality)
70
+ */
71
+ export function extractQualityMode(
72
+ wizardData: Record<string, unknown>,
73
+ ): "draft" | "normal" | undefined {
74
+ const qualityData = wizardData.quality_mode;
75
+ const extracted = extractTrimmedString(qualityData);
76
+ if (extracted === "draft" || extracted === "normal") {
77
+ return extracted;
78
+ }
79
+ return undefined;
80
+ }
@@ -48,6 +48,7 @@ export interface GenericWizardFlowProps {
48
48
  readonly onCreditsExhausted?: () => void;
49
49
  readonly onBack?: () => void;
50
50
  readonly onTryAgain?: () => void;
51
+ readonly onDismissGenerating?: () => void;
51
52
  readonly t: (key: string) => string;
52
53
  readonly translations?: Record<string, string>;
53
54
  readonly renderPreview?: (onContinue: () => void) => React.ReactElement | null;
@@ -76,6 +77,7 @@ export const GenericWizardFlow: React.FC<GenericWizardFlowProps> = (props) => {
76
77
  onCreditsExhausted,
77
78
  onBack,
78
79
  onTryAgain,
80
+ onDismissGenerating,
79
81
  t,
80
82
  renderPreview,
81
83
  renderGenerating,
@@ -137,6 +139,7 @@ export const GenericWizardFlow: React.FC<GenericWizardFlowProps> = (props) => {
137
139
  onCreditsExhausted={onCreditsExhausted}
138
140
  onBack={onBack}
139
141
  onTryAgain={onTryAgain}
142
+ onDismissGenerating={onDismissGenerating}
140
143
  t={t}
141
144
  renderPreview={renderPreview}
142
145
  renderGenerating={renderGenerating}
@@ -10,11 +10,13 @@ import { View, StyleSheet } from "react-native";
10
10
  interface IndeterminateProgressBarProps {
11
11
  readonly backgroundColor: string;
12
12
  readonly fillColor: string;
13
+ readonly height?: number;
13
14
  }
14
15
 
15
16
  export const IndeterminateProgressBar: React.FC<IndeterminateProgressBarProps> = ({
16
17
  backgroundColor,
17
18
  fillColor,
19
+ height = 8,
18
20
  }) => {
19
21
  const [position, setPosition] = useState(0);
20
22
  const directionRef = useRef(1);
@@ -39,7 +41,7 @@ export const IndeterminateProgressBar: React.FC<IndeterminateProgressBarProps> =
39
41
  }, []);
40
42
 
41
43
  return (
42
- <View style={[styles.progressBar, { backgroundColor }]}>
44
+ <View style={[styles.progressBar, { backgroundColor, height }]}>
43
45
  <View
44
46
  style={[
45
47
  styles.progressFill,
@@ -50,6 +50,7 @@ interface WizardFlowContentProps {
50
50
  readonly onCreditsExhausted?: () => void;
51
51
  readonly onBack?: () => void;
52
52
  readonly onTryAgain?: () => void;
53
+ readonly onDismissGenerating?: () => void;
53
54
  readonly t: (key: string) => string;
54
55
  readonly renderPreview?: (onContinue: () => void) => React.ReactElement | null;
55
56
  readonly renderGenerating?: (progress: number) => React.ReactElement | null;
@@ -77,6 +78,7 @@ export const WizardFlowContent: React.FC<WizardFlowContentProps> = (props) => {
77
78
  onCreditsExhausted,
78
79
  onBack,
79
80
  onTryAgain,
81
+ onDismissGenerating,
80
82
  t,
81
83
  renderPreview,
82
84
  renderGenerating,
@@ -186,6 +188,7 @@ export const WizardFlowContent: React.FC<WizardFlowContentProps> = (props) => {
186
188
  onGenerationComplete,
187
189
  onGenerationError,
188
190
  onBack,
191
+ onDismissGenerating,
189
192
  });
190
193
 
191
194
  useWizardGeneration({
@@ -18,10 +18,11 @@ interface UseGenerationHandlersProps {
18
18
  readonly onGenerationComplete?: (result: unknown) => void;
19
19
  readonly onGenerationError?: (error: string, errorInfo?: GenerationErrorInfo) => void;
20
20
  readonly onBack?: () => void;
21
+ readonly onDismissGenerating?: () => void;
21
22
  }
22
23
 
23
24
  export function useGenerationHandlers(props: UseGenerationHandlersProps) {
24
- const { skipResultStep, t, nextStep, setResult, setCurrentCreation, onGenerationComplete, onGenerationError, onBack } = props;
25
+ const { skipResultStep, t, nextStep, setResult, setCurrentCreation, onGenerationComplete, onGenerationError, onBack, onDismissGenerating } = props;
25
26
 
26
27
  const alert = useAlert();
27
28
 
@@ -65,8 +66,12 @@ export function useGenerationHandlers(props: UseGenerationHandlersProps) {
65
66
  console.log("[handleDismissGenerating] User dismissed generating screen");
66
67
  }
67
68
  alert.show(AlertType.INFO, AlertMode.TOAST, t("generator.backgroundTitle"), t("generator.backgroundMessage"));
68
- onBack?.();
69
- }, [alert, t, onBack]);
69
+ if (onDismissGenerating) {
70
+ onDismissGenerating();
71
+ } else {
72
+ onBack?.();
73
+ }
74
+ }, [alert, t, onBack, onDismissGenerating]);
70
75
 
71
76
  return { handleGenerationComplete, handleGenerationError, handleDismissGenerating };
72
77
  }
@@ -13,7 +13,7 @@ export function useWizardFlowHandlers(props: UseWizardFlowHandlersProps) {
13
13
  const {
14
14
  currentStepIndex, flowSteps, customData, userId, currentCreation,
15
15
  repository, t, nextStep, previousStep, setCustomData,
16
- onGenerationStart, onBack,
16
+ onGenerationStart, onBack, onDismissGenerating,
17
17
  } = props;
18
18
 
19
19
  const alert = useAlert();
@@ -27,6 +27,7 @@ export function useWizardFlowHandlers(props: UseWizardFlowHandlersProps) {
27
27
  onGenerationComplete: props.onGenerationComplete,
28
28
  onGenerationError: props.onGenerationError,
29
29
  onBack,
30
+ onDismissGenerating,
30
31
  });
31
32
 
32
33
  const navigation = useNavigationHandlers({
@@ -26,4 +26,5 @@ export interface UseWizardFlowHandlersProps {
26
26
  readonly onGenerationComplete?: (result: unknown) => void;
27
27
  readonly onGenerationError?: (error: string, errorInfo?: GenerationErrorInfo) => void;
28
28
  readonly onBack?: () => void;
29
+ readonly onDismissGenerating?: () => void;
29
30
  }
@@ -195,6 +195,7 @@ export const GeneratingScreen: React.FC<GeneratingScreenProps> = ({
195
195
  <IndeterminateProgressBar
196
196
  backgroundColor={tokens.colors.surfaceVariant}
197
197
  fillColor={tokens.colors.primary}
198
+ height={4}
198
199
  />
199
200
  </View>
200
201
  <AtomicText type="bodySmall" style={[styles.hint, { color: tokens.colors.textSecondary, opacity: 0.7 }]}>
@@ -23,8 +23,8 @@ export const ResultActionBar: React.FC<ResultActionBarProps> = ({
23
23
  iconOnly = false,
24
24
  showTryAgain = true,
25
25
  showRating = false,
26
- onEdit,
27
- onEditVideo,
26
+ onEdit: _onEdit,
27
+ onEditVideo: _onEditVideo,
28
28
  onShareToFeed,
29
29
  }) => {
30
30
  const tokens = useAppDesignTokens();