@sprig-technologies/sprig-bundled 1.0.1 → 1.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/dist/index.d.ts +3062 -0
- package/dist/index.js +14671 -0
- package/package.json +3 -6
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3062 @@
|
|
|
1
|
+
declare enum NodeType {
|
|
2
|
+
Document = 0,
|
|
3
|
+
DocumentType = 1,
|
|
4
|
+
Element = 2,
|
|
5
|
+
Text = 3,
|
|
6
|
+
CDATA = 4,
|
|
7
|
+
Comment = 5
|
|
8
|
+
}
|
|
9
|
+
type documentNode = {
|
|
10
|
+
type: NodeType.Document;
|
|
11
|
+
childNodes: serializedNodeWithId[];
|
|
12
|
+
compatMode?: string;
|
|
13
|
+
};
|
|
14
|
+
type documentTypeNode = {
|
|
15
|
+
type: NodeType.DocumentType;
|
|
16
|
+
name: string;
|
|
17
|
+
publicId: string;
|
|
18
|
+
systemId: string;
|
|
19
|
+
};
|
|
20
|
+
type attributes = {
|
|
21
|
+
[key: string]: string | number | true | null;
|
|
22
|
+
};
|
|
23
|
+
type elementNode = {
|
|
24
|
+
type: NodeType.Element;
|
|
25
|
+
tagName: string;
|
|
26
|
+
attributes: attributes;
|
|
27
|
+
childNodes: serializedNodeWithId[];
|
|
28
|
+
isSVG?: true;
|
|
29
|
+
needBlock?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type textNode = {
|
|
32
|
+
type: NodeType.Text;
|
|
33
|
+
textContent: string;
|
|
34
|
+
isStyle?: true;
|
|
35
|
+
};
|
|
36
|
+
type cdataNode = {
|
|
37
|
+
type: NodeType.CDATA;
|
|
38
|
+
textContent: '';
|
|
39
|
+
};
|
|
40
|
+
type commentNode = {
|
|
41
|
+
type: NodeType.Comment;
|
|
42
|
+
textContent: string;
|
|
43
|
+
};
|
|
44
|
+
type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
|
|
45
|
+
rootId?: number;
|
|
46
|
+
isShadowHost?: boolean;
|
|
47
|
+
isShadow?: boolean;
|
|
48
|
+
};
|
|
49
|
+
type serializedNodeWithId = serializedNode & {
|
|
50
|
+
id: number;
|
|
51
|
+
};
|
|
52
|
+
interface INode extends Node {
|
|
53
|
+
__sn: serializedNodeWithId;
|
|
54
|
+
}
|
|
55
|
+
interface IMirror<TNode> {
|
|
56
|
+
getId(n: TNode | undefined | null): number;
|
|
57
|
+
getNode(id: number): TNode | null;
|
|
58
|
+
getIds(): number[];
|
|
59
|
+
getMeta(n: TNode): serializedNodeWithId | null;
|
|
60
|
+
removeNodeFromMap(n: TNode): void;
|
|
61
|
+
has(id: number): boolean;
|
|
62
|
+
hasNode(node: TNode): boolean;
|
|
63
|
+
add(n: TNode, meta: serializedNodeWithId): void;
|
|
64
|
+
replace(id: number, n: TNode): void;
|
|
65
|
+
reset(): void;
|
|
66
|
+
}
|
|
67
|
+
type MaskInputOptions = Partial<{
|
|
68
|
+
color: boolean;
|
|
69
|
+
date: boolean;
|
|
70
|
+
'datetime-local': boolean;
|
|
71
|
+
email: boolean;
|
|
72
|
+
month: boolean;
|
|
73
|
+
number: boolean;
|
|
74
|
+
range: boolean;
|
|
75
|
+
search: boolean;
|
|
76
|
+
tel: boolean;
|
|
77
|
+
text: boolean;
|
|
78
|
+
time: boolean;
|
|
79
|
+
url: boolean;
|
|
80
|
+
week: boolean;
|
|
81
|
+
textarea: boolean;
|
|
82
|
+
select: boolean;
|
|
83
|
+
password: boolean;
|
|
84
|
+
}>;
|
|
85
|
+
type SlimDOMOptions = Partial<{
|
|
86
|
+
script: boolean;
|
|
87
|
+
comment: boolean;
|
|
88
|
+
headFavicon: boolean;
|
|
89
|
+
headWhitespace: boolean;
|
|
90
|
+
headMetaDescKeywords: boolean;
|
|
91
|
+
headMetaSocial: boolean;
|
|
92
|
+
headMetaRobots: boolean;
|
|
93
|
+
headMetaHttpEquiv: boolean;
|
|
94
|
+
headMetaAuthorship: boolean;
|
|
95
|
+
headMetaVerification: boolean;
|
|
96
|
+
}>;
|
|
97
|
+
type DataURLOptions = Partial<{
|
|
98
|
+
type: string;
|
|
99
|
+
quality: number;
|
|
100
|
+
}>;
|
|
101
|
+
type MaskTextFn = (text: string) => string;
|
|
102
|
+
type MaskInputFn = (text: string, element: HTMLElement) => string;
|
|
103
|
+
|
|
104
|
+
declare class Mirror$1 implements IMirror<Node> {
|
|
105
|
+
private idNodeMap;
|
|
106
|
+
private nodeMetaMap;
|
|
107
|
+
getId(n: Node | undefined | null): number;
|
|
108
|
+
getNode(id: number): Node | null;
|
|
109
|
+
getIds(): number[];
|
|
110
|
+
getMeta(n: Node): serializedNodeWithId | null;
|
|
111
|
+
removeNodeFromMap(n: Node): void;
|
|
112
|
+
has(id: number): boolean;
|
|
113
|
+
hasNode(node: Node): boolean;
|
|
114
|
+
add(n: Node, meta: serializedNodeWithId): void;
|
|
115
|
+
replace(id: number, n: Node): void;
|
|
116
|
+
reset(): void;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare enum EventType {
|
|
120
|
+
DomContentLoaded = 0,
|
|
121
|
+
Load = 1,
|
|
122
|
+
FullSnapshot = 2,
|
|
123
|
+
IncrementalSnapshot = 3,
|
|
124
|
+
Meta = 4,
|
|
125
|
+
Custom = 5,
|
|
126
|
+
Plugin = 6
|
|
127
|
+
}
|
|
128
|
+
type domContentLoadedEvent = {
|
|
129
|
+
type: EventType.DomContentLoaded;
|
|
130
|
+
data: unknown;
|
|
131
|
+
};
|
|
132
|
+
type loadedEvent = {
|
|
133
|
+
type: EventType.Load;
|
|
134
|
+
data: unknown;
|
|
135
|
+
};
|
|
136
|
+
type fullSnapshotEvent = {
|
|
137
|
+
type: EventType.FullSnapshot;
|
|
138
|
+
data: {
|
|
139
|
+
node: serializedNodeWithId;
|
|
140
|
+
initialOffset: {
|
|
141
|
+
top: number;
|
|
142
|
+
left: number;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
type incrementalSnapshotEvent = {
|
|
147
|
+
type: EventType.IncrementalSnapshot;
|
|
148
|
+
data: incrementalData;
|
|
149
|
+
};
|
|
150
|
+
type metaEvent = {
|
|
151
|
+
type: EventType.Meta;
|
|
152
|
+
data: {
|
|
153
|
+
href: string;
|
|
154
|
+
width: number;
|
|
155
|
+
height: number;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
type customEvent<T = unknown> = {
|
|
159
|
+
type: EventType.Custom;
|
|
160
|
+
data: {
|
|
161
|
+
tag: string;
|
|
162
|
+
payload: T;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
type pluginEvent<T = unknown> = {
|
|
166
|
+
type: EventType.Plugin;
|
|
167
|
+
data: {
|
|
168
|
+
plugin: string;
|
|
169
|
+
payload: T;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
declare enum IncrementalSource {
|
|
173
|
+
Mutation = 0,
|
|
174
|
+
MouseMove = 1,
|
|
175
|
+
MouseInteraction = 2,
|
|
176
|
+
Scroll = 3,
|
|
177
|
+
ViewportResize = 4,
|
|
178
|
+
Input = 5,
|
|
179
|
+
TouchMove = 6,
|
|
180
|
+
MediaInteraction = 7,
|
|
181
|
+
StyleSheetRule = 8,
|
|
182
|
+
CanvasMutation = 9,
|
|
183
|
+
Font = 10,
|
|
184
|
+
Log = 11,
|
|
185
|
+
Drag = 12,
|
|
186
|
+
StyleDeclaration = 13,
|
|
187
|
+
Selection = 14,
|
|
188
|
+
AdoptedStyleSheet = 15
|
|
189
|
+
}
|
|
190
|
+
type mutationData = {
|
|
191
|
+
source: IncrementalSource.Mutation;
|
|
192
|
+
} & mutationCallbackParam;
|
|
193
|
+
type mousemoveData = {
|
|
194
|
+
source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
|
|
195
|
+
positions: mousePosition[];
|
|
196
|
+
};
|
|
197
|
+
type mouseInteractionData = {
|
|
198
|
+
source: IncrementalSource.MouseInteraction;
|
|
199
|
+
} & mouseInteractionParam;
|
|
200
|
+
type scrollData = {
|
|
201
|
+
source: IncrementalSource.Scroll;
|
|
202
|
+
} & scrollPosition;
|
|
203
|
+
type viewportResizeData = {
|
|
204
|
+
source: IncrementalSource.ViewportResize;
|
|
205
|
+
} & viewportResizeDimension;
|
|
206
|
+
type inputData = {
|
|
207
|
+
source: IncrementalSource.Input;
|
|
208
|
+
id: number;
|
|
209
|
+
} & inputValue;
|
|
210
|
+
type mediaInteractionData = {
|
|
211
|
+
source: IncrementalSource.MediaInteraction;
|
|
212
|
+
} & mediaInteractionParam;
|
|
213
|
+
type styleSheetRuleData = {
|
|
214
|
+
source: IncrementalSource.StyleSheetRule;
|
|
215
|
+
} & styleSheetRuleParam;
|
|
216
|
+
type styleDeclarationData = {
|
|
217
|
+
source: IncrementalSource.StyleDeclaration;
|
|
218
|
+
} & styleDeclarationParam;
|
|
219
|
+
type canvasMutationData = {
|
|
220
|
+
source: IncrementalSource.CanvasMutation;
|
|
221
|
+
} & canvasMutationParam;
|
|
222
|
+
type fontData = {
|
|
223
|
+
source: IncrementalSource.Font;
|
|
224
|
+
} & fontParam;
|
|
225
|
+
type selectionData = {
|
|
226
|
+
source: IncrementalSource.Selection;
|
|
227
|
+
} & selectionParam;
|
|
228
|
+
type adoptedStyleSheetData = {
|
|
229
|
+
source: IncrementalSource.AdoptedStyleSheet;
|
|
230
|
+
} & adoptedStyleSheetParam;
|
|
231
|
+
type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData;
|
|
232
|
+
type event = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
|
|
233
|
+
type eventWithTime = event & {
|
|
234
|
+
timestamp: number;
|
|
235
|
+
delay?: number;
|
|
236
|
+
};
|
|
237
|
+
type canvasEventWithTime = eventWithTime & {
|
|
238
|
+
type: EventType.IncrementalSnapshot;
|
|
239
|
+
data: canvasMutationData;
|
|
240
|
+
};
|
|
241
|
+
type blockClass = string | RegExp;
|
|
242
|
+
type maskTextClass = string | RegExp;
|
|
243
|
+
type SamplingStrategy = Partial<{
|
|
244
|
+
mousemove: boolean | number;
|
|
245
|
+
mousemoveCallback: number;
|
|
246
|
+
mouseInteraction: boolean | Record<string, boolean | undefined>;
|
|
247
|
+
scroll: number;
|
|
248
|
+
media: number;
|
|
249
|
+
input: 'all' | 'last';
|
|
250
|
+
canvas: 'all' | number;
|
|
251
|
+
}>;
|
|
252
|
+
interface ICrossOriginIframeMirror {
|
|
253
|
+
getId(iframe: HTMLIFrameElement, remoteId: number, parentToRemoteMap?: Map<number, number>, remoteToParentMap?: Map<number, number>): number;
|
|
254
|
+
getIds(iframe: HTMLIFrameElement, remoteId: number[]): number[];
|
|
255
|
+
getRemoteId(iframe: HTMLIFrameElement, parentId: number, map?: Map<number, number>): number;
|
|
256
|
+
getRemoteIds(iframe: HTMLIFrameElement, parentId: number[]): number[];
|
|
257
|
+
reset(iframe?: HTMLIFrameElement): void;
|
|
258
|
+
}
|
|
259
|
+
type RecordPlugin<TOptions = unknown> = {
|
|
260
|
+
name: string;
|
|
261
|
+
observer?: (cb: (...args: Array<unknown>) => void, win: IWindow, options: TOptions) => listenerHandler;
|
|
262
|
+
eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;
|
|
263
|
+
getMirror?: (mirrors: {
|
|
264
|
+
nodeMirror: Mirror$1;
|
|
265
|
+
crossOriginIframeMirror: ICrossOriginIframeMirror;
|
|
266
|
+
crossOriginIframeStyleMirror: ICrossOriginIframeMirror;
|
|
267
|
+
}) => void;
|
|
268
|
+
options: TOptions;
|
|
269
|
+
};
|
|
270
|
+
type hooksParam = {
|
|
271
|
+
mutation?: mutationCallBack;
|
|
272
|
+
mousemove?: mousemoveCallBack;
|
|
273
|
+
mouseInteraction?: mouseInteractionCallBack;
|
|
274
|
+
scroll?: scrollCallback;
|
|
275
|
+
viewportResize?: viewportResizeCallback;
|
|
276
|
+
input?: inputCallback;
|
|
277
|
+
mediaInteaction?: mediaInteractionCallback;
|
|
278
|
+
styleSheetRule?: styleSheetRuleCallback;
|
|
279
|
+
styleDeclaration?: styleDeclarationCallback;
|
|
280
|
+
canvasMutation?: canvasMutationCallback;
|
|
281
|
+
font?: fontCallback;
|
|
282
|
+
selection?: selectionCallback;
|
|
283
|
+
};
|
|
284
|
+
type textMutation = {
|
|
285
|
+
id: number;
|
|
286
|
+
value: string | null;
|
|
287
|
+
};
|
|
288
|
+
type styleOMValue = {
|
|
289
|
+
[key: string]: styleValueWithPriority | string | false;
|
|
290
|
+
};
|
|
291
|
+
type styleValueWithPriority = [string, string];
|
|
292
|
+
type attributeMutation = {
|
|
293
|
+
id: number;
|
|
294
|
+
attributes: {
|
|
295
|
+
[key: string]: string | styleOMValue | null;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
type removedNodeMutation = {
|
|
299
|
+
parentId: number;
|
|
300
|
+
id: number;
|
|
301
|
+
isShadow?: boolean;
|
|
302
|
+
};
|
|
303
|
+
type addedNodeMutation = {
|
|
304
|
+
parentId: number;
|
|
305
|
+
previousId?: number | null;
|
|
306
|
+
nextId: number | null;
|
|
307
|
+
node: serializedNodeWithId;
|
|
308
|
+
};
|
|
309
|
+
type mutationCallbackParam = {
|
|
310
|
+
texts: textMutation[];
|
|
311
|
+
attributes: attributeMutation[];
|
|
312
|
+
removes: removedNodeMutation[];
|
|
313
|
+
adds: addedNodeMutation[];
|
|
314
|
+
isAttachIframe?: true;
|
|
315
|
+
};
|
|
316
|
+
type mutationCallBack = (m: mutationCallbackParam) => void;
|
|
317
|
+
type mousemoveCallBack = (p: mousePosition[], source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag) => void;
|
|
318
|
+
type mousePosition = {
|
|
319
|
+
x: number;
|
|
320
|
+
y: number;
|
|
321
|
+
id: number;
|
|
322
|
+
timeOffset: number;
|
|
323
|
+
};
|
|
324
|
+
declare enum MouseInteractions {
|
|
325
|
+
MouseUp = 0,
|
|
326
|
+
MouseDown = 1,
|
|
327
|
+
Click = 2,
|
|
328
|
+
ContextMenu = 3,
|
|
329
|
+
DblClick = 4,
|
|
330
|
+
Focus = 5,
|
|
331
|
+
Blur = 6,
|
|
332
|
+
TouchStart = 7,
|
|
333
|
+
TouchMove_Departed = 8,
|
|
334
|
+
TouchEnd = 9,
|
|
335
|
+
TouchCancel = 10
|
|
336
|
+
}
|
|
337
|
+
declare enum PointerTypes {
|
|
338
|
+
Mouse = 0,
|
|
339
|
+
Pen = 1,
|
|
340
|
+
Touch = 2
|
|
341
|
+
}
|
|
342
|
+
declare enum CanvasContext {
|
|
343
|
+
'2D' = 0,
|
|
344
|
+
WebGL = 1,
|
|
345
|
+
WebGL2 = 2
|
|
346
|
+
}
|
|
347
|
+
type mouseInteractionParam = {
|
|
348
|
+
type: MouseInteractions;
|
|
349
|
+
id: number;
|
|
350
|
+
x: number;
|
|
351
|
+
y: number;
|
|
352
|
+
pointerType?: PointerTypes;
|
|
353
|
+
};
|
|
354
|
+
type mouseInteractionCallBack = (d: mouseInteractionParam) => void;
|
|
355
|
+
type scrollPosition = {
|
|
356
|
+
id: number;
|
|
357
|
+
x: number;
|
|
358
|
+
y: number;
|
|
359
|
+
};
|
|
360
|
+
type scrollCallback = (p: scrollPosition) => void;
|
|
361
|
+
type styleSheetAddRule = {
|
|
362
|
+
rule: string;
|
|
363
|
+
index?: number | number[];
|
|
364
|
+
};
|
|
365
|
+
type styleSheetDeleteRule = {
|
|
366
|
+
index: number | number[];
|
|
367
|
+
};
|
|
368
|
+
type styleSheetRuleParam = {
|
|
369
|
+
id?: number;
|
|
370
|
+
styleId?: number;
|
|
371
|
+
removes?: styleSheetDeleteRule[];
|
|
372
|
+
adds?: styleSheetAddRule[];
|
|
373
|
+
replace?: string;
|
|
374
|
+
replaceSync?: string;
|
|
375
|
+
};
|
|
376
|
+
type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;
|
|
377
|
+
type adoptedStyleSheetParam = {
|
|
378
|
+
id: number;
|
|
379
|
+
styles?: {
|
|
380
|
+
styleId: number;
|
|
381
|
+
rules: styleSheetAddRule[];
|
|
382
|
+
}[];
|
|
383
|
+
styleIds: number[];
|
|
384
|
+
};
|
|
385
|
+
type styleDeclarationParam = {
|
|
386
|
+
id?: number;
|
|
387
|
+
styleId?: number;
|
|
388
|
+
index: number[];
|
|
389
|
+
set?: {
|
|
390
|
+
property: string;
|
|
391
|
+
value: string | null;
|
|
392
|
+
priority: string | undefined;
|
|
393
|
+
};
|
|
394
|
+
remove?: {
|
|
395
|
+
property: string;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
type styleDeclarationCallback = (s: styleDeclarationParam) => void;
|
|
399
|
+
type canvasMutationCommand = {
|
|
400
|
+
property: string;
|
|
401
|
+
args: Array<unknown>;
|
|
402
|
+
setter?: true;
|
|
403
|
+
};
|
|
404
|
+
type canvasMutationParam = {
|
|
405
|
+
id: number;
|
|
406
|
+
type: CanvasContext;
|
|
407
|
+
commands: canvasMutationCommand[];
|
|
408
|
+
} | ({
|
|
409
|
+
id: number;
|
|
410
|
+
type: CanvasContext;
|
|
411
|
+
} & canvasMutationCommand);
|
|
412
|
+
type canvasMutationCallback = (p: canvasMutationParam) => void;
|
|
413
|
+
type fontParam = {
|
|
414
|
+
family: string;
|
|
415
|
+
fontSource: string;
|
|
416
|
+
buffer: boolean;
|
|
417
|
+
descriptors?: FontFaceDescriptors;
|
|
418
|
+
};
|
|
419
|
+
type fontCallback = (p: fontParam) => void;
|
|
420
|
+
type viewportResizeDimension = {
|
|
421
|
+
width: number;
|
|
422
|
+
height: number;
|
|
423
|
+
};
|
|
424
|
+
type viewportResizeCallback = (d: viewportResizeDimension) => void;
|
|
425
|
+
type inputValue = {
|
|
426
|
+
text: string;
|
|
427
|
+
isChecked: boolean;
|
|
428
|
+
userTriggered?: boolean;
|
|
429
|
+
};
|
|
430
|
+
type inputCallback = (v: inputValue & {
|
|
431
|
+
id: number;
|
|
432
|
+
}) => void;
|
|
433
|
+
declare const enum MediaInteractions {
|
|
434
|
+
Play = 0,
|
|
435
|
+
Pause = 1,
|
|
436
|
+
Seeked = 2,
|
|
437
|
+
VolumeChange = 3,
|
|
438
|
+
RateChange = 4
|
|
439
|
+
}
|
|
440
|
+
type mediaInteractionParam = {
|
|
441
|
+
type: MediaInteractions;
|
|
442
|
+
id: number;
|
|
443
|
+
currentTime?: number;
|
|
444
|
+
volume?: number;
|
|
445
|
+
muted?: boolean;
|
|
446
|
+
playbackRate?: number;
|
|
447
|
+
};
|
|
448
|
+
type mediaInteractionCallback = (p: mediaInteractionParam) => void;
|
|
449
|
+
type DocumentDimension = {
|
|
450
|
+
x: number;
|
|
451
|
+
y: number;
|
|
452
|
+
relativeScale: number;
|
|
453
|
+
absoluteScale: number;
|
|
454
|
+
};
|
|
455
|
+
type SelectionRange = {
|
|
456
|
+
start: number;
|
|
457
|
+
startOffset: number;
|
|
458
|
+
end: number;
|
|
459
|
+
endOffset: number;
|
|
460
|
+
};
|
|
461
|
+
type selectionParam = {
|
|
462
|
+
ranges: Array<SelectionRange>;
|
|
463
|
+
};
|
|
464
|
+
type selectionCallback = (p: selectionParam) => void;
|
|
465
|
+
type DeprecatedMirror = {
|
|
466
|
+
map: {
|
|
467
|
+
[key: number]: INode;
|
|
468
|
+
};
|
|
469
|
+
getId: (n: Node) => number;
|
|
470
|
+
getNode: (id: number) => INode | null;
|
|
471
|
+
removeNodeFromMap: (n: Node) => void;
|
|
472
|
+
has: (id: number) => boolean;
|
|
473
|
+
reset: () => void;
|
|
474
|
+
};
|
|
475
|
+
type throttleOptions = {
|
|
476
|
+
leading?: boolean;
|
|
477
|
+
trailing?: boolean;
|
|
478
|
+
};
|
|
479
|
+
type listenerHandler = () => void;
|
|
480
|
+
type hookResetter = () => void;
|
|
481
|
+
type playerMetaData = {
|
|
482
|
+
startTime: number;
|
|
483
|
+
endTime: number;
|
|
484
|
+
totalTime: number;
|
|
485
|
+
};
|
|
486
|
+
type actionWithDelay = {
|
|
487
|
+
doAction: () => void;
|
|
488
|
+
delay: number;
|
|
489
|
+
};
|
|
490
|
+
type Handler = (event?: unknown) => void;
|
|
491
|
+
type Emitter$1 = {
|
|
492
|
+
on(type: string, handler: Handler): void;
|
|
493
|
+
emit(type: string, event?: unknown): void;
|
|
494
|
+
off(type: string, handler: Handler): void;
|
|
495
|
+
};
|
|
496
|
+
declare enum ReplayerEvents {
|
|
497
|
+
Start = "start",
|
|
498
|
+
Pause = "pause",
|
|
499
|
+
Resume = "resume",
|
|
500
|
+
Resize = "resize",
|
|
501
|
+
Finish = "finish",
|
|
502
|
+
FullsnapshotRebuilded = "fullsnapshot-rebuilded",
|
|
503
|
+
LoadStylesheetStart = "load-stylesheet-start",
|
|
504
|
+
LoadStylesheetEnd = "load-stylesheet-end",
|
|
505
|
+
SkipStart = "skip-start",
|
|
506
|
+
SkipEnd = "skip-end",
|
|
507
|
+
MouseInteraction = "mouse-interaction",
|
|
508
|
+
EventCast = "event-cast",
|
|
509
|
+
CustomEvent = "custom-event",
|
|
510
|
+
Flush = "flush",
|
|
511
|
+
StateChange = "state-change",
|
|
512
|
+
PlayBack = "play-back",
|
|
513
|
+
Destroy = "destroy"
|
|
514
|
+
}
|
|
515
|
+
type KeepIframeSrcFn = (src: string) => boolean;
|
|
516
|
+
declare global {
|
|
517
|
+
interface Window {
|
|
518
|
+
FontFace: typeof FontFace;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
type IWindow = Window & typeof globalThis;
|
|
522
|
+
|
|
523
|
+
type PackFn = (event: eventWithTime) => string;
|
|
524
|
+
type UnpackFn = (raw: string) => eventWithTime;
|
|
525
|
+
|
|
526
|
+
interface IRRNode {
|
|
527
|
+
parentElement: IRRNode | null;
|
|
528
|
+
parentNode: IRRNode | null;
|
|
529
|
+
ownerDocument: IRRDocument;
|
|
530
|
+
readonly childNodes: IRRNode[];
|
|
531
|
+
readonly ELEMENT_NODE: number;
|
|
532
|
+
readonly TEXT_NODE: number;
|
|
533
|
+
readonly nodeType: number;
|
|
534
|
+
readonly nodeName: string;
|
|
535
|
+
readonly RRNodeType: NodeType;
|
|
536
|
+
firstChild: IRRNode | null;
|
|
537
|
+
lastChild: IRRNode | null;
|
|
538
|
+
previousSibling: IRRNode | null;
|
|
539
|
+
nextSibling: IRRNode | null;
|
|
540
|
+
textContent: string | null;
|
|
541
|
+
contains(node: IRRNode): boolean;
|
|
542
|
+
appendChild(newChild: IRRNode): IRRNode;
|
|
543
|
+
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
|
|
544
|
+
removeChild(node: IRRNode): IRRNode;
|
|
545
|
+
toString(): string;
|
|
546
|
+
}
|
|
547
|
+
interface IRRDocument extends IRRNode {
|
|
548
|
+
documentElement: IRRElement | null;
|
|
549
|
+
body: IRRElement | null;
|
|
550
|
+
head: IRRElement | null;
|
|
551
|
+
implementation: IRRDocument;
|
|
552
|
+
firstElementChild: IRRElement | null;
|
|
553
|
+
readonly nodeName: '#document';
|
|
554
|
+
compatMode: 'BackCompat' | 'CSS1Compat';
|
|
555
|
+
createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): IRRDocument;
|
|
556
|
+
createDocumentType(qualifiedName: string, publicId: string, systemId: string): IRRDocumentType;
|
|
557
|
+
createElement(tagName: string): IRRElement;
|
|
558
|
+
createElementNS(_namespaceURI: string, qualifiedName: string): IRRElement;
|
|
559
|
+
createTextNode(data: string): IRRText;
|
|
560
|
+
createComment(data: string): IRRComment;
|
|
561
|
+
createCDATASection(data: string): IRRCDATASection;
|
|
562
|
+
open(): void;
|
|
563
|
+
close(): void;
|
|
564
|
+
write(content: string): void;
|
|
565
|
+
}
|
|
566
|
+
interface IRRElement extends IRRNode {
|
|
567
|
+
tagName: string;
|
|
568
|
+
attributes: Record<string, string>;
|
|
569
|
+
shadowRoot: IRRElement | null;
|
|
570
|
+
scrollLeft?: number;
|
|
571
|
+
scrollTop?: number;
|
|
572
|
+
id: string;
|
|
573
|
+
className: string;
|
|
574
|
+
classList: ClassList;
|
|
575
|
+
style: CSSStyleDeclaration;
|
|
576
|
+
attachShadow(init: ShadowRootInit): IRRElement;
|
|
577
|
+
getAttribute(name: string): string | null;
|
|
578
|
+
setAttribute(name: string, attribute: string): void;
|
|
579
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
580
|
+
removeAttribute(name: string): void;
|
|
581
|
+
dispatchEvent(event: Event): boolean;
|
|
582
|
+
}
|
|
583
|
+
interface IRRDocumentType extends IRRNode {
|
|
584
|
+
readonly name: string;
|
|
585
|
+
readonly publicId: string;
|
|
586
|
+
readonly systemId: string;
|
|
587
|
+
}
|
|
588
|
+
interface IRRText extends IRRNode {
|
|
589
|
+
readonly nodeName: '#text';
|
|
590
|
+
data: string;
|
|
591
|
+
}
|
|
592
|
+
interface IRRComment extends IRRNode {
|
|
593
|
+
readonly nodeName: '#comment';
|
|
594
|
+
data: string;
|
|
595
|
+
}
|
|
596
|
+
interface IRRCDATASection extends IRRNode {
|
|
597
|
+
readonly nodeName: '#cdata-section';
|
|
598
|
+
data: string;
|
|
599
|
+
}
|
|
600
|
+
declare class BaseRRNode implements IRRNode {
|
|
601
|
+
parentElement: IRRNode | null;
|
|
602
|
+
parentNode: IRRNode | null;
|
|
603
|
+
ownerDocument: IRRDocument;
|
|
604
|
+
firstChild: IRRNode | null;
|
|
605
|
+
lastChild: IRRNode | null;
|
|
606
|
+
previousSibling: IRRNode | null;
|
|
607
|
+
nextSibling: IRRNode | null;
|
|
608
|
+
textContent: string | null;
|
|
609
|
+
readonly ELEMENT_NODE: number;
|
|
610
|
+
readonly TEXT_NODE: number;
|
|
611
|
+
readonly nodeType: number;
|
|
612
|
+
readonly nodeName: string;
|
|
613
|
+
readonly RRNodeType: NodeType;
|
|
614
|
+
constructor(..._args: any[]);
|
|
615
|
+
get childNodes(): IRRNode[];
|
|
616
|
+
contains(node: IRRNode): boolean;
|
|
617
|
+
appendChild(_newChild: IRRNode): IRRNode;
|
|
618
|
+
insertBefore(_newChild: IRRNode, _refChild: IRRNode | null): IRRNode;
|
|
619
|
+
removeChild(_node: IRRNode): IRRNode;
|
|
620
|
+
toString(): string;
|
|
621
|
+
}
|
|
622
|
+
declare class ClassList {
|
|
623
|
+
private onChange;
|
|
624
|
+
classes: string[];
|
|
625
|
+
constructor(classText?: string, onChange?: ((newClassText: string) => void) | undefined);
|
|
626
|
+
add: (...classNames: string[]) => void;
|
|
627
|
+
remove: (...classNames: string[]) => void;
|
|
628
|
+
}
|
|
629
|
+
type CSSStyleDeclaration = Record<string, string> & {
|
|
630
|
+
setProperty: (name: string, value: string | null, priority?: string | null) => void;
|
|
631
|
+
removeProperty: (name: string) => string;
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
declare const RRDocument_base: {
|
|
635
|
+
new (...args: any[]): {
|
|
636
|
+
readonly nodeType: number;
|
|
637
|
+
readonly nodeName: "#document";
|
|
638
|
+
readonly compatMode: "BackCompat" | "CSS1Compat";
|
|
639
|
+
readonly RRNodeType: NodeType.Document;
|
|
640
|
+
readonly documentElement: IRRElement | null;
|
|
641
|
+
readonly body: IRRElement | null;
|
|
642
|
+
readonly head: IRRElement | null;
|
|
643
|
+
readonly implementation: IRRDocument;
|
|
644
|
+
readonly firstElementChild: IRRElement | null;
|
|
645
|
+
appendChild(newChild: IRRNode): IRRNode;
|
|
646
|
+
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
|
|
647
|
+
removeChild(node: IRRNode): IRRNode;
|
|
648
|
+
open(): void;
|
|
649
|
+
close(): void;
|
|
650
|
+
write(content: string): void;
|
|
651
|
+
createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null | undefined): IRRDocument;
|
|
652
|
+
createDocumentType(qualifiedName: string, publicId: string, systemId: string): IRRDocumentType;
|
|
653
|
+
createElement(tagName: string): IRRElement;
|
|
654
|
+
createElementNS(_namespaceURI: string, qualifiedName: string): IRRElement;
|
|
655
|
+
createTextNode(data: string): IRRText;
|
|
656
|
+
createComment(data: string): IRRComment;
|
|
657
|
+
createCDATASection(data: string): IRRCDATASection;
|
|
658
|
+
toString(): string;
|
|
659
|
+
parentElement: IRRNode | null;
|
|
660
|
+
parentNode: IRRNode | null;
|
|
661
|
+
ownerDocument: IRRDocument;
|
|
662
|
+
readonly childNodes: IRRNode[];
|
|
663
|
+
readonly ELEMENT_NODE: number;
|
|
664
|
+
readonly TEXT_NODE: number;
|
|
665
|
+
firstChild: IRRNode | null;
|
|
666
|
+
lastChild: IRRNode | null;
|
|
667
|
+
previousSibling: IRRNode | null;
|
|
668
|
+
nextSibling: IRRNode | null;
|
|
669
|
+
textContent: string | null;
|
|
670
|
+
contains(node: IRRNode): boolean;
|
|
671
|
+
};
|
|
672
|
+
} & typeof BaseRRNode;
|
|
673
|
+
declare class RRDocument extends RRDocument_base {
|
|
674
|
+
private UNSERIALIZED_STARTING_ID;
|
|
675
|
+
private _unserializedId;
|
|
676
|
+
get unserializedId(): number;
|
|
677
|
+
mirror: Mirror;
|
|
678
|
+
scrollData: scrollData | null;
|
|
679
|
+
constructor(mirror?: Mirror);
|
|
680
|
+
createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): RRDocument;
|
|
681
|
+
createDocumentType(qualifiedName: string, publicId: string, systemId: string): {
|
|
682
|
+
readonly nodeType: number;
|
|
683
|
+
readonly RRNodeType: NodeType.DocumentType;
|
|
684
|
+
readonly nodeName: string;
|
|
685
|
+
readonly name: string;
|
|
686
|
+
readonly publicId: string;
|
|
687
|
+
readonly systemId: string;
|
|
688
|
+
toString(): string;
|
|
689
|
+
parentElement: IRRNode | null;
|
|
690
|
+
parentNode: IRRNode | null;
|
|
691
|
+
ownerDocument: IRRDocument;
|
|
692
|
+
readonly childNodes: IRRNode[];
|
|
693
|
+
readonly ELEMENT_NODE: number;
|
|
694
|
+
readonly TEXT_NODE: number;
|
|
695
|
+
firstChild: IRRNode | null;
|
|
696
|
+
lastChild: IRRNode | null;
|
|
697
|
+
previousSibling: IRRNode | null;
|
|
698
|
+
nextSibling: IRRNode | null;
|
|
699
|
+
textContent: string | null;
|
|
700
|
+
contains(node: IRRNode): boolean;
|
|
701
|
+
appendChild(newChild: IRRNode): IRRNode;
|
|
702
|
+
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
|
|
703
|
+
removeChild(node: IRRNode): IRRNode;
|
|
704
|
+
} & BaseRRNode;
|
|
705
|
+
createElement<K extends keyof HTMLElementTagNameMap>(tagName: K): RRElementType<K>;
|
|
706
|
+
createElement(tagName: string): RRElement;
|
|
707
|
+
createComment(data: string): {
|
|
708
|
+
readonly nodeType: number;
|
|
709
|
+
readonly nodeName: "#comment";
|
|
710
|
+
readonly RRNodeType: NodeType.Comment;
|
|
711
|
+
data: string;
|
|
712
|
+
textContent: string;
|
|
713
|
+
toString(): string;
|
|
714
|
+
parentElement: IRRNode | null;
|
|
715
|
+
parentNode: IRRNode | null;
|
|
716
|
+
ownerDocument: IRRDocument;
|
|
717
|
+
readonly childNodes: IRRNode[];
|
|
718
|
+
readonly ELEMENT_NODE: number;
|
|
719
|
+
readonly TEXT_NODE: number;
|
|
720
|
+
firstChild: IRRNode | null;
|
|
721
|
+
lastChild: IRRNode | null;
|
|
722
|
+
previousSibling: IRRNode | null;
|
|
723
|
+
nextSibling: IRRNode | null;
|
|
724
|
+
contains(node: IRRNode): boolean;
|
|
725
|
+
appendChild(newChild: IRRNode): IRRNode;
|
|
726
|
+
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
|
|
727
|
+
removeChild(node: IRRNode): IRRNode;
|
|
728
|
+
} & BaseRRNode;
|
|
729
|
+
createCDATASection(data: string): {
|
|
730
|
+
readonly nodeName: "#cdata-section";
|
|
731
|
+
readonly nodeType: number;
|
|
732
|
+
readonly RRNodeType: NodeType.CDATA;
|
|
733
|
+
data: string;
|
|
734
|
+
textContent: string;
|
|
735
|
+
toString(): string;
|
|
736
|
+
parentElement: IRRNode | null;
|
|
737
|
+
parentNode: IRRNode | null;
|
|
738
|
+
ownerDocument: IRRDocument;
|
|
739
|
+
readonly childNodes: IRRNode[];
|
|
740
|
+
readonly ELEMENT_NODE: number;
|
|
741
|
+
readonly TEXT_NODE: number;
|
|
742
|
+
firstChild: IRRNode | null;
|
|
743
|
+
lastChild: IRRNode | null;
|
|
744
|
+
previousSibling: IRRNode | null;
|
|
745
|
+
nextSibling: IRRNode | null;
|
|
746
|
+
contains(node: IRRNode): boolean;
|
|
747
|
+
appendChild(newChild: IRRNode): IRRNode;
|
|
748
|
+
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
|
|
749
|
+
removeChild(node: IRRNode): IRRNode;
|
|
750
|
+
} & BaseRRNode;
|
|
751
|
+
createTextNode(data: string): {
|
|
752
|
+
readonly nodeType: number;
|
|
753
|
+
readonly nodeName: "#text";
|
|
754
|
+
readonly RRNodeType: NodeType.Text;
|
|
755
|
+
data: string;
|
|
756
|
+
textContent: string;
|
|
757
|
+
toString(): string;
|
|
758
|
+
parentElement: IRRNode | null;
|
|
759
|
+
parentNode: IRRNode | null;
|
|
760
|
+
ownerDocument: IRRDocument;
|
|
761
|
+
readonly childNodes: IRRNode[];
|
|
762
|
+
readonly ELEMENT_NODE: number;
|
|
763
|
+
readonly TEXT_NODE: number;
|
|
764
|
+
firstChild: IRRNode | null;
|
|
765
|
+
lastChild: IRRNode | null;
|
|
766
|
+
previousSibling: IRRNode | null;
|
|
767
|
+
nextSibling: IRRNode | null;
|
|
768
|
+
contains(node: IRRNode): boolean;
|
|
769
|
+
appendChild(newChild: IRRNode): IRRNode;
|
|
770
|
+
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
|
|
771
|
+
removeChild(node: IRRNode): IRRNode;
|
|
772
|
+
} & BaseRRNode;
|
|
773
|
+
destroyTree(): void;
|
|
774
|
+
open(): void;
|
|
775
|
+
}
|
|
776
|
+
declare const RRElement_base: {
|
|
777
|
+
new (tagName: string): {
|
|
778
|
+
readonly nodeType: number;
|
|
779
|
+
readonly RRNodeType: NodeType.Element;
|
|
780
|
+
readonly nodeName: string;
|
|
781
|
+
tagName: string;
|
|
782
|
+
attributes: Record<string, string>;
|
|
783
|
+
shadowRoot: IRRElement | null;
|
|
784
|
+
scrollLeft?: number | undefined;
|
|
785
|
+
scrollTop?: number | undefined;
|
|
786
|
+
textContent: string;
|
|
787
|
+
readonly classList: ClassList;
|
|
788
|
+
readonly id: string;
|
|
789
|
+
readonly className: string;
|
|
790
|
+
readonly style: CSSStyleDeclaration;
|
|
791
|
+
getAttribute(name: string): string | null;
|
|
792
|
+
setAttribute(name: string, attribute: string): void;
|
|
793
|
+
setAttributeNS(_namespace: string | null, qualifiedName: string, value: string): void;
|
|
794
|
+
removeAttribute(name: string): void;
|
|
795
|
+
appendChild(newChild: IRRNode): IRRNode;
|
|
796
|
+
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
|
|
797
|
+
removeChild(node: IRRNode): IRRNode;
|
|
798
|
+
attachShadow(_init: ShadowRootInit): IRRElement;
|
|
799
|
+
dispatchEvent(_event: Event): boolean;
|
|
800
|
+
toString(): string;
|
|
801
|
+
parentElement: IRRNode | null;
|
|
802
|
+
parentNode: IRRNode | null;
|
|
803
|
+
ownerDocument: IRRDocument;
|
|
804
|
+
readonly childNodes: IRRNode[];
|
|
805
|
+
readonly ELEMENT_NODE: number;
|
|
806
|
+
readonly TEXT_NODE: number;
|
|
807
|
+
firstChild: IRRNode | null;
|
|
808
|
+
lastChild: IRRNode | null;
|
|
809
|
+
previousSibling: IRRNode | null;
|
|
810
|
+
nextSibling: IRRNode | null;
|
|
811
|
+
contains(node: IRRNode): boolean;
|
|
812
|
+
};
|
|
813
|
+
} & typeof BaseRRNode;
|
|
814
|
+
declare class RRElement extends RRElement_base {
|
|
815
|
+
inputData: inputData | null;
|
|
816
|
+
scrollData: scrollData | null;
|
|
817
|
+
}
|
|
818
|
+
declare const RRMediaElement_base: {
|
|
819
|
+
new (...args: any[]): {
|
|
820
|
+
currentTime?: number | undefined;
|
|
821
|
+
volume?: number | undefined;
|
|
822
|
+
paused?: boolean | undefined;
|
|
823
|
+
muted?: boolean | undefined;
|
|
824
|
+
playbackRate?: number | undefined;
|
|
825
|
+
attachShadow(_init: ShadowRootInit): IRRElement;
|
|
826
|
+
play(): void;
|
|
827
|
+
pause(): void;
|
|
828
|
+
tagName: string;
|
|
829
|
+
attributes: Record<string, string>;
|
|
830
|
+
shadowRoot: IRRElement | null;
|
|
831
|
+
scrollLeft?: number | undefined;
|
|
832
|
+
scrollTop?: number | undefined;
|
|
833
|
+
id: string;
|
|
834
|
+
className: string;
|
|
835
|
+
classList: ClassList;
|
|
836
|
+
style: CSSStyleDeclaration;
|
|
837
|
+
getAttribute(name: string): string | null;
|
|
838
|
+
setAttribute(name: string, attribute: string): void;
|
|
839
|
+
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
840
|
+
removeAttribute(name: string): void;
|
|
841
|
+
dispatchEvent(event: Event): boolean;
|
|
842
|
+
parentElement: IRRNode | null;
|
|
843
|
+
parentNode: IRRNode | null;
|
|
844
|
+
ownerDocument: IRRDocument;
|
|
845
|
+
readonly childNodes: IRRNode[];
|
|
846
|
+
readonly ELEMENT_NODE: number;
|
|
847
|
+
readonly TEXT_NODE: number;
|
|
848
|
+
readonly nodeType: number;
|
|
849
|
+
readonly nodeName: string;
|
|
850
|
+
readonly RRNodeType: NodeType;
|
|
851
|
+
firstChild: IRRNode | null;
|
|
852
|
+
lastChild: IRRNode | null;
|
|
853
|
+
previousSibling: IRRNode | null;
|
|
854
|
+
nextSibling: IRRNode | null;
|
|
855
|
+
textContent: string | null;
|
|
856
|
+
contains(node: IRRNode): boolean;
|
|
857
|
+
appendChild(newChild: IRRNode): IRRNode;
|
|
858
|
+
insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
|
|
859
|
+
removeChild(node: IRRNode): IRRNode;
|
|
860
|
+
toString(): string;
|
|
861
|
+
};
|
|
862
|
+
} & typeof RRElement;
|
|
863
|
+
declare class RRMediaElement extends RRMediaElement_base {
|
|
864
|
+
}
|
|
865
|
+
declare class RRCanvasElement extends RRElement implements IRRElement {
|
|
866
|
+
rr_dataURL: string | null;
|
|
867
|
+
canvasMutations: {
|
|
868
|
+
event: canvasEventWithTime;
|
|
869
|
+
mutation: canvasMutationData;
|
|
870
|
+
}[];
|
|
871
|
+
getContext(): RenderingContext | null;
|
|
872
|
+
}
|
|
873
|
+
declare class RRStyleElement extends RRElement {
|
|
874
|
+
rules: (styleSheetRuleData | styleDeclarationData)[];
|
|
875
|
+
}
|
|
876
|
+
declare class RRIFrameElement extends RRElement {
|
|
877
|
+
contentDocument: RRDocument;
|
|
878
|
+
constructor(upperTagName: string, mirror: Mirror);
|
|
879
|
+
}
|
|
880
|
+
interface RRElementTagNameMap {
|
|
881
|
+
audio: RRMediaElement;
|
|
882
|
+
canvas: RRCanvasElement;
|
|
883
|
+
iframe: RRIFrameElement;
|
|
884
|
+
style: RRStyleElement;
|
|
885
|
+
video: RRMediaElement;
|
|
886
|
+
}
|
|
887
|
+
type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement;
|
|
888
|
+
declare class Mirror implements IMirror<BaseRRNode> {
|
|
889
|
+
private idNodeMap;
|
|
890
|
+
private nodeMetaMap;
|
|
891
|
+
getId(n: BaseRRNode | undefined | null): number;
|
|
892
|
+
getNode(id: number): BaseRRNode | null;
|
|
893
|
+
getIds(): number[];
|
|
894
|
+
getMeta(n: BaseRRNode): serializedNodeWithId | null;
|
|
895
|
+
removeNodeFromMap(n: BaseRRNode): void;
|
|
896
|
+
has(id: number): boolean;
|
|
897
|
+
hasNode(node: BaseRRNode): boolean;
|
|
898
|
+
add(n: BaseRRNode, meta: serializedNodeWithId): void;
|
|
899
|
+
replace(id: number, n: BaseRRNode): void;
|
|
900
|
+
reset(): void;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
declare function on(type: string, fn: EventListenerOrEventListenerObject, target?: Document | IWindow): listenerHandler;
|
|
904
|
+
declare let _mirror: DeprecatedMirror;
|
|
905
|
+
declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (...args: T[]) => void;
|
|
906
|
+
declare function hookSetter<T>(target: T, key: string | number | symbol, d: PropertyDescriptor, isRevoked?: boolean, win?: Window & typeof globalThis): hookResetter;
|
|
907
|
+
declare function patch(source: {
|
|
908
|
+
[key: string]: any;
|
|
909
|
+
}, name: string, replacement: (...args: unknown[]) => unknown): () => void;
|
|
910
|
+
declare let nowTimestamp: () => number;
|
|
911
|
+
|
|
912
|
+
declare function getWindowScroll(win: Window): {
|
|
913
|
+
left: number;
|
|
914
|
+
top: number;
|
|
915
|
+
};
|
|
916
|
+
declare function getWindowHeight(): number;
|
|
917
|
+
declare function getWindowWidth(): number;
|
|
918
|
+
declare function isBlocked(node: Node | null, blockClass: blockClass, blockSelector: string | null, checkAncestors: boolean): boolean;
|
|
919
|
+
declare function isSerialized(n: Node, mirror: Mirror$1): boolean;
|
|
920
|
+
declare function isIgnored(n: Node, mirror: Mirror$1): boolean;
|
|
921
|
+
declare function isAncestorRemoved(target: Node, mirror: Mirror$1): boolean;
|
|
922
|
+
declare function legacy_isTouchEvent(event: MouseEvent | TouchEvent | PointerEvent): event is TouchEvent;
|
|
923
|
+
declare function polyfill(win?: Window & typeof globalThis): void;
|
|
924
|
+
type ResolveTree = {
|
|
925
|
+
value: addedNodeMutation;
|
|
926
|
+
children: ResolveTree[];
|
|
927
|
+
parent: ResolveTree | null;
|
|
928
|
+
};
|
|
929
|
+
declare function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[];
|
|
930
|
+
declare function iterateResolveTree(tree: ResolveTree, cb: (mutation: addedNodeMutation) => unknown): void;
|
|
931
|
+
type AppendedIframe = {
|
|
932
|
+
mutationInQueue: addedNodeMutation;
|
|
933
|
+
builtNode: HTMLIFrameElement | RRIFrameElement;
|
|
934
|
+
};
|
|
935
|
+
declare function isSerializedIframe<TNode extends Node | BaseRRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
|
|
936
|
+
declare function isSerializedStylesheet<TNode extends Node | BaseRRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
|
|
937
|
+
declare function getBaseDimension(node: Node, rootIframe: Node): DocumentDimension;
|
|
938
|
+
declare function hasShadowRoot<T extends Node | BaseRRNode>(n: T): n is T & {
|
|
939
|
+
shadowRoot: ShadowRoot;
|
|
940
|
+
};
|
|
941
|
+
declare function getNestedRule(rules: CSSRuleList, position: number[]): CSSGroupingRule;
|
|
942
|
+
declare function getPositionsAndIndex(nestedIndex: number[]): {
|
|
943
|
+
positions: number[];
|
|
944
|
+
index: number | undefined;
|
|
945
|
+
};
|
|
946
|
+
declare function uniqueTextMutations(mutations: textMutation[]): textMutation[];
|
|
947
|
+
declare class StyleSheetMirror {
|
|
948
|
+
private id;
|
|
949
|
+
private styleIDMap;
|
|
950
|
+
private idStyleMap;
|
|
951
|
+
getId(stylesheet: CSSStyleSheet): number;
|
|
952
|
+
has(stylesheet: CSSStyleSheet): boolean;
|
|
953
|
+
add(stylesheet: CSSStyleSheet, id?: number): number;
|
|
954
|
+
getStyle(id: number): CSSStyleSheet | null;
|
|
955
|
+
reset(): void;
|
|
956
|
+
generateId(): number;
|
|
957
|
+
}
|
|
958
|
+
declare function getShadowHost(n: Node): Element | null;
|
|
959
|
+
declare function getRootShadowHost(n: Node): Node;
|
|
960
|
+
declare function shadowHostInDom(n: Node): boolean;
|
|
961
|
+
declare function inDom(n: Node): boolean;
|
|
962
|
+
|
|
963
|
+
type utils_d_AppendedIframe = AppendedIframe;
|
|
964
|
+
type utils_d_StyleSheetMirror = StyleSheetMirror;
|
|
965
|
+
declare const utils_d_StyleSheetMirror: typeof StyleSheetMirror;
|
|
966
|
+
declare const utils_d__mirror: typeof _mirror;
|
|
967
|
+
declare const utils_d_getBaseDimension: typeof getBaseDimension;
|
|
968
|
+
declare const utils_d_getNestedRule: typeof getNestedRule;
|
|
969
|
+
declare const utils_d_getPositionsAndIndex: typeof getPositionsAndIndex;
|
|
970
|
+
declare const utils_d_getRootShadowHost: typeof getRootShadowHost;
|
|
971
|
+
declare const utils_d_getShadowHost: typeof getShadowHost;
|
|
972
|
+
declare const utils_d_getWindowHeight: typeof getWindowHeight;
|
|
973
|
+
declare const utils_d_getWindowScroll: typeof getWindowScroll;
|
|
974
|
+
declare const utils_d_getWindowWidth: typeof getWindowWidth;
|
|
975
|
+
declare const utils_d_hasShadowRoot: typeof hasShadowRoot;
|
|
976
|
+
declare const utils_d_hookSetter: typeof hookSetter;
|
|
977
|
+
declare const utils_d_inDom: typeof inDom;
|
|
978
|
+
declare const utils_d_isAncestorRemoved: typeof isAncestorRemoved;
|
|
979
|
+
declare const utils_d_isBlocked: typeof isBlocked;
|
|
980
|
+
declare const utils_d_isIgnored: typeof isIgnored;
|
|
981
|
+
declare const utils_d_isSerialized: typeof isSerialized;
|
|
982
|
+
declare const utils_d_isSerializedIframe: typeof isSerializedIframe;
|
|
983
|
+
declare const utils_d_isSerializedStylesheet: typeof isSerializedStylesheet;
|
|
984
|
+
declare const utils_d_iterateResolveTree: typeof iterateResolveTree;
|
|
985
|
+
declare const utils_d_legacy_isTouchEvent: typeof legacy_isTouchEvent;
|
|
986
|
+
declare const utils_d_nowTimestamp: typeof nowTimestamp;
|
|
987
|
+
declare const utils_d_on: typeof on;
|
|
988
|
+
declare const utils_d_patch: typeof patch;
|
|
989
|
+
declare const utils_d_polyfill: typeof polyfill;
|
|
990
|
+
declare const utils_d_queueToResolveTrees: typeof queueToResolveTrees;
|
|
991
|
+
declare const utils_d_shadowHostInDom: typeof shadowHostInDom;
|
|
992
|
+
declare const utils_d_throttle: typeof throttle;
|
|
993
|
+
declare const utils_d_uniqueTextMutations: typeof uniqueTextMutations;
|
|
994
|
+
declare namespace utils_d {
|
|
995
|
+
export {
|
|
996
|
+
utils_d_AppendedIframe as AppendedIframe,
|
|
997
|
+
utils_d_StyleSheetMirror as StyleSheetMirror,
|
|
998
|
+
utils_d__mirror as _mirror,
|
|
999
|
+
utils_d_getBaseDimension as getBaseDimension,
|
|
1000
|
+
utils_d_getNestedRule as getNestedRule,
|
|
1001
|
+
utils_d_getPositionsAndIndex as getPositionsAndIndex,
|
|
1002
|
+
utils_d_getRootShadowHost as getRootShadowHost,
|
|
1003
|
+
utils_d_getShadowHost as getShadowHost,
|
|
1004
|
+
utils_d_getWindowHeight as getWindowHeight,
|
|
1005
|
+
utils_d_getWindowScroll as getWindowScroll,
|
|
1006
|
+
utils_d_getWindowWidth as getWindowWidth,
|
|
1007
|
+
utils_d_hasShadowRoot as hasShadowRoot,
|
|
1008
|
+
utils_d_hookSetter as hookSetter,
|
|
1009
|
+
utils_d_inDom as inDom,
|
|
1010
|
+
utils_d_isAncestorRemoved as isAncestorRemoved,
|
|
1011
|
+
utils_d_isBlocked as isBlocked,
|
|
1012
|
+
utils_d_isIgnored as isIgnored,
|
|
1013
|
+
utils_d_isSerialized as isSerialized,
|
|
1014
|
+
utils_d_isSerializedIframe as isSerializedIframe,
|
|
1015
|
+
utils_d_isSerializedStylesheet as isSerializedStylesheet,
|
|
1016
|
+
utils_d_iterateResolveTree as iterateResolveTree,
|
|
1017
|
+
utils_d_legacy_isTouchEvent as legacy_isTouchEvent,
|
|
1018
|
+
utils_d_nowTimestamp as nowTimestamp,
|
|
1019
|
+
utils_d_on as on,
|
|
1020
|
+
utils_d_patch as patch,
|
|
1021
|
+
utils_d_polyfill as polyfill,
|
|
1022
|
+
utils_d_queueToResolveTrees as queueToResolveTrees,
|
|
1023
|
+
utils_d_shadowHostInDom as shadowHostInDom,
|
|
1024
|
+
utils_d_throttle as throttle,
|
|
1025
|
+
utils_d_uniqueTextMutations as uniqueTextMutations,
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
declare class Timer {
|
|
1030
|
+
timeOffset: number;
|
|
1031
|
+
speed: number;
|
|
1032
|
+
private actions;
|
|
1033
|
+
private raf;
|
|
1034
|
+
private lastTimestamp;
|
|
1035
|
+
constructor(actions: actionWithDelay[] | undefined, config: {
|
|
1036
|
+
speed: number;
|
|
1037
|
+
});
|
|
1038
|
+
addAction(action: actionWithDelay): void;
|
|
1039
|
+
start(): void;
|
|
1040
|
+
private rafCheck;
|
|
1041
|
+
clear(): void;
|
|
1042
|
+
setSpeed(speed: number): void;
|
|
1043
|
+
isActive(): boolean;
|
|
1044
|
+
private findActionIndex;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
declare enum InterpreterStatus {
|
|
1048
|
+
NotStarted = 0,
|
|
1049
|
+
Running = 1,
|
|
1050
|
+
Stopped = 2
|
|
1051
|
+
}
|
|
1052
|
+
declare type SingleOrArray<T> = T[] | T;
|
|
1053
|
+
interface EventObject {
|
|
1054
|
+
type: string;
|
|
1055
|
+
}
|
|
1056
|
+
declare type InitEvent = {
|
|
1057
|
+
type: 'xstate.init';
|
|
1058
|
+
};
|
|
1059
|
+
declare namespace StateMachine {
|
|
1060
|
+
type Action<TContext extends object, TEvent extends EventObject> = string | AssignActionObject<TContext, TEvent> | ActionObject<TContext, TEvent> | ActionFunction<TContext, TEvent>;
|
|
1061
|
+
type ActionMap<TContext extends object, TEvent extends EventObject> = Record<string, Exclude<Action<TContext, TEvent>, string>>;
|
|
1062
|
+
interface ActionObject<TContext extends object, TEvent extends EventObject> {
|
|
1063
|
+
type: string;
|
|
1064
|
+
exec?: ActionFunction<TContext, TEvent>;
|
|
1065
|
+
[key: string]: any;
|
|
1066
|
+
}
|
|
1067
|
+
type ActionFunction<TContext extends object, TEvent extends EventObject> = (context: TContext, event: TEvent | InitEvent) => void;
|
|
1068
|
+
type AssignAction = 'xstate.assign';
|
|
1069
|
+
interface AssignActionObject<TContext extends object, TEvent extends EventObject> extends ActionObject<TContext, TEvent> {
|
|
1070
|
+
type: AssignAction;
|
|
1071
|
+
assignment: Assigner<TContext, TEvent> | PropertyAssigner<TContext, TEvent>;
|
|
1072
|
+
}
|
|
1073
|
+
type Transition<TContext extends object, TEvent extends EventObject> = string | {
|
|
1074
|
+
target?: string;
|
|
1075
|
+
actions?: SingleOrArray<Action<TContext, TEvent>>;
|
|
1076
|
+
cond?: (context: TContext, event: TEvent) => boolean;
|
|
1077
|
+
};
|
|
1078
|
+
interface State<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext>> {
|
|
1079
|
+
value: TState['value'];
|
|
1080
|
+
context: TContext;
|
|
1081
|
+
actions: Array<ActionObject<TContext, TEvent>>;
|
|
1082
|
+
changed?: boolean | undefined;
|
|
1083
|
+
matches: <TSV extends TState['value']>(value: TSV) => this is TState extends {
|
|
1084
|
+
value: TSV;
|
|
1085
|
+
} ? TState & {
|
|
1086
|
+
value: TSV;
|
|
1087
|
+
} : never;
|
|
1088
|
+
}
|
|
1089
|
+
type AnyState = State<any, any, any>;
|
|
1090
|
+
interface Config<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext> = {
|
|
1091
|
+
value: any;
|
|
1092
|
+
context: TContext;
|
|
1093
|
+
}> {
|
|
1094
|
+
id?: string;
|
|
1095
|
+
initial: string;
|
|
1096
|
+
context?: TContext;
|
|
1097
|
+
states: {
|
|
1098
|
+
[key in TState['value']]: {
|
|
1099
|
+
on?: {
|
|
1100
|
+
[K in TEvent['type']]?: SingleOrArray<Transition<TContext, TEvent extends {
|
|
1101
|
+
type: K;
|
|
1102
|
+
} ? TEvent : never>>;
|
|
1103
|
+
};
|
|
1104
|
+
exit?: SingleOrArray<Action<TContext, TEvent>>;
|
|
1105
|
+
entry?: SingleOrArray<Action<TContext, TEvent>>;
|
|
1106
|
+
};
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
interface Machine<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext>> {
|
|
1110
|
+
config: StateMachine.Config<TContext, TEvent, TState>;
|
|
1111
|
+
initialState: State<TContext, TEvent, TState>;
|
|
1112
|
+
transition: (state: string | State<TContext, TEvent, TState>, event: TEvent['type'] | TEvent) => State<TContext, TEvent, TState>;
|
|
1113
|
+
}
|
|
1114
|
+
type StateListener<T extends AnyState> = (state: T) => void;
|
|
1115
|
+
interface Service<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext> = {
|
|
1116
|
+
value: any;
|
|
1117
|
+
context: TContext;
|
|
1118
|
+
}> {
|
|
1119
|
+
send: (event: TEvent | TEvent['type']) => void;
|
|
1120
|
+
subscribe: (listener: StateListener<State<TContext, TEvent, TState>>) => {
|
|
1121
|
+
unsubscribe: () => void;
|
|
1122
|
+
};
|
|
1123
|
+
start: (initialState?: TState['value'] | {
|
|
1124
|
+
context: TContext;
|
|
1125
|
+
value: TState['value'];
|
|
1126
|
+
}) => Service<TContext, TEvent, TState>;
|
|
1127
|
+
stop: () => Service<TContext, TEvent, TState>;
|
|
1128
|
+
readonly status: InterpreterStatus;
|
|
1129
|
+
readonly state: State<TContext, TEvent, TState>;
|
|
1130
|
+
}
|
|
1131
|
+
type Assigner<TContext extends object, TEvent extends EventObject> = (context: TContext, event: TEvent) => Partial<TContext>;
|
|
1132
|
+
type PropertyAssigner<TContext extends object, TEvent extends EventObject> = {
|
|
1133
|
+
[K in keyof TContext]?: ((context: TContext, event: TEvent) => TContext[K]) | TContext[K];
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
interface Typestate<TContext extends object> {
|
|
1137
|
+
value: string;
|
|
1138
|
+
context: TContext;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
type PlayerContext = {
|
|
1142
|
+
events: eventWithTime[];
|
|
1143
|
+
timer: Timer;
|
|
1144
|
+
timeOffset: number;
|
|
1145
|
+
baselineTime: number;
|
|
1146
|
+
lastPlayedEvent: eventWithTime | null;
|
|
1147
|
+
};
|
|
1148
|
+
type PlayerEvent = {
|
|
1149
|
+
type: 'PLAY';
|
|
1150
|
+
payload: {
|
|
1151
|
+
timeOffset: number;
|
|
1152
|
+
};
|
|
1153
|
+
} | {
|
|
1154
|
+
type: 'CAST_EVENT';
|
|
1155
|
+
payload: {
|
|
1156
|
+
event: eventWithTime;
|
|
1157
|
+
};
|
|
1158
|
+
} | {
|
|
1159
|
+
type: 'PAUSE';
|
|
1160
|
+
} | {
|
|
1161
|
+
type: 'TO_LIVE';
|
|
1162
|
+
payload: {
|
|
1163
|
+
baselineTime?: number;
|
|
1164
|
+
};
|
|
1165
|
+
} | {
|
|
1166
|
+
type: 'ADD_EVENT';
|
|
1167
|
+
payload: {
|
|
1168
|
+
event: eventWithTime;
|
|
1169
|
+
};
|
|
1170
|
+
} | {
|
|
1171
|
+
type: 'END';
|
|
1172
|
+
};
|
|
1173
|
+
type PlayerState = {
|
|
1174
|
+
value: 'playing';
|
|
1175
|
+
context: PlayerContext;
|
|
1176
|
+
} | {
|
|
1177
|
+
value: 'paused';
|
|
1178
|
+
context: PlayerContext;
|
|
1179
|
+
} | {
|
|
1180
|
+
value: 'live';
|
|
1181
|
+
context: PlayerContext;
|
|
1182
|
+
};
|
|
1183
|
+
type PlayerAssets = {
|
|
1184
|
+
emitter: Emitter$1;
|
|
1185
|
+
applyEventsSynchronously(events: Array<eventWithTime>): void;
|
|
1186
|
+
getCastFn(event: eventWithTime, isSync: boolean): () => void;
|
|
1187
|
+
};
|
|
1188
|
+
declare function createPlayerService(context: PlayerContext, { getCastFn, applyEventsSynchronously, emitter }: PlayerAssets): StateMachine.Service<PlayerContext, PlayerEvent, PlayerState>;
|
|
1189
|
+
type SpeedContext = {
|
|
1190
|
+
normalSpeed: playerConfig['speed'];
|
|
1191
|
+
timer: Timer;
|
|
1192
|
+
};
|
|
1193
|
+
type SpeedEvent = {
|
|
1194
|
+
type: 'FAST_FORWARD';
|
|
1195
|
+
payload: {
|
|
1196
|
+
speed: playerConfig['speed'];
|
|
1197
|
+
};
|
|
1198
|
+
} | {
|
|
1199
|
+
type: 'BACK_TO_NORMAL';
|
|
1200
|
+
} | {
|
|
1201
|
+
type: 'SET_SPEED';
|
|
1202
|
+
payload: {
|
|
1203
|
+
speed: playerConfig['speed'];
|
|
1204
|
+
};
|
|
1205
|
+
};
|
|
1206
|
+
type SpeedState = {
|
|
1207
|
+
value: 'normal';
|
|
1208
|
+
context: SpeedContext;
|
|
1209
|
+
} | {
|
|
1210
|
+
value: 'skipping';
|
|
1211
|
+
context: SpeedContext;
|
|
1212
|
+
};
|
|
1213
|
+
declare function createSpeedService(context: SpeedContext): StateMachine.Service<SpeedContext, SpeedEvent, SpeedState>;
|
|
1214
|
+
|
|
1215
|
+
declare class Replayer {
|
|
1216
|
+
wrapper: HTMLDivElement;
|
|
1217
|
+
iframe: HTMLIFrameElement;
|
|
1218
|
+
service: ReturnType<typeof createPlayerService>;
|
|
1219
|
+
speedService: ReturnType<typeof createSpeedService>;
|
|
1220
|
+
get timer(): Timer;
|
|
1221
|
+
config: playerConfig;
|
|
1222
|
+
usingVirtualDom: boolean;
|
|
1223
|
+
virtualDom: RRDocument;
|
|
1224
|
+
private mouse;
|
|
1225
|
+
private mouseTail;
|
|
1226
|
+
private tailPositions;
|
|
1227
|
+
private emitter;
|
|
1228
|
+
private nextUserInteractionEvent;
|
|
1229
|
+
private legacy_missingNodeRetryMap;
|
|
1230
|
+
private cache;
|
|
1231
|
+
private imageMap;
|
|
1232
|
+
private canvasEventMap;
|
|
1233
|
+
private mirror;
|
|
1234
|
+
private styleMirror;
|
|
1235
|
+
private firstFullSnapshot;
|
|
1236
|
+
private newDocumentQueue;
|
|
1237
|
+
private mousePos;
|
|
1238
|
+
private touchActive;
|
|
1239
|
+
private lastMouseDownEvent;
|
|
1240
|
+
private lastHoveredRootNode;
|
|
1241
|
+
private lastSelectionData;
|
|
1242
|
+
private constructedStyleMutations;
|
|
1243
|
+
private adoptedStyleSheets;
|
|
1244
|
+
constructor(events: Array<eventWithTime | string>, config?: Partial<playerConfig>);
|
|
1245
|
+
on(event: string, handler: Handler): this;
|
|
1246
|
+
off(event: string, handler: Handler): this;
|
|
1247
|
+
setConfig(config: Partial<playerConfig>): void;
|
|
1248
|
+
getMetaData(): playerMetaData;
|
|
1249
|
+
getCurrentTime(): number;
|
|
1250
|
+
getTimeOffset(): number;
|
|
1251
|
+
getMirror(): Mirror$1;
|
|
1252
|
+
play(timeOffset?: number): void;
|
|
1253
|
+
pause(timeOffset?: number): void;
|
|
1254
|
+
resume(timeOffset?: number): void;
|
|
1255
|
+
destroy(): void;
|
|
1256
|
+
startLive(baselineTime?: number): void;
|
|
1257
|
+
addEvent(rawEvent: eventWithTime | string): void;
|
|
1258
|
+
enableInteract(): void;
|
|
1259
|
+
disableInteract(): void;
|
|
1260
|
+
resetCache(): void;
|
|
1261
|
+
private setupDom;
|
|
1262
|
+
private handleResize;
|
|
1263
|
+
private applyEventsSynchronously;
|
|
1264
|
+
private getCastFn;
|
|
1265
|
+
private rebuildFullSnapshot;
|
|
1266
|
+
private insertStyleRules;
|
|
1267
|
+
private attachDocumentToIframe;
|
|
1268
|
+
private collectIframeAndAttachDocument;
|
|
1269
|
+
private waitForStylesheetLoad;
|
|
1270
|
+
private preloadAllImages;
|
|
1271
|
+
private preloadImages;
|
|
1272
|
+
private deserializeAndPreloadCanvasEvents;
|
|
1273
|
+
private applyIncremental;
|
|
1274
|
+
private applyMutation;
|
|
1275
|
+
private applyScroll;
|
|
1276
|
+
private applyInput;
|
|
1277
|
+
private applySelection;
|
|
1278
|
+
private applyStyleSheetMutation;
|
|
1279
|
+
private applyStyleSheetRule;
|
|
1280
|
+
private applyStyleDeclaration;
|
|
1281
|
+
private applyAdoptedStyleSheet;
|
|
1282
|
+
private legacy_resolveMissingNode;
|
|
1283
|
+
private moveAndHover;
|
|
1284
|
+
private drawMouseTail;
|
|
1285
|
+
private hoverElements;
|
|
1286
|
+
private isUserInteraction;
|
|
1287
|
+
private backToNormal;
|
|
1288
|
+
private warnNodeNotFound;
|
|
1289
|
+
private warnCanvasMutationFailed;
|
|
1290
|
+
private debugNodeNotFound;
|
|
1291
|
+
private warn;
|
|
1292
|
+
private debug;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
type recordOptions<T> = {
|
|
1296
|
+
emit?: (e: T, isCheckout?: boolean) => void;
|
|
1297
|
+
checkoutEveryNth?: number;
|
|
1298
|
+
checkoutEveryNms?: number;
|
|
1299
|
+
blockClass?: blockClass;
|
|
1300
|
+
blockSelector?: string;
|
|
1301
|
+
ignoreClass?: string;
|
|
1302
|
+
ignoreSelector?: string;
|
|
1303
|
+
maskTextClass?: maskTextClass;
|
|
1304
|
+
maskTextSelector?: string;
|
|
1305
|
+
maskAllInputs?: boolean;
|
|
1306
|
+
maskInputOptions?: MaskInputOptions;
|
|
1307
|
+
maskInputFn?: MaskInputFn;
|
|
1308
|
+
maskTextFn?: MaskTextFn;
|
|
1309
|
+
slimDOMOptions?: SlimDOMOptions | 'all' | true;
|
|
1310
|
+
ignoreCSSAttributes?: Set<string>;
|
|
1311
|
+
inlineStylesheet?: boolean;
|
|
1312
|
+
hooks?: hooksParam;
|
|
1313
|
+
packFn?: PackFn;
|
|
1314
|
+
sampling?: SamplingStrategy;
|
|
1315
|
+
dataURLOptions?: DataURLOptions;
|
|
1316
|
+
recordCanvas?: boolean;
|
|
1317
|
+
recordCrossOriginIframes?: boolean;
|
|
1318
|
+
recordAfter?: 'DOMContentLoaded' | 'load';
|
|
1319
|
+
userTriggeredOnInput?: boolean;
|
|
1320
|
+
collectFonts?: boolean;
|
|
1321
|
+
inlineImages?: boolean;
|
|
1322
|
+
plugins?: RecordPlugin[];
|
|
1323
|
+
mousemoveWait?: number;
|
|
1324
|
+
keepIframeSrcFn?: KeepIframeSrcFn;
|
|
1325
|
+
errorHandler?: ErrorHandler;
|
|
1326
|
+
};
|
|
1327
|
+
type ReplayPlugin = {
|
|
1328
|
+
handler?: (event: eventWithTime, isSync: boolean, context: {
|
|
1329
|
+
replayer: Replayer;
|
|
1330
|
+
}) => void;
|
|
1331
|
+
onBuild?: (node: Node | BaseRRNode, context: {
|
|
1332
|
+
id: number;
|
|
1333
|
+
replayer: Replayer;
|
|
1334
|
+
}) => void;
|
|
1335
|
+
getMirror?: (mirrors: {
|
|
1336
|
+
nodeMirror: Mirror$1;
|
|
1337
|
+
}) => void;
|
|
1338
|
+
};
|
|
1339
|
+
type playerConfig = {
|
|
1340
|
+
speed: number;
|
|
1341
|
+
maxSpeed: number;
|
|
1342
|
+
root: Element;
|
|
1343
|
+
loadTimeout: number;
|
|
1344
|
+
skipInactive: boolean;
|
|
1345
|
+
showWarning: boolean;
|
|
1346
|
+
showDebug: boolean;
|
|
1347
|
+
blockClass: string;
|
|
1348
|
+
liveMode: boolean;
|
|
1349
|
+
insertStyleRules: string[];
|
|
1350
|
+
triggerFocus: boolean;
|
|
1351
|
+
UNSAFE_replayCanvas: boolean;
|
|
1352
|
+
pauseAnimation?: boolean;
|
|
1353
|
+
mouseTail: boolean | {
|
|
1354
|
+
duration?: number;
|
|
1355
|
+
lineCap?: string;
|
|
1356
|
+
lineWidth?: number;
|
|
1357
|
+
strokeStyle?: string;
|
|
1358
|
+
};
|
|
1359
|
+
unpackFn?: UnpackFn;
|
|
1360
|
+
useVirtualDom: boolean;
|
|
1361
|
+
logger: {
|
|
1362
|
+
log: (...args: Parameters<typeof console.log>) => void;
|
|
1363
|
+
warn: (...args: Parameters<typeof console.warn>) => void;
|
|
1364
|
+
};
|
|
1365
|
+
plugins?: ReplayPlugin[];
|
|
1366
|
+
};
|
|
1367
|
+
declare global {
|
|
1368
|
+
interface Window {
|
|
1369
|
+
FontFace: typeof FontFace;
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
type ErrorHandler = (error: unknown) => void | boolean;
|
|
1373
|
+
|
|
1374
|
+
declare function record<T = eventWithTime>(options?: recordOptions<T>): listenerHandler | undefined;
|
|
1375
|
+
declare namespace record {
|
|
1376
|
+
var addCustomEvent: <T>(tag: string, payload: T) => void;
|
|
1377
|
+
var freezePage: () => void;
|
|
1378
|
+
var takeFullSnapshot: (isCheckout?: boolean | undefined) => void;
|
|
1379
|
+
var mirror: Mirror$1;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
declare const addCustomEvent: <T>(tag: string, payload: T) => void;
|
|
1383
|
+
declare const freezePage: () => void;
|
|
1384
|
+
|
|
1385
|
+
declare const pack: PackFn;
|
|
1386
|
+
|
|
1387
|
+
declare const unpack: UnpackFn;
|
|
1388
|
+
|
|
1389
|
+
type StringifyOptions = {
|
|
1390
|
+
stringLengthLimit?: number;
|
|
1391
|
+
numOfKeysLimit: number;
|
|
1392
|
+
depthOfLimit: number;
|
|
1393
|
+
};
|
|
1394
|
+
type LogRecordOptions = {
|
|
1395
|
+
level?: LogLevel[];
|
|
1396
|
+
lengthThreshold?: number;
|
|
1397
|
+
stringifyOptions?: StringifyOptions;
|
|
1398
|
+
logger?: Logger | 'console';
|
|
1399
|
+
};
|
|
1400
|
+
type LogData = {
|
|
1401
|
+
level: LogLevel;
|
|
1402
|
+
trace: string[];
|
|
1403
|
+
payload: string[];
|
|
1404
|
+
};
|
|
1405
|
+
type Logger = {
|
|
1406
|
+
assert?: typeof console.assert;
|
|
1407
|
+
clear?: typeof console.clear;
|
|
1408
|
+
count?: typeof console.count;
|
|
1409
|
+
countReset?: typeof console.countReset;
|
|
1410
|
+
debug?: typeof console.debug;
|
|
1411
|
+
dir?: typeof console.dir;
|
|
1412
|
+
dirxml?: typeof console.dirxml;
|
|
1413
|
+
error?: typeof console.error;
|
|
1414
|
+
group?: typeof console.group;
|
|
1415
|
+
groupCollapsed?: typeof console.groupCollapsed;
|
|
1416
|
+
groupEnd?: () => void;
|
|
1417
|
+
info?: typeof console.info;
|
|
1418
|
+
log?: typeof console.log;
|
|
1419
|
+
table?: typeof console.table;
|
|
1420
|
+
time?: typeof console.time;
|
|
1421
|
+
timeEnd?: typeof console.timeEnd;
|
|
1422
|
+
timeLog?: typeof console.timeLog;
|
|
1423
|
+
trace?: typeof console.trace;
|
|
1424
|
+
warn?: typeof console.warn;
|
|
1425
|
+
};
|
|
1426
|
+
type LogLevel = keyof Logger;
|
|
1427
|
+
declare const PLUGIN_NAME = "rrweb/console@1";
|
|
1428
|
+
declare const getRecordConsolePlugin: (options?: LogRecordOptions) => RecordPlugin;
|
|
1429
|
+
|
|
1430
|
+
type ReplayLogger = Partial<Record<LogLevel, (data: LogData) => void>>;
|
|
1431
|
+
type LogReplayConfig = {
|
|
1432
|
+
level?: LogLevel[];
|
|
1433
|
+
replayLogger?: ReplayLogger;
|
|
1434
|
+
};
|
|
1435
|
+
declare const getReplayConsolePlugin: (options?: LogReplayConfig) => ReplayPlugin;
|
|
1436
|
+
|
|
1437
|
+
type rrweb_EventType = EventType;
|
|
1438
|
+
declare const rrweb_EventType: typeof EventType;
|
|
1439
|
+
type rrweb_IncrementalSource = IncrementalSource;
|
|
1440
|
+
declare const rrweb_IncrementalSource: typeof IncrementalSource;
|
|
1441
|
+
type rrweb_LogData = LogData;
|
|
1442
|
+
type rrweb_LogLevel = LogLevel;
|
|
1443
|
+
type rrweb_Logger = Logger;
|
|
1444
|
+
type rrweb_MouseInteractions = MouseInteractions;
|
|
1445
|
+
declare const rrweb_MouseInteractions: typeof MouseInteractions;
|
|
1446
|
+
declare const rrweb_PLUGIN_NAME: typeof PLUGIN_NAME;
|
|
1447
|
+
type rrweb_Replayer = Replayer;
|
|
1448
|
+
declare const rrweb_Replayer: typeof Replayer;
|
|
1449
|
+
type rrweb_ReplayerEvents = ReplayerEvents;
|
|
1450
|
+
declare const rrweb_ReplayerEvents: typeof ReplayerEvents;
|
|
1451
|
+
type rrweb_StringifyOptions = StringifyOptions;
|
|
1452
|
+
declare const rrweb_addCustomEvent: typeof addCustomEvent;
|
|
1453
|
+
declare const rrweb_freezePage: typeof freezePage;
|
|
1454
|
+
declare const rrweb_getRecordConsolePlugin: typeof getRecordConsolePlugin;
|
|
1455
|
+
declare const rrweb_getReplayConsolePlugin: typeof getReplayConsolePlugin;
|
|
1456
|
+
declare const rrweb_pack: typeof pack;
|
|
1457
|
+
declare const rrweb_record: typeof record;
|
|
1458
|
+
type rrweb_recordOptions<T> = recordOptions<T>;
|
|
1459
|
+
declare const rrweb_unpack: typeof unpack;
|
|
1460
|
+
declare namespace rrweb {
|
|
1461
|
+
export {
|
|
1462
|
+
rrweb_EventType as EventType,
|
|
1463
|
+
rrweb_IncrementalSource as IncrementalSource,
|
|
1464
|
+
rrweb_LogData as LogData,
|
|
1465
|
+
rrweb_LogLevel as LogLevel,
|
|
1466
|
+
rrweb_Logger as Logger,
|
|
1467
|
+
rrweb_MouseInteractions as MouseInteractions,
|
|
1468
|
+
rrweb_PLUGIN_NAME as PLUGIN_NAME,
|
|
1469
|
+
rrweb_Replayer as Replayer,
|
|
1470
|
+
rrweb_ReplayerEvents as ReplayerEvents,
|
|
1471
|
+
rrweb_StringifyOptions as StringifyOptions,
|
|
1472
|
+
rrweb_addCustomEvent as addCustomEvent,
|
|
1473
|
+
rrweb_freezePage as freezePage,
|
|
1474
|
+
rrweb_getRecordConsolePlugin as getRecordConsolePlugin,
|
|
1475
|
+
rrweb_getReplayConsolePlugin as getReplayConsolePlugin,
|
|
1476
|
+
_mirror as mirror,
|
|
1477
|
+
rrweb_pack as pack,
|
|
1478
|
+
rrweb_record as record,
|
|
1479
|
+
rrweb_recordOptions as recordOptions,
|
|
1480
|
+
rrweb_unpack as unpack,
|
|
1481
|
+
utils_d as utils,
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
interface XhrResponse {
|
|
1486
|
+
body: Object | string;
|
|
1487
|
+
statusCode: number;
|
|
1488
|
+
method: string;
|
|
1489
|
+
headers: XhrHeaders;
|
|
1490
|
+
url: string;
|
|
1491
|
+
rawRequest: XMLHttpRequest;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
interface XhrHeaders {
|
|
1495
|
+
[key: string]: string;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
declare const isValidChunkSize: (chunkSize: any, { minChunkSize, maxChunkSize, }?: {
|
|
1499
|
+
minChunkSize?: number | undefined;
|
|
1500
|
+
maxChunkSize?: number | undefined;
|
|
1501
|
+
}) => chunkSize is number | null | undefined;
|
|
1502
|
+
declare const getChunkSizeError: (chunkSize: any, { minChunkSize, maxChunkSize, }?: {
|
|
1503
|
+
minChunkSize?: number | undefined;
|
|
1504
|
+
maxChunkSize?: number | undefined;
|
|
1505
|
+
}) => TypeError;
|
|
1506
|
+
declare type ChunkedStreamIterableOptions = {
|
|
1507
|
+
defaultChunkSize?: number;
|
|
1508
|
+
minChunkSize?: number;
|
|
1509
|
+
maxChunkSize?: number;
|
|
1510
|
+
};
|
|
1511
|
+
declare class ChunkedStreamIterable implements AsyncIterable<Blob> {
|
|
1512
|
+
protected readableStream: ReadableStream<Uint8Array | Blob>;
|
|
1513
|
+
protected _chunkSize: number | undefined;
|
|
1514
|
+
protected defaultChunkSize: number;
|
|
1515
|
+
readonly minChunkSize: number;
|
|
1516
|
+
readonly maxChunkSize: number;
|
|
1517
|
+
constructor(readableStream: ReadableStream<Uint8Array | Blob>, options?: ChunkedStreamIterableOptions);
|
|
1518
|
+
get chunkSize(): number;
|
|
1519
|
+
set chunkSize(value: number);
|
|
1520
|
+
get chunkByteSize(): number;
|
|
1521
|
+
[Symbol.asyncIterator](): AsyncIterator<Blob>;
|
|
1522
|
+
}
|
|
1523
|
+
declare type EventName = 'attempt' | 'attemptFailure' | 'chunkSuccess' | 'error' | 'offline' | 'online' | 'progress' | 'success';
|
|
1524
|
+
declare type AllowedMethods = 'PUT' | 'POST' | 'PATCH';
|
|
1525
|
+
interface UpChunkOptions {
|
|
1526
|
+
endpoint: string | ((file?: File) => Promise<string>);
|
|
1527
|
+
file: File;
|
|
1528
|
+
method?: AllowedMethods;
|
|
1529
|
+
headers?: XhrHeaders | (() => XhrHeaders) | (() => Promise<XhrHeaders>);
|
|
1530
|
+
maxFileSize?: number;
|
|
1531
|
+
chunkSize?: number;
|
|
1532
|
+
attempts?: number;
|
|
1533
|
+
delayBeforeAttempt?: number;
|
|
1534
|
+
retryCodes?: number[];
|
|
1535
|
+
dynamicChunkSize?: boolean;
|
|
1536
|
+
maxChunkSize?: number;
|
|
1537
|
+
minChunkSize?: number;
|
|
1538
|
+
}
|
|
1539
|
+
declare class UpChunk {
|
|
1540
|
+
static createUpload(options: UpChunkOptions): UpChunk;
|
|
1541
|
+
endpoint: string | ((file?: File) => Promise<string>);
|
|
1542
|
+
file: File;
|
|
1543
|
+
headers: XhrHeaders | (() => XhrHeaders) | (() => Promise<XhrHeaders>);
|
|
1544
|
+
method: AllowedMethods;
|
|
1545
|
+
attempts: number;
|
|
1546
|
+
delayBeforeAttempt: number;
|
|
1547
|
+
retryCodes: number[];
|
|
1548
|
+
dynamicChunkSize: boolean;
|
|
1549
|
+
protected chunkedStreamIterable: ChunkedStreamIterable;
|
|
1550
|
+
protected chunkedStreamIterator: AsyncIterator<Blob, any, undefined>;
|
|
1551
|
+
protected pendingChunk?: Blob;
|
|
1552
|
+
private chunkCount;
|
|
1553
|
+
private maxFileBytes;
|
|
1554
|
+
private endpointValue;
|
|
1555
|
+
private totalChunks;
|
|
1556
|
+
private attemptCount;
|
|
1557
|
+
private offline;
|
|
1558
|
+
private _paused;
|
|
1559
|
+
private success;
|
|
1560
|
+
private currentXhr?;
|
|
1561
|
+
private lastChunkStart;
|
|
1562
|
+
private nextChunkRangeStart;
|
|
1563
|
+
private eventTarget;
|
|
1564
|
+
constructor(options: UpChunkOptions);
|
|
1565
|
+
protected get maxChunkSize(): number;
|
|
1566
|
+
protected get minChunkSize(): number;
|
|
1567
|
+
get chunkSize(): number;
|
|
1568
|
+
set chunkSize(value: number);
|
|
1569
|
+
get chunkByteSize(): number;
|
|
1570
|
+
get totalChunkSize(): number;
|
|
1571
|
+
/**
|
|
1572
|
+
* Subscribe to an event
|
|
1573
|
+
*/
|
|
1574
|
+
on(eventName: EventName, fn: (event: CustomEvent) => void): void;
|
|
1575
|
+
/**
|
|
1576
|
+
* Subscribe to an event once
|
|
1577
|
+
*/
|
|
1578
|
+
once(eventName: EventName, fn: (event: CustomEvent) => void): void;
|
|
1579
|
+
/**
|
|
1580
|
+
* Unsubscribe to an event
|
|
1581
|
+
*/
|
|
1582
|
+
off(eventName: EventName, fn: (event: CustomEvent) => void): void;
|
|
1583
|
+
get paused(): boolean;
|
|
1584
|
+
abort(): void;
|
|
1585
|
+
pause(): void;
|
|
1586
|
+
resume(): void;
|
|
1587
|
+
/**
|
|
1588
|
+
* Dispatch an event
|
|
1589
|
+
*/
|
|
1590
|
+
private dispatch;
|
|
1591
|
+
/**
|
|
1592
|
+
* Validate options and throw errors if expectations are violated.
|
|
1593
|
+
*/
|
|
1594
|
+
private validateOptions;
|
|
1595
|
+
/**
|
|
1596
|
+
* Endpoint can either be a URL or a function that returns a promise that resolves to a string.
|
|
1597
|
+
*/
|
|
1598
|
+
private getEndpoint;
|
|
1599
|
+
private xhrPromise;
|
|
1600
|
+
/**
|
|
1601
|
+
* Send chunk of the file with appropriate headers
|
|
1602
|
+
*/
|
|
1603
|
+
protected sendChunk(chunk: Blob): Promise<XhrResponse>;
|
|
1604
|
+
protected sendChunkWithRetries(chunk: Blob): Promise<boolean>;
|
|
1605
|
+
/**
|
|
1606
|
+
* Manage the whole upload by calling getChunk & sendChunk
|
|
1607
|
+
* handle errors & retries and dispatch events
|
|
1608
|
+
*/
|
|
1609
|
+
private sendChunks;
|
|
1610
|
+
}
|
|
1611
|
+
declare const createUpload$1: typeof UpChunk.createUpload;
|
|
1612
|
+
|
|
1613
|
+
type _mux_upchunk_ChunkedStreamIterable = ChunkedStreamIterable;
|
|
1614
|
+
declare const _mux_upchunk_ChunkedStreamIterable: typeof ChunkedStreamIterable;
|
|
1615
|
+
type _mux_upchunk_ChunkedStreamIterableOptions = ChunkedStreamIterableOptions;
|
|
1616
|
+
type _mux_upchunk_UpChunk = UpChunk;
|
|
1617
|
+
declare const _mux_upchunk_UpChunk: typeof UpChunk;
|
|
1618
|
+
type _mux_upchunk_UpChunkOptions = UpChunkOptions;
|
|
1619
|
+
declare const _mux_upchunk_getChunkSizeError: typeof getChunkSizeError;
|
|
1620
|
+
declare const _mux_upchunk_isValidChunkSize: typeof isValidChunkSize;
|
|
1621
|
+
declare namespace _mux_upchunk {
|
|
1622
|
+
export {
|
|
1623
|
+
_mux_upchunk_ChunkedStreamIterable as ChunkedStreamIterable,
|
|
1624
|
+
_mux_upchunk_ChunkedStreamIterableOptions as ChunkedStreamIterableOptions,
|
|
1625
|
+
_mux_upchunk_UpChunk as UpChunk,
|
|
1626
|
+
_mux_upchunk_UpChunkOptions as UpChunkOptions,
|
|
1627
|
+
createUpload$1 as createUpload,
|
|
1628
|
+
_mux_upchunk_getChunkSizeError as getChunkSizeError,
|
|
1629
|
+
_mux_upchunk_isValidChunkSize as isValidChunkSize,
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
declare enum NOTIFICATION_TYPES {
|
|
1634
|
+
ACTIVATE = "ACTIVATE:experiment, user_id,attributes, variation, event",
|
|
1635
|
+
DECISION = "DECISION:type, userId, attributes, decisionInfo",
|
|
1636
|
+
LOG_EVENT = "LOG_EVENT:logEvent",
|
|
1637
|
+
OPTIMIZELY_CONFIG_UPDATE = "OPTIMIZELY_CONFIG_UPDATE",
|
|
1638
|
+
TRACK = "TRACK:event_key, user_id, attributes, event_tags, event"
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
declare type UserAttributes = {
|
|
1642
|
+
[name: string]: any;
|
|
1643
|
+
};
|
|
1644
|
+
declare type EventTags = {
|
|
1645
|
+
[key: string]: string | number | null;
|
|
1646
|
+
};
|
|
1647
|
+
interface ListenerPayload {
|
|
1648
|
+
userId: string;
|
|
1649
|
+
attributes?: UserAttributes;
|
|
1650
|
+
}
|
|
1651
|
+
declare type NotificationListener<T extends ListenerPayload> = (notificationData: T) => void;
|
|
1652
|
+
interface NotificationCenter {
|
|
1653
|
+
addNotificationListener<T extends ListenerPayload>(notificationType: string, callback: NotificationListener<T>): number;
|
|
1654
|
+
removeNotificationListener(listenerId: number): boolean;
|
|
1655
|
+
clearAllNotificationListeners(): void;
|
|
1656
|
+
clearNotificationListeners(notificationType: NOTIFICATION_TYPES): void;
|
|
1657
|
+
}
|
|
1658
|
+
declare enum OptimizelyDecideOption {
|
|
1659
|
+
DISABLE_DECISION_EVENT = "DISABLE_DECISION_EVENT",
|
|
1660
|
+
ENABLED_FLAGS_ONLY = "ENABLED_FLAGS_ONLY",
|
|
1661
|
+
IGNORE_USER_PROFILE_SERVICE = "IGNORE_USER_PROFILE_SERVICE",
|
|
1662
|
+
INCLUDE_REASONS = "INCLUDE_REASONS",
|
|
1663
|
+
EXCLUDE_VARIABLES = "EXCLUDE_VARIABLES"
|
|
1664
|
+
}
|
|
1665
|
+
/**
|
|
1666
|
+
* Optimizely Config Entities
|
|
1667
|
+
*/
|
|
1668
|
+
interface OptimizelyExperiment {
|
|
1669
|
+
id: string;
|
|
1670
|
+
key: string;
|
|
1671
|
+
audiences: string;
|
|
1672
|
+
variationsMap: {
|
|
1673
|
+
[variationKey: string]: OptimizelyVariation;
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
interface OptimizelyVariable {
|
|
1677
|
+
id: string;
|
|
1678
|
+
key: string;
|
|
1679
|
+
type: string;
|
|
1680
|
+
value: string;
|
|
1681
|
+
}
|
|
1682
|
+
interface Client {
|
|
1683
|
+
notificationCenter: NotificationCenter;
|
|
1684
|
+
createUserContext(userId: string, attributes?: UserAttributes): OptimizelyUserContext | null;
|
|
1685
|
+
activate(experimentKey: string, userId: string, attributes?: UserAttributes): string | null;
|
|
1686
|
+
track(eventKey: string, userId: string, attributes?: UserAttributes, eventTags?: EventTags): void;
|
|
1687
|
+
getVariation(experimentKey: string, userId: string, attributes?: UserAttributes): string | null;
|
|
1688
|
+
setForcedVariation(experimentKey: string, userId: string, variationKey: string | null): boolean;
|
|
1689
|
+
getForcedVariation(experimentKey: string, userId: string): string | null;
|
|
1690
|
+
isFeatureEnabled(featureKey: string, userId: string, attributes?: UserAttributes): boolean;
|
|
1691
|
+
getEnabledFeatures(userId: string, attributes?: UserAttributes): string[];
|
|
1692
|
+
getFeatureVariable(featureKey: string, variableKey: string, userId: string, attributes?: UserAttributes): unknown;
|
|
1693
|
+
getFeatureVariableBoolean(featureKey: string, variableKey: string, userId: string, attributes?: UserAttributes): boolean | null;
|
|
1694
|
+
getFeatureVariableDouble(featureKey: string, variableKey: string, userId: string, attributes?: UserAttributes): number | null;
|
|
1695
|
+
getFeatureVariableInteger(featureKey: string, variableKey: string, userId: string, attributes?: UserAttributes): number | null;
|
|
1696
|
+
getFeatureVariableString(featureKey: string, variableKey: string, userId: string, attributes?: UserAttributes): string | null;
|
|
1697
|
+
getFeatureVariableJSON(featureKey: string, variableKey: string, userId: string, attributes?: UserAttributes): unknown;
|
|
1698
|
+
getAllFeatureVariables(featureKey: string, userId: string, attributes?: UserAttributes): {
|
|
1699
|
+
[variableKey: string]: unknown;
|
|
1700
|
+
} | null;
|
|
1701
|
+
getOptimizelyConfig(): OptimizelyConfig | null;
|
|
1702
|
+
onReady(options?: {
|
|
1703
|
+
timeout?: number;
|
|
1704
|
+
}): Promise<{
|
|
1705
|
+
success: boolean;
|
|
1706
|
+
reason?: string;
|
|
1707
|
+
}>;
|
|
1708
|
+
close(): Promise<{
|
|
1709
|
+
success: boolean;
|
|
1710
|
+
reason?: string;
|
|
1711
|
+
}>;
|
|
1712
|
+
}
|
|
1713
|
+
declare type OptimizelyExperimentsMap = {
|
|
1714
|
+
[experimentKey: string]: OptimizelyExperiment;
|
|
1715
|
+
};
|
|
1716
|
+
declare type OptimizelyVariablesMap = {
|
|
1717
|
+
[variableKey: string]: OptimizelyVariable;
|
|
1718
|
+
};
|
|
1719
|
+
declare type OptimizelyFeaturesMap = {
|
|
1720
|
+
[featureKey: string]: OptimizelyFeature;
|
|
1721
|
+
};
|
|
1722
|
+
declare type OptimizelyAttribute = {
|
|
1723
|
+
id: string;
|
|
1724
|
+
key: string;
|
|
1725
|
+
};
|
|
1726
|
+
declare type OptimizelyAudience = {
|
|
1727
|
+
id: string;
|
|
1728
|
+
name: string;
|
|
1729
|
+
conditions: string;
|
|
1730
|
+
};
|
|
1731
|
+
declare type OptimizelyEvent = {
|
|
1732
|
+
id: string;
|
|
1733
|
+
key: string;
|
|
1734
|
+
experimentsIds: string[];
|
|
1735
|
+
};
|
|
1736
|
+
interface OptimizelyFeature {
|
|
1737
|
+
id: string;
|
|
1738
|
+
key: string;
|
|
1739
|
+
experimentRules: OptimizelyExperiment[];
|
|
1740
|
+
deliveryRules: OptimizelyExperiment[];
|
|
1741
|
+
variablesMap: OptimizelyVariablesMap;
|
|
1742
|
+
/**
|
|
1743
|
+
* @deprecated Use experimentRules and deliveryRules
|
|
1744
|
+
*/
|
|
1745
|
+
experimentsMap: OptimizelyExperimentsMap;
|
|
1746
|
+
}
|
|
1747
|
+
interface OptimizelyVariation {
|
|
1748
|
+
id: string;
|
|
1749
|
+
key: string;
|
|
1750
|
+
featureEnabled?: boolean;
|
|
1751
|
+
variablesMap: OptimizelyVariablesMap;
|
|
1752
|
+
}
|
|
1753
|
+
interface OptimizelyConfig {
|
|
1754
|
+
environmentKey: string;
|
|
1755
|
+
sdkKey: string;
|
|
1756
|
+
revision: string;
|
|
1757
|
+
/**
|
|
1758
|
+
* This experimentsMap is for experiments of legacy projects only.
|
|
1759
|
+
* For flag projects, experiment keys are not guaranteed to be unique
|
|
1760
|
+
* across multiple flags, so this map may not include all experiments
|
|
1761
|
+
* when keys conflict.
|
|
1762
|
+
*/
|
|
1763
|
+
experimentsMap: OptimizelyExperimentsMap;
|
|
1764
|
+
featuresMap: OptimizelyFeaturesMap;
|
|
1765
|
+
attributes: OptimizelyAttribute[];
|
|
1766
|
+
audiences: OptimizelyAudience[];
|
|
1767
|
+
events: OptimizelyEvent[];
|
|
1768
|
+
getDatafile(): string;
|
|
1769
|
+
}
|
|
1770
|
+
interface OptimizelyUserContext {
|
|
1771
|
+
getUserId(): string;
|
|
1772
|
+
getAttributes(): UserAttributes;
|
|
1773
|
+
setAttribute(key: string, value: unknown): void;
|
|
1774
|
+
decide(key: string, options?: OptimizelyDecideOption[]): OptimizelyDecision;
|
|
1775
|
+
decideForKeys(keys: string[], options?: OptimizelyDecideOption[]): {
|
|
1776
|
+
[key: string]: OptimizelyDecision;
|
|
1777
|
+
};
|
|
1778
|
+
decideAll(options?: OptimizelyDecideOption[]): {
|
|
1779
|
+
[key: string]: OptimizelyDecision;
|
|
1780
|
+
};
|
|
1781
|
+
trackEvent(eventName: string, eventTags?: EventTags): void;
|
|
1782
|
+
setForcedDecision(context: OptimizelyDecisionContext, decision: OptimizelyForcedDecision): boolean;
|
|
1783
|
+
getForcedDecision(context: OptimizelyDecisionContext): OptimizelyForcedDecision | null;
|
|
1784
|
+
removeForcedDecision(context: OptimizelyDecisionContext): boolean;
|
|
1785
|
+
removeAllForcedDecisions(): boolean;
|
|
1786
|
+
}
|
|
1787
|
+
interface OptimizelyDecision {
|
|
1788
|
+
variationKey: string | null;
|
|
1789
|
+
enabled: boolean;
|
|
1790
|
+
variables: {
|
|
1791
|
+
[variableKey: string]: unknown;
|
|
1792
|
+
};
|
|
1793
|
+
ruleKey: string | null;
|
|
1794
|
+
flagKey: string;
|
|
1795
|
+
userContext: OptimizelyUserContext;
|
|
1796
|
+
reasons: string[];
|
|
1797
|
+
}
|
|
1798
|
+
interface OptimizelyDecisionContext {
|
|
1799
|
+
flagKey: string;
|
|
1800
|
+
ruleKey?: string;
|
|
1801
|
+
}
|
|
1802
|
+
interface OptimizelyForcedDecision {
|
|
1803
|
+
variationKey: string;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
declare type EventMap = {
|
|
1807
|
+
[eventName: string]: Array<unknown>;
|
|
1808
|
+
};
|
|
1809
|
+
declare type InternalEventNames = 'newListener' | 'removeListener';
|
|
1810
|
+
declare type InternalListener<Events extends EventMap> = Listener<[
|
|
1811
|
+
eventName: keyof Events,
|
|
1812
|
+
listener: Listener<Array<unknown>>
|
|
1813
|
+
]>;
|
|
1814
|
+
declare type Listener<Data extends Array<unknown>> = (...data: Data) => void;
|
|
1815
|
+
/**
|
|
1816
|
+
* Node.js-compatible implementation of `EventEmitter`.
|
|
1817
|
+
*
|
|
1818
|
+
* @example
|
|
1819
|
+
* const emitter = new Emitter<{ hello: [string] }>()
|
|
1820
|
+
* emitter.on('hello', (name) => console.log(name))
|
|
1821
|
+
* emitter.emit('hello', 'John')
|
|
1822
|
+
*/
|
|
1823
|
+
declare class Emitter<Events extends EventMap> {
|
|
1824
|
+
private events;
|
|
1825
|
+
private maxListeners;
|
|
1826
|
+
private hasWarnedAboutPotentialMemoryLeak;
|
|
1827
|
+
static defaultMaxListeners: number;
|
|
1828
|
+
static listenerCount<Events extends EventMap>(emitter: Emitter<EventMap>, eventName: keyof Events): number;
|
|
1829
|
+
constructor();
|
|
1830
|
+
private _emitInternalEvent;
|
|
1831
|
+
private _getListeners;
|
|
1832
|
+
private _removeListener;
|
|
1833
|
+
private _wrapOnceListener;
|
|
1834
|
+
setMaxListeners(maxListeners: number): this;
|
|
1835
|
+
/**
|
|
1836
|
+
* Returns the current max listener value for the `Emitter` which is
|
|
1837
|
+
* either set by `emitter.setMaxListeners(n)` or defaults to
|
|
1838
|
+
* `Emitter.defaultMaxListeners`.
|
|
1839
|
+
*/
|
|
1840
|
+
getMaxListeners(): number;
|
|
1841
|
+
/**
|
|
1842
|
+
* Returns an array listing the events for which the emitter has registered listeners.
|
|
1843
|
+
* The values in the array will be strings or Symbols.
|
|
1844
|
+
*/
|
|
1845
|
+
eventNames(): Array<keyof Events>;
|
|
1846
|
+
/**
|
|
1847
|
+
* Synchronously calls each of the listeners registered for the event named `eventName`,
|
|
1848
|
+
* in the order they were registered, passing the supplied arguments to each.
|
|
1849
|
+
* Returns `true` if the event has listeners, `false` otherwise.
|
|
1850
|
+
*
|
|
1851
|
+
* @example
|
|
1852
|
+
* const emitter = new Emitter<{ hello: [string] }>()
|
|
1853
|
+
* emitter.emit('hello', 'John')
|
|
1854
|
+
*/
|
|
1855
|
+
emit<EventName extends keyof Events>(eventName: EventName, ...data: Events[EventName]): boolean;
|
|
1856
|
+
addListener(eventName: InternalEventNames, listener: InternalListener<Events>): this;
|
|
1857
|
+
addListener<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
|
|
1858
|
+
on(eventName: InternalEventNames, listener: InternalListener<Events>): this;
|
|
1859
|
+
on<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
|
|
1860
|
+
once(eventName: InternalEventNames, listener: InternalListener<Events>): this;
|
|
1861
|
+
once<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
|
|
1862
|
+
prependListener(eventName: InternalEventNames, listener: InternalListener<Events>): this;
|
|
1863
|
+
prependListener<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
|
|
1864
|
+
prependOnceListener(eventName: InternalEventNames, listener: InternalListener<Events>): this;
|
|
1865
|
+
prependOnceListener<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
|
|
1866
|
+
removeListener(eventName: InternalEventNames, listener: InternalListener<Events>): this;
|
|
1867
|
+
removeListener<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
|
|
1868
|
+
off(eventName: InternalEventNames, listener: InternalListener<Events>): this;
|
|
1869
|
+
off<EventName extends keyof Events>(eventName: EventName, listener: Listener<Events[EventName]>): this;
|
|
1870
|
+
removeAllListeners(eventName?: InternalEventNames): this;
|
|
1871
|
+
removeAllListeners<EventName extends keyof Events>(eventName?: EventName): this;
|
|
1872
|
+
listeners(eventName: InternalEventNames): Array<Listener<any>>;
|
|
1873
|
+
listeners<EventName extends keyof Events>(eventName: EventName): Array<Listener<Events[EventName]>>;
|
|
1874
|
+
listenerCount(eventName: InternalEventNames): number;
|
|
1875
|
+
listenerCount<EventName extends keyof Events>(eventName: EventName): number;
|
|
1876
|
+
rawListeners<EventName extends keyof Events>(eventName: EventName): Array<Listener<Events[EventName]>>;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
declare enum DismissReason {
|
|
1880
|
+
Closed = "close.click",
|
|
1881
|
+
Complete = "survey.completed",
|
|
1882
|
+
PageChange = "page.change",
|
|
1883
|
+
API = "api",
|
|
1884
|
+
Override = "override"
|
|
1885
|
+
}
|
|
1886
|
+
declare enum SprigEvent {
|
|
1887
|
+
ReplayCapture = "replay.capture",
|
|
1888
|
+
SDKReady = "sdk.ready",
|
|
1889
|
+
SurveyAppeared = "survey.appeared",
|
|
1890
|
+
SurveyClosed = "survey.closed",
|
|
1891
|
+
SurveyDimensions = "survey.dimensions",
|
|
1892
|
+
SurveyFadingOut = "survey.fadingOut",
|
|
1893
|
+
SurveyHeight = "survey.height",
|
|
1894
|
+
SurveyPresented = "survey.presented",
|
|
1895
|
+
SurveyLifeCycle = "survey.lifeCycle",
|
|
1896
|
+
SurveyWidth = "survey.width",
|
|
1897
|
+
SurveyWillClose = "survey.willClose",
|
|
1898
|
+
SurveyWillPresent = "survey.will.present",
|
|
1899
|
+
CloseSurveyOnOverlayClick = "close.survey.overlayClick",
|
|
1900
|
+
VisitorIDUpdated = "visitor.id.updated",
|
|
1901
|
+
QuestionAnswered = "question.answered"
|
|
1902
|
+
}
|
|
1903
|
+
declare enum SprigEventData {
|
|
1904
|
+
SurveyId = "survey.id"
|
|
1905
|
+
}
|
|
1906
|
+
declare const EVENTS: {
|
|
1907
|
+
SDK_READY: SprigEvent;
|
|
1908
|
+
SURVEY_APPEARED: SprigEvent;
|
|
1909
|
+
SURVEY_CLOSED: SprigEvent;
|
|
1910
|
+
SURVEY_DIMENSIONS: SprigEvent;
|
|
1911
|
+
SURVEY_FADING_OUT: SprigEvent;
|
|
1912
|
+
SURVEY_HEIGHT: SprigEvent;
|
|
1913
|
+
SURVEY_PRESENTED: SprigEvent;
|
|
1914
|
+
SURVEY_LIFE_CYCLE: SprigEvent;
|
|
1915
|
+
SURVEY_WILL_CLOSE: SprigEvent;
|
|
1916
|
+
SURVEY_WILL_PRESENT: SprigEvent;
|
|
1917
|
+
QUESTION_ANSWERED: SprigEvent;
|
|
1918
|
+
REPLAY_CAPTURE: SprigEvent;
|
|
1919
|
+
CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
|
|
1920
|
+
VISITOR_ID_UPDATED: SprigEvent;
|
|
1921
|
+
DATA: {
|
|
1922
|
+
DISMISS_REASONS: {
|
|
1923
|
+
API: DismissReason;
|
|
1924
|
+
CLOSED: DismissReason;
|
|
1925
|
+
COMPLETE: DismissReason;
|
|
1926
|
+
PAGE_CHANGE: DismissReason;
|
|
1927
|
+
OVERRIDE: DismissReason;
|
|
1928
|
+
};
|
|
1929
|
+
SURVEY_ID: SprigEventData;
|
|
1930
|
+
};
|
|
1931
|
+
};
|
|
1932
|
+
declare const enum InternalEventName {
|
|
1933
|
+
VerifyViewVersion = "verify.view.version",
|
|
1934
|
+
CurrentQuestion = "survey.question",
|
|
1935
|
+
ViewPrototypeClick = "question.prototype.click",
|
|
1936
|
+
ViewAgreementClick = "question.agreement.click",
|
|
1937
|
+
RecordedTaskStart = "recorded.task.start",
|
|
1938
|
+
RecordedTaskPermissionScreen = "recorded.task.permission.screen",
|
|
1939
|
+
SurveyComplete = "survey.complete"
|
|
1940
|
+
}
|
|
1941
|
+
declare const enum InternalEventData {
|
|
1942
|
+
ViewVersion = "view.version",
|
|
1943
|
+
QuestionId = "qid",
|
|
1944
|
+
Props = "props"
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
declare const enum MediaType {
|
|
1948
|
+
Video = "video",
|
|
1949
|
+
Audio = "audio",
|
|
1950
|
+
Screen = "screen"
|
|
1951
|
+
}
|
|
1952
|
+
declare const enum SprigRecordingEvent {
|
|
1953
|
+
PermissionStatus = "permission.status",
|
|
1954
|
+
AvPermission = "av.permission",
|
|
1955
|
+
ScreenPermission = "screen.permission",
|
|
1956
|
+
BeginRecording = "begin.recording",
|
|
1957
|
+
StartTask = "start.task",
|
|
1958
|
+
FinishTask = "finish.task"
|
|
1959
|
+
}
|
|
1960
|
+
declare const enum TaskStatus {
|
|
1961
|
+
Abandoned = "abandoned",
|
|
1962
|
+
GivenUp = "given.up",
|
|
1963
|
+
Completed = "completed"
|
|
1964
|
+
}
|
|
1965
|
+
declare const enum SprigRecordingEventData {
|
|
1966
|
+
ScreenPermissionRequested = "screen.permission.requested",
|
|
1967
|
+
PermissionDescriptors = "permission.descriptors",
|
|
1968
|
+
PermissionStatusCallback = "permission.status.callback",
|
|
1969
|
+
StreamReadyCallback = "stream.ready.callback",
|
|
1970
|
+
StreamCanceledCallback = "stream.canceled.callback",
|
|
1971
|
+
TaskCompleteCallback = "task.complete.callback",
|
|
1972
|
+
TaskResponse = "task.response",
|
|
1973
|
+
TaskStatus = "task.status",
|
|
1974
|
+
RecordingMediaTypes = "recording.media.types",
|
|
1975
|
+
StartRecordingCallback = "start.recording.callback",
|
|
1976
|
+
PassthroughData = "passthrough.data",
|
|
1977
|
+
CurrentIndex = "current.index",
|
|
1978
|
+
UploadCallback = "upload.callback",
|
|
1979
|
+
ProgressCallback = "progress.callback",
|
|
1980
|
+
BeginCallback = "begin.callback"
|
|
1981
|
+
}
|
|
1982
|
+
interface PassthroughData {
|
|
1983
|
+
questionId: number;
|
|
1984
|
+
surveyId: number;
|
|
1985
|
+
visitorId: string | null;
|
|
1986
|
+
responseGroupUid: UUID;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
interface Experiment {
|
|
1990
|
+
id: string;
|
|
1991
|
+
variation?: string;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
type QueueItem = [string, ...unknown[]] | (() => void);
|
|
1995
|
+
declare class SprigQueue {
|
|
1996
|
+
paused: boolean;
|
|
1997
|
+
queue: QueueItem[];
|
|
1998
|
+
ul: WindowSprig;
|
|
1999
|
+
constructor(ul: WindowSprig, queue: QueueItem[]);
|
|
2000
|
+
flush(queue: QueueItem[]): void;
|
|
2001
|
+
isPaused(): boolean;
|
|
2002
|
+
pause(): void;
|
|
2003
|
+
unpause(): void;
|
|
2004
|
+
push(action: QueueItem): void;
|
|
2005
|
+
perform(func: () => void): void | Promise<unknown>;
|
|
2006
|
+
/**
|
|
2007
|
+
* Removes all queued items
|
|
2008
|
+
*/
|
|
2009
|
+
empty(): void;
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
declare enum SurveyState {
|
|
2013
|
+
Ready = "ready",
|
|
2014
|
+
NoSurvey = "no survey"
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
interface RecordedTaskResponseValueType {
|
|
2018
|
+
mediaRecordingUids?: string[] | null;
|
|
2019
|
+
taskDurationMillisecond?: number;
|
|
2020
|
+
taskStatus: TaskStatus;
|
|
2021
|
+
}
|
|
2022
|
+
declare enum BooleanOperator {
|
|
2023
|
+
And = 1,
|
|
2024
|
+
Or = 2
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
declare const enum CardType {
|
|
2028
|
+
ConsentLegal = "consentlegal",
|
|
2029
|
+
Likert = "likert",
|
|
2030
|
+
Matrix = "matrix",
|
|
2031
|
+
MultipleChoice = "multiplechoice",
|
|
2032
|
+
MultipleSelect = "multipleselect",
|
|
2033
|
+
NPS = "nps",
|
|
2034
|
+
Open = "open",
|
|
2035
|
+
RecordedTask = "recordedtask",
|
|
2036
|
+
TextUrlPrompt = "texturlprompt",
|
|
2037
|
+
Thanks = "thanks",
|
|
2038
|
+
Uploading = "uploading",
|
|
2039
|
+
VideoVoice = "videovoice"
|
|
2040
|
+
}
|
|
2041
|
+
type ConceptUrl = string | null;
|
|
2042
|
+
interface BaseCard {
|
|
2043
|
+
name: number;
|
|
2044
|
+
surveyId: number;
|
|
2045
|
+
updatedAt: string;
|
|
2046
|
+
value?: unknown;
|
|
2047
|
+
}
|
|
2048
|
+
declare const enum Comparator {
|
|
2049
|
+
Answered = "answered",
|
|
2050
|
+
Contains = "contains",
|
|
2051
|
+
DoesNotContain = "notcontains",
|
|
2052
|
+
DoesNotInclude = "list_dni",
|
|
2053
|
+
Equal = "eq",
|
|
2054
|
+
GivenUp = "given_up",
|
|
2055
|
+
GreaterThan = "gt",
|
|
2056
|
+
GreaterThanOrEqual = "gte",
|
|
2057
|
+
LessThan = "lt",
|
|
2058
|
+
LessThanOrEqual = "lte",
|
|
2059
|
+
ListAll = "list_all",
|
|
2060
|
+
ListAtLeastOne = "list_alo",
|
|
2061
|
+
ListExact = "list_exact",
|
|
2062
|
+
NotEqual = "neq",
|
|
2063
|
+
Partial = "partial",
|
|
2064
|
+
Skipped = "skipped"
|
|
2065
|
+
}
|
|
2066
|
+
type DefaultComparator = Comparator.Answered | Comparator.Skipped;
|
|
2067
|
+
type RoutingOption<C extends Comparator = DefaultComparator> = OldRoutingOption<C> | GroupRoutingOption;
|
|
2068
|
+
type OldRoutingOption<C extends Comparator = DefaultComparator> = {
|
|
2069
|
+
comparator: C;
|
|
2070
|
+
target: number;
|
|
2071
|
+
/** @example '', 'option_2', ['option_1'] */
|
|
2072
|
+
value: number | string | string[];
|
|
2073
|
+
};
|
|
2074
|
+
type GroupRoutingOption = {
|
|
2075
|
+
group: (RoutingGroupOption | BooleanOperator)[];
|
|
2076
|
+
target: number;
|
|
2077
|
+
};
|
|
2078
|
+
type RoutingGroupOption = {
|
|
2079
|
+
comparator: Comparator;
|
|
2080
|
+
questionIndex: number;
|
|
2081
|
+
value: number | string | string[] | {
|
|
2082
|
+
skipped: true;
|
|
2083
|
+
} | null | undefined;
|
|
2084
|
+
};
|
|
2085
|
+
type RoutingOptions<C extends Comparator = DefaultComparator> = RoutingOption<C | DefaultComparator>[] | null;
|
|
2086
|
+
/** @example <p>Body</p> */
|
|
2087
|
+
type RichTextBody = string;
|
|
2088
|
+
declare const enum PromptActionType {
|
|
2089
|
+
Continue = "CONTINUE",
|
|
2090
|
+
External = "EXTERNAL"
|
|
2091
|
+
}
|
|
2092
|
+
interface TextUrlPromptCard extends BaseCard {
|
|
2093
|
+
props: {
|
|
2094
|
+
message: string;
|
|
2095
|
+
options: [];
|
|
2096
|
+
properties: {
|
|
2097
|
+
body: string;
|
|
2098
|
+
buttonText?: string;
|
|
2099
|
+
skipButtonText?: string;
|
|
2100
|
+
buttonUrl?: string;
|
|
2101
|
+
conceptUrl: ConceptUrl;
|
|
2102
|
+
promptActionType: PromptActionType;
|
|
2103
|
+
required: boolean;
|
|
2104
|
+
richTextBody: RichTextBody;
|
|
2105
|
+
};
|
|
2106
|
+
routingOptions: RoutingOptions;
|
|
2107
|
+
};
|
|
2108
|
+
type: CardType.TextUrlPrompt;
|
|
2109
|
+
}
|
|
2110
|
+
declare const enum AvPermission {
|
|
2111
|
+
Camera = "camera",
|
|
2112
|
+
Microphone = "microphone",
|
|
2113
|
+
Screen = "screen"
|
|
2114
|
+
}
|
|
2115
|
+
interface ConsentLegalCard extends BaseCard {
|
|
2116
|
+
props: {
|
|
2117
|
+
message: string;
|
|
2118
|
+
options: [];
|
|
2119
|
+
properties: {
|
|
2120
|
+
body: string;
|
|
2121
|
+
captionText: string;
|
|
2122
|
+
collectName: boolean;
|
|
2123
|
+
conceptUrl: ConceptUrl;
|
|
2124
|
+
consentDocument?: {
|
|
2125
|
+
originalFilename: string;
|
|
2126
|
+
url: string;
|
|
2127
|
+
};
|
|
2128
|
+
consentText: string;
|
|
2129
|
+
nameLabelText: string;
|
|
2130
|
+
required: boolean;
|
|
2131
|
+
richTextBody: RichTextBody;
|
|
2132
|
+
skipButtonText: string;
|
|
2133
|
+
submitButtonText: string;
|
|
2134
|
+
};
|
|
2135
|
+
routingOptions: RoutingOptions;
|
|
2136
|
+
};
|
|
2137
|
+
type: CardType.ConsentLegal;
|
|
2138
|
+
}
|
|
2139
|
+
interface BaseTaskPage {
|
|
2140
|
+
buttonText: string;
|
|
2141
|
+
headline: string;
|
|
2142
|
+
}
|
|
2143
|
+
declare const enum RecordedTaskPageType {
|
|
2144
|
+
AvPermission = "av_permission",
|
|
2145
|
+
ScreenPermission = "screen_permission",
|
|
2146
|
+
StartTask = "start_task",
|
|
2147
|
+
CompleteTask = "complete_task"
|
|
2148
|
+
}
|
|
2149
|
+
interface PermissionTaskPage extends BaseTaskPage {
|
|
2150
|
+
captionText: string;
|
|
2151
|
+
headline: string;
|
|
2152
|
+
permissionDeniedBody: string;
|
|
2153
|
+
permissionDeniedHeadline: string;
|
|
2154
|
+
permissionDescriptors: AvPermission[];
|
|
2155
|
+
permissionGrantedCaptionText?: string;
|
|
2156
|
+
permissionGrantedHeadline?: string;
|
|
2157
|
+
skipButtonText?: string;
|
|
2158
|
+
svg: string;
|
|
2159
|
+
tryAgainButtonText: string;
|
|
2160
|
+
type: RecordedTaskPageType.AvPermission;
|
|
2161
|
+
}
|
|
2162
|
+
interface ScreenTaskPage extends BaseTaskPage {
|
|
2163
|
+
captionText: string;
|
|
2164
|
+
permissionDeniedCaptionText: string;
|
|
2165
|
+
permissionDeniedHeadline: string;
|
|
2166
|
+
selectTabText: string;
|
|
2167
|
+
skipButtonText: string;
|
|
2168
|
+
type: RecordedTaskPageType.ScreenPermission;
|
|
2169
|
+
}
|
|
2170
|
+
interface StartTaskPage extends BaseTaskPage {
|
|
2171
|
+
captionText?: string;
|
|
2172
|
+
skipButtonText: string;
|
|
2173
|
+
taskDetail: string;
|
|
2174
|
+
type: RecordedTaskPageType.StartTask;
|
|
2175
|
+
}
|
|
2176
|
+
interface CompleteTaskPage extends BaseTaskPage {
|
|
2177
|
+
captionText?: string;
|
|
2178
|
+
skipButtonText: string;
|
|
2179
|
+
taskDetail: string;
|
|
2180
|
+
type: RecordedTaskPageType.CompleteTask;
|
|
2181
|
+
}
|
|
2182
|
+
type RecordedTaskPage = PermissionTaskPage | ScreenTaskPage | StartTaskPage | CompleteTaskPage;
|
|
2183
|
+
interface RecordedTaskCardProperties {
|
|
2184
|
+
captionText: string;
|
|
2185
|
+
conceptUrl: ConceptUrl;
|
|
2186
|
+
pages: RecordedTaskPage[];
|
|
2187
|
+
permissions: AvPermission[];
|
|
2188
|
+
required: boolean;
|
|
2189
|
+
taskDetail: string;
|
|
2190
|
+
}
|
|
2191
|
+
interface RecordedTaskCard extends BaseCard {
|
|
2192
|
+
props: {
|
|
2193
|
+
message: string;
|
|
2194
|
+
options: [];
|
|
2195
|
+
properties: RecordedTaskCardProperties;
|
|
2196
|
+
routingOptions: RoutingOptions<Comparator.GivenUp>;
|
|
2197
|
+
};
|
|
2198
|
+
type: CardType.RecordedTask;
|
|
2199
|
+
}
|
|
2200
|
+
interface Labels {
|
|
2201
|
+
left: string;
|
|
2202
|
+
right: string;
|
|
2203
|
+
}
|
|
2204
|
+
interface RatingIcon {
|
|
2205
|
+
idx?: number;
|
|
2206
|
+
svg: string;
|
|
2207
|
+
}
|
|
2208
|
+
declare enum ScaleLabelType {
|
|
2209
|
+
Number = "number",
|
|
2210
|
+
Smiley = "smiley",
|
|
2211
|
+
Star = "star"
|
|
2212
|
+
}
|
|
2213
|
+
interface LikertCard extends BaseCard {
|
|
2214
|
+
props: {
|
|
2215
|
+
labels: Labels;
|
|
2216
|
+
message: string;
|
|
2217
|
+
options: [];
|
|
2218
|
+
properties: {
|
|
2219
|
+
captionText: string;
|
|
2220
|
+
buttonText?: string;
|
|
2221
|
+
conceptUrl: ConceptUrl;
|
|
2222
|
+
labels: Labels;
|
|
2223
|
+
range: string;
|
|
2224
|
+
ratingIcons: RatingIcon[];
|
|
2225
|
+
scaleLabelType: ScaleLabelType;
|
|
2226
|
+
required: boolean;
|
|
2227
|
+
};
|
|
2228
|
+
routingOptions: RoutingOptions<Comparator.Equal | Comparator.GivenUp | Comparator.GreaterThan | Comparator.GreaterThanOrEqual | Comparator.LessThan | Comparator.LessThanOrEqual | Comparator.NotEqual>;
|
|
2229
|
+
};
|
|
2230
|
+
type: CardType.Likert;
|
|
2231
|
+
}
|
|
2232
|
+
interface OpenTextCard extends BaseCard {
|
|
2233
|
+
props: {
|
|
2234
|
+
message: string;
|
|
2235
|
+
options: [];
|
|
2236
|
+
properties: {
|
|
2237
|
+
body: string;
|
|
2238
|
+
buttonText?: string;
|
|
2239
|
+
captionText?: string;
|
|
2240
|
+
conceptUrl: ConceptUrl;
|
|
2241
|
+
openTextPlaceholder?: string;
|
|
2242
|
+
required: boolean;
|
|
2243
|
+
richTextBody: RichTextBody;
|
|
2244
|
+
skipButtonText?: string;
|
|
2245
|
+
};
|
|
2246
|
+
routingOptions: RoutingOptions<Comparator.Contains | Comparator.DoesNotContain>;
|
|
2247
|
+
};
|
|
2248
|
+
type: CardType.Open;
|
|
2249
|
+
}
|
|
2250
|
+
interface MultipleChoiceOption {
|
|
2251
|
+
createdAt: string;
|
|
2252
|
+
deletedAt: null;
|
|
2253
|
+
id: number;
|
|
2254
|
+
label: string;
|
|
2255
|
+
optionProperties: null | {
|
|
2256
|
+
allowsTextEntry: boolean;
|
|
2257
|
+
};
|
|
2258
|
+
order: number;
|
|
2259
|
+
productId: number;
|
|
2260
|
+
surveyId: number;
|
|
2261
|
+
surveyQuestionId: number;
|
|
2262
|
+
updatedAt: string;
|
|
2263
|
+
value: string;
|
|
2264
|
+
}
|
|
2265
|
+
interface CommonMultipleChoiceProps {
|
|
2266
|
+
message: string;
|
|
2267
|
+
options: MultipleChoiceOption[];
|
|
2268
|
+
properties: {
|
|
2269
|
+
buttonText?: string;
|
|
2270
|
+
captionText: string;
|
|
2271
|
+
conceptUrl: ConceptUrl;
|
|
2272
|
+
randomize: "none" | "keeplast" | "all";
|
|
2273
|
+
required: boolean;
|
|
2274
|
+
};
|
|
2275
|
+
}
|
|
2276
|
+
interface MultiChoiceCard<C extends Comparator = DefaultComparator> extends BaseCard {
|
|
2277
|
+
props: CommonMultipleChoiceProps & {
|
|
2278
|
+
routingOptions: RoutingOptions<C>;
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<Comparator.Equal | Comparator.NotEqual | Comparator.ListAtLeastOne | Comparator.DoesNotInclude> {
|
|
2282
|
+
type: CardType.MultipleChoice;
|
|
2283
|
+
}
|
|
2284
|
+
interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<Comparator.ListAll | Comparator.ListAtLeastOne | Comparator.ListExact | Comparator.DoesNotInclude> {
|
|
2285
|
+
type: CardType.MultipleSelect;
|
|
2286
|
+
}
|
|
2287
|
+
interface MatrixCard extends BaseCard {
|
|
2288
|
+
props: {
|
|
2289
|
+
options: MultipleChoiceOption[];
|
|
2290
|
+
message: string;
|
|
2291
|
+
routingOptions: RoutingOptions<Comparator.Skipped | Comparator.Partial | Comparator.Answered>;
|
|
2292
|
+
properties: {
|
|
2293
|
+
buttonText?: string;
|
|
2294
|
+
captionText: string;
|
|
2295
|
+
conceptUrl: ConceptUrl;
|
|
2296
|
+
matrixColumn: {
|
|
2297
|
+
label: string;
|
|
2298
|
+
value: string;
|
|
2299
|
+
}[];
|
|
2300
|
+
randomize: "none" | "all";
|
|
2301
|
+
required: boolean;
|
|
2302
|
+
};
|
|
2303
|
+
};
|
|
2304
|
+
type: CardType.Matrix;
|
|
2305
|
+
}
|
|
2306
|
+
interface NPSCard extends BaseCard {
|
|
2307
|
+
props: {
|
|
2308
|
+
labels: {
|
|
2309
|
+
left: string;
|
|
2310
|
+
right: string;
|
|
2311
|
+
};
|
|
2312
|
+
message: string;
|
|
2313
|
+
options: [];
|
|
2314
|
+
properties: {
|
|
2315
|
+
buttonText?: string;
|
|
2316
|
+
captionText: string;
|
|
2317
|
+
conceptUrl: null;
|
|
2318
|
+
labels: {
|
|
2319
|
+
left: string;
|
|
2320
|
+
right: string;
|
|
2321
|
+
};
|
|
2322
|
+
required: boolean;
|
|
2323
|
+
};
|
|
2324
|
+
routingOptions: RoutingOptions<Comparator.Equal | Comparator.GreaterThan | Comparator.GreaterThanOrEqual | Comparator.LessThan | Comparator.LessThanOrEqual | Comparator.NotEqual>;
|
|
2325
|
+
};
|
|
2326
|
+
type: CardType.NPS;
|
|
2327
|
+
}
|
|
2328
|
+
interface VideoVoiceCard extends BaseCard {
|
|
2329
|
+
props: {
|
|
2330
|
+
message: string;
|
|
2331
|
+
options: [];
|
|
2332
|
+
properties: {
|
|
2333
|
+
buttonText: string;
|
|
2334
|
+
captionText: string;
|
|
2335
|
+
conceptUrl: null;
|
|
2336
|
+
mediaType: "video" | "audio";
|
|
2337
|
+
required: boolean;
|
|
2338
|
+
skipButtonText: string;
|
|
2339
|
+
uploadId: string;
|
|
2340
|
+
videoUrl: string;
|
|
2341
|
+
};
|
|
2342
|
+
routingOptions: RoutingOptions;
|
|
2343
|
+
};
|
|
2344
|
+
type: CardType.VideoVoice;
|
|
2345
|
+
}
|
|
2346
|
+
type Card = TextUrlPromptCard | ConsentLegalCard | RecordedTaskCard | LikertCard | OpenTextCard | MatrixCard | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | VideoVoiceCard;
|
|
2347
|
+
|
|
2348
|
+
interface RecordedTaskResponseType {
|
|
2349
|
+
questionId: number;
|
|
2350
|
+
type: CardType;
|
|
2351
|
+
value: RecordedTaskResponseValueType;
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
interface MobileReplayConfig {
|
|
2355
|
+
maxMobileReplayDurationSeconds?: number;
|
|
2356
|
+
mobileReplaySettings?: {
|
|
2357
|
+
hideAllFormContents: boolean;
|
|
2358
|
+
hidePasswordsOnly: boolean;
|
|
2359
|
+
hideAllImages: boolean;
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2362
|
+
type SprigEventMap = {
|
|
2363
|
+
[InternalEventName.CurrentQuestion]: [
|
|
2364
|
+
{
|
|
2365
|
+
[InternalEventData.QuestionId]: number;
|
|
2366
|
+
[InternalEventData.Props]: unknown;
|
|
2367
|
+
}
|
|
2368
|
+
];
|
|
2369
|
+
[InternalEventName.RecordedTaskPermissionScreen]: [];
|
|
2370
|
+
[InternalEventName.RecordedTaskStart]: [];
|
|
2371
|
+
[InternalEventName.SurveyComplete]: [];
|
|
2372
|
+
[InternalEventName.VerifyViewVersion]: [
|
|
2373
|
+
{
|
|
2374
|
+
[InternalEventData.ViewVersion]: string;
|
|
2375
|
+
}
|
|
2376
|
+
];
|
|
2377
|
+
[SprigEvent.CloseSurveyOnOverlayClick]: [];
|
|
2378
|
+
[SprigEvent.SDKReady]: [MobileReplayConfig];
|
|
2379
|
+
[SprigEvent.SurveyAppeared]: [
|
|
2380
|
+
{
|
|
2381
|
+
name: string;
|
|
2382
|
+
[SprigEventData.SurveyId]: number;
|
|
2383
|
+
}
|
|
2384
|
+
];
|
|
2385
|
+
[SprigEvent.SurveyDimensions]: [
|
|
2386
|
+
{
|
|
2387
|
+
contentFrameHeight: number;
|
|
2388
|
+
contentFrameWidth: number;
|
|
2389
|
+
name: string;
|
|
2390
|
+
}
|
|
2391
|
+
];
|
|
2392
|
+
[SprigEvent.SurveyClosed]: [
|
|
2393
|
+
{
|
|
2394
|
+
initiator?: string;
|
|
2395
|
+
name: string;
|
|
2396
|
+
}
|
|
2397
|
+
];
|
|
2398
|
+
[SprigEvent.SurveyFadingOut]: [];
|
|
2399
|
+
[SprigEvent.SurveyHeight]: [
|
|
2400
|
+
{
|
|
2401
|
+
name: string;
|
|
2402
|
+
contentFrameHeight: number;
|
|
2403
|
+
}
|
|
2404
|
+
];
|
|
2405
|
+
[SprigEvent.SurveyWidth]: [
|
|
2406
|
+
{
|
|
2407
|
+
name: string;
|
|
2408
|
+
contentFrameWidth: number;
|
|
2409
|
+
}
|
|
2410
|
+
];
|
|
2411
|
+
[SprigEvent.SurveyLifeCycle]: [{
|
|
2412
|
+
state: string;
|
|
2413
|
+
}];
|
|
2414
|
+
[SprigEvent.SurveyPresented]: [
|
|
2415
|
+
{
|
|
2416
|
+
name: string;
|
|
2417
|
+
[SprigEventData.SurveyId]: number;
|
|
2418
|
+
}
|
|
2419
|
+
];
|
|
2420
|
+
[SprigEvent.SurveyWillClose]: [
|
|
2421
|
+
{
|
|
2422
|
+
initiator: DismissReason;
|
|
2423
|
+
name?: string;
|
|
2424
|
+
}
|
|
2425
|
+
];
|
|
2426
|
+
[SprigEvent.SurveyWillPresent]: [
|
|
2427
|
+
{
|
|
2428
|
+
name: string;
|
|
2429
|
+
[SprigEventData.SurveyId]: number;
|
|
2430
|
+
}
|
|
2431
|
+
];
|
|
2432
|
+
[SprigEvent.VisitorIDUpdated]: [{
|
|
2433
|
+
visitorId: string | null;
|
|
2434
|
+
}];
|
|
2435
|
+
[SprigEvent.QuestionAnswered]: [
|
|
2436
|
+
{
|
|
2437
|
+
answeredAt?: number;
|
|
2438
|
+
questionIndex?: number;
|
|
2439
|
+
value: unknown;
|
|
2440
|
+
}
|
|
2441
|
+
];
|
|
2442
|
+
[SprigEvent.ReplayCapture]: [
|
|
2443
|
+
{
|
|
2444
|
+
responseGroupUid: string;
|
|
2445
|
+
hasQuestions: boolean;
|
|
2446
|
+
uploadId: string;
|
|
2447
|
+
seconds: number;
|
|
2448
|
+
replayType: ReplayDurationType;
|
|
2449
|
+
generateVideoUploadUrlPayload: object;
|
|
2450
|
+
surveyId: number;
|
|
2451
|
+
}
|
|
2452
|
+
];
|
|
2453
|
+
[SprigRecordingEvent.AvPermission]: [
|
|
2454
|
+
{
|
|
2455
|
+
[SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
|
|
2456
|
+
[SprigRecordingEventData.PermissionDescriptors]: AvPermission[];
|
|
2457
|
+
}
|
|
2458
|
+
];
|
|
2459
|
+
[SprigRecordingEvent.BeginRecording]: [
|
|
2460
|
+
{
|
|
2461
|
+
[SprigRecordingEventData.RecordingMediaTypes]: MediaType[];
|
|
2462
|
+
[SprigRecordingEventData.StartRecordingCallback]: (mediaRecordingUids: UUID[]) => void;
|
|
2463
|
+
}
|
|
2464
|
+
];
|
|
2465
|
+
[SprigRecordingEvent.FinishTask]: [
|
|
2466
|
+
{
|
|
2467
|
+
[SprigRecordingEventData.BeginCallback]: (mediaRecordingUid: UUID) => void;
|
|
2468
|
+
[SprigRecordingEventData.CurrentIndex]: number;
|
|
2469
|
+
[SprigRecordingEventData.PassthroughData]: PassthroughData;
|
|
2470
|
+
[SprigRecordingEventData.ProgressCallback]: (mediaRecordingUid: UUID, data: {
|
|
2471
|
+
detail: number;
|
|
2472
|
+
}) => void;
|
|
2473
|
+
[SprigRecordingEventData.TaskCompleteCallback]: (taskDurationMillisecond: number) => void;
|
|
2474
|
+
[SprigRecordingEventData.TaskResponse]: RecordedTaskResponseType;
|
|
2475
|
+
[SprigRecordingEventData.UploadCallback]: (mediaRecordingUid: UUID | null, successOrError: true | unknown) => void;
|
|
2476
|
+
}
|
|
2477
|
+
];
|
|
2478
|
+
[SprigRecordingEvent.PermissionStatus]: [
|
|
2479
|
+
{
|
|
2480
|
+
[SprigRecordingEventData.PermissionStatusCallback]: (avStream: MediaStream | undefined, hasVideoPermission: boolean, hasScreenPermission: boolean, captureStream: MediaStream | undefined) => void;
|
|
2481
|
+
}
|
|
2482
|
+
];
|
|
2483
|
+
[SprigRecordingEvent.ScreenPermission]: [
|
|
2484
|
+
{
|
|
2485
|
+
[SprigRecordingEventData.ScreenPermissionRequested]?: (data: boolean) => void;
|
|
2486
|
+
[SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream: MediaStream | null) => void;
|
|
2487
|
+
}
|
|
2488
|
+
];
|
|
2489
|
+
[SprigRecordingEvent.StartTask]: [];
|
|
2490
|
+
};
|
|
2491
|
+
declare const eventEmitter: Emitter<SprigEventMap>;
|
|
2492
|
+
type SprigEventEmitter = typeof eventEmitter;
|
|
2493
|
+
|
|
2494
|
+
type MatchType = "exactly" | "legacy";
|
|
2495
|
+
interface InteractiveEvent {
|
|
2496
|
+
id: number;
|
|
2497
|
+
matchType: MatchType;
|
|
2498
|
+
name: string;
|
|
2499
|
+
pattern: string;
|
|
2500
|
+
properties: {
|
|
2501
|
+
innerText: string;
|
|
2502
|
+
selector?: string;
|
|
2503
|
+
type?: "click";
|
|
2504
|
+
};
|
|
2505
|
+
}
|
|
2506
|
+
interface PageUrlEvent {
|
|
2507
|
+
id: number;
|
|
2508
|
+
matchType: MatchType | "contains" | "notContains" | "regex" | "startsWith";
|
|
2509
|
+
pattern: string;
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
declare const enum FramePosition {
|
|
2513
|
+
BottomLeft = "bottomLeft",
|
|
2514
|
+
BottomRight = "bottomRight",
|
|
2515
|
+
Center = "center",
|
|
2516
|
+
TopLeft = "topLeft",
|
|
2517
|
+
TopRight = "topRight"
|
|
2518
|
+
}
|
|
2519
|
+
declare const enum HttpHeader {
|
|
2520
|
+
Error = "x-ul-error",
|
|
2521
|
+
EnvironmentID = "x-ul-environment-id",
|
|
2522
|
+
InstallationMethod = "x-ul-installation-method",
|
|
2523
|
+
PartnerAnonymousId = "x-ul-anonymous-id",
|
|
2524
|
+
Platform = "userleap-platform",
|
|
2525
|
+
PreviewMode = "x-ul-preview-mode",
|
|
2526
|
+
UserID = "x-ul-user-id",
|
|
2527
|
+
VisitorID = "x-ul-visitor-id"
|
|
2528
|
+
}
|
|
2529
|
+
declare const enum Platform {
|
|
2530
|
+
Email = "email",
|
|
2531
|
+
Link = "link",
|
|
2532
|
+
Web = "web"
|
|
2533
|
+
}
|
|
2534
|
+
declare const enum InstallationMethod {
|
|
2535
|
+
Npm = "web-npm",
|
|
2536
|
+
NpmBundled = "web-npm-bundled",
|
|
2537
|
+
Gtm = "web-gtm",
|
|
2538
|
+
Segment = "web-segment",
|
|
2539
|
+
SegmentAndroid = "android-segment",
|
|
2540
|
+
SegmentReactNative = "react-native-segment",
|
|
2541
|
+
SegmentIOS = "ios-segment",
|
|
2542
|
+
Snippet = "web-snippet"
|
|
2543
|
+
}
|
|
2544
|
+
interface Answer {
|
|
2545
|
+
questionId: number;
|
|
2546
|
+
value: unknown;
|
|
2547
|
+
}
|
|
2548
|
+
interface Config extends MobileReplayConfig {
|
|
2549
|
+
allResponses: unknown[];
|
|
2550
|
+
answers?: Answer[];
|
|
2551
|
+
apiURL: string;
|
|
2552
|
+
/** @example "#000000" */
|
|
2553
|
+
border: string;
|
|
2554
|
+
cards: Card[];
|
|
2555
|
+
configureExitOnOverlayClick: (cb: () => void) => void;
|
|
2556
|
+
context: {
|
|
2557
|
+
outcome: string;
|
|
2558
|
+
product: {
|
|
2559
|
+
name: string;
|
|
2560
|
+
};
|
|
2561
|
+
visitor: {
|
|
2562
|
+
outcome: string;
|
|
2563
|
+
};
|
|
2564
|
+
};
|
|
2565
|
+
customMetadata?: Record<string, unknown>;
|
|
2566
|
+
customStyles: string;
|
|
2567
|
+
dismissOnPageChange: boolean;
|
|
2568
|
+
forceBrandedLogo?: boolean;
|
|
2569
|
+
endCard?: {
|
|
2570
|
+
headline: string;
|
|
2571
|
+
subheader?: string;
|
|
2572
|
+
};
|
|
2573
|
+
/** @example "SJcVfq-7QQ" */
|
|
2574
|
+
envId: string;
|
|
2575
|
+
environmentId?: string;
|
|
2576
|
+
exitOnOverlayClick?: boolean;
|
|
2577
|
+
exitOnOverlayClickMobile?: boolean;
|
|
2578
|
+
eventEmitFn: SprigEventEmitter["emit"];
|
|
2579
|
+
fontFamily?: string;
|
|
2580
|
+
fontFamilyURL: undefined;
|
|
2581
|
+
frame: HTMLIFrameElement & {
|
|
2582
|
+
eventEmitter?: SprigEventEmitter;
|
|
2583
|
+
setHeight?: (height: number) => void;
|
|
2584
|
+
setWidth?: (width: number) => void;
|
|
2585
|
+
};
|
|
2586
|
+
framePosition: FramePosition;
|
|
2587
|
+
headers: {
|
|
2588
|
+
"accept-language"?: string;
|
|
2589
|
+
/** @example "Bearer 123" */
|
|
2590
|
+
Authorization?: string;
|
|
2591
|
+
"Content-Type": string;
|
|
2592
|
+
"userleap-platform": Platform;
|
|
2593
|
+
/** @example "SJcVfq-7QQ" */
|
|
2594
|
+
[HttpHeader.EnvironmentID]?: string;
|
|
2595
|
+
[HttpHeader.InstallationMethod]: InstallationMethod;
|
|
2596
|
+
[HttpHeader.PartnerAnonymousId]?: string;
|
|
2597
|
+
[HttpHeader.PreviewMode]?: string;
|
|
2598
|
+
/** @example "2.18.0" */
|
|
2599
|
+
"x-ul-sdk-version": string;
|
|
2600
|
+
/** For web-bundled sdk */
|
|
2601
|
+
"x-ul-bundled-sdk-version"?: string;
|
|
2602
|
+
[HttpHeader.UserID]?: string;
|
|
2603
|
+
[HttpHeader.VisitorID]?: UUID;
|
|
2604
|
+
};
|
|
2605
|
+
installationMethod?: InstallationMethod;
|
|
2606
|
+
interactiveEvents: InteractiveEvent[];
|
|
2607
|
+
interactiveEventsHandler?: (e: MouseEvent) => void;
|
|
2608
|
+
isPreview?: boolean;
|
|
2609
|
+
launchDarklyEnabled?: boolean;
|
|
2610
|
+
locale: string;
|
|
2611
|
+
marketingUrl?: string;
|
|
2612
|
+
maxAttrNameLength: number;
|
|
2613
|
+
maxAttrValueLength: number;
|
|
2614
|
+
maxEmailLength: number;
|
|
2615
|
+
maxEventLength: number;
|
|
2616
|
+
maxReplayDurationSeconds?: number;
|
|
2617
|
+
maxUserIdLength: number;
|
|
2618
|
+
mobileSDKVersion: undefined;
|
|
2619
|
+
mode?: string;
|
|
2620
|
+
mute?: boolean;
|
|
2621
|
+
optimizelyEnabled?: boolean;
|
|
2622
|
+
overlayStyle: "light";
|
|
2623
|
+
overlayStyleMobile: "none";
|
|
2624
|
+
pageUrlEvents: PageUrlEvent[];
|
|
2625
|
+
path?: string;
|
|
2626
|
+
platform?: Platform;
|
|
2627
|
+
previewKey?: string | null;
|
|
2628
|
+
previewLanguage?: string;
|
|
2629
|
+
replayNonce?: string;
|
|
2630
|
+
replaySettings?: object;
|
|
2631
|
+
requireUserIdForTracking: boolean;
|
|
2632
|
+
responseGroupUid: UUID;
|
|
2633
|
+
showStripes: boolean;
|
|
2634
|
+
showSurveyBrand: boolean;
|
|
2635
|
+
slugName: null;
|
|
2636
|
+
startingQuestionIdx?: number | null;
|
|
2637
|
+
styleNonce?: string;
|
|
2638
|
+
surveyId: number;
|
|
2639
|
+
tabTitle: string;
|
|
2640
|
+
ulEvents: typeof SprigEvent;
|
|
2641
|
+
UpChunk: Window["UpChunk"];
|
|
2642
|
+
useDesktopPrototype?: boolean;
|
|
2643
|
+
useMobileStyling: boolean;
|
|
2644
|
+
userId: UUID | null;
|
|
2645
|
+
visitorId: UUID | null;
|
|
2646
|
+
viewDocument: Document;
|
|
2647
|
+
viewWindow: Window;
|
|
2648
|
+
visitorAttributes: {
|
|
2649
|
+
email?: string;
|
|
2650
|
+
externalUserId?: string;
|
|
2651
|
+
};
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
declare enum ReplayDurationType {
|
|
2655
|
+
After = "after",
|
|
2656
|
+
Before = "before",
|
|
2657
|
+
BeforeAndAfter = "beforeAndAfter"
|
|
2658
|
+
}
|
|
2659
|
+
declare enum ReplayEventType {
|
|
2660
|
+
Click = "Sprig_Click",
|
|
2661
|
+
Event = "Sprig_TrackEvent",
|
|
2662
|
+
PageView = "Sprig_PageView",
|
|
2663
|
+
SurveyShown = "Sprig_ShowSurvey",
|
|
2664
|
+
SurveySubmitted = "Sprig_SubmitSurvey",
|
|
2665
|
+
Noop = "Sprig_Noop"
|
|
2666
|
+
}
|
|
2667
|
+
type EventDigest = {
|
|
2668
|
+
timestamp: number;
|
|
2669
|
+
type: ReplayEventType.Click;
|
|
2670
|
+
} | {
|
|
2671
|
+
timestamp: number;
|
|
2672
|
+
name: string;
|
|
2673
|
+
type: ReplayEventType.Event;
|
|
2674
|
+
} | {
|
|
2675
|
+
timestamp: number;
|
|
2676
|
+
type: ReplayEventType.PageView;
|
|
2677
|
+
url: string;
|
|
2678
|
+
} | {
|
|
2679
|
+
timestamp: number;
|
|
2680
|
+
surveyId: string;
|
|
2681
|
+
type: ReplayEventType.SurveyShown;
|
|
2682
|
+
} | {
|
|
2683
|
+
timestamp: number;
|
|
2684
|
+
surveyId: string;
|
|
2685
|
+
type: ReplayEventType.SurveySubmitted;
|
|
2686
|
+
};
|
|
2687
|
+
|
|
2688
|
+
declare namespace optimizely {
|
|
2689
|
+
interface Optimizely {
|
|
2690
|
+
get?: (key: "state") => {
|
|
2691
|
+
getExperimentStates: (options: {
|
|
2692
|
+
filter?: unknown;
|
|
2693
|
+
isActive?: boolean;
|
|
2694
|
+
}) => Record<string, OptimizelyExperimentState>;
|
|
2695
|
+
};
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
// Ref: https://docs.developers.optimizely.com/web/docs/state#return-value-2
|
|
2699
|
+
interface OptimizelyExperimentState {
|
|
2700
|
+
/** Audiences the visitor was in when the experiment was activated.
|
|
2701
|
+
* @example { "id": "6672770135", "name": "Chrome users" }
|
|
2702
|
+
*/
|
|
2703
|
+
audiences: { id: number; name: string }[];
|
|
2704
|
+
/** The name of the experiment
|
|
2705
|
+
* @example OptimizelyExperimentState
|
|
2706
|
+
* */
|
|
2707
|
+
experimentName: string;
|
|
2708
|
+
/** The ID of the experiment
|
|
2709
|
+
* @example OptimizelyExperimentState
|
|
2710
|
+
* */
|
|
2711
|
+
id: string;
|
|
2712
|
+
/** Indicates if the experiment is currently active */
|
|
2713
|
+
isActive: boolean;
|
|
2714
|
+
/** Indicates if the visitor is in the holdback (i.e., is excluded due traffic allocation) */
|
|
2715
|
+
isInExperimentHoldback: boolean;
|
|
2716
|
+
/** The name of the object. Required */
|
|
2717
|
+
name: string;
|
|
2718
|
+
/** An object with the name and the ID of the variation the visitor is bucketed in, or null if the visitor was not bucketed
|
|
2719
|
+
* @example { "id": "6626731852", "name": "Variation #1" }
|
|
2720
|
+
*/
|
|
2721
|
+
variation: { id: number; name: string } | null;
|
|
2722
|
+
/** Indicates if the visitor was redirected due to this experiment */
|
|
2723
|
+
visitorRedirected: boolean;
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
|
|
2727
|
+
declare namespace sprigConfig {
|
|
2728
|
+
type IdentifyResult = Promise<
|
|
2729
|
+
| {
|
|
2730
|
+
success: boolean;
|
|
2731
|
+
message?: string;
|
|
2732
|
+
surveyState?: SurveyState;
|
|
2733
|
+
surveyId?: number;
|
|
2734
|
+
responseGroupUid?: string;
|
|
2735
|
+
}
|
|
2736
|
+
| undefined
|
|
2737
|
+
>;
|
|
2738
|
+
|
|
2739
|
+
interface TrackPayload {
|
|
2740
|
+
anonymousId?: string;
|
|
2741
|
+
metadata?: SprigMetadata;
|
|
2742
|
+
eventName?: string;
|
|
2743
|
+
properties?: SprigProperties;
|
|
2744
|
+
userId?: string;
|
|
2745
|
+
showSurveyCallback?: (surveyId?: number) => Promise<boolean>;
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
interface SprigAPIActions {
|
|
2749
|
+
// internal apis
|
|
2750
|
+
_completeSessionReplay: (payload: {
|
|
2751
|
+
surveyId: number;
|
|
2752
|
+
responseGroupUuid: string;
|
|
2753
|
+
eventDigest?: EventDigest[];
|
|
2754
|
+
}) => Promise<void>;
|
|
2755
|
+
_generateVideoUploadUrl: (body: {
|
|
2756
|
+
mediaRecordingUid?: string;
|
|
2757
|
+
mediaType?: MediaType;
|
|
2758
|
+
questionId?: number;
|
|
2759
|
+
responseGroupUid?: string;
|
|
2760
|
+
surveyId?: number;
|
|
2761
|
+
updatedAt?: string;
|
|
2762
|
+
visitorId?: string | null;
|
|
2763
|
+
isReplay?: boolean;
|
|
2764
|
+
}) => Promise<string | null>;
|
|
2765
|
+
_previewSurvey: (surveyTemplateId: UUID) => void;
|
|
2766
|
+
_reviewSurvey: (surveyId: number) => void;
|
|
2767
|
+
|
|
2768
|
+
// external apis
|
|
2769
|
+
addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
|
|
2770
|
+
addSurveyListener: (listener: SprigListener) => Promise<void>;
|
|
2771
|
+
applyStyles: (styleString: string) => void;
|
|
2772
|
+
dismissActiveSurvey: (reason?: DismissReason) => void;
|
|
2773
|
+
displaySurvey: (surveyId: number) => IdentifyResult;
|
|
2774
|
+
identifyAndSetAttributes: (payload: {
|
|
2775
|
+
anonymousId?: string;
|
|
2776
|
+
attributes?: SprigAttributes;
|
|
2777
|
+
userId?: string;
|
|
2778
|
+
}) => IdentifyResult;
|
|
2779
|
+
identifyAndTrack: (payload: TrackPayload) => IdentifyResult;
|
|
2780
|
+
importLaunchDarklyData: (data: Record<string, number | undefined>) => void;
|
|
2781
|
+
integrateOptimizely: (
|
|
2782
|
+
strData: string | { experiments: Experiment[] },
|
|
2783
|
+
isOverride?: boolean
|
|
2784
|
+
) => void;
|
|
2785
|
+
integrateOptimizelyClient: (client: Client) => void;
|
|
2786
|
+
logoutUser: () => void;
|
|
2787
|
+
mute: () => void;
|
|
2788
|
+
previewSurvey: (surveyTemplateId: UUID) => void;
|
|
2789
|
+
removeAllListeners: () => Promise<void>;
|
|
2790
|
+
removeAttributes: (attributes: SprigAttributes) => IdentifyResult;
|
|
2791
|
+
removeListener: (
|
|
2792
|
+
event: SprigEvent,
|
|
2793
|
+
listener: SprigListener
|
|
2794
|
+
) => Promise<void>;
|
|
2795
|
+
removeSurveyListener: (listener: SprigListener) => Promise<void>;
|
|
2796
|
+
reviewSurvey: (surveyId: number) => void;
|
|
2797
|
+
setAttribute: (attribute: string, value: string | number) => IdentifyResult;
|
|
2798
|
+
setAttributes: (attributes?: SprigAttributes) => IdentifyResult;
|
|
2799
|
+
setPartnerAnonymousId: (
|
|
2800
|
+
partnerAnonymousId: string
|
|
2801
|
+
) => Promise<{ success: boolean; message?: string }>;
|
|
2802
|
+
setVisitorAttribute: (
|
|
2803
|
+
attribute: string,
|
|
2804
|
+
value: string | number
|
|
2805
|
+
) => IdentifyResult;
|
|
2806
|
+
setWindowDimensions: (
|
|
2807
|
+
width: number | string,
|
|
2808
|
+
height: number | string
|
|
2809
|
+
) => void;
|
|
2810
|
+
setEmail: (email: string) => IdentifyResult;
|
|
2811
|
+
setPreviewKey: (previewKey: string) => void;
|
|
2812
|
+
setUserId: (userId: string) => IdentifyResult;
|
|
2813
|
+
setVisitorEmail: (email: string) => IdentifyResult;
|
|
2814
|
+
setVisitorToken: () => void;
|
|
2815
|
+
teardown: () => void;
|
|
2816
|
+
track: (
|
|
2817
|
+
eventName: string,
|
|
2818
|
+
properties?: TrackPayload["properties"],
|
|
2819
|
+
metadata?: SprigMetadata,
|
|
2820
|
+
showSurveyCallback?: (surveyId?: number) => Promise<boolean>
|
|
2821
|
+
) => IdentifyResult;
|
|
2822
|
+
trackPageView: (
|
|
2823
|
+
url: string,
|
|
2824
|
+
properties?: SprigProperties,
|
|
2825
|
+
showSurveyCallback?: (surveyId?: number) => Promise<boolean>
|
|
2826
|
+
) => void;
|
|
2827
|
+
unmute: () => void;
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
type SprigCommand = keyof SprigAPIActions;
|
|
2831
|
+
type SprigCommands = <C extends SprigCommand>(
|
|
2832
|
+
command: C,
|
|
2833
|
+
...params: Parameters<SprigAPIActions[C]>
|
|
2834
|
+
) => ReturnType<SprigAPIActions[C]>;
|
|
2835
|
+
|
|
2836
|
+
type WindowSprig = Config &
|
|
2837
|
+
SprigAPIActions &
|
|
2838
|
+
SprigCommands & {
|
|
2839
|
+
_API_URL: string;
|
|
2840
|
+
_config: Config;
|
|
2841
|
+
_gtm: unknown; // TODO: determine if boolean?
|
|
2842
|
+
_queue: SprigQueue;
|
|
2843
|
+
_segment: unknown; // TODO: determine if boolean?
|
|
2844
|
+
appId: string;
|
|
2845
|
+
container?: HTMLElement | null;
|
|
2846
|
+
config: Config;
|
|
2847
|
+
debugMode?: boolean;
|
|
2848
|
+
delayingSurvey: boolean;
|
|
2849
|
+
email?: string | null;
|
|
2850
|
+
envId: string;
|
|
2851
|
+
error?: Error;
|
|
2852
|
+
frameId: string;
|
|
2853
|
+
loaded: boolean;
|
|
2854
|
+
locale?: string;
|
|
2855
|
+
maxHeight?: number | string;
|
|
2856
|
+
maxInflightReplayRequests?: number;
|
|
2857
|
+
mobileHeadersJSON?: string;
|
|
2858
|
+
nonce?: string;
|
|
2859
|
+
partnerAnonymousId: string | null;
|
|
2860
|
+
replayNonce?: string;
|
|
2861
|
+
reportError: (name: string, err: Error, extraInfo?: object) => void;
|
|
2862
|
+
sampleRate?: number;
|
|
2863
|
+
token: string | null;
|
|
2864
|
+
UPDATES: typeof EVENTS;
|
|
2865
|
+
viewSDKURL?: string;
|
|
2866
|
+
windowDimensions?: {
|
|
2867
|
+
height: number;
|
|
2868
|
+
width: number;
|
|
2869
|
+
};
|
|
2870
|
+
};
|
|
2871
|
+
}
|
|
2872
|
+
type ArgumentTypes<F> = F extends (...args: infer A) => unknown ? A : never;
|
|
2873
|
+
type ArgumentType<T> = T extends (arg1: infer U, ...args: unknown[]) => unknown
|
|
2874
|
+
? U
|
|
2875
|
+
: unknown;
|
|
2876
|
+
type PublicOf<T> = { [K in keyof T]: T[K] };
|
|
2877
|
+
type createUpload = typeof _mux_upchunk["createUpload"];
|
|
2878
|
+
type rrwebRecord = typeof rrweb["record"];
|
|
2879
|
+
type rrwebCustomEvent = typeof rrweb["record"]["addCustomEvent"];
|
|
2880
|
+
declare global {
|
|
2881
|
+
interface Window {
|
|
2882
|
+
__cfg: Config;
|
|
2883
|
+
attachEvent?: typeof window.addEventListener;
|
|
2884
|
+
Intercom: { ul_wasVisible?: boolean } & ((
|
|
2885
|
+
method: string,
|
|
2886
|
+
data: unknown
|
|
2887
|
+
) => void);
|
|
2888
|
+
optimizely?: optimizely.Optimizely;
|
|
2889
|
+
optimizelyDatafile?: object;
|
|
2890
|
+
previewMode?: unknown;
|
|
2891
|
+
UpChunk: {
|
|
2892
|
+
createUpload: (
|
|
2893
|
+
...args: ArgumentTypes<createUpload>
|
|
2894
|
+
) => PublicOf<ReturnType<createUpload>>;
|
|
2895
|
+
};
|
|
2896
|
+
_Sprig?: sprigConfig.WindowSprig;
|
|
2897
|
+
Sprig: sprigConfig.WindowSprig;
|
|
2898
|
+
UserLeap: sprigConfig.WindowSprig;
|
|
2899
|
+
rrwebRecord?: {
|
|
2900
|
+
addCustomEvent: (
|
|
2901
|
+
...args: ArgumentTypes<rrwebCustomEvent>
|
|
2902
|
+
) => PublicOf<ReturnType<rrwebCustomEvent>>;
|
|
2903
|
+
} & ((
|
|
2904
|
+
arg: Omit<ArgumentType<rrwebRecord>, "hooks">
|
|
2905
|
+
) => PublicOf<ReturnType<rrwebRecord>>);
|
|
2906
|
+
sprigAPI?: object;
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
type WindowSprig = sprigConfig.WindowSprig;
|
|
2910
|
+
type SprigAttributes = Record<string, boolean | number | string>;
|
|
2911
|
+
type SprigListener = Listener<unknown[]>;
|
|
2912
|
+
type SprigMetadata = Record<string, unknown>;
|
|
2913
|
+
type SprigProperties = Record<string, unknown>;
|
|
2914
|
+
type SprigAPIActions = sprigConfig.SprigAPIActions;
|
|
2915
|
+
type TrackPayload = sprigConfig.TrackPayload;
|
|
2916
|
+
|
|
2917
|
+
// common types
|
|
2918
|
+
/** @example "123e4567-e89b-12d3-a456-426614174000" */
|
|
2919
|
+
type UUID = string;
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
declare class SprigAPI {
|
|
2923
|
+
/**
|
|
2924
|
+
* Include external events emitted from Sprig
|
|
2925
|
+
*/
|
|
2926
|
+
UPDATES: {
|
|
2927
|
+
SDK_READY: SprigEvent;
|
|
2928
|
+
SURVEY_APPEARED: SprigEvent;
|
|
2929
|
+
SURVEY_CLOSED: SprigEvent;
|
|
2930
|
+
SURVEY_DIMENSIONS: SprigEvent;
|
|
2931
|
+
SURVEY_FADING_OUT: SprigEvent;
|
|
2932
|
+
SURVEY_HEIGHT: SprigEvent;
|
|
2933
|
+
SURVEY_PRESENTED: SprigEvent;
|
|
2934
|
+
SURVEY_LIFE_CYCLE: SprigEvent;
|
|
2935
|
+
SURVEY_WILL_CLOSE: SprigEvent;
|
|
2936
|
+
SURVEY_WILL_PRESENT: SprigEvent;
|
|
2937
|
+
QUESTION_ANSWERED: SprigEvent;
|
|
2938
|
+
REPLAY_CAPTURE: SprigEvent;
|
|
2939
|
+
CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
|
|
2940
|
+
VISITOR_ID_UPDATED: SprigEvent;
|
|
2941
|
+
DATA: {
|
|
2942
|
+
DISMISS_REASONS: {
|
|
2943
|
+
API: DismissReason;
|
|
2944
|
+
CLOSED: DismissReason;
|
|
2945
|
+
COMPLETE: DismissReason;
|
|
2946
|
+
PAGE_CHANGE: DismissReason;
|
|
2947
|
+
OVERRIDE: DismissReason;
|
|
2948
|
+
};
|
|
2949
|
+
SURVEY_ID: SprigEventData;
|
|
2950
|
+
};
|
|
2951
|
+
};
|
|
2952
|
+
/**
|
|
2953
|
+
* Triggers displaying specified survey. Does submit answers!
|
|
2954
|
+
*/
|
|
2955
|
+
displaySurvey(surveyId: number): void;
|
|
2956
|
+
/**
|
|
2957
|
+
* Pauses api interactions
|
|
2958
|
+
*/
|
|
2959
|
+
mute(): void;
|
|
2960
|
+
/**
|
|
2961
|
+
* Restart api interactions
|
|
2962
|
+
*/
|
|
2963
|
+
unmute(): void;
|
|
2964
|
+
/**
|
|
2965
|
+
* Manually dismiss an opened survey
|
|
2966
|
+
*/
|
|
2967
|
+
dismissActiveSurvey(): void;
|
|
2968
|
+
/**
|
|
2969
|
+
* Set an arbitrary attribute on the visitor
|
|
2970
|
+
*/
|
|
2971
|
+
setAttribute(attribute: string, value: string): void;
|
|
2972
|
+
/**
|
|
2973
|
+
* Set attributes on visitor
|
|
2974
|
+
*/
|
|
2975
|
+
setAttributes(attributes: SprigAttributes): void;
|
|
2976
|
+
/**
|
|
2977
|
+
* Set identifiers and attributes on visitor
|
|
2978
|
+
*/
|
|
2979
|
+
identifyAndSetAttributes(payload: {
|
|
2980
|
+
anonymousID?: string;
|
|
2981
|
+
attributes: SprigAttributes;
|
|
2982
|
+
userID?: string;
|
|
2983
|
+
}): void;
|
|
2984
|
+
/**
|
|
2985
|
+
* Remove attributes on visitor
|
|
2986
|
+
*/
|
|
2987
|
+
removeAttributes(attributes: SprigAttributes): void;
|
|
2988
|
+
/**
|
|
2989
|
+
* Add a listener for an event defined in ulEvents
|
|
2990
|
+
*/
|
|
2991
|
+
addListener(event: SprigEvent, listener: SprigListener): void;
|
|
2992
|
+
/**
|
|
2993
|
+
* Remove a listener for an event defined in ulEvents
|
|
2994
|
+
*/
|
|
2995
|
+
removeListener(event: SprigEvent, listener: SprigListener): void;
|
|
2996
|
+
/**
|
|
2997
|
+
* Remove all listeners set on Sprig
|
|
2998
|
+
*/
|
|
2999
|
+
removeAllListeners(): void;
|
|
3000
|
+
/**
|
|
3001
|
+
* Attach an email address to visitor
|
|
3002
|
+
*/
|
|
3003
|
+
setEmail(email: string): void;
|
|
3004
|
+
/**
|
|
3005
|
+
* Attach a user id to the visitor
|
|
3006
|
+
*/
|
|
3007
|
+
setUserId(userId: string): void;
|
|
3008
|
+
/**
|
|
3009
|
+
* Set a partner anonymous id for future requests.
|
|
3010
|
+
*/
|
|
3011
|
+
setPartnerAnonymousId(partnerAnonymousId: string): void;
|
|
3012
|
+
/**
|
|
3013
|
+
* Track an event to show survey if eligible
|
|
3014
|
+
* @param eventName name of event to track
|
|
3015
|
+
*/
|
|
3016
|
+
track(eventName: string, properties?: Record<string, unknown>, metadata?: SprigMetadata): void;
|
|
3017
|
+
/**
|
|
3018
|
+
* Optionally set userId and/or anonymousId, track an event to show survey if eligible
|
|
3019
|
+
*/
|
|
3020
|
+
identifyAndTrack(payload: {
|
|
3021
|
+
anonymousId?: string;
|
|
3022
|
+
eventName: string;
|
|
3023
|
+
metadata?: SprigMetadata;
|
|
3024
|
+
userId?: string;
|
|
3025
|
+
}): void;
|
|
3026
|
+
/**
|
|
3027
|
+
* Tracks a page view with the provided URL and additional event properties.
|
|
3028
|
+
*/
|
|
3029
|
+
trackPageView(url: string, props?: SprigProperties, showSurveyCallback?: (surveyId?: number) => Promise<boolean>): void;
|
|
3030
|
+
/**
|
|
3031
|
+
* Apply a css string representing the customized styles
|
|
3032
|
+
*/
|
|
3033
|
+
applyStyles(styleString: string): void;
|
|
3034
|
+
/**
|
|
3035
|
+
Set viewport dimensions, in int pixels. necessary if Sprig is installed in an iframe/component defaulting to 0 width and height.
|
|
3036
|
+
*/
|
|
3037
|
+
setWindowDimensions(width: number | string, height: number | string): void;
|
|
3038
|
+
/**
|
|
3039
|
+
* Logs out current visitor and associated ids
|
|
3040
|
+
*/
|
|
3041
|
+
logoutUser(): void;
|
|
3042
|
+
/**
|
|
3043
|
+
* Clears Sprig from window
|
|
3044
|
+
*/
|
|
3045
|
+
teardown(): void;
|
|
3046
|
+
}
|
|
3047
|
+
type NpmConfig = {
|
|
3048
|
+
envId?: string;
|
|
3049
|
+
environmentId?: string;
|
|
3050
|
+
path?: string;
|
|
3051
|
+
} & Partial<WindowSprig$1>;
|
|
3052
|
+
declare const sprig: {
|
|
3053
|
+
/**
|
|
3054
|
+
* Sets up the sprig api and load the sprig sdk on document load
|
|
3055
|
+
* @param config
|
|
3056
|
+
* @returns an instance of the sprig api
|
|
3057
|
+
*/
|
|
3058
|
+
configure: (config: NpmConfig) => sprigConfig.WindowSprig;
|
|
3059
|
+
};
|
|
3060
|
+
type WindowSprig$1 = typeof window.Sprig;
|
|
3061
|
+
|
|
3062
|
+
export { DismissReason, SprigAPI, SprigEvent, WindowSprig$1 as WindowSprig, sprig };
|