@umituz/react-native-ai-generation-content 1.17.0 → 1.17.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.
Files changed (110) hide show
  1. package/package.json +13 -14
  2. package/src/domains/creations/domain/entities/Creation.ts +33 -2
  3. package/src/domains/creations/domain/entities/index.ts +1 -1
  4. package/src/domains/creations/domain/types/creation-categories.ts +133 -0
  5. package/src/domains/creations/domain/types/creation-filter.ts +131 -0
  6. package/src/domains/creations/domain/types/creation-types.ts +63 -0
  7. package/src/domains/creations/domain/types/index.ts +44 -0
  8. package/src/domains/creations/domain/utils/creation-helpers.ts +134 -0
  9. package/src/domains/creations/domain/utils/index.ts +8 -0
  10. package/src/domains/creations/domain/utils/preview-helpers.ts +84 -0
  11. package/src/domains/creations/domain/utils/status-helpers.ts +90 -0
  12. package/src/domains/creations/index.ts +95 -21
  13. package/src/domains/creations/infrastructure/repositories/CreationsRepository.ts +14 -1
  14. package/src/domains/creations/presentation/components/CreationActions.tsx +120 -0
  15. package/src/domains/creations/presentation/components/CreationBadges.tsx +111 -0
  16. package/src/domains/creations/presentation/components/CreationCard.tsx +201 -102
  17. package/src/domains/creations/presentation/components/CreationPreview.tsx +117 -0
  18. package/src/domains/creations/presentation/components/CreationsFilterBar.tsx +254 -0
  19. package/src/domains/creations/presentation/components/CreationsGrid.tsx +121 -68
  20. package/src/domains/creations/presentation/components/index.ts +23 -3
  21. package/src/domains/creations/presentation/hooks/index.ts +1 -0
  22. package/src/domains/creations/presentation/hooks/useAdvancedFilter.ts +262 -0
  23. package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +5 -6
  24. package/src/features/ai-hug/domain/index.ts +5 -0
  25. package/src/features/ai-hug/domain/types/ai-hug.types.ts +72 -0
  26. package/src/features/ai-hug/domain/types/index.ts +14 -0
  27. package/src/features/ai-hug/index.ts +27 -0
  28. package/src/features/ai-hug/infrastructure/index.ts +5 -0
  29. package/src/features/ai-hug/infrastructure/services/ai-hug-executor.ts +96 -0
  30. package/src/features/ai-hug/infrastructure/services/index.ts +6 -0
  31. package/src/features/ai-hug/presentation/hooks/index.ts +9 -0
  32. package/src/features/ai-hug/presentation/hooks/useAIHugFeature.ts +157 -0
  33. package/src/features/ai-hug/presentation/index.ts +5 -0
  34. package/src/features/ai-kiss/domain/index.ts +5 -0
  35. package/src/features/ai-kiss/domain/types/ai-kiss.types.ts +72 -0
  36. package/src/features/ai-kiss/domain/types/index.ts +14 -0
  37. package/src/features/ai-kiss/index.ts +27 -0
  38. package/src/features/ai-kiss/infrastructure/index.ts +5 -0
  39. package/src/features/ai-kiss/infrastructure/services/ai-kiss-executor.ts +96 -0
  40. package/src/features/ai-kiss/infrastructure/services/index.ts +6 -0
  41. package/src/features/ai-kiss/presentation/hooks/index.ts +9 -0
  42. package/src/features/ai-kiss/presentation/hooks/useAIKissFeature.ts +157 -0
  43. package/src/features/ai-kiss/presentation/index.ts +5 -0
  44. package/src/features/anime-selfie/domain/index.ts +5 -0
  45. package/src/features/anime-selfie/domain/types/anime-selfie.types.ts +72 -0
  46. package/src/features/anime-selfie/domain/types/index.ts +15 -0
  47. package/src/features/anime-selfie/index.ts +28 -0
  48. package/src/features/anime-selfie/infrastructure/index.ts +5 -0
  49. package/src/features/anime-selfie/infrastructure/services/anime-selfie-executor.ts +95 -0
  50. package/src/features/anime-selfie/infrastructure/services/index.ts +6 -0
  51. package/src/features/anime-selfie/presentation/hooks/index.ts +9 -0
  52. package/src/features/anime-selfie/presentation/hooks/useAnimeSelfieFeature.ts +138 -0
  53. package/src/features/anime-selfie/presentation/index.ts +5 -0
  54. package/src/features/background/domain/types/index.ts +15 -0
  55. package/src/features/background/domain/types/replace-background.types.ts +82 -0
  56. package/src/features/background/index.ts +31 -3
  57. package/src/features/background/infrastructure/index.ts +5 -0
  58. package/src/features/background/infrastructure/services/index.ts +6 -0
  59. package/src/features/background/infrastructure/services/replace-background-executor.ts +95 -0
  60. package/src/features/background/presentation/hooks/index.ts +6 -1
  61. package/src/features/background/presentation/hooks/useReplaceBackgroundFeature.ts +160 -0
  62. package/src/features/face-swap/domain/index.ts +5 -0
  63. package/src/features/face-swap/domain/types/face-swap.types.ts +72 -0
  64. package/src/features/face-swap/domain/types/index.ts +14 -0
  65. package/src/features/face-swap/index.ts +27 -1
  66. package/src/features/face-swap/infrastructure/index.ts +5 -0
  67. package/src/features/face-swap/infrastructure/services/face-swap-executor.ts +96 -0
  68. package/src/features/face-swap/infrastructure/services/index.ts +6 -0
  69. package/src/features/face-swap/presentation/hooks/index.ts +9 -0
  70. package/src/features/face-swap/presentation/hooks/useFaceSwapFeature.ts +157 -0
  71. package/src/features/face-swap/presentation/index.ts +5 -0
  72. package/src/features/photo-restoration/domain/types/index.ts +2 -5
  73. package/src/features/photo-restoration/domain/types/photo-restore.types.ts +14 -0
  74. package/src/features/photo-restoration/index.ts +3 -8
  75. package/src/features/photo-restoration/infrastructure/services/index.ts +1 -6
  76. package/src/features/photo-restoration/infrastructure/services/photo-restore-executor.ts +64 -30
  77. package/src/features/photo-restoration/presentation/hooks/usePhotoRestoreFeature.ts +11 -6
  78. package/src/features/remove-background/domain/index.ts +5 -0
  79. package/src/features/remove-background/domain/types/index.ts +14 -0
  80. package/src/features/remove-background/domain/types/remove-background.types.ts +69 -0
  81. package/src/features/remove-background/index.ts +27 -0
  82. package/src/features/remove-background/infrastructure/index.ts +5 -0
  83. package/src/features/remove-background/infrastructure/services/index.ts +6 -0
  84. package/src/features/remove-background/infrastructure/services/remove-background-executor.ts +95 -0
  85. package/src/features/remove-background/presentation/hooks/index.ts +9 -0
  86. package/src/features/remove-background/presentation/hooks/useRemoveBackgroundFeature.ts +137 -0
  87. package/src/features/remove-background/presentation/index.ts +5 -0
  88. package/src/features/remove-object/domain/index.ts +5 -0
  89. package/src/features/remove-object/domain/types/index.ts +14 -0
  90. package/src/features/remove-object/domain/types/remove-object.types.ts +77 -0
  91. package/src/features/remove-object/index.ts +27 -0
  92. package/src/features/remove-object/infrastructure/index.ts +5 -0
  93. package/src/features/remove-object/infrastructure/services/index.ts +6 -0
  94. package/src/features/remove-object/infrastructure/services/remove-object-executor.ts +99 -0
  95. package/src/features/remove-object/presentation/hooks/index.ts +9 -0
  96. package/src/features/remove-object/presentation/hooks/useRemoveObjectFeature.ts +168 -0
  97. package/src/features/remove-object/presentation/index.ts +5 -0
  98. package/src/features/upscaling/domain/types/index.ts +0 -1
  99. package/src/features/upscaling/domain/types/upscale.types.ts +14 -0
  100. package/src/features/upscaling/index.ts +3 -11
  101. package/src/features/upscaling/infrastructure/services/index.ts +1 -6
  102. package/src/features/upscaling/infrastructure/services/upscale-executor.ts +64 -30
  103. package/src/features/upscaling/presentation/hooks/useUpscaleFeature.ts +12 -7
  104. package/src/index.ts +39 -0
  105. package/src/types/jsx.d.ts +19 -0
  106. package/src/features/face-swap/domain/entities.ts +0 -48
  107. package/src/features/photo-restoration/domain/types/provider.types.ts +0 -23
  108. package/src/features/photo-restoration/infrastructure/services/photo-restore-provider-registry.ts +0 -77
  109. package/src/features/upscaling/domain/types/provider.types.ts +0 -23
  110. package/src/features/upscaling/infrastructure/services/upscale-provider-registry.ts +0 -77
