@umituz/react-native-sentry 1.3.0 → 1.4.1
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
|
@@ -53,3 +53,10 @@ export {
|
|
|
53
53
|
setTestUser,
|
|
54
54
|
runTestSuite,
|
|
55
55
|
} from './presentation/utils/testHelpers';
|
|
56
|
+
|
|
57
|
+
// UI Components (for settings integration)
|
|
58
|
+
export {
|
|
59
|
+
SentryTestSetting,
|
|
60
|
+
createSentryTestSetting,
|
|
61
|
+
} from './presentation/components/SentryTestSetting';
|
|
62
|
+
export type { SentryTestSettingProps } from './presentation/components/SentryTestSetting';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentry Test Setting Component
|
|
3
|
+
* Single Responsibility: Provide Sentry test setting config
|
|
4
|
+
* Framework-agnostic design - returns configuration object
|
|
5
|
+
*
|
|
6
|
+
* Note: Application should handle __DEV__ check before calling this
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { runTestSuite } from "../utils/testHelpers";
|
|
10
|
+
|
|
11
|
+
export interface SentryTestSettingProps {
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
userId?: string;
|
|
15
|
+
iconColor?: string;
|
|
16
|
+
titleColor?: string;
|
|
17
|
+
isLast?: boolean;
|
|
18
|
+
onPress?: (userId?: string) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates Sentry test setting configuration
|
|
23
|
+
* Returns setting item props for use with any UI framework
|
|
24
|
+
*
|
|
25
|
+
* Application should wrap this in __DEV__ check:
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import { createSentryTestSetting } from '@umituz/react-native-sentry';
|
|
30
|
+
*
|
|
31
|
+
* if (__DEV__) {
|
|
32
|
+
* const sentryTestConfig = createSentryTestSetting({ userId: 'user123' });
|
|
33
|
+
* // Use with your UI framework's SettingItem component
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export function createSentryTestSetting(props: SentryTestSettingProps = {}) {
|
|
38
|
+
return {
|
|
39
|
+
type: "setting-item" as const,
|
|
40
|
+
icon: "bug" as const,
|
|
41
|
+
title: props.title || "Test Sentry",
|
|
42
|
+
value: props.description || "Send test error to Sentry dashboard",
|
|
43
|
+
onPress: () => {
|
|
44
|
+
if (props.onPress) {
|
|
45
|
+
props.onPress(props.userId);
|
|
46
|
+
} else {
|
|
47
|
+
runTestSuite(props.userId);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
iconColor: props.iconColor || "#EF4444",
|
|
51
|
+
titleColor: props.titleColor || "#EF4444",
|
|
52
|
+
isLast: props.isLast ?? false,
|
|
53
|
+
devOnly: true,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Alias for backward compatibility
|
|
58
|
+
export const SentryTestSetting = createSentryTestSetting;
|