@flareapp/react 2.5.1 → 2.7.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/README.md CHANGED
@@ -44,22 +44,24 @@ flare.logger.info('Checkout started', { cartId: cart.id, total: cart.total });
44
44
  ## Minified production errors
45
45
 
46
46
  In production, React throws minified errors like `Minified React error #418; visit https://react.dev/errors/418?args[]=Foo`.
47
- The client parses these into structured fields and attaches them, along with the running React version, to the report
48
- context:
47
+ The client parses these into a single self-contained field, `flare.exception.react_minified_error`, carrying the running
48
+ React version alongside the parsed pieces:
49
49
 
50
50
  ```ts
51
- react: {
52
- version: '19.0.0',
53
- minifiedError: {
54
- number: 418,
55
- args: ['Foo', 'Bar'],
56
- url: 'https://react.dev/errors/418?args[]=Foo&args[]=Bar',
57
- },
51
+ 'flare.exception.react_minified_error': {
52
+ number: 418,
53
+ args: ['Foo', 'Bar'],
54
+ url: 'https://react.dev/errors/418?args[]=Foo&args[]=Bar',
55
+ react_version: '19.0.0',
58
56
  }
59
57
  ```
60
58
 
61
- Flare uses `react.minifiedError` and `react.version` on the backend to look up React's error-code map and surface the
62
- full, human-readable message. No error-code map is bundled into the client. Non-minified errors are reported unchanged.
59
+ Flare reads this field on the backend to look up React's error-code map (keyed on `react_version`) and surface the full,
60
+ human-readable message. It is a Flare-internal field, not part of the display context, so it is emitted only when an
61
+ error actually parses as a minified React error and cannot be stripped by a `beforeSubmit` hook. No error-code map is
62
+ bundled into the client. Non-minified errors are reported unchanged.
63
+
64
+ `context.custom.react` continues to carry `componentStack`, `componentStackFrames` and `version` for display.
63
65
 
64
66
  ## Identifying users
65
67
 
@@ -1,5 +1,5 @@
1
- import { Flare } from "@flareapp/js/browser";
2
1
  import { Component, ErrorInfo, PropsWithChildren, ReactNode } from "react";
2
+ import { Flare } from "@flareapp/js/browser";
3
3
 
4
4
  //#region src/types.d.ts
5
5
  type ComponentStackFrame = {
@@ -18,7 +18,6 @@ type FlareReactContext = {
18
18
  componentStack: string[];
19
19
  componentStackFrames: ComponentStackFrame[];
20
20
  version?: string;
21
- minifiedError?: MinifiedReactError;
22
21
  };
23
22
  };
24
23
  //#endregion
@@ -1,5 +1,5 @@
1
- import { Component, ErrorInfo, PropsWithChildren, ReactNode } from "react";
2
1
  import { Flare } from "@flareapp/js/browser";
2
+ import { Component, ErrorInfo, PropsWithChildren, ReactNode } from "react";
3
3
 
4
4
  //#region src/types.d.ts
5
5
  type ComponentStackFrame = {
@@ -18,7 +18,6 @@ type FlareReactContext = {
18
18
  componentStack: string[];
19
19
  componentStackFrames: ComponentStackFrame[];
20
20
  version?: string;
21
- minifiedError?: MinifiedReactError;
22
21
  };
23
22
  };
24
23
  //#endregion
@@ -32,7 +32,7 @@ let _flareapp_core = require("@flareapp/core");
32
32
  //#region src/constants.ts
33
33
  const CHROMIUM_STACK_REGEX = /^at\s+(\S+)(?:\s+\((.+):(\d+):(\d+)\))?$/;
34
34
  const FIREFOX_SAFARI_STACK_REGEX = /^(\S+?)@(.+):(\d+):(\d+)$/;
35
- const PACKAGE_VERSION = typeof process !== "undefined" && true ? "2.5.1" : "?";
35
+ const PACKAGE_VERSION = typeof process !== "undefined" && true ? "2.7.0" : "?";
36
36
 
