@umituz/react-native-ai-generation-content 1.20.2 → 1.20.3

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.2",
3
+ "version": "1.20.3",
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",
@@ -1,5 +1,4 @@
1
1
  /**
2
- export * from "./presentation/components";
3
2
  * HD Touch Up Feature
4
3
  * Provider-agnostic HD enhancement feature
5
4
  */
@@ -16,12 +15,7 @@ export type {
16
15
  } from "./domain";
17
16
 
18
17
  // Presentation Hooks
19
- export { useHDTouchUpFeature } from "./presentation";
20
- export type {
21
- UseHDTouchUpFeatureProps,
22
- UseHDTouchUpFeatureReturn,
23
- } from "./presentation";
18
+ export { useHDTouchUpFeature, type UseHDTouchUpFeatureProps } from "./presentation";
24
19
 
25
20
  // Presentation Components
26
- export { HDTouchUpFeature } from "./presentation";
27
- export type { HDTouchUpFeatureProps } from "./presentation";
21
+ export { HDTouchUpFeature, type HDTouchUpFeatureProps } from "./presentation";
@@ -1,5 +1 @@
1
- export { useHDTouchUpFeature } from "./useHDTouchUpFeature";
2
- export type {
3
- UseHDTouchUpFeatureProps,
4
- UseHDTouchUpFeatureReturn,
5
- } from "./useHDTouchUpFeature";
1
+ export { useHDTouchUpFeature, type UseHDTouchUpFeatureProps } from "./useHDTouchUpFeature";
@@ -1,15 +1,10 @@
1
1
  /**
2
2
  * useHDTouchUpFeature Hook
3
3
  * Uses base single image hook for HD touch up
4
- * Uses centralized orchestrator for credit/error handling
5
4
  */
6
5
 
7
- import {
8
- useSingleImageFeature,
9
- type BaseSingleImageHookReturn,
10
- } from "../../../image-to-image";
11
- import type { AlertMessages } from "../../../../presentation/hooks/generation";
12
- import type { HDTouchUpFeatureConfig } from "../../domain/types";
6
+ import { useSingleImageFeature, type BaseSingleImageHookReturn } from "../../../image-to-image";
7
+ import type { HDTouchUpFeatureConfig, HDTouchUpResult } from "../../domain/types";
13
8
 
