@fixback/sdk 0.4.0 → 0.6.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 +12 -2
- package/dist/annotation.d.ts +10 -73
- package/dist/capture/extract-dom.d.ts +33 -0
- package/dist/connect.d.ts +47 -0
- package/dist/dom.d.ts +7 -19
- package/dist/element-picker.d.ts +1 -1
- package/dist/error-capture.d.ts +21 -93
- package/dist/fixback.umd.js +36 -215
- package/dist/fixback.umd.js.map +1 -1
- package/dist/identity.d.ts +6 -1
- package/dist/index.d.ts +17 -15
- package/dist/index.mjs +3598 -4681
- package/dist/index.mjs.map +1 -1
- package/dist/init.d.ts +63 -97
- package/dist/mount.d.ts +46 -0
- package/dist/overlay/dom.d.ts +16 -0
- package/dist/overlay/icons.d.ts +23 -0
- package/dist/overlay/marking.d.ts +64 -0
- package/dist/overlay/send.d.ts +65 -0
- package/dist/overlay/view.d.ts +78 -0
- package/dist/overlay-styles.d.ts +1 -1
- package/dist/overlay.d.ts +40 -43
- package/dist/package.json +3 -0
- package/dist/report.d.ts +22 -111
- package/dist/reporter-session-store.d.ts +17 -0
- package/dist/session.d.ts +27 -0
- package/dist/submit.d.ts +56 -19
- package/dist/trace/instrument/beacon.d.ts +16 -0
- package/dist/trace/instrument/console.d.ts +11 -0
- package/dist/trace/instrument/fetch.d.ts +16 -0
- package/dist/trace/instrument/index.d.ts +64 -0
- package/dist/trace/instrument/navigation.d.ts +12 -0
- package/dist/trace/instrument/ui.d.ts +23 -0
- package/dist/trace/instrument/window.d.ts +66 -0
- package/dist/trace/instrument/xhr.d.ts +15 -0
- package/dist/version.d.ts +1 -1
- package/package.json +8 -5
- package/dist/auto-report-backoff.d.ts +0 -47
- package/dist/boot.d.ts +0 -74
- package/dist/breadcrumbs.d.ts +0 -448
- package/dist/invite.d.ts +0 -104
- package/dist/onboarding-styles.d.ts +0 -8
- package/dist/onboarding.d.ts +0 -44
- package/dist/screenshot.d.ts +0 -73
- package/dist/scrub.d.ts +0 -61
package/dist/invite.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Invite redemption & reporter identity (spec §F).
|
|
3
|
-
*
|
|
4
|
-
* The zero-integration path for an invited tester: detect an invite token on the
|
|
5
|
-
* page (`?fixback_invite=<token>`) or an explicit `redeem()` call, read the
|
|
6
|
-
* Invite's public status, and — on confirmation — redeem it into a persisted
|
|
7
|
-
* `reporterId` the SDK thereafter presents as an identity input.
|
|
8
|
-
*
|
|
9
|
-
* This module is the wire + storage half (pure enough to unit-test directly): the
|
|
10
|
-
* two invite endpoints, the localStorage persistence scoped by publishable key,
|
|
11
|
-
* and the URL token detection / one-time consumption. The onboarding modal is
|
|
12
|
-
* `onboarding.ts`; `init` wires the two together.
|
|
13
|
-
*
|
|
14
|
-
* Like `boot.ts`, the wire types are a **vendored** slice of the server contract
|
|
15
|
-
* (`apps/api/src/invites/invite-redemption.controller.ts`) — the SDK never imports
|
|
16
|
-
* the private server package. Keep them in lock-step with that controller.
|
|
17
|
-
*/
|
|
18
|
-
import type { ReporterTier } from "./boot";
|
|
19
|
-
/** The Invite's shape. Mirrors the server's `InviteKind`. */
|
|
20
|
-
export type InviteKind = "targeted" | "shared";
|
|
21
|
-
/** The dead/unknown states a status or redeem read can resolve to. */
|
|
22
|
-
export type InviteDeadStatus = "revoked" | "expired" | "exhausted" | "not_found";
|
|
23
|
-
/**
|
|
24
|
-
* The public status of an Invite (`GET /api/invites/:token`). A live (`pending`)
|
|
25
|
-
* Invite reveals the minimal facts the onboarding modal needs — the Project, the
|
|
26
|
-
* Invite's shape, and the **server-derived** tier the redemption would grant; a
|
|
27
|
-
* dead or unknown token reveals only its state.
|
|
28
|
-
*/
|
|
29
|
-
export type InviteStatusAnswer = {
|
|
30
|
-
readonly status: "pending";
|
|
31
|
-
readonly projectId: string;
|
|
32
|
-
readonly kind: InviteKind;
|
|
33
|
-
readonly tier: ReporterTier;
|
|
34
|
-
} | {
|
|
35
|
-
readonly status: InviteDeadStatus;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* The result of redeeming an Invite (`POST /api/invites/:token/redeem`): the
|
|
39
|
-
* minted Reporter (its handle + server-derived tier + Project), or why it was
|
|
40
|
-
* refused.
|
|
41
|
-
*/
|
|
42
|
-
export type RedeemAnswer = {
|
|
43
|
-
readonly status: "redeemed";
|
|
44
|
-
readonly reporterId: string;
|
|
45
|
-
readonly tier: ReporterTier;
|
|
46
|
-
readonly projectId: string;
|
|
47
|
-
} | {
|
|
48
|
-
readonly status: InviteDeadStatus;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* The self-provided display fields captured in the onboarding modal. They ride
|
|
52
|
-
* along as a Reporter's chosen name / email — **never** a trust signal (the tier
|
|
53
|
-
* is always server-derived, spec §F).
|
|
54
|
-
*/
|
|
55
|
-
export interface ReporterDisplay {
|
|
56
|
-
readonly name?: string;
|
|
57
|
-
readonly email?: string;
|
|
58
|
-
}
|
|
59
|
-
/** A persisted redeemed Reporter: the server handle plus the display fields. */
|
|
60
|
-
export interface StoredReporter extends ReporterDisplay {
|
|
61
|
-
readonly reporterId: string;
|
|
62
|
-
}
|
|
63
|
-
/** The URL query parameter that carries an invite token. */
|
|
64
|
-
export declare const INVITE_QUERY_PARAM = "fixback_invite";
|
|
65
|
-
/**
|
|
66
|
-
* Read the invite token from a page URL's `?fixback_invite=` param. Returns the
|
|
67
|
-
* token, or `null` when absent, empty, or the URL cannot be parsed — never throws.
|
|
68
|
-
*/
|
|
69
|
-
export declare function readInviteToken(href: string): string | null;
|
|
70
|
-
/**
|
|
71
|
-
* Strip the invite token from the address bar (one-time consumption, spec §F) via
|
|
72
|
-
* `history.replaceState`, so a reload or a shared link cannot re-trigger — or
|
|
73
|
-
* re-consume — an already-redeemed Invite. Other params, the path, and the hash
|
|
74
|
-
* are preserved. Best-effort: it never throws into the host page.
|
|
75
|
-
*/
|
|
76
|
-
export declare function stripInviteToken(win: Window): void;
|
|
77
|
-
/**
|
|
78
|
-
* Persist a redeemed Reporter for `key`. The `reporterId` is the identity the SDK
|
|
79
|
-
* presents on later boots; the display name / email ride along as chosen fields.
|
|
80
|
-
* Best-effort — storage being unavailable (private mode) is never fatal.
|
|
81
|
-
*/
|
|
82
|
-
export declare function persistReporter(key: string, reporter: StoredReporter, store?: Storage | null): void;
|
|
83
|
-
/**
|
|
84
|
-
* Read the redeemed Reporter persisted for `key`, or `null` when none is stored,
|
|
85
|
-
* the record is malformed, or it carries no `reporterId`. Never throws.
|
|
86
|
-
*/
|
|
87
|
-
export declare function readStoredReporter(key: string, store?: Storage | null): StoredReporter | null;
|
|
88
|
-
/** Join an API base URL with the invite status path, tolerating a trailing slash. */
|
|
89
|
-
export declare function inviteStatusEndpoint(apiUrl: string, token: string): string;
|
|
90
|
-
/** Join an API base URL with the redeem path for a token. */
|
|
91
|
-
export declare function redeemEndpoint(apiUrl: string, token: string): string;
|
|
92
|
-
/**
|
|
93
|
-
* Read an Invite's public status. Resolves to the answer, or `null` when Fixback
|
|
94
|
-
* could not be reached or the body was not a recognised answer. The endpoint
|
|
95
|
-
* answers 200 for a live or dead Invite and 404 (with a JSON body) for an unknown
|
|
96
|
-
* token, so the body — not the HTTP status — is what the caller narrows on. Never
|
|
97
|
-
* throws: an outage stays invisible to the host page.
|
|
98
|
-
*/
|
|
99
|
-
export declare function fetchInviteStatus(apiUrl: string, token: string, fetchImpl?: typeof fetch): Promise<InviteStatusAnswer | null>;
|
|
100
|
-
/**
|
|
101
|
-
* Redeem an Invite by token, minting and returning a Reporter. Resolves to the
|
|
102
|
-
* answer, or `null` on an unreachable API or an unrecognised body. Never throws.
|
|
103
|
-
*/
|
|
104
|
-
export declare function redeemInviteToken(apiUrl: string, token: string, fetchImpl?: typeof fetch): Promise<RedeemAnswer | null>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Styles for the invite onboarding modal (spec §F) — the Signal look of the
|
|
3
|
-
* frozen Reporter prototype (`docs/design/Fixback Reporter.dc.html`), scoped to
|
|
4
|
-
* the modal's own Shadow DOM so the host page is never touched and never touches
|
|
5
|
-
* it. Tokens mirror `overlay-styles.ts` so launcher, overlay, and modal read as
|
|
6
|
-
* one system.
|
|
7
|
-
*/
|
|
8
|
-
export declare const ONBOARDING_STYLES = "\n:host {\n --fb-color-accent: #2f6fed;\n --fb-color-accent-hover: #245fd0;\n --fb-color-on-emphasis: #ffffff;\n --fb-color-ink: #0f1720;\n --fb-color-text: #1a2530;\n --fb-color-muted: #5a6875;\n --fb-color-faint: #9aa7b2;\n --fb-color-hint: #b7c1cb;\n --fb-color-border: #dce3ea;\n --fb-color-border-soft: #e6ebf0;\n --fb-color-surface: #ffffff;\n --fb-color-card: #f6f8fa;\n --fb-color-accent-bg: #eaf1fe;\n --fb-color-success: #2f9e5b;\n --fb-font-sans: \"IBM Plex Sans\", system-ui, -apple-system, \"Segoe UI\", Roboto,\n Helvetica, Arial, sans-serif;\n --fb-font-mono: \"IBM Plex Mono\", ui-monospace, \"SFMono-Regular\", Menlo, Consolas,\n monospace;\n all: initial;\n}\n\n*, *::before, *::after { box-sizing: border-box; }\n\n.fb-ob-backdrop {\n position: fixed;\n inset: 0;\n z-index: 2147483010;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 24px;\n background: rgba(15, 23, 32, 0.55);\n backdrop-filter: blur(3px);\n font-family: var(--fb-font-sans);\n color: var(--fb-color-text);\n animation: fb-ob-fade 0.25s ease both;\n}\n\n.fb-ob-panel {\n width: 400px;\n max-width: 100%;\n background: var(--fb-color-surface);\n border-radius: 16px;\n box-shadow: 0 30px 70px rgba(15, 40, 70, 0.4);\n overflow: hidden;\n animation: fb-ob-pop 0.32s cubic-bezier(0.2, 0.8, 0.3, 1) both;\n}\n\n.fb-ob-head {\n padding: 22px 24px 0;\n display: flex;\n align-items: center;\n gap: 10px;\n}\n.fb-ob-mark {\n width: 22px;\n height: 22px;\n border-radius: 6px;\n background: var(--fb-color-accent);\n flex: none;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.fb-ob-mark::after {\n content: \"\";\n width: 7px;\n height: 7px;\n border-radius: 2px;\n background: #fff;\n}\n.fb-ob-brand { font-size: 15px; font-weight: 600; color: var(--fb-color-ink); }\n.fb-ob-chip {\n margin-left: auto;\n font-family: var(--fb-font-mono);\n font-size: 10px;\n color: #8a97a3;\n border: 1px solid var(--fb-color-border-soft);\n border-radius: 6px;\n padding: 2px 7px;\n}\n\n.fb-ob-body { padding: 16px 24px 8px; }\n.fb-ob-title {\n font-size: 19px;\n font-weight: 700;\n color: var(--fb-color-ink);\n letter-spacing: -0.01em;\n}\n.fb-ob-lede {\n font-size: 13.5px;\n color: var(--fb-color-muted);\n line-height: 1.5;\n margin: 7px 0 0;\n}\n.fb-ob-lede strong { color: var(--fb-color-text); }\n\n.fb-ob-card {\n margin: 16px 0;\n padding: 13px 14px;\n background: var(--fb-color-card);\n border: 1px solid var(--fb-color-border-soft);\n border-radius: 10px;\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n.fb-ob-row { display: flex; align-items: center; gap: 10px; }\n.fb-ob-row + .fb-ob-row {\n border-top: 1px solid #eef2f6;\n padding-top: 10px;\n}\n.fb-ob-rowlabel {\n font-family: var(--fb-font-mono);\n font-size: 10px;\n color: var(--fb-color-faint);\n width: 70px;\n flex: none;\n}\n.fb-ob-site { font-size: 13px; color: var(--fb-color-text); font-weight: 500; }\n.fb-ob-tier {\n font-size: 11px;\n font-weight: 600;\n color: var(--fb-color-accent);\n background: var(--fb-color-accent-bg);\n padding: 3px 9px;\n border-radius: 6px;\n}\n.fb-ob-tiernote { font-size: 11.5px; color: #8a97a3; }\n\n.fb-ob-fieldlabel {\n display: block;\n font-family: var(--fb-font-mono);\n font-size: 10px;\n letter-spacing: 0.05em;\n text-transform: uppercase;\n color: var(--fb-color-faint);\n margin-bottom: 6px;\n}\n.fb-ob-fields { display: flex; gap: 8px; }\n.fb-ob-input {\n height: 38px;\n padding: 0 12px;\n border: 1px solid var(--fb-color-border);\n border-radius: 9px;\n font-family: inherit;\n font-size: 13px;\n color: var(--fb-color-text);\n outline: none;\n min-width: 0;\n}\n.fb-ob-input:focus { border-color: var(--fb-color-accent); }\n.fb-ob-name { flex: 1; }\n.fb-ob-email { flex: 1.3; font-family: var(--fb-font-mono); font-size: 12.5px; color: var(--fb-color-muted); }\n\n.fb-ob-privacy {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n margin-top: 14px;\n font-size: 11.5px;\n color: #8a97a3;\n line-height: 1.5;\n}\n.fb-ob-privacy svg { flex: none; margin-top: 1px; }\n.fb-ob-privacy strong { color: var(--fb-color-muted); }\n\n.fb-ob-foot { padding: 16px 24px 22px; }\n.fb-ob-confirm {\n width: 100%;\n height: 44px;\n border: 0;\n border-radius: 11px;\n background: var(--fb-color-accent);\n color: var(--fb-color-on-emphasis);\n font-family: inherit;\n font-size: 14px;\n font-weight: 600;\n cursor: pointer;\n}\n.fb-ob-confirm:hover { background: var(--fb-color-accent-hover); }\n.fb-ob-confirm:disabled { opacity: 0.6; cursor: default; }\n\n@keyframes fb-ob-fade { from { opacity: 0; } to { opacity: 1; } }\n@keyframes fb-ob-pop {\n from { opacity: 0; transform: translateY(8px) scale(0.98); }\n to { opacity: 1; transform: none; }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fb-ob-backdrop, .fb-ob-panel { animation: none; }\n}\n";
|
package/dist/onboarding.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The invite onboarding modal (spec §F) — the SDK-rendered redemption screen an
|
|
3
|
-
* invited tester sees when a page carries an invite token. It shows the site
|
|
4
|
-
* they were invited to, the **server-derived** access tier the redemption grants,
|
|
5
|
-
* a private-by-default note, and a "Continue as" name / email, then confirms.
|
|
6
|
-
*
|
|
7
|
-
* Built to the frozen Signal Reporter prototype
|
|
8
|
-
* (`docs/design/Fixback Reporter.dc.html`). It mounts lazily inside its own open
|
|
9
|
-
* Shadow DOM so the host page is fully isolated, and — like the launcher and
|
|
10
|
-
* overlay — never throws into the host page. It renders only data the SDK
|
|
11
|
-
* truthfully holds: the site's own origin and the server-derived tier. The name /
|
|
12
|
-
* email are **self-provided display fields**, never a trust signal (§F).
|
|
13
|
-
*/
|
|
14
|
-
import type { ReporterTier } from "./boot";
|
|
15
|
-
import type { ReporterDisplay } from "./invite";
|
|
16
|
-
/** Marks the modal's host element in the light DOM, so it is findable and unique. */
|
|
17
|
-
export declare const ONBOARDING_ATTRIBUTE = "data-fixback-onboard";
|
|
18
|
-
/** Configuration for {@link createOnboardingModal}. */
|
|
19
|
-
export interface OnboardingConfig {
|
|
20
|
-
/** The site the tester was invited to — its origin (`window.location.host`). */
|
|
21
|
-
readonly origin: string;
|
|
22
|
-
/** The **server-derived** tier the redemption grants (from the invite status). */
|
|
23
|
-
readonly tier: ReporterTier;
|
|
24
|
-
/** Prefill the Continue-as fields from a previously stored display identity. */
|
|
25
|
-
readonly defaults?: ReporterDisplay;
|
|
26
|
-
/** Called with the self-provided display fields when the tester confirms. */
|
|
27
|
-
readonly onConfirm: (display: ReporterDisplay) => void;
|
|
28
|
-
/** Where to mount the modal host. Defaults to `document.body`. */
|
|
29
|
-
readonly target?: HTMLElement;
|
|
30
|
-
/** The document to build in. Defaults to the target's owner document. */
|
|
31
|
-
readonly doc?: Document;
|
|
32
|
-
}
|
|
33
|
-
/** A mounted onboarding modal. */
|
|
34
|
-
export interface OnboardingModal {
|
|
35
|
-
destroy(): void;
|
|
36
|
-
readonly host: HTMLElement;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Render the onboarding modal into `target` (default `document.body`) and return a
|
|
40
|
-
* handle to remove it. Confirming reads the name / email, fires `onConfirm` once
|
|
41
|
-
* (further clicks are ignored while the caller redeems), and leaves teardown to
|
|
42
|
-
* the caller so it can strip the token and mount the launcher first.
|
|
43
|
-
*/
|
|
44
|
-
export declare function createOnboardingModal(config: OnboardingConfig): OnboardingModal;
|
package/dist/screenshot.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side masked screenshot capture (spec MVP §E; ticket #54; ADR-0014).
|
|
3
|
-
*
|
|
4
|
-
* The capture is **private-by-default**: input values are masked and the SDK's own
|
|
5
|
-
* UI is excluded from a *clone* of the view **before** anything is rasterised, so no
|
|
6
|
-
* unmasked text and none of Fixback's chrome ever reaches the image.
|
|
7
|
-
*
|
|
8
|
-
* The rasterisation itself is delegated to `modern-screenshot` (ADR-0014): it clones
|
|
9
|
-
* the target, inlines the page's real styles **and** its fonts and images as data
|
|
10
|
-
* URIs, then draws the result through an SVG `<foreignObject>` onto a `<canvas>`.
|
|
11
|
-
* That closes the fidelity gap a hand-rolled `<foreignObject>` left open — external
|
|
12
|
-
* stylesheets, web fonts, and same-origin images now render — so the shot matches
|
|
13
|
-
* what the Reporter saw and lines up with the annotation's viewport-space marks.
|
|
14
|
-
*
|
|
15
|
-
* We keep the privacy guarantee by driving it through two of its hooks: `filter`
|
|
16
|
-
* drops Fixback's own host elements, and `onCloneNode` masks the clone's inputs —
|
|
17
|
-
* both run on the library's internal clone, before it embeds or serialises anything,
|
|
18
|
-
* so the live page is never touched and no real value reaches the raster. The backend
|
|
19
|
-
* is injectable so the pipeline (and the masking-before-capture guarantee) is testable
|
|
20
|
-
* without a real canvas, and it fails quietly: any problem resolves to `null` and the
|
|
21
|
-
* report is simply sent without a screenshot.
|
|
22
|
-
*/
|
|
23
|
-
/** The character private input content is replaced with. */
|
|
24
|
-
export declare const MASK_CHAR = "\u2022";
|
|
25
|
-
/**
|
|
26
|
-
* Mask the private, user-entered content in a subtree: text `input` values,
|
|
27
|
-
* `textarea` content, and `contenteditable` text. Developer-authored text
|
|
28
|
-
* (placeholders, button labels, non-text controls) is left untouched. Operates in
|
|
29
|
-
* place — call it on a *clone* of the view, never the live page.
|
|
30
|
-
*/
|
|
31
|
-
export declare function maskInputs(root: ParentNode): void;
|
|
32
|
-
/** A captured screenshot: the image bytes plus its dimensions and content type. */
|
|
33
|
-
export interface Capture {
|
|
34
|
-
readonly blob: Blob;
|
|
35
|
-
readonly width: number;
|
|
36
|
-
readonly height: number;
|
|
37
|
-
readonly type: string;
|
|
38
|
-
}
|
|
39
|
-
/** The screenshot filename extension for a {@link Capture}'s content type (defaults to `png`). */
|
|
40
|
-
export declare function extensionFor(type: string): string;
|
|
41
|
-
/** How the SDK prepares a capture: exclude Fixback's UI, mask the clone's inputs. */
|
|
42
|
-
interface CaptureHooks {
|
|
43
|
-
/** Keep a node in the shot? Returns `false` for Fixback's own host elements. */
|
|
44
|
-
readonly filter: (node: Node) => boolean;
|
|
45
|
-
/** Mask private input content on the library's internal clone, pre-raster. */
|
|
46
|
-
readonly onCloneNode: (clone: Node) => void;
|
|
47
|
-
}
|
|
48
|
-
/** Turns a DOM subtree into image bytes at a given size (injectable for tests). */
|
|
49
|
-
export type CaptureBackend = (target: Element, meta: {
|
|
50
|
-
width: number;
|
|
51
|
-
height: number;
|
|
52
|
-
type: string;
|
|
53
|
-
} & CaptureHooks) => Promise<Blob | null>;
|
|
54
|
-
/** Options for {@link captureView}. */
|
|
55
|
-
export interface CaptureOptions {
|
|
56
|
-
/** The element to capture. Defaults to the document element (the full view). */
|
|
57
|
-
readonly target?: Element;
|
|
58
|
-
readonly doc?: Document;
|
|
59
|
-
readonly win?: Window;
|
|
60
|
-
/** Output content type. Defaults to `image/png`. */
|
|
61
|
-
readonly type?: string;
|
|
62
|
-
/** Override the raster backend (the default is `modern-screenshot`). */
|
|
63
|
-
readonly capture?: CaptureBackend;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Capture the current view as a masked screenshot. Delegates the raster to the
|
|
67
|
-
* backend ({@link captureViaModernScreenshot} by default), which excludes the SDK's
|
|
68
|
-
* own UI and masks input values on its internal clone — **before** it embeds or
|
|
69
|
-
* serialises anything — then returns the image bytes, or `null` if capture wasn't
|
|
70
|
-
* possible.
|
|
71
|
-
*/
|
|
72
|
-
export declare function captureView(options?: CaptureOptions): Promise<Capture | null>;
|
|
73
|
-
export {};
|
package/dist/scrub.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The single client-side **scrub choke point** every report passes through
|
|
3
|
-
* before transport (spec 0003 §C; research `sentry-error-capture-findings.md`
|
|
4
|
-
* §7.4) — the SDK's `beforeSend` equivalent.
|
|
5
|
-
*
|
|
6
|
-
* Masking is the SDK's job, done in the browser before anything leaves the page.
|
|
7
|
-
* The screenshot is masked at capture, and breadcrumbs never record a value or a
|
|
8
|
-
* body at the source; `runBeforeSend` is the **last** gate over the assembled
|
|
9
|
-
* report. Its default scrubbers are **on**: they strip credentials, query
|
|
10
|
-
* strings, and bearer tokens from URLs, and redact obvious PII (emails, long
|
|
11
|
-
* digit runs, bearer tokens) from crumb and error text. The result is then handed
|
|
12
|
-
* to an optional per-project hook that can mutate it further or drop the whole
|
|
13
|
-
* report by returning `null`.
|
|
14
|
-
*
|
|
15
|
-
* The hook is **synchronous and network-free** by contract, and both manual
|
|
16
|
-
* (overlay) and automatic (error-capture) reports run through the very same
|
|
17
|
-
* choke point. A project relaxes the defaults with `scrub: false`, or reshapes
|
|
18
|
-
* the draft in its own hook — never a silent raw send.
|
|
19
|
-
*/
|
|
20
|
-
import type { ReportContent } from "./report";
|
|
21
|
-
/** The per-project client scrub hook. Return `null` to drop the whole report. */
|
|
22
|
-
export type BeforeSend = (draft: ReportContent) => ReportContent | null;
|
|
23
|
-
/** Options for {@link runBeforeSend}. */
|
|
24
|
-
export interface BeforeSendOptions {
|
|
25
|
-
/** The per-project hook, run **after** the default scrubbers. */
|
|
26
|
-
readonly hook?: BeforeSend | null;
|
|
27
|
-
/** Run the built-in default scrubbers first. Defaults to `true`. */
|
|
28
|
-
readonly scrub?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Redact obvious PII from free text: email addresses, `Bearer <token>` /
|
|
32
|
-
* `token <value>` pairs, and long digit runs. Conservative by design — it keeps
|
|
33
|
-
* the shape of the message readable while removing the sensitive spans.
|
|
34
|
-
*/
|
|
35
|
-
export declare function redactPii(text: string): string;
|
|
36
|
-
/**
|
|
37
|
-
* Strip the sensitive parts of a URL: userinfo credentials
|
|
38
|
-
* (`scheme://user:pass@host`), the entire query string, a token-bearing
|
|
39
|
-
* fragment (one that carries `key=value`), and PII (emails, long digit runs) in
|
|
40
|
-
* the **path segments** (#139). Plain hash routes (`#/checkout`) are kept. Works
|
|
41
|
-
* on absolute and relative URLs alike, with no dependency and no throw. The host
|
|
42
|
-
* (authority) is never redacted — only the path and any surviving fragment route.
|
|
43
|
-
*/
|
|
44
|
-
export declare function scrubUrl(url: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* Apply the built-in default scrubbers to a report draft: strip the page URL,
|
|
47
|
-
* and scrub every crumb's URLs and redact PII from its text. The Reporter's own
|
|
48
|
-
* `comment` is intentionally left untouched — it is authored on purpose, not
|
|
49
|
-
* scraped. The screenshot and input values are masked elsewhere (at capture and
|
|
50
|
-
* at crumb creation); this is the final URL/PII sweep.
|
|
51
|
-
*/
|
|
52
|
-
export declare function applyDefaultScrub(draft: ReportContent): ReportContent;
|
|
53
|
-
/**
|
|
54
|
-
* Run the report draft through the client scrub choke point: the default
|
|
55
|
-
* scrubbers first (unless `scrub` is `false`), then the optional per-project
|
|
56
|
-
* hook. Returns the scrubbed (and possibly hook-mutated) draft, or `null` when
|
|
57
|
-
* the hook drops the report. A hook that throws is treated as a no-op — the
|
|
58
|
-
* already-scrubbed draft is kept, so a buggy hook never breaks the report path
|
|
59
|
-
* nor leaks unscrubbed data.
|
|
60
|
-
*/
|
|
61
|
-
export declare function runBeforeSend(draft: ReportContent, options?: BeforeSendOptions): ReportContent | null;
|