@umituz/react-native-ai-generation-content 1.27.16 → 1.27.18
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.27.
|
|
3
|
+
"version": "1.27.18",
|
|
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",
|
|
@@ -47,7 +47,8 @@ export interface TextToImageCallbacks {
|
|
|
47
47
|
calculateCost: (numImages: NumImages, model?: string | null) => number;
|
|
48
48
|
canAfford: (cost: number) => boolean;
|
|
49
49
|
isAuthenticated: () => boolean;
|
|
50
|
-
|
|
50
|
+
/** Called when auth is required. Pass retryCallback to resume after auth. */
|
|
51
|
+
onAuthRequired?: (retryCallback?: () => void) => void;
|
|
51
52
|
onCreditsRequired?: (cost: number) => void;
|
|
52
53
|
onSuccess?: (imageUrls: string[]) => void;
|
|
53
54
|
onError?: (error: string) => void;
|
|
@@ -108,7 +108,10 @@ export function useGeneration(options: UseGenerationOptions): UseGenerationRetur
|
|
|
108
108
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
109
109
|
console.log("[TextToImage] Auth required");
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
// Pass retry callback to resume generation after auth
|
|
112
|
+
callbacks.onAuthRequired?.(() => {
|
|
113
|
+
void handleGenerate();
|
|
114
|
+
});
|
|
112
115
|
return { success: false, error: "Authentication required" };
|
|
113
116
|
}
|
|
114
117
|
|
|
@@ -24,8 +24,8 @@ export interface AIFeatureCallbacksConfig<TRequest = unknown, TResult = unknown>
|
|
|
24
24
|
imageUrls?: string[];
|
|
25
25
|
}>;
|
|
26
26
|
|
|
27
|
-
// Actions from app
|
|
28
|
-
showAuthModal: () => void;
|
|
27
|
+
// Actions from app - showAuthModal accepts callback for post-auth resume
|
|
28
|
+
showAuthModal: (callback?: () => void) => void;
|
|
29
29
|
openPaywall: () => void;
|
|
30
30
|
deductCredits?: (amount: number) => Promise<void>;
|
|
31
31
|
|
|
@@ -53,7 +53,8 @@ export interface AIFeatureCallbacks<TRequest = unknown, TResult = unknown> {
|
|
|
53
53
|
calculateCost: (multiplier?: number, _model?: string | null) => number;
|
|
54
54
|
canAfford: (cost: number) => boolean;
|
|
55
55
|
isAuthenticated: () => boolean;
|
|
56
|
-
|
|
56
|
+
/** Called when auth is required. Pass retryCallback to resume after auth. */
|
|
57
|
+
onAuthRequired: (retryCallback?: () => void) => void;
|
|
57
58
|
onCreditsRequired: (cost?: number) => void;
|
|
58
59
|
onSuccess?: (result: TResult) => void;
|
|
59
60
|
onError?: (error: string) => void;
|
|
@@ -97,8 +98,8 @@ export function useAIFeatureCallbacks<TRequest = unknown, TResult = unknown>(
|
|
|
97
98
|
[creditCostPerUnit],
|
|
98
99
|
);
|
|
99
100
|
|
|
100
|
-
const onAuthRequired = useCallback(() => {
|
|
101
|
-
showAuthModal();
|
|
101
|
+
const onAuthRequired = useCallback((retryCallback?: () => void) => {
|
|
102
|
+
showAuthModal(retryCallback);
|
|
102
103
|
}, [showAuthModal]);
|
|
103
104
|
|
|
104
105
|
const onCreditsRequired = useCallback(
|