@squasher-ai/browser 0.1.0 → 0.1.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/README.md +41 -2
- package/package.json +2 -10
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @squasher-ai/browser
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Browser SDK for Squasher.
|
|
4
|
+
|
|
5
|
+
Capture frontend errors, Core Web Vitals, automatic breadcrumbs, analytics-style events, and optional session replay from a browser app.
|
|
4
6
|
|
|
5
7
|
## Install
|
|
6
8
|
|
|
@@ -8,5 +10,42 @@ Official @squasher-ai/browser package for Squasher.
|
|
|
8
10
|
npm install @squasher-ai/browser
|
|
9
11
|
```
|
|
10
12
|
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { init } from "@squasher-ai/browser";
|
|
17
|
+
|
|
18
|
+
init({
|
|
19
|
+
apiKey: process.env.NEXT_PUBLIC_SQUASHER_API_KEY!,
|
|
20
|
+
projectId: process.env.NEXT_PUBLIC_SQUASHER_PROJECT_ID!,
|
|
21
|
+
environment: process.env.NODE_ENV,
|
|
22
|
+
replay: {
|
|
23
|
+
enabled: true,
|
|
24
|
+
sampleRate: 0.1,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## React Error Boundary
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { SquasherErrorBoundary } from "@squasher-ai/browser/react";
|
|
33
|
+
|
|
34
|
+
<SquasherErrorBoundary fallback={<div>Something went wrong.</div>}>
|
|
35
|
+
<App />
|
|
36
|
+
</SquasherErrorBoundary>;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Manual Capture
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { captureError, captureMessage, page, track } from "@squasher-ai/browser";
|
|
43
|
+
|
|
44
|
+
track("checkout_started", { step: 1 });
|
|
45
|
+
page("Checkout");
|
|
46
|
+
captureMessage("Frontend boot complete", "info");
|
|
47
|
+
captureError(new Error("Checkout failed"), { cartId: "cart_123" });
|
|
48
|
+
```
|
|
49
|
+
|
|
11
50
|
Docs: https://docs.squasher.ai
|
|
12
|
-
Homepage: https://squasher.ai
|
|
51
|
+
Homepage: https://squasher.ai
|
package/package.json
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squasher-ai/browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Official @squasher-ai/browser package for Squasher.",
|
|
5
|
-
"homepage": "https://squasher.ai",
|
|
5
|
+
"homepage": "https://docs.squasher.ai",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/squasher-ai/squasher.git",
|
|
10
|
-
"directory": "packages/sdk-browser"
|
|
11
|
-
},
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/squasher-ai/squasher/issues"
|
|
14
|
-
},
|
|
15
7
|
"publishConfig": {
|
|
16
8
|
"access": "public"
|
|
17
9
|
},
|