@@ -0,0 +1,168 @@
1
+ /**
2
+ * useRemoveObjectFeature Hook
3
+ * Manages remove object feature state and actions
4
+ */
5
+
6
+ import { useState, useCallback } from "react";
7
+ import { executeRemoveObject } from "../../infrastructure/services";
8
+ import type {
9
+ RemoveObjectFeatureState,
10
+ RemoveObjectFeatureConfig,
11
+ RemoveObjectResult,
12
+ } from "../../domain/types";
13
+
14
+ declare const __DEV__: boolean;
15
+
16
+ export interface UseRemoveObjectFeatureProps {
17
+ config: RemoveObjectFeatureConfig;
18
+ userId: string;
19
+ onSelectImage: () => Promise<string | null>;
20
+ onSelectMask?: () => Promise<string | null>;
21
+ onSaveImage: (imageUrl: string) => Promise<void>;
22
+ }
23
+
24
+ export interface UseRemoveObjectFeatureReturn extends RemoveObjectFeatureState {
25
+ selectImage: () => Promise<void>;
26
+ selectMask: () => Promise<void>;
27
+ setPrompt: (prompt: string) => void;
28
+ process: () => Promise<void>;
29
+ save: () => Promise<void>;
30
+ reset: () => void;
31
+ }
32
+
33
+ const initialState: RemoveObjectFeatureState = {
34
+ imageUri: null,
35
+ maskUri: null,
36
+ prompt: "",
37
+ processedUrl: null,
38
+ isProcessing: false,
39
+ progress: 0,
40
+ error: null,
41
+ };
42
+
43
+ export function useRemoveObjectFeature(
44
+ props: UseRemoveObjectFeatureProps,
45
+ ): UseRemoveObjectFeatureReturn {
46
+ const { config, userId, onSelectImage, onSelectMask, onSaveImage } = props;
47
+ const [state, setState] = useState<RemoveObjectFeatureState>(initialState);
48
+
49
+ const selectImage = useCallback(async () => {
50
+ try {
51
+ const uri = await onSelectImage();
52
+ if (uri) {
53
+ setState((prev) => ({ ...prev, imageUri: uri, error: null }));
54
+ config.onImageSelect?.(uri);
55
+ }
56
+ } catch (error) {
57
+ const message = error instanceof Error ? error.message : String(error);
58
+ setState((prev) => ({ ...prev, error: message }));
59
+ }
60
+ }, [onSelectImage, config]);
61
+
62
+ const selectMask = useCallback(async () => {
63
+ if (!onSelectMask) return;
64
+
65
+ try {
66
+ const uri = await onSelectMask();
67
+ if (uri) {
68
+ setState((prev) => ({ ...prev, maskUri: uri, error: null }));
69
+ config.onMaskSelect?.(uri);
70
+ }
71
+ } catch (error) {
72
+ const message = error instanceof Error ? error.message : String(error);
73
+ setState((prev) => ({ ...prev, error: message }));
74
+ }
75
+ }, [onSelectMask, config]);
76
+
77
+ const setPrompt = useCallback((prompt: string) => {
78
+ setState((prev) => ({ ...prev, prompt }));
79
+ }, []);
80
+
81
+ const handleProgress = useCallback((progress: number) => {
82
+ setState((prev) => ({ ...prev, progress }));
83
+ }, []);
84
+
85
+ const process = useCallback(async () => {
86
+ if (!state.imageUri) return;
87
+
88
+ setState((prev) => ({
89
+ ...prev,
90
+ isProcessing: true,
91
+ progress: 0,
92
+ error: null,
93
+ }));
94
+
95
+ config.onProcessingStart?.();
96
+
97
+ if (__DEV__) {
98
+ // eslint-disable-next-line no-console
99
+ console.log("[useRemoveObjectFeature] Starting object removal process");
100
+ }
101
+
102
+ const imageBase64 = await config.prepareImage(state.imageUri);
103
+ const maskBase64 = state.maskUri
104
+ ? await config.prepareImage(state.maskUri)
105
+ : undefined;
106
+
107
+ const result: RemoveObjectResult = await executeRemoveObject(
108
+ {
109
+ imageUri: state.imageUri,
110
+ imageBase64,
111
+ maskBase64,
112
+ prompt: state.prompt || undefined,
113
+ userId,
114
+ },
115
+ {
116
+ model: config.model,
117
+ buildInput: config.buildInput,
118
+ extractResult: config.extractResult,
119
+ onProgress: handleProgress,
120
+ },
121
+ );
122
+
123
+ if (result.success && result.imageUrl) {
124
+ const url = result.imageUrl;
125
+ setState((prev) => ({
126
+ ...prev,
127
+ isProcessing: false,
128
+ processedUrl: url,
129
+ progress: 100,
130
+ }));
131
+ config.onProcessingComplete?.(result);
132
+ } else {
133
+ const errorMessage = result.error || "Processing failed";
134
+ setState((prev) => ({
135
+ ...prev,
136
+ isProcessing: false,
137
+ error: errorMessage,
138
+ progress: 0,
139
+ }));
140
+ config.onError?.(errorMessage);
141
+ }
142
+ }, [state.imageUri, state.maskUri, state.prompt, userId, config, handleProgress]);
143
+
144
+ const save = useCallback(async () => {
145
+ if (!state.processedUrl) return;
146
+
147
+ try {
148
+ await onSaveImage(state.processedUrl);
149
+ } catch (error) {
150
+ const message = error instanceof Error ? error.message : String(error);
151
+ setState((prev) => ({ ...prev, error: message }));
152
+ }
153
+ }, [state.processedUrl, onSaveImage]);
154
+
155
+ const reset = useCallback(() => {
156
+ setState(initialState);
157
+ }, []);
158
+
159
+ return {
160
+ ...state,
161
+ selectImage,
162
+ selectMask,
163
+ setPrompt,
164
+ process,
165
+ save,
166
+ reset,
167
+ };
168
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Remove Object Presentation Index
3
+ */
4
+
5
+ export * from "./hooks";
@@ -1,2 +1 @@
1
1
  export * from "./upscale.types";
2
- export * from "./provider.types";
@@ -12,6 +12,7 @@ export interface UpscaleOptions {
12
12
 
13
13
  export interface UpscaleRequest {
14
14
  imageUri: string;
15
+ imageBase64?: string;
15
16
  userId: string;
16
17
  options?: UpscaleOptions;
17
18
  }
@@ -48,10 +49,23 @@ export interface UpscaleTranslations {
48
49
  compareHint?: string;
49
50
  }
50
51
 
52
+ export type UpscaleInputBuilder = (
53
+ base64: string,
54
+ options?: UpscaleOptions,
55
+ ) => Record<string, unknown>;
56
+
57
+ export type UpscaleResultExtractor = (
58
+ result: unknown,
59
+ ) => string | undefined;
60
+
51
61
  export interface UpscaleFeatureConfig {
52
62
  providerId?: string;
53
63
  defaultScaleFactor?: UpscaleScaleFactor;
54
64
  creditCost?: number;
65
+ model: string;
66
+ buildInput: UpscaleInputBuilder;
67
+ extractResult?: UpscaleResultExtractor;
68
+ prepareImage: (imageUri: string) => Promise<string>;
55
69
  onImageSelect?: (uri: string) => void;
56
70
  onProcessingStart?: () => void;
57
71
  onProcessingComplete?: (result: UpscaleResult) => void;
@@ -12,17 +12,12 @@ export type {
12
12
  UpscaleFeatureState,
13
13
  UpscaleTranslations,
14
14
  UpscaleFeatureConfig,
15
- IUpscaleProvider,
16
- UpscaleProviderEntry,
15
+ UpscaleInputBuilder,
16
+ UpscaleResultExtractor,
17
17
  } from "./domain";
18
18
 
19
19
  // Infrastructure Services
20
- export {
21
- upscaleProviderRegistry,
22
- executeUpscale,
23
- getAvailableProvider,
24
- hasUpscaleProvider,
25
- } from "./infrastructure";
20
+ export { executeUpscale, hasUpscaleSupport } from "./infrastructure";
26
21
  export type { ExecuteUpscaleOptions } from "./infrastructure";
27
22
 
28
23
  // Presentation Hooks
@@ -38,6 +33,3 @@ export type {
38
33
  UpscaleFeatureProps,
39
34
  UpscaleResultViewProps,
40
35
  } from "./presentation";
41
-
42
- // ComparisonSlider is available from ./presentation/components if needed directly
43
- // but not re-exported to avoid conflict with background feature's ComparisonSlider
@@ -1,7 +1,2 @@
1
- export { upscaleProviderRegistry } from "./upscale-provider-registry";
2
- export {
3
- executeUpscale,
4
- getAvailableProvider,
5
- hasUpscaleProvider,
6
- } from "./upscale-executor";
1
+ export { executeUpscale, hasUpscaleSupport } from "./upscale-executor";
7
2
  export type { ExecuteUpscaleOptions } from "./upscale-executor";
@@ -1,64 +1,98 @@
1
1
  /**
2
2
  * Upscale Executor
3
- * Executes upscale operations using registered providers
3
+ * Provider-agnostic upscale execution using active AI provider
4
+ * Model and input format are provided via options from app level
5
+ *
6
+ * Note: imageBase64 must be provided in the request. Image URI to base64
7
+ * conversion should be handled at the app level before calling this executor.
4
8
  */
5
9
 
6
- import { upscaleProviderRegistry } from "./upscale-provider-registry";
7
- import type { UpscaleRequest, UpscaleResult } from "../../domain/types";
10
+ import { providerRegistry } from "../../../../infrastructure/services";
11
+ import { cleanBase64 } from "../../../../infrastructure/utils";
12
+ import type {
13
+ UpscaleRequest,
14
+ UpscaleResult,
15
+ UpscaleInputBuilder,
16
+ UpscaleResultExtractor,
17
+ } from "../../domain/types";
8
18
 
9
19
  declare const __DEV__: boolean;
10
20
 
11
21
  export interface ExecuteUpscaleOptions {
12
- providerId?: string;
22
+ model: string;
23
+ buildInput: UpscaleInputBuilder;
24
+ extractResult?: UpscaleResultExtractor;
13
25
  onProgress?: (progress: number) => void;
14
26
  }
15
27
 
28
+ function defaultExtractResult(result: unknown): string | undefined {
29
+ if (typeof result !== "object" || result === null) return undefined;
30
+
31
+ const r = result as Record<string, unknown>;
32
+
33
+ if (typeof r.image === "string") return r.image;
34
+ if (Array.isArray(r.images) && r.images[0]?.url) return r.images[0].url;
35
+
36
+ return undefined;
37
+ }
38
+
16
39
  export async function executeUpscale(
17
40
  request: UpscaleRequest,
18
- options?: ExecuteUpscaleOptions,
41
+ options: ExecuteUpscaleOptions,
19
42
  ): Promise<UpscaleResult> {
20
- const provider = upscaleProviderRegistry.get(options?.providerId);
43
+ const provider = providerRegistry.getActiveProvider();
21
44
 
22
45
  if (!provider) {
23
- return {
24
- success: false,
25
- error: "No upscale provider available",
26
- };
46
+ return { success: false, error: "No AI provider configured" };
27
47
  }
28
48
 
29
- if (!provider.isAvailable()) {
30
- return {
31
- success: false,
32
- error: `Provider ${provider.providerId} is not available`,
33
- };
49
+ if (!provider.isInitialized()) {
50
+ return { success: false, error: "AI provider not initialized" };
34
51
  }
35
52
 
53
+ if (!request.imageBase64) {
54
+ return { success: false, error: "Image base64 is required" };
55
+ }
56
+
57
+ const { model, buildInput, extractResult, onProgress } = options;
58
+
36
59
  if (__DEV__) {
37
60
  // eslint-disable-next-line no-console
38
- console.log(`[UpscaleExecutor] Using provider: ${provider.providerId}`);
61
+ console.log(`[Upscale] Provider: ${provider.providerId}, Model: ${model}`);
39
62
  }
40
63
 
41
64
  try {
42
- return await provider.upscale(request, options?.onProgress);
65
+ onProgress?.(10);
66
+
67
+ const base64 = cleanBase64(request.imageBase64);
68
+ onProgress?.(30);
69
+
70
+ const input = buildInput(base64, request.options);
71
+ onProgress?.(40);
72
+
73
+ const result = await provider.run(model, input);
74
+ onProgress?.(90);
75
+
76
+ const extractor = extractResult || defaultExtractResult;
77
+ const imageUrl = extractor(result);
78
+ onProgress?.(100);
79
+
80
+ if (!imageUrl) {
81
+ return { success: false, error: "No image in response" };
82
+ }
83
+
84
+ return { success: true, imageUrl };
43
85
  } catch (error) {
44
86
  const message = error instanceof Error ? error.message : String(error);
45
-
46
87
  if (__DEV__) {
47
88
  // eslint-disable-next-line no-console
48
- console.error("[UpscaleExecutor] Error:", message);
89
+ console.error("[Upscale] Error:", message);
49
90
  }
50
-
51
- return {
52
- success: false,
53
- error: message,
54
- };
91
+ return { success: false, error: message };
55
92
  }
56
93
  }
57
94
 
58
- export function getAvailableProvider(providerId?: string) {
59
- return upscaleProviderRegistry.get(providerId);
60
- }
61
-
62
- export function hasUpscaleProvider(providerId: string): boolean {
63
- return upscaleProviderRegistry.hasProvider(providerId);
95
+ export function hasUpscaleSupport(): boolean {
96
+ const provider = providerRegistry.getActiveProvider();
97
+ return provider !== null && provider.isInitialized();
64
98
  }
@@ -14,7 +14,7 @@ import type {
14
14
  declare const __DEV__: boolean;
15
15
 
16
16
  export interface UseUpscaleFeatureProps {
17
- config?: UpscaleFeatureConfig;
17
+ config: UpscaleFeatureConfig;
18
18
  userId: string;
19
19
  onSelectImage: () => Promise<string | null>;
20
20
  onSaveImage: (imageUrl: string) => Promise<void>;
@@ -46,7 +46,7 @@ export function useUpscaleFeature(
46
46
  const uri = await onSelectImage();
47
47
  if (uri) {
48
48
  setState((prev) => ({ ...prev, imageUri: uri, error: null }));
49
- config?.onImageSelect?.(uri);
49
+ config.onImageSelect?.(uri);
50
50
  }
51
51
  } catch (error) {
52
52
  const message = error instanceof Error ? error.message : String(error);
@@ -68,21 +68,26 @@ export function useUpscaleFeature(
68
68
  error: null,
69
69
  }));
70
70
 
71
- config?.onProcessingStart?.();
71
+ config.onProcessingStart?.();
72
72
 
73
73
  if (__DEV__) {
74
74
  // eslint-disable-next-line no-console
75
75
  console.log("[useUpscaleFeature] Starting upscale process");
76
76
  }
77
77
 
78
+ const imageBase64 = await config.prepareImage(state.imageUri);
79
+
78
80
  const result: UpscaleResult = await executeUpscale(
79
81
  {
80
82
  imageUri: state.imageUri,
83
+ imageBase64,
81
84
  userId,
82
- options: { scaleFactor: config?.defaultScaleFactor || 2 },
85
+ options: { scaleFactor: config.defaultScaleFactor || 2 },
83
86
  },
84
87
  {
85
- providerId: config?.providerId,
88
+ model: config.model,
89
+ buildInput: config.buildInput,
90
+ extractResult: config.extractResult,
86
91
  onProgress: handleProgress,
87
92
  },
88
93
  );
@@ -95,7 +100,7 @@ export function useUpscaleFeature(
95
100
  processedUrl: url,
96
101
  progress: 100,
97
102
  }));
98
- config?.onProcessingComplete?.(result);
103
+ config.onProcessingComplete?.(result);
99
104
  } else {
100
105
  const errorMessage = result.error || "Processing failed";
101
106
  setState((prev) => ({
@@ -104,7 +109,7 @@ export function useUpscaleFeature(
104
109
  error: errorMessage,
105
110
  progress: 0,
106
111
  }));
107
- config?.onError?.(errorMessage);
112
+ config.onError?.(errorMessage);
108
113
  }
109
114
  }, [state.imageUri, userId, config, handleProgress]);
110
115
 
package/src/index.ts CHANGED
@@ -10,6 +10,9 @@
10
10
  * } from '@umituz/react-native-ai-generation-content';
11
11
  */
12
12
 
13
+ // eslint-disable-next-line no-console
14
+ if (typeof __DEV__ !== "undefined" && __DEV__) console.log("📍 [LIFECYCLE] @umituz/react-native-ai-generation-content/index.ts - Module loading");
15
+
13
16
  // =============================================================================
14
17
  // DOMAIN LAYER - Types & Interfaces
15
18
  // =============================================================================
@@ -314,3 +317,39 @@ export * from "./features/upscaling";
314
317
 
315
318
  export * from "./features/photo-restoration";
316
319
 
320
+ // =============================================================================
321
+ // FEATURES - AI Hug
322
+ // =============================================================================
323
+
324
+ export * from "./features/ai-hug";
325
+
326
+ // =============================================================================
327
+ // FEATURES - AI Kiss
328
+ // =============================================================================
329
+
330
+ export * from "./features/ai-kiss";
331
+
332
+ // =============================================================================
333
+ // FEATURES - Face Swap
334
+ // =============================================================================
335
+
336
+ export * from "./features/face-swap";
337
+
338
+ // =============================================================================
339
+ // FEATURES - Anime Selfie
340
+ // =============================================================================
341
+
342
+ export * from "./features/anime-selfie";
343
+
344
+ // =============================================================================
345
+ // FEATURES - Remove Background
346
+ // =============================================================================
347
+
348
+ export * from "./features/remove-background";
349
+
350
+ // =============================================================================
351
+ // FEATURES - Remove Object
352
+ // =============================================================================
353
+
354
+ export * from "./features/remove-object";
355
+
@@ -0,0 +1,19 @@
1
+ /**
2
+ * React 19 JSX Compatibility for React Native
3
+ * Fixes JSX namespace issues between React 19 and react-native
4
+ */
5
+
6
+ import type { JSX as ReactJSX } from 'react';
7
+
8
+ declare global {
9
+ namespace JSX {
10
+ interface Element extends ReactJSX.Element {}
11
+ interface ElementClass extends ReactJSX.ElementClass {}
12
+ interface ElementAttributesProperty extends ReactJSX.ElementAttributesProperty {}
13
+ interface ElementChildrenAttribute extends ReactJSX.ElementChildrenAttribute {}
14
+ interface IntrinsicAttributes extends ReactJSX.IntrinsicAttributes {}
15
+ interface IntrinsicClassAttributes<T> extends ReactJSX.IntrinsicClassAttributes<T> {}
16
+ }
17
+ }
18
+
19
+ export {};
@@ -1,48 +0,0 @@
1
- /**
2
- * Face Swap Domain Entities
3
- */
4
-
5
- export interface FaceSwapConfig {
6
- /**
7
- * Enhance the face details after swapping
8
- * @default true
9
- */
10
- enhanceFace?: boolean;
11
-
12
- /**
13
- * Preserve the skin tone of the target image
14
- * @default true
15
- */
16
- preserveSkinTone?: boolean;
17
- }
18
-
19
- export interface FaceSwapRequest {
20
- /**
21
- * The target image where the face will be swapped TO.
22
- * Can be a Base64 string or a remote URL.
23
- */
24
- targetImage: string;
25
-
26
- /**
27
- * The source image containing the face to swap FROM.
28
- * Can be a Base64 string or a remote URL.
29
- */
30
- sourceImage: string;
31
-
32
- /**
33
- * Optional configuration for the swap process
34
- */
35
- options?: FaceSwapConfig;
36
- }
37
-
38
- export interface FaceSwapResult {
39
- /**
40
- * URL or Base64 of the resulting image
41
- */
42
- imageUrl: string;
43
-
44
- /**
45
- * Metadata about the generation
46
- */
47
- metadata?: Record<string, unknown>;
48
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * Photo Restore Provider Types
3
- * Interface for provider implementations
4
- */
5
-
6
- import type { PhotoRestoreRequest, PhotoRestoreResult } from "./photo-restore.types";
7
-
8
- export interface IPhotoRestoreProvider {
9
- readonly providerId: string;
10
- readonly providerName: string;
11
-
12
- isAvailable(): boolean;
13
-
14
- restore(
15
- request: PhotoRestoreRequest,
16
- onProgress?: (progress: number) => void,
17
- ): Promise<PhotoRestoreResult>;
18
- }
19
-
20
- export interface PhotoRestoreProviderEntry {
21
- provider: IPhotoRestoreProvider;
22
- priority: number;
23
- }
@@ -1,77 +0,0 @@
1
- /**
2
- * Photo Restore Provider Registry
3
- * Manages registered photo restore providers
4
- */
5
-
6
- import type {
7
- IPhotoRestoreProvider,
8
- PhotoRestoreProviderEntry,
9
- } from "../../domain/types";
10
-
11
- declare const __DEV__: boolean;
12
-
13
- class PhotoRestoreProviderRegistry {
14
- private providers: Map<string, PhotoRestoreProviderEntry> = new Map();
15
- private defaultProviderId: string | null = null;
16
-
17
- register(provider: IPhotoRestoreProvider, priority = 0): void {
18
- this.providers.set(provider.providerId, { provider, priority });
19
-
20
- if (__DEV__) {
21
- // eslint-disable-next-line no-console
22
- console.log(
23
- `[PhotoRestoreRegistry] Registered provider: ${provider.providerId}`,
24
- );
25
- }
26
- }
27
-
28
- unregister(providerId: string): void {
29
- this.providers.delete(providerId);
30
- }
31
-
32
- setDefault(providerId: string): void {
33
- if (!this.providers.has(providerId)) {
34
- throw new Error(`Provider ${providerId} not registered`);
35
- }
36
- this.defaultProviderId = providerId;
37
- }
38
-
39
- get(providerId?: string): IPhotoRestoreProvider | null {
40
- const id = providerId || this.defaultProviderId;
41
- if (!id) return this.getHighestPriority();
42
-
43
- const entry = this.providers.get(id);
44
- return entry?.provider || null;
45
- }
46
-
47
- getAvailable(): IPhotoRestoreProvider | null {
48
- const sorted = this.getSortedProviders();
49
- return sorted.find((p) => p.isAvailable()) || null;
50
- }
51
-
52
- hasProvider(providerId: string): boolean {
53
- return this.providers.has(providerId);
54
- }
55
-
56
- getProviderIds(): string[] {
57
- return Array.from(this.providers.keys());
58
- }
59
-
60
- private getHighestPriority(): IPhotoRestoreProvider | null {
61
- const sorted = this.getSortedProviders();
62
- return sorted[0] || null;
63
- }
64
-
65
- private getSortedProviders(): IPhotoRestoreProvider[] {
66
- return Array.from(this.providers.values())
67
- .sort((a, b) => b.priority - a.priority)
68
- .map((entry) => entry.provider);
69
- }
70
-
71
- reset(): void {
72
- this.providers.clear();
73
- this.defaultProviderId = null;
74
- }
75
- }
76
-
77
- export const photoRestoreProviderRegistry = new PhotoRestoreProviderRegistry();
@@ -1,23 +0,0 @@
1
- /**
2
- * Upscale Provider Types
3
- * Interface for provider implementations
4
- */
5
-
6
- import type { UpscaleRequest, UpscaleResult } from "./upscale.types";
7
-
8
- export interface IUpscaleProvider {
9
- readonly providerId: string;
10
- readonly providerName: string;
11
-
12
- isAvailable(): boolean;
13
-
14
- upscale(
15
- request: UpscaleRequest,
16
- onProgress?: (progress: number) => void,
17
- ): Promise<UpscaleResult>;
18
- }
19
-
20
- export interface UpscaleProviderEntry {
21
- provider: IUpscaleProvider;
22
- priority: number;
23
- }