@blipit/react-native 0.2.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.2.1
2
+
3
+ - Events carry the `npm:@blipit/react-native` package and version, so the dashboard can show when this app runs an old Blipit SDK. A `beforeSend` you pass still runs after it. `VERSION` is exported.
4
+ - No development console notice: events leave through the native transport, which does not expose response headers, and swapping it for the fetch transport in development would change how events are queued offline. The dashboard banner covers updates instead.
5
+
1
6
  ## 0.2.0
2
7
 
3
8
  - `init` with an empty key or project id logs a warning, returns false and leaves Blipit off instead of throwing. It returns true when started.
package/README.md CHANGED
@@ -42,3 +42,7 @@ await Blipit.flush();
42
42
  Pass `tracesSampleRate: 0.2` to `init` and screen loads and requests show up on the Performance page.
43
43
 
44
44
  Docs: https://docs.blipit.io/mobile
45
+
46
+ ## Updates
47
+
48
+ The project page on app.blipit.io shows a banner when this app sends events from an older version, with the command. Update with `npm install @blipit/react-native@latest`. Details: https://docs.blipit.io/updates
package/dist/index.cjs CHANGED
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  DEFAULT_ENDPOINT: () => DEFAULT_ENDPOINT,
34
+ VERSION: () => VERSION,
34
35
  addBreadcrumb: () => import_react_native.addBreadcrumb,
35
36
  captureException: () => import_react_native.captureException,
36
37
  captureMessage: () => import_react_native.captureMessage,
@@ -40,12 +41,26 @@ __export(index_exports, {
40
41
  init: () => init2,
41
42
  setTag: () => import_react_native.setTag,
42
43
  setUser: () => import_react_native.setUser,
44
+ withIdentity: () => withIdentity,
43
45
  wrap: () => import_react_native.wrap
44
46
  });
45
47
  module.exports = __toCommonJS(index_exports);
46
48
  var Sentry = __toESM(require("@sentry/react-native"), 1);
47
49
  var import_react_native = require("@sentry/react-native");
48
50
  var DEFAULT_ENDPOINT = "https://in.blipit.io";
51
+ var VERSION = "0.2.1";
52
+ var PACKAGE = { name: "npm:@blipit/react-native", version: VERSION };
53
+ function withIdentity(user) {
54
+ return (event, hint) => {
55
+ try {
56
+ const sdk = event.sdk ??= {};
57
+ const packages = sdk.packages ?? [];
58
+ if (!packages.some((p) => p?.name === PACKAGE.name)) sdk.packages = [...packages, { ...PACKAGE }];
59
+ } catch {
60
+ }
61
+ return user ? user(event, hint) : event;
62
+ };
63
+ }
49
64
  function dsn(key, project, endpoint = DEFAULT_ENDPOINT) {
50
65
  const host = endpoint.split("://").pop().replace(/\/+$/, "");
51
66
  const scheme = endpoint.startsWith("http://") ? "http" : "https";
@@ -68,7 +83,8 @@ function init2(options) {
68
83
  dsn: dsn(k, project, endpoint),
69
84
  sendDefaultPii: false,
70
85
  tracesSampleRate: 0,
71
- ...rest
86
+ ...rest,
87
+ beforeSend: withIdentity(rest.beforeSend)
72
88
  });
73
89
  return true;
74
90
  }
