@seaproof/core 0.1.0-beta.1 → 0.1.0-beta.2
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 +25 -1
- package/dist/index.cjs +468 -25
- package/dist/index.d.cts +165 -4
- package/dist/index.d.ts +165 -4
- package/dist/index.js +460 -25
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -80,6 +80,16 @@ interface FeedbackContext {
|
|
|
80
80
|
commit?: string;
|
|
81
81
|
/** Free-form metadata, for example a build number or feature flags. Strings only. */
|
|
82
82
|
custom?: Record<string, string>;
|
|
83
|
+
/** Set by the SDK: the page load the report or error comes from, which links the two. */
|
|
84
|
+
sessionId?: string;
|
|
85
|
+
}
|
|
86
|
+
interface CaptureExceptionOptions {
|
|
87
|
+
/** False for an error the app did not catch itself. Default true. */
|
|
88
|
+
handled?: boolean;
|
|
89
|
+
/** Your own key for which errors are the same problem, instead of grouping by the stack. */
|
|
90
|
+
fingerprint?: string;
|
|
91
|
+
/** Extra context for this error, merged over the client's. */
|
|
92
|
+
context?: FeedbackContext;
|
|
83
93
|
}
|
|
84
94
|
interface AttachmentInput {
|
|
85
95
|
kind: AttachmentKind;
|
|
@@ -96,6 +106,28 @@ interface FeedbackInput {
|
|
|
96
106
|
attachments?: AttachmentInput[];
|
|
97
107
|
/** The known problem or public idea this is about, from `suggest()`: the team sees the link. */
|
|
98
108
|
linkedTo?: string;
|
|
109
|
+
/**
|
|
110
|
+
* The signed-in tester chose Do it now: a small, clear change may skip triage (fast track). Only
|
|
111
|
+
* sent when {@link canFastTrackType} allows the report's type; the project's rules decide what happens.
|
|
112
|
+
*/
|
|
113
|
+
doItNow?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The person signed in as a tester in a test environment, whatever account the app itself uses.
|
|
117
|
+
* Their group decides what the team's AI agents may do with their reports.
|
|
118
|
+
*/
|
|
119
|
+
interface Tester {
|
|
120
|
+
email: string;
|
|
121
|
+
name: string | null;
|
|
122
|
+
/** The team's name for their group, such as `Testers` or `Decision makers`. */
|
|
123
|
+
group: string;
|
|
124
|
+
/** The widget offers Do it now for some type: their group may skip triage and the project has fast track on. */
|
|
125
|
+
canFastTrack: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* The types the widget offers Do it now for, such as `bug`. Missing from older Seaproof servers,
|
|
128
|
+
* where {@link Tester.canFastTrack} covers every type but questions.
|
|
129
|
+
*/
|
|
130
|
+
fastTrackTypes?: FeedbackType[];
|
|
99
131
|
}
|
|
100
132
|
interface SubmittedFeedback {
|
|
101
133
|
id: string;
|
|
@@ -116,6 +148,8 @@ interface SeaproofProject {
|
|
|
116
148
|
branding?: SeaproofBranding;
|
|
117
149
|
/** The built-in feedback button's project settings. Null or absent uses SDK defaults. */
|
|
118
150
|
launcher?: SeaproofLauncherSettings | null;
|
|
151
|
+
/** Whether the widget shows "Powered by Seaproof"; the plan decides. Absent from older APIs: not shown. */
|
|
152
|
+
showPoweredBy?: boolean;
|
|
119
153
|
}
|
|
120
154
|
type LauncherPosition = "top-left" | "middle-left" | "bottom-left" | "top-right" | "middle-right" | "bottom-right";
|
|
121
155
|
interface SeaproofLauncherSettings {
|
|
@@ -160,7 +194,13 @@ interface SeaproofOptions {
|
|
|
160
194
|
diagnostics?: CaptureOptions | false;
|
|
161
195
|
/** Attach the diagnostics to reports. Default: only in tester mode. */
|
|
162
196
|
includeDiagnostics?: boolean;
|
|
163
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* Send uncaught errors and `captureException` calls to the Errors page, grouped by problem and
|
|
199
|
+
* linked to reports from the same page load. Default: on for keys in a test-mode environment,
|
|
200
|
+
* off in production unless you set it. Until the environment is known, errors wait.
|
|
201
|
+
*/
|
|
202
|
+
reportErrors?: boolean;
|
|
203
|
+
/** @deprecated Use `reportErrors`. Errors now go to the Errors page instead of the inbox. */
|
|
164
204
|
reportCrashes?: boolean;
|
|
165
205
|
/** Where the reporter key and read markers are kept. Default: `localStorage`, or memory when it is unavailable. */
|
|
166
206
|
storage?: KeyValueStorage;
|
|
@@ -272,6 +312,11 @@ interface SeaproofClient {
|
|
|
272
312
|
readonly branding: SeaproofBranding | undefined;
|
|
273
313
|
/** The project's built-in button settings, once known. */
|
|
274
314
|
readonly launcher?: SeaproofLauncherSettings | null | undefined;
|
|
315
|
+
/**
|
|
316
|
+
* Whether the widget shows "Powered by Seaproof". The organization's plan decides it on the
|
|
317
|
+
* server; false until the project is known, so a plan without it never sees it flash.
|
|
318
|
+
*/
|
|
319
|
+
readonly showPoweredBy?: boolean;
|
|
275
320
|
/**
|
|
276
321
|
* Sets the signed-in user, or null on sign-out. Used for submissions without their own
|
|
277
322
|
* reporter, and, with a `userHash`, to share conversations and votes across devices.
|
|
@@ -283,6 +328,16 @@ interface SeaproofClient {
|
|
|
283
328
|
readonly diagnostics: Diagnostics;
|
|
284
329
|
/** Adds a line to the diagnostics. */
|
|
285
330
|
log(message: string): void;
|
|
331
|
+
/**
|
|
332
|
+
* Made when the page loads and sent with every report and error, so the Errors page links a
|
|
333
|
+
* report to the errors that happened around it.
|
|
334
|
+
*/
|
|
335
|
+
readonly sessionId: string;
|
|
336
|
+
/**
|
|
337
|
+
* Sends an error the app caught to the Errors page. Follows `reportErrors`: by default only from
|
|
338
|
+
* keys in a test-mode environment.
|
|
339
|
+
*/
|
|
340
|
+
captureException(error: unknown, options?: CaptureExceptionOptions): void;
|
|
286
341
|
/** Called when the environment becomes known. Returns an unsubscribe function. */
|
|
287
342
|
subscribe(listener: () => void): () => void;
|
|
288
343
|
/** Feedback sent from this browser, with the team's replies counted. */
|
|
@@ -314,6 +369,17 @@ interface SeaproofClient {
|
|
|
314
369
|
review(type: NonNullable<FeedbackInput["type"]>, description: string, conversationId?: string, feedbackId?: string): Promise<ReviewResult>;
|
|
315
370
|
/** Records the question before showing it in the widget. */
|
|
316
371
|
recordAssistQuestion?(feedbackId: string, receipt: string): Promise<boolean>;
|
|
372
|
+
/** The signed-in tester, in test environments only; undefined when nobody is signed in. */
|
|
373
|
+
readonly tester?: Tester | undefined;
|
|
374
|
+
/**
|
|
375
|
+
* Sends a six-digit sign-in code to a tester's e-mail address. Resolves the same whether or not
|
|
376
|
+
* the address may sign in, so it never tells who is known. Test environments only.
|
|
377
|
+
*/
|
|
378
|
+
requestTesterCode?(email: string): Promise<void>;
|
|
379
|
+
/** Signs the tester in with the code; the session lasts 30 days in this browser. */
|
|
380
|
+
signInTester?(email: string, code: string): Promise<Tester>;
|
|
381
|
+
/** Ends the tester session in this browser. */
|
|
382
|
+
signOutTester?(): Promise<void>;
|
|
317
383
|
/** Stops capturing and restores console, fetch and XMLHttpRequest. */
|
|
318
384
|
dispose(): void;
|
|
319
385
|
}
|
|
@@ -324,6 +390,31 @@ declare function createSeaproof(options: SeaproofOptions): SeaproofClient;
|
|
|
324
390
|
/** Context the browser can tell us without asking anyone. */
|
|
325
391
|
declare function browserContext(): FeedbackContext;
|
|
326
392
|
|
|
393
|
+
/** Whether a signed-in tester may ask Do it now for a report of this type; never for questions. */
|
|
394
|
+
declare function canFastTrackType(tester: Tester | undefined, type: FeedbackType): boolean;
|
|
395
|
+
|
|
396
|
+
/** One error as `POST /api/v1/sdk/errors` takes it (docs/error-tracking.md). */
|
|
397
|
+
interface ErrorEventPayload {
|
|
398
|
+
/** Made here, so a batch sent again is stored once. */
|
|
399
|
+
id: string;
|
|
400
|
+
occurredAt: string;
|
|
401
|
+
type: string;
|
|
402
|
+
message: string;
|
|
403
|
+
stack?: string;
|
|
404
|
+
handled: boolean;
|
|
405
|
+
sessionId: string;
|
|
406
|
+
fingerprint?: string;
|
|
407
|
+
context: FeedbackContext;
|
|
408
|
+
breadcrumbs: Breadcrumb[];
|
|
409
|
+
}
|
|
410
|
+
/** What happened just before the error: console lines, requests and the app's own log lines. */
|
|
411
|
+
interface Breadcrumb {
|
|
412
|
+
at: string;
|
|
413
|
+
kind: string;
|
|
414
|
+
message: string;
|
|
415
|
+
level?: string;
|
|
416
|
+
}
|
|
417
|
+
|
|
327
418
|
/** Where every API error code is explained, with how to fix it. */
|
|
328
419
|
declare const ERROR_REFERENCE_URL = "https://seaproof.io/docs/errors";
|
|
329
420
|
/** A failed call to the Seaproof API. `code` is the API's stable error code, e.g. `feedback.description_invalid`. */
|
|
@@ -399,6 +490,68 @@ declare class ReporterIdentity {
|
|
|
399
490
|
/** `localStorage` when the page may use it (not in some private modes or sandboxed frames), otherwise memory. */
|
|
400
491
|
declare function defaultStorage(): KeyValueStorage;
|
|
401
492
|
|
|
493
|
+
/** A box in viewport pixels (CSS pixels, relative to the top-left of the window). */
|
|
494
|
+
interface Box {
|
|
495
|
+
x: number;
|
|
496
|
+
y: number;
|
|
497
|
+
width: number;
|
|
498
|
+
height: number;
|
|
499
|
+
}
|
|
500
|
+
/** What the user pointed at: the element's box and how to name it, or only the spot. */
|
|
501
|
+
interface PointedElement {
|
|
502
|
+
box: Box;
|
|
503
|
+
/** "Button", "Link", "Field"… or null when the element has no clear role. */
|
|
504
|
+
role: string | null;
|
|
505
|
+
/** Its accessible name, or null when it has none or is masked. Typed values are never read. */
|
|
506
|
+
name: string | null;
|
|
507
|
+
}
|
|
508
|
+
/** One pin, numbered from 1 in the order it was placed. */
|
|
509
|
+
interface Pin {
|
|
510
|
+
number: number;
|
|
511
|
+
/** Where the user tapped, in viewport pixels. */
|
|
512
|
+
x: number;
|
|
513
|
+
y: number;
|
|
514
|
+
element: PointedElement | null;
|
|
515
|
+
/** What the user wrote at the pin, if anything. Drawn next to it in the screenshot. */
|
|
516
|
+
note?: string | null;
|
|
517
|
+
/**
|
|
518
|
+
* Where the user moved the note so it covers nothing: its top-left corner, in viewport pixels.
|
|
519
|
+
* Without it the note sits beside the pin's number.
|
|
520
|
+
*/
|
|
521
|
+
notePosition?: {
|
|
522
|
+
x: number;
|
|
523
|
+
y: number;
|
|
524
|
+
} | null;
|
|
525
|
+
}
|
|
526
|
+
/** How the screenshot maps to the viewport: image pixel = (viewport pixel − origin) × scale. */
|
|
527
|
+
interface ScreenshotFrame {
|
|
528
|
+
originX: number;
|
|
529
|
+
originY: number;
|
|
530
|
+
scale: number;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* The element under a point, skipping the widget itself (`data-seaproof-ignore`). Prefers the
|
|
534
|
+
* closest interactive element (a button rather than the icon inside it); a large container counts
|
|
535
|
+
* as "no element", so the pin marks the spot instead of outlining half the page.
|
|
536
|
+
*/
|
|
537
|
+
declare function elementAt(x: number, y: number, doc?: Document): PointedElement | null;
|
|
538
|
+
/** The role and accessible name of an element, as a person would say it. */
|
|
539
|
+
declare function describeElement(el: Element): {
|
|
540
|
+
role: string | null;
|
|
541
|
+
name: string | null;
|
|
542
|
+
};
|
|
543
|
+
/** `Button "Pay 349 kr"`, `Image`, `"Shipping"` or null. */
|
|
544
|
+
declare function pinLabel(element: PointedElement | null): string | null;
|
|
545
|
+
/** The text that tells the team what the pins point at, one line per pin, with what was written there. */
|
|
546
|
+
declare function pinMessage(pins: readonly Pin[]): string;
|
|
547
|
+
/**
|
|
548
|
+
* Draws numbered pins, and an outline around each element, into a screenshot. The result has the
|
|
549
|
+
* screenshot's full size, like a marked-up screenshot from the annotator.
|
|
550
|
+
*/
|
|
551
|
+
declare function drawPins(screenshot: Blob, pins: readonly Pin[], frame: ScreenshotFrame): Promise<Blob>;
|
|
552
|
+
/** The point of a rectangle closest to (px, py): where a line from a pin meets its note. */
|
|
553
|
+
declare function nearestPoint(px: number, py: number, x: number, y: number, width: number, height: number): [number, number];
|
|
554
|
+
|
|
402
555
|
/** Whether a node is left out of screenshots: the widget itself, masked elements and password fields. */
|
|
403
556
|
declare function excludedFromScreenshot(node: Node): boolean;
|
|
404
557
|
/**
|
|
@@ -407,8 +560,16 @@ declare function excludedFromScreenshot(node: Node): boolean;
|
|
|
407
560
|
* leaves the browser. Password fields are always left out.
|
|
408
561
|
*/
|
|
409
562
|
declare function captureScreenshot(element?: HTMLElement): Promise<Blob>;
|
|
563
|
+
/**
|
|
564
|
+
* Like {@link captureScreenshot}, and also says where the image sits in the window, so a point
|
|
565
|
+
* on the screen (such as a pin) can be drawn at the same place in the image.
|
|
566
|
+
*/
|
|
567
|
+
declare function captureScreenshotWithFrame(element?: HTMLElement): Promise<{
|
|
568
|
+
file: Blob;
|
|
569
|
+
frame: ScreenshotFrame;
|
|
570
|
+
}>;
|
|
410
571
|
|
|
411
|
-
declare const SDK_VERSION = "0.1.0-beta.
|
|
572
|
+
declare const SDK_VERSION = "0.1.0-beta.2";
|
|
412
573
|
|
|
413
|
-
export { Diagnostics, ERROR_REFERENCE_URL, ReporterIdentity, SDK_VERSION, ScreenRecorder, SeaproofError, browserContext, canRecordScreen, captureScreenshot, createSeaproof, defaultStorage, describeError, excludedFromScreenshot, installCapture, newConversationId, redactUrl };
|
|
414
|
-
export type { AssistSettings, AttachmentInput, AttachmentKind, CaptureOptions, ConversationMessage, DiagnosticEntry, DiagnosticKind, Environment, EnvironmentMode, FeedbackContext, FeedbackInput, FeedbackSeverity, FeedbackType, KeyValueStorage, LauncherPosition, OwnFeedback, OwnFeedbackDetail, PublicIdea, PublicStatus, RecorderOptions, Reporter, ReporterAttachment, ReviewResult, ScreenRecording, SeaproofBranding, SeaproofClient, SeaproofLauncherSettings, SeaproofMode, SeaproofOptions, SeaproofProject, SubmittedFeedback, Suggestion };
|
|
574
|
+
export { Diagnostics, ERROR_REFERENCE_URL, ReporterIdentity, SDK_VERSION, ScreenRecorder, SeaproofError, browserContext, canFastTrackType, canRecordScreen, captureScreenshot, captureScreenshotWithFrame, createSeaproof, defaultStorage, describeElement, describeError, drawPins, elementAt, excludedFromScreenshot, installCapture, nearestPoint, newConversationId, pinLabel, pinMessage, redactUrl };
|
|
575
|
+
export type { AssistSettings, AttachmentInput, AttachmentKind, Box, Breadcrumb, CaptureExceptionOptions, CaptureOptions, ConversationMessage, DiagnosticEntry, DiagnosticKind, Environment, EnvironmentMode, ErrorEventPayload, FeedbackContext, FeedbackInput, FeedbackSeverity, FeedbackType, KeyValueStorage, LauncherPosition, OwnFeedback, OwnFeedbackDetail, Pin, PointedElement, PublicIdea, PublicStatus, RecorderOptions, Reporter, ReporterAttachment, ReviewResult, ScreenRecording, ScreenshotFrame, SeaproofBranding, SeaproofClient, SeaproofLauncherSettings, SeaproofMode, SeaproofOptions, SeaproofProject, SubmittedFeedback, Suggestion, Tester };
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,16 @@ interface FeedbackContext {
|
|
|
80
80
|
commit?: string;
|
|
81
81
|
/** Free-form metadata, for example a build number or feature flags. Strings only. */
|
|
82
82
|
custom?: Record<string, string>;
|
|
83
|
+
/** Set by the SDK: the page load the report or error comes from, which links the two. */
|
|
84
|
+
sessionId?: string;
|
|
85
|
+
}
|
|
86
|
+
interface CaptureExceptionOptions {
|
|
87
|
+
/** False for an error the app did not catch itself. Default true. */
|
|
88
|
+
handled?: boolean;
|
|
89
|
+
/** Your own key for which errors are the same problem, instead of grouping by the stack. */
|
|
90
|
+
fingerprint?: string;
|
|
91
|
+
/** Extra context for this error, merged over the client's. */
|
|
92
|
+
context?: FeedbackContext;
|
|
83
93
|
}
|
|
84
94
|
interface AttachmentInput {
|
|
85
95
|
kind: AttachmentKind;
|
|
@@ -96,6 +106,28 @@ interface FeedbackInput {
|
|
|
96
106
|
attachments?: AttachmentInput[];
|
|
97
107
|
/** The known problem or public idea this is about, from `suggest()`: the team sees the link. */
|
|
98
108
|
linkedTo?: string;
|
|
109
|
+
/**
|
|
110
|
+
* The signed-in tester chose Do it now: a small, clear change may skip triage (fast track). Only
|
|
111
|
+
* sent when {@link canFastTrackType} allows the report's type; the project's rules decide what happens.
|
|
112
|
+
*/
|
|
113
|
+
doItNow?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The person signed in as a tester in a test environment, whatever account the app itself uses.
|
|
117
|
+
* Their group decides what the team's AI agents may do with their reports.
|
|
118
|
+
*/
|
|
119
|
+
interface Tester {
|
|
120
|
+
email: string;
|
|
121
|
+
name: string | null;
|
|
122
|
+
/** The team's name for their group, such as `Testers` or `Decision makers`. */
|
|
123
|
+
group: string;
|
|
124
|
+
/** The widget offers Do it now for some type: their group may skip triage and the project has fast track on. */
|
|
125
|
+
canFastTrack: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* The types the widget offers Do it now for, such as `bug`. Missing from older Seaproof servers,
|
|
128
|
+
* where {@link Tester.canFastTrack} covers every type but questions.
|
|
129
|
+
*/
|
|
130
|
+
fastTrackTypes?: FeedbackType[];
|
|
99
131
|
}
|
|
100
132
|
interface SubmittedFeedback {
|
|
101
133
|
id: string;
|
|
@@ -116,6 +148,8 @@ interface SeaproofProject {
|
|
|
116
148
|
branding?: SeaproofBranding;
|
|
117
149
|
/** The built-in feedback button's project settings. Null or absent uses SDK defaults. */
|
|
118
150
|
launcher?: SeaproofLauncherSettings | null;
|
|
151
|
+
/** Whether the widget shows "Powered by Seaproof"; the plan decides. Absent from older APIs: not shown. */
|
|
152
|
+
showPoweredBy?: boolean;
|
|
119
153
|
}
|
|
120
154
|
type LauncherPosition = "top-left" | "middle-left" | "bottom-left" | "top-right" | "middle-right" | "bottom-right";
|
|
121
155
|
interface SeaproofLauncherSettings {
|
|
@@ -160,7 +194,13 @@ interface SeaproofOptions {
|
|
|
160
194
|
diagnostics?: CaptureOptions | false;
|
|
161
195
|
/** Attach the diagnostics to reports. Default: only in tester mode. */
|
|
162
196
|
includeDiagnostics?: boolean;
|
|
163
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* Send uncaught errors and `captureException` calls to the Errors page, grouped by problem and
|
|
199
|
+
* linked to reports from the same page load. Default: on for keys in a test-mode environment,
|
|
200
|
+
* off in production unless you set it. Until the environment is known, errors wait.
|
|
201
|
+
*/
|
|
202
|
+
reportErrors?: boolean;
|
|
203
|
+
/** @deprecated Use `reportErrors`. Errors now go to the Errors page instead of the inbox. */
|
|
164
204
|
reportCrashes?: boolean;
|
|
165
205
|
/** Where the reporter key and read markers are kept. Default: `localStorage`, or memory when it is unavailable. */
|
|
166
206
|
storage?: KeyValueStorage;
|
|
@@ -272,6 +312,11 @@ interface SeaproofClient {
|
|
|
272
312
|
readonly branding: SeaproofBranding | undefined;
|
|
273
313
|
/** The project's built-in button settings, once known. */
|
|
274
314
|
readonly launcher?: SeaproofLauncherSettings | null | undefined;
|
|
315
|
+
/**
|
|
316
|
+
* Whether the widget shows "Powered by Seaproof". The organization's plan decides it on the
|
|
317
|
+
* server; false until the project is known, so a plan without it never sees it flash.
|
|
318
|
+
*/
|
|
319
|
+
readonly showPoweredBy?: boolean;
|
|
275
320
|
/**
|
|
276
321
|
* Sets the signed-in user, or null on sign-out. Used for submissions without their own
|
|
277
322
|
* reporter, and, with a `userHash`, to share conversations and votes across devices.
|
|
@@ -283,6 +328,16 @@ interface SeaproofClient {
|
|
|
283
328
|
readonly diagnostics: Diagnostics;
|
|
284
329
|
/** Adds a line to the diagnostics. */
|
|
285
330
|
log(message: string): void;
|
|
331
|
+
/**
|
|
332
|
+
* Made when the page loads and sent with every report and error, so the Errors page links a
|
|
333
|
+
* report to the errors that happened around it.
|
|
334
|
+
*/
|
|
335
|
+
readonly sessionId: string;
|
|
336
|
+
/**
|
|
337
|
+
* Sends an error the app caught to the Errors page. Follows `reportErrors`: by default only from
|
|
338
|
+
* keys in a test-mode environment.
|
|
339
|
+
*/
|
|
340
|
+
captureException(error: unknown, options?: CaptureExceptionOptions): void;
|
|
286
341
|
/** Called when the environment becomes known. Returns an unsubscribe function. */
|
|
287
342
|
subscribe(listener: () => void): () => void;
|
|
288
343
|
/** Feedback sent from this browser, with the team's replies counted. */
|
|
@@ -314,6 +369,17 @@ interface SeaproofClient {
|
|
|
314
369
|
review(type: NonNullable<FeedbackInput["type"]>, description: string, conversationId?: string, feedbackId?: string): Promise<ReviewResult>;
|
|
315
370
|
/** Records the question before showing it in the widget. */
|
|
316
371
|
recordAssistQuestion?(feedbackId: string, receipt: string): Promise<boolean>;
|
|
372
|
+
/** The signed-in tester, in test environments only; undefined when nobody is signed in. */
|
|
373
|
+
readonly tester?: Tester | undefined;
|
|
374
|
+
/**
|
|
375
|
+
* Sends a six-digit sign-in code to a tester's e-mail address. Resolves the same whether or not
|
|
376
|
+
* the address may sign in, so it never tells who is known. Test environments only.
|
|
377
|
+
*/
|
|
378
|
+
requestTesterCode?(email: string): Promise<void>;
|
|
379
|
+
/** Signs the tester in with the code; the session lasts 30 days in this browser. */
|
|
380
|
+
signInTester?(email: string, code: string): Promise<Tester>;
|
|
381
|
+
/** Ends the tester session in this browser. */
|
|
382
|
+
signOutTester?(): Promise<void>;
|
|
317
383
|
/** Stops capturing and restores console, fetch and XMLHttpRequest. */
|
|
318
384
|
dispose(): void;
|
|
319
385
|
}
|
|
@@ -324,6 +390,31 @@ declare function createSeaproof(options: SeaproofOptions): SeaproofClient;
|
|
|
324
390
|
/** Context the browser can tell us without asking anyone. */
|
|
325
391
|
declare function browserContext(): FeedbackContext;
|
|
326
392
|
|
|
393
|
+
/** Whether a signed-in tester may ask Do it now for a report of this type; never for questions. */
|
|
394
|
+
declare function canFastTrackType(tester: Tester | undefined, type: FeedbackType): boolean;
|
|
395
|
+
|
|
396
|
+
/** One error as `POST /api/v1/sdk/errors` takes it (docs/error-tracking.md). */
|
|
397
|
+
interface ErrorEventPayload {
|
|
398
|
+
/** Made here, so a batch sent again is stored once. */
|
|
399
|
+
id: string;
|
|
400
|
+
occurredAt: string;
|
|
401
|
+
type: string;
|
|
402
|
+
message: string;
|
|
403
|
+
stack?: string;
|
|
404
|
+
handled: boolean;
|
|
405
|
+
sessionId: string;
|
|
406
|
+
fingerprint?: string;
|
|
407
|
+
context: FeedbackContext;
|
|
408
|
+
breadcrumbs: Breadcrumb[];
|
|
409
|
+
}
|
|
410
|
+
/** What happened just before the error: console lines, requests and the app's own log lines. */
|
|
411
|
+
interface Breadcrumb {
|
|
412
|
+
at: string;
|
|
413
|
+
kind: string;
|
|
414
|
+
message: string;
|
|
415
|
+
level?: string;
|
|
416
|
+
}
|
|
417
|
+
|
|
327
418
|
/** Where every API error code is explained, with how to fix it. */
|
|
328
419
|
declare const ERROR_REFERENCE_URL = "https://seaproof.io/docs/errors";
|
|
329
420
|
/** A failed call to the Seaproof API. `code` is the API's stable error code, e.g. `feedback.description_invalid`. */
|
|
@@ -399,6 +490,68 @@ declare class ReporterIdentity {
|
|
|
399
490
|
/** `localStorage` when the page may use it (not in some private modes or sandboxed frames), otherwise memory. */
|
|
400
491
|
declare function defaultStorage(): KeyValueStorage;
|
|
401
492
|
|
|
493
|
+
/** A box in viewport pixels (CSS pixels, relative to the top-left of the window). */
|
|
494
|
+
interface Box {
|
|
495
|
+
x: number;
|
|
496
|
+
y: number;
|
|
497
|
+
width: number;
|
|
498
|
+
height: number;
|
|
499
|
+
}
|
|
500
|
+
/** What the user pointed at: the element's box and how to name it, or only the spot. */
|
|
501
|
+
interface PointedElement {
|
|
502
|
+
box: Box;
|
|
503
|
+
/** "Button", "Link", "Field"… or null when the element has no clear role. */
|
|
504
|
+
role: string | null;
|
|
505
|
+
/** Its accessible name, or null when it has none or is masked. Typed values are never read. */
|
|
506
|
+
name: string | null;
|
|
507
|
+
}
|
|
508
|
+
/** One pin, numbered from 1 in the order it was placed. */
|
|
509
|
+
interface Pin {
|
|
510
|
+
number: number;
|
|
511
|
+
/** Where the user tapped, in viewport pixels. */
|
|
512
|
+
x: number;
|
|
513
|
+
y: number;
|
|
514
|
+
element: PointedElement | null;
|
|
515
|
+
/** What the user wrote at the pin, if anything. Drawn next to it in the screenshot. */
|
|
516
|
+
note?: string | null;
|
|
517
|
+
/**
|
|
518
|
+
* Where the user moved the note so it covers nothing: its top-left corner, in viewport pixels.
|
|
519
|
+
* Without it the note sits beside the pin's number.
|
|
520
|
+
*/
|
|
521
|
+
notePosition?: {
|
|
522
|
+
x: number;
|
|
523
|
+
y: number;
|
|
524
|
+
} | null;
|
|
525
|
+
}
|
|
526
|
+
/** How the screenshot maps to the viewport: image pixel = (viewport pixel − origin) × scale. */
|
|
527
|
+
interface ScreenshotFrame {
|
|
528
|
+
originX: number;
|
|
529
|
+
originY: number;
|
|
530
|
+
scale: number;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* The element under a point, skipping the widget itself (`data-seaproof-ignore`). Prefers the
|
|
534
|
+
* closest interactive element (a button rather than the icon inside it); a large container counts
|
|
535
|
+
* as "no element", so the pin marks the spot instead of outlining half the page.
|
|
536
|
+
*/
|
|
537
|
+
declare function elementAt(x: number, y: number, doc?: Document): PointedElement | null;
|
|
538
|
+
/** The role and accessible name of an element, as a person would say it. */
|
|
539
|
+
declare function describeElement(el: Element): {
|
|
540
|
+
role: string | null;
|
|
541
|
+
name: string | null;
|
|
542
|
+
};
|
|
543
|
+
/** `Button "Pay 349 kr"`, `Image`, `"Shipping"` or null. */
|
|
544
|
+
declare function pinLabel(element: PointedElement | null): string | null;
|
|
545
|
+
/** The text that tells the team what the pins point at, one line per pin, with what was written there. */
|
|
546
|
+
declare function pinMessage(pins: readonly Pin[]): string;
|
|
547
|
+
/**
|
|
548
|
+
* Draws numbered pins, and an outline around each element, into a screenshot. The result has the
|
|
549
|
+
* screenshot's full size, like a marked-up screenshot from the annotator.
|
|
550
|
+
*/
|
|
551
|
+
declare function drawPins(screenshot: Blob, pins: readonly Pin[], frame: ScreenshotFrame): Promise<Blob>;
|
|
552
|
+
/** The point of a rectangle closest to (px, py): where a line from a pin meets its note. */
|
|
553
|
+
declare function nearestPoint(px: number, py: number, x: number, y: number, width: number, height: number): [number, number];
|
|
554
|
+
|
|
402
555
|
/** Whether a node is left out of screenshots: the widget itself, masked elements and password fields. */
|
|
403
556
|
declare function excludedFromScreenshot(node: Node): boolean;
|
|
404
557
|
/**
|
|
@@ -407,8 +560,16 @@ declare function excludedFromScreenshot(node: Node): boolean;
|
|
|
407
560
|
* leaves the browser. Password fields are always left out.
|
|
408
561
|
*/
|
|
409
562
|
declare function captureScreenshot(element?: HTMLElement): Promise<Blob>;
|
|
563
|
+
/**
|
|
564
|
+
* Like {@link captureScreenshot}, and also says where the image sits in the window, so a point
|
|
565
|
+
* on the screen (such as a pin) can be drawn at the same place in the image.
|
|
566
|
+
*/
|
|
567
|
+
declare function captureScreenshotWithFrame(element?: HTMLElement): Promise<{
|
|
568
|
+
file: Blob;
|
|
569
|
+
frame: ScreenshotFrame;
|
|
570
|
+
}>;
|
|
410
571
|
|
|
411
|
-
declare const SDK_VERSION = "0.1.0-beta.
|
|
572
|
+
declare const SDK_VERSION = "0.1.0-beta.2";
|
|
412
573
|
|
|
413
|
-
export { Diagnostics, ERROR_REFERENCE_URL, ReporterIdentity, SDK_VERSION, ScreenRecorder, SeaproofError, browserContext, canRecordScreen, captureScreenshot, createSeaproof, defaultStorage, describeError, excludedFromScreenshot, installCapture, newConversationId, redactUrl };
|
|
414
|
-
export type { AssistSettings, AttachmentInput, AttachmentKind, CaptureOptions, ConversationMessage, DiagnosticEntry, DiagnosticKind, Environment, EnvironmentMode, FeedbackContext, FeedbackInput, FeedbackSeverity, FeedbackType, KeyValueStorage, LauncherPosition, OwnFeedback, OwnFeedbackDetail, PublicIdea, PublicStatus, RecorderOptions, Reporter, ReporterAttachment, ReviewResult, ScreenRecording, SeaproofBranding, SeaproofClient, SeaproofLauncherSettings, SeaproofMode, SeaproofOptions, SeaproofProject, SubmittedFeedback, Suggestion };
|
|
574
|
+
export { Diagnostics, ERROR_REFERENCE_URL, ReporterIdentity, SDK_VERSION, ScreenRecorder, SeaproofError, browserContext, canFastTrackType, canRecordScreen, captureScreenshot, captureScreenshotWithFrame, createSeaproof, defaultStorage, describeElement, describeError, drawPins, elementAt, excludedFromScreenshot, installCapture, nearestPoint, newConversationId, pinLabel, pinMessage, redactUrl };
|
|
575
|
+
export type { AssistSettings, AttachmentInput, AttachmentKind, Box, Breadcrumb, CaptureExceptionOptions, CaptureOptions, ConversationMessage, DiagnosticEntry, DiagnosticKind, Environment, EnvironmentMode, ErrorEventPayload, FeedbackContext, FeedbackInput, FeedbackSeverity, FeedbackType, KeyValueStorage, LauncherPosition, OwnFeedback, OwnFeedbackDetail, Pin, PointedElement, PublicIdea, PublicStatus, RecorderOptions, Reporter, ReporterAttachment, ReviewResult, ScreenRecording, ScreenshotFrame, SeaproofBranding, SeaproofClient, SeaproofLauncherSettings, SeaproofMode, SeaproofOptions, SeaproofProject, SubmittedFeedback, Suggestion, Tester };
|