@umituz/react-native-ai-generation-content 1.81.6 → 1.82.1
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 +3 -1
- package/src/domains/generation/presentation/useAIGeneration.hook.ts +0 -2
- package/src/domains/generation/wizard/presentation/components/WizardFlowContent.tsx +5 -2
- package/src/domains/generation/wizard/presentation/components/step-renderers/renderTextInputStep.tsx +1 -2
- package/src/domains/generation/wizard/presentation/hooks/usePhotoBlockingGeneration.ts +0 -2
- package/src/domains/generation/wizard/presentation/hooks/videoQueuePoller.ts +3 -3
- package/src/domains/image-to-video/presentation/hooks/useImageToVideoFeature.ts +0 -1
- package/src/domains/text-to-video/presentation/hooks/useTextToVideoFeature.ts +0 -1
- package/src/infrastructure/orchestration/GenerationOrchestrator.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.82.1",
|
|
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",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@react-navigation/native": ">=6.0.0",
|
|
46
46
|
"@tanstack/react-query": ">=5.0.0",
|
|
47
|
+
"@umituz/react-native-ai-fal-provider": ">=3.0.0",
|
|
47
48
|
"@umituz/react-native-design-system": ">=4.0.0",
|
|
48
49
|
"@umituz/react-native-firebase": ">=1.0.0",
|
|
49
50
|
"@umituz/react-native-subscription": ">=2.23.0",
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"react-native-safe-area-context": ">=5.0.0"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
60
|
+
"@umituz/react-native-ai-fal-provider": "^3.2.0",
|
|
59
61
|
"@expo/vector-icons": "^15.0.3",
|
|
60
62
|
"@gorhom/bottom-sheet": "^5.2.8",
|
|
61
63
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
@@ -61,7 +61,6 @@ export function useAIGeneration(
|
|
|
61
61
|
alertMessages,
|
|
62
62
|
onSuccess,
|
|
63
63
|
onError,
|
|
64
|
-
onCreditsExhausted,
|
|
65
64
|
repository,
|
|
66
65
|
} = props;
|
|
67
66
|
|
|
@@ -86,7 +85,6 @@ export function useAIGeneration(
|
|
|
86
85
|
alertMessages: alertMessages || DEFAULT_ALERT_MESSAGES,
|
|
87
86
|
onSuccess,
|
|
88
87
|
onError: onError ? (error) => onError(error.message) : undefined,
|
|
89
|
-
onCreditsExhausted,
|
|
90
88
|
});
|
|
91
89
|
|
|
92
90
|
return {
|
|
@@ -151,8 +151,11 @@ export const WizardFlowContent: React.FC<WizardFlowContentProps> = (props) => {
|
|
|
151
151
|
hasImageInput,
|
|
152
152
|
});
|
|
153
153
|
|
|
154
|
-
//
|
|
155
|
-
|
|
154
|
+
// Validate: must be a positive finite integer
|
|
155
|
+
if (!Number.isFinite(result) || result <= 0) {
|
|
156
|
+
return creditCost;
|
|
157
|
+
}
|
|
158
|
+
return Math.ceil(result);
|
|
156
159
|
}, [customData, featureConfig.steps, validatedScenario.outputType, validatedScenario.inputType, calculateCredits, creditCost]);
|
|
157
160
|
|
|
158
161
|
const handlers = useWizardFlowHandlers({
|
package/src/domains/generation/wizard/presentation/components/step-renderers/renderTextInputStep.tsx
CHANGED
|
@@ -59,8 +59,7 @@ export function renderTextInputStep({
|
|
|
59
59
|
creditCost={creditCost}
|
|
60
60
|
onBack={onBack}
|
|
61
61
|
onContinue={(text) => {
|
|
62
|
-
|
|
63
|
-
onPhotoContinue(step.id, { uri: text, text, previewUrl: "" } as unknown as any);
|
|
62
|
+
onPhotoContinue(step.id, { uri: text, previewUrl: "" } as UploadedImage);
|
|
64
63
|
}}
|
|
65
64
|
/>
|
|
66
65
|
);
|
|
@@ -44,7 +44,6 @@ export function usePhotoBlockingGeneration(
|
|
|
44
44
|
alertMessages,
|
|
45
45
|
onSuccess,
|
|
46
46
|
onError,
|
|
47
|
-
onCreditsExhausted,
|
|
48
47
|
} = props;
|
|
49
48
|
|
|
50
49
|
const creationIdRef = useRef<string | null>(null);
|
|
@@ -97,7 +96,6 @@ export function usePhotoBlockingGeneration(
|
|
|
97
96
|
const { generate, isGenerating } = useGenerationOrchestrator(strategy, {
|
|
98
97
|
userId,
|
|
99
98
|
alertMessages,
|
|
100
|
-
onCreditsExhausted,
|
|
101
99
|
onSuccess: handleSuccess,
|
|
102
100
|
onError: handleError,
|
|
103
101
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { providerRegistry } from "../../../../../infrastructure/services/provider-registry.service";
|
|
2
|
-
import { extractResultUrl, type GenerationUrls } from "./generation-result.utils";
|
|
2
|
+
import { extractResultUrl, type GenerationUrls, type GenerationResult } from "./generation-result.utils";
|
|
3
3
|
import { QUEUE_STATUS } from "../../../../../domain/constants/queue-status.constants";
|
|
4
4
|
|
|
5
5
|
declare const __DEV__: boolean;
|
|
@@ -80,9 +80,9 @@ export const pollQueueStatus = async (params: PollParams): Promise<void> => {
|
|
|
80
80
|
try {
|
|
81
81
|
const result = await provider.getJobResult(model, requestId);
|
|
82
82
|
if (__DEV__) {
|
|
83
|
-
console.log("[VideoQueuePoller]
|
|
83
|
+
console.log("[VideoQueuePoller] Raw result from provider:", JSON.stringify(result, null, 2));
|
|
84
84
|
}
|
|
85
|
-
const urls = extractResultUrl(result);
|
|
85
|
+
const urls = extractResultUrl(result as GenerationResult);
|
|
86
86
|
if (__DEV__) {
|
|
87
87
|
console.log("[VideoQueuePoller] 🎬 Extracted URLs:", urls);
|
|
88
88
|
}
|
|
@@ -41,7 +41,6 @@ export function useImageToVideoFeature(props: UseImageToVideoFeatureProps): UseI
|
|
|
41
41
|
const orchestrator = useGenerationOrchestrator(strategy, {
|
|
42
42
|
userId,
|
|
43
43
|
alertMessages: DEFAULT_ALERT_MESSAGES,
|
|
44
|
-
onCreditsExhausted: () => callbacks?.onShowPaywall?.(config.creditCost ?? 0),
|
|
45
44
|
onSuccess: (result: unknown) => {
|
|
46
45
|
const typedResult = result as { success: boolean; videoUrl?: string; thumbnailUrl?: string };
|
|
47
46
|
if (typedResult.success && typedResult.videoUrl) {
|
|
@@ -70,7 +70,6 @@ export function useTextToVideoFeature(props: UseTextToVideoFeatureProps): UseTex
|
|
|
70
70
|
const orchestrator = useGenerationOrchestrator(strategy, {
|
|
71
71
|
userId,
|
|
72
72
|
alertMessages: DEFAULT_ALERT_MESSAGES,
|
|
73
|
-
onCreditsExhausted: () => callbacks.onShowPaywall?.(config.creditCost),
|
|
74
73
|
onSuccess: (result) => callbacks.onGenerate?.(result as TextToVideoResult),
|
|
75
74
|
onError: (err) => callbacks.onError?.(err.message),
|
|
76
75
|
});
|
|
@@ -120,8 +120,8 @@ export class GenerationOrchestrator {
|
|
|
120
120
|
try {
|
|
121
121
|
const actualUserId = this.requireAuthenticatedUser();
|
|
122
122
|
await this.config.creditService.add(actualUserId, amount);
|
|
123
|
-
} catch {
|
|
124
|
-
|
|
123
|
+
} catch (refundError) {
|
|
124
|
+
console.error("[GenerationOrchestrator] REFUND FAILED - user may have lost credits. Amount:", amount, "Error:", refundError);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
}
|