@flareapp/js 2.5.0 → 2.6.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
@@ -21,6 +21,22 @@ flare.light('YOUR_FLARE_API_KEY');
21
21
  That is all you need. The client automatically listens for uncaught exceptions and unhandled promise rejections,
22
22
  collects browser context, and sends error reports to Flare.
23
23
 
24
+ ## Identifying users
25
+
26
+ Attach the logged-in user to reports so you can see who was affected:
27
+
28
+ ```javascript
29
+ import { flare } from '@flareapp/js';
30
+
31
+ flare.setUser({
32
+ id: 123,
33
+ email: 'jane@example.com',
34
+ fullName: 'Jane Doe',
35
+ });
36
+ ```
37
+
38
+ Recognised fields: `id` (→ `user.id`), `email` (→ `user.email`), `fullName` (→ `user.full_name`), `ipAddress` (→ `client.address`). Any extra keys are collected under `user.attributes`. Pass `null` to clear the user on logout: `flare.setUser(null)`.
39
+
24
40
  ## Logging
25
41
 
26
42
  Beyond errors, the client can send structured logs. Logs are opt-in: enable them with `enableLogs`, then call any of
package/dist/browser.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_catchWindowErrors = require('./catchWindowErrors-o3uphGbB.cjs');
2
+ const require_catchWindowErrors = require('./catchWindowErrors-_IlVo06V.cjs');
3
3
  let _flareapp_core = require("@flareapp/core");
4
4
 
5
5
  //#region src/browser.ts
package/dist/browser.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as BrowserFlushScheduler, i as collectBrowser, n as CLIENT_VERSION, r as FetchFileReader, t as catchWindowErrors } from "./catchWindowErrors-CfjwL-Dl.mjs";
1
+ import { a as BrowserFlushScheduler, i as collectBrowser, n as CLIENT_VERSION, r as FetchFileReader, t as catchWindowErrors } from "./catchWindowErrors-DaCqd2yC.mjs";
2
2
  import { Api, Flare as Flare$1, GlobalScopeProvider } from "@flareapp/core";
3
3
 
4
4
  //#region src/browser.ts
@@ -1,4 +1,4 @@
1
- import { redactUrlQuery } from "@flareapp/core";
1
+ import { redactUrlQuery, routeRejection } from "@flareapp/core";
2
2
 
3
3
  //#region src/browser/BrowserFlushScheduler.ts
