@umituz/react-native-sentry 1.0.1 → 1.1.0

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-sentry",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Production-ready error tracking and performance monitoring for React Native apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -39,7 +39,7 @@ export interface SentryConfig {
39
39
  * Enable automatic session tracking
40
40
  * Default: true
41
41
  */
42
- autoSessionTracking?: boolean;
42
+ enableAutoSessionTracking?: boolean;
43
43
 
44
44
  /**
45
45
  * Attach screenshot on errors (production only)
package/src/index.ts CHANGED
@@ -36,3 +36,11 @@ export { useSentry } from './presentation/hooks/useSentry';
36
36
  export type { UseSentryReturn } from './presentation/hooks/useSentry';
37
37
  export { useBreadcrumb } from './presentation/hooks/useBreadcrumb';
38
38
  export type { UseBreadcrumbReturn } from './presentation/hooks/useBreadcrumb';
39
+
40
+ // Package Tracking Utilities (for use in other packages)
41
+ export {
42
+ trackPackageError,
43
+ addPackageBreadcrumb,
44
+ trackPackageWarning,
45
+ } from './presentation/utils/packageTracking';
46
+ export type { PackageErrorContext } from './presentation/utils/packageTracking';
@@ -26,7 +26,7 @@ export const nativeSentryAdapter: NativeSentryAdapter = {
26
26
  release: config.release,
27
27
  tracesSampleRate: config.tracesSampleRate ?? 0.1,
28
28
  enableNative: config.enableNative ?? true,
29
- autoSessionTracking: config.autoSessionTracking ?? true,
29
+ enableAutoSessionTracking: config.enableAutoSessionTracking ?? true,
30
30
  attachScreenshot: config.attachScreenshot ?? false,
31
31
  maxBreadcrumbs: config.maxBreadcrumbs ?? 100,
32
32
  debug: config.debug ?? false,
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Package Error Tracking Utility
3
+ * Reusable error tracking for ANY package that needs Sentry integration
4
+ *
5
+ * Usage in packages:
6
+ * import { trackPackageError, addPackageBreadcrumb } from '@umituz/react-native-sentry';
7
+ */
8
+
9
+ import { SentryClient } from '../../infrastructure/config/SentryClient';
10
+
11
+ export interface PackageErrorContext {
12
+ packageName: string;
13
+ operation: string;
14
+ userId?: string;
15
+ [key: string]: any;
16
+ }
17
+
18
+ /**
19
+ * Track error from any package
20
+ *
21
+ * @example
22
+ * trackPackageError(error, {
23
+ * packageName: 'subscription',
24
+ * operation: 'purchase',
25
+ * userId: 'user123',
26
+ * productId: 'premium_monthly'
27
+ * });
28
+ */
29
+ export function trackPackageError(
30
+ error: Error,
31
+ context: PackageErrorContext
32
+ ): void {
33
+ if (!SentryClient.isInitialized()) return;
34
+
35
+ try {
36
+ SentryClient.captureException(error, {
37
+ tags: {
38
+ package: context.packageName,
39
+ operation: context.operation,
40
+ },
41
+ extra: context,
42
+ });
43
+ } catch {
44
+ // Silent fallback - don't break app if Sentry fails
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Add breadcrumb from any package
50
+ *
51
+ * @example
52
+ * addPackageBreadcrumb('subscription', 'User started purchase flow', {
53
+ * productId: 'premium_monthly'
54
+ * });
55
+ */
56
+ export function addPackageBreadcrumb(
57
+ packageName: string,
58
+ message: string,
59
+ data?: Record<string, any>
60
+ ): void {
61
+ if (!SentryClient.isInitialized()) return;
62
+
63
+ try {
64
+ SentryClient.addBreadcrumb({
65
+ category: packageName,
66
+ message,
67
+ level: 'info',
68
+ data,
69
+ });
70
+ } catch {
71
+ // Silent fallback
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Track warning from any package
77
+ *
78
+ * @example
79
+ * trackPackageWarning('subscription', 'RevenueCat not initialized', {
80
+ * userId: 'user123'
81
+ * });
82
+ */
83
+ export function trackPackageWarning(
84
+ packageName: string,
85
+ message: string,
86
+ context?: Record<string, any>
87
+ ): void {
88
+ if (!SentryClient.isInitialized()) return;
89
+
90
+ try {
91
+ SentryClient.captureMessage(message, 'warning', {
92
+ tags: {
93
+ package: packageName,
94
+ },
95
+ extra: context,
96
+ });
97
+ } catch {
98
+ // Silent fallback
99
+ }
100
+ }