@umituz/react-native-ai-generation-content 1.27.18 → 1.27.19

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.18",
3
+ "version": "1.27.19",
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",
@@ -34,7 +34,7 @@ export interface TextToImageGenerationState {
34
34
  export interface UseGenerationReturn {
35
35
  generationState: TextToImageGenerationState;
36
36
  totalCost: number;
37
- handleGenerate: () => Promise<TextToImageGenerationResult | null>;
37
+ handleGenerate: (options?: { skipAuthCheck?: boolean }) => Promise<TextToImageGenerationResult | null>;
38
38
  }
39
39
 
40
40
  const DEFAULT_ALERT_MESSAGES: AlertMessages = {
@@ -92,7 +92,8 @@ export function useGeneration(options: UseGenerationOptions): UseGenerationRetur
92
92
  },
93
93
  });
94
94
 
95
- const handleGenerate = useCallback(async (): Promise<TextToImageGenerationResult | null> => {
95
+ const handleGenerate = useCallback(async (options?: { skipAuthCheck?: boolean }): Promise<TextToImageGenerationResult | null> => {
96
+ const { skipAuthCheck = false } = options ?? {};
96
97
  const trimmedPrompt = formState.prompt.trim();
97
98
 
98
99
  if (!trimmedPrompt) {
@@ -103,14 +104,17 @@ export function useGeneration(options: UseGenerationOptions): UseGenerationRetur
103
104
  return { success: false, error: "Prompt is required" };
104
105
  }
105
106
 
106
- // Auth check BEFORE generation
107
- if (!callbacks.isAuthenticated()) {
107
+ // Auth check BEFORE generation (skip if retrying after successful auth)
108
+ if (!skipAuthCheck && !callbacks.isAuthenticated()) {
108
109
  if (typeof __DEV__ !== "undefined" && __DEV__) {
109
110
  console.log("[TextToImage] Auth required");
110
111
  }
111
- // Pass retry callback to resume generation after auth
112
+ // Pass retry callback to resume generation after auth (skip auth check on retry)
112
113
  callbacks.onAuthRequired?.(() => {
113
- void handleGenerate();
114
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
115
+ console.log("[TextToImage] Retrying generation after auth (skipping auth check)");
116
+ }
117
+ void handleGenerate({ skipAuthCheck: true });
114
118
  });
115
119
  return { success: false, error: "Authentication required" };
116
120
  }