@umituz/react-native-ai-generation-content 1.26.66 → 1.26.67
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.26.
|
|
3
|
+
"version": "1.26.67",
|
|
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",
|
|
@@ -38,6 +38,9 @@ export interface GenericWizardFlowProps {
|
|
|
38
38
|
readonly onGenerationComplete?: (result: unknown) => void;
|
|
39
39
|
readonly onGenerationError?: (error: string) => void;
|
|
40
40
|
readonly onCreditsExhausted?: () => void;
|
|
41
|
+
/** Auth check - orchestrator will check auth BEFORE credits */
|
|
42
|
+
readonly isAuthenticated?: () => boolean;
|
|
43
|
+
readonly onAuthRequired?: () => void;
|
|
41
44
|
readonly onRate?: (creationId: string, rating: number, description: string) => Promise<boolean>;
|
|
42
45
|
readonly onBack?: () => void;
|
|
43
46
|
readonly onTryAgain?: () => void;
|
|
@@ -58,6 +61,8 @@ export const GenericWizardFlow: React.FC<GenericWizardFlowProps> = ({
|
|
|
58
61
|
onGenerationComplete,
|
|
59
62
|
onGenerationError,
|
|
60
63
|
onCreditsExhausted,
|
|
64
|
+
isAuthenticated,
|
|
65
|
+
onAuthRequired,
|
|
61
66
|
onRate,
|
|
62
67
|
onBack,
|
|
63
68
|
onTryAgain,
|
|
@@ -125,6 +130,8 @@ export const GenericWizardFlow: React.FC<GenericWizardFlowProps> = ({
|
|
|
125
130
|
onError: onGenerationError,
|
|
126
131
|
onProgressChange: handleProgressChange,
|
|
127
132
|
onCreditsExhausted,
|
|
133
|
+
isAuthenticated,
|
|
134
|
+
onAuthRequired,
|
|
128
135
|
});
|
|
129
136
|
|
|
130
137
|
useEffect(() => {
|
|
@@ -36,6 +36,9 @@ export interface UseWizardGenerationProps {
|
|
|
36
36
|
readonly onError?: (error: string) => void;
|
|
37
37
|
readonly onProgressChange?: (progress: number) => void;
|
|
38
38
|
readonly onCreditsExhausted?: () => void;
|
|
39
|
+
/** Auth check - if user not authenticated, onAuthRequired will be called */
|
|
40
|
+
readonly isAuthenticated?: () => boolean;
|
|
41
|
+
readonly onAuthRequired?: () => void;
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
export interface UseWizardGenerationReturn {
|
|
@@ -60,6 +63,8 @@ export const useWizardGeneration = (
|
|
|
60
63
|
onError,
|
|
61
64
|
onProgressChange,
|
|
62
65
|
onCreditsExhausted,
|
|
66
|
+
isAuthenticated,
|
|
67
|
+
onAuthRequired,
|
|
63
68
|
} = props;
|
|
64
69
|
|
|
65
70
|
const hasStarted = useRef(false);
|
|
@@ -97,6 +102,10 @@ export const useWizardGeneration = (
|
|
|
97
102
|
unknown: "An error occurred",
|
|
98
103
|
},
|
|
99
104
|
onCreditsExhausted,
|
|
105
|
+
// Auth config - check auth BEFORE credits
|
|
106
|
+
auth: isAuthenticated && onAuthRequired
|
|
107
|
+
? { isAuthenticated, onAuthRequired }
|
|
108
|
+
: undefined,
|
|
100
109
|
onSuccess: (result) => {
|
|
101
110
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
102
111
|
console.log("[useWizardGeneration] Success");
|