@scalebun-release/sdk-contracts 2.0.3
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/LICENSE +21 -0
- package/dist/bridge.d.ts +28 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +9 -0
- package/dist/bridge.js.map +1 -0
- package/dist/config.d.ts +412 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +8 -0
- package/dist/config.js.map +1 -0
- package/dist/events.d.ts +33 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +8 -0
- package/dist/events.js.map +1 -0
- package/dist/features.d.ts +205 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +8 -0
- package/dist/features.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/platform.d.ts +22 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +8 -0
- package/dist/platform.js.map +1 -0
- package/dist/session-boundary.d.ts +35 -0
- package/dist/session-boundary.d.ts.map +1 -0
- package/dist/session-boundary.js +26 -0
- package/dist/session-boundary.js.map +1 -0
- package/dist/session.d.ts +52 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +8 -0
- package/dist/session.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ScaleBun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/bridge.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Debug Bridge Types (optional)
|
|
3
|
+
*
|
|
4
|
+
* Pure types for the optional dev/desktop-debugger bridge (parity with the RN SDK's debug bridge).
|
|
5
|
+
* Not part of the ingestion protocol — that lives in @scalebun/protocol. Kept minimal for now;
|
|
6
|
+
* the web debug transport is not implemented yet.
|
|
7
|
+
*/
|
|
8
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
9
|
+
export interface BaseMessage {
|
|
10
|
+
type: string;
|
|
11
|
+
ts: number;
|
|
12
|
+
}
|
|
13
|
+
export interface HelloMessage extends BaseMessage {
|
|
14
|
+
type: 'hello';
|
|
15
|
+
sdk: {
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
};
|
|
19
|
+
sessionId: string;
|
|
20
|
+
}
|
|
21
|
+
export interface PingMessage extends BaseMessage {
|
|
22
|
+
type: 'ping';
|
|
23
|
+
}
|
|
24
|
+
export interface PongMessage extends BaseMessage {
|
|
25
|
+
type: 'pong';
|
|
26
|
+
}
|
|
27
|
+
export type DebugMessage = HelloMessage | PingMessage | PongMessage;
|
|
28
|
+
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,CAAC"}
|
package/dist/bridge.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Debug Bridge Types (optional)
|
|
3
|
+
*
|
|
4
|
+
* Pure types for the optional dev/desktop-debugger bridge (parity with the RN SDK's debug bridge).
|
|
5
|
+
* Not part of the ingestion protocol — that lives in @scalebun/protocol. Kept minimal for now;
|
|
6
|
+
* the web debug transport is not implemented yet.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Config Types
|
|
3
|
+
*
|
|
4
|
+
* Pure type definitions for the public init config. Runtime defaults/validation live in
|
|
5
|
+
* @scalebun/web (core/config). Mirrors the RN SDK's config contract, adapted for the browser.
|
|
6
|
+
*/
|
|
7
|
+
import type { ErrorItem, Breadcrumb, NetworkItem } from '@scalebun/protocol';
|
|
8
|
+
/** The features that can be toggled (all default ON except replay, which is lazy/opt-in). */
|
|
9
|
+
export interface ScaleBunFeatures {
|
|
10
|
+
errors?: boolean;
|
|
11
|
+
network?: boolean;
|
|
12
|
+
console?: boolean;
|
|
13
|
+
webVitals?: boolean;
|
|
14
|
+
performance?: boolean;
|
|
15
|
+
journey?: boolean;
|
|
16
|
+
replay?: boolean;
|
|
17
|
+
bugReport?: boolean;
|
|
18
|
+
/** Web crash detection (ReportingObserver + session-liveness recovery). Default on. */
|
|
19
|
+
crash?: boolean;
|
|
20
|
+
/** Config & flags (feature flags / remote config / rollouts / experiments). Default on. */
|
|
21
|
+
config?: boolean;
|
|
22
|
+
/** Engage — surveys / NPS (in-app prompts, friction-triggered). Default on. */
|
|
23
|
+
engage?: boolean;
|
|
24
|
+
/** Product-analytics + revenue lane (track/trackPurchase → /batch Event). Default on. */
|
|
25
|
+
analytics?: boolean;
|
|
26
|
+
/** Web RUM — page-load (Navigation Timing) + FPS (rAF) + LoAF. Default on. */
|
|
27
|
+
webPerf?: boolean;
|
|
28
|
+
/** JS Self-Profiling flame graphs. Default OFF (CPU cost + needs Document-Policy: js-profiling). */
|
|
29
|
+
profiler?: boolean;
|
|
30
|
+
/** W5.2 — Resource Watchdog (continuous resource sampling + local incident detection). Default OFF. */
|
|
31
|
+
watchdog?: boolean;
|
|
32
|
+
/** Persistent Message Inbox / Notification Center (offline-first, delta-synced). Default OFF (until GA). */
|
|
33
|
+
inbox?: boolean;
|
|
34
|
+
/** IAM 2.0 in-app engine (schema-driven surfaces). Default false (opt-in). */
|
|
35
|
+
inapp2?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** Privacy controls. Mask-all-by-default is non-negotiable; these only narrow it. */
|
|
38
|
+
export interface PrivacyConfig {
|
|
39
|
+
/** Capture network request/response bodies (redacted). Default false (denylist-by-default). */
|
|
40
|
+
captureNetworkBodies?: boolean;
|
|
41
|
+
/** Header/body keys always stripped before send. */
|
|
42
|
+
denylist?: string[];
|
|
43
|
+
/** CSS selectors whose text/inputs are masked (in addition to mask-all defaults). */
|
|
44
|
+
maskSelectors?: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Mask ALL static text in session replay (default **false** — text is captured so replays are
|
|
47
|
+
* readable). Set true to mask every text node. Form input VALUES have their OWN flag (`maskInputs`).
|
|
48
|
+
*/
|
|
49
|
+
maskReplayText?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Mask form input VALUES in session replay. Default **true**, and **independent of
|
|
52
|
+
* `maskReplayText`** — typed input is the real PII exposure, so it stays masked even when static
|
|
53
|
+
* text is shown (the default). Password fields are ALWAYS blanked regardless of this flag.
|
|
54
|
+
*
|
|
55
|
+
* ⚠️ Setting this false captures real user input — only do this for internal/dev apps with no PII.
|
|
56
|
+
* For apps handling personal data (e.g. healthcare), keep it on.
|
|
57
|
+
*/
|
|
58
|
+
maskInputs?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Honor the user's **Global Privacy Control** / **Do-Not-Track** signal (default **false**). When
|
|
61
|
+
* true and the browser signals opt-out (`navigator.globalPrivacyControl` / `navigator.doNotTrack`),
|
|
62
|
+
* session replay does not record for that user. Recommended where GPC compliance (e.g. CCPA) matters.
|
|
63
|
+
*/
|
|
64
|
+
respectDnt?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Mask the TEXT LABEL on captured interaction events (default **false** — the real label is sent).
|
|
67
|
+
*
|
|
68
|
+
* Applies to two places, and only these two:
|
|
69
|
+
* - `USER_ACTION.label` on the session lane (`button: Buy now`)
|
|
70
|
+
* - `props.text` on `$autocapture` in the analytics lane
|
|
71
|
+
*
|
|
72
|
+
* This used to be unconditional, and it is why the Events explorer showed rows like `button: *** ***`:
|
|
73
|
+
* every non-whitespace character was replaced with `*`, which preserved the shape of the text and
|
|
74
|
+
* destroyed the only value that made one click distinguishable from another. Two different buttons
|
|
75
|
+
* with same-length text collapsed into ONE row, so per-element click analytics were not possible.
|
|
76
|
+
*
|
|
77
|
+
* The default matches `maskReplayText`, which has always been false — the SDK already captures visible
|
|
78
|
+
* replay text, so hard-masking the label of the very click that replay shows was inconsistent.
|
|
79
|
+
*
|
|
80
|
+
* ⚠️ With this off (the default) the element's visible text is captured. On a page whose button or
|
|
81
|
+
* link text contains personal data ("Delete account for ada@example.com"), turn it on, or exclude the
|
|
82
|
+
* subtree with `data-scalebun-no-capture`, or list it in `maskSelectors`. Input VALUES are never
|
|
83
|
+
* captured by either path regardless of this flag.
|
|
84
|
+
*/
|
|
85
|
+
maskEventText?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Engage options. Currently just the gamified-outcome resolver.
|
|
89
|
+
*
|
|
90
|
+
* The handler is typed loosely HERE and precisely at the call site (`features/engage/gameTypes`).
|
|
91
|
+
* Contracts is imported by every entry point, and pulling the eight-variant discriminated union in
|
|
92
|
+
* would put ~0 runtime bytes but a real maintenance edge in core's dependency graph — the request
|
|
93
|
+
* and result shapes belong with the code that builds and validates them. Hosts get full types by
|
|
94
|
+
* importing `InAppGameRequestHandler` from the SDK.
|
|
95
|
+
*/
|
|
96
|
+
export interface EngageOptions {
|
|
97
|
+
onInAppGameRequest?: (request: unknown) => Promise<unknown>;
|
|
98
|
+
}
|
|
99
|
+
/** Where the floating bug-report launcher sits. */
|
|
100
|
+
export type BugReportPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
101
|
+
/** Embeddable bug-report widget options. */
|
|
102
|
+
export interface BugReportOptions {
|
|
103
|
+
/** Mount a floating launcher button. Default false (use ScaleBun.reportBug(...) programmatically). */
|
|
104
|
+
launcher?: boolean;
|
|
105
|
+
/** Launcher corner. Default 'bottom-right'. */
|
|
106
|
+
position?: BugReportPosition;
|
|
107
|
+
/** Launcher button label. Default 'Report a bug'. */
|
|
108
|
+
label?: string;
|
|
109
|
+
}
|
|
110
|
+
/** End-user identity attached to the session. */
|
|
111
|
+
export interface ScaleBunUser {
|
|
112
|
+
id?: string;
|
|
113
|
+
email?: string;
|
|
114
|
+
name?: string;
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
}
|
|
117
|
+
/** Session-replay capture mode. See `ScaleBunInitConfig.replay`. */
|
|
118
|
+
export type ReplayMode = 'off' | 'onError' | 'sampled' | 'always';
|
|
119
|
+
/** Public init config consumers pass to ScaleBun.init(). */
|
|
120
|
+
export interface ScaleBunInitConfig {
|
|
121
|
+
/** SaaS SDK key — sent as `x-scalebun-client-key`. */
|
|
122
|
+
clientKey: string;
|
|
123
|
+
/**
|
|
124
|
+
* Backend base URL, e.g. https://api.scalebun.com/api/v1. Optional — defaults
|
|
125
|
+
* to the ScaleBun cloud. Override only for staging or a self-hosted backend.
|
|
126
|
+
*/
|
|
127
|
+
apiBaseUrl?: string;
|
|
128
|
+
environment?: string;
|
|
129
|
+
release?: string;
|
|
130
|
+
appVersion?: string;
|
|
131
|
+
/** Content-Security-Policy options. `nonce` is applied to every <style>/<script> the SDK injects, so
|
|
132
|
+
* strict-CSP sites (style-src/script-src without 'unsafe-inline') work. Optional — absent = today's
|
|
133
|
+
* behavior. On a <script>-tag install the SDK also auto-detects the nonce from its own tag. */
|
|
134
|
+
csp?: {
|
|
135
|
+
nonce?: string;
|
|
136
|
+
};
|
|
137
|
+
flushIntervalMs?: number;
|
|
138
|
+
/**
|
|
139
|
+
* Inactivity after which the next page load starts a NEW session (default 30 min).
|
|
140
|
+
*
|
|
141
|
+
* A session is persisted across document loads, so a refresh or a second tab CONTINUES the
|
|
142
|
+
* current session rather than starting another one; it ends only after this much idle time.
|
|
143
|
+
*/
|
|
144
|
+
sessionTimeoutMs?: number;
|
|
145
|
+
/** Absolute cap on one session (default 24 h), so a permanently-open tab cannot report an
|
|
146
|
+
* endless session. */
|
|
147
|
+
sessionMaxDurationMs?: number;
|
|
148
|
+
maxBatchSize?: number;
|
|
149
|
+
maxQueueSize?: number;
|
|
150
|
+
/**
|
|
151
|
+
* Session-replay sampling. Deterministic per-session decision (the SDK buckets the sessionId with
|
|
152
|
+
* the same fnv1a as flags/experiments, so the backend can re-derive it — no client trust).
|
|
153
|
+
* - 'sampled' (DEFAULT): record the FULL session from the first frame for `sampleRate` of sessions
|
|
154
|
+
* (default 1 = every session, like the mobile SDK). Dial `sampleRate` down to control volume.
|
|
155
|
+
* - 'onError': record into a rolling pre-roll buffer, flush it only when an error/rage/report
|
|
156
|
+
* signal fires (cost-saver — ships only sessions that hit a problem). `onErrorSampleRate` gates it.
|
|
157
|
+
* - 'always': record every session from start, ignoring `sampleRate`. 'off': never record.
|
|
158
|
+
* A session that isn't sampled installs NOTHING (zero overhead).
|
|
159
|
+
*/
|
|
160
|
+
replay?: {
|
|
161
|
+
mode?: ReplayMode;
|
|
162
|
+
sampleRate?: number;
|
|
163
|
+
onErrorSampleRate?: number;
|
|
164
|
+
/** Opt-in: mirror the pre-roll buffer to IndexedDB so a tab-killing crash still yields it on the
|
|
165
|
+
* next load (an error-free clean close discards it). Default false. */
|
|
166
|
+
persistBuffer?: boolean;
|
|
167
|
+
/** 'strict' adds heuristic PII redaction (emails / card numbers / SSNs) to captured text — useful
|
|
168
|
+
* when replay text is UNMASKED (privacy.maskReplayText:false). Default 'standard'. */
|
|
169
|
+
privacyLevel?: 'standard' | 'strict';
|
|
170
|
+
};
|
|
171
|
+
/** Opt-in: capture <canvas> pixels in replay (off by default — pixels can't be masked). */
|
|
172
|
+
replayCanvas?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Upload a DOM replay frame’s payload straight to object storage instead of inline in the
|
|
175
|
+
* batch envelope. Off by default. Against a backend without the matching presign support the
|
|
176
|
+
* SDK is told storage is disabled and every frame goes inline, so enabling it early is inert
|
|
177
|
+
* rather than harmful.
|
|
178
|
+
*/
|
|
179
|
+
replayDirectUpload?: boolean;
|
|
180
|
+
/** Opt-in: HMAC-sign session/replay batches too (the analytics lane always signs). Off by default —
|
|
181
|
+
* signing multi-MB replay uploads re-enables server-side rawBody double-buffering. */
|
|
182
|
+
signSessionLane?: boolean;
|
|
183
|
+
/** Cross-origin replay stitching (F-IFR P2): origins the parent bridges + a child trusts. Both the
|
|
184
|
+
* parent page and the cross-origin child must run the SDK with each other's origin listed. e.g.
|
|
185
|
+
* parent lists ['https://embed.example.com'], child lists ['https://app.example.com']. Default []. */
|
|
186
|
+
replayFrameOrigins?: string[];
|
|
187
|
+
/** Autocapture DOM interactions as analytics events (on by default; text masked). Set false to opt out. */
|
|
188
|
+
autocapture?: boolean;
|
|
189
|
+
/** Inject a W3C `traceparent` into outbound requests for FE→BE trace correlation. Default true
|
|
190
|
+
* (same-origin only — safe). Set false to disable entirely. */
|
|
191
|
+
tracePropagation?: boolean;
|
|
192
|
+
/** Cross-origin origins to ALSO propagate the traceparent to (the server must CORS-allow the
|
|
193
|
+
* `traceparent` header). e.g. ['https://api.example.com']. Default []. */
|
|
194
|
+
tracePropagationOrigins?: string[];
|
|
195
|
+
/** Error capture tuning (F-ERR). All optional — defaults need no config. */
|
|
196
|
+
errors?: {
|
|
197
|
+
/** Drop errors whose MESSAGE matches (substring or RegExp). Merged with built-in benign noise
|
|
198
|
+
* (e.g. "ResizeObserver loop…") — your list is appended, never replaces the defaults. */
|
|
199
|
+
ignoreErrors?: (string | RegExp)[];
|
|
200
|
+
/** Drop errors whose originating script URL matches (substring or RegExp) — silence noisy
|
|
201
|
+
* third-party scripts (chrome-extension://, ad/analytics vendors, …). */
|
|
202
|
+
denyUrls?: (string | RegExp)[];
|
|
203
|
+
/** Capture failed resource loads (img/script/link/css) as 'resource' errors instead of dropping
|
|
204
|
+
* them. Default false — they're usually noise, and never JS crashes. */
|
|
205
|
+
captureResourceErrors?: boolean;
|
|
206
|
+
/** Max breadcrumbs retained in the ring + attached to each error (the trail of console/network/
|
|
207
|
+
* navigation/click events leading up to it). Default 50, max 200. */
|
|
208
|
+
maxBreadcrumbs?: number;
|
|
209
|
+
/** Cost lever for very-high-volume apps: fraction of SESSIONS (0–1) whose AUTO errors are captured
|
|
210
|
+
* (deterministic per-session; manual captureError always fires). Default 1 = every session.
|
|
211
|
+
* Prefer grouping / ignoreErrors / beforeSend first — sampling trades error completeness for cost. */
|
|
212
|
+
sampleRate?: number;
|
|
213
|
+
/** Last-mile hook: inspect/transform each error item before it's sent, or return null to DROP it
|
|
214
|
+
* (e.g. scrub fields, drop by URL/tag). Throwing is safe — the original is kept. */
|
|
215
|
+
beforeSend?: (item: ErrorItem) => ErrorItem | null;
|
|
216
|
+
/** Hook: inspect/transform each breadcrumb before it enters the ring, or return null to drop it. */
|
|
217
|
+
beforeBreadcrumb?: (crumb: Breadcrumb) => Breadcrumb | null;
|
|
218
|
+
};
|
|
219
|
+
/** Network capture tuning (F-NET). All optional — defaults need no config. */
|
|
220
|
+
network?: {
|
|
221
|
+
/** Track WebSocket connection lifecycle + message/byte counters. Default true (lazy chunk). */
|
|
222
|
+
trackWebSocket?: boolean;
|
|
223
|
+
/** Track Server-Sent-Events (EventSource) lifecycle. Default true (lazy chunk). */
|
|
224
|
+
trackSse?: boolean;
|
|
225
|
+
/** Opt-in: capture request/response bodies + headers (redacted + capped). Default false (privacy). */
|
|
226
|
+
captureBodies?: boolean;
|
|
227
|
+
/** Hard cap on captured body bytes when captureBodies is on. Default 8192, ceiling-enforced. */
|
|
228
|
+
bodyMaxBytes?: number;
|
|
229
|
+
/** Content-types eligible for body capture. Default ['application/json','text/plain']. */
|
|
230
|
+
contentTypeAllowlist?: string[];
|
|
231
|
+
/** Base sample rate (0–1) for SUCCESSFUL requests — failed/slow are ALWAYS kept. Default 1. */
|
|
232
|
+
sampleRate?: number;
|
|
233
|
+
/** "slow" threshold in ms — requests at/over this are flagged + always kept. Default 2000. */
|
|
234
|
+
slowRequestMs?: number;
|
|
235
|
+
/** Never capture requests whose URL matches (substring or RegExp). */
|
|
236
|
+
denyUrls?: (string | RegExp)[];
|
|
237
|
+
/**
|
|
238
|
+
* Keep known telemetry beacons: analytics collectors, ad pixels, IP-enrichment calls.
|
|
239
|
+
*
|
|
240
|
+
* Default false -- they are dropped before they ever leave the browser. They are not the app,
|
|
241
|
+
* they cost the visitor upload bandwidth, and a beacon blocked by an ad blocker is a transport
|
|
242
|
+
* failure that used to count against the SESSION HEALTH score. Matching is by hostname only,
|
|
243
|
+
* never by path, so your own /collect route is never touched.
|
|
244
|
+
*/
|
|
245
|
+
captureThirdParty?: boolean;
|
|
246
|
+
/** Replace the built-in beacon host list wholesale. Comma-joined hostname suffixes. */
|
|
247
|
+
thirdPartyHosts?: string;
|
|
248
|
+
/** Last-mile hook: transform the network item, or return null to DROP it. Throwing is safe. */
|
|
249
|
+
beforeSend?: (item: NetworkItem) => NetworkItem | null;
|
|
250
|
+
};
|
|
251
|
+
/** Performance / RUM tuning (transactions, spans). All optional — defaults need no config. */
|
|
252
|
+
performance?: {
|
|
253
|
+
/** Base sample rate (0–1) for transactions. SLOW/errored transactions are ALWAYS kept regardless;
|
|
254
|
+
* this only thins the fast, clean ones. Deterministic per-transaction (re-derivable from traceId).
|
|
255
|
+
* Default 1 = keep every transaction. */
|
|
256
|
+
tracesSampleRate?: number;
|
|
257
|
+
/** Duration (ms) at/over which a transaction is "slow" → always kept (the adaptive bias). Default 3000. */
|
|
258
|
+
slowTransactionMs?: number;
|
|
259
|
+
};
|
|
260
|
+
/** W5.2 — Resource Watchdog tuning (continuous resource sampling → local incidents). All optional. */
|
|
261
|
+
watchdog?: {
|
|
262
|
+
/** Per-session deterministic keep rate (0–1). Default 1. */
|
|
263
|
+
sampleRate?: number;
|
|
264
|
+
/** Event-loop-lag heartbeat cadence (ms). Default 1000, floored at 250. */
|
|
265
|
+
heartbeatMs?: number;
|
|
266
|
+
/** Health-rollup window (ms) — one resource_health item per window. Default 30000. */
|
|
267
|
+
rollupMs?: number;
|
|
268
|
+
/** Heap sample cadence (ms). Default 20000. */
|
|
269
|
+
memorySampleMs?: number;
|
|
270
|
+
/** Incident-threshold overrides (see the WatchdogThresholds keys). */
|
|
271
|
+
thresholds?: Record<string, number>;
|
|
272
|
+
/** 5.3 — capture a JS Self-Profiling window on an incident (no-op until the header + phase land). Default true. */
|
|
273
|
+
captureProfileOnIncident?: boolean;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* #25 P2 — exit-intent scroll-reversal thresholds. All optional; omitted keys use REVERSAL_DEFAULTS.
|
|
277
|
+
*
|
|
278
|
+
* Host-tunable on purpose: every default is a guess until real `$exit_intent` distributions exist, and
|
|
279
|
+
* an SDK release is the slowest step in that loop. A site can retune from its own data without waiting
|
|
280
|
+
* for one. The event carries `velocity_px_ms` + `distance_px` so there is something to tune FROM.
|
|
281
|
+
*
|
|
282
|
+
* Note `minDistancePx` and `minVelocityPxMs` are not independent: at dt = windowMs the velocity floor
|
|
283
|
+
* binds and distance decides nothing. Raise them together.
|
|
284
|
+
*/
|
|
285
|
+
exitIntent?: {
|
|
286
|
+
/** How far back to measure upward velocity (ms). Default 120. */
|
|
287
|
+
windowMs?: number;
|
|
288
|
+
/** Minimum upward travel across the window (px) — filters micro-corrections. Default 80. */
|
|
289
|
+
minDistancePx?: number;
|
|
290
|
+
/** Minimum upward velocity (px/ms). Default 0.7 (≈700 px/s) — a flick, not a drift. */
|
|
291
|
+
minVelocityPxMs?: number;
|
|
292
|
+
/** Engagement floor: minimum max scroll depth reached (%). Default 25. */
|
|
293
|
+
minDepthPct?: number;
|
|
294
|
+
/** Consecutive qualifying samples required (hysteresis vs scroll jitter). Default 3. */
|
|
295
|
+
sustainSamples?: number;
|
|
296
|
+
/**
|
|
297
|
+
* Pointer-exit band: how close to the top edge (px) the pointer must be when it leaves the page.
|
|
298
|
+
* Default 40.
|
|
299
|
+
*
|
|
300
|
+
* Belongs to the OTHER trigger, not scroll reversal. `mouseout` reports the last SAMPLED pointer
|
|
301
|
+
* position, and a fast flick toward the tab bar covers tens of pixels between samples — so a narrow
|
|
302
|
+
* band misses exactly the deliberate gestures it exists to catch. Raise it if pointer exits are
|
|
303
|
+
* under-reported; the event carries `exit_y` so you can tune from the real distribution.
|
|
304
|
+
*/
|
|
305
|
+
topEdgePx?: number;
|
|
306
|
+
};
|
|
307
|
+
/** Product-analytics tuning. All optional — analytics works with none of this set. */
|
|
308
|
+
analytics?: {
|
|
309
|
+
/** A3 — optional typed tracking plan. Governs custom `track()` events (internal `$` events are
|
|
310
|
+
* never governed): warns on unknown events / missing-required / type-mismatch props, and — in
|
|
311
|
+
* `strict` mode — DROPS violations from both lanes. */
|
|
312
|
+
plan?: TrackingPlan;
|
|
313
|
+
/** A6 — analytics-lane sample rate (0–1, default 1 = keep all). Sampling is PER-USER + deterministic
|
|
314
|
+
* (a stable subset of anonymous ids is kept in full, so funnels/retention stay intact). Identity
|
|
315
|
+
* ($identify/$group/$alias) and revenue (purchase) events are NEVER thinned. */
|
|
316
|
+
sampleRate?: number;
|
|
317
|
+
/** A6 — set to share the anonymous id across sub-domains via a cookie (e.g. '.example.com'), so a
|
|
318
|
+
* user is one profile across app./www./shop. When unset, the id is localStorage-scoped per origin. */
|
|
319
|
+
cookieDomain?: string;
|
|
320
|
+
};
|
|
321
|
+
/** Feature-flag / config options. */
|
|
322
|
+
flags?: {
|
|
323
|
+
/** F3 — bootstrap seed applied synchronously at init (SSR handoff) so the first paint uses real
|
|
324
|
+
* values instead of defaults — no flash-of-default on a cold cache. Shape mirrors GET /config. */
|
|
325
|
+
bootstrap?: FlagsBootstrap;
|
|
326
|
+
/** F4 — subscribe to the realtime config stream (SSE) so a kill-switch flip / flag edit reaches
|
|
327
|
+
* the client in seconds instead of waiting for the periodic refresh. Default true; set false to
|
|
328
|
+
* rely on the foreground-poll refresh only (no persistent connection). */
|
|
329
|
+
realtime?: boolean;
|
|
330
|
+
};
|
|
331
|
+
features?: ScaleBunFeatures;
|
|
332
|
+
privacy?: PrivacyConfig;
|
|
333
|
+
/** Bug-report widget (F-BUG) options. The feature is enabled via features.bugReport; these tune
|
|
334
|
+
* the optional embeddable launcher. Default: launcher off (programmatic reportBug() only). */
|
|
335
|
+
bugReportOptions?: BugReportOptions;
|
|
336
|
+
/**
|
|
337
|
+
* Engage options.
|
|
338
|
+
*
|
|
339
|
+
* `onInAppGameRequest` is how the EIGHT gamified in-app formats get their outcome. Deliberately
|
|
340
|
+
* NOT optional-with-a-default: the SDK has no randomness in it, because a browser that picks its
|
|
341
|
+
* own prize can be made to pick again. The host app's backend grants or reserves the reward and
|
|
342
|
+
* returns it; ScaleBun never holds prize inventory.
|
|
343
|
+
*
|
|
344
|
+
* Named to match the React Native SDK's provider prop exactly, so one handler serves both
|
|
345
|
+
* platforms. Without it, those formats render their unavailable state rather than a wrong prize.
|
|
346
|
+
*/
|
|
347
|
+
engageOptions?: EngageOptions;
|
|
348
|
+
/**
|
|
349
|
+
* Web Push options.
|
|
350
|
+
*
|
|
351
|
+
* `softAsk` renders the SDK's own in-page prompt and calls `push.enable()` from its Allow button.
|
|
352
|
+
* That button click IS the user activation browsers require — which is why a host would otherwise
|
|
353
|
+
* have to wire up a gesture themselves just to be allowed to ask.
|
|
354
|
+
*
|
|
355
|
+
* ⚠️ Asking through this first is not politeness, it is protection: a "Not now" here is reversible,
|
|
356
|
+
* whereas a browser-level Block is permanent and unrecoverable by the SDK. Chrome also demotes
|
|
357
|
+
* sites with poor accept rates to a near-invisible prompt, so a badly-timed direct ask can cost a
|
|
358
|
+
* tenant the ability to ask at all.
|
|
359
|
+
*
|
|
360
|
+
* The implementation is loaded lazily and costs nothing when this is absent.
|
|
361
|
+
*/
|
|
362
|
+
push?: {
|
|
363
|
+
softAsk?: {
|
|
364
|
+
trigger?: 'immediate' | {
|
|
365
|
+
afterMs: number;
|
|
366
|
+
} | {
|
|
367
|
+
onSelector: string;
|
|
368
|
+
};
|
|
369
|
+
title?: string;
|
|
370
|
+
body?: string;
|
|
371
|
+
allowText?: string;
|
|
372
|
+
denyText?: string;
|
|
373
|
+
/** Days before re-asking after a dismissal. Persisted, so it survives reloads. */
|
|
374
|
+
remindAfterDays?: number;
|
|
375
|
+
accent?: string;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Consent-mode (GDPR/CIPA). When true, the SDK captures + sends NOTHING until the host calls
|
|
380
|
+
* `ScaleBun.setConsent(true)` (typically from a CMP callback). Default false = capture immediately.
|
|
381
|
+
*/
|
|
382
|
+
requireConsent?: boolean;
|
|
383
|
+
/** Pre-known consent (SSR/cookie) so a host can skip the wait. Default 'unknown' when gated. */
|
|
384
|
+
initialConsent?: 'granted' | 'denied' | 'unknown';
|
|
385
|
+
debug?: boolean;
|
|
386
|
+
}
|
|
387
|
+
/** F3 — the flags/config seed passed to `init({ flags: { bootstrap } })`. Structurally mirrors the
|
|
388
|
+
* GET /config payload; typed loosely here so the contracts package stays independent of the web SDK's
|
|
389
|
+
* concrete SdkConfigPayload (the SDK narrows it). */
|
|
390
|
+
export interface FlagsBootstrap {
|
|
391
|
+
version?: string;
|
|
392
|
+
flags?: unknown[];
|
|
393
|
+
remoteConfig?: unknown[];
|
|
394
|
+
experiments?: unknown[];
|
|
395
|
+
rollouts?: unknown[];
|
|
396
|
+
entitlements?: Record<string, boolean>;
|
|
397
|
+
}
|
|
398
|
+
/** A3 — a typed tracking plan (Amplitude/Segment-Protocols style), enforced client-side. */
|
|
399
|
+
export interface TrackingPlan {
|
|
400
|
+
/** Per-event contracts. An event absent from this map is "unknown" (see allowUnknownEvents). */
|
|
401
|
+
events?: Record<string, {
|
|
402
|
+
/** Property keys that must be present. */
|
|
403
|
+
required?: string[];
|
|
404
|
+
/** Expected primitive type per property key. */
|
|
405
|
+
props?: Record<string, 'string' | 'number' | 'boolean'>;
|
|
406
|
+
}>;
|
|
407
|
+
/** Allow events not declared in `events` (default true → warn only, never drop). */
|
|
408
|
+
allowUnknownEvents?: boolean;
|
|
409
|
+
/** Drop violating events from both lanes instead of only warning (default false). */
|
|
410
|
+
strict?: boolean;
|
|
411
|
+
}
|
|
412
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE7E,6FAA6F;AAC7F,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uFAAuF;IACvF,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2FAA2F;IAC3F,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yFAAyF;IACzF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oGAAoG;IACpG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4GAA4G;IAC5G,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,qFAAqF;AACrF,MAAM,WAAW,aAAa;IA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D;QAChD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC,CAAC;KACzD,CACF,CAAC;IACF,oFAAoF;IACpF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qFAAqF;IACrF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Config Types
|
|
3
|
+
*
|
|
4
|
+
* Pure type definitions for the public init config. Runtime defaults/validation live in
|
|
5
|
+
* @scalebun/web (core/config). Mirrors the RN SDK's config contract, adapted for the browser.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Context Types
|
|
3
|
+
*
|
|
4
|
+
* Pure context type definitions. The wire-level item/envelope schemas live in @scalebun/protocol;
|
|
5
|
+
* these are the in-SDK context shapes used while assembling those payloads.
|
|
6
|
+
*/
|
|
7
|
+
export interface UserContext {
|
|
8
|
+
id?: string;
|
|
9
|
+
email?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface AppContext {
|
|
14
|
+
name?: string;
|
|
15
|
+
version?: string;
|
|
16
|
+
build?: string;
|
|
17
|
+
environment?: string;
|
|
18
|
+
release?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface DeviceContext {
|
|
21
|
+
id: string;
|
|
22
|
+
model?: string;
|
|
23
|
+
os?: string;
|
|
24
|
+
osVersion?: string;
|
|
25
|
+
browser?: string;
|
|
26
|
+
browserVersion?: string;
|
|
27
|
+
locale?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface SessionContext {
|
|
30
|
+
id: string;
|
|
31
|
+
startTime: number;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Context Types
|
|
3
|
+
*
|
|
4
|
+
* Pure context type definitions. The wire-level item/envelope schemas live in @scalebun/protocol;
|
|
5
|
+
* these are the in-SDK context shapes used while assembling those payloads.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Feature Contract
|
|
3
|
+
*
|
|
4
|
+
* Pure interface definitions for pluggable SDK features. No runtime implementation.
|
|
5
|
+
* Mirrors the RN SDK's fail-isolated IFeature/FeatureContext model.
|
|
6
|
+
*/
|
|
7
|
+
import type { Item, ErrorItem, NetworkItem } from '@scalebun/protocol';
|
|
8
|
+
import type { ReplayMode, TrackingPlan, FlagsBootstrap } from './config.js';
|
|
9
|
+
/** Context provided to features during setup. The narrow surface a feature is allowed to touch. */
|
|
10
|
+
export interface FeatureContext {
|
|
11
|
+
/** The current session id (e.g. to correlate a recovered-crash signal to the dead session).
|
|
12
|
+
* Always set by the bootstrap at runtime; optional so feature unit-test mocks stay terse. */
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
/** Public client key (scalebun_ck_…) — a feature calling its own backend lane (e.g. config/flags) uses
|
|
15
|
+
* it for `x-scalebun-client-key` auth. Set by the bootstrap; optional for terse test mocks. */
|
|
16
|
+
clientKey?: string;
|
|
17
|
+
/** Stable per-browser device id — deterministic flag/experiment bucketing keys off it (must match
|
|
18
|
+
* the id used for capture so bucketing is stable). Set by the bootstrap; optional for test mocks. */
|
|
19
|
+
deviceId?: string;
|
|
20
|
+
/** App/release version (from init config). Read by Engage to send the config-query `appVersion` the
|
|
21
|
+
* backend uses for minAppVersion targeting. Optional. */
|
|
22
|
+
appVersion?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The currently IDENTIFIED user id, or undefined while anonymous.
|
|
25
|
+
*
|
|
26
|
+
* Read by Engage / IAM to send the config-query `endUserId`, which is what the backend needs to
|
|
27
|
+
* resolve segment targeting. Without it a segment-targeted campaign fails closed and is never
|
|
28
|
+
* served — the RN SDK has always sent it, web did not, so segment targeting was silently dead on
|
|
29
|
+
* web. A getter (not a value) because identity changes after the context is built: the host app
|
|
30
|
+
* typically calls identify() at login, long after setup().
|
|
31
|
+
*/
|
|
32
|
+
getUserId?: () => string | undefined;
|
|
33
|
+
/** Enqueue a signal item onto the ONE unified pipeline. */
|
|
34
|
+
emit: (item: Item) => void;
|
|
35
|
+
/**
|
|
36
|
+
* File an item against a DIFFERENT session than the live one.
|
|
37
|
+
*
|
|
38
|
+
* Exists for exactly one situation: a signal that is ABOUT a session that already ended, produced
|
|
39
|
+
* after the next one began. Crash recovery is the case — a tab that dies hard cannot report its
|
|
40
|
+
* own death, so the following load finds the unfinished marker and reports it. Sent via `emit`,
|
|
41
|
+
* that crash landed on the freshly-opened session, which is how a healthy session came up already
|
|
42
|
+
* marked crashed at t≈0 while the session that actually died stayed clean. Verified against real
|
|
43
|
+
* rows: 4 of 4 recovered crashes were filed against the wrong session.
|
|
44
|
+
*
|
|
45
|
+
* Optional so mobile bootstraps and terse test mocks are unaffected; callers must fall back.
|
|
46
|
+
*/
|
|
47
|
+
emitFor?: (sessionId: string, item: Item) => void;
|
|
48
|
+
/** Track a custom event (sugar over emit for a kind:'event' item). */
|
|
49
|
+
trackEvent: (name: string, props?: Record<string, unknown>) => void;
|
|
50
|
+
/** Current page lifecycle state. */
|
|
51
|
+
getAppState: () => 'active' | 'background' | 'inactive';
|
|
52
|
+
/** Debug logger (no-op unless debug is enabled). */
|
|
53
|
+
log: (...args: unknown[]) => void;
|
|
54
|
+
/** The SDK's own ingestion base URL — features use it to self-exclude their own traffic. */
|
|
55
|
+
apiBaseUrl: string;
|
|
56
|
+
/**
|
|
57
|
+
* Raise a capture signal ('error' | 'rage' | 'report' | …) — arms capture-on-signal features.
|
|
58
|
+
*
|
|
59
|
+
* `detail` is optional and additive: subscribers that only care about the reason ignore it, and every
|
|
60
|
+
* existing caller keeps working unchanged. It exists so a signal can carry the few fields a
|
|
61
|
+
* subscriber needs without the raiser having to reach into another feature — ErrorsFeature attaches
|
|
62
|
+
* the error's type/fingerprint so AnalyticsFeature can promote it to `$exception`.
|
|
63
|
+
*/
|
|
64
|
+
signal: (reason: string, detail?: Record<string, unknown>) => void;
|
|
65
|
+
/** Subscribe to capture signals. Returns an unsubscribe fn. */
|
|
66
|
+
onSignal: (cb: (reason: string, detail?: Record<string, unknown>) => void) => () => void;
|
|
67
|
+
/** Opt-in flag for replay <canvas> pixel capture (read by ReplayFeature). Default off. */
|
|
68
|
+
replayCanvas?: boolean;
|
|
69
|
+
/** See ScaleBunInitConfig.replayDirectUpload. */
|
|
70
|
+
replayDirectUpload?: boolean;
|
|
71
|
+
/** F-IFR P2 — origin allowlist for cross-origin replay stitching (parent bridge + child satellite). */
|
|
72
|
+
replayFrameOrigins?: string[];
|
|
73
|
+
/** Autocapture DOM interactions as analytics events (read by AnalyticsFeature). Default on. */
|
|
74
|
+
autocapture?: boolean;
|
|
75
|
+
/** Resolved allowlist of origins to inject a W3C `traceparent` into (read by NetworkFeature).
|
|
76
|
+
* Same-origin by default; empty = tracing off. */
|
|
77
|
+
traceOrigins?: string[];
|
|
78
|
+
/** Mask all text in replay (read by ReplayFeature → snapshot). Default true (privacy-safe). */
|
|
79
|
+
maskReplayText?: boolean;
|
|
80
|
+
/** CSS selectors whose subtree text is ALWAYS masked in replay, even when maskReplayText is off
|
|
81
|
+
* (read by ReplayFeature → snapshot). `contenteditable` + `[data-scalebun-mask]` are masked
|
|
82
|
+
* unconditionally in addition to these. */
|
|
83
|
+
maskSelectors?: string[];
|
|
84
|
+
/** Mask form input values in replay (read by ReplayFeature → snapshot). Default true; passwords
|
|
85
|
+
* are always blanked regardless. */
|
|
86
|
+
maskInputs?: boolean;
|
|
87
|
+
/** Mask the text label on interaction events — `USER_ACTION.label` (JourneyFeature) and
|
|
88
|
+
* `$autocapture` `props.text` (AnalyticsFeature). Default FALSE: the real label is sent, so clicks
|
|
89
|
+
* group per element rather than collapsing into one row. */
|
|
90
|
+
maskEventText?: boolean;
|
|
91
|
+
/** Honor GPC / Do-Not-Track by not recording replay for opted-out users (read by ReplayFeature).
|
|
92
|
+
* Default false (opt-in). */
|
|
93
|
+
respectDnt?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Scroll-reversal thresholds for the exit-intent detector (read by ExitIntentFeature).
|
|
96
|
+
*
|
|
97
|
+
* Host-tunable because every default is a guess until real `$exit_intent` distributions exist, and an
|
|
98
|
+
* SDK release is the slowest step in that loop — a site can retune without waiting for one. Omitted
|
|
99
|
+
* keys fall back to REVERSAL_DEFAULTS. Shape is duplicated here rather than imported because
|
|
100
|
+
* sdk-contracts must not depend on the web package.
|
|
101
|
+
*/
|
|
102
|
+
exitIntent?: {
|
|
103
|
+
windowMs?: number;
|
|
104
|
+
minDistancePx?: number;
|
|
105
|
+
minVelocityPxMs?: number;
|
|
106
|
+
minDepthPct?: number;
|
|
107
|
+
sustainSamples?: number;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Host resolver for the eight gamified in-app formats (`engageOptions.onInAppGameRequest`).
|
|
111
|
+
*
|
|
112
|
+
* Carried as an opaque function rather than the typed handler on purpose: the request/result
|
|
113
|
+
* contract lives in the engage chunk, and importing it here — into a module every entry point
|
|
114
|
+
* loads — would drag the eight-variant union into core's dependency graph for no runtime benefit.
|
|
115
|
+
* The engage RUNTIME (lazy) applies the precise types when it installs this.
|
|
116
|
+
*/
|
|
117
|
+
onInAppGameRequest?: (request: unknown) => Promise<unknown>;
|
|
118
|
+
/** Replay sampling config (read by ReplayFeature → decideSampling, which applies defaults). */
|
|
119
|
+
replaySampling?: {
|
|
120
|
+
mode?: ReplayMode;
|
|
121
|
+
sampleRate?: number;
|
|
122
|
+
onErrorSampleRate?: number;
|
|
123
|
+
persistBuffer?: boolean;
|
|
124
|
+
privacyLevel?: 'standard' | 'strict';
|
|
125
|
+
};
|
|
126
|
+
/** Pipeline backpressure signal — items still pending egress. Replay's adaptive quality sheds
|
|
127
|
+
* low-priority capture when this (or CPU) is high. Set by the bootstrap. */
|
|
128
|
+
egressPending?: () => number;
|
|
129
|
+
/** Cumulative items the pipeline has thrown away. Replay watches it for a rise: a shed drops a
|
|
130
|
+
* whole frame chain, so the recorder must open a new one rather than keep emitting deltas that
|
|
131
|
+
* reconstruct against frames the server will never receive. Set by the bootstrap. */
|
|
132
|
+
egressDropped?: () => number;
|
|
133
|
+
/** Error capture options (read by ErrorsFeature; defaults applied in-feature). Passthrough from
|
|
134
|
+
* config.errors — keeps resolution out of the core bundle. */
|
|
135
|
+
errorsOptions?: {
|
|
136
|
+
ignoreErrors?: (string | RegExp)[];
|
|
137
|
+
denyUrls?: (string | RegExp)[];
|
|
138
|
+
captureResourceErrors?: boolean;
|
|
139
|
+
beforeSend?: (item: ErrorItem) => ErrorItem | null;
|
|
140
|
+
sampleRate?: number;
|
|
141
|
+
};
|
|
142
|
+
/** Network capture options (read by NetworkFeature; defaults applied in-feature). Passthrough from
|
|
143
|
+
* config.network — keeps resolution out of the core bundle. */
|
|
144
|
+
networkOptions?: {
|
|
145
|
+
trackWebSocket?: boolean;
|
|
146
|
+
trackSse?: boolean;
|
|
147
|
+
captureBodies?: boolean;
|
|
148
|
+
bodyMaxBytes?: number;
|
|
149
|
+
contentTypeAllowlist?: string[];
|
|
150
|
+
sampleRate?: number;
|
|
151
|
+
slowRequestMs?: number;
|
|
152
|
+
denyUrls?: (string | RegExp)[];
|
|
153
|
+
/**
|
|
154
|
+
* Keep known telemetry beacons (analytics collectors, ad pixels, IP enrichment).
|
|
155
|
+
*
|
|
156
|
+
* Default false: they are dropped. They are not the app, they cost the visitor bandwidth, and
|
|
157
|
+
* a blocked one used to move the session health score. See features/network/thirdParty.ts.
|
|
158
|
+
*/
|
|
159
|
+
captureThirdParty?: boolean;
|
|
160
|
+
/** Replace the built-in beacon host list wholesale (comma-joined hostname suffixes). */
|
|
161
|
+
thirdPartyHosts?: string;
|
|
162
|
+
beforeSend?: (item: NetworkItem) => NetworkItem | null;
|
|
163
|
+
};
|
|
164
|
+
/** Performance/RUM options (read by PerformanceFeature; defaults applied in-feature). */
|
|
165
|
+
performanceOptions?: {
|
|
166
|
+
tracesSampleRate?: number;
|
|
167
|
+
slowTransactionMs?: number;
|
|
168
|
+
};
|
|
169
|
+
/** W5.2 — Resource Watchdog options (read by WatchdogFeature; defaults applied in-feature). */
|
|
170
|
+
watchdogOptions?: {
|
|
171
|
+
sampleRate?: number;
|
|
172
|
+
heartbeatMs?: number;
|
|
173
|
+
rollupMs?: number;
|
|
174
|
+
memorySampleMs?: number;
|
|
175
|
+
thresholds?: Record<string, number>;
|
|
176
|
+
captureProfileOnIncident?: boolean;
|
|
177
|
+
};
|
|
178
|
+
/** A3/A6 — analytics options (read by AnalyticsFeature): tracking plan, sample rate, cookie domain. */
|
|
179
|
+
analyticsOptions?: {
|
|
180
|
+
plan?: TrackingPlan;
|
|
181
|
+
sampleRate?: number;
|
|
182
|
+
cookieDomain?: string;
|
|
183
|
+
};
|
|
184
|
+
/** F3 — flags/config bootstrap seed (read by ConfigFeature at setup). Passthrough from
|
|
185
|
+
* config.flags.bootstrap; seeds evaluation before the network responds (no flash-of-default). */
|
|
186
|
+
flagsBootstrap?: FlagsBootstrap;
|
|
187
|
+
/** F4 — open the realtime config stream (SSE). Passthrough from config.flags.realtime (default on).
|
|
188
|
+
* When false, ConfigFeature keeps only the foreground-poll refresh. */
|
|
189
|
+
flagsRealtime?: boolean;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Contract for SDK features (errors, network, performance, replay, …). Each feature implements
|
|
193
|
+
* this and registers with the FeatureRegistry.
|
|
194
|
+
*/
|
|
195
|
+
export interface IFeature {
|
|
196
|
+
/** Unique feature name (e.g. 'errors', 'network', 'replay'). */
|
|
197
|
+
readonly name: string;
|
|
198
|
+
/** Install interceptors / observers. May be async for features needing lazy chunks. */
|
|
199
|
+
setup(context: FeatureContext): void | Promise<void>;
|
|
200
|
+
/** Remove interceptors / observers. Must be safe to call multiple times. */
|
|
201
|
+
teardown(): void;
|
|
202
|
+
/** Whether the feature is currently active. */
|
|
203
|
+
readonly isActive: boolean;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../src/features.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzE,mGAAmG;AACnG,MAAM,WAAW,cAAc;IAC7B;kGAC8F;IAC9F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;oGACgG;IAChG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;0GACsG;IACtG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;8DAC0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACrC,2DAA2D;IAC3D,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC3B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAClD,sEAAsE;IACtE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,oCAAoC;IACpC,WAAW,EAAE,MAAM,QAAQ,GAAG,YAAY,GAAG,UAAU,CAAC;IACxD,oDAAoD;IACpD,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,I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AW,KAAK,WAAW,GAAG,IAAI,CAAC;KACxD,CAAC;IACF,yFAAyF;IACzF,kBAAkB,CAAC,EAAE;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,+FAA+F;IAC/F,eAAe,CAAC,EAAE;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACpC,wBAAwB,CAAC,EAAE,OAAO,CAAC;KACpC,CAAC;IACF,uGAAuG;IACvG,gBAAgB,CAAC,EAAE;QACjB,IAAI,CAAC,EAAE,YAAY,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF;sGACkG;IAClG,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;4EACwE;IACxE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uFAAuF;IACvF,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,4EAA4E;IAC5E,QAAQ,IAAI,IAAI,CAAC;IACjB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B"}
|
package/dist/features.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Feature Contract
|
|
3
|
+
*
|
|
4
|
+
* Pure interface definitions for pluggable SDK features. No runtime implementation.
|
|
5
|
+
* Mirrors the RN SDK's fail-isolated IFeature/FeatureContext model.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../src/features.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* Single entry point for all shared TYPE contracts. This package contains ONLY pure TypeScript
|
|
5
|
+
* types and interfaces — no runtime code, no Zod schemas (those live in @scalebun/protocol).
|
|
6
|
+
*/
|
|
7
|
+
export type { ScaleBunInitConfig, ScaleBunFeatures, PrivacyConfig, ScaleBunUser, ReplayMode, TrackingPlan, FlagsBootstrap } from './config.js';
|
|
8
|
+
export type { UserContext, AppContext, DeviceContext, SessionContext } from './events.js';
|
|
9
|
+
export type { Session, SessionMetadata, SessionStatus, CaptureReason, CaptureMode, ReplayQuality, WebReplayFrame, PrivacyPolicy, SessionReplayConfig, } from './session.js';
|
|
10
|
+
export type { IFeature, FeatureContext } from './features.js';
|
|
11
|
+
export type { IPlatformInfo, IAppLifecycle, AppLifecycleState } from './platform.js';
|
|
12
|
+
export type { ISessionBoundary, SessionStateValue } from './session-boundary.js';
|
|
13
|
+
export type { BaseMessage, HelloMessage, PingMessage, PongMessage, DebugMessage, LogLevel } from './bridge.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG5I,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAGvF,YAAY,EACV,OAAO,EACP,eAAe,EACf,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,mBAAmB,GACpB,MAAM,WAAW,CAAC;AAGnB,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG3D,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGlF,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG9E,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* Single entry point for all shared TYPE contracts. This package contains ONLY pure TypeScript
|
|
5
|
+
* types and interfaces — no runtime code, no Zod schemas (those live in @scalebun/protocol).
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Platform Abstractions
|
|
3
|
+
*
|
|
4
|
+
* Pure interfaces for platform information and app lifecycle. No runtime, no DOM access.
|
|
5
|
+
* Implementations live in @scalebun/web.
|
|
6
|
+
*/
|
|
7
|
+
/** Platform information abstraction (web binding fills this from navigator/UA). */
|
|
8
|
+
export interface IPlatformInfo {
|
|
9
|
+
readonly os: 'android' | 'ios' | 'web';
|
|
10
|
+
readonly osVersion: string;
|
|
11
|
+
readonly browser?: string;
|
|
12
|
+
readonly browserVersion?: string;
|
|
13
|
+
readonly isBot?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Normalized app/page lifecycle state. On web this maps to the Page Visibility API. */
|
|
16
|
+
export type AppLifecycleState = 'active' | 'background' | 'inactive';
|
|
17
|
+
export interface IAppLifecycle {
|
|
18
|
+
getCurrentState(): AppLifecycleState;
|
|
19
|
+
/** Add a listener for lifecycle changes. Returns an unsubscribe function. */
|
|
20
|
+
addListener(callback: (state: AppLifecycleState) => void): () => void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wFAAwF;AACxF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,eAAe,IAAI,iBAAiB,CAAC;IACrC,6EAA6E;IAC7E,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACvE"}
|
package/dist/platform.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Session Boundary
|
|
3
|
+
*
|
|
4
|
+
* Pure contract for when a session starts/ends (timeout, page-hide, manual).
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ NOTHING IMPLEMENTS THIS. The header used to say "Implementation in @scalebun/web
|
|
7
|
+
* (features/session)"; that directory holds `sessionManager.ts` and `sessionStore.ts`, neither of
|
|
8
|
+
* which implements `ISessionBoundary`, and no other file in either SDK does either. The only thing
|
|
9
|
+
* bearing the name is a test file. Read as documentation of how the web SDK works, this shape is
|
|
10
|
+
* actively misleading — it describes an `'ending' → 'ended'` transition and a `'pagehide'` end reason
|
|
11
|
+
* that do not exist anywhere.
|
|
12
|
+
*
|
|
13
|
+
* How a web session ACTUALLY ends, for anyone arriving here looking for it:
|
|
14
|
+
* - the id lives in `sessionStorage` and is resolved ONCE per document, in the `SessionManager`
|
|
15
|
+
* constructor (`features/session/sessionStore.ts` → `resolveSession`);
|
|
16
|
+
* - it therefore survives refreshes and same-tab navigations, and dies with the tab;
|
|
17
|
+
* - an idle timeout (default 30 min) and an absolute cap (default 4 h) are evaluated at the NEXT
|
|
18
|
+
* document load, not by a timer;
|
|
19
|
+
* - the server closes the row: `IngestionService.reapStaleSessions`, a 5-minute cron.
|
|
20
|
+
*
|
|
21
|
+
* Before implementing this interface, read the warning on `HttpClient.finalize()`. The obvious
|
|
22
|
+
* reading of `end('pagehide')` — finalize the session when the page hides — corrupts every
|
|
23
|
+
* multi-page session, and the reasons are recorded there.
|
|
24
|
+
*/
|
|
25
|
+
export type SessionStateValue = 'idle' | 'active' | 'ending' | 'ended';
|
|
26
|
+
export interface ISessionBoundary {
|
|
27
|
+
readonly state: SessionStateValue;
|
|
28
|
+
/** Start a new session boundary. */
|
|
29
|
+
begin(): void;
|
|
30
|
+
/** End the current session. */
|
|
31
|
+
end(reason: 'manual' | 'timeout' | 'pagehide'): void;
|
|
32
|
+
/** Subscribe to boundary transitions. Returns an unsubscribe fn. */
|
|
33
|
+
onChange(cb: (state: SessionStateValue) => void): () => void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=session-boundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-boundary.d.ts","sourceRoot":"","sources":["../src/session-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,oCAAoC;IACpC,KAAK,IAAI,IAAI,CAAC;IACd,+BAA+B;IAC/B,GAAG,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC;IACrD,oEAAoE;IACpE,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC9D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Session Boundary
|
|
3
|
+
*
|
|
4
|
+
* Pure contract for when a session starts/ends (timeout, page-hide, manual).
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ NOTHING IMPLEMENTS THIS. The header used to say "Implementation in @scalebun/web
|
|
7
|
+
* (features/session)"; that directory holds `sessionManager.ts` and `sessionStore.ts`, neither of
|
|
8
|
+
* which implements `ISessionBoundary`, and no other file in either SDK does either. The only thing
|
|
9
|
+
* bearing the name is a test file. Read as documentation of how the web SDK works, this shape is
|
|
10
|
+
* actively misleading — it describes an `'ending' → 'ended'` transition and a `'pagehide'` end reason
|
|
11
|
+
* that do not exist anywhere.
|
|
12
|
+
*
|
|
13
|
+
* How a web session ACTUALLY ends, for anyone arriving here looking for it:
|
|
14
|
+
* - the id lives in `sessionStorage` and is resolved ONCE per document, in the `SessionManager`
|
|
15
|
+
* constructor (`features/session/sessionStore.ts` → `resolveSession`);
|
|
16
|
+
* - it therefore survives refreshes and same-tab navigations, and dies with the tab;
|
|
17
|
+
* - an idle timeout (default 30 min) and an absolute cap (default 4 h) are evaluated at the NEXT
|
|
18
|
+
* document load, not by a timer;
|
|
19
|
+
* - the server closes the row: `IngestionService.reapStaleSessions`, a 5-minute cron.
|
|
20
|
+
*
|
|
21
|
+
* Before implementing this interface, read the warning on `HttpClient.finalize()`. The obvious
|
|
22
|
+
* reading of `end('pagehide')` — finalize the session when the page hides — corrupts every
|
|
23
|
+
* multi-page session, and the reasons are recorded there.
|
|
24
|
+
*/
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=session-boundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-boundary.js","sourceRoot":"","sources":["../src/session-boundary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Session Domain Types
|
|
3
|
+
*
|
|
4
|
+
* Pure type definitions for the unified session system (web). Runtime constants/helpers live in
|
|
5
|
+
* @scalebun/web (features/session). Mirrors the RN session contract; replay frame is DOM-shaped.
|
|
6
|
+
*/
|
|
7
|
+
export type SessionStatus = 'active' | 'ended' | 'timeout';
|
|
8
|
+
export interface SessionMetadata {
|
|
9
|
+
appName?: string;
|
|
10
|
+
appVersion?: string;
|
|
11
|
+
environment?: string;
|
|
12
|
+
platform?: 'android' | 'ios' | 'web';
|
|
13
|
+
osVersion?: string;
|
|
14
|
+
browser?: string;
|
|
15
|
+
browserVersion?: string;
|
|
16
|
+
viewportWidth?: number;
|
|
17
|
+
viewportHeight?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface Session {
|
|
20
|
+
sessionId: string;
|
|
21
|
+
deviceId: string;
|
|
22
|
+
startedAt: number;
|
|
23
|
+
endedAt?: number;
|
|
24
|
+
status: SessionStatus;
|
|
25
|
+
metadata: SessionMetadata;
|
|
26
|
+
}
|
|
27
|
+
export type CaptureReason = 'navigation' | 'interaction' | 'frequency' | 'manual' | 'error-context' | 'scroll';
|
|
28
|
+
export type CaptureMode = 'continuous' | 'capture-on-signal';
|
|
29
|
+
export type ReplayQuality = 'high' | 'normal' | 'low';
|
|
30
|
+
/** A web replay frame is a DOM snapshot (keyframe) or a batch of mutations (delta). */
|
|
31
|
+
export interface WebReplayFrame {
|
|
32
|
+
frameId: string;
|
|
33
|
+
sessionId: string;
|
|
34
|
+
ts: number;
|
|
35
|
+
frameType: 'keyframe' | 'delta';
|
|
36
|
+
captureReason: CaptureReason;
|
|
37
|
+
masked: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface PrivacyPolicy {
|
|
40
|
+
maskAllText: boolean;
|
|
41
|
+
maskAllInputs: boolean;
|
|
42
|
+
maskSelectors: string[];
|
|
43
|
+
blockSelectors: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface SessionReplayConfig {
|
|
46
|
+
captureMode: CaptureMode;
|
|
47
|
+
quality: ReplayQuality;
|
|
48
|
+
maxFrames: number;
|
|
49
|
+
maxDurationMs: number;
|
|
50
|
+
privacyPolicy: PrivacyPolicy;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK,GAAG,KAAK,CAA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ist/session.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @scalebun/sdk-contracts — Session Domain Types
|
|
3
|
+
*
|
|
4
|
+
* Pure type definitions for the unified session system (web). Runtime constants/helpers live in
|
|
5
|
+
* @scalebun/web (features/session). Mirrors the RN session contract; replay frame is DOM-shaped.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@scalebun-release/sdk-contracts",
|
|
3
|
+
"version": "2.0.3",
|
|
4
|
+
"description": "Pure TypeScript interface/type contracts for the ScaleBun web SDK. No runtime code, no Zod, no validators — the single source of truth for shared types.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.json && node ../../scripts/fix-esm-extensions.mjs dist",
|
|
20
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@scalebun/protocol": "npm:@scalebun-release/protocol@2.0.3"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"typescript": "^5.6.0"
|
|
27
|
+
},
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/scalebun/scalebun-web-sdk.git",
|
|
35
|
+
"directory": "packages/sdk-contracts"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://scalebun.com/docs/web-sdk",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/scalebun/scalebun-web-sdk/issues"
|
|
40
|
+
}
|
|
41
|
+
}
|