37
37
  //#endregion
38
38
  //#region src/identify.ts
@@ -114,6 +114,34 @@ function parseComponentStack(stack) {
114
114
  });
115
115
  }
116
116
 
117
+ //#endregion
118
+ //#region src/buildReactContext.ts
119
+ function buildReactContext(rawStack) {
120
+ return { react: {
121
+ componentStack: formatComponentStack(rawStack),
122
+ componentStackFrames: parseComponentStack(rawStack),
123
+ version: react.version
124
+ } };
125
+ }
126
+
127
+ //#endregion
128
+ //#region src/contextToAttributes.ts
129
+ function contextToAttributes(context, minifiedError) {
130
+ return {
131
+ "context.custom": { react: {
132
+ componentStack: context.react.componentStack,
133
+ componentStackFrames: context.react.componentStackFrames,
134
+ ...context.react.version ? { version: context.react.version } : {}
135
+ } },
136
+ ...minifiedError ? { "flare.exception.react_minified_error": {
137
+ number: minifiedError.number,
138
+ args: minifiedError.args,
139
+ url: minifiedError.url,
140
+ react_version: react.version
141
+ } } : {}
142
+ };
143
+ }
144
+
117
145
  //#endregion
118
146
  //#region src/parseMinifiedReactError.ts
119
147
  const NUMBER_PATTERN = /Minified React error #(\d+)/;
@@ -141,29 +169,6 @@ function parseMinifiedReactError(error) {
141
169
  };
142
170
  }
143
171
 
144
- //#endregion
145
- //#region src/buildReactContext.ts
146
- function buildReactContext(rawStack, error) {
147
- const minifiedError = parseMinifiedReactError(error);
148
- return { react: {
149
- componentStack: formatComponentStack(rawStack),
150
- componentStackFrames: parseComponentStack(rawStack),
151
- version: react.version,
152
- ...minifiedError ? { minifiedError } : {}
153
- } };
154
- }
155
-
156
- //#endregion
157
- //#region src/contextToAttributes.ts
158
- function contextToAttributes(context) {
159
- return { "context.custom": { react: {
160
- componentStack: context.react.componentStack,
161
- componentStackFrames: context.react.componentStackFrames,
162
- ...context.react.version ? { version: context.react.version } : {},
163
- ...context.react.minifiedError ? { minifiedError: context.react.minifiedError } : {}
164
- } } };
165
- }
166
-
167
172
  //#endregion
168
173
  //#region src/FlareErrorBoundary.ts
169
174
  var FlareErrorBoundary = class extends react.Component {
@@ -185,14 +190,14 @@ var FlareErrorBoundary = class extends react.Component {
185
190
  error,
186
191
  errorInfo
187
192
  });
188
- const context = buildReactContext(errorInfo.componentStack ?? "", error);
193
+ const context = buildReactContext(errorInfo.componentStack ?? "");
189
194
  const finalContext = this.props.beforeSubmit?.({
190
195
  error,
191
196
  errorInfo,
192
197
  context
193
198
  }) ?? context;
194
199
  this.setState({ componentStack: finalContext.react.componentStack });
