bugstack-sdk 2.2.2 → 2.4.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/CHANGELOG.md +57 -0
- package/README.md +117 -2
- package/dist/adapters/express/index.d.mts +2 -2
- package/dist/adapters/express/index.d.ts +2 -2
- package/dist/adapters/express/index.js +408 -42
- package/dist/adapters/express/index.js.map +1 -1
- package/dist/adapters/express/index.mjs +408 -42
- package/dist/adapters/express/index.mjs.map +1 -1
- package/dist/adapters/generic/index.d.mts +2 -2
- package/dist/adapters/generic/index.d.ts +2 -2
- package/dist/adapters/generic/index.js +456 -42
- package/dist/adapters/generic/index.js.map +1 -1
- package/dist/adapters/generic/index.mjs +453 -43
- package/dist/adapters/generic/index.mjs.map +1 -1
- package/dist/adapters/nextjs/index.d.mts +2 -2
- package/dist/adapters/nextjs/index.d.ts +2 -2
- package/dist/adapters/nextjs/index.js +408 -42
- package/dist/adapters/nextjs/index.js.map +1 -1
- package/dist/adapters/nextjs/index.mjs +408 -42
- package/dist/adapters/nextjs/index.mjs.map +1 -1
- package/dist/browser/index.d.mts +131 -0
- package/dist/browser/index.d.ts +131 -0
- package/dist/browser/index.js +992 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/index.mjs +984 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/{client-DK_ItP55.d.mts → client-B9WaTEYj.d.mts} +148 -1
- package/dist/{client-DK_ItP55.d.ts → client-B9WaTEYj.d.ts} +148 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +468 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +465 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -7
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
type ElementRef = {
|
|
2
|
+
selector: string;
|
|
3
|
+
label?: string;
|
|
4
|
+
};
|
|
5
|
+
type SessionEvent = {
|
|
6
|
+
kind: "navigation";
|
|
7
|
+
at: string;
|
|
8
|
+
route: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "error";
|
|
11
|
+
at: string;
|
|
12
|
+
route: string;
|
|
13
|
+
error: {
|
|
14
|
+
name: string;
|
|
15
|
+
message: string;
|
|
16
|
+
stack?: string;
|
|
17
|
+
};
|
|
18
|
+
} | {
|
|
19
|
+
kind: "failed_request";
|
|
20
|
+
at: string;
|
|
21
|
+
route: string;
|
|
22
|
+
request: {
|
|
23
|
+
method: string;
|
|
24
|
+
path: string;
|
|
25
|
+
status: number | null;
|
|
26
|
+
durationMs: number;
|
|
27
|
+
};
|
|
28
|
+
} | {
|
|
29
|
+
kind: "rage_click";
|
|
30
|
+
at: string;
|
|
31
|
+
route: string;
|
|
32
|
+
element: ElementRef;
|
|
33
|
+
clicks: number;
|
|
34
|
+
} | {
|
|
35
|
+
kind: "dead_click";
|
|
36
|
+
at: string;
|
|
37
|
+
route: string;
|
|
38
|
+
element: ElementRef;
|
|
39
|
+
/** Set when the click DID navigate, to a page that says it does not exist. */
|
|
40
|
+
reason?: "not_found";
|
|
41
|
+
/** For `not_found`: where the link went (path only). */
|
|
42
|
+
to?: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: "error_click";
|
|
45
|
+
at: string;
|
|
46
|
+
route: string;
|
|
47
|
+
element: ElementRef;
|
|
48
|
+
/** The error's class and a short message; the full error is its own `error` event. */
|
|
49
|
+
error: {
|
|
50
|
+
name: string;
|
|
51
|
+
message: string;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
kind: "form_abandon";
|
|
55
|
+
at: string;
|
|
56
|
+
route: string;
|
|
57
|
+
/** The form: its selector, labelled by its submit control. */
|
|
58
|
+
element: ElementRef;
|
|
59
|
+
/** Fields that showed a validation error: selector and label, never a value. */
|
|
60
|
+
fields: ElementRef[];
|
|
61
|
+
/** Submits that hit a validation error. */
|
|
62
|
+
attempts: number;
|
|
63
|
+
} | {
|
|
64
|
+
kind: "thrash";
|
|
65
|
+
at: string;
|
|
66
|
+
route: string;
|
|
67
|
+
routes: [string, string];
|
|
68
|
+
switches: number;
|
|
69
|
+
};
|
|
70
|
+
type SessionUser = {
|
|
71
|
+
id?: string;
|
|
72
|
+
email?: string;
|
|
73
|
+
};
|
|
74
|
+
type SessionBatch = {
|
|
75
|
+
v: 1;
|
|
76
|
+
sessionId: string;
|
|
77
|
+
user?: SessionUser;
|
|
78
|
+
release?: string;
|
|
79
|
+
environment?: string;
|
|
80
|
+
events: SessionEvent[];
|
|
81
|
+
};
|
|
82
|
+
type BrowserConfig = {
|
|
83
|
+
/** The repository's BROWSER key (public; never the server SDK key). */
|
|
84
|
+
key: string;
|
|
85
|
+
/** Defaults to https://dashboard.bugstack.ai/api/v1/sessions/ingest. */
|
|
86
|
+
endpoint?: string;
|
|
87
|
+
/** The release the page is running, e.g. "web@1.4.2". */
|
|
88
|
+
release?: string;
|
|
89
|
+
environment?: string;
|
|
90
|
+
/** Share of browser sessions recorded, 0..1. Default 1. Decided once per session. */
|
|
91
|
+
sampleRate?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Frustration signals: rage clicks, dead clicks, clicks followed by an
|
|
94
|
+
* error, forms left after a validation error, and rapid back-and-forth
|
|
95
|
+
* between two pages. OFF unless set. `true`, or an object to tune it.
|
|
96
|
+
* Never records an input's value or any text beyond a short element label.
|
|
97
|
+
*/
|
|
98
|
+
frustration?: boolean | FrustrationConfig;
|
|
99
|
+
};
|
|
100
|
+
type FrustrationConfig = {
|
|
101
|
+
/** Default true when the object is given. */
|
|
102
|
+
enabled?: boolean;
|
|
103
|
+
/** Share of RECORDED sessions that also record frustration, 0..1. Default 1. Decided once per session. */
|
|
104
|
+
sampleRate?: number;
|
|
105
|
+
/** The most frustration events one page view sends. Default 20. */
|
|
106
|
+
maxPerPage?: number;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
declare const DEFAULT_ENDPOINT = "https://dashboard.bugstack.ai/api/v1/sessions/ingest";
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Start recording this browser session. Call once, as early as you can. A
|
|
113
|
+
* second call is ignored; close() first to start over.
|
|
114
|
+
*/
|
|
115
|
+
declare function init(config: BrowserConfig): void;
|
|
116
|
+
/**
|
|
117
|
+
* Who this session belongs to. bugstack stores only a salted hash of it, which
|
|
118
|
+
* is how a support ticket from the same person finds what they saw. Pass null
|
|
119
|
+
* on sign-out.
|
|
120
|
+
*/
|
|
121
|
+
declare function setUser(user: SessionUser | null): void;
|
|
122
|
+
/** Report an error you caught yourself. */
|
|
123
|
+
declare function captureError(err: unknown): void;
|
|
124
|
+
/** Send what is queued now. Resolves when the send settles; never rejects. */
|
|
125
|
+
declare function flush(): Promise<void>;
|
|
126
|
+
/** Stop recording: send what is queued, remove every listener and wrapper. */
|
|
127
|
+
declare function close(): void;
|
|
128
|
+
/** The current session id, or null when not recording. */
|
|
129
|
+
declare function getSessionId(): string | null;
|
|
130
|
+
|
|
131
|
+
export { type BrowserConfig, DEFAULT_ENDPOINT, type ElementRef, type FrustrationConfig, type SessionBatch, type SessionEvent, type SessionUser, captureError, close, flush, getSessionId, init, setUser };
|