@umituz/react-native-ai-generation-content 1.61.45 → 1.61.47

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.61.45",
3
+ "version": "1.61.47",
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",
@@ -50,7 +50,8 @@
50
50
  "firebase": ">=10.0.0",
51
51
  "react": ">=19.0.0",
52
52
  "react-native": ">=0.81.0",
53
- "react-native-safe-area-context": ">=5.0.0"
53
+ "react-native-safe-area-context": ">=5.0.0",
54
+ "@umituz/react-native-design-system": ">=4.0.0"
54
55
  },
55
56
  "devDependencies": {
56
57
  "@expo/vector-icons": "^15.0.3",
@@ -8,4 +8,7 @@ export {
8
8
  type AIGenerationResultProps,
9
9
  type AIGenerationResultAction,
10
10
  } from "./AIGenerationResult";
11
- export { ErrorDisplay, type ErrorDisplayProps } from "./ErrorDisplay";
11
+ export {
12
+ ExceptionErrorState as ErrorDisplay,
13
+ ExceptionEmptyState,
14
+ } from "@umituz/react-native-design-system";
@@ -5,7 +5,7 @@ export { PendingJobProgressBar } from "./PendingJobProgressBar";
5
5
  export { PendingJobCardActions } from "./PendingJobCardActions";
6
6
  export { PromptInput } from "./PromptInput";
7
7
  export { AIGenerationHero } from "./AIGenerationHero";
8
- export { ErrorBoundary, withErrorBoundary } from "./ErrorBoundary";
8
+ export { ErrorBoundary, withErrorBoundary } from "@umituz/react-native-design-system/exception";
9
9
  export * from "./StylePresetsGrid";
10
10
  export * from "./AIGenerationForm";
11
11
  export * from "./AIGenerationForm.types";
@@ -1,141 +0,0 @@
1
- /**
2
- * Error Boundary Component
3
- * Catches JavaScript errors anywhere in the child component tree
4
- * Displays a fallback UI instead of crashing the entire app
5
- */
6
-
7
- import React, { ErrorInfo, ReactNode } from "react";
8
- import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
9
-
10
- interface ErrorBoundaryProps {
11
- readonly children: ReactNode;
12
- readonly fallback?: ReactNode;
13
- readonly onError?: (error: Error, errorInfo: ErrorInfo) => void;
14
- }
15
-
16
- interface ErrorBoundaryState {
17
- readonly hasError: boolean;
18
- readonly error?: Error;
19
- }
20
-
21
- export class ErrorBoundary extends React.Component<
22
- ErrorBoundaryProps,
23
- ErrorBoundaryState
24
- > {
25
- constructor(props: ErrorBoundaryProps) {
26
- super(props);
27
- this.state = { hasError: false };
28
- }
29
-
30
- static getDerivedStateFromError(error: Error): ErrorBoundaryState {
31
- return { hasError: true, error };
32
- }
33
-
34
- componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
35
- // Log error to error reporting service
36
- if (typeof __DEV__ !== "undefined" && __DEV__) {
37
- console.error("[ErrorBoundary] Caught error:", error, errorInfo);
38
- }
39
-
40
- this.props.onError?.(error, errorInfo);
41
- }
42
-
43
- handleReset = (): void => {
44
- this.setState({ hasError: false, error: undefined });
45
- };
46
-
47
- render(): ReactNode {
48
- if (this.state.hasError) {
49
- // Use custom fallback if provided
50
- if (this.props.fallback) {
51
- return this.props.fallback;
52
- }
53
-
54
- // Default error UI
55
- return (
56
- <View style={styles.container}>
57
- <View style={styles.content}>
58
- <Text style={styles.title}>Something went wrong</Text>
59
- <Text style={styles.message}>
60
- An unexpected error occurred. Please try again.
61
- </Text>
62
- {typeof __DEV__ !== "undefined" && __DEV__ && this.state.error && (
63
- <Text style={styles.errorText}>
64
- {this.state.error.message}
65
- </Text>
66
- )}
67
- <TouchableOpacity
68
- style={styles.button}
69
- onPress={this.handleReset}
70
- >
71
- <Text style={styles.buttonText}>Try Again</Text>
72
- </TouchableOpacity>
73
- </View>
74
- </View>
75
- );
76
- }
77
-
78
- return this.props.children;
79
- }
80
- }
81
-
82
- const styles = StyleSheet.create({
83
- container: {
84
- flex: 1,
85
- backgroundColor: "#fff",
86
- justifyContent: "center",
87
- alignItems: "center",
88
- padding: 20,
89
- },
90
- content: {
91
- alignItems: "center",
92
- maxWidth: 400,
93
- },
94
- title: {
95
- fontSize: 24,
96
- fontWeight: "bold",
97
- marginBottom: 12,
98
- color: "#d32f2f",
99
- },
100
- message: {
101
- fontSize: 16,
102
- textAlign: "center",
103
- marginBottom: 20,
104
- color: "#666",
105
- lineHeight: 24,
106
- },
107
- errorText: {
108
- fontSize: 12,
109
- textAlign: "center",
110
- marginBottom: 20,
111
- color: "#999",
112
- fontFamily: "monospace",
113
- },
114
- button: {
115
- backgroundColor: "#2196F3",
116
- paddingHorizontal: 24,
117
- paddingVertical: 12,
118
- borderRadius: 8,
119
- minWidth: 120,
120
- alignItems: "center",
121
- },
122
- buttonText: {
123
- color: "#fff",
124
- fontSize: 16,
125
- fontWeight: "600",
126
- },
127
- });
128
-
129
- /**
130
- * Higher-order component version of ErrorBoundary
131
- */
132
- export function withErrorBoundary<P extends object>(
133
- WrappedComponent: React.ComponentType<P>,
134
- fallback?: ReactNode,
135
- ): React.ComponentType<P> {
136
- return (props: P) => (
137
- <ErrorBoundary fallback={fallback}>
138
- <WrappedComponent {...props} />
139
- </ErrorBoundary>
140
- );
141
- }
@@ -1,111 +0,0 @@
1
- /**
2
- * ErrorDisplay Component
3
- * Generic error display with retry action
4
- * Props-driven for 100+ apps compatibility
5
- */
6
-
7
- import React from "react";
8
- import { View, StyleSheet, TouchableOpacity } from "react-native";
9
- import {
10
- AtomicText,
11
- useAppDesignTokens,
12
- AtomicIcon,
13
- } from "@umituz/react-native-design-system";
14
-
15
- export interface ErrorDisplayProps {
16
- readonly error: string | null;
17
- readonly onRetry?: () => void;
18
- readonly retryText?: string;
19
- readonly icon?: string;
20
- }
21
-
22
- export const ErrorDisplay: React.FC<ErrorDisplayProps> = ({
23
- error,
24
- onRetry,
25
- retryText,
26
- icon = "alert-circle",
27
- }) => {
28
- const tokens = useAppDesignTokens();
29
-
30
- if (!error) {
31
- return null;
32
- }
33
-
34
- return (
35
- <View
36
- style={[
37
- styles.container,
38
- {
39
- backgroundColor: `${tokens.colors.error}15`,
40
- borderColor: `${tokens.colors.error}30`,
41
- padding: tokens.spacing.md,
42
- marginTop: tokens.spacing.md,
43
- },
44
- ]}
45
- >
46
- <View style={styles.header}>
47
- <AtomicIcon
48
- name={icon}
49
- customSize={20}
50
- customColor={tokens.colors.error}
51
- />
52
- <AtomicText
53
- type="bodyMedium"
54
- style={[styles.errorText, { color: tokens.colors.error }]}
55
- >
56
- {error}
57
- </AtomicText>
58
- </View>
59
- {onRetry && retryText && (
60
- <TouchableOpacity
61
- onPress={onRetry}
62
- style={[
63
- styles.retryButton,
64
- {
65
- backgroundColor: tokens.colors.error,
66
- marginTop: tokens.spacing.sm,
67
- },
68
- ]}
69
- >
70
- <AtomicIcon
71
- name="refresh"
72
- customSize={16}
73
- customColor={tokens.colors.onError}
74
- />
75
- <AtomicText
76
- type="bodySmall"
77
- style={{ color: tokens.colors.onError, fontWeight: "600" }}
78
- >
79
- {retryText}
80
- </AtomicText>
81
- </TouchableOpacity>
82
- )}
83
- </View>
84
- );
85
- };
86
-
87
- const styles = StyleSheet.create({
88
- container: {
89
- borderRadius: 12,
90
- borderWidth: 1,
91
- },
92
- header: {
93
- flexDirection: "row",
94
- alignItems: "flex-start",
95
- gap: 10,
96
- },
97
- errorText: {
98
- flex: 1,
99
- lineHeight: 20,
100
- },
101
- retryButton: {
102
- flexDirection: "row",
103
- alignItems: "center",
104
- justifyContent: "center",
105
- gap: 6,
106
- paddingVertical: 10,
107
- paddingHorizontal: 16,
108
- borderRadius: 8,
109
- alignSelf: "flex-start",
110
- },
111
- });