@espejo/browser 0.1.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/LICENSE +27 -0
- package/README.md +52 -0
- package/dist/agent.cjs +3 -0
- package/dist/agent.d.cts +1 -0
- package/dist/agent.d.ts +1 -0
- package/dist/agent.js +1 -0
- package/dist/chat.cjs +1101 -0
- package/dist/chat.d.cts +288 -0
- package/dist/chat.d.ts +288 -0
- package/dist/chat.js +1051 -0
- package/dist/chunk-54OEDPVD.js +3 -0
- package/dist/chunk-MJUVVQNB.js +49 -0
- package/dist/index-Djj7dbiY.d.cts +234 -0
- package/dist/index-Djj7dbiY.d.ts +234 -0
- package/dist/index.cjs +529 -0
- package/dist/index.d.cts +302 -0
- package/dist/index.d.ts +302 -0
- package/dist/index.js +481 -0
- package/dist/shadow-scaffold-DUJmxf_n.d.cts +4 -0
- package/dist/shadow-scaffold-DUJmxf_n.d.ts +4 -0
- package/package.json +52 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { N as NetworkEntry, c as ConsoleEntry, I as Interaction, d as Navigation, e as EventsDocument } from './index-Djj7dbiY.cjs';
|
|
2
|
+
export { b as ActResult, f as AgentAction, A as AgentActionType, g as AgentContext, h as AgentPolicy, E as EspejoAgent } from './index-Djj7dbiY.cjs';
|
|
3
|
+
import { a as WidgetTheme } from './shadow-scaffold-DUJmxf_n.cjs';
|
|
4
|
+
|
|
5
|
+
declare const AUTO_TRIGGERS: readonly ["auto:console_error", "auto:uncaught", "auto:unhandled_rejection", "auto:network_5xx", "auto:network_failed", "auto:network_4xx"];
|
|
6
|
+
type AutoTrigger = (typeof AUTO_TRIGGERS)[number];
|
|
7
|
+
interface AutoReportConfig {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
triggers: AutoTrigger[];
|
|
10
|
+
max_per_page: number;
|
|
11
|
+
cooldown_ms: number;
|
|
12
|
+
video_surface?: string | null;
|
|
13
|
+
has_triggers?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare const FEEDBACK_KINDS: readonly ["emoji3", "scale7", "thumbs"];
|
|
17
|
+
type FeedbackKind = (typeof FEEDBACK_KINDS)[number];
|
|
18
|
+
interface FeedbackConfig {
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
kind: FeedbackKind;
|
|
21
|
+
cadence_days: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface RingBufferOptions {
|
|
25
|
+
maxBytes: number;
|
|
26
|
+
maxItems: number;
|
|
27
|
+
}
|
|
28
|
+
declare class RingBuffer<T> {
|
|
29
|
+
private readonly options;
|
|
30
|
+
private slots;
|
|
31
|
+
private total;
|
|
32
|
+
private dropped;
|
|
33
|
+
constructor(options: RingBufferOptions);
|
|
34
|
+
push(item: T): void;
|
|
35
|
+
private evict;
|
|
36
|
+
toArray(): T[];
|
|
37
|
+
get droppedCount(): number;
|
|
38
|
+
get byteLength(): number;
|
|
39
|
+
get length(): number;
|
|
40
|
+
clear(): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare const DEFAULT_BUDGETS: {
|
|
44
|
+
readonly networkBytes: 1200000;
|
|
45
|
+
readonly consoleBytes: 400000;
|
|
46
|
+
readonly interactionBytes: 200000;
|
|
47
|
+
readonly navigationBytes: 50000;
|
|
48
|
+
readonly maxItemsPerKind: 5000;
|
|
49
|
+
};
|
|
50
|
+
type Budgets = typeof DEFAULT_BUDGETS;
|
|
51
|
+
interface DroppedCounts {
|
|
52
|
+
network: number;
|
|
53
|
+
console: number;
|
|
54
|
+
interactions: number;
|
|
55
|
+
navigations: number;
|
|
56
|
+
}
|
|
57
|
+
declare class SessionRecorder {
|
|
58
|
+
readonly startedAtIso: string;
|
|
59
|
+
private readonly clockStart;
|
|
60
|
+
readonly network: RingBuffer<NetworkEntry>;
|
|
61
|
+
readonly console: RingBuffer<ConsoleEntry>;
|
|
62
|
+
readonly interactions: RingBuffer<Interaction>;
|
|
63
|
+
readonly navigations: RingBuffer<Navigation>;
|
|
64
|
+
constructor(budgets?: Partial<Budgets>);
|
|
65
|
+
elapsed(): number;
|
|
66
|
+
get dropped(): DroppedCounts;
|
|
67
|
+
get byteLength(): number;
|
|
68
|
+
snapshot(): EventsDocument;
|
|
69
|
+
clear(): void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface SegmentRingOptions {
|
|
73
|
+
maxBytes: number;
|
|
74
|
+
}
|
|
75
|
+
declare class SegmentRing<T> {
|
|
76
|
+
private readonly options;
|
|
77
|
+
private segments;
|
|
78
|
+
private total;
|
|
79
|
+
private droppedSegments;
|
|
80
|
+
private overflowed;
|
|
81
|
+
constructor(options: SegmentRingOptions);
|
|
82
|
+
startSegment(): void;
|
|
83
|
+
push(item: T): void;
|
|
84
|
+
private evict;
|
|
85
|
+
toArray(): T[];
|
|
86
|
+
get byteLength(): number;
|
|
87
|
+
get segmentCount(): number;
|
|
88
|
+
get droppedCount(): number;
|
|
89
|
+
get isOverflowed(): boolean;
|
|
90
|
+
clear(): void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare const BLOCK_SELECTOR = "[data-espejo-block]";
|
|
94
|
+
declare const MASK_SELECTOR = "[data-espejo-mask]";
|
|
95
|
+
interface RrwebEvent {
|
|
96
|
+
type: number;
|
|
97
|
+
timestamp?: number;
|
|
98
|
+
[key: string]: unknown;
|
|
99
|
+
}
|
|
100
|
+
type RrwebRecord = (options: {
|
|
101
|
+
emit: (event: RrwebEvent, isCheckout?: boolean) => void;
|
|
102
|
+
checkoutEveryNms?: number;
|
|
103
|
+
maskAllInputs?: boolean;
|
|
104
|
+
blockSelector?: string;
|
|
105
|
+
maskTextSelector?: string;
|
|
106
|
+
recordCanvas?: boolean;
|
|
107
|
+
collectFonts?: boolean;
|
|
108
|
+
}) => (() => void) | undefined;
|
|
109
|
+
type RrwebSnapshot = (doc: Document, options?: {
|
|
110
|
+
maskAllInputs?: boolean;
|
|
111
|
+
blockSelector?: string | null;
|
|
112
|
+
maskTextSelector?: string | null;
|
|
113
|
+
inlineStylesheet?: boolean;
|
|
114
|
+
recordCanvas?: boolean;
|
|
115
|
+
}) => unknown;
|
|
116
|
+
|
|
117
|
+
declare const MAX_VIDEO_SECONDS = 240;
|
|
118
|
+
type VideoSurface = 'current-tab' | 'browser' | 'window' | 'monitor';
|
|
119
|
+
interface VideoCaptureOptions {
|
|
120
|
+
microphone?: boolean;
|
|
121
|
+
surface?: VideoSurface;
|
|
122
|
+
onUserStopped?: () => void;
|
|
123
|
+
onLimitReached?: () => void;
|
|
124
|
+
maxSeconds?: number;
|
|
125
|
+
maxHeight?: number;
|
|
126
|
+
frameRate?: number;
|
|
127
|
+
videoBitsPerSecond?: number;
|
|
128
|
+
}
|
|
129
|
+
interface MicrophoneResult {
|
|
130
|
+
on: boolean;
|
|
131
|
+
denied: boolean;
|
|
132
|
+
}
|
|
133
|
+
declare function videoSupported(): boolean;
|
|
134
|
+
|
|
135
|
+
declare const DEFAULT_TEXT: {
|
|
136
|
+
triggerLabel: string;
|
|
137
|
+
title: string;
|
|
138
|
+
fieldLabel: string;
|
|
139
|
+
placeholder: string;
|
|
140
|
+
cancel: string;
|
|
141
|
+
submit: string;
|
|
142
|
+
sending: string;
|
|
143
|
+
success: string;
|
|
144
|
+
errorPrefix: string;
|
|
145
|
+
record: string;
|
|
146
|
+
recordHint: string;
|
|
147
|
+
recording: string;
|
|
148
|
+
stopRecording: string;
|
|
149
|
+
micOn: string;
|
|
150
|
+
micOff: string;
|
|
151
|
+
micBlocked: string;
|
|
152
|
+
micStateOn: string;
|
|
153
|
+
micStateOff: string;
|
|
154
|
+
micStateBlocked: string;
|
|
155
|
+
countdown: string;
|
|
156
|
+
markupOn: string;
|
|
157
|
+
markupOff: string;
|
|
158
|
+
videoAttached: string;
|
|
159
|
+
videoRemove: string;
|
|
160
|
+
limitReached: string;
|
|
161
|
+
recordErrorPrefix: string;
|
|
162
|
+
};
|
|
163
|
+
type WidgetText = typeof DEFAULT_TEXT;
|
|
164
|
+
|
|
165
|
+
declare const DEFAULT_FEEDBACK_TEXT: {
|
|
166
|
+
title: string;
|
|
167
|
+
thanks: string;
|
|
168
|
+
dismiss: string;
|
|
169
|
+
emojiSad: string;
|
|
170
|
+
emojiNeutral: string;
|
|
171
|
+
emojiHappy: string;
|
|
172
|
+
thumbsDown: string;
|
|
173
|
+
thumbsUp: string;
|
|
174
|
+
scaleLabel: string;
|
|
175
|
+
};
|
|
176
|
+
type FeedbackWidgetText = typeof DEFAULT_FEEDBACK_TEXT;
|
|
177
|
+
interface FeedbackWidgetOptions {
|
|
178
|
+
config: FeedbackConfig;
|
|
179
|
+
vote(value: number): Promise<void>;
|
|
180
|
+
text?: Partial<FeedbackWidgetText>;
|
|
181
|
+
theme?: WidgetTheme;
|
|
182
|
+
doc?: Document;
|
|
183
|
+
}
|
|
184
|
+
interface FeedbackWidgetHandle {
|
|
185
|
+
destroy(): void;
|
|
186
|
+
shadowRootForTesting: ShadowRoot;
|
|
187
|
+
}
|
|
188
|
+
declare function installFeedbackWidget(options: FeedbackWidgetOptions): FeedbackWidgetHandle | null;
|
|
189
|
+
|
|
190
|
+
declare const BLOCK_ATTRIBUTE = "data-espejo-block";
|
|
191
|
+
|
|
192
|
+
declare function fetchAutoReportConfig(ingestUrl: string, key: string, fetchImpl: typeof fetch): Promise<{
|
|
193
|
+
config: AutoReportConfig | null;
|
|
194
|
+
videoSurface: string | null;
|
|
195
|
+
hasTriggers: boolean;
|
|
196
|
+
}>;
|
|
197
|
+
declare function normalizeConfig(raw: unknown): AutoReportConfig | null;
|
|
198
|
+
|
|
199
|
+
declare function fetchFeedbackConfig(ingestUrl: string, key: string, fetchImpl: typeof fetch): Promise<FeedbackConfig | null>;
|
|
200
|
+
declare function normalizeFeedbackConfig(raw: unknown): FeedbackConfig | null;
|
|
201
|
+
|
|
202
|
+
declare function canShowFeedback(projectKey: string, cadenceDays: number, doc?: Document): boolean;
|
|
203
|
+
declare function sealFeedbackShown(projectKey: string, doc?: Document): void;
|
|
204
|
+
|
|
205
|
+
interface VoteInput {
|
|
206
|
+
ingestUrl: string;
|
|
207
|
+
key: string;
|
|
208
|
+
kind: string;
|
|
209
|
+
value: number;
|
|
210
|
+
pageHost?: string;
|
|
211
|
+
userRef?: string;
|
|
212
|
+
}
|
|
213
|
+
declare function sendVote(input: VoteInput, fetchImpl?: typeof fetch): Promise<void>;
|
|
214
|
+
|
|
215
|
+
declare const SDK_NAME = "@espejo/browser";
|
|
216
|
+
declare const SDK_VERSION = "0.1.0";
|
|
217
|
+
interface EspejoConfig {
|
|
218
|
+
key: string;
|
|
219
|
+
ingestUrl?: string;
|
|
220
|
+
mode?: 'ring' | 'always';
|
|
221
|
+
capture?: 'events' | 'dom';
|
|
222
|
+
budgets?: Partial<Budgets>;
|
|
223
|
+
release?: string;
|
|
224
|
+
env?: string;
|
|
225
|
+
userRef?: string;
|
|
226
|
+
button?: 'on' | 'off';
|
|
227
|
+
buttonText?: Partial<WidgetText>;
|
|
228
|
+
rrwebRecord?: RrwebRecord;
|
|
229
|
+
rrwebSnapshot?: RrwebSnapshot;
|
|
230
|
+
autoReport?: 'on' | 'off';
|
|
231
|
+
feedback?: 'on' | 'off';
|
|
232
|
+
feedbackText?: Partial<FeedbackWidgetText>;
|
|
233
|
+
theme?: 'auto' | 'light' | 'dark';
|
|
234
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
235
|
+
buttonIcon?: string;
|
|
236
|
+
videoSurface?: VideoSurface;
|
|
237
|
+
}
|
|
238
|
+
type ReportOrigin = {
|
|
239
|
+
source: 'manual';
|
|
240
|
+
} | {
|
|
241
|
+
source: 'auto';
|
|
242
|
+
trigger: AutoTrigger;
|
|
243
|
+
};
|
|
244
|
+
declare class Espejo {
|
|
245
|
+
private recorder;
|
|
246
|
+
private uninstall;
|
|
247
|
+
private dom;
|
|
248
|
+
private routeSnapshot;
|
|
249
|
+
private snapshotFn;
|
|
250
|
+
private widget;
|
|
251
|
+
private lastReport;
|
|
252
|
+
private feedback;
|
|
253
|
+
private annotator;
|
|
254
|
+
private markupHost;
|
|
255
|
+
private video;
|
|
256
|
+
private videoBlob;
|
|
257
|
+
private videoContentType;
|
|
258
|
+
private videoHasAudio;
|
|
259
|
+
private videoMs;
|
|
260
|
+
private autoConfig;
|
|
261
|
+
private autoGuard;
|
|
262
|
+
private autoKilled;
|
|
263
|
+
private autoInFlight;
|
|
264
|
+
private triggerSink;
|
|
265
|
+
private triggerBuf;
|
|
266
|
+
private triggersStop;
|
|
267
|
+
private readonly pristineFetch;
|
|
268
|
+
private readonly config;
|
|
269
|
+
constructor(config: EspejoConfig);
|
|
270
|
+
get recording(): boolean;
|
|
271
|
+
start(): void;
|
|
272
|
+
private pushTriggerSignal;
|
|
273
|
+
private loadTriggers;
|
|
274
|
+
private loadFeedback;
|
|
275
|
+
private loadAutoReport;
|
|
276
|
+
setAutoReport(enabled: boolean): void;
|
|
277
|
+
identify(userRef: string | null): void;
|
|
278
|
+
canOpenReport(): boolean;
|
|
279
|
+
openReport(): boolean;
|
|
280
|
+
get lastReportId(): string | null;
|
|
281
|
+
get autoReportActive(): boolean;
|
|
282
|
+
private autoEnabled;
|
|
283
|
+
private onConsoleEntry;
|
|
284
|
+
private onNetworkEntry;
|
|
285
|
+
private maybeAutoReport;
|
|
286
|
+
private enableDom;
|
|
287
|
+
stop(): void;
|
|
288
|
+
startVideo(options?: VideoCaptureOptions): Promise<void>;
|
|
289
|
+
setMicrophone(on: boolean): Promise<MicrophoneResult>;
|
|
290
|
+
get microphoneOn(): boolean;
|
|
291
|
+
stopVideo(): Promise<Blob | null>;
|
|
292
|
+
get recordingVideo(): boolean;
|
|
293
|
+
setMarkup(on: boolean, onExit?: () => void): Promise<boolean>;
|
|
294
|
+
private teardownMarkup;
|
|
295
|
+
discardVideo(): void;
|
|
296
|
+
snapshot(): EventsDocument | null;
|
|
297
|
+
report(description?: string, origin?: ReportOrigin, onProgress?: (fraction: number) => void): Promise<string | null>;
|
|
298
|
+
private manifest;
|
|
299
|
+
}
|
|
300
|
+
declare function autoStart(overrides?: Partial<EspejoConfig>): Espejo | null;
|
|
301
|
+
|
|
302
|
+
export { BLOCK_ATTRIBUTE, BLOCK_SELECTOR, DEFAULT_BUDGETS, Espejo, type EspejoConfig, DEFAULT_FEEDBACK_TEXT as FEEDBACK_DEFAULT_TEXT, type FeedbackWidgetText, MASK_SELECTOR, MAX_VIDEO_SECONDS, type MicrophoneResult, type ReportOrigin, RingBuffer, SDK_NAME, SDK_VERSION, SegmentRing, SessionRecorder, DEFAULT_TEXT as WIDGET_DEFAULT_TEXT, type WidgetText, autoStart, canShowFeedback, fetchAutoReportConfig, fetchFeedbackConfig, installFeedbackWidget, normalizeConfig as normalizeAutoReportConfig, normalizeFeedbackConfig, sealFeedbackShown, sendVote, videoSupported };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { N as NetworkEntry, c as ConsoleEntry, I as Interaction, d as Navigation, e as EventsDocument } from './index-Djj7dbiY.js';
|
|
2
|
+
export { b as ActResult, f as AgentAction, A as AgentActionType, g as AgentContext, h as AgentPolicy, E as EspejoAgent } from './index-Djj7dbiY.js';
|
|
3
|
+
import { a as WidgetTheme } from './shadow-scaffold-DUJmxf_n.js';
|
|
4
|
+
|
|
5
|
+
declare const AUTO_TRIGGERS: readonly ["auto:console_error", "auto:uncaught", "auto:unhandled_rejection", "auto:network_5xx", "auto:network_failed", "auto:network_4xx"];
|
|
6
|
+
type AutoTrigger = (typeof AUTO_TRIGGERS)[number];
|
|
7
|
+
interface AutoReportConfig {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
triggers: AutoTrigger[];
|
|
10
|
+
max_per_page: number;
|
|
11
|
+
cooldown_ms: number;
|
|
12
|
+
video_surface?: string | null;
|
|
13
|
+
has_triggers?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare const FEEDBACK_KINDS: readonly ["emoji3", "scale7", "thumbs"];
|
|
17
|
+
type FeedbackKind = (typeof FEEDBACK_KINDS)[number];
|
|
18
|
+
interface FeedbackConfig {
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
kind: FeedbackKind;
|
|
21
|
+
cadence_days: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface RingBufferOptions {
|
|
25
|
+
maxBytes: number;
|
|
26
|
+
maxItems: number;
|
|
27
|
+
}
|
|
28
|
+
declare class RingBuffer<T> {
|
|
29
|
+
private readonly options;
|
|
30
|
+
private slots;
|
|
31
|
+
private total;
|
|
32
|
+
private dropped;
|
|
33
|
+
constructor(options: RingBufferOptions);
|
|
34
|
+
push(item: T): void;
|
|
35
|
+
private evict;
|
|
36
|
+
toArray(): T[];
|
|
37
|
+
get droppedCount(): number;
|
|
38
|
+
get byteLength(): number;
|
|
39
|
+
get length(): number;
|
|
40
|
+
clear(): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare const DEFAULT_BUDGETS: {
|
|
44
|
+
readonly networkBytes: 1200000;
|
|
45
|
+
readonly consoleBytes: 400000;
|
|
46
|
+
readonly interactionBytes: 200000;
|
|
47
|
+
readonly navigationBytes: 50000;
|
|
48
|
+
readonly maxItemsPerKind: 5000;
|
|
49
|
+
};
|
|
50
|
+
type Budgets = typeof DEFAULT_BUDGETS;
|
|
51
|
+
interface DroppedCounts {
|
|
52
|
+
network: number;
|
|
53
|
+
console: number;
|
|
54
|
+
interactions: number;
|
|
55
|
+
navigations: number;
|
|
56
|
+
}
|
|
57
|
+
declare class SessionRecorder {
|
|
58
|
+
readonly startedAtIso: string;
|
|
59
|
+
private readonly clockStart;
|
|
60
|
+
readonly network: RingBuffer<NetworkEntry>;
|
|
61
|
+
readonly console: RingBuffer<ConsoleEntry>;
|
|
62
|
+
readonly interactions: RingBuffer<Interaction>;
|
|
63
|
+
readonly navigations: RingBuffer<Navigation>;
|
|
64
|
+
constructor(budgets?: Partial<Budgets>);
|
|
65
|
+
elapsed(): number;
|
|
66
|
+
get dropped(): DroppedCounts;
|
|
67
|
+
get byteLength(): number;
|
|
68
|
+
snapshot(): EventsDocument;
|
|
69
|
+
clear(): void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface SegmentRingOptions {
|
|
73
|
+
maxBytes: number;
|
|
74
|
+
}
|
|
75
|
+
declare class SegmentRing<T> {
|
|
76
|
+
private readonly options;
|
|
77
|
+
private segments;
|
|
78
|
+
private total;
|
|
79
|
+
private droppedSegments;
|
|
80
|
+
private overflowed;
|
|
81
|
+
constructor(options: SegmentRingOptions);
|
|
82
|
+
startSegment(): void;
|
|
83
|
+
push(item: T): void;
|
|
84
|
+
private evict;
|
|
85
|
+
toArray(): T[];
|
|
86
|
+
get byteLength(): number;
|
|
87
|
+
get segmentCount(): number;
|
|
88
|
+
get droppedCount(): number;
|
|
89
|
+
get isOverflowed(): boolean;
|
|
90
|
+
clear(): void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
declare const BLOCK_SELECTOR = "[data-espejo-block]";
|
|
94
|
+
declare const MASK_SELECTOR = "[data-espejo-mask]";
|
|
95
|
+
interface RrwebEvent {
|
|
96
|
+
type: number;
|
|
97
|
+
timestamp?: number;
|
|
98
|
+
[key: string]: unknown;
|
|
99
|
+
}
|
|
100
|
+
type RrwebRecord = (options: {
|
|
101
|
+
emit: (event: RrwebEvent, isCheckout?: boolean) => void;
|
|
102
|
+
checkoutEveryNms?: number;
|
|
103
|
+
maskAllInputs?: boolean;
|
|
104
|
+
blockSelector?: string;
|
|
105
|
+
maskTextSelector?: string;
|
|
106
|
+
recordCanvas?: boolean;
|
|
107
|
+
collectFonts?: boolean;
|
|
108
|
+
}) => (() => void) | undefined;
|
|
109
|
+
type RrwebSnapshot = (doc: Document, options?: {
|
|
110
|
+
maskAllInputs?: boolean;
|
|
111
|
+
blockSelector?: string | null;
|
|
112
|
+
maskTextSelector?: string | null;
|
|
113
|
+
inlineStylesheet?: boolean;
|
|
114
|
+
recordCanvas?: boolean;
|
|
115
|
+
}) => unknown;
|
|
116
|
+
|
|
117
|
+
declare const MAX_VIDEO_SECONDS = 240;
|
|
118
|
+
type VideoSurface = 'current-tab' | 'browser' | 'window' | 'monitor';
|
|
119
|
+
interface VideoCaptureOptions {
|
|
120
|
+
microphone?: boolean;
|
|
121
|
+
surface?: VideoSurface;
|
|
122
|
+
onUserStopped?: () => void;
|
|
123
|
+
onLimitReached?: () => void;
|
|
124
|
+
maxSeconds?: number;
|
|
125
|
+
maxHeight?: number;
|
|
126
|
+
frameRate?: number;
|
|
127
|
+
videoBitsPerSecond?: number;
|
|
128
|
+
}
|
|
129
|
+
interface MicrophoneResult {
|
|
130
|
+
on: boolean;
|
|
131
|
+
denied: boolean;
|
|
132
|
+
}
|
|
133
|
+
declare function videoSupported(): boolean;
|
|
134
|
+
|
|
135
|
+
declare const DEFAULT_TEXT: {
|
|
136
|
+
triggerLabel: string;
|
|
137
|
+
title: string;
|
|
138
|
+
fieldLabel: string;
|
|
139
|
+
placeholder: string;
|
|
140
|
+
cancel: string;
|
|
141
|
+
submit: string;
|
|
142
|
+
sending: string;
|
|
143
|
+
success: string;
|
|
144
|
+
errorPrefix: string;
|
|
145
|
+
record: string;
|
|
146
|
+
recordHint: string;
|
|
147
|
+
recording: string;
|
|
148
|
+
stopRecording: string;
|
|
149
|
+
micOn: string;
|
|
150
|
+
micOff: string;
|
|
151
|
+
micBlocked: string;
|
|
152
|
+
micStateOn: string;
|
|
153
|
+
micStateOff: string;
|
|
154
|
+
micStateBlocked: string;
|
|
155
|
+
countdown: string;
|
|
156
|
+
markupOn: string;
|
|
157
|
+
markupOff: string;
|
|
158
|
+
videoAttached: string;
|
|
159
|
+
videoRemove: string;
|
|
160
|
+
limitReached: string;
|
|
161
|
+
recordErrorPrefix: string;
|
|
162
|
+
};
|
|
163
|
+
type WidgetText = typeof DEFAULT_TEXT;
|
|
164
|
+
|
|
165
|
+
declare const DEFAULT_FEEDBACK_TEXT: {
|
|
166
|
+
title: string;
|
|
167
|
+
thanks: string;
|
|
168
|
+
dismiss: string;
|
|
169
|
+
emojiSad: string;
|
|
170
|
+
emojiNeutral: string;
|
|
171
|
+
emojiHappy: string;
|
|
172
|
+
thumbsDown: string;
|
|
173
|
+
thumbsUp: string;
|
|
174
|
+
scaleLabel: string;
|
|
175
|
+
};
|
|
176
|
+
type FeedbackWidgetText = typeof DEFAULT_FEEDBACK_TEXT;
|
|
177
|
+
interface FeedbackWidgetOptions {
|
|
178
|
+
config: FeedbackConfig;
|
|
179
|
+
vote(value: number): Promise<void>;
|
|
180
|
+
text?: Partial<FeedbackWidgetText>;
|
|
181
|
+
theme?: WidgetTheme;
|
|
182
|
+
doc?: Document;
|
|
183
|
+
}
|
|
184
|
+
interface FeedbackWidgetHandle {
|
|
185
|
+
destroy(): void;
|
|
186
|
+
shadowRootForTesting: ShadowRoot;
|
|
187
|
+
}
|
|
188
|
+
declare function installFeedbackWidget(options: FeedbackWidgetOptions): FeedbackWidgetHandle | null;
|
|
189
|
+
|
|
190
|
+
declare const BLOCK_ATTRIBUTE = "data-espejo-block";
|
|
191
|
+
|
|
192
|
+
declare function fetchAutoReportConfig(ingestUrl: string, key: string, fetchImpl: typeof fetch): Promise<{
|
|
193
|
+
config: AutoReportConfig | null;
|
|
194
|
+
videoSurface: string | null;
|
|
195
|
+
hasTriggers: boolean;
|
|
196
|
+
}>;
|
|
197
|
+
declare function normalizeConfig(raw: unknown): AutoReportConfig | null;
|
|
198
|
+
|
|
199
|
+
declare function fetchFeedbackConfig(ingestUrl: string, key: string, fetchImpl: typeof fetch): Promise<FeedbackConfig | null>;
|
|
200
|
+
declare function normalizeFeedbackConfig(raw: unknown): FeedbackConfig | null;
|
|
201
|
+
|
|
202
|
+
declare function canShowFeedback(projectKey: string, cadenceDays: number, doc?: Document): boolean;
|
|
203
|
+
declare function sealFeedbackShown(projectKey: string, doc?: Document): void;
|
|
204
|
+
|
|
205
|
+
interface VoteInput {
|
|
206
|
+
ingestUrl: string;
|
|
207
|
+
key: string;
|
|
208
|
+
kind: string;
|
|
209
|
+
value: number;
|
|
210
|
+
pageHost?: string;
|
|
211
|
+
userRef?: string;
|
|
212
|
+
}
|
|
213
|
+
declare function sendVote(input: VoteInput, fetchImpl?: typeof fetch): Promise<void>;
|
|
214
|
+
|
|
215
|
+
declare const SDK_NAME = "@espejo/browser";
|
|
216
|
+
declare const SDK_VERSION = "0.1.0";
|
|
217
|
+
interface EspejoConfig {
|
|
218
|
+
key: string;
|
|
219
|
+
ingestUrl?: string;
|
|
220
|
+
mode?: 'ring' | 'always';
|
|
221
|
+
capture?: 'events' | 'dom';
|
|
222
|
+
budgets?: Partial<Budgets>;
|
|
223
|
+
release?: string;
|
|
224
|
+
env?: string;
|
|
225
|
+
userRef?: string;
|
|
226
|
+
button?: 'on' | 'off';
|
|
227
|
+
buttonText?: Partial<WidgetText>;
|
|
228
|
+
rrwebRecord?: RrwebRecord;
|
|
229
|
+
rrwebSnapshot?: RrwebSnapshot;
|
|
230
|
+
autoReport?: 'on' | 'off';
|
|
231
|
+
feedback?: 'on' | 'off';
|
|
232
|
+
feedbackText?: Partial<FeedbackWidgetText>;
|
|
233
|
+
theme?: 'auto' | 'light' | 'dark';
|
|
234
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
235
|
+
buttonIcon?: string;
|
|
236
|
+
videoSurface?: VideoSurface;
|
|
237
|
+
}
|
|
238
|
+
type ReportOrigin = {
|
|
239
|
+
source: 'manual';
|
|
240
|
+
} | {
|
|
241
|
+
source: 'auto';
|
|
242
|
+
trigger: AutoTrigger;
|
|
243
|
+
};
|
|
244
|
+
declare class Espejo {
|
|
245
|
+
private recorder;
|
|
246
|
+
private uninstall;
|
|
247
|
+
private dom;
|
|
248
|
+
private routeSnapshot;
|
|
249
|
+
private snapshotFn;
|
|
250
|
+
private widget;
|
|
251
|
+
private lastReport;
|
|
252
|
+
private feedback;
|
|
253
|
+
private annotator;
|
|
254
|
+
private markupHost;
|
|
255
|
+
private video;
|
|
256
|
+
private videoBlob;
|
|
257
|
+
private videoContentType;
|
|
258
|
+
private videoHasAudio;
|
|
259
|
+
private videoMs;
|
|
260
|
+
private autoConfig;
|
|
261
|
+
private autoGuard;
|
|
262
|
+
private autoKilled;
|
|
263
|
+
private autoInFlight;
|
|
264
|
+
private triggerSink;
|
|
265
|
+
private triggerBuf;
|
|
266
|
+
private triggersStop;
|
|
267
|
+
private readonly pristineFetch;
|
|
268
|
+
private readonly config;
|
|
269
|
+
constructor(config: EspejoConfig);
|
|
270
|
+
get recording(): boolean;
|
|
271
|
+
start(): void;
|
|
272
|
+
private pushTriggerSignal;
|
|
273
|
+
private loadTriggers;
|
|
274
|
+
private loadFeedback;
|
|
275
|
+
private loadAutoReport;
|
|
276
|
+
setAutoReport(enabled: boolean): void;
|
|
277
|
+
identify(userRef: string | null): void;
|
|
278
|
+
canOpenReport(): boolean;
|
|
279
|
+
openReport(): boolean;
|
|
280
|
+
get lastReportId(): string | null;
|
|
281
|
+
get autoReportActive(): boolean;
|
|
282
|
+
private autoEnabled;
|
|
283
|
+
private onConsoleEntry;
|
|
284
|
+
private onNetworkEntry;
|
|
285
|
+
private maybeAutoReport;
|
|
286
|
+
private enableDom;
|
|
287
|
+
stop(): void;
|
|
288
|
+
startVideo(options?: VideoCaptureOptions): Promise<void>;
|
|
289
|
+
setMicrophone(on: boolean): Promise<MicrophoneResult>;
|
|
290
|
+
get microphoneOn(): boolean;
|
|
291
|
+
stopVideo(): Promise<Blob | null>;
|
|
292
|
+
get recordingVideo(): boolean;
|
|
293
|
+
setMarkup(on: boolean, onExit?: () => void): Promise<boolean>;
|
|
294
|
+
private teardownMarkup;
|
|
295
|
+
discardVideo(): void;
|
|
296
|
+
snapshot(): EventsDocument | null;
|
|
297
|
+
report(description?: string, origin?: ReportOrigin, onProgress?: (fraction: number) => void): Promise<string | null>;
|
|
298
|
+
private manifest;
|
|
299
|
+
}
|
|
300
|
+
declare function autoStart(overrides?: Partial<EspejoConfig>): Espejo | null;
|
|
301
|
+
|
|
302
|
+
export { BLOCK_ATTRIBUTE, BLOCK_SELECTOR, DEFAULT_BUDGETS, Espejo, type EspejoConfig, DEFAULT_FEEDBACK_TEXT as FEEDBACK_DEFAULT_TEXT, type FeedbackWidgetText, MASK_SELECTOR, MAX_VIDEO_SECONDS, type MicrophoneResult, type ReportOrigin, RingBuffer, SDK_NAME, SDK_VERSION, SegmentRing, SessionRecorder, DEFAULT_TEXT as WIDGET_DEFAULT_TEXT, type WidgetText, autoStart, canShowFeedback, fetchAutoReportConfig, fetchFeedbackConfig, installFeedbackWidget, normalizeConfig as normalizeAutoReportConfig, normalizeFeedbackConfig, sealFeedbackShown, sendVote, videoSupported };
|