@drakkar.software/sunglasses-react-native 0.12.1 → 0.14.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/dist/index.js CHANGED
@@ -91,7 +91,12 @@ function reasonOf(event) {
91
91
  }
92
92
  function attachUnhandledRejectionHandler(client, options = {}) {
93
93
  const onUnhandled = (error) => {
94
- (0, import_sunglasses_core.captureException)(client, error, { handled: false, ...options });
94
+ (0, import_sunglasses_core.captureException)(client, error, {
95
+ handled: false,
96
+ ...options,
97
+ source: "rejection",
98
+ fatal: false
99
+ });
95
100
  (0, import_sunglasses_core.publishGlobalError)({ error, fatal: false, kind: "rejection" });
96
101
  };
97
102
  const tracking = rejectionTracking;
@@ -149,7 +154,12 @@ function SunglassesProvider({
149
154
  if (options.globalHandlers !== false && typeof ErrorUtils !== "undefined" && ErrorUtils.setGlobalHandler) {
150
155
  const previous = ErrorUtils.getGlobalHandler?.();
151
156
  ErrorUtils.setGlobalHandler((error, isFatal) => {
152
- (0, import_sunglasses_core2.captureException)(client, error, { handled: false, ...options });
157
+ (0, import_sunglasses_core2.captureException)(client, error, {
158
+ handled: false,
159
+ ...options,
160
+ fatal: isFatal !== false,
161
+ source: "global"
162
+ });
153
163
  (0, import_sunglasses_core2.publishGlobalError)({ error, fatal: isFatal !== false, kind: "error" });
154
164
  previous?.(error, isFatal);
155
165
  });
@@ -320,9 +330,14 @@ var ErrorBoundaryInner = class extends import_react7.default.Component {
320
330
  static getDerivedStateFromError() {
321
331
  return { hasError: true };
322
332
  }
323
- componentDidCatch(error) {
333
+ componentDidCatch(error, errorInfo) {
324
334
  const { client, config } = this.props;
325
- (0, import_sunglasses_core3.captureException)(client, error, { handled: true, ...config });
335
+ (0, import_sunglasses_core3.captureException)(client, error, {
336
+ handled: true,
337
+ ...config,
338
+ componentStack: errorInfo.componentStack ?? void 0,
339
+ source: "boundary"
340
+ });
326
341
  }
327
342
  render() {
328
343
  if (this.state.hasError) return this.props.fallback ?? null;
@@ -359,9 +374,14 @@ var GlobalErrorBoundaryInner = class extends import_react8.default.Component {
359
374
  componentWillUnmount() {
360
375
  this.unsubscribe?.();
361
376
  }
362
- componentDidCatch(error) {
377
+ componentDidCatch(error, errorInfo) {
363
378
  const { client, config } = this.props;
364
- (0, import_sunglasses_core4.captureException)(client, error, { handled: true, ...config });
379
+ (0, import_sunglasses_core4.captureException)(client, error, {
380
+ handled: true,
381
+ ...config,
382
+ componentStack: errorInfo.componentStack ?? void 0,
383
+ source: "boundary"
384
+ });
365
385
  }
366
386
  /**
367
387
  * React to a global error published by the provider's auto-capture handlers.
@@ -416,6 +436,9 @@ function wrapExpoRouterErrorBoundary(Boundary, options = {}) {
416
436
  (0, import_sunglasses_core5.captureException)(client, error, {
417
437
  handled: true,
418
438
  ...options.config,
439
+ // Expo Router passes only { error, retry } — no errorInfo is available,
440
+ // so $error_component_stack cannot be captured here.
441
+ source: "boundary",
419
442
  properties: { ...routeProps, ...options.config?.properties }
420
443
  });
421
444
  }, [client, error, pathname]);
package/dist/index.mjs CHANGED
@@ -47,7 +47,12 @@ function reasonOf(event) {
47
47
  }
48
48
  function attachUnhandledRejectionHandler(client, options = {}) {
49
49
  const onUnhandled = (error) => {
50
- captureException(client, error, { handled: false, ...options });
50
+ captureException(client, error, {
51
+ handled: false,
52
+ ...options,
53
+ source: "rejection",
54
+ fatal: false
55
+ });
51
56
  publishGlobalError({ error, fatal: false, kind: "rejection" });
52
57
  };
53
58
  const tracking = rejectionTracking;
@@ -105,7 +110,12 @@ function SunglassesProvider({
105
110
  if (options.globalHandlers !== false && typeof ErrorUtils !== "undefined" && ErrorUtils.setGlobalHandler) {
106
111
  const previous = ErrorUtils.getGlobalHandler?.();
107
112
  ErrorUtils.setGlobalHandler((error, isFatal) => {
108
- captureException2(client, error, { handled: false, ...options });
113
+ captureException2(client, error, {
114
+ handled: false,
115
+ ...options,
116
+ fatal: isFatal !== false,
117
+ source: "global"
118
+ });
109
119
  publishGlobalError2({ error, fatal: isFatal !== false, kind: "error" });
110
120
  previous?.(error, isFatal);
111
121
  });
@@ -276,9 +286,14 @@ var ErrorBoundaryInner = class extends React2.Component {
276
286
  static getDerivedStateFromError() {
277
287
  return { hasError: true };
278
288
  }
279
- componentDidCatch(error) {
289
+ componentDidCatch(error, errorInfo) {
280
290
  const { client, config } = this.props;
281
- captureException3(client, error, { handled: true, ...config });
291
+ captureException3(client, error, {
292
+ handled: true,
293
+ ...config,
294
+ componentStack: errorInfo.componentStack ?? void 0,
295
+ source: "boundary"
296
+ });
282
297
  }
283
298
  render() {
284
299
  if (this.state.hasError) return this.props.fallback ?? null;
@@ -315,9 +330,14 @@ var GlobalErrorBoundaryInner = class extends React3.Component {
315
330
  componentWillUnmount() {
316
331
  this.unsubscribe?.();
317
332
  }
318
- componentDidCatch(error) {
333
+ componentDidCatch(error, errorInfo) {
319
334
  const { client, config } = this.props;
320
- captureException4(client, error, { handled: true, ...config });
335
+ captureException4(client, error, {
336
+ handled: true,
337
+ ...config,
338
+ componentStack: errorInfo.componentStack ?? void 0,
339
+ source: "boundary"
340
+ });
321
341
  }
322
342
  /**
323
343
  * React to a global error published by the provider's auto-capture handlers.
@@ -372,6 +392,9 @@ function wrapExpoRouterErrorBoundary(Boundary, options = {}) {
372
392
  captureException5(client, error, {
373
393
  handled: true,
374
394
  ...options.config,
395
+ // Expo Router passes only { error, retry } — no errorInfo is available,
396
+ // so $error_component_stack cannot be captured here.
397
+ source: "boundary",
375
398
  properties: { ...routeProps, ...options.config?.properties }
376
399
  });
377
400
  }, [client, error, pathname]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drakkar.software/sunglasses-react-native",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "description": "React Native / Expo provider and hooks for SunGlasses event tracking",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -8,6 +8,8 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
+ "react-native": "./dist/index.js",
12
+ "browser": "./dist/index.js",
11
13
  "import": "./dist/index.mjs",
12
14
  "require": "./dist/index.js"
13
15
  }
@@ -16,7 +18,7 @@
16
18
  "dist"
17
19
  ],
18
20
  "dependencies": {
19
- "@drakkar.software/sunglasses-core": "0.12.0"
21
+ "@drakkar.software/sunglasses-core": "0.14.0"
20
22
  },
21
23
  "peerDependencies": {
22
24
  "expo-router": ">=3.0.0",