@blipit/react-native 0.1.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 +44 -0
- package/dist/index.cjs +92 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +47 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @blipit/react-native
|
|
2
|
+
|
|
3
|
+
Blipit error monitoring for React Native and Expo. Know your app broke before your users tell you.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @blipit/react-native @sentry/react-native
|
|
9
|
+
npx pod-install
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Expo projects add the `@sentry/react-native/expo` config plugin to `app.json` as usual; the Blipit key and project id go in code.
|
|
13
|
+
|
|
14
|
+
## Quick start
|
|
15
|
+
|
|
16
|
+
Call `init` once, at the top of your entry file, and wrap the root component.
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import * as Blipit from "@blipit/react-native";
|
|
20
|
+
|
|
21
|
+
Blipit.init({ key: "<public key>", project: <project id>, environment: "production", release: "myapp@1.4.2" });
|
|
22
|
+
|
|
23
|
+
export default Blipit.wrap(App);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Both values are on the project's Keys page at app.blipit.io. Unhandled JavaScript errors and native crashes are reported on their own.
|
|
27
|
+
|
|
28
|
+
## Manual capture
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
Blipit.captureException(err);
|
|
32
|
+
Blipit.captureMessage("cache miss rate above 50%", "warning");
|
|
33
|
+
Blipit.setUser({ id: "42", email: "ana@example.com" });
|
|
34
|
+
Blipit.setTag("region", "ap-southeast-1");
|
|
35
|
+
Blipit.addBreadcrumb({ category: "ui", message: "opened checkout" });
|
|
36
|
+
Blipit.captureSecurity("login_failed", "ana@example.com", { ip: "10.0.0.1" });
|
|
37
|
+
await Blipit.flush();
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Performance
|
|
41
|
+
|
|
42
|
+
Pass `tracesSampleRate: 0.2` to `init` and screen loads and requests show up on the Performance page.
|
|
43
|
+
|
|
44
|
+
Docs: https://docs.blipit.io/mobile
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
DEFAULT_ENDPOINT: () => DEFAULT_ENDPOINT,
|
|
34
|
+
addBreadcrumb: () => import_react_native.addBreadcrumb,
|
|
35
|
+
captureException: () => import_react_native.captureException,
|
|
36
|
+
captureMessage: () => import_react_native.captureMessage,
|
|
37
|
+
captureSecurity: () => captureSecurity,
|
|
38
|
+
dsn: () => dsn,
|
|
39
|
+
flush: () => import_react_native.flush,
|
|
40
|
+
init: () => init2,
|
|
41
|
+
setTag: () => import_react_native.setTag,
|
|
42
|
+
setUser: () => import_react_native.setUser,
|
|
43
|
+
wrap: () => import_react_native.wrap
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(index_exports);
|
|
46
|
+
var Sentry = __toESM(require("@sentry/react-native"), 1);
|
|
47
|
+
var import_react_native = require("@sentry/react-native");
|
|
48
|
+
var DEFAULT_ENDPOINT = "https://in.blipit.io";
|
|
49
|
+
function dsn(key, project, endpoint = DEFAULT_ENDPOINT) {
|
|
50
|
+
const host = endpoint.split("://").pop().replace(/\/+$/, "");
|
|
51
|
+
const scheme = endpoint.startsWith("http://") ? "http" : "https";
|
|
52
|
+
return `${scheme}://${key}@${host}/${project}`;
|
|
53
|
+
}
|
|
54
|
+
function init2(options) {
|
|
55
|
+
const { key, publicKey, project, endpoint, ...rest } = options;
|
|
56
|
+
const k = key ?? publicKey;
|
|
57
|
+
if (!k) throw new Error("Blipit.init needs the project's public key");
|
|
58
|
+
if (project === void 0 || project === null || project === "") throw new Error("Blipit.init needs the project id");
|
|
59
|
+
Sentry.init({
|
|
60
|
+
dsn: dsn(k, project, endpoint),
|
|
61
|
+
sendDefaultPii: false,
|
|
62
|
+
tracesSampleRate: 0,
|
|
63
|
+
...rest
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function captureSecurity(kind, actor, details = {}) {
|
|
67
|
+
const context = { kind, actor };
|
|
68
|
+
const extra = { outcome: details.outcome, actor_id: details.actorId, ip: details.ip, user_agent: details.userAgent, target: details.target };
|
|
69
|
+
for (const [k, v] of Object.entries(extra)) {
|
|
70
|
+
if (v !== void 0 && v !== null) context[k] = v;
|
|
71
|
+
}
|
|
72
|
+
const level = kind === "login_failed" || kind === "login_blocked" ? "warning" : "info";
|
|
73
|
+
Sentry.withScope((scope) => {
|
|
74
|
+
scope.setContext("security", context);
|
|
75
|
+
scope.setTag("security.kind", kind);
|
|
76
|
+
Sentry.captureMessage(`${kind} for ${actor}`, level);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
DEFAULT_ENDPOINT,
|
|
82
|
+
addBreadcrumb,
|
|
83
|
+
captureException,
|
|
84
|
+
captureMessage,
|
|
85
|
+
captureSecurity,
|
|
86
|
+
dsn,
|
|
87
|
+
flush,
|
|
88
|
+
init,
|
|
89
|
+
setTag,
|
|
90
|
+
setUser,
|
|
91
|
+
wrap
|
|
92
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNativeOptions } from '@sentry/react-native';
|
|
2
|
+
export { addBreadcrumb, captureException, captureMessage, flush, setTag, setUser, wrap } from '@sentry/react-native';
|
|
3
|
+
|
|
4
|
+
declare const DEFAULT_ENDPOINT = "https://in.blipit.io";
|
|
5
|
+
interface BlipitOptions extends Omit<ReactNativeOptions, "dsn"> {
|
|
6
|
+
key?: string;
|
|
7
|
+
publicKey?: string;
|
|
8
|
+
project: string | number;
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
}
|
|
11
|
+
interface SecurityDetails {
|
|
12
|
+
outcome?: string;
|
|
13
|
+
actorId?: string;
|
|
14
|
+
ip?: string;
|
|
15
|
+
userAgent?: string;
|
|
16
|
+
target?: string;
|
|
17
|
+
}
|
|
18
|
+
declare function dsn(key: string, project: string | number, endpoint?: string): string;
|
|
19
|
+
declare function init(options: BlipitOptions): void;
|
|
20
|
+
declare function captureSecurity(kind: string, actor: string, details?: SecurityDetails): void;
|
|
21
|
+
|
|
22
|
+
export { type BlipitOptions, DEFAULT_ENDPOINT, type SecurityDetails, captureSecurity, dsn, init };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNativeOptions } from '@sentry/react-native';
|
|
2
|
+
export { addBreadcrumb, captureException, captureMessage, flush, setTag, setUser, wrap } from '@sentry/react-native';
|
|
3
|
+
|
|
4
|
+
declare const DEFAULT_ENDPOINT = "https://in.blipit.io";
|
|
5
|
+
interface BlipitOptions extends Omit<ReactNativeOptions, "dsn"> {
|
|
6
|
+
key?: string;
|
|
7
|
+
publicKey?: string;
|
|
8
|
+
project: string | number;
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
}
|
|
11
|
+
interface SecurityDetails {
|
|
12
|
+
outcome?: string;
|
|
13
|
+
actorId?: string;
|
|
14
|
+
ip?: string;
|
|
15
|
+
userAgent?: string;
|
|
16
|
+
target?: string;
|
|
17
|
+
}
|
|
18
|
+
declare function dsn(key: string, project: string | number, endpoint?: string): string;
|
|
19
|
+
declare function init(options: BlipitOptions): void;
|
|
20
|
+
declare function captureSecurity(kind: string, actor: string, details?: SecurityDetails): void;
|
|
21
|
+
|
|
22
|
+
export { type BlipitOptions, DEFAULT_ENDPOINT, type SecurityDetails, captureSecurity, dsn, init };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import * as Sentry from "@sentry/react-native";
|
|
3
|
+
import { captureException, captureMessage as captureMessage2, setUser, setTag, addBreadcrumb, flush, wrap } from "@sentry/react-native";
|
|
4
|
+
var DEFAULT_ENDPOINT = "https://in.blipit.io";
|
|
5
|
+
function dsn(key, project, endpoint = DEFAULT_ENDPOINT) {
|
|
6
|
+
const host = endpoint.split("://").pop().replace(/\/+$/, "");
|
|
7
|
+
const scheme = endpoint.startsWith("http://") ? "http" : "https";
|
|
8
|
+
return `${scheme}://${key}@${host}/${project}`;
|
|
9
|
+
}
|
|
10
|
+
function init2(options) {
|
|
11
|
+
const { key, publicKey, project, endpoint, ...rest } = options;
|
|
12
|
+
const k = key ?? publicKey;
|
|
13
|
+
if (!k) throw new Error("Blipit.init needs the project's public key");
|
|
14
|
+
if (project === void 0 || project === null || project === "") throw new Error("Blipit.init needs the project id");
|
|
15
|
+
Sentry.init({
|
|
16
|
+
dsn: dsn(k, project, endpoint),
|
|
17
|
+
sendDefaultPii: false,
|
|
18
|
+
tracesSampleRate: 0,
|
|
19
|
+
...rest
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function captureSecurity(kind, actor, details = {}) {
|
|
23
|
+
const context = { kind, actor };
|
|
24
|
+
const extra = { outcome: details.outcome, actor_id: details.actorId, ip: details.ip, user_agent: details.userAgent, target: details.target };
|
|
25
|
+
for (const [k, v] of Object.entries(extra)) {
|
|
26
|
+
if (v !== void 0 && v !== null) context[k] = v;
|
|
27
|
+
}
|
|
28
|
+
const level = kind === "login_failed" || kind === "login_blocked" ? "warning" : "info";
|
|
29
|
+
Sentry.withScope((scope) => {
|
|
30
|
+
scope.setContext("security", context);
|
|
31
|
+
scope.setTag("security.kind", kind);
|
|
32
|
+
Sentry.captureMessage(`${kind} for ${actor}`, level);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
DEFAULT_ENDPOINT,
|
|
37
|
+
addBreadcrumb,
|
|
38
|
+
captureException,
|
|
39
|
+
captureMessage2 as captureMessage,
|
|
40
|
+
captureSecurity,
|
|
41
|
+
dsn,
|
|
42
|
+
flush,
|
|
43
|
+
init2 as init,
|
|
44
|
+
setTag,
|
|
45
|
+
setUser,
|
|
46
|
+
wrap
|
|
47
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blipit/react-native",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Blipit error monitoring for React Native and Expo. Know your app broke before your users tell you.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.cjs",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
23
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
24
|
+
"test": "node --experimental-strip-types --experimental-test-module-mocks --test test/init.test.ts"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@sentry/react-native": ">=6"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@sentry/react-native": "^8.28.0",
|
|
31
|
+
"@types/node": "^22.0.0",
|
|
32
|
+
"@types/react": "^19.0.0",
|
|
33
|
+
"react": "^19.0.0",
|
|
34
|
+
"react-native": "^0.81.0",
|
|
35
|
+
"tsup": "^8.3.0",
|
|
36
|
+
"typescript": "^5.7.0"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/blipit-io/blipit.git",
|
|
44
|
+
"directory": "packages/sdk-react-native"
|
|
45
|
+
},
|
|
46
|
+
"homepage": "https://docs.blipit.io/mobile",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"email": "support@blipit.io"
|
|
49
|
+
},
|
|
50
|
+
"author": "Louward Labs <support@blipit.io>",
|
|
51
|
+
"keywords": [
|
|
52
|
+
"react-native",
|
|
53
|
+
"expo",
|
|
54
|
+
"error-monitoring",
|
|
55
|
+
"blipit"
|
|
56
|
+
]
|
|
57
|
+
}
|