195
- this.flare.reportSilently(error, contextToAttributes(finalContext));
200
+ this.flare.reportSilently(error, contextToAttributes(finalContext, parseMinifiedReactError(error)));
196
201
  this.props.afterSubmit?.({
197
202
  error,
198
203
  errorInfo,
@@ -241,13 +246,13 @@ function flareReactErrorHandler(options) {
241
246
  error: errorObject,
242
247
  errorInfo
243
248
  });
244
- const context = buildReactContext(errorInfo.componentStack ?? "", errorObject);
249
+ const context = buildReactContext(errorInfo.componentStack ?? "");
245
250
  const finalContext = options?.beforeSubmit?.({
246
251
  error: errorObject,
247
252
  errorInfo,
248
253
  context
249
254
  }) ?? context;
250
- flare.reportSilently(errorObject, contextToAttributes(finalContext));
255
+ flare.reportSilently(errorObject, contextToAttributes(finalContext, parseMinifiedReactError(errorObject)));
251
256
  options?.afterSubmit?.({
252
257
  error: errorObject,
253
258
  errorInfo,
@@ -5,7 +5,7 @@ import { convertToError } from "@flareapp/core";
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.5.1" : "?";
8
+ const PACKAGE_VERSION = typeof process !== "undefined" && true ? "2.7.0" : "?";
9
9
 
10
10
  //#endregion
11
11
  //#region src/identify.ts
@@ -87,6 +87,34 @@ function parseComponentStack(stack) {
87
87
  });
88
88
  }
89
89
 
90
+ //#endregion
91
+ //#region src/buildReactContext.ts
92
+ function buildReactContext(rawStack) {
93
+ return { react: {
94
+ componentStack: formatComponentStack(rawStack),
95
+ componentStackFrames: parseComponentStack(rawStack),
96
+ version
97
+ } };
98
+ }
99
+
100
+ //#endregion
101
+ //#region src/contextToAttributes.ts
102
+ function contextToAttributes(context, minifiedError) {
103
+ return {
104
+ "context.custom": { react: {
105
+ componentStack: context.react.componentStack,
106
+ componentStackFrames: context.react.componentStackFrames,
107
+ ...context.react.version ? { version: context.react.version } : {}
108
+ } },
109
+ ...minifiedError ? { "flare.exception.react_minified_error": {
110
+ number: minifiedError.number,
111
+ args: minifiedError.args,
112
+ url: minifiedError.url,
113
+ react_version: version
114
+ } } : {}
115
+ };
116
+ }
117
+
90
118
  //#endregion
91
119
  //#region src/parseMinifiedReactError.ts
92
120
  const NUMBER_PATTERN = /Minified React error #(\d+)/;
@@ -114,29 +142,6 @@ function parseMinifiedReactError(error) {
114
142
  };
115
143
  }
116
144
 
117
- //#endregion
118
- //#region src/buildReactContext.ts
119
- function buildReactContext(rawStack, error) {
120
- const minifiedError = parseMinifiedReactError(error);
121
- return { react: {
122
- componentStack: formatComponentStack(rawStack),
123
- componentStackFrames: parseComponentStack(rawStack),
124
- version,
125
- ...minifiedError ? { minifiedError } : {}
126
- } };
127
- }
128
-
129
- //#endregion
130
- //#region src/contextToAttributes.ts
131
- function contextToAttributes(context) {
132
- return { "context.custom": { react: {
133
- componentStack: context.react.componentStack,
134
- componentStackFrames: context.react.componentStackFrames,
135
- ...context.react.version ? { version: context.react.version } : {},
136
- ...context.react.minifiedError ? { minifiedError: context.react.minifiedError } : {}
137
- } } };
138
- }
139
-
140
145
  //#endregion
141
146
  //#region src/FlareErrorBoundary.ts
142
147
  var FlareErrorBoundary = class extends Component {
@@ -158,14 +163,14 @@ var FlareErrorBoundary = class extends Component {
158
163
  error,
159
164
  errorInfo
160
165
  });
161
- const context = buildReactContext(errorInfo.componentStack ?? "", error);
166
+ const context = buildReactContext(errorInfo.componentStack ?? "");
162
167
  const finalContext = this.props.beforeSubmit?.({
163
168
  error,
164
169
  errorInfo,
165
170
  context
166
171
  }) ?? context;
167
172
  this.setState({ componentStack: finalContext.react.componentStack });
