@flareapp/react 2.0.0 → 2.0.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/dist/index.cjs CHANGED
@@ -33,7 +33,7 @@ react = __toESM(react);
33
33
  //#region src/constants.ts
34
34
  const CHROMIUM_STACK_REGEX = /^at\s+(\S+)(?:\s+\((.+):(\d+):(\d+)\))?$/;
35
35
  const FIREFOX_SAFARI_STACK_REGEX = /^(\S+?)@(.+):(\d+):(\d+)$/;
36
- const PACKAGE_VERSION = typeof process !== "undefined" && true ? "2.0.0" : "?";
36
+ const PACKAGE_VERSION = typeof process !== "undefined" && true ? "2.0.1" : "?";
37
37
 
38
38
  //#endregion
39
39
  //#region src/identify.ts
@@ -54,13 +54,10 @@ function registerReactSdkIdentity() {
54
54
  //#endregion
55
55
  //#region src/contextToAttributes.ts
56
56
  function contextToAttributes(context) {
57
- return { "context.custom": {
58
- framework: "react",
59
- react: {
60
- componentStack: context.react.componentStack,
61
- componentStackFrames: context.react.componentStackFrames
62
- }
63
- } };
57
+ return { "context.custom": { react: {
58
+ componentStack: context.react.componentStack,
59
+ componentStackFrames: context.react.componentStackFrames
60
+ } } };
64
61
  }
65
62
 
66
63
  //#endregion
@@ -122,7 +119,7 @@ var FlareErrorBoundary = class extends react.Component {
122
119
  context
123
120
  }) ?? context;
124
121
  this.setState({ componentStack: finalContext.react.componentStack });
125
- Promise.resolve(_flareapp_js.flare.report(error, contextToAttributes(finalContext))).catch(() => {});
122
+ _flareapp_js.flare.reportSilently(error, contextToAttributes(finalContext));
126
123
  this.props.afterSubmit?.({
127
124
  error,
128
125
  errorInfo,
@@ -160,19 +157,11 @@ var FlareErrorBoundary = class extends react.Component {
160
157
  }
161
158
  };
162
159
 
163
- //#endregion
164
- //#region src/convertToError.ts
165
- function convertToError(error) {
166
- if (error instanceof Error) return error;
167
- if (typeof error === "string") return new Error(error);
168
- return new Error(String(error));
169
- }
170
-
171
160
  //#endregion
172
161
  //#region src/flareReactErrorHandler.ts
173
162
  function flareReactErrorHandler(options) {
174
163
  return (error, errorInfo) => {
175
- const errorObject = convertToError(error);
164
+ const errorObject = (0, _flareapp_js.convertToError)(error);
176
165
  options?.beforeEvaluate?.({
177
166
  error: errorObject,
178
167
  errorInfo
@@ -187,7 +176,7 @@ function flareReactErrorHandler(options) {
187
176
  errorInfo,
188
177
  context
189
178
  }) ?? context;
190
- Promise.resolve(_flareapp_js.flare.report(errorObject, contextToAttributes(finalContext))).catch(() => {});
179
+ _flareapp_js.flare.reportSilently(errorObject, contextToAttributes(finalContext));
191
180
  options?.afterSubmit?.({
192
181
  error: errorObject,
193
182
  errorInfo,
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { flare } from "@flareapp/js";
1
+ import { convertToError, flare } from "@flareapp/js";
2
2
  import * as React from "react";
3
3
  import { Component } from "react";
4
4
 
5
5
  //#region src/constants.ts
6
6
  const CHROMIUM_STACK_REGEX = /^at\s+(\S+)(?:\s+\((.+):(\d+):(\d+)\))?$/;
7
7
  const FIREFOX_SAFARI_STACK_REGEX = /^(\S+?)@(.+):(\d+):(\d+)$/;
8
- const PACKAGE_VERSION = typeof process !== "undefined" && true ? "2.0.0" : "?";
8
+ const PACKAGE_VERSION = typeof process !== "undefined" && true ? "2.0.1" : "?";
9
9
 
10
10
  //#endregion
11
11
  //#region src/identify.ts
@@ -26,13 +26,10 @@ function registerReactSdkIdentity() {
26
26
  //#endregion
27
27
  //#region src/contextToAttributes.ts
28
28
  function contextToAttributes(context) {
29
- return { "context.custom": {
30
- framework: "react",
31
- react: {
32
- componentStack: context.react.componentStack,
33
- componentStackFrames: context.react.componentStackFrames
34
- }
35
- } };
29
+ return { "context.custom": { react: {
30
+ componentStack: context.react.componentStack,
31
+ componentStackFrames: context.react.componentStackFrames
32
+ } } };
36
33
  }
37
34
 
38
35
  //#endregion
@@ -94,7 +91,7 @@ var FlareErrorBoundary = class extends Component {
94
91
  context
95
92
  }) ?? context;
96
93
  this.setState({ componentStack: finalContext.react.componentStack });
97
- Promise.resolve(flare.report(error, contextToAttributes(finalContext))).catch(() => {});
94
+ flare.reportSilently(error, contextToAttributes(finalContext));
98
95
  this.props.afterSubmit?.({
99
96
  error,
100
97
  errorInfo,
@@ -132,14 +129,6 @@ var FlareErrorBoundary = class extends Component {
132
129
  }
133
130
  };
134
131
 
135
- //#endregion
136
- //#region src/convertToError.ts
137
- function convertToError(error) {
138
- if (error instanceof Error) return error;
139
- if (typeof error === "string") return new Error(error);
140
- return new Error(String(error));
141
- }
142
-
143
132
  //#endregion
144
133
  //#region src/flareReactErrorHandler.ts
145
134
  function flareReactErrorHandler(options) {
@@ -159,7 +148,7 @@ function flareReactErrorHandler(options) {
159
148
  errorInfo,
160
149
  context
161
150
  }) ?? context;
162
- Promise.resolve(flare.report(errorObject, contextToAttributes(finalContext))).catch(() => {});
151
+ flare.reportSilently(errorObject, contextToAttributes(finalContext));
163
152
  options?.afterSubmit?.({
164
153
  error: errorObject,
165
154
  errorInfo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flareapp/react",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "React client for flareapp.io",
5
5
  "homepage": "https://flareapp.io",
6
6
  "bugs": "https://github.com/spatie/flare-client-js/issues",
@@ -57,7 +57,7 @@
57
57
  "vitest": "^4.0.0"
58
58
  },
59
59
  "peerDependencies": {
60
- "@flareapp/js": "^2.0.0",
60
+ "@flareapp/js": "^2.0.1",
61
61
  "react": "^16.0.0||^17.0.0||^18.0.0||^19.0.0"
62
62
  },
63
63
  "publishConfig": {