@umituz/react-native-ai-generation-content 1.17.6 → 1.17.8

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 (25) hide show
  1. package/package.json +1 -1
  2. package/src/features/ai-hug/index.ts +4 -0
  3. package/src/features/ai-hug/presentation/components/AIHugFeature.tsx +209 -0
  4. package/src/features/ai-hug/presentation/components/index.ts +2 -0
  5. package/src/features/ai-hug/presentation/index.ts +1 -0
  6. package/src/features/ai-kiss/index.ts +4 -0
  7. package/src/features/ai-kiss/presentation/components/AIKissFeature.tsx +202 -0
  8. package/src/features/ai-kiss/presentation/components/index.ts +2 -0
  9. package/src/features/ai-kiss/presentation/index.ts +1 -0
  10. package/src/features/anime-selfie/index.ts +4 -0
  11. package/src/features/anime-selfie/presentation/components/AnimeSelfieFeature.tsx +199 -0
  12. package/src/features/anime-selfie/presentation/components/index.ts +2 -0
  13. package/src/features/anime-selfie/presentation/index.ts +1 -0
  14. package/src/features/face-swap/index.ts +4 -0
  15. package/src/features/face-swap/presentation/components/FaceSwapFeature.tsx +202 -0
  16. package/src/features/face-swap/presentation/components/index.ts +2 -0
  17. package/src/features/face-swap/presentation/index.ts +1 -0
  18. package/src/features/photo-restoration/presentation/components/PhotoRestoreFeature.tsx +48 -36
  19. package/src/features/remove-background/index.ts +4 -0
  20. package/src/features/remove-background/presentation/components/RemoveBackgroundFeature.tsx +199 -0
  21. package/src/features/remove-background/presentation/components/index.ts +2 -0
  22. package/src/features/remove-background/presentation/index.ts +1 -0
  23. package/src/features/upscaling/presentation/components/UpscaleFeature.tsx +48 -36
  24. package/src/presentation/components/photo-step/PhotoStep.tsx +2 -4
  25. package/src/presentation/types/flow-config.types.ts +1 -1
@@ -1,34 +1,36 @@
1
1
  /**
2
2
  * UpscaleFeature Component
3
- * Main upscale feature UI component
3
+ * Self-contained upscale feature UI component
4
+ * Uses hook internally, only requires config and translations
4
5
  */
5
6
 
6
7
  import React, { useCallback, useMemo } from "react";
7
8
  import { View, ScrollView, StyleSheet } from "react-native";
8
9
  import {
9
10
  useAppDesignTokens,
10
- PhotoUploadCard,
11
11
  AtomicText,
12
12
  AtomicButton,
13
13
  } from "@umituz/react-native-design-system";
14
+ import { PhotoUploadCard } from "../../../../presentation/components/PhotoUploadCard";
14
15
  import { UpscaleResultView } from "./UpscaleResultView";
16
+ import { useUpscaleFeature } from "../hooks";
15
17
  import type {
16
18
  UpscaleTranslations,
17
19
  UpscaleFeatureConfig,
18
20
  } from "../../domain/types";
19
21
 
