@umituz/react-native-ai-generation-content 1.57.2 → 1.57.3

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.57.2",
3
+ "version": "1.57.3",
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",
@@ -19,10 +19,14 @@ export interface BaseWizardFlowProps {
19
19
  readonly isCreditsLoaded: boolean;
20
20
  /** Credit cost for this generation - REQUIRED, determined by the app */
21
21
  readonly creditCost: number;
22
+ /** Is device offline - prevents generation when true */
23
+ readonly isOffline?: boolean;
22
24
  /** Show auth modal with callback */
23
25
  readonly onShowAuthModal: (callback: () => void) => void;
24
26
  /** Show paywall */
25
27
  readonly onShowPaywall: () => void;
28
+ /** Called when network is unavailable and generation is blocked */
29
+ readonly onNetworkError?: () => void;
26
30
  /** Called when generation completes */
27
31
  readonly onGenerationComplete?: () => void;
28
32
  /** Called on generation error */
@@ -34,8 +34,10 @@ export const ImageToVideoWizardFlow: React.FC<ImageToVideoWizardFlowProps> = (pr
34
34
  creditBalance,
35
35
  isCreditsLoaded,
36
36
  creditCost,
37
+ isOffline,
37
38
  onShowAuthModal,
38
39
  onShowPaywall,
40
+ onNetworkError,
39
41
  onGenerationComplete,
40
42
  onGenerationError,
41
43
  onBack,
@@ -69,11 +71,15 @@ export const ImageToVideoWizardFlow: React.FC<ImageToVideoWizardFlowProps> = (pr
69
71
 
70
72
  const handleGenerationStart = useCallback(
71
73
  (_data: Record<string, unknown>, proceed: () => void) => {
74
+ // Network check - must be online to generate
75
+ if (isOffline) { onNetworkError?.(); return; }
76
+ // Auth check - must be authenticated
72
77
  if (!isAuthenticated) { onShowAuthModal(proceed); return; }
78
+ // Credit check - must have enough credits
73
79
  if (!hasPremium && isCreditsLoaded && creditBalance < creditCost) { onShowPaywall(); return; }
74
80
  proceed();
75
81
  },
76
- [isAuthenticated, hasPremium, creditBalance, creditCost, isCreditsLoaded, onShowAuthModal, onShowPaywall],
82
+ [isOffline, isAuthenticated, hasPremium, creditBalance, creditCost, isCreditsLoaded, onNetworkError, onShowAuthModal, onShowPaywall],
77
83
  );
78
84
 
79
85
  const handleGenerationComplete = useCallback(() => {
@@ -34,8 +34,10 @@ export const TextToImageWizardFlow: React.FC<TextToImageWizardFlowProps> = (prop
34
34
  creditBalance,
35
35
  isCreditsLoaded,
36
36
  creditCost,
37
+ isOffline,
37
38
  onShowAuthModal,
38
39
  onShowPaywall,
40
+ onNetworkError,
39
41
  onGenerationComplete,
40
42
  onGenerationError,
41
43
  onBack,
@@ -69,11 +71,15 @@ export const TextToImageWizardFlow: React.FC<TextToImageWizardFlowProps> = (prop
69
71
 
70
72
  const handleGenerationStart = useCallback(
71
73
  (_data: Record<string, unknown>, proceed: () => void) => {
74
+ // Network check - must be online to generate
75
+ if (isOffline) { onNetworkError?.(); return; }
76
+ // Auth check - must be authenticated
72
77
  if (!isAuthenticated) { onShowAuthModal(proceed); return; }
78
+ // Credit check - must have enough credits
73
79
  if (!hasPremium && isCreditsLoaded && creditBalance < creditCost) { onShowPaywall(); return; }
74
80
  proceed();
75
81
  },
76
- [isAuthenticated, hasPremium, creditBalance, creditCost, isCreditsLoaded, onShowAuthModal, onShowPaywall],
82
+ [isOffline, isAuthenticated, hasPremium, creditBalance, creditCost, isCreditsLoaded, onNetworkError, onShowAuthModal, onShowPaywall],
77
83
  );
78
84
 
79
85
  const handleGenerationComplete = useCallback(() => {
@@ -34,8 +34,10 @@ export const TextToVideoWizardFlow: React.FC<TextToVideoWizardFlowProps> = (prop
34
34
  creditBalance,
35
35
  isCreditsLoaded,
36
36
  creditCost,
37
+ isOffline,
37
38
  onShowAuthModal,
38
39
  onShowPaywall,
40
+ onNetworkError,
39
41
  onGenerationComplete,
40
42
  onGenerationError,
41
43
  onBack,
@@ -69,11 +71,15 @@ export const TextToVideoWizardFlow: React.FC<TextToVideoWizardFlowProps> = (prop
69
71
 
70
72
  const handleGenerationStart = useCallback(
71
73
  (_data: Record<string, unknown>, proceed: () => void) => {
74
+ // Network check - must be online to generate
75
+ if (isOffline) { onNetworkError?.(); return; }
76
+ // Auth check - must be authenticated
72
77
  if (!isAuthenticated) { onShowAuthModal(proceed); return; }
78
+ // Credit check - must have enough credits
73
79
  if (!hasPremium && isCreditsLoaded && creditBalance < creditCost) { onShowPaywall(); return; }
74
80
  proceed();
75
81
  },
76
- [isAuthenticated, hasPremium, creditBalance, creditCost, isCreditsLoaded, onShowAuthModal, onShowPaywall],
82
+ [isOffline, isAuthenticated, hasPremium, creditBalance, creditCost, isCreditsLoaded, onNetworkError, onShowAuthModal, onShowPaywall],
77
83
  );
78
84
 
79
85
  const handleGenerationComplete = useCallback(() => {