@umituz/react-native-ai-generation-content 1.84.22 → 1.86.0
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.
|
|
3
|
+
"version": "1.86.0",
|
|
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",
|
|
@@ -10,6 +10,9 @@ import type { CreationTypeId, CreationCategory } from "./creation-types";
|
|
|
10
10
|
*/
|
|
11
11
|
export const IMAGE_CREATION_TYPES: CreationTypeId[] = [
|
|
12
12
|
"text-to-image",
|
|
13
|
+
"imagine",
|
|
14
|
+
"wardrobe",
|
|
15
|
+
"historical-wardrobe",
|
|
13
16
|
"upscale",
|
|
14
17
|
"remove-background",
|
|
15
18
|
"photo-restore",
|
|
@@ -22,6 +25,17 @@ export const IMAGE_CREATION_TYPES: CreationTypeId[] = [
|
|
|
22
25
|
"ai-brush",
|
|
23
26
|
"hd-touch-up",
|
|
24
27
|
"anime-selfie",
|
|
28
|
+
"aging",
|
|
29
|
+
"headshot",
|
|
30
|
+
"retouch",
|
|
31
|
+
"magic-edit",
|
|
32
|
+
"color-grading",
|
|
33
|
+
"art-style",
|
|
34
|
+
"mood-filter",
|
|
35
|
+
"face-expression",
|
|
36
|
+
"scene-composer",
|
|
37
|
+
"ai-background",
|
|
38
|
+
"effects",
|
|
25
39
|
];
|
|
26
40
|
|
|
27
41
|
/**
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type CreationTypeId =
|
|
10
10
|
| "text-to-image"
|
|
11
|
+
| "imagine"
|
|
12
|
+
| "wardrobe"
|
|
13
|
+
| "historical-wardrobe"
|
|
11
14
|
| "text-to-video"
|
|
12
15
|
| "image-to-video"
|
|
13
16
|
| "upscale"
|
|
@@ -21,7 +24,18 @@ export type CreationTypeId =
|
|
|
21
24
|
| "background-replacement"
|
|
22
25
|
| "ai-brush"
|
|
23
26
|
| "hd-touch-up"
|
|
24
|
-
| "anime-selfie"
|
|
27
|
+
| "anime-selfie"
|
|
28
|
+
| "aging"
|
|
29
|
+
| "headshot"
|
|
30
|
+
| "retouch"
|
|
31
|
+
| "magic-edit"
|
|
32
|
+
| "color-grading"
|
|
33
|
+
| "art-style"
|
|
34
|
+
| "mood-filter"
|
|
35
|
+
| "face-expression"
|
|
36
|
+
| "scene-composer"
|
|
37
|
+
| "ai-background"
|
|
38
|
+
| "effects";
|
|
25
39
|
|
|
26
40
|
/**
|
|
27
41
|
* Creation status values
|
|
@@ -42,8 +42,8 @@ export interface AIImageResult {
|
|
|
42
42
|
const DEFAULT_IMAGE_CREDIT_COST = 2;
|
|
43
43
|
|
|
44
44
|
export interface ImageGenerationExecutorConfig<P> {
|
|
45
|
-
/** Creation type stored in Firestore (e.g. "aging", "retouch") */
|
|
46
|
-
readonly type: string;
|
|
45
|
+
/** Creation type stored in Firestore (e.g. "aging", "retouch"). Can be a static string or a function that computes type from params. */
|
|
46
|
+
readonly type: string | ((params: P) => string);
|
|
47
47
|
/** Credit cost per generation. Defaults to 2. */
|
|
48
48
|
readonly creditCost?: number;
|
|
49
49
|
/** Whether to call onGenerationSuccess after completion */
|
|
@@ -102,7 +102,7 @@ export function useImageGenerationExecutor<P>(
|
|
|
102
102
|
|
|
103
103
|
await repository.create(userId, {
|
|
104
104
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
105
|
-
type: config.type,
|
|
105
|
+
type: typeof config.type === "function" ? config.type(params) : config.type,
|
|
106
106
|
uri: imageUrl,
|
|
107
107
|
createdAt: new Date(),
|
|
108
108
|
isShared: false,
|
|
@@ -123,17 +123,18 @@ export function useImageGenerationExecutor<P>(
|
|
|
123
123
|
const message =
|
|
124
124
|
err instanceof Error ? err.message : "Generation failed";
|
|
125
125
|
setError(message);
|
|
126
|
+
const typeLabel = typeof config.type === "function" ? config.type(params) : config.type;
|
|
126
127
|
if (deducted) {
|
|
127
128
|
try {
|
|
128
129
|
await refundCredits(cost);
|
|
129
130
|
} catch {
|
|
130
131
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
131
|
-
console.error(`[${
|
|
132
|
+
console.error(`[${typeLabel}] Refund failed`);
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
136
|
-
console.error(`[${
|
|
137
|
+
console.error(`[${typeLabel}]`, err);
|
|
137
138
|
}
|
|
138
139
|
return null;
|
|
139
140
|
} finally {
|