168
- this.flare.reportSilently(error, contextToAttributes(finalContext));
173
+ this.flare.reportSilently(error, contextToAttributes(finalContext, parseMinifiedReactError(error)));
169
174
  this.props.afterSubmit?.({
170
175
  error,
171
176
  errorInfo,
@@ -214,13 +219,13 @@ function flareReactErrorHandler(options) {
214
219
  error: errorObject,
215
220
  errorInfo
216
221
  });
217
- const context = buildReactContext(errorInfo.componentStack ?? "", errorObject);
222
+ const context = buildReactContext(errorInfo.componentStack ?? "");
218
223
  const finalContext = options?.beforeSubmit?.({
219
224
  error: errorObject,
220
225
  errorInfo,
221
226
  context
222
227
  }) ?? context;
223
- flare.reportSilently(errorObject, contextToAttributes(finalContext));
228
+ flare.reportSilently(errorObject, contextToAttributes(finalContext, parseMinifiedReactError(errorObject)));
224
229
  options?.afterSubmit?.({
225
230
  error: errorObject,
226
231
  errorInfo,
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_flareReactErrorHandler = require('./flareReactErrorHandler-BECMhASE.cjs');
2
+ const require_flareReactErrorHandler = require('./flareReactErrorHandler-e8mBB8Lg.cjs');
3
3
  let _flareapp_js = require("@flareapp/js");
4
4
 
5
5
  //#region src/index.ts
package/dist/index.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as FlareErrorBoundaryFallbackProps, c as FlareReactContext, i as FlareErrorBoundary, l as MinifiedReactError, n as FlareReactErrorHandlerOptions, o as FlareErrorBoundaryProps, r as flareReactErrorHandler, s as ComponentStackFrame, t as FlareReactErrorHandlerCallback } from "./flareReactErrorHandler-4Vgqlths.cjs";
1
+ import { a as FlareErrorBoundaryFallbackProps, c as FlareReactContext, i as FlareErrorBoundary, l as MinifiedReactError, n as FlareReactErrorHandlerOptions, o as FlareErrorBoundaryProps, r as flareReactErrorHandler, s as ComponentStackFrame, t as FlareReactErrorHandlerCallback } from "./flareReactErrorHandler-DDsrRIsz.cjs";
2
2
  export { type ComponentStackFrame, FlareErrorBoundary, type FlareErrorBoundaryFallbackProps, type FlareErrorBoundaryProps, type FlareReactContext, type FlareReactErrorHandlerCallback, type FlareReactErrorHandlerOptions, type MinifiedReactError, flareReactErrorHandler };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as FlareErrorBoundaryFallbackProps, c as FlareReactContext, i as FlareErrorBoundary, l as MinifiedReactError, n as FlareReactErrorHandlerOptions, o as FlareErrorBoundaryProps, r as flareReactErrorHandler, s as ComponentStackFrame, t as FlareReactErrorHandlerCallback } from "./flareReactErrorHandler-BcVYRMtC.mjs";
1
+ import { a as FlareErrorBoundaryFallbackProps, c as FlareReactContext, i as FlareErrorBoundary, l as MinifiedReactError, n as FlareReactErrorHandlerOptions, o as FlareErrorBoundaryProps, r as flareReactErrorHandler, s as ComponentStackFrame, t as FlareReactErrorHandlerCallback } from "./flareReactErrorHandler-CLRs3ATb.mjs";
2
2
  export { type ComponentStackFrame, FlareErrorBoundary, type FlareErrorBoundaryFallbackProps, type FlareErrorBoundaryProps, type FlareReactContext, type FlareReactErrorHandlerCallback, type FlareReactErrorHandlerOptions, type MinifiedReactError, flareReactErrorHandler };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as registerReactSdkIdentity, n as FlareErrorBoundary, r as registerDefaultFlare, t as flareReactErrorHandler } from "./flareReactErrorHandler-FqJ6hQZc.mjs";
1
+ import { i as registerReactSdkIdentity, n as FlareErrorBoundary, r as registerDefaultFlare, t as flareReactErrorHandler } from "./flareReactErrorHandler-zU02JsUc.mjs";
2
2
  import { flare } from "@flareapp/js";
3
3
 
4
4
  //#region src/index.ts