4
4
  var BrowserFlushScheduler = class {
@@ -102,7 +102,7 @@ var FetchFileReader = class {
102
102
 
103
103
  //#endregion
104
104
  //#region src/env/index.ts
105
- const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.5.0" : "?";
105
+ const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.6.0" : "?";
106
106
 
107
107
  //#endregion
108
108
  //#region src/browser/catchWindowErrors.ts
@@ -116,36 +116,9 @@ function catchWindowErrors() {
116
116
  window.addEventListener("unhandledrejection", (event) => {
117
117
  const flare = window.flare;
118
118
  if (!flare) return;
119
- const reason = event.reason;
120
- if (reason instanceof Error) {
121
- flare.reportSilently(reason);
122
- return;
123
- }
124
- if (hasStack(reason)) {
125
- const error = new Error(describeRejectionReason(reason));
126
- error.stack = reason.stack;
127
- flare.reportSilently(error);
128
- return;
129
- }
130
- Promise.resolve(flare.reportUnhandledRejection(describeRejectionReason(reason))).catch(() => {});
119
+ routeRejection(flare, event.reason);
131
120
  });
132
121
  }
133
- function describeRejectionReason(reason) {
134
- if (typeof reason === "string") return reason;
135
- if (reason && typeof reason === "object") {
136
- const message = reason.message;
137
- if (typeof message === "string") return message;
138
- try {
139
- return JSON.stringify(reason);
140
- } catch {
141
- return "Unhandled promise rejection (non-serializable reason)";
142
- }
143
- }
144
- return String(reason);
145
- }
146
- function hasStack(value) {
147
- return typeof value === "object" && value !== null && "stack" in value && typeof value.stack === "string";
148
- }
149
122
 
150
123
  //#endregion
151
124
  export { BrowserFlushScheduler as a, collectBrowser as i, CLIENT_VERSION as n, FetchFileReader as r, catchWindowErrors as t };
@@ -102,7 +102,7 @@ var FetchFileReader = class {
102
102
 
103
103
  //#endregion
104
104
  //#region src/env/index.ts
105
- const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.5.0" : "?";
105
+ const CLIENT_VERSION = typeof process !== "undefined" && true ? "2.6.0" : "?";
106
106
 
107
107
  //#endregion
108
108
  //#region src/browser/catchWindowErrors.ts
@@ -116,36 +116,9 @@ function catchWindowErrors() {
116
116
  window.addEventListener("unhandledrejection", (event) => {
117
117
  const flare = window.flare;
118
118
  if (!flare) return;
119
- const reason = event.reason;
120
- if (reason instanceof Error) {
121
- flare.reportSilently(reason);
122
- return;
123
- }
124
- if (hasStack(reason)) {
125
- const error = new Error(describeRejectionReason(reason));
126
- error.stack = reason.stack;
127
- flare.reportSilently(error);
128
- return;
129
- }
130
- Promise.resolve(flare.reportUnhandledRejection(describeRejectionReason(reason))).catch(() => {});
119
+ (0, _flareapp_core.routeRejection)(flare, event.reason);
131
120
  });
132
121
  }
133
- function describeRejectionReason(reason) {
134
- if (typeof reason === "string") return reason;
135
- if (reason && typeof reason === "object") {
136
- const message = reason.message;
137
- if (typeof message === "string") return message;
138
- try {
139
- return JSON.stringify(reason);
140
- } catch {
141
- return "Unhandled promise rejection (non-serializable reason)";
142
- }
143
- }
144
- return String(reason);
145
- }
146
- function hasStack(value) {
147
- return typeof value === "object" && value !== null && "stack" in value && typeof value.stack === "string";
148
- }
149
122
 
150
123
  //#endregion
151
124
  Object.defineProperty(exports, 'BrowserFlushScheduler', {
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_catchWindowErrors = require('./catchWindowErrors-o3uphGbB.cjs');
2
+ const require_catchWindowErrors = require('./catchWindowErrors-_IlVo06V.cjs');
3
3
  const require_browser = require('./browser.cjs');
4
4
  let _flareapp_core = require("@flareapp/core");
5
5
 
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Flare } from "./browser.cjs";
2
- import { AttributeValue, Attributes, Config, ContextCollector, DEFAULT_URL_DENYLIST, EntryPointHandler, FileReader, FlushFn, FlushScheduler, Framework, GlobalScopeProvider, Glow, Logger, MessageLevel, NullFileReader, OverriddenGrouping, Report, Scope, ScopeProvider, SdkInfo, SpanEvent, StackFrame, convertToError, redactUrlQuery, redactUrlQuery as redactFullPath, resolveDenylist } from "@flareapp/core";
2
+ import { AttributeValue, Attributes, Config, ContextCollector, DEFAULT_URL_DENYLIST, EntryPointHandler, FileReader, FlushFn, FlushScheduler, Framework, GlobalScopeProvider, Glow, Logger, MessageLevel, NullFileReader, OverriddenGrouping, Report, Scope, ScopeProvider, SdkInfo, SpanEvent, StackFrame, User, convertToError, redactUrlQuery, redactUrlQuery as redactFullPath, resolveDenylist } from "@flareapp/core";
3
3
 
4
4
  //#region src/index.d.ts
5
5
  declare const flare: Flare;
6
6
  //#endregion
7
- export { type AttributeValue, type Attributes, type Config, type ContextCollector, DEFAULT_URL_DENYLIST, type EntryPointHandler, type FileReader, Flare, type FlushFn, type FlushScheduler, type Framework, GlobalScopeProvider, type Glow, Logger, type MessageLevel, NullFileReader, type OverriddenGrouping, type Report, Scope, type ScopeProvider, type SdkInfo, type SpanEvent, type StackFrame, convertToError, flare, redactFullPath, redactUrlQuery, resolveDenylist };
7
+ export { type AttributeValue, type Attributes, type Config, type ContextCollector, DEFAULT_URL_DENYLIST, type EntryPointHandler, type FileReader, Flare, type FlushFn, type FlushScheduler, type Framework, GlobalScopeProvider, type Glow, Logger, type MessageLevel, NullFileReader, type OverriddenGrouping, type Report, Scope, type ScopeProvider, type SdkInfo, type SpanEvent, type StackFrame, type User, convertToError, flare, redactFullPath, redactUrlQuery, resolveDenylist };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Flare } from "./browser.mjs";
2
- import { AttributeValue, Attributes, Config, ContextCollector, DEFAULT_URL_DENYLIST, EntryPointHandler, FileReader, FlushFn, FlushScheduler, Framework, GlobalScopeProvider, Glow, Logger, MessageLevel, NullFileReader, OverriddenGrouping, Report, Scope, ScopeProvider, SdkInfo, SpanEvent, StackFrame, convertToError, redactUrlQuery, redactUrlQuery as redactFullPath, resolveDenylist } from "@flareapp/core";
2
+ import { AttributeValue, Attributes, Config, ContextCollector, DEFAULT_URL_DENYLIST, EntryPointHandler, FileReader, FlushFn, FlushScheduler, Framework, GlobalScopeProvider, Glow, Logger, MessageLevel, NullFileReader, OverriddenGrouping, Report, Scope, ScopeProvider, SdkInfo, SpanEvent, StackFrame, User, convertToError, redactUrlQuery, redactUrlQuery as redactFullPath, resolveDenylist } from "@flareapp/core";
3
3
 
4
4
  //#region src/index.d.ts
5
5
  declare const flare: Flare;
6
6
  //#endregion
7
- export { type AttributeValue, type Attributes, type Config, type ContextCollector, DEFAULT_URL_DENYLIST, type EntryPointHandler, type FileReader, Flare, type FlushFn, type FlushScheduler, type Framework, GlobalScopeProvider, type Glow, Logger, type MessageLevel, NullFileReader, type OverriddenGrouping, type Report, Scope, type ScopeProvider, type SdkInfo, type SpanEvent, type StackFrame, convertToError, flare, redactFullPath, redactUrlQuery, resolveDenylist };
7
+ export { type AttributeValue, type Attributes, type Config, type ContextCollector, DEFAULT_URL_DENYLIST, type EntryPointHandler, type FileReader, Flare, type FlushFn, type FlushScheduler, type Framework, GlobalScopeProvider, type Glow, Logger, type MessageLevel, NullFileReader, type OverriddenGrouping, type Report, Scope, type ScopeProvider, type SdkInfo, type SpanEvent, type StackFrame, type User, convertToError, flare, redactFullPath, redactUrlQuery, resolveDenylist };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as catchWindowErrors } from "./catchWindowErrors-CfjwL-Dl.mjs";
1
+ import { t as catchWindowErrors } from "./catchWindowErrors-DaCqd2yC.mjs";
2
2
  import { Flare } from "./browser.mjs";
3
3
  import { DEFAULT_URL_DENYLIST, GlobalScopeProvider, Logger, NullFileReader, Scope, convertToError, redactUrlQuery, redactUrlQuery as redactFullPath, resolveDenylist } from "@flareapp/core";
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flareapp/js",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "JavaScript client for flareapp.io",
5
5
  "homepage": "https://flareapp.io",
6
6
  "bugs": {
@@ -59,7 +59,7 @@
59
59
  "release": "release-it"
60
60
  },
61
61
  "dependencies": {
62
- "@flareapp/core": "2.5.0"
62
+ "@flareapp/core": "2.6.0"
63
63
  },
64
64
  "devDependencies": {
65
65
  "error-stack-parser": "^2.0.2",