@@ -88,6 +104,7 @@ function captureSecurity(kind, actor, details = {}) {
88
104
  // Annotate the CommonJS export names for ESM import in node:
89
105
  0 && (module.exports = {
90
106
  DEFAULT_ENDPOINT,
107
+ VERSION,
91
108
  addBreadcrumb,
92
109
  captureException,
93
110
  captureMessage,
@@ -97,5 +114,6 @@ function captureSecurity(kind, actor, details = {}) {
97
114
  init,
98
115
  setTag,
99
116
  setUser,
117
+ withIdentity,
100
118
  wrap
101
119
  });
package/dist/index.d.cts CHANGED
@@ -2,6 +2,9 @@ import { ReactNativeOptions } from '@sentry/react-native';
2
2
  export { addBreadcrumb, captureException, captureMessage, flush, setTag, setUser, wrap } from '@sentry/react-native';
3
3
 
4
4
  declare const DEFAULT_ENDPOINT = "https://in.blipit.io";
5
+ declare const VERSION = "0.2.1";
6
+ type BeforeSend = NonNullable<ReactNativeOptions["beforeSend"]>;
7
+ declare function withIdentity(user?: BeforeSend): BeforeSend;
5
8
  interface BlipitOptions extends Omit<ReactNativeOptions, "dsn"> {
6
9
  key?: string;
7
10
  publicKey?: string;
@@ -19,4 +22,4 @@ declare function dsn(key: string, project: string | number, endpoint?: string):
19
22
  declare function init(options: BlipitOptions): boolean;
20
23
  declare function captureSecurity(kind: string, actor: string, details?: SecurityDetails): void;
21
24
 
22
- export { type BlipitOptions, DEFAULT_ENDPOINT, type SecurityDetails, captureSecurity, dsn, init };
25
+ export { type BlipitOptions, DEFAULT_ENDPOINT, type SecurityDetails, VERSION, captureSecurity, dsn, init, withIdentity };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,9 @@ import { ReactNativeOptions } from '@sentry/react-native';
2
2
  export { addBreadcrumb, captureException, captureMessage, flush, setTag, setUser, wrap } from '@sentry/react-native';
3
3
 
4
4
  declare const DEFAULT_ENDPOINT = "https://in.blipit.io";
5
+ declare const VERSION = "0.2.1";
6
+ type BeforeSend = NonNullable<ReactNativeOptions["beforeSend"]>;
7
+ declare function withIdentity(user?: BeforeSend): BeforeSend;
5
8
  interface BlipitOptions extends Omit<ReactNativeOptions, "dsn"> {
6
9
  key?: string;
7
10
  publicKey?: string;
@@ -19,4 +22,4 @@ declare function dsn(key: string, project: string | number, endpoint?: string):
19
22
  declare function init(options: BlipitOptions): boolean;
20
23
  declare function captureSecurity(kind: string, actor: string, details?: SecurityDetails): void;
21
24
 
22
- export { type BlipitOptions, DEFAULT_ENDPOINT, type SecurityDetails, captureSecurity, dsn, init };
25
+ export { type BlipitOptions, DEFAULT_ENDPOINT, type SecurityDetails, VERSION, captureSecurity, dsn, init, withIdentity };
package/dist/index.js CHANGED
@@ -2,6 +2,19 @@
2
2
  import * as Sentry from "@sentry/react-native";
3
3
  import { captureException, captureMessage as captureMessage2, setUser, setTag, addBreadcrumb, flush, wrap } from "@sentry/react-native";
4
4
  var DEFAULT_ENDPOINT = "https://in.blipit.io";
5
+ var VERSION = "0.2.1";
6
+ var PACKAGE = { name: "npm:@blipit/react-native", version: VERSION };
7
+ function withIdentity(user) {
8
+ return (event, hint) => {
9
+ try {
10
+ const sdk = event.sdk ??= {};
11
+ const packages = sdk.packages ?? [];
12
+ if (!packages.some((p) => p?.name === PACKAGE.name)) sdk.packages = [...packages, { ...PACKAGE }];
13
+ } catch {
14
+ }
15
+ return user ? user(event, hint) : event;
16
+ };
17
+ }
5
18
  function dsn(key, project, endpoint = DEFAULT_ENDPOINT) {
6
19
  const host = endpoint.split("://").pop().replace(/\/+$/, "");
7
20
  const scheme = endpoint.startsWith("http://") ? "http" : "https";
@@ -24,7 +37,8 @@ function init2(options) {
24
37
  dsn: dsn(k, project, endpoint),
25
38
  sendDefaultPii: false,
26
39
  tracesSampleRate: 0,
27
- ...rest
40
+ ...rest,
41
+ beforeSend: withIdentity(rest.beforeSend)
28
42
  });
29
43
  return true;
30
44
  }
@@ -43,6 +57,7 @@ function captureSecurity(kind, actor, details = {}) {
43
57
  }
44
58
  export {
45
59
  DEFAULT_ENDPOINT,
60
+ VERSION,
46
61
  addBreadcrumb,
47
62
  captureException,
48
63
  captureMessage2 as captureMessage,
@@ -52,5 +67,6 @@ export {
52
67
  init2 as init,
53
68
  setTag,
54
69
  setUser,
70
+ withIdentity,
55
71
  wrap
56
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blipit/react-native",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Blipit error monitoring for React Native and Expo. Know your app broke before your users tell you.",
5
5
  "license": "MIT",
6
6
  "type": "module",