@umituz/react-native-ai-generation-content 1.74.0 → 1.74.2

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.74.0",
3
+ "version": "1.74.2",
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",
@@ -35,6 +35,7 @@ export interface GenericWizardFlowProps {
35
35
  readonly onGenerationStart?: (
36
36
  data: Record<string, unknown>,
37
37
  proceedToGenerating: () => void,
38
+ onError?: (error: string) => void,
38
39
  ) => void;
39
40
  readonly onGenerationComplete?: (result: unknown) => void;
40
41
  readonly onGenerationError?: (error: string, errorInfo?: GenerationErrorInfo) => void;
@@ -28,6 +28,12 @@ export interface BaseWizardFlowProps {
28
28
  readonly calculateCredits?: CreditCalculatorFn;
29
29
  /** Called when network is unavailable and generation is blocked */
30
30
  readonly onNetworkError?: () => void;
31
+ /** Called when generation starts - APP handles credit deduction here */
32
+ readonly onGenerationStart?: (
33
+ data: Record<string, unknown>,
34
+ proceedToGenerating: () => void,
35
+ onError?: (error: string) => void,
36
+ ) => void;
31
37
  /** Called when generation completes */
32
38
  readonly onGenerationComplete?: () => void;
33
39
  /** Called on generation error with refund eligibility info */
@@ -36,6 +36,7 @@ export interface WizardFlowContentProps {
36
36
  readonly onGenerationStart?: (
37
37
  data: Record<string, unknown>,
38
38
  proceedToGenerating: () => void,
39
+ onError?: (error: string) => void,
39
40
  ) => void;
40
41
  readonly onGenerationComplete?: (result: unknown) => void;
41
42
  readonly onGenerationError?: (error: string) => void;
@@ -26,6 +26,7 @@ export const ImageToVideoWizardFlow: React.FC<ImageToVideoWizardFlowProps> = (pr
26
26
  creditCost,
27
27
  calculateCredits,
28
28
  onNetworkError,
29
+ onGenerationStart: appOnGenerationStart,
29
30
  onGenerationComplete,
30
31
  onGenerationError,
31
32
  onBack,
@@ -57,12 +58,14 @@ export const ImageToVideoWizardFlow: React.FC<ImageToVideoWizardFlowProps> = (pr
57
58
 
58
59
  const defaultAlerts = useMemo(() => createDefaultAlerts(t), [t]);
59
60
 
60
- const { handleGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
61
+ const { handleGenerationStart: defaultGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
61
62
  requireFeature,
62
63
  onGenerationComplete,
63
64
  onBack,
64
65
  });
65
66
 
67
+ const handleGenerationStart = appOnGenerationStart ?? defaultGenerationStart;
68
+
66
69
  return (
67
70
  <View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
68
71
  <GenericWizardFlow
@@ -25,6 +25,7 @@ export const TextToImageWizardFlow: React.FC<TextToImageWizardFlowProps> = (prop
25
25
  creditCost,
26
26
  calculateCredits,
27
27
  onNetworkError,
28
+ onGenerationStart: appOnGenerationStart,
28
29
  onGenerationComplete,
29
30
  onGenerationError,
30
31
  onBack,
@@ -58,12 +59,14 @@ export const TextToImageWizardFlow: React.FC<TextToImageWizardFlowProps> = (prop
58
59
  [model, t]
59
60
  );
60
61
 
61
- const { handleGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
62
+ const { handleGenerationStart: defaultGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
62
63
  requireFeature,
63
64
  onGenerationComplete,
64
65
  onBack,
65
66
  });
66
67
 
68
+ const handleGenerationStart = appOnGenerationStart ?? defaultGenerationStart;
69
+
67
70
  return (
68
71
  <View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
69
72
  <GenericWizardFlow
@@ -26,6 +26,7 @@ export const TextToVideoWizardFlow: React.FC<TextToVideoWizardFlowProps> = (prop
26
26
  creditCost,
27
27
  calculateCredits,
28
28
  onNetworkError,
29
+ onGenerationStart: appOnGenerationStart,
29
30
  onGenerationComplete,
30
31
  onGenerationError,
31
32
  onBack,
@@ -57,12 +58,16 @@ export const TextToVideoWizardFlow: React.FC<TextToVideoWizardFlowProps> = (prop
57
58
 
58
59
  const defaultAlerts = useMemo(() => createDefaultAlerts(t), [t]);
59
60
 
60
- const { handleGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
61
+ const { handleGenerationStart: defaultGenerationStart, handleGenerationComplete } = useWizardFlowHandlers({
61
62
  requireFeature,
62
63
  onGenerationComplete,
63
64
  onBack,
64
65
  });
65
66
 
67
+ // Use app's onGenerationStart if provided (handles credit deduction),
68
+ // otherwise use default (just requireFeature check)
69
+ const handleGenerationStart = appOnGenerationStart ?? defaultGenerationStart;
70
+
66
71
  return (
67
72
  <View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
68
73
  <GenericWizardFlow
package/src/index.ts CHANGED
@@ -31,3 +31,12 @@ export {
31
31
  IMAGE_TO_VIDEO_WIZARD_CONFIG,
32
32
  } from "./domains/generation/wizard";
33
33
  export type { WizardScenarioData } from "./domains/generation/wizard";
34
+
35
+ // Wizard Validators and Credit Utilities
36
+ export {
37
+ validateDuration,
38
+ validateResolution,
39
+ convertCostToCredits,
40
+ getCreditConfig,
41
+ } from "./domains/generation/wizard";
42
+ export type { ValidationResult, CreditCalculatorFn } from "./domains/generation/wizard";