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

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.19",
3
+ "version": "1.27.21",
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: (options?: { skipAuthCheck?: boolean }) => Promise<TextToImageGenerationResult | null>;
37
+ handleGenerate: () => Promise<TextToImageGenerationResult | null>;
38
38
  }
39
39
 
40
40
  const DEFAULT_ALERT_MESSAGES: AlertMessages = {
@@ -92,8 +92,7 @@ export function useGeneration(options: UseGenerationOptions): UseGenerationRetur
92
92
  },
93
93
  });
94
94
 
95
- const handleGenerate = useCallback(async (options?: { skipAuthCheck?: boolean }): Promise<TextToImageGenerationResult | null> => {
96
- const { skipAuthCheck = false } = options ?? {};
95
+ const handleGenerate = useCallback(async (): Promise<TextToImageGenerationResult | null> => {
97
96
  const trimmedPrompt = formState.prompt.trim();
98
97
 
99
98
  if (!trimmedPrompt) {
@@ -104,29 +103,8 @@ export function useGeneration(options: UseGenerationOptions): UseGenerationRetur
104
103
  return { success: false, error: "Prompt is required" };
105
104
  }
106
105
 
107
- // Auth check BEFORE generation (skip if retrying after successful auth)
108
- if (!skipAuthCheck && !callbacks.isAuthenticated()) {
109
- if (typeof __DEV__ !== "undefined" && __DEV__) {
110
- console.log("[TextToImage] Auth required");
111
- }
112
- // Pass retry callback to resume generation after auth (skip auth check on retry)
113
- callbacks.onAuthRequired?.(() => {
114
- if (typeof __DEV__ !== "undefined" && __DEV__) {
115
- console.log("[TextToImage] Retrying generation after auth (skipping auth check)");
116
- }
117
- void handleGenerate({ skipAuthCheck: true });
118
- });
119
- return { success: false, error: "Authentication required" };
120
- }
121
-
122
- // Credit check BEFORE generation
123
- if (!callbacks.canAfford(totalCost)) {
124
- if (typeof __DEV__ !== "undefined" && __DEV__) {
125
- console.log("[TextToImage] Insufficient credits", { totalCost });
126
- }
127
- callbacks.onCreditsRequired?.(totalCost);
128
- return { success: false, error: "Insufficient credits" };
129
- }
106
+ // Auth and credit checks should be handled by useFeatureGate before calling this
107
+ // Only keeping prompt validation here
130
108
 
131
109
  const request: TextToImageGenerationRequest = {
132
110
  prompt: trimmedPrompt,
@@ -148,7 +126,7 @@ export function useGeneration(options: UseGenerationOptions): UseGenerationRetur
148
126
 
149
127
  // Return result based on orchestrator state
150
128
  return null; // Result handled via callbacks
151
- }, [formState, generate, callbacks, totalCost]);
129
+ }, [formState, generate, callbacks]);
152
130
 
153
131
  return {
154
132
  generationState: {