@umituz/react-native-ai-generation-content 1.57.2 → 1.57.4
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 +1 -1
- package/src/domains/generation/wizard/presentation/components/WizardFlow.types.ts +4 -0
- package/src/features/image-to-video/presentation/screens/ImageToVideoWizardFlow.tsx +39 -3
- package/src/features/text-to-image/presentation/screens/TextToImageWizardFlow.tsx +7 -1
- package/src/features/text-to-video/presentation/screens/TextToVideoWizardFlow.tsx +7 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.57.
|
|
3
|
+
"version": "1.57.4",
|
|
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,45 @@ export const ImageToVideoWizardFlow: React.FC<ImageToVideoWizardFlowProps> = (pr
|
|
|
69
71
|
|
|
70
72
|
const handleGenerationStart = useCallback(
|
|
71
73
|
(_data: Record<string, unknown>, proceed: () => void) => {
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
75
|
+
console.log("[ImageToVideoWizardFlow] handleGenerationStart:", {
|
|
76
|
+
isOffline,
|
|
77
|
+
isAuthenticated,
|
|
78
|
+
hasPremium,
|
|
79
|
+
creditBalance,
|
|
80
|
+
creditCost,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// Network check - must be online to generate
|
|
84
|
+
if (isOffline) {
|
|
85
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
86
|
+
console.log("[ImageToVideoWizardFlow] Blocked: offline");
|
|
87
|
+
}
|
|
88
|
+
onNetworkError?.();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// Auth check - must be authenticated
|
|
92
|
+
if (!isAuthenticated) {
|
|
93
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
94
|
+
console.log("[ImageToVideoWizardFlow] Blocked: not authenticated, showing auth modal");
|
|
95
|
+
}
|
|
96
|
+
onShowAuthModal(proceed);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// Credit check - must have enough credits
|
|
100
|
+
if (!hasPremium && isCreditsLoaded && creditBalance < creditCost) {
|
|
101
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
102
|
+
console.log("[ImageToVideoWizardFlow] Blocked: insufficient credits, showing paywall");
|
|
103
|
+
}
|
|
104
|
+
onShowPaywall();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
108
|
+
console.log("[ImageToVideoWizardFlow] All checks passed, proceeding");
|
|
109
|
+
}
|
|
74
110
|
proceed();
|
|
75
111
|
},
|
|
76
|
-
[isAuthenticated, hasPremium, creditBalance, creditCost, isCreditsLoaded, onShowAuthModal, onShowPaywall],
|
|
112
|
+
[isOffline, isAuthenticated, hasPremium, creditBalance, creditCost, isCreditsLoaded, onNetworkError, onShowAuthModal, onShowPaywall],
|
|
77
113
|
);
|
|
78
114
|
|
|
79
115
|
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(() => {
|