@umituz/react-native-ai-generation-content 1.17.76 → 1.17.77
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
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
|
// =============================================================================
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
* Default no-op alert function
|
|
13
|
+
*/
|
|
14
|
+
const noOpAlert: VideoAlertFunction = () => {
|
|
15
|
+
// No-op for environments without alerts
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Show video generation success
|
|
20
|
+
*/
|
|
21
|
+
export function showVideoGenerationSuccess(
|
|
22
|
+
showAlert: VideoAlertFunction = noOpAlert
|
|
23
|
+
): void {
|
|
24
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
25
|
+
console.log("[VideoGeneration] Success");
|
|
26
|
+
}
|
|
27
|
+
showAlert("Success", "Your video has been generated successfully!");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Handle generation error
|
|
32
|
+
*/
|
|
33
|
+
export function handleGenerationError(
|
|
34
|
+
error: Error | unknown,
|
|
35
|
+
showAlert: VideoAlertFunction = noOpAlert
|
|
36
|
+
): void {
|
|
37
|
+
const message = error instanceof Error ? error.message : "An error occurred";
|
|
38
|
+
|
|
39
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
40
|
+
console.error("[VideoGeneration] Error:", error);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
showAlert("Error", `Video generation failed: ${message}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Show content moderation warning
|
|
48
|
+
*/
|
|
49
|
+
export function showContentModerationWarning(
|
|
50
|
+
showAlert: VideoAlertFunction = noOpAlert,
|
|
51
|
+
reason?: string
|
|
52
|
+
): void {
|
|
53
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
54
|
+
console.warn("[VideoGeneration] Content moderation warning:", reason);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
showAlert(
|
|
58
|
+
"Content Warning",
|
|
59
|
+
reason || "Your content may not comply with our content policy. Please review and try again."
|
|
60
|
+
);
|
|
61
|
+
}
|