@umituz/react-native-ai-generation-content 1.17.72 → 1.17.74

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.17.72",
3
+ "version": "1.17.74",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -195,6 +195,10 @@ export {
195
195
  isValidBase64,
196
196
  getBase64Size,
197
197
  getBase64SizeMB,
198
+ // Feature utils
199
+ prepareImage,
200
+ createDevCallbacks,
201
+ createFeatureUtils,
198
202
  } from "./infrastructure/utils";
199
203
 
200
204
  export type {
@@ -205,6 +209,12 @@ export type {
205
209
  ValidateResultOptions,
206
210
  PhotoInput,
207
211
  PreparedImage,
212
+ // Feature utils types
213
+ ImageSelector,
214
+ VideoSaver,
215
+ CreditChecker,
216
+ AlertFunction,
217
+ FeatureUtilsConfig,
208
218
  } from "./infrastructure/utils";
209
219
 
210
220
  // =============================================================================
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Feature Utilities
3
+ * Generic utilities for AI generation features
4
+ * App provides implementations via dependency injection
5
+ */
6
+
7
+ /**
8
+ * Image selector function type
9
+ */
10
+ export type ImageSelector = () => Promise<string | null>;
11
+
12
+ /**
13
+ * Video saver function type
14
+ */
15
+ export type VideoSaver = (uri: string) => Promise<void>;
16
+
17
+ /**
18
+ * Credit checker function type
19
+ */
20
+ export type CreditChecker = (cost: number, featureName: string, type: string) => Promise<boolean>;
21
+
22
+ /**
23
+ * Alert function type
24
+ */
25
+ export type AlertFunction = (title: string, message: string) => void;
26
+
27
+ /**
28
+ * Feature utilities configuration
29
+ */
30
+ export interface FeatureUtilsConfig {
31
+ selectImage: ImageSelector;
32
+ saveVideo: VideoSaver;
33
+ checkCredit: CreditChecker;
34
+ showSuccessAlert?: AlertFunction;
35
+ showErrorAlert?: AlertFunction;
36
+ }
37
+
38
+ /**
39
+ * Prepare image from URI (generic passthrough)
40
+ */
41
+ export function prepareImage(uri: string): string {
42
+ return uri;
43
+ }
44
+
45
+ /**
46
+ * Create dev callbacks for logging
47
+ */
48
+ export function createDevCallbacks(featureName: string) {
49
+ return {
50
+ onSuccess: (result: unknown) => {
51
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
52
+ console.log(`[${featureName}] Success:`, result);
53
+ }
54
+ },
55
+ onError: (error: unknown) => {
56
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
57
+ console.error(`[${featureName}] Error:`, error);
58
+ }
59
+ },
60
+ };
61
+ }
62
+
63
+ /**
64
+ * Create feature utils with injected dependencies
65
+ */
66
+ export function createFeatureUtils(config: FeatureUtilsConfig) {
67
+ return {
68
+ selectImage: config.selectImage,
69
+ saveVideo: config.saveVideo,
70
+ checkCreditGuard: config.checkCredit,
71
+ prepareImage,
72
+ createDevCallbacks,
73
+ };
74
+ }
75
+
76
+ /**
77
+ * Hook factory for feature utilities
78
+ */
79
+ export function createUseFeatureUtils(config: FeatureUtilsConfig) {
80
+ return function useFeatureUtils() {
81
+ return createFeatureUtils(config);
82
+ };
83
+ }
@@ -8,3 +8,4 @@ export * from "./progress-calculator.util";
8
8
  export * from "./status-checker.util";
9
9
  export * from "./result-validator.util";
10
10
  export * from "./photo-generation";
11
+ export * from "./feature-utils";