@sprig-technologies/sprig-bundled 2.24.7 → 2.35.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 CHANGED
@@ -1,1485 +1,637 @@
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 {
1
+ declare type attributes = {
2
+ [key: string]: string | number | true | null;
3
+ };
4
+
5
+ declare type cdataNode = {
6
+ type: NodeType.CDATA;
7
+ textContent: '';
8
+ };
9
+
10
+ declare type commentNode = {
11
+ type: NodeType.Comment;
12
+ textContent: string;
13
+ };
14
+
15
+ declare type DataURLOptions = Partial<{
16
+ type: string;
17
+ quality: number;
18
+ }>;
19
+
20
+ declare type documentNode = {
21
+ type: NodeType.Document;
22
+ childNodes: serializedNodeWithId[];
23
+ compatMode?: string;
24
+ };
25
+
26
+ declare type documentTypeNode = {
27
+ type: NodeType.DocumentType;
28
+ name: string;
29
+ publicId: string;
30
+ systemId: string;
31
+ };
32
+
33
+ declare type elementNode = {
34
+ type: NodeType.Element;
567
35
  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;
36
+ attributes: attributes;
37
+ childNodes: serializedNodeWithId[];
38
+ isSVG?: true;
39
+ needBlock?: boolean;
40
+ isCustom?: true;
41
+ };
42
+
43
+ declare interface IMirror<TNode> {
44
+ getId(n: TNode | undefined | null): number;
45
+ getNode(id: number): TNode | null;
46
+ getIds(): number[];
47
+ getMeta(n: TNode): serializedNodeWithId | null;
48
+ removeNodeFromMap(n: TNode): void;
49
+ has(id: number): boolean;
50
+ hasNode(node: TNode): boolean;
51
+ add(n: TNode, meta: serializedNodeWithId): void;
52
+ replace(id: number, n: TNode): void;
53
+ reset(): void;
599
54
  }
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;
55
+
56
+ declare type MaskInputFn = (text: string, element: HTMLElement) => string;
57
+
58
+ declare type MaskInputOptions = Partial<{
59
+ color: boolean;
60
+ date: boolean;
61
+ 'datetime-local': boolean;
62
+ email: boolean;
63
+ month: boolean;
64
+ number: boolean;
65
+ range: boolean;
66
+ search: boolean;
67
+ tel: boolean;
68
+ text: boolean;
69
+ time: boolean;
70
+ url: boolean;
71
+ week: boolean;
72
+ textarea: boolean;
73
+ select: boolean;
74
+ password: boolean;
75
+ }>;
76
+
77
+ declare type MaskTextFn = (text: string, element: HTMLElement | null) => string;
78
+
79
+ declare class Mirror implements IMirror<Node> {
80
+ private idNodeMap;
81
+ private nodeMetaMap;
82
+ getId(n: Node | undefined | null): number;
83
+ getNode(id: number): Node | null;
84
+ getIds(): number[];
85
+ getMeta(n: Node): serializedNodeWithId | null;
86
+ removeNodeFromMap(n: Node): void;
87
+ has(id: number): boolean;
88
+ hasNode(node: Node): boolean;
89
+ add(n: Node, meta: serializedNodeWithId): void;
90
+ replace(id: number, n: Node): void;
91
+ reset(): void;
621
92
  }
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;
93
+
94
+ declare enum NodeType {
95
+ Document = 0,
96
+ DocumentType = 1,
97
+ Element = 2,
98
+ Text = 3,
99
+ CDATA = 4,
100
+ Comment = 5
628
101
  }
629
- type CSSStyleDeclaration = Record<string, string> & {
630
- setProperty: (name: string, value: string | null, priority?: string | null) => void;
631
- removeProperty: (name: string) => string;
102
+
103
+ declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
104
+ rootId?: number;
105
+ isShadowHost?: boolean;
106
+ isShadow?: boolean;
107
+ };
108
+
109
+ declare type serializedNodeWithId = serializedNode & {
110
+ id: number;
111
+ };
112
+
113
+ declare type SlimDOMOptions = Partial<{
114
+ script: boolean;
115
+ comment: boolean;
116
+ headFavicon: boolean;
117
+ headWhitespace: boolean;
118
+ headMetaDescKeywords: boolean;
119
+ headMetaSocial: boolean;
120
+ headMetaRobots: boolean;
121
+ headMetaHttpEquiv: boolean;
122
+ headMetaAuthorship: boolean;
123
+ headMetaVerification: boolean;
124
+ headTitleMutations: boolean;
125
+ }>;
126
+
127
+ declare type textNode = {
128
+ type: NodeType.Text;
129
+ textContent: string;
130
+ isStyle?: true;
632
131
  };
633
132
 
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;
133
+ declare type addedNodeMutation = {
134
+ parentId: number;
135
+ previousId?: number | null;
136
+ nextId: number | null;
137
+ node: serializedNodeWithId;
138
+ };
139
+
140
+ declare type adoptedStyleSheetData = {
141
+ source: IncrementalSource.AdoptedStyleSheet;
142
+ } & adoptedStyleSheetParam;
143
+
144
+ declare type adoptedStyleSheetParam = {
145
+ id: number;
146
+ styles?: {
147
+ styleId: number;
148
+ rules: styleSheetAddRule[];
149
+ }[];
150
+ styleIds: number[];
151
+ };
152
+
153
+ declare type attributeMutation = {
154
+ id: number;
155
+ attributes: {
156
+ [key: string]: string | styleOMValue | null;
671
157
  };
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;
158
+ };
159
+
160
+ declare type blockClass = string | RegExp;
161
+
162
+ declare enum CanvasContext {
163
+ '2D' = 0,
164
+ WebGL = 1,
165
+ WebGL2 = 2
775
166
  }
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;
167
+
168
+ declare type canvasMutationCallback = (p: canvasMutationParam) => void;
169
+
170
+ declare type canvasMutationCommand = {
171
+ property: string;
172
+ args: Array<unknown>;
173
+ setter?: true;
174
+ };
175
+
176
+ declare type canvasMutationData = {
177
+ source: IncrementalSource.CanvasMutation;
178
+ } & canvasMutationParam;
179
+
180
+ declare type canvasMutationParam = {
181
+ id: number;
182
+ type: CanvasContext;
183
+ commands: canvasMutationCommand[];
184
+ } | ({
185
+ id: number;
186
+ type: CanvasContext;
187
+ } & canvasMutationCommand);
188
+
189
+ declare type customElementCallback = (c: customElementParam) => void;
190
+
191
+ declare type customElementData = {
192
+ source: IncrementalSource.CustomElement;
193
+ } & customElementParam;
194
+
195
+ declare type customElementParam = {
196
+ define?: {
197
+ name: string;
812
198
  };
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;
199
+ };
200
+
201
+ declare type customEvent<T = unknown> = {
202
+ type: EventType.Custom;
203
+ data: {
204
+ tag: string;
205
+ payload: T;
861
206
  };
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;
207
+ };
208
+
209
+ declare type domContentLoadedEvent = {
210
+ type: EventType.DomContentLoaded;
211
+ data: unknown;
212
+ };
213
+
214
+ declare enum EventType {
215
+ DomContentLoaded = 0,
216
+ Load = 1,
217
+ FullSnapshot = 2,
218
+ IncrementalSnapshot = 3,
219
+ Meta = 4,
220
+ Custom = 5,
221
+ Plugin = 6
872
222
  }
873
- declare class RRStyleElement extends RRElement {
874
- rules: (styleSheetRuleData | styleDeclarationData)[];
223
+
224
+ declare type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
225
+
226
+ declare type eventWithTime = eventWithoutTime & {
227
+ timestamp: number;
228
+ delay?: number;
229
+ };
230
+
231
+ declare type fontCallback = (p: fontParam) => void;
232
+
233
+ declare type fontData = {
234
+ source: IncrementalSource.Font;
235
+ } & fontParam;
236
+
237
+ declare type fontParam = {
238
+ family: string;
239
+ fontSource: string;
240
+ buffer: boolean;
241
+ descriptors?: FontFaceDescriptors;
242
+ };
243
+
244
+ declare type fullSnapshotEvent = {
245
+ type: EventType.FullSnapshot;
246
+ data: {
247
+ node: serializedNodeWithId;
248
+ initialOffset: {
249
+ top: number;
250
+ left: number;
251
+ };
252
+ };
253
+ };
254
+
255
+ declare type hooksParam = {
256
+ mutation?: mutationCallBack;
257
+ mousemove?: mousemoveCallBack;
258
+ mouseInteraction?: mouseInteractionCallBack;
259
+ scroll?: scrollCallback;
260
+ viewportResize?: viewportResizeCallback;
261
+ input?: inputCallback;
262
+ mediaInteaction?: mediaInteractionCallback;
263
+ styleSheetRule?: styleSheetRuleCallback;
264
+ styleDeclaration?: styleDeclarationCallback;
265
+ canvasMutation?: canvasMutationCallback;
266
+ font?: fontCallback;
267
+ selection?: selectionCallback;
268
+ customElement?: customElementCallback;
269
+ };
270
+
271
+ declare interface ICrossOriginIframeMirror {
272
+ getId(iframe: HTMLIFrameElement, remoteId: number, parentToRemoteMap?: Map<number, number>, remoteToParentMap?: Map<number, number>): number;
273
+ getIds(iframe: HTMLIFrameElement, remoteId: number[]): number[];
274
+ getRemoteId(iframe: HTMLIFrameElement, parentId: number, map?: Map<number, number>): number;
275
+ getRemoteIds(iframe: HTMLIFrameElement, parentId: number[]): number[];
276
+ reset(iframe?: HTMLIFrameElement): void;
875
277
  }
876
- declare class RRIFrameElement extends RRElement {
877
- contentDocument: RRDocument;
878
- constructor(upperTagName: string, mirror: Mirror);
278
+
279
+ declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
280
+
281
+ declare type incrementalSnapshotEvent = {
282
+ type: EventType.IncrementalSnapshot;
283
+ data: incrementalData;
284
+ };
285
+
286
+ declare enum IncrementalSource {
287
+ Mutation = 0,
288
+ MouseMove = 1,
289
+ MouseInteraction = 2,
290
+ Scroll = 3,
291
+ ViewportResize = 4,
292
+ Input = 5,
293
+ TouchMove = 6,
294
+ MediaInteraction = 7,
295
+ StyleSheetRule = 8,
296
+ CanvasMutation = 9,
297
+ Font = 10,
298
+ Log = 11,
299
+ Drag = 12,
300
+ StyleDeclaration = 13,
301
+ Selection = 14,
302
+ AdoptedStyleSheet = 15,
303
+ CustomElement = 16
879
304
  }
880
- interface RRElementTagNameMap {
881
- audio: RRMediaElement;
882
- canvas: RRCanvasElement;
883
- iframe: RRIFrameElement;
884
- style: RRStyleElement;
885
- video: RRMediaElement;
305
+
306
+ declare type inputCallback = (v: inputValue & {
307
+ id: number;
308
+ }) => void;
309
+
310
+ declare type inputData = {
311
+ source: IncrementalSource.Input;
312
+ id: number;
313
+ } & inputValue;
314
+
315
+ declare type inputValue = {
316
+ text: string;
317
+ isChecked: boolean;
318
+ userTriggered?: boolean;
319
+ };
320
+
321
+ declare type IWindow = Window & typeof globalThis;
322
+
323
+ declare type KeepIframeSrcFn = (src: string) => boolean;
324
+
325
+ declare type listenerHandler = () => void;
326
+
327
+ declare type loadedEvent = {
328
+ type: EventType.Load;
329
+ data: unknown;
330
+ };
331
+
332
+ declare type maskTextClass = string | RegExp;
333
+
334
+ declare type mediaInteractionCallback = (p: mediaInteractionParam) => void;
335
+
336
+ declare type mediaInteractionData = {
337
+ source: IncrementalSource.MediaInteraction;
338
+ } & mediaInteractionParam;
339
+
340
+ declare type mediaInteractionParam = {
341
+ type: MediaInteractions;
342
+ id: number;
343
+ currentTime?: number;
344
+ volume?: number;
345
+ muted?: boolean;
346
+ loop?: boolean;
347
+ playbackRate?: number;
348
+ };
349
+
350
+ declare enum MediaInteractions {
351
+ Play = 0,
352
+ Pause = 1,
353
+ Seeked = 2,
354
+ VolumeChange = 3,
355
+ RateChange = 4
886
356
  }
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
357
+
358
+ declare type metaEvent = {
359
+ type: EventType.Meta;
360
+ data: {
361
+ href: string;
362
+ width: number;
363
+ height: number;
364
+ };
365
+ };
366
+
367
+ declare type mouseInteractionCallBack = (d: mouseInteractionParam) => void;
368
+
369
+ declare type mouseInteractionData = {
370
+ source: IncrementalSource.MouseInteraction;
371
+ } & mouseInteractionParam;
372
+
373
+ declare type mouseInteractionParam = {
374
+ type: MouseInteractions;
375
+ id: number;
376
+ x?: number;
377
+ y?: number;
378
+ pointerType?: PointerTypes;
379
+ };
380
+
381
+ declare enum MouseInteractions {
382
+ MouseUp = 0,
383
+ MouseDown = 1,
384
+ Click = 2,
385
+ ContextMenu = 3,
386
+ DblClick = 4,
387
+ Focus = 5,
388
+ Blur = 6,
389
+ TouchStart = 7,
390
+ TouchMove_Departed = 8,
391
+ TouchEnd = 9,
392
+ TouchCancel = 10
1051
393
  }
1052
- declare type SingleOrArray<T> = T[] | T;
1053
- interface EventObject {
1054
- type: string;
394
+
395
+ declare type mousemoveCallBack = (p: mousePosition[], source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag) => void;
396
+
397
+ declare type mousemoveData = {
398
+ source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
399
+ positions: mousePosition[];
400
+ };
401
+
402
+ declare type mousePosition = {
403
+ x: number;
404
+ y: number;
405
+ id: number;
406
+ timeOffset: number;
407
+ };
408
+
409
+ declare type mutationCallBack = (m: mutationCallbackParam) => void;
410
+
411
+ declare type mutationCallbackParam = {
412
+ texts: textMutation[];
413
+ attributes: attributeMutation[];
414
+ removes: removedNodeMutation[];
415
+ adds: addedNodeMutation[];
416
+ isAttachIframe?: true;
417
+ };
418
+
419
+ declare type mutationData = {
420
+ source: IncrementalSource.Mutation;
421
+ } & mutationCallbackParam;
422
+
423
+ declare type PackFn = (event: eventWithTime) => string;
424
+
425
+ declare type pluginEvent<T = unknown> = {
426
+ type: EventType.Plugin;
427
+ data: {
428
+ plugin: string;
429
+ payload: T;
430
+ };
431
+ };
432
+
433
+ declare enum PointerTypes {
434
+ Mouse = 0,
435
+ Pen = 1,
436
+ Touch = 2
1055
437
  }
1056
- declare type InitEvent = {
1057
- type: 'xstate.init';
438
+
439
+ declare type RecordPlugin<TOptions = unknown> = {
440
+ name: string;
441
+ observer?: (cb: (...args: Array<unknown>) => void, win: IWindow, options: TOptions) => listenerHandler;
442
+ eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;
443
+ getMirror?: (mirrors: {
444
+ nodeMirror: Mirror;
445
+ crossOriginIframeMirror: ICrossOriginIframeMirror;
446
+ crossOriginIframeStyleMirror: ICrossOriginIframeMirror;
447
+ }) => void;
448
+ options: TOptions;
449
+ };
450
+
451
+ declare type removedNodeMutation = {
452
+ parentId: number;
453
+ id: number;
454
+ isShadow?: boolean;
455
+ };
456
+
457
+ declare type SamplingStrategy = Partial<{
458
+ mousemove: boolean | number;
459
+ mousemoveCallback: number;
460
+ mouseInteraction: boolean | Record<string, boolean | undefined>;
461
+ scroll: number;
462
+ media: number;
463
+ input: 'all' | 'last';
464
+ canvas: 'all' | number;
465
+ }>;
466
+
467
+ declare type scrollCallback = (p: scrollPosition) => void;
468
+
469
+ declare type scrollData = {
470
+ source: IncrementalSource.Scroll;
471
+ } & scrollPosition;
472
+
473
+ declare type scrollPosition = {
474
+ id: number;
475
+ x: number;
476
+ y: number;
477
+ };
478
+
479
+ declare type selectionCallback = (p: selectionParam) => void;
480
+
481
+ declare type selectionData = {
482
+ source: IncrementalSource.Selection;
483
+ } & selectionParam;
484
+
485
+ declare type selectionParam = {
486
+ ranges: Array<SelectionRange>;
487
+ };
488
+
489
+ declare type SelectionRange = {
490
+ start: number;
491
+ startOffset: number;
492
+ end: number;
493
+ endOffset: number;
1058
494
  };
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;
495
+
496
+ declare type styleDeclarationCallback = (s: styleDeclarationParam) => void;
497
+
498
+ declare type styleDeclarationData = {
499
+ source: IncrementalSource.StyleDeclaration;
500
+ } & styleDeclarationParam;
501
+
502
+ declare type styleDeclarationParam = {
503
+ id?: number;
504
+ styleId?: number;
505
+ index: number[];
506
+ set?: {
507
+ property: string;
508
+ value: string | null;
509
+ priority: string | undefined;
1077
510
  };
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];
511
+ remove?: {
512
+ property: string;
1134
513
  };
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>;
514
+ };
515
+
516
+ declare type styleOMValue = {
517
+ [key: string]: styleValueWithPriority | string | false;
518
+ };
519
+
520
+ declare type styleSheetAddRule = {
521
+ rule: string;
522
+ index?: number | number[];
523
+ };
524
+
525
+ declare type styleSheetDeleteRule = {
526
+ index: number | number[];
527
+ };
528
+
529
+ declare type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;
530
+
531
+ declare type styleSheetRuleData = {
532
+ source: IncrementalSource.StyleSheetRule;
533
+ } & styleSheetRuleParam;
534
+
535
+ declare type styleSheetRuleParam = {
536
+ id?: number;
537
+ styleId?: number;
538
+ removes?: styleSheetDeleteRule[];
539
+ adds?: styleSheetAddRule[];
540
+ replace?: string;
541
+ replaceSync?: string;
542
+ };
543
+
544
+ declare type styleValueWithPriority = [string, string];
545
+
546
+ declare type textMutation = {
547
+ id: number;
548
+ value: string | null;
549
+ };
550
+
551
+ declare type viewportResizeCallback = (d: viewportResizeDimension) => void;
552
+
553
+ declare type viewportResizeData = {
554
+ source: IncrementalSource.ViewportResize;
555
+ } & viewportResizeDimension;
556
+
557
+ declare type viewportResizeDimension = {
558
+ width: number;
559
+ height: number;
560
+ };
561
+
1214
562
 
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
563
 
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
564
  declare global {
1368
565
  interface Window {
1369
566
  FontFace: typeof FontFace;
1370
567
  }
1371
568
  }
1372
- type ErrorHandler = (error: unknown) => void | boolean;
1373
569
 
1374
- declare function record<T = eventWithTime>(options?: recordOptions<T>): listenerHandler | undefined;
570
+ declare type ErrorHandler = (error: unknown) => void | boolean;
571
+
572
+
573
+ declare type recordOptions<T> = {
574
+ emit?: (e: T, isCheckout?: boolean) => void;
575
+ checkoutEveryNth?: number;
576
+ checkoutEveryNms?: number;
577
+ blockClass?: blockClass;
578
+ blockSelector?: string;
579
+ ignoreClass?: string;
580
+ ignoreSelector?: string;
581
+ maskTextClass?: maskTextClass;
582
+ maskTextSelector?: string;
583
+ maskAllInputs?: boolean;
584
+ maskInputOptions?: MaskInputOptions;
585
+ maskInputFn?: MaskInputFn;
586
+ maskTextFn?: MaskTextFn;
587
+ slimDOMOptions?: SlimDOMOptions | 'all' | true;
588
+ ignoreCSSAttributes?: Set<string>;
589
+ inlineStylesheet?: boolean;
590
+ hooks?: hooksParam;
591
+ packFn?: PackFn;
592
+ sampling?: SamplingStrategy;
593
+ dataURLOptions?: DataURLOptions;
594
+ recordDOM?: boolean;
595
+ recordCanvas?: boolean;
596
+ recordCrossOriginIframes?: boolean;
597
+ recordAfter?: 'DOMContentLoaded' | 'load';
598
+ userTriggeredOnInput?: boolean;
599
+ collectFonts?: boolean;
600
+ inlineImages?: boolean;
601
+ plugins?: RecordPlugin[];
602
+ mousemoveWait?: number;
603
+ keepIframeSrcFn?: KeepIframeSrcFn;
604
+ errorHandler?: ErrorHandler;
605
+ };
606
+
607
+ declare function record<T = eventWithTime>(options?: recordOptions<T>): listenerHandler | undefined;
608
+
609
+ declare namespace record {
610
+ var addCustomEvent: <T>(tag: string, payload: T) => void;
611
+ var freezePage: () => void;
612
+ var takeFullSnapshot: (isCheckout?: boolean | undefined) => void;
613
+ var mirror: Mirror;
614
+ }
615
+
616
+
1375
617
  declare namespace record {
1376
618
  var addCustomEvent: <T>(tag: string, payload: T) => void;
1377
619
  var freezePage: () => void;
1378
620
  var takeFullSnapshot: (isCheckout?: boolean | undefined) => void;
1379
- var mirror: Mirror$1;
621
+ var mirror: Mirror;
1380
622
  }
1381
623
 
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
624
 
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;
625
+ declare global {
626
+ interface Window {
627
+ FontFace: typeof FontFace;
628
+ Array: typeof Array;
629
+ }
630
+ }
1436
631
 
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
- };
632
+ declare const _rrweb_record_record: typeof record;
633
+ declare namespace _rrweb_record {
634
+ export { _rrweb_record_record as record };
1483
635
  }
1484
636
 
1485
637
  interface XhrResponse {
@@ -1495,14 +647,6 @@ interface XhrHeaders {
1495
647
  [key: string]: string;
1496
648
  }
1497
649
 
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
650
  declare type ChunkedStreamIterableOptions = {
1507
651
  defaultChunkSize?: number;
1508
652
  minChunkSize?: number;
@@ -1608,27 +752,7 @@ declare class UpChunk {
1608
752
  */
1609
753
  private sendChunks;
1610
754
  }
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
- }
755
+ declare const createUpload: typeof UpChunk.createUpload;
1632
756
 
1633
757
  declare enum NOTIFICATION_TYPES {
1634
758
  ACTIVATE = "ACTIVATE:experiment, user_id,attributes, variation, event",
@@ -1876,106 +1000,8 @@ declare class Emitter<Events extends EventMap> {
1876
1000
  rawListeners<EventName extends keyof Events>(eventName: EventName): Array<Listener<Events[EventName]>>;
1877
1001
  }
1878
1002
 
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
- SDKReady = "sdk.ready",
1888
- SurveyAppeared = "survey.appeared",
1889
- SurveyClosed = "survey.closed",
1890
- SurveyDimensions = "survey.dimensions",
1891
- SurveyFadingOut = "survey.fadingOut",
1892
- SurveyHeight = "survey.height",
1893
- SurveyPresented = "survey.presented",
1894
- SurveyLifeCycle = "survey.lifeCycle",
1895
- SurveyWillClose = "survey.willClose",
1896
- SurveyWillPresent = "survey.will.present",
1897
- CloseSurveyOnOverlayClick = "close.survey.overlayClick",
1898
- VisitorIDUpdated = "visitor.id.updated",
1899
- QuestionAnswered = "question.answered"
1900
- }
1901
- declare enum SprigEventData {
1902
- SurveyId = "survey.id"
1903
- }
1904
- declare const EVENTS: {
1905
- SDK_READY: SprigEvent;
1906
- SURVEY_APPEARED: SprigEvent;
1907
- SURVEY_CLOSED: SprigEvent;
1908
- SURVEY_DIMENSIONS: SprigEvent;
1909
- SURVEY_FADING_OUT: SprigEvent;
1910
- SURVEY_HEIGHT: SprigEvent;
1911
- SURVEY_PRESENTED: SprigEvent;
1912
- SURVEY_LIFE_CYCLE: SprigEvent;
1913
- SURVEY_WILL_CLOSE: SprigEvent;
1914
- SURVEY_WILL_PRESENT: SprigEvent;
1915
- QUESTION_ANSWERED: SprigEvent;
1916
- CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
1917
- VISITOR_ID_UPDATED: SprigEvent;
1918
- DATA: {
1919
- DISMISS_REASONS: {
1920
- API: DismissReason;
1921
- CLOSED: DismissReason;
1922
- COMPLETE: DismissReason;
1923
- PAGE_CHANGE: DismissReason;
1924
- OVERRIDE: DismissReason;
1925
- };
1926
- SURVEY_ID: SprigEventData;
1927
- };
1928
- };
1929
- declare const enum InternalEventName {
1930
- VerifyViewVersion = "verify.view.version",
1931
- CurrentQuestion = "survey.question",
1932
- ViewPrototypeClick = "question.prototype.click",
1933
- ViewAgreementClick = "question.agreement.click",
1934
- RecordedTaskStart = "recorded.task.start",
1935
- RecordedTaskPermissionScreen = "recorded.task.permission.screen",
1936
- SurveyComplete = "survey.complete"
1937
- }
1938
- declare const enum InternalEventData {
1939
- ViewVersion = "view.version",
1940
- QuestionId = "qid",
1941
- Props = "props"
1942
- }
1943
-
1944
- declare const enum MediaType {
1945
- Video = "video",
1946
- Audio = "audio",
1947
- Screen = "screen"
1948
- }
1949
- declare const enum SprigRecordingEvent {
1950
- PermissionStatus = "permission.status",
1951
- AvPermission = "av.permission",
1952
- ScreenPermission = "screen.permission",
1953
- BeginRecording = "begin.recording",
1954
- StartTask = "start.task",
1955
- FinishTask = "finish.task"
1956
- }
1957
- declare const enum TaskStatus {
1958
- Abandoned = "abandoned",
1959
- GivenUp = "given.up",
1960
- Completed = "completed"
1961
- }
1962
- declare const enum SprigRecordingEventData {
1963
- ScreenPermissionRequested = "screen.permission.requested",
1964
- PermissionDescriptors = "permission.descriptors",
1965
- PermissionStatusCallback = "permission.status.callback",
1966
- StreamReadyCallback = "stream.ready.callback",
1967
- StreamCanceledCallback = "stream.canceled.callback",
1968
- TaskCompleteCallback = "task.complete.callback",
1969
- TaskResponse = "task.response",
1970
- TaskStatus = "task.status",
1971
- RecordingMediaTypes = "recording.media.types",
1972
- StartRecordingCallback = "start.recording.callback",
1973
- PassthroughData = "passthrough.data",
1974
- CurrentIndex = "current.index",
1975
- UploadCallback = "upload.callback",
1976
- ProgressCallback = "progress.callback",
1977
- BeginCallback = "begin.callback"
1978
- }
1003
+ type MediaType = "video" | "audio" | "screen";
1004
+ type TaskStatus = "abandoned" | "given.up" | "completed";
1979
1005
  interface PassthroughData {
1980
1006
  questionId: number;
1981
1007
  surveyId: number;
@@ -1983,82 +1009,30 @@ interface PassthroughData {
1983
1009
  responseGroupUid: UUID;
1984
1010
  }
1985
1011
 
1986
- interface Experiment {
1987
- id: string;
1988
- variation?: string;
1989
- }
1990
-
1991
- type QueueItem = [string, ...unknown[]] | (() => void);
1992
- declare class SprigQueue {
1993
- paused: boolean;
1994
- queue: QueueItem[];
1995
- ul: WindowSprig;
1996
- constructor(ul: WindowSprig, queue: QueueItem[]);
1997
- flush(queue: QueueItem[]): void;
1998
- isPaused(): boolean;
1999
- pause(): void;
2000
- unpause(): void;
2001
- push(action: QueueItem): void;
2002
- perform(func: () => void): void | Promise<unknown>;
2003
- /**
2004
- * Removes all queued items
2005
- */
2006
- empty(): void;
2007
- }
2008
-
2009
- declare enum SurveyState {
2010
- Ready = "ready",
2011
- NoSurvey = "no survey"
2012
- }
2013
-
2014
1012
  interface RecordedTaskResponseValueType {
2015
1013
  mediaRecordingUids?: string[] | null;
2016
1014
  taskDurationMillisecond?: number;
2017
1015
  taskStatus: TaskStatus;
2018
1016
  }
2019
- declare enum BooleanOperator {
2020
- And = 1,
2021
- Or = 2
2022
- }
1017
+ declare const BOOLEAN_OPERATOR: {
1018
+ readonly And: 1;
1019
+ readonly Or: 2;
1020
+ };
1021
+ type BooleanOperator = (typeof BOOLEAN_OPERATOR)[keyof typeof BOOLEAN_OPERATOR];
2023
1022
 
2024
- declare const enum CardType {
2025
- ConsentLegal = "consentlegal",
2026
- Likert = "likert",
2027
- MultipleChoice = "multiplechoice",
2028
- MultipleSelect = "multipleselect",
2029
- NPS = "nps",
2030
- Open = "open",
2031
- RecordedTask = "recordedtask",
2032
- TextUrlPrompt = "texturlprompt",
2033
- Thanks = "thanks",
2034
- Uploading = "uploading",
2035
- VideoVoice = "videovoice"
2036
- }
1023
+ type CardType = "consentlegal" | "likert" | "matrix" | "multiplechoice" | "multipleselect" | "nps" | "open" | "rankorder" | "recordedtask" | "texturlprompt" | "thanks" | "uploading" | "videovoice";
2037
1024
  type ConceptUrl = string | null;
2038
1025
  interface BaseCard {
2039
1026
  name: number;
2040
1027
  surveyId: number;
2041
1028
  updatedAt: string;
2042
1029
  value?: unknown;
1030
+ type: CardType;
1031
+ groupId?: number;
2043
1032
  }
2044
- declare const enum Comparator {
2045
- Answered = "answered",
2046
- Equal = "eq",
2047
- NotEqual = "neq",
2048
- Skipped = "skipped",
2049
- LessThan = "lt",
2050
- LessThanOrEqual = "lte",
2051
- GivenUp = "given_up",
2052
- GreaterThan = "gt",
2053
- GreaterThanOrEqual = "gte",
2054
- ListAll = "list_all",
2055
- ListAtLeastOne = "list_alo",
2056
- ListExact = "list_exact",
2057
- DoesNotInclude = "list_dni",
2058
- Contains = "contains",
2059
- DoesNotContain = "notcontains"
2060
- }
2061
- type DefaultComparator = Comparator.Answered | Comparator.Skipped;
1033
+ type Comparator = "answered" | "contains" | "notcontains" | "list_dni" | "eq" | "given_up" | "gt" | "gte" | "lt" | "lte" | "list_all" | "list_alo" | "list_exact" | "neq" | "partial" | "skipped";
1034
+ type Randomize = "none" | "all";
1035
+ type DefaultComparator = Extract<Comparator, "answered" | "skipped">;
2062
1036
  type RoutingOption<C extends Comparator = DefaultComparator> = OldRoutingOption<C> | GroupRoutingOption;
2063
1037
  type OldRoutingOption<C extends Comparator = DefaultComparator> = {
2064
1038
  comparator: C;
@@ -2080,10 +1054,12 @@ type RoutingGroupOption = {
2080
1054
  type RoutingOptions<C extends Comparator = DefaultComparator> = RoutingOption<C | DefaultComparator>[] | null;
2081
1055
  /** @example <p>Body</p> */
2082
1056
  type RichTextBody = string;
2083
- declare const enum PromptActionType {
2084
- Continue = "CONTINUE",
2085
- External = "EXTERNAL"
1057
+ declare enum PromptActionTypeEnum {
1058
+ CONTINUE = "CONTINUE",
1059
+ EXTERNAL = "EXTERNAL",
1060
+ NO_BUTTON = "NO_BUTTON"
2086
1061
  }
1062
+ type PromptActionType = keyof typeof PromptActionTypeEnum;
2087
1063
  interface TextUrlPromptCard extends BaseCard {
2088
1064
  props: {
2089
1065
  message: string;
@@ -2097,16 +1073,13 @@ interface TextUrlPromptCard extends BaseCard {
2097
1073
  promptActionType: PromptActionType;
2098
1074
  required: boolean;
2099
1075
  richTextBody: RichTextBody;
1076
+ questionHtml?: string;
2100
1077
  };
2101
1078
  routingOptions: RoutingOptions;
2102
1079
  };
2103
- type: CardType.TextUrlPrompt;
2104
- }
2105
- declare const enum AvPermission {
2106
- Camera = "camera",
2107
- Microphone = "microphone",
2108
- Screen = "screen"
1080
+ type: "texturlprompt";
2109
1081
  }
1082
+ type AvPermission = "camera" | "microphone" | "screen";
2110
1083
  interface ConsentLegalCard extends BaseCard {
2111
1084
  props: {
2112
1085
  message: string;
@@ -2126,21 +1099,18 @@ interface ConsentLegalCard extends BaseCard {
2126
1099
  richTextBody: RichTextBody;
2127
1100
  skipButtonText: string;
2128
1101
  submitButtonText: string;
1102
+ questionHtml?: string;
2129
1103
  };
2130
1104
  routingOptions: RoutingOptions;
2131
1105
  };
2132
- type: CardType.ConsentLegal;
1106
+ type: "consentlegal";
2133
1107
  }
2134
1108
  interface BaseTaskPage {
2135
1109
  buttonText: string;
2136
1110
  headline: string;
1111
+ type: RecordedTaskPageType;
2137
1112
  }
2138
- declare const enum RecordedTaskPageType {
2139
- AvPermission = "av_permission",
2140
- ScreenPermission = "screen_permission",
2141
- StartTask = "start_task",
2142
- CompleteTask = "complete_task"
2143
- }
1113
+ type RecordedTaskPageType = "av_permission" | "screen_permission" | "start_task" | "complete_task";
2144
1114
  interface PermissionTaskPage extends BaseTaskPage {
2145
1115
  captionText: string;
2146
1116
  headline: string;
@@ -2152,7 +1122,7 @@ interface PermissionTaskPage extends BaseTaskPage {
2152
1122
  skipButtonText?: string;
2153
1123
  svg: string;
2154
1124
  tryAgainButtonText: string;
2155
- type: RecordedTaskPageType.AvPermission;
1125
+ type: "av_permission";
2156
1126
  }
2157
1127
  interface ScreenTaskPage extends BaseTaskPage {
2158
1128
  captionText: string;
@@ -2160,19 +1130,19 @@ interface ScreenTaskPage extends BaseTaskPage {
2160
1130
  permissionDeniedHeadline: string;
2161
1131
  selectTabText: string;
2162
1132
  skipButtonText: string;
2163
- type: RecordedTaskPageType.ScreenPermission;
1133
+ type: "screen_permission";
2164
1134
  }
2165
1135
  interface StartTaskPage extends BaseTaskPage {
2166
1136
  captionText?: string;
2167
1137
  skipButtonText: string;
2168
1138
  taskDetail: string;
2169
- type: RecordedTaskPageType.StartTask;
1139
+ type: "start_task";
2170
1140
  }
2171
1141
  interface CompleteTaskPage extends BaseTaskPage {
2172
1142
  captionText?: string;
2173
1143
  skipButtonText: string;
2174
1144
  taskDetail: string;
2175
- type: RecordedTaskPageType.CompleteTask;
1145
+ type: "complete_task";
2176
1146
  }
2177
1147
  type RecordedTaskPage = PermissionTaskPage | ScreenTaskPage | StartTaskPage | CompleteTaskPage;
2178
1148
  interface RecordedTaskCardProperties {
@@ -2188,9 +1158,9 @@ interface RecordedTaskCard extends BaseCard {
2188
1158
  message: string;
2189
1159
  options: [];
2190
1160
  properties: RecordedTaskCardProperties;
2191
- routingOptions: RoutingOptions<Comparator.GivenUp>;
1161
+ routingOptions: RoutingOptions<"given_up">;
2192
1162
  };
2193
- type: CardType.RecordedTask;
1163
+ type: "recordedtask";
2194
1164
  }
2195
1165
  interface Labels {
2196
1166
  left: string;
@@ -2200,11 +1170,7 @@ interface RatingIcon {
2200
1170
  idx?: number;
2201
1171
  svg: string;
2202
1172
  }
2203
- declare enum ScaleLabelType {
2204
- Number = "number",
2205
- Smiley = "smiley",
2206
- Star = "star"
2207
- }
1173
+ type ScaleLabelType = "number" | "smiley" | "star";
2208
1174
  interface LikertCard extends BaseCard {
2209
1175
  props: {
2210
1176
  labels: Labels;
@@ -2220,9 +1186,9 @@ interface LikertCard extends BaseCard {
2220
1186
  scaleLabelType: ScaleLabelType;
2221
1187
  required: boolean;
2222
1188
  };
2223
- routingOptions: RoutingOptions<Comparator.Equal | Comparator.GivenUp | Comparator.GreaterThan | Comparator.GreaterThanOrEqual | Comparator.LessThan | Comparator.LessThanOrEqual | Comparator.NotEqual>;
1189
+ routingOptions: RoutingOptions<"eq" | "given_up" | "gt" | "gte" | "lt" | "lte" | "neq">;
2224
1190
  };
2225
- type: CardType.Likert;
1191
+ type: "likert";
2226
1192
  }
2227
1193
  interface OpenTextCard extends BaseCard {
2228
1194
  props: {
@@ -2233,14 +1199,15 @@ interface OpenTextCard extends BaseCard {
2233
1199
  buttonText?: string;
2234
1200
  captionText?: string;
2235
1201
  conceptUrl: ConceptUrl;
1202
+ footerHtml?: string;
2236
1203
  openTextPlaceholder?: string;
2237
1204
  required: boolean;
2238
1205
  richTextBody: RichTextBody;
2239
1206
  skipButtonText?: string;
2240
1207
  };
2241
- routingOptions: RoutingOptions<Comparator.Contains | Comparator.DoesNotContain>;
1208
+ routingOptions: RoutingOptions<"contains" | "notcontains">;
2242
1209
  };
2243
- type: CardType.Open;
1210
+ type: "open";
2244
1211
  }
2245
1212
  interface MultipleChoiceOption {
2246
1213
  createdAt: string;
@@ -2248,7 +1215,9 @@ interface MultipleChoiceOption {
2248
1215
  id: number;
2249
1216
  label: string;
2250
1217
  optionProperties: null | {
2251
- allowsTextEntry: boolean;
1218
+ allowsTextEntry?: boolean;
1219
+ noneOfTheAbove?: boolean;
1220
+ isPinned?: boolean;
2252
1221
  };
2253
1222
  order: number;
2254
1223
  productId: number;
@@ -2264,7 +1233,16 @@ interface CommonMultipleChoiceProps {
2264
1233
  buttonText?: string;
2265
1234
  captionText: string;
2266
1235
  conceptUrl: ConceptUrl;
2267
- randomize: "none" | "keeplast" | "all";
1236
+ isDropdown?: boolean;
1237
+ /**
1238
+ * Placeholder text on the dropdown button when no items are selected
1239
+ */
1240
+ dropdownPlaceholderText?: string;
1241
+ /**
1242
+ * Text when multiple items are selected, such as "2 items selected" / "3 items selected"
1243
+ */
1244
+ dropdownMultiselectedText?: string;
1245
+ randomize: Randomize;
2268
1246
  required: boolean;
2269
1247
  };
2270
1248
  }
@@ -2273,33 +1251,76 @@ interface MultiChoiceCard<C extends Comparator = DefaultComparator> extends Base
2273
1251
  routingOptions: RoutingOptions<C>;
2274
1252
  };
2275
1253
  }
2276
- interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<Comparator.Equal | Comparator.NotEqual | Comparator.ListAtLeastOne | Comparator.DoesNotInclude> {
2277
- type: CardType.MultipleChoice;
1254
+ interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<"eq" | "neq" | "list_alo" | "list_dni"> {
1255
+ type: "multiplechoice";
2278
1256
  }
2279
- interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<Comparator.ListAll | Comparator.ListAtLeastOne | Comparator.ListExact | Comparator.DoesNotInclude> {
2280
- type: CardType.MultipleSelect;
1257
+ interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<"list_all" | "list_alo" | "list_exact" | "list_dni"> {
1258
+ type: "multipleselect";
2281
1259
  }
2282
- interface NPSCard extends BaseCard {
1260
+ interface MatrixCard extends BaseCard {
2283
1261
  props: {
2284
- labels: {
2285
- left: string;
2286
- right: string;
1262
+ options: MultipleChoiceOption[];
1263
+ message: string;
1264
+ routingOptions: RoutingOptions<"skipped" | "partial" | "answered">;
1265
+ properties: {
1266
+ buttonText?: string;
1267
+ captionText: string;
1268
+ conceptUrl: ConceptUrl;
1269
+ displayMatrixAsAccordion?: boolean;
1270
+ matrixColumn: {
1271
+ label: string;
1272
+ value: string;
1273
+ }[];
1274
+ randomize: Randomize;
1275
+ required: boolean;
2287
1276
  };
1277
+ };
1278
+ type: "matrix";
1279
+ }
1280
+ interface NPSCard extends BaseCard {
1281
+ props: {
1282
+ labels: Labels;
2288
1283
  message: string;
2289
1284
  options: [];
2290
1285
  properties: {
2291
1286
  buttonText?: string;
2292
1287
  captionText: string;
2293
1288
  conceptUrl: null;
2294
- labels: {
2295
- left: string;
2296
- right: string;
2297
- };
1289
+ labels: Labels;
1290
+ required: boolean;
1291
+ };
1292
+ routingOptions: RoutingOptions<"eq" | "gt" | "gte" | "lt" | "lte" | "neq">;
1293
+ };
1294
+ type: "nps";
1295
+ }
1296
+ interface RankOrderOption {
1297
+ createdAt: string;
1298
+ deletedAt: null;
1299
+ id: number;
1300
+ label: string;
1301
+ order: number;
1302
+ productId: number;
1303
+ surveyId: number;
1304
+ surveyQuestionId: number;
1305
+ updatedAt: string;
1306
+ value: string;
1307
+ }
1308
+ interface RankOderType extends BaseCard {
1309
+ props: {
1310
+ labels: Labels;
1311
+ message: string;
1312
+ options: RankOrderOption[];
1313
+ properties: {
1314
+ captionText: string;
1315
+ buttonText?: string;
1316
+ conceptUrl: ConceptUrl;
1317
+ labels: Labels;
2298
1318
  required: boolean;
1319
+ randomize: Randomize;
2299
1320
  };
2300
- routingOptions: RoutingOptions<Comparator.Equal | Comparator.GreaterThan | Comparator.GreaterThanOrEqual | Comparator.LessThan | Comparator.LessThanOrEqual | Comparator.NotEqual>;
1321
+ routingOptions: RoutingOptions<"eq" | "gt" | "gte" | "lt" | "lte" | "neq">;
2301
1322
  };
2302
- type: CardType.NPS;
1323
+ type: "rankorder";
2303
1324
  }
2304
1325
  interface VideoVoiceCard extends BaseCard {
2305
1326
  props: {
@@ -2309,6 +1330,7 @@ interface VideoVoiceCard extends BaseCard {
2309
1330
  buttonText: string;
2310
1331
  captionText: string;
2311
1332
  conceptUrl: null;
1333
+ hideRecordedPrompt?: boolean;
2312
1334
  mediaType: "video" | "audio";
2313
1335
  required: boolean;
2314
1336
  skipButtonText: string;
@@ -2317,9 +1339,95 @@ interface VideoVoiceCard extends BaseCard {
2317
1339
  };
2318
1340
  routingOptions: RoutingOptions;
2319
1341
  };
2320
- type: CardType.VideoVoice;
1342
+ type: "videovoice";
1343
+ }
1344
+ type Card = TextUrlPromptCard | ConsentLegalCard | RecordedTaskCard | LikertCard | OpenTextCard | MatrixCard | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | RankOderType | VideoVoiceCard;
1345
+
1346
+ type InteractiveMatchType = "exactly" | "legacy";
1347
+ type PageUrlMatchType = "contains" | "exactly" | "legacy" | "notContains" | "regex" | "startsWith";
1348
+ interface InteractiveEvent {
1349
+ id: number;
1350
+ matchType: InteractiveMatchType;
1351
+ name: string;
1352
+ pattern: string;
1353
+ properties: {
1354
+ innerText: string;
1355
+ selector?: string;
1356
+ type?: "click";
1357
+ };
1358
+ }
1359
+ interface PageUrlEvent {
1360
+ id: number;
1361
+ matchType: PageUrlMatchType;
1362
+ pattern: string;
1363
+ }
1364
+
1365
+ declare enum DismissReason {
1366
+ Closed = "close.click",// user clicked the close button
1367
+ Complete = "survey.completed",// user answered all questions
1368
+ FeedbackClosed = "feedback.closed",// user either clicked on feedback button or close button
1369
+ PageChange = "page.change",// productConfig.dismissOnPageChange == true and we detected a page change (excludes hash/query param changes)
1370
+ API = "api",// JS called Sprig('dismissActiveSurvey')
1371
+ Override = "override"
1372
+ }
1373
+ type StudyType = "feedbackButton" | "inProductSurvey" | "longFormSurvey";
1374
+ declare enum SprigEvent {
1375
+ ReplayCapture = "replay.capture",
1376
+ ReplayPaused = "replay.paused",
1377
+ ReplayResumed = "replay.resumed",
1378
+ FeedbackButtonLoaded = "feedback.button.loaded",
1379
+ SDKReady = "sdk.ready",
1380
+ SurveyAppeared = "survey.appeared",
1381
+ SurveyCloseRequested = "survey.closeRequested",//This event signals to mobile the survey overlay can close
1382
+ SurveyClosed = "survey.closed",
1383
+ SurveyDimensions = "survey.dimensions",
1384
+ SurveyFadingOut = "survey.fadingOut",
1385
+ SurveyHeight = "survey.height",
1386
+ SurveyPresented = "survey.presented",
1387
+ SurveyLifeCycle = "survey.lifeCycle",
1388
+ SurveyWidth = "survey.width",
1389
+ SurveyWillClose = "survey.willClose",
1390
+ SurveyWillPresent = "survey.will.present",
1391
+ CloseSurveyOnOverlayClick = "close.survey.overlayClick",
1392
+ VisitorIDUpdated = "visitor.id.updated",
1393
+ QuestionAnswered = "question.answered"
1394
+ }
1395
+ declare const EVENTS: {
1396
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
1397
+ SDK_READY: SprigEvent;
1398
+ SURVEY_APPEARED: SprigEvent;
1399
+ SURVEY_CLOSED: SprigEvent;
1400
+ SURVEY_DIMENSIONS: SprigEvent;
1401
+ SURVEY_FADING_OUT: SprigEvent;
1402
+ SURVEY_HEIGHT: SprigEvent;
1403
+ SURVEY_WIDTH: SprigEvent;
1404
+ SURVEY_PRESENTED: SprigEvent;
1405
+ SURVEY_LIFE_CYCLE: SprigEvent;
1406
+ SURVEY_WILL_CLOSE: SprigEvent;
1407
+ SURVEY_WILL_PRESENT: SprigEvent;
1408
+ QUESTION_ANSWERED: SprigEvent;
1409
+ REPLAY_CAPTURE: SprigEvent;
1410
+ CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
1411
+ VISITOR_ID_UPDATED: SprigEvent;
1412
+ DATA: {
1413
+ DISMISS_REASONS: {
1414
+ API: DismissReason;
1415
+ CLOSED: DismissReason;
1416
+ COMPLETE: DismissReason;
1417
+ PAGE_CHANGE: DismissReason;
1418
+ OVERRIDE: DismissReason;
1419
+ };
1420
+ SURVEY_ID: string;
1421
+ };
1422
+ };
1423
+
1424
+ type Metric = "sdk_event_queue_latency_seconds" | "sdk_replay_add_event_batch_seconds" | "sdk_replay_cleanup_seconds" | "sdk_replay_compression_seconds" | "sdk_replay_get_events_between_seconds" | "sdk_replay_snapshot_seconds" | "sdk_mutations_nodes_added" | "sdk_mutations_nodes_removed" | "sdk_mutations_attributes_changed" | "sdk_mutations_character_data" | "sdk_dom_nodes_count" | "sdk_page_html_characters";
1425
+ type ThresholdType = "max" | "min";
1426
+ interface MetricThreshold {
1427
+ metric: Metric;
1428
+ type: ThresholdType;
1429
+ value: number;
2321
1430
  }
2322
- type Card = TextUrlPromptCard | ConsentLegalCard | RecordedTaskCard | LikertCard | OpenTextCard | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | VideoVoiceCard;
2323
1431
 
2324
1432
  interface RecordedTaskResponseType {
2325
1433
  questionId: number;
@@ -2327,35 +1435,63 @@ interface RecordedTaskResponseType {
2327
1435
  value: RecordedTaskResponseValueType;
2328
1436
  }
2329
1437
 
1438
+ type SurveyState = "ready" | "no survey";
1439
+ type ReplayDurationType = "after" | "before" | "beforeAndAfter";
1440
+
1441
+ interface MobileReplayConfig {
1442
+ mobileMetricsReportingEnabled?: boolean;
1443
+ metricsReportingInterval?: number;
1444
+ metricsThresholds?: MetricThreshold[];
1445
+ maxMobileReplayDurationSeconds?: number;
1446
+ mobileReplaySettings?: {
1447
+ hideAllFormContents: boolean;
1448
+ hidePasswordsOnly: boolean;
1449
+ hideAllImages: boolean;
1450
+ };
1451
+ }
2330
1452
  type SprigEventMap = {
2331
- [InternalEventName.CurrentQuestion]: [
1453
+ "survey.question": [
2332
1454
  {
2333
- [InternalEventData.QuestionId]: number;
2334
- [InternalEventData.Props]: unknown;
1455
+ qid: number;
1456
+ props: unknown;
2335
1457
  }
2336
1458
  ];
2337
- [InternalEventName.RecordedTaskPermissionScreen]: [];
2338
- [InternalEventName.RecordedTaskStart]: [];
2339
- [InternalEventName.SurveyComplete]: [];
2340
- [InternalEventName.VerifyViewVersion]: [
1459
+ "recorded.task.permission.screen": [];
1460
+ "recorded.task.start": [];
1461
+ "survey.complete": [number];
1462
+ "verify.view.version": [
2341
1463
  {
2342
- [InternalEventData.ViewVersion]: string;
1464
+ "view.version": string;
2343
1465
  }
2344
1466
  ];
2345
1467
  [SprigEvent.CloseSurveyOnOverlayClick]: [];
2346
- [SprigEvent.SDKReady]: [];
2347
- [SprigEvent.SurveyAppeared]: [];
1468
+ [SprigEvent.FeedbackButtonLoaded]: [
1469
+ {
1470
+ name: string;
1471
+ "survey.id"?: number;
1472
+ }
1473
+ ];
1474
+ [SprigEvent.SDKReady]: [MobileReplayConfig];
1475
+ [SprigEvent.SurveyAppeared]: [
1476
+ {
1477
+ name: string;
1478
+ "survey.id": number;
1479
+ }
1480
+ ];
2348
1481
  [SprigEvent.SurveyDimensions]: [
2349
1482
  {
2350
1483
  contentFrameHeight: number;
2351
1484
  contentFrameWidth: number;
2352
1485
  name: string;
1486
+ "survey.id": number;
2353
1487
  }
2354
1488
  ];
2355
1489
  [SprigEvent.SurveyClosed]: [
2356
1490
  {
2357
1491
  initiator?: string;
2358
1492
  name: string;
1493
+ studyType?: StudyType;
1494
+ "survey.id": number;
2359
1495
  }
2360
1496
  ];
2361
1497
  [SprigEvent.SurveyFadingOut]: [];
@@ -2363,6 +1499,14 @@ type SprigEventMap = {
2363
1499
  {
2364
1500
  name: string;
2365
1501
  contentFrameHeight: number;
1502
+ "survey.id": number;
1503
+ }
1504
+ ];
1505
+ [SprigEvent.SurveyWidth]: [
1506
+ {
1507
+ name: string;
1508
+ contentFrameWidth: number;
1509
+ "survey.id": number;
2366
1510
  }
2367
1511
  ];
2368
1512
  [SprigEvent.SurveyLifeCycle]: [{
@@ -2371,12 +1515,23 @@ type SprigEventMap = {
2371
1515
  [SprigEvent.SurveyPresented]: [
2372
1516
  {
2373
1517
  name: string;
1518
+ "survey.id": number;
1519
+ }
1520
+ ];
1521
+ [SprigEvent.SurveyCloseRequested]: [
1522
+ {
1523
+ initiator: DismissReason;
1524
+ name?: string;
1525
+ studyType?: StudyType;
1526
+ "survey.id": number;
2374
1527
  }
2375
1528
  ];
2376
1529
  [SprigEvent.SurveyWillClose]: [
2377
1530
  {
2378
1531
  initiator: DismissReason;
2379
1532
  name?: string;
1533
+ studyType?: StudyType;
1534
+ "survey.id": number;
2380
1535
  }
2381
1536
  ];
2382
1537
  [SprigEvent.SurveyWillPresent]: [
@@ -2393,104 +1548,87 @@ type SprigEventMap = {
2393
1548
  answeredAt?: number;
2394
1549
  questionIndex?: number;
2395
1550
  value: unknown;
1551
+ "survey.id": number;
1552
+ }
1553
+ ];
1554
+ [SprigEvent.ReplayCapture]: [
1555
+ {
1556
+ responseGroupUid: string;
1557
+ hasQuestions: boolean;
1558
+ uploadId: string;
1559
+ seconds: number;
1560
+ replayType: ReplayDurationType;
1561
+ generateVideoUploadUrlPayload: {
1562
+ isReplay: boolean;
1563
+ mediaRecordingUid: string;
1564
+ mediaType: MediaType;
1565
+ questionId: number;
1566
+ responseGroupUid: string;
1567
+ surveyId: number;
1568
+ updatedAt: string;
1569
+ visitorId: string | null;
1570
+ };
1571
+ surveyId: number;
2396
1572
  }
2397
1573
  ];
2398
- [SprigRecordingEvent.AvPermission]: [
1574
+ [SprigEvent.ReplayPaused]: [];
1575
+ [SprigEvent.ReplayResumed]: [];
1576
+ "av.permission": [
2399
1577
  {
2400
- [SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
2401
- [SprigRecordingEventData.PermissionDescriptors]: AvPermission[];
1578
+ "stream.ready": (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
1579
+ "permission.descriptors": AvPermission[];
2402
1580
  }
2403
1581
  ];
2404
- [SprigRecordingEvent.BeginRecording]: [
1582
+ "begin.recording": [
2405
1583
  {
2406
- [SprigRecordingEventData.RecordingMediaTypes]: MediaType[];
2407
- [SprigRecordingEventData.StartRecordingCallback]: (mediaRecordingUids: UUID[]) => void;
1584
+ "recording.media.types": MediaType[];
1585
+ "start.recording.callback": (mediaRecordingUids: UUID[]) => void;
2408
1586
  }
2409
1587
  ];
2410
- [SprigRecordingEvent.FinishTask]: [
1588
+ "finish.task": [
2411
1589
  {
2412
- [SprigRecordingEventData.BeginCallback]: (mediaRecordingUid: UUID) => void;
2413
- [SprigRecordingEventData.CurrentIndex]: number;
2414
- [SprigRecordingEventData.PassthroughData]: PassthroughData;
2415
- [SprigRecordingEventData.ProgressCallback]: (mediaRecordingUid: UUID, data: {
1590
+ "begin.callback": (mediaRecordingUid: UUID) => void;
1591
+ "current.index": number;
1592
+ "passthrough.data": PassthroughData;
1593
+ "progress.callback": (mediaRecordingUid: UUID, data: {
2416
1594
  detail: number;
2417
1595
  }) => void;
2418
- [SprigRecordingEventData.TaskCompleteCallback]: (taskDurationMillisecond: number) => void;
2419
- [SprigRecordingEventData.TaskResponse]: RecordedTaskResponseType;
2420
- [SprigRecordingEventData.UploadCallback]: (mediaRecordingUid: UUID | null, successOrError: true | unknown) => void;
1596
+ "task.complete.callback": (taskDurationMillisecond: number) => void;
1597
+ "task.response": RecordedTaskResponseType;
1598
+ "upload.callback": (mediaRecordingUid: UUID | null, successOrError: true | unknown) => void;
2421
1599
  }
2422
1600
  ];
2423
- [SprigRecordingEvent.PermissionStatus]: [
1601
+ "permission.status": [
2424
1602
  {
2425
- [SprigRecordingEventData.PermissionStatusCallback]: (avStream: MediaStream | undefined, hasVideoPermission: boolean, hasScreenPermission: boolean, captureStream: MediaStream | undefined) => void;
1603
+ "permission.status.callback": (avStream: MediaStream | undefined, hasVideoPermission: boolean, hasScreenPermission: boolean, captureStream: MediaStream | undefined) => void;
2426
1604
  }
2427
1605
  ];
2428
- [SprigRecordingEvent.ScreenPermission]: [
1606
+ "screen.permission": [
2429
1607
  {
2430
- [SprigRecordingEventData.ScreenPermissionRequested]?: (data: boolean) => void;
2431
- [SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream: MediaStream | null) => void;
1608
+ "screen.permission.requested"?: (data: boolean) => void;
1609
+ "stream.ready.callback": (avStream: MediaStream | null, captureStream: MediaStream | null) => void;
2432
1610
  }
2433
1611
  ];
2434
- [SprigRecordingEvent.StartTask]: [];
1612
+ "start.task": [];
2435
1613
  };
2436
1614
  declare const eventEmitter: Emitter<SprigEventMap>;
2437
1615
  type SprigEventEmitter = typeof eventEmitter;
2438
1616
 
2439
- type MatchType = "exactly" | "legacy";
2440
- interface InteractiveEvent {
2441
- id: number;
2442
- matchType: MatchType;
2443
- name: string;
2444
- pattern: string;
2445
- properties: {
2446
- innerText: string;
2447
- selector?: string;
2448
- type?: "click";
2449
- };
2450
- }
2451
- interface PageUrlEvent {
2452
- id: number;
2453
- matchType: MatchType | "contains" | "notContains" | "regex" | "startsWith";
2454
- pattern: string;
2455
- }
2456
-
2457
- declare const enum FramePosition {
2458
- BottomLeft = "bottomLeft",
2459
- BottomRight = "bottomRight",
2460
- Center = "center",
2461
- TopLeft = "topLeft",
2462
- TopRight = "topRight"
2463
- }
2464
- declare const enum HttpHeader {
2465
- Error = "x-ul-error",
2466
- EnvironmentID = "x-ul-environment-id",
2467
- InstallationMethod = "x-ul-installation-method",
2468
- PartnerAnonymousId = "x-ul-anonymous-id",
2469
- Platform = "userleap-platform",
2470
- PreviewMode = "x-ul-preview-mode",
2471
- UserID = "x-ul-user-id",
2472
- VisitorID = "x-ul-visitor-id"
2473
- }
2474
- declare const enum Platform {
2475
- Email = "email",
2476
- Link = "link",
2477
- Web = "web"
2478
- }
2479
- declare const enum InstallationMethod {
2480
- Npm = "web-npm",
2481
- NpmBundled = "web-npm-bundled",
2482
- Gtm = "web-gtm",
2483
- Segment = "web-segment",
2484
- SegmentAndroid = "android-segment",
2485
- SegmentReactNative = "react-native-segment",
2486
- SegmentIOS = "ios-segment",
2487
- Snippet = "web-snippet"
2488
- }
1617
+ type FramePosition = "bottomLeft" | "bottomRight" | "center" | "topLeft" | "topRight";
1618
+ type Platform = "email" | "link" | "web";
1619
+ type InstallationMethod = "web-npm" | "web-npm-bundled" | "web-gtm" | "web-segment" | "android-segment" | "react-native-segment" | "ios-segment" | "web-snippet";
2489
1620
  interface Answer {
2490
1621
  questionId: number;
2491
1622
  value: unknown;
2492
1623
  }
2493
- interface Config {
1624
+ type FeedbackPlacement = "center-left" | "center-right" | "bottom-left" | "bottom-right";
1625
+ type FeedbackDesktopDisplay = "center-modal" | "slider";
1626
+ interface AppProductConfig {
1627
+ framePosition?: FramePosition;
1628
+ desktopDisplay?: FeedbackDesktopDisplay;
1629
+ placement?: FeedbackPlacement;
1630
+ }
1631
+ interface Config extends MobileReplayConfig {
2494
1632
  allResponses: unknown[];
2495
1633
  answers?: Answer[];
2496
1634
  apiURL: string;
@@ -2508,7 +1646,7 @@ interface Config {
2508
1646
  };
2509
1647
  };
2510
1648
  customMetadata?: Record<string, unknown>;
2511
- customStyles: string;
1649
+ customStyles?: string;
2512
1650
  dismissOnPageChange: boolean;
2513
1651
  forceBrandedLogo?: boolean;
2514
1652
  endCard?: {
@@ -2526,30 +1664,37 @@ interface Config {
2526
1664
  frame: HTMLIFrameElement & {
2527
1665
  eventEmitter?: SprigEventEmitter;
2528
1666
  setHeight?: (height: number) => void;
1667
+ setWidth?: (width: number) => void;
2529
1668
  };
2530
1669
  framePosition: FramePosition;
2531
1670
  headers: {
2532
1671
  "accept-language"?: string;
2533
1672
  /** @example "Bearer 123" */
2534
1673
  Authorization?: string;
2535
- "Content-Type": string;
2536
- "userleap-platform": Platform;
1674
+ "Content-Type"?: string;
1675
+ "userleap-platform": Platform | "ios" | "android" | "video_recorder";
1676
+ "sprig-modules"?: string;
2537
1677
  /** @example "SJcVfq-7QQ" */
2538
- [HttpHeader.EnvironmentID]?: string;
2539
- [HttpHeader.InstallationMethod]: InstallationMethod;
2540
- [HttpHeader.PartnerAnonymousId]?: string;
2541
- [HttpHeader.PreviewMode]?: string;
1678
+ "x-ul-environment-id"?: string;
1679
+ "x-ul-installation-method": InstallationMethod;
1680
+ "x-ul-anonymous-id"?: string;
1681
+ "x-ul-error"?: string;
1682
+ "x-ul-preview-mode"?: string;
2542
1683
  /** @example "2.18.0" */
2543
- "x-ul-sdk-version": string;
2544
- [HttpHeader.UserID]?: string;
2545
- [HttpHeader.VisitorID]?: UUID;
1684
+ "x-ul-sdk-version"?: string;
1685
+ /** For web-bundled sdk */
1686
+ "x-ul-package-version"?: string;
1687
+ "x-ul-user-id"?: string;
1688
+ "x-ul-visitor-id"?: string;
2546
1689
  };
2547
1690
  installationMethod?: InstallationMethod;
2548
1691
  interactiveEvents: InteractiveEvent[];
2549
1692
  interactiveEventsHandler?: (e: MouseEvent) => void;
1693
+ isOnQuestionsTab?: boolean;
2550
1694
  isPreview?: boolean;
2551
1695
  launchDarklyEnabled?: boolean;
2552
1696
  locale: string;
1697
+ logBufferLimit?: number;
2553
1698
  marketingUrl?: string;
2554
1699
  maxAttrNameLength: number;
2555
1700
  maxAttrValueLength: number;
@@ -2561,13 +1706,15 @@ interface Config {
2561
1706
  mode?: string;
2562
1707
  mute?: boolean;
2563
1708
  optimizelyEnabled?: boolean;
1709
+ outstandingTransactionLimit?: number | null;
2564
1710
  overlayStyle: "light";
2565
1711
  overlayStyleMobile: "none";
2566
1712
  pageUrlEvents: PageUrlEvent[];
2567
1713
  path?: string;
2568
1714
  platform?: Platform;
2569
1715
  previewKey?: string | null;
2570
- replayNonce?: string;
1716
+ previewMode?: boolean;
1717
+ productConfig?: AppProductConfig;
2571
1718
  replaySettings?: object;
2572
1719
  requireUserIdForTracking: boolean;
2573
1720
  responseGroupUid: UUID;
@@ -2576,10 +1723,13 @@ interface Config {
2576
1723
  slugName: null;
2577
1724
  startingQuestionIdx?: number | null;
2578
1725
  styleNonce?: string;
1726
+ studyType?: StudyType;
2579
1727
  surveyId: number;
2580
1728
  tabTitle: string;
1729
+ trackPageViewUrl?: string;
2581
1730
  ulEvents: typeof SprigEvent;
2582
1731
  UpChunk: Window["UpChunk"];
1732
+ upchunkLibraryURL?: string;
2583
1733
  useDesktopPrototype?: boolean;
2584
1734
  useMobileStyling: boolean;
2585
1735
  userId: UUID | null;
@@ -2592,33 +1742,54 @@ interface Config {
2592
1742
  };
2593
1743
  }
2594
1744
 
2595
- declare enum ReplayEventType {
2596
- Click = "Sprig_Click",
2597
- Event = "Sprig_TrackEvent",
2598
- PageView = "Sprig_PageView",
2599
- SurveyShown = "Sprig_ShowSurvey",
2600
- SurveySubmitted = "Sprig_SubmitSurvey",
2601
- Noop = "Sprig_Noop"
1745
+ interface Experiment {
1746
+ id: string;
1747
+ variation?: string;
2602
1748
  }
1749
+
1750
+ type QueueItem = [string, ...unknown[]] | (() => void);
1751
+ declare class SprigQueue {
1752
+ paused: boolean;
1753
+ queue: QueueItem[];
1754
+ ul: WindowSprig;
1755
+ constructor(ul: WindowSprig, queue: QueueItem[]);
1756
+ flush(queue: QueueItem[]): void;
1757
+ isPaused(): boolean;
1758
+ pause(): void;
1759
+ unpause(): void;
1760
+ push(action: QueueItem): void;
1761
+ perform(func: () => void): void | Promise<unknown>;
1762
+ /**
1763
+ * Removes all queued items
1764
+ */
1765
+ empty(): void;
1766
+ }
1767
+
2603
1768
  type EventDigest = {
2604
1769
  timestamp: number;
2605
- type: ReplayEventType.Click;
1770
+ type: "Sprig_Click";
2606
1771
  } | {
2607
1772
  timestamp: number;
2608
1773
  name: string;
2609
- type: ReplayEventType.Event;
1774
+ type: "Sprig_TrackEvent";
2610
1775
  } | {
2611
1776
  timestamp: number;
2612
- type: ReplayEventType.PageView;
1777
+ type: "Sprig_PageView";
2613
1778
  url: string;
2614
1779
  } | {
2615
1780
  timestamp: number;
2616
1781
  surveyId: string;
2617
- type: ReplayEventType.SurveyShown;
1782
+ type: "Sprig_ShowSurvey";
2618
1783
  } | {
2619
1784
  timestamp: number;
2620
1785
  surveyId: string;
2621
- type: ReplayEventType.SurveySubmitted;
1786
+ type: "Sprig_SubmitSurvey";
1787
+ } | {
1788
+ timestamp: number;
1789
+ type: "Sprig_ReplayPaused";
1790
+ } | {
1791
+ timestamp: number;
1792
+ type: "Sprig_ReplayResumed";
2622
1793
  };
2623
1794
 
2624
1795
  declare namespace optimizely {
@@ -2663,6 +1834,7 @@ declare namespace optimizely {
2663
1834
  declare namespace sprigConfig {
2664
1835
  type IdentifyResult = Promise<
2665
1836
  | {
1837
+ error?: Error;
2666
1838
  success: boolean;
2667
1839
  message?: string;
2668
1840
  surveyState?: SurveyState;
@@ -2687,7 +1859,7 @@ declare namespace sprigConfig {
2687
1859
  surveyId: number;
2688
1860
  responseGroupUuid: string;
2689
1861
  eventDigest?: EventDigest[];
2690
- }) => Promise<void>;
1862
+ }) => Promise<boolean>;
2691
1863
  _generateVideoUploadUrl: (body: {
2692
1864
  mediaRecordingUid?: string;
2693
1865
  mediaType?: MediaType;
@@ -2696,13 +1868,16 @@ declare namespace sprigConfig {
2696
1868
  surveyId?: number;
2697
1869
  updatedAt?: string;
2698
1870
  visitorId?: string | null;
1871
+ isReplay?: boolean;
2699
1872
  }) => Promise<string | null>;
2700
1873
  _previewSurvey: (surveyTemplateId: UUID) => void;
2701
1874
  _reviewSurvey: (surveyId: number) => void;
1875
+ _reportMetric: (name: Metric, value: number) => void;
2702
1876
 
2703
1877
  // external apis
2704
1878
  addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
2705
1879
  addSurveyListener: (listener: SprigListener) => Promise<void>;
1880
+ applyFeedbackStyles: (styles: { button?: string; view?: string }) => void;
2706
1881
  applyStyles: (styleString: string) => void;
2707
1882
  dismissActiveSurvey: (reason?: DismissReason) => void;
2708
1883
  displaySurvey: (surveyId: number) => IdentifyResult;
@@ -2715,7 +1890,7 @@ declare namespace sprigConfig {
2715
1890
  importLaunchDarklyData: (data: Record<string, number | undefined>) => void;
2716
1891
  integrateOptimizely: (
2717
1892
  strData: string | { experiments: Experiment[] },
2718
- isOverride?: boolean
1893
+ isOverride?: boolean,
2719
1894
  ) => void;
2720
1895
  integrateOptimizelyClient: (client: Client) => void;
2721
1896
  logoutUser: () => void;
@@ -2725,22 +1900,25 @@ declare namespace sprigConfig {
2725
1900
  removeAttributes: (attributes: SprigAttributes) => IdentifyResult;
2726
1901
  removeListener: (
2727
1902
  event: SprigEvent,
2728
- listener: SprigListener
1903
+ listener: SprigListener,
2729
1904
  ) => Promise<void>;
2730
1905
  removeSurveyListener: (listener: SprigListener) => Promise<void>;
2731
1906
  reviewSurvey: (surveyId: number) => void;
2732
- setAttribute: (attribute: string, value: string | number) => IdentifyResult;
1907
+ setAttribute: (
1908
+ attribute: string,
1909
+ value: string | number | boolean,
1910
+ ) => IdentifyResult;
2733
1911
  setAttributes: (attributes?: SprigAttributes) => IdentifyResult;
2734
1912
  setPartnerAnonymousId: (
2735
- partnerAnonymousId: string
1913
+ partnerAnonymousId: string,
2736
1914
  ) => Promise<{ success: boolean; message?: string }>;
2737
1915
  setVisitorAttribute: (
2738
1916
  attribute: string,
2739
- value: string | number
1917
+ value: string | number,
2740
1918
  ) => IdentifyResult;
2741
1919
  setWindowDimensions: (
2742
1920
  width: number | string,
2743
- height: number | string
1921
+ height: number | string,
2744
1922
  ) => void;
2745
1923
  setEmail: (email: string) => IdentifyResult;
2746
1924
  setPreviewKey: (previewKey: string) => void;
@@ -2752,14 +1930,18 @@ declare namespace sprigConfig {
2752
1930
  eventName: string,
2753
1931
  properties?: TrackPayload["properties"],
2754
1932
  metadata?: SprigMetadata,
2755
- showSurveyCallback?: (surveyId?: number) => Promise<boolean>
1933
+ showSurveyCallback?: (surveyId?: number) => Promise<boolean>,
2756
1934
  ) => IdentifyResult;
2757
1935
  trackPageView: (
2758
1936
  url: string,
2759
1937
  properties?: SprigProperties,
2760
- showSurveyCallback?: (surveyId?: number) => Promise<boolean>
1938
+ showSurveyCallback?: (surveyId?: number) => Promise<boolean>,
1939
+ calledFromApi?: boolean,
2761
1940
  ) => void;
1941
+ trackHistory?: ({ event: string }) => void;
2762
1942
  unmute: () => void;
1943
+ pauseReplayRecording: () => void;
1944
+ resumeReplayRecording: () => void;
2763
1945
  }
2764
1946
 
2765
1947
  type SprigCommand = keyof SprigAPIActions;
@@ -2772,7 +1954,10 @@ declare namespace sprigConfig {
2772
1954
  SprigAPIActions &
2773
1955
  SprigCommands & {
2774
1956
  _API_URL: string;
2775
- _config: Config;
1957
+ _config: Config & {
1958
+ desktopDisplay?: string;
1959
+ previewLanguage?: string;
1960
+ };
2776
1961
  _gtm: unknown; // TODO: determine if boolean?
2777
1962
  _queue: SprigQueue;
2778
1963
  _segment: unknown; // TODO: determine if boolean?
@@ -2784,19 +1969,29 @@ declare namespace sprigConfig {
2784
1969
  email?: string | null;
2785
1970
  envId: string;
2786
1971
  error?: Error;
1972
+ feedbackCustomStyles?: string;
1973
+ forceDirectEmbed?: boolean;
2787
1974
  frameId: string;
1975
+ isMobileSDK?: boolean;
2788
1976
  loaded: boolean;
2789
1977
  locale?: string;
2790
- localStorageAvailable: boolean;
2791
1978
  maxHeight?: number | string;
2792
1979
  maxInflightReplayRequests?: number;
1980
+ outstandingTransactionLimit?: number | null;
2793
1981
  mobileHeadersJSON?: string;
2794
1982
  nonce?: string;
2795
1983
  partnerAnonymousId: string | null;
2796
- replayNonce?: string;
2797
- reportError: (name: string, err: Error, extraInfo?: object) => void;
1984
+ pointerDownTarget?: EventTarget | null;
1985
+ replayLibraryURL?: string;
1986
+ reportError: (
1987
+ name: string,
1988
+ err: Error,
1989
+ extraInfo?: object,
1990
+ bodyInfo?: object,
1991
+ ) => void;
2798
1992
  sampleRate?: number;
2799
1993
  token: string | null;
1994
+ upchunkLibraryURL?: string;
2800
1995
  UPDATES: typeof EVENTS;
2801
1996
  viewSDKURL?: string;
2802
1997
  windowDimensions?: {
@@ -2805,49 +2000,42 @@ declare namespace sprigConfig {
2805
2000
  };
2806
2001
  };
2807
2002
  }
2808
- type ArgumentTypes<F> = F extends (...args: infer A) => unknown
2809
- ? A
2810
- : never;
2811
- type ArgumentType<T> = T extends (arg1: infer U, ...args: unknown[]) => unknown
2812
- ? U
2813
- : unknown;
2814
- type PublicOf<T> = { [K in keyof T]: T[K] };
2815
- type createUpload = typeof _mux_upchunk["createUpload"];
2816
- type rrwebRecord = typeof rrweb["record"];
2817
- type rrwebCustomEvent = typeof rrweb["record"]["addCustomEvent"];
2003
+
2818
2004
  declare global {
2819
2005
  interface Window {
2820
2006
  __cfg: Config;
2821
2007
  attachEvent?: typeof window.addEventListener;
2008
+ Backbone: {
2009
+ history: typeof window.history;
2010
+ };
2822
2011
  Intercom: { ul_wasVisible?: boolean } & ((
2823
2012
  method: string,
2824
- data: unknown
2013
+ data?: unknown,
2825
2014
  ) => void);
2826
2015
  optimizely?: optimizely.Optimizely;
2827
2016
  optimizelyDatafile?: object;
2828
2017
  previewMode?: unknown;
2829
2018
  UpChunk: {
2830
- createUpload: (
2831
- ...args: ArgumentTypes<createUpload>
2832
- ) => PublicOf<ReturnType<createUpload>>;
2019
+ createUpload: typeof createUpload;
2833
2020
  };
2834
2021
  _Sprig?: sprigConfig.WindowSprig;
2835
2022
  Sprig: sprigConfig.WindowSprig;
2836
2023
  UserLeap: sprigConfig.WindowSprig;
2837
- rrwebRecord?: {
2838
- addCustomEvent: (
2839
- ...args: ArgumentTypes<rrwebCustomEvent>
2840
- ) => PublicOf<ReturnType<rrwebCustomEvent>>;
2841
- } & ((
2842
- arg: Omit<ArgumentType<rrwebRecord>, "hooks">
2843
- ) => PublicOf<ReturnType<rrwebRecord>>);
2844
- sprigAPI?: object;
2024
+ rrwebRecord?: (typeof _rrweb_record)["record"];
2025
+ sprigAPI?: { openUrl: (url: string) => void };
2026
+ SprigLoggerCallback?: (message: string) => void;
2845
2027
  }
2846
2028
 
2847
2029
  type WindowSprig = sprigConfig.WindowSprig;
2848
2030
  type SprigAttributes = Record<string, boolean | number | string>;
2849
2031
  type SprigListener = Listener<unknown[]>;
2850
- type SprigMetadata = Record<string, unknown>;
2032
+ type SprigMetadata = {
2033
+ url?: string;
2034
+ trackPageView?: boolean;
2035
+ optimizelyExperiments?: object;
2036
+ launchDarklyFlags?: object;
2037
+ eventProperties?: SprigProperties;
2038
+ };
2851
2039
  type SprigProperties = Record<string, unknown>;
2852
2040
  type SprigAPIActions = sprigConfig.SprigAPIActions;
2853
2041
  type TrackPayload = sprigConfig.TrackPayload;
@@ -2862,28 +2050,36 @@ declare class SprigAPI {
2862
2050
  * Include external events emitted from Sprig
2863
2051
  */
2864
2052
  UPDATES: {
2053
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
2865
2054
  SDK_READY: SprigEvent;
2866
2055
  SURVEY_APPEARED: SprigEvent;
2867
2056
  SURVEY_CLOSED: SprigEvent;
2868
2057
  SURVEY_DIMENSIONS: SprigEvent;
2869
2058
  SURVEY_FADING_OUT: SprigEvent;
2870
2059
  SURVEY_HEIGHT: SprigEvent;
2060
+ SURVEY_WIDTH: SprigEvent;
2871
2061
  SURVEY_PRESENTED: SprigEvent;
2872
2062
  SURVEY_LIFE_CYCLE: SprigEvent;
2873
2063
  SURVEY_WILL_CLOSE: SprigEvent;
2874
2064
  SURVEY_WILL_PRESENT: SprigEvent;
2875
2065
  QUESTION_ANSWERED: SprigEvent;
2876
- CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
2066
+ REPLAY_CAPTURE: SprigEvent;
2067
+ CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent; /**
2068
+ * Tracks a page view with the provided URL and additional event properties.
2069
+ */
2877
2070
  VISITOR_ID_UPDATED: SprigEvent;
2878
2071
  DATA: {
2879
2072
  DISMISS_REASONS: {
2880
2073
  API: DismissReason;
2881
2074
  CLOSED: DismissReason;
2075
+ /**
2076
+ * Apply a css string representing the customized styles
2077
+ */
2882
2078
  COMPLETE: DismissReason;
2883
2079
  PAGE_CHANGE: DismissReason;
2884
2080
  OVERRIDE: DismissReason;
2885
2081
  };
2886
- SURVEY_ID: SprigEventData;
2082
+ SURVEY_ID: string;
2887
2083
  };
2888
2084
  };
2889
2085
  /**
@@ -2905,7 +2101,7 @@ declare class SprigAPI {
2905
2101
  /**
2906
2102
  * Set an arbitrary attribute on the visitor
2907
2103
  */
2908
- setAttribute(attribute: string, value: string): void;
2104
+ setAttribute(attribute: string, value: string | number | boolean): void;
2909
2105
  /**
2910
2106
  * Set attributes on visitor
2911
2107
  */
@@ -2980,6 +2176,14 @@ declare class SprigAPI {
2980
2176
  * Clears Sprig from window
2981
2177
  */
2982
2178
  teardown(): void;
2179
+ /**
2180
+ * Pause replay recording
2181
+ */
2182
+ pauseReplayRecording(): void;
2183
+ /**
2184
+ * Resume replay recording
2185
+ */
2186
+ resumeReplayRecording(): void;
2983
2187
  }
2984
2188
  type NpmConfig = {
2985
2189
  envId?: string;
@@ -2996,4 +2200,4 @@ declare const sprig: {
2996
2200
  };
2997
2201
  type WindowSprig$1 = typeof window.Sprig;
2998
2202
 
2999
- export { DismissReason, SprigAPI, SprigEvent, WindowSprig$1 as WindowSprig, sprig };
2203
+ export { DismissReason, SprigAPI, SprigEvent, type WindowSprig$1 as WindowSprig, sprig };