package/dist/inject.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_flareReactErrorHandler = require('./flareReactErrorHandler-BECMhASE.cjs');
2
+ const require_flareReactErrorHandler = require('./flareReactErrorHandler-e8mBB8Lg.cjs');
3
3
 
4
4
  exports.FlareErrorBoundary = require_flareReactErrorHandler.FlareErrorBoundary;
5
5
  exports.flareReactErrorHandler = require_flareReactErrorHandler.flareReactErrorHandler;
package/dist/inject.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as FlareErrorBoundaryFallbackProps, c as FlareReactContext, i as FlareErrorBoundary, l as MinifiedReactError, n as FlareReactErrorHandlerOptions, o as FlareErrorBoundaryProps, r as flareReactErrorHandler, s as ComponentStackFrame, t as FlareReactErrorHandlerCallback } from "./flareReactErrorHandler-4Vgqlths.cjs";
1
+ import { a as FlareErrorBoundaryFallbackProps, c as FlareReactContext, i as FlareErrorBoundary, l as MinifiedReactError, n as FlareReactErrorHandlerOptions, o as FlareErrorBoundaryProps, r as flareReactErrorHandler, s as ComponentStackFrame, t as FlareReactErrorHandlerCallback } from "./flareReactErrorHandler-DDsrRIsz.cjs";
2
2
  export { type ComponentStackFrame, FlareErrorBoundary, type FlareErrorBoundaryFallbackProps, type FlareErrorBoundaryProps, type FlareReactContext, type FlareReactErrorHandlerCallback, type FlareReactErrorHandlerOptions, type MinifiedReactError, flareReactErrorHandler };
package/dist/inject.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as FlareErrorBoundaryFallbackProps, c as FlareReactContext, i as FlareErrorBoundary, l as MinifiedReactError, n as FlareReactErrorHandlerOptions, o as FlareErrorBoundaryProps, r as flareReactErrorHandler, s as ComponentStackFrame, t as FlareReactErrorHandlerCallback } from "./flareReactErrorHandler-BcVYRMtC.mjs";
1
+ import { a as FlareErrorBoundaryFallbackProps, c as FlareReactContext, i as FlareErrorBoundary, l as MinifiedReactError, n as FlareReactErrorHandlerOptions, o as FlareErrorBoundaryProps, r as flareReactErrorHandler, s as ComponentStackFrame, t as FlareReactErrorHandlerCallback } from "./flareReactErrorHandler-CLRs3ATb.mjs";
2
2
  export { type ComponentStackFrame, FlareErrorBoundary, type FlareErrorBoundaryFallbackProps, type FlareErrorBoundaryProps, type FlareReactContext, type FlareReactErrorHandlerCallback, type FlareReactErrorHandlerOptions, type MinifiedReactError, flareReactErrorHandler };
package/dist/inject.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as FlareErrorBoundary, t as flareReactErrorHandler } from "./flareReactErrorHandler-FqJ6hQZc.mjs";
1
+ import { n as FlareErrorBoundary, t as flareReactErrorHandler } from "./flareReactErrorHandler-zU02JsUc.mjs";
2
2
 
3
3
  export { FlareErrorBoundary, flareReactErrorHandler };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flareapp/react",
3
- "version": "2.5.1",
3
+ "version": "2.7.0",
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",
@@ -62,7 +62,7 @@
62
62
  "release": "release-it"
63
63
  },
64
64
  "dependencies": {
65
- "@flareapp/core": "2.5.1"
65
+ "@flareapp/core": "2.7.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@flareapp/electron": "file:../electron",
@@ -79,7 +79,7 @@
79
79
  "vitest": "^4.0.0"
80
80
  },
81
81
  "peerDependencies": {
82
- "@flareapp/js": "^2.5.1",
82
+ "@flareapp/js": "^2.7.0",
83
83
  "react": "^16.0.0||^17.0.0||^18.0.0||^19.0.0"
84
84
  },
85
85
  "publishConfig": {