@umituz/react-native-ai-generation-content 1.17.71 → 1.17.73

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.71",
3
+ "version": "1.17.73",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -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";
@@ -98,7 +98,7 @@ export const GenerateButton: React.FC<GenerateButtonProps> = ({
98
98
  onPress={onPress}
99
99
  disabled={disabled}
100
100
  activeOpacity={0.85}
101
- style={[styles.buttonWrapper, accessoryRight && { flex: 1 }]}
101
+ style={[styles.buttonWrapper, accessoryRight ? { flex: 1 } : undefined]}
102
102
  >
103
103
  <LinearGradient
104
104
  colors={disabled ? ["#9CA3AF", "#6B7280"] : gradientColors}