20
22
  export interface UpscaleFeatureProps {
21
- imageUri: string | null;
22
- processedUrl: string | null;
23
- isProcessing: boolean;
24
- progress: number;
25
- error: string | null;
23
+ /** Feature configuration with provider-specific settings */
24
+ config: UpscaleFeatureConfig;
25
+ /** User ID for the generation request */
26
+ userId: string;
27
+ /** Translations for all UI text */
26
28
  translations: UpscaleTranslations;
27
- config?: UpscaleFeatureConfig;
28
- onSelectImage: () => void;
29
- onProcess: () => void;
30
- onSave: () => void;
31
- onReset: () => void;
29
+ /** Image picker callback */
30
+ onSelectImage: () => Promise<string | null>;
31
+ /** Save image callback */
32
+ onSaveImage: (imageUrl: string) => Promise<void>;
33
+ /** Optional custom processing modal renderer */
32
34
  renderProcessingModal?: (props: {
33
35
  visible: boolean;
34
36
  progress: number;
@@ -36,20 +38,22 @@ export interface UpscaleFeatureProps {
36
38
  }
37
39
 
38
40
  export const UpscaleFeature: React.FC<UpscaleFeatureProps> = ({
39
- imageUri,
40
- processedUrl,
41
- isProcessing,
42
- progress,
43
- error,
41
+ config,
42
+ userId,
44
43
  translations,
45
44
  onSelectImage,
46
- onProcess,
47
- onSave,
48
- onReset,
45
+ onSaveImage,
49
46
  renderProcessingModal,
50
47
  }) => {
51
48
  const tokens = useAppDesignTokens();
52
49
 
50
+ const feature = useUpscaleFeature({
51
+ config,
52
+ userId,
53
+ onSelectImage,
54
+ onSaveImage,
55
+ });
56
+
53
57
  const photoTranslations = useMemo(
54
58
  () => ({
55
59
  tapToUpload: translations.uploadTitle,
@@ -61,10 +65,18 @@ export const UpscaleFeature: React.FC<UpscaleFeatureProps> = ({
61
65
  );
62
66
 
63
67
  const handleProcess = useCallback(() => {
64
- onProcess();
65
- }, [onProcess]);
68
+ void feature.process();
69
+ }, [feature]);
70
+
71
+ const handleSave = useCallback(() => {
72
+ void feature.save();
73
+ }, [feature]);
74
+
75
+ const handleSelectImage = useCallback(() => {
76
+ void feature.selectImage();
77
+ }, [feature]);
66
78
 
67
- if (processedUrl && imageUri) {
79
+ if (feature.processedUrl && feature.imageUri) {
68
80
  return (
69
81
  <ScrollView
70
82
  style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}
@@ -72,8 +84,8 @@ export const UpscaleFeature: React.FC<UpscaleFeatureProps> = ({
72
84
  showsVerticalScrollIndicator={false}
73
85
  >
74
86
  <UpscaleResultView
75
- originalUri={imageUri}
76
- processedUri={processedUrl}
87
+ originalUri={feature.imageUri}
88
+ processedUri={feature.processedUrl}
77
89
  translations={{
78
90
  successText: translations.successText,
79
91
  saveButtonText: translations.saveButtonText,
@@ -81,8 +93,8 @@ export const UpscaleFeature: React.FC<UpscaleFeatureProps> = ({
81
93
  beforeLabel: translations.beforeLabel,
82
94
  afterLabel: translations.afterLabel,
83
95
  }}
84
- onSave={onSave}
85
- onReset={onReset}
96
+ onSave={handleSave}
97
+ onReset={feature.reset}
86
98
  />
87
99
  </ScrollView>
88
100
  );
@@ -103,10 +115,10 @@ export const UpscaleFeature: React.FC<UpscaleFeatureProps> = ({
103
115
  </AtomicText>
104
116
 
105
117
  <PhotoUploadCard
106
- imageUri={imageUri}
107
- onPress={onSelectImage}
108
- isValidating={isProcessing}
109
- disabled={isProcessing}
118
+ imageUri={feature.imageUri}
119
+ onPress={handleSelectImage}
120
+ isValidating={feature.isProcessing}
121
+ disabled={feature.isProcessing}
110
122
  translations={photoTranslations}
111
123
  config={{
112
124
  aspectRatio: 1,
@@ -116,7 +128,7 @@ export const UpscaleFeature: React.FC<UpscaleFeatureProps> = ({
116
128
  }}
117
129
  />
118
130
 
119
- {error && (
131
+ {feature.error && (
120
132
  <View
121
133
  style={[
122
134
  styles.errorContainer,
@@ -124,7 +136,7 @@ export const UpscaleFeature: React.FC<UpscaleFeatureProps> = ({
124
136
  ]}
125
137
  >
126
138
  <AtomicText type="bodyMedium" style={{ color: tokens.colors.error }}>
127
- {error}
139
+ {feature.error}
128
140
  </AtomicText>
129
141
  </View>
130
142
  )}
@@ -132,19 +144,19 @@ export const UpscaleFeature: React.FC<UpscaleFeatureProps> = ({
132
144
  <View style={styles.buttonContainer}>
133
145
  <AtomicButton
134
146
  title={
135
- isProcessing
147
+ feature.isProcessing
136
148
  ? translations.processingText
137
149
  : translations.processButtonText
138
150
  }
139
151
  onPress={handleProcess}
140
- disabled={!imageUri || isProcessing}
152
+ disabled={!feature.imageUri || feature.isProcessing}
141
153
  variant="primary"
142
154
  size="lg"
143
155
  />
144
156
  </View>
145
157
  </ScrollView>
146
158
 
147
- {renderProcessingModal?.({ visible: isProcessing, progress })}
159
+ {renderProcessingModal?.({ visible: feature.isProcessing, progress: feature.progress })}
148
160
  </>
149
161
  );
150
162
  };
@@ -7,10 +7,8 @@
7
7
 
8
8
  import React, { useMemo } from "react";
9
9
  import { View, StyleSheet, type ViewStyle, type StyleProp } from "react-native";
10
- import {
11
- StepHeader,
12
- PhotoUploadCard,
13
- } from "@umituz/react-native-design-system";
10
+ import { StepHeader } from "@umituz/react-native-design-system";
11
+ import { PhotoUploadCard } from "../PhotoUploadCard";
14
12
  import type { PhotoStepConfig } from "../../types/flow-config.types";
15
13
 
16
14
  export interface PhotoStepProps {
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { StepHeaderConfig } from "@umituz/react-native-design-system";
9
- import type { PhotoUploadCardConfig } from "@umituz/react-native-design-system";
9
+ import type { PhotoUploadCardConfig } from "../components/PhotoUploadCard";
10
10
 
11
11
  /**
12
12
  * Photo upload step configuration