14
9
  export interface UseHDTouchUpFeatureProps {
15
10
  config: HDTouchUpFeatureConfig;
@@ -18,29 +13,11 @@ export interface UseHDTouchUpFeatureProps {
18
13
  onBeforeProcess?: () => Promise<boolean>;
19
14
  }
20
15
 
21
- export interface UseHDTouchUpFeatureOptions {
22
- /** Alert messages for error handling */
23
- alertMessages?: AlertMessages;
24
- /** User ID for credit operations */
25
- userId?: string;
26
- /** Callback when credits are exhausted */
27
- onCreditsExhausted?: () => void;
28
- }
29
-
30
- export interface UseHDTouchUpFeatureReturn extends BaseSingleImageHookReturn {}
31
-
32
- export function useHDTouchUpFeature(
33
- props: UseHDTouchUpFeatureProps,
34
- options?: UseHDTouchUpFeatureOptions,
35
- ): UseHDTouchUpFeatureReturn {
16
+ export function useHDTouchUpFeature(props: UseHDTouchUpFeatureProps): BaseSingleImageHookReturn {
36
17
  const { config, onSelectImage, onSaveImage, onBeforeProcess } = props;
37
18
 
38
- // Cast config to any to bypass strict type checking while maintaining runtime behavior
39
- return useSingleImageFeature(
19
+ return useSingleImageFeature<HDTouchUpFeatureConfig, HDTouchUpResult>(
40
20
  { config: config as never, onSelectImage, onSaveImage, onBeforeProcess },
41
- {
42
- buildInput: (imageBase64) => ({ imageBase64 }),
43
- ...options,
44
- },
21
+ { buildInput: (imageBase64) => ({ imageBase64 }) },
45
22
  );
46
23
  }
@@ -9,9 +9,7 @@ import type { BaseSingleImageState, BaseDualImageState } from "./state.types";
9
9
  /**
10
10
  * Base hook props for single image features
11
11
  */
12
- export interface BaseSingleImageHookProps<
13
- TConfig extends SingleImageConfig = SingleImageConfig,
14
- > {
12
+ export interface BaseSingleImageHookProps<TConfig = SingleImageConfig> {
15
13
  config: TConfig;
16
14
  onSelectImage: () => Promise<string | null>;
17
15
  onSaveImage: (imageUrl: string) => Promise<void>;
@@ -19,7 +19,7 @@ import type {
19
19
  BaseImageResult,
20
20
  } from "../../domain/types";
21
21
 
22
- export interface SingleImageFeatureOptions<TConfig extends SingleImageConfig> {
22
+ export interface SingleImageFeatureOptions<TConfig = SingleImageConfig> {
23
23
  buildInput?: (imageBase64: string, config: TConfig) => Record<string, unknown>;
24
24
  /** Alert messages for error handling */
25
25
  alertMessages?: AlertMessages;
@@ -43,13 +43,16 @@ interface SingleImageInput {
43
43
  }
44
44
 
45
45
  export function useSingleImageFeature<
46
- TConfig extends SingleImageConfig = SingleImageConfig,
47
- TResult extends BaseImageResult = BaseImageResult,
46
+ TConfig = SingleImageConfig,
47
+ TResult = BaseImageResult,
48
48
  >(
49
49
  props: BaseSingleImageHookProps<TConfig>,
50
50
  options?: SingleImageFeatureOptions<TConfig>,
51
51
  ): BaseSingleImageHookReturn {
52
- const { config, onSelectImage, onSaveImage, onBeforeProcess } = props;
52
+ const { config: rawConfig, onSelectImage, onSaveImage, onBeforeProcess } = props;
53
+
54
+ // Cast config to base type for internal usage
55
+ const config = rawConfig as unknown as SingleImageConfig;
53
56
 
54
57
  // Image selection state (separate from orchestrator state)
55
58
  const [imageUri, setImageUri] = useState<string | null>(null);
@@ -73,7 +76,7 @@ export function useSingleImageFeature<
73
76
  // Notify completion with creationId
74
77
  const creationId = creationIdRef.current;
75
78
  if (creationId) {
76
- config.onProcessingComplete?.({ ...result, creationId } as unknown as TResult);
79
+ config.onProcessingComplete?.({ ...result, creationId } as BaseImageResult);
77
80
  }
78
81
 
79
82
  return result.imageUrl;
@@ -124,14 +127,14 @@ export function useSingleImageFeature<
124
127
  const imageBase64 = await config.prepareImage(imageUri);
125
128
 
126
129
  const input: SingleImageInput = options?.buildInput
127
- ? { imageBase64, options: options.buildInput(imageBase64, config) }
130
+ ? { imageBase64, options: options.buildInput(imageBase64, rawConfig) }
128
131
  : { imageBase64 };
129
132
 
130
133
  await orchestrator.generate(input);
131
134
  } catch (error) {
132
135
  // Error already handled by orchestrator
133
136
  }
134
- }, [imageUri, config, options, onBeforeProcess, orchestrator]);
137
+ }, [imageUri, config, rawConfig, options, onBeforeProcess, orchestrator]);
135
138
 
136
139
  const save = useCallback(async () => {
137
140
  if (!orchestrator.result) return;
@@ -1,5 +1,4 @@
1
1
  /**
2
- export * from "./presentation/components";
3
2
  * Photo Restoration Feature
4
3
  * Provider-agnostic photo restoration feature
5
4
  */
@@ -16,15 +15,8 @@ export type {
16
15
  } from "./domain";
17
16
 
18
17
  // Presentation Hooks
19
- export { usePhotoRestoreFeature } from "./presentation";
20
- export type {
21
- UsePhotoRestoreFeatureProps,
22
- UsePhotoRestoreFeatureReturn,
23
- } from "./presentation";
18
+ export { usePhotoRestoreFeature, type UsePhotoRestoreFeatureProps } from "./presentation";
24
19
 
25
20
  // Presentation Components
26
21
  export { PhotoRestoreFeature, PhotoRestoreResultView } from "./presentation";
27
- export type {
28
- PhotoRestoreFeatureProps,
29
- PhotoRestoreResultViewProps,
30
- } from "./presentation";
22
+ export type { PhotoRestoreFeatureProps, PhotoRestoreResultViewProps } from "./presentation";
@@ -1,5 +1 @@
1
- export { usePhotoRestoreFeature } from "./usePhotoRestoreFeature";
2
- export type {
3
- UsePhotoRestoreFeatureProps,
4
- UsePhotoRestoreFeatureReturn,
5
- } from "./usePhotoRestoreFeature";
1
+ export { usePhotoRestoreFeature, type UsePhotoRestoreFeatureProps } from "./usePhotoRestoreFeature";
@@ -1,15 +1,10 @@
1
1
  /**
2
2
  * usePhotoRestoreFeature Hook
3
3
  * Uses base single image hook for photo restoration
4
- * Uses centralized orchestrator for credit/error handling
5
4
  */
6
5
 
7
- import {
8
- useSingleImageFeature,
9
- type BaseSingleImageHookReturn,
10
- } from "../../../image-to-image";
11
- import type { AlertMessages } from "../../../../presentation/hooks/generation";
12
- import type { PhotoRestoreFeatureConfig } from "../../domain/types";
6
+ import { useSingleImageFeature, type BaseSingleImageHookReturn } from "../../../image-to-image";
7
+ import type { PhotoRestoreFeatureConfig, PhotoRestoreResult } from "../../domain/types";
13
8
 
14
9
  export interface UsePhotoRestoreFeatureProps {
15
10
  config: PhotoRestoreFeatureConfig;
@@ -18,29 +13,11 @@ export interface UsePhotoRestoreFeatureProps {
18
13
  onBeforeProcess?: () => Promise<boolean>;
19
14
  }
20
15
 
21
- export interface UsePhotoRestoreFeatureOptions {
22
- /** Alert messages for error handling */
23
- alertMessages?: AlertMessages;
24
- /** User ID for credit operations */
25
- userId?: string;
26
- /** Callback when credits are exhausted */
27
- onCreditsExhausted?: () => void;
28
- }
29
-
30
- export interface UsePhotoRestoreFeatureReturn extends BaseSingleImageHookReturn {}
31
-
32
- export function usePhotoRestoreFeature(
33
- props: UsePhotoRestoreFeatureProps,
34
- options?: UsePhotoRestoreFeatureOptions,
35
- ): UsePhotoRestoreFeatureReturn {
16
+ export function usePhotoRestoreFeature(props: UsePhotoRestoreFeatureProps): BaseSingleImageHookReturn {
36
17
  const { config, onSelectImage, onSaveImage, onBeforeProcess } = props;
37
18
 
38
- // Cast config to any to bypass strict type checking while maintaining runtime behavior
39
- return useSingleImageFeature(
19
+ return useSingleImageFeature<PhotoRestoreFeatureConfig, PhotoRestoreResult>(
40
20
  { config: config as never, onSelectImage, onSaveImage, onBeforeProcess },
41
- {
42
- buildInput: (imageBase64) => ({ imageBase64 }),
43
- ...options,
44
- },
21
+ { buildInput: (imageBase64) => ({ imageBase64 }) },
45
22
  );
46
23
  }
@@ -1,6 +1 @@
1
- /**
2
- * Remove Background Presentation Hooks Index
3
- */
4
-
5
- export { useRemoveBackgroundFeature } from "./useRemoveBackgroundFeature";
6
- export type { UseRemoveBackgroundFeatureProps } from "./useRemoveBackgroundFeature";
1
+ export { useRemoveBackgroundFeature, type UseRemoveBackgroundFeatureProps } from "./useRemoveBackgroundFeature";
@@ -3,14 +3,8 @@
3
3
  * Uses base single image hook for background removal
4
4
  */
5
5
 
6
- import {
7
- useSingleImageFeature,
8
- type BaseSingleImageHookReturn,
9
- } from "../../../image-to-image";
10
- import type {
11
- RemoveBackgroundFeatureConfig,
12
- RemoveBackgroundResult,
13
- } from "../../domain/types";
6
+ import { useSingleImageFeature, type BaseSingleImageHookReturn } from "../../../image-to-image";
7
+ import type { RemoveBackgroundFeatureConfig, RemoveBackgroundResult } from "../../domain/types";
14
8
 
15
9
  export interface UseRemoveBackgroundFeatureProps {
16
10
  config: RemoveBackgroundFeatureConfig;
@@ -19,13 +13,11 @@ export interface UseRemoveBackgroundFeatureProps {
19
13
  onBeforeProcess?: () => Promise<boolean>;
20
14
  }
21
15
 
22
- export function useRemoveBackgroundFeature(
23
- props: UseRemoveBackgroundFeatureProps,
24
- ): BaseSingleImageHookReturn {
16
+ export function useRemoveBackgroundFeature(props: UseRemoveBackgroundFeatureProps): BaseSingleImageHookReturn {
25
17
  const { config, onSelectImage, onSaveImage, onBeforeProcess } = props;
26
18
 
27
19
  return useSingleImageFeature<RemoveBackgroundFeatureConfig, RemoveBackgroundResult>(
28
- { config, onSelectImage, onSaveImage, onBeforeProcess },
20
+ { config: config as never, onSelectImage, onSaveImage, onBeforeProcess },
29
21
  {
30
22
  buildInput: (imageBase64, cfg) => ({
31
23
  imageBase64,
@@ -1,2 +1 @@
1
- export { useUpscaleFeature } from "./useUpscaleFeature";
2
- export type { UseUpscaleFeatureProps } from "./useUpscaleFeature";
1
+ export { useUpscaleFeature, type UseUpscaleFeatureProps } from "./useUpscaleFeature";
@@ -1,12 +1,9 @@
1
1
  /**
2
2
  * useUpscaleFeature Hook
3
- * Uses base single image hook with upscale-specific options
3
+ * Uses base single image hook for image upscaling
4
4
  */
5
5
 
6
- import {
7
- useSingleImageFeature,
8
- type BaseSingleImageHookReturn,
9
- } from "../../../image-to-image";
6
+ import { useSingleImageFeature, type BaseSingleImageHookReturn } from "../../../image-to-image";
10
7
  import type { UpscaleFeatureConfig, UpscaleResult } from "../../domain/types";
11
8
 
12
9
  export interface UseUpscaleFeatureProps {
@@ -16,13 +13,11 @@ export interface UseUpscaleFeatureProps {
16
13
  onBeforeProcess?: () => Promise<boolean>;
17
14
  }
18
15
 
19
- export function useUpscaleFeature(
20
- props: UseUpscaleFeatureProps,
21
- ): BaseSingleImageHookReturn {
16
+ export function useUpscaleFeature(props: UseUpscaleFeatureProps): BaseSingleImageHookReturn {
22
17
  const { config, onSelectImage, onSaveImage, onBeforeProcess } = props;
23
18
 
24
19
  return useSingleImageFeature<UpscaleFeatureConfig, UpscaleResult>(
25
- { config, onSelectImage, onSaveImage, onBeforeProcess },
20
+ { config: config as never, onSelectImage, onSaveImage, onBeforeProcess },
26
21
  {
27
22
  buildInput: (imageBase64, cfg) => ({
28
23
  imageBase64,