@umituz/react-native-ai-generation-content 1.20.38 → 1.20.39

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.20.38",
3
+ "version": "1.20.39",
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",
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { useSingleImageFeature, type BaseSingleImageHookReturn } from "../../../image-to-image";
7
- import type { HDTouchUpFeatureConfig, HDTouchUpResult } from "../../domain/types";
7
+ import type { HDTouchUpFeatureConfig } from "../../domain/types";
8
8
 
9
9
  export interface UseHDTouchUpFeatureProps {
10
10
  config: HDTouchUpFeatureConfig;
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { useSingleImageFeature, type BaseSingleImageHookReturn } from "../../../image-to-image";
7
- import type { PhotoRestoreFeatureConfig, PhotoRestoreResult } from "../../domain/types";
7
+ import type { PhotoRestoreFeatureConfig } from "../../domain/types";
8
8
 
9
9
  export interface UsePhotoRestoreFeatureProps {
10
10
  config: PhotoRestoreFeatureConfig;
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { useSingleImageFeature, type BaseSingleImageHookReturn } from "../../../image-to-image";
7
- import type { RemoveBackgroundFeatureConfig, RemoveBackgroundResult } from "../../domain/types";
7
+ import type { RemoveBackgroundFeatureConfig } from "../../domain/types";
8
8
 
9
9
  export interface UseRemoveBackgroundFeatureProps {
10
10
  config: RemoveBackgroundFeatureConfig;
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { useSingleImageFeature, type BaseSingleImageHookReturn } from "../../../image-to-image";
7
- import type { UpscaleFeatureConfig, UpscaleResult } from "../../domain/types";
7
+ import type { UpscaleFeatureConfig } from "../../domain/types";
8
8
 
9
9
  export interface UseUpscaleFeatureProps {
10
10
  config: UpscaleFeatureConfig;
@@ -4,7 +4,6 @@ import { View, Image, StyleSheet } from "react-native";
4
4
  import { AIGenerationHero } from "./AIGenerationHero";
5
5
  import { AIGenerationForm } from "./AIGenerationForm";
6
6
  import type { AIGenerationFormProps } from "./AIGenerationForm.types";
7
- import { useAppDesignTokens } from "@umituz/react-native-design-system";
8
7
 
9
8
  export interface AIGenerationConfigProps extends Omit<AIGenerationFormProps, "isGenerating" | "progress"> {
10
9
  readonly heroTitle: string;
@@ -24,8 +23,6 @@ export const AIGenerationConfig: React.FC<AIGenerationConfigProps> = ({
24
23
  progress = 0,
25
24
  ...formProps
26
25
  }) => {
27
- const tokens = useAppDesignTokens();
28
-
29
26
  return (
30
27
  <View style={styles.container}>
31
28
  {heroTitle && (
@@ -61,7 +61,7 @@ export const AIGenerateWizardFlow: React.FC<AIGenerateWizardFlowProps> = ({
61
61
  <PartnerStepScreen
62
62
  t={t}
63
63
  onBack={handleBack}
64
- onContinue={(img: any) => {
64
+ onContinue={(img: { uri: string; previewUrl?: string }) => {
65
65
  setStepImage(isStep2 ? 1 : 0, { uri: img.uri, previewUrl: img.previewUrl || img.uri });
66
66
  handleNext();
67
67
  }}
@@ -184,7 +184,7 @@ export const AIGenerateWizardFlow: React.FC<AIGenerateWizardFlowProps> = ({
184
184
  isGenerating={isGenerating}
185
185
  progress={progress}
186
186
  presets={presets}
187
- onPresetPress={handleGenerate as any}
187
+ onPresetPress={() => { void handleGenerate(); }}
188
188
  prompt={prompt}
189
189
  onPromptChange={setPrompt}
190
190
  styles={styleOptions}
@@ -33,11 +33,24 @@ export interface AIGenerateWizardTranslations {
33
33
  readonly maxFileSize: string;
34
34
  }
35
35
 
36
+ export interface StyleOption {
37
+ readonly id: string;
38
+ readonly label: string;
39
+ readonly icon?: string;
40
+ }
41
+
42
+ export interface PresetOption {
43
+ readonly id: string;
44
+ readonly label: string;
45
+ readonly prompt?: string;
46
+ readonly icon?: string;
47
+ }
48
+
36
49
  export interface AIGenerateWizardFlowProps {
37
50
  readonly featureType: string;
38
51
  readonly translations: AIGenerateWizardTranslations;
39
- readonly styleOptions: any[];
40
- readonly presets: any[];
52
+ readonly styleOptions: StyleOption[];
53
+ readonly presets: PresetOption[];
41
54
  readonly durationOptions: number[];
42
55
  readonly onGenerate: (data: {
43
56
  prompt: string;
@@ -3,9 +3,16 @@ import { useMemo, useCallback, useEffect } from "react";
3
3
  import { useAIGenerateState, AIGenerateStep } from "../../hooks/generation/useAIGenerateState";
4
4
  import { getAIFeatureConfig, hasAIFeature } from "../../screens/ai-feature/registry";
5
5
 
6
+ interface GenerationData {
7
+ prompt: string;
8
+ style: string;
9
+ duration: number;
10
+ images: { uri: string; previewUrl?: string }[];
11
+ }
12
+
6
13
  interface UseAIGenerateWizardFlowProps {
7
14
  featureType: string;
8
- onGenerate: (data: any) => Promise<string | null | void>;
15
+ onGenerate: (data: GenerationData) => Promise<string | null | void>;
9
16
  onBack?: () => void;
10
17
  }
11
18
 
@@ -15,15 +22,15 @@ export function useAIGenerateWizardFlow({
15
22
  onBack: onBackProp,
16
23
  }: UseAIGenerateWizardFlowProps) {
17
24
  const state = useAIGenerateState();
18
- const {
19
- currentStep, setCurrentStep, isGenerating, setIsGenerating,
20
- setProgress, setResult, images, prompt, selectedStyle,
21
- selectedDuration, setStepImage
25
+ const {
26
+ currentStep, setCurrentStep, setIsGenerating,
27
+ setProgress, setResult, images, prompt, selectedStyle,
28
+ selectedDuration
22
29
  } = state;
23
30
 
24
31
  const imageCountRequired = useMemo(() => {
25
32
  if (!featureType || !hasAIFeature(featureType)) return 0;
26
- const config = getAIFeatureConfig(featureType as any);
33
+ const config = getAIFeatureConfig(featureType as Parameters<typeof getAIFeatureConfig>[0]);
27
34
  if (config.mode === "dual" || config.mode === "dual-video") return 2;
28
35
  if (config.mode === "single" || config.mode === "single-with-prompt")
29
36
  return 1;
@@ -70,7 +70,10 @@ export const useGenerationOrchestrator = <TInput, TResult>(
70
70
 
71
71
  const offlineStore = useOfflineStore();
72
72
  const { showError, showSuccess } = useAlert();
73
- const defaultCredits = useDeductCredit({ userId, onCreditsExhausted }) as any;
73
+ const defaultCredits = useDeductCredit({ userId, onCreditsExhausted }) as {
74
+ checkCredits: (amount: number) => Promise<boolean>;
75
+ deductCredit: (amount: number) => Promise<void>;
76
+ };
74
77
 
75
78
  // Use provided credit callbacks or default to useDeductCredit hook
76
79
  const checkCredits = credits?.checkCredits ?? defaultCredits.checkCredits;
@@ -9,12 +9,25 @@ import { prepareImage } from "../../../infrastructure/utils";
9
9
  import type { AIFeatureId } from "../../screens/ai-feature/types";
10
10
  import type { ImageFeatureType, VideoFeatureType } from "../../../domain/interfaces";
11
11
 
12
+ interface AlertMessages {
13
+ success?: string;
14
+ error?: string;
15
+ network?: string;
16
+ credits?: string;
17
+ }
18
+
19
+ interface GenerationError {
20
+ type: string;
21
+ message: string;
22
+ originalError?: Error;
23
+ }
24
+
12
25
  interface FeatureGenerationConfig {
13
26
  featureType: AIFeatureId;
14
27
  userId?: string;
15
- alertMessages: any;
16
- onSuccess?: (result: any) => void;
17
- onError?: (error: any) => void;
28
+ alertMessages: AlertMessages;
29
+ onSuccess?: (result: string) => void;
30
+ onError?: (error: GenerationError) => void;
18
31
  creditCost?: number;
19
32
  onCreditsExhausted?: () => void;
20
33
  }