@umituz/react-native-ai-generation-content 1.17.76 → 1.17.78

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.76",
3
+ "version": "1.17.78",
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
@@ -199,6 +199,10 @@ export {
199
199
  prepareImage,
200
200
  createDevCallbacks,
201
201
  createFeatureUtils,
202
+ // Video helpers
203
+ showVideoGenerationSuccess,
204
+ handleGenerationError,
205
+ showContentModerationWarning,
202
206
  } from "./infrastructure/utils";
203
207
 
204
208
  export type {
@@ -215,6 +219,8 @@ export type {
215
219
  CreditChecker,
216
220
  AlertFunction,
217
221
  FeatureUtilsConfig,
222
+ // Video helpers types
223
+ VideoAlertFunction,
218
224
  } from "./infrastructure/utils";
219
225
 
220
226
  // =============================================================================
@@ -9,3 +9,4 @@ export * from "./status-checker.util";
9
9
  export * from "./result-validator.util";
10
10
  export * from "./photo-generation";
11
11
  export * from "./feature-utils";
12
+ export * from "./video-helpers";
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Video Generation Helpers
3
+ * Generic helper functions for video generation features
4
+ */
5
+
6
+ /**
7
+ * Alert function type for displaying messages
8
+ */
9
+ export type VideoAlertFunction = (title: string, message: string) => void;
10
+
11
+ /**
12
+ * Navigation function type for success actions
13
+ */
14
+ export type VideoNavigationFunction = () => void;
15
+
16
+ /**
17
+ * Default no-op alert function
18
+ */
19
+ const noOpAlert: VideoAlertFunction = () => {
20
+ // No-op for environments without alerts
21
+ };
22
+
23
+ /**
24
+ * Show video generation success
25
+ * Supports both alert-based and navigation-based success handling
26
+ */
27
+ export function showVideoGenerationSuccess(
28
+ onViewProjects?: VideoNavigationFunction | VideoAlertFunction,
29
+ onEditVideo?: VideoNavigationFunction,
30
+ ): void {
31
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
32
+ console.log("[VideoGeneration] Success");
33
+ }
34
+
35
+ // If both callbacks are provided, they're navigation functions
36
+ if (onViewProjects && onEditVideo) {
37
+ // This is the navigation pattern - no alert needed
38
+ // The app will handle navigation
39
+ return;
40
+ }
41
+
42
+ // If only one callback is provided, treat it as an alert function
43
+ if (onViewProjects && typeof onViewProjects === "function") {
44
+ const showAlert = onViewProjects as VideoAlertFunction;
45
+ showAlert("Success", "Your video has been generated successfully!");
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Handle generation error
51
+ */
52
+ export function handleGenerationError(
53
+ error: Error | unknown,
54
+ showAlert: VideoAlertFunction = noOpAlert
55
+ ): void {
56
+ const message = error instanceof Error ? error.message : "An error occurred";
57
+
58
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
59
+ console.error("[VideoGeneration] Error:", error);
60
+ }
61
+
62
+ showAlert("Error", `Video generation failed: ${message}`);
63
+ }
64
+
65
+ /**
66
+ * Show content moderation warning
67
+ */
68
+ export function showContentModerationWarning(
69
+ showAlert: VideoAlertFunction = noOpAlert,
70
+ reason?: string
71
+ ): void {
72
+ if (typeof __DEV__ !== "undefined" && __DEV__) {
73
+ console.warn("[VideoGeneration] Content moderation warning:", reason);
74
+ }
75
+
76
+ showAlert(
77
+ "Content Warning",
78
+ reason || "Your content may not comply with our content policy. Please review and try again."
79
+ );
80
+ }