@umituz/react-native-exception 1.2.14 → 1.2.17
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,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-exception",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.17",
|
|
4
4
|
"description": "Exception handling and error tracking for React Native apps",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"typecheck": "
|
|
9
|
-
"lint": "
|
|
8
|
+
"typecheck": "tsc --noEmit",
|
|
9
|
+
"lint": "eslint src --ext .ts,.tsx --max-warnings 0",
|
|
10
10
|
"version:patch": "npm version patch -m 'chore: release v%s'",
|
|
11
11
|
"version:minor": "npm version minor -m 'chore: release v%s'",
|
|
12
12
|
"version:major": "npm version major -m 'chore: release v%s'"
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@umituz/react-native-firebase": "latest",
|
|
29
29
|
"@umituz/react-native-firebase-auth": "latest",
|
|
30
|
+
"@umituz/react-native-storage": "latest",
|
|
30
31
|
"@umituz/react-native-uuid": "latest",
|
|
31
32
|
"react": ">=18.2.0",
|
|
32
33
|
"react-native": ">=0.74.0"
|
|
@@ -34,11 +35,18 @@
|
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@umituz/react-native-firebase": "latest",
|
|
36
37
|
"@umituz/react-native-firebase-auth": "latest",
|
|
38
|
+
"@umituz/react-native-storage": "latest",
|
|
37
39
|
"@umituz/react-native-uuid": "latest",
|
|
38
40
|
"@types/react": "~19.1.10",
|
|
39
41
|
"react": "19.1.0",
|
|
40
42
|
"react-native": "0.81.5",
|
|
41
|
-
"typescript": "~5.9.2"
|
|
43
|
+
"typescript": "~5.9.2",
|
|
44
|
+
"eslint": "^8.57.0",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
46
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
47
|
+
"eslint-plugin-react": "^7.33.2",
|
|
48
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
49
|
+
"eslint-plugin-react-native": "^4.1.0"
|
|
42
50
|
},
|
|
43
51
|
"publishConfig": {
|
|
44
52
|
"access": "public"
|
|
@@ -3,35 +3,42 @@
|
|
|
3
3
|
* Zustand store for exception state management
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { createStore } from '@umituz/react-native-storage';
|
|
7
7
|
import type { ExceptionEntity } from '../../domain/entities/ExceptionEntity';
|
|
8
8
|
|
|
9
9
|
interface ExceptionState {
|
|
10
10
|
exceptions: ExceptionEntity[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ExceptionActions {
|
|
11
14
|
addException: (exception: ExceptionEntity) => void;
|
|
12
15
|
clearExceptions: () => void;
|
|
13
16
|
markAsHandled: (id: string) => void;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
export const useExceptionStore =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
19
|
+
export const useExceptionStore = createStore<ExceptionState, ExceptionActions>({
|
|
20
|
+
name: 'exception-store',
|
|
21
|
+
initialState: {
|
|
22
|
+
exceptions: [],
|
|
23
|
+
},
|
|
24
|
+
persist: false,
|
|
25
|
+
actions: (set, get) => ({
|
|
26
|
+
addException: (exception: ExceptionEntity) =>
|
|
27
|
+
set({ exceptions: [...get().exceptions, exception] }),
|
|
28
|
+
clearExceptions: () => set({ exceptions: [] }),
|
|
29
|
+
markAsHandled: (id: string) =>
|
|
30
|
+
set({
|
|
31
|
+
exceptions: get().exceptions.map((e) =>
|
|
32
|
+
e.id === id ? { ...e, isHandled: true } : e
|
|
33
|
+
),
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
30
37
|
|
|
31
38
|
/**
|
|
32
39
|
* Hook to get exceptions from store
|
|
33
40
|
*/
|
|
34
41
|
export const useExceptions = () => {
|
|
35
|
-
const exceptions = useExceptionStore((state
|
|
42
|
+
const exceptions = useExceptionStore((state) => state.exceptions);
|
|
36
43
|
return exceptions;
|
|
37
44
|
};
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "@umituz/react-native-design-system";
|
|
16
16
|
|
|
17
17
|
export interface ErrorStateProps {
|
|
18
|
-
/** Icon name from
|
|
18
|
+
/** Icon name from Ionicons */
|
|
19
19
|
icon?: string;
|
|
20
20
|
/** Error title */
|
|
21
21
|
title: string;
|
|
@@ -30,7 +30,7 @@ export interface ErrorStateProps {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export const ErrorState: React.FC<ErrorStateProps> = ({
|
|
33
|
-
icon = "
|
|
33
|
+
icon = "alert-circle-outline",
|
|
34
34
|
title,
|
|
35
35
|
description,
|
|
36
36
|
actionLabel,
|
|
@@ -47,7 +47,7 @@ export const ErrorState: React.FC<ErrorStateProps> = ({
|
|
|
47
47
|
<View
|
|
48
48
|
style={[styles.iconContainer, { backgroundColor: tokens.colors.surface }]}
|
|
49
49
|
>
|
|
50
|
-
<AtomicIcon name={icon} size="xxl" color="secondary" />
|
|
50
|
+
<AtomicIcon name={icon as any} size="xxl" color="secondary" />
|
|
51
51
|
</View>
|
|
52
52
|
)}
|
|
53
53
|
|
|
@@ -67,7 +67,7 @@ export const ErrorState: React.FC<ErrorStateProps> = ({
|
|
|
67
67
|
onPress={onAction}
|
|
68
68
|
activeOpacity={0.8}
|
|
69
69
|
>
|
|
70
|
-
<AtomicIcon name="
|
|
70
|
+
<AtomicIcon name="refresh-outline" size="sm" color="onPrimary" />
|
|
71
71
|
<AtomicText type="labelLarge" color="onPrimary">
|
|
72
72
|
{actionLabel}
|
|
73
73
|
</AtomicText>
|