@sprig-technologies/sprig-bundled 1.1.5 → 1.1.7

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,1446 +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
- isCustom?: true;
31
- };
32
- type textNode = {
33
- type: NodeType.Text;
34
- textContent: string;
35
- isStyle?: true;
36
- };
37
- type cdataNode = {
38
- type: NodeType.CDATA;
39
- textContent: '';
40
- };
41
- type commentNode = {
42
- type: NodeType.Comment;
43
- textContent: string;
44
- };
45
- type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
46
- rootId?: number;
47
- isShadowHost?: boolean;
48
- isShadow?: boolean;
49
- };
50
- type serializedNodeWithId = serializedNode & {
51
- id: number;
52
- };
53
- interface INode extends Node {
54
- __sn: serializedNodeWithId;
55
- }
56
- interface IMirror<TNode> {
57
- getId(n: TNode | undefined | null): number;
58
- getNode(id: number): TNode | null;
59
- getIds(): number[];
60
- getMeta(n: TNode): serializedNodeWithId | null;
61
- removeNodeFromMap(n: TNode): void;
62
- has(id: number): boolean;
63
- hasNode(node: TNode): boolean;
64
- add(n: TNode, meta: serializedNodeWithId): void;
65
- replace(id: number, n: TNode): void;
66
- reset(): void;
67
- }
68
- type MaskInputOptions = Partial<{
69
- color: boolean;
70
- date: boolean;
71
- 'datetime-local': boolean;
72
- email: boolean;
73
- month: boolean;
74
- number: boolean;
75
- range: boolean;
76
- search: boolean;
77
- tel: boolean;
78
- text: boolean;
79
- time: boolean;
80
- url: boolean;
81
- week: boolean;
82
- textarea: boolean;
83
- select: boolean;
84
- password: boolean;
85
- }>;
86
- type SlimDOMOptions = Partial<{
87
- script: boolean;
88
- comment: boolean;
89
- headFavicon: boolean;
90
- headWhitespace: boolean;
91
- headMetaDescKeywords: boolean;
92
- headMetaSocial: boolean;
93
- headMetaRobots: boolean;
94
- headMetaHttpEquiv: boolean;
95
- headMetaAuthorship: boolean;
96
- headMetaVerification: boolean;
97
- }>;
98
- type DataURLOptions = Partial<{
99
- type: string;
100
- quality: number;
101
- }>;
102
- type MaskTextFn = (text: string, element: HTMLElement | null) => string;
103
- type MaskInputFn = (text: string, element: HTMLElement) => string;
104
-
105
- declare class Mirror$1 implements IMirror<Node> {
106
- private idNodeMap;
107
- private nodeMetaMap;
108
- getId(n: Node | undefined | null): number;
109
- getNode(id: number): Node | null;
110
- getIds(): number[];
111
- getMeta(n: Node): serializedNodeWithId | null;
112
- removeNodeFromMap(n: Node): void;
113
- has(id: number): boolean;
114
- hasNode(node: Node): boolean;
115
- add(n: Node, meta: serializedNodeWithId): void;
116
- replace(id: number, n: Node): void;
117
- reset(): void;
118
- }
119
-
120
- declare enum EventType {
121
- DomContentLoaded = 0,
122
- Load = 1,
123
- FullSnapshot = 2,
124
- IncrementalSnapshot = 3,
125
- Meta = 4,
126
- Custom = 5,
127
- Plugin = 6
128
- }
129
- type domContentLoadedEvent = {
130
- type: EventType.DomContentLoaded;
131
- data: unknown;
132
- };
133
- type loadedEvent = {
134
- type: EventType.Load;
135
- data: unknown;
136
- };
137
- type fullSnapshotEvent = {
138
- type: EventType.FullSnapshot;
139
- data: {
140
- node: serializedNodeWithId;
141
- initialOffset: {
142
- top: number;
143
- left: number;
144
- };
145
- };
146
- };
147
- type incrementalSnapshotEvent = {
148
- type: EventType.IncrementalSnapshot;
149
- data: incrementalData;
150
- };
151
- type metaEvent = {
152
- type: EventType.Meta;
153
- data: {
154
- href: string;
155
- width: number;
156
- height: number;
157
- };
158
- };
159
- type customEvent<T = unknown> = {
160
- type: EventType.Custom;
161
- data: {
162
- tag: string;
163
- payload: T;
164
- };
165
- };
166
- type pluginEvent<T = unknown> = {
167
- type: EventType.Plugin;
168
- data: {
169
- plugin: string;
170
- payload: T;
171
- };
172
- };
173
- declare enum IncrementalSource {
174
- Mutation = 0,
175
- MouseMove = 1,
176
- MouseInteraction = 2,
177
- Scroll = 3,
178
- ViewportResize = 4,
179
- Input = 5,
180
- TouchMove = 6,
181
- MediaInteraction = 7,
182
- StyleSheetRule = 8,
183
- CanvasMutation = 9,
184
- Font = 10,
185
- Log = 11,
186
- Drag = 12,
187
- StyleDeclaration = 13,
188
- Selection = 14,
189
- AdoptedStyleSheet = 15,
190
- CustomElement = 16
191
- }
192
- type mutationData = {
193
- source: IncrementalSource.Mutation;
194
- } & mutationCallbackParam;
195
- type mousemoveData = {
196
- source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
197
- positions: mousePosition[];
198
- };
199
- type mouseInteractionData = {
200
- source: IncrementalSource.MouseInteraction;
201
- } & mouseInteractionParam;
202
- type scrollData = {
203
- source: IncrementalSource.Scroll;
204
- } & scrollPosition;
205
- type viewportResizeData = {
206
- source: IncrementalSource.ViewportResize;
207
- } & viewportResizeDimension;
208
- type inputData = {
209
- source: IncrementalSource.Input;
210
- id: number;
211
- } & inputValue;
212
- type mediaInteractionData = {
213
- source: IncrementalSource.MediaInteraction;
214
- } & mediaInteractionParam;
215
- type styleSheetRuleData = {
216
- source: IncrementalSource.StyleSheetRule;
217
- } & styleSheetRuleParam;
218
- type styleDeclarationData = {
219
- source: IncrementalSource.StyleDeclaration;
220
- } & styleDeclarationParam;
221
- type canvasMutationData = {
222
- source: IncrementalSource.CanvasMutation;
223
- } & canvasMutationParam;
224
- type fontData = {
225
- source: IncrementalSource.Font;
226
- } & fontParam;
227
- type selectionData = {
228
- source: IncrementalSource.Selection;
229
- } & selectionParam;
230
- type adoptedStyleSheetData = {
231
- source: IncrementalSource.AdoptedStyleSheet;
232
- } & adoptedStyleSheetParam;
233
- type customElementData = {
234
- source: IncrementalSource.CustomElement;
235
- } & customElementParam;
236
- type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
237
- type event = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
238
- type eventWithTime = event & {
239
- timestamp: number;
240
- delay?: number;
241
- };
242
- type canvasEventWithTime = eventWithTime & {
243
- type: EventType.IncrementalSnapshot;
244
- data: canvasMutationData;
245
- };
246
- type blockClass = string | RegExp;
247
- type maskTextClass = string | RegExp;
248
- type SamplingStrategy = Partial<{
249
- mousemove: boolean | number;
250
- mousemoveCallback: number;
251
- mouseInteraction: boolean | Record<string, boolean | undefined>;
252
- scroll: number;
253
- media: number;
254
- input: 'all' | 'last';
255
- canvas: 'all' | number;
256
- }>;
257
- interface ICrossOriginIframeMirror {
258
- getId(iframe: HTMLIFrameElement, remoteId: number, parentToRemoteMap?: Map<number, number>, remoteToParentMap?: Map<number, number>): number;
259
- getIds(iframe: HTMLIFrameElement, remoteId: number[]): number[];
260
- getRemoteId(iframe: HTMLIFrameElement, parentId: number, map?: Map<number, number>): number;
261
- getRemoteIds(iframe: HTMLIFrameElement, parentId: number[]): number[];
262
- reset(iframe?: HTMLIFrameElement): void;
263
- }
264
- type RecordPlugin<TOptions = unknown> = {
265
- name: string;
266
- observer?: (cb: (...args: Array<unknown>) => void, win: IWindow, options: TOptions) => listenerHandler;
267
- eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;
268
- getMirror?: (mirrors: {
269
- nodeMirror: Mirror$1;
270
- crossOriginIframeMirror: ICrossOriginIframeMirror;
271
- crossOriginIframeStyleMirror: ICrossOriginIframeMirror;
272
- }) => void;
273
- options: TOptions;
274
- };
275
- type hooksParam = {
276
- mutation?: mutationCallBack;
277
- mousemove?: mousemoveCallBack;
278
- mouseInteraction?: mouseInteractionCallBack;
279
- scroll?: scrollCallback;
280
- viewportResize?: viewportResizeCallback;
281
- input?: inputCallback;
282
- mediaInteaction?: mediaInteractionCallback;
283
- styleSheetRule?: styleSheetRuleCallback;
284
- styleDeclaration?: styleDeclarationCallback;
285
- canvasMutation?: canvasMutationCallback;
286
- font?: fontCallback;
287
- selection?: selectionCallback;
288
- customElement?: customElementCallback;
289
- };
290
- type textMutation = {
291
- id: number;
292
- value: string | null;
293
- };
294
- type styleOMValue = {
295
- [key: string]: styleValueWithPriority | string | false;
296
- };
297
- type styleValueWithPriority = [string, string];
298
- type attributeMutation = {
299
- id: number;
300
- attributes: {
301
- [key: string]: string | styleOMValue | null;
302
- };
303
- };
304
- type removedNodeMutation = {
305
- parentId: number;
306
- id: number;
307
- isShadow?: boolean;
308
- };
309
- type addedNodeMutation = {
310
- parentId: number;
311
- previousId?: number | null;
312
- nextId: number | null;
313
- node: serializedNodeWithId;
314
- };
315
- type mutationCallbackParam = {
316
- texts: textMutation[];
317
- attributes: attributeMutation[];
318
- removes: removedNodeMutation[];
319
- adds: addedNodeMutation[];
320
- isAttachIframe?: true;
321
- };
322
- type mutationCallBack = (m: mutationCallbackParam) => void;
323
- type mousemoveCallBack = (p: mousePosition[], source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag) => void;
324
- type mousePosition = {
325
- x: number;
326
- y: number;
327
- id: number;
328
- timeOffset: number;
329
- };
330
- declare enum MouseInteractions {
331
- MouseUp = 0,
332
- MouseDown = 1,
333
- Click = 2,
334
- ContextMenu = 3,
335
- DblClick = 4,
336
- Focus = 5,
337
- Blur = 6,
338
- TouchStart = 7,
339
- TouchMove_Departed = 8,
340
- TouchEnd = 9,
341
- TouchCancel = 10
342
- }
343
- declare enum PointerTypes {
344
- Mouse = 0,
345
- Pen = 1,
346
- Touch = 2
347
- }
348
- declare enum CanvasContext {
349
- '2D' = 0,
350
- WebGL = 1,
351
- WebGL2 = 2
352
- }
353
- type mouseInteractionParam = {
354
- type: MouseInteractions;
355
- id: number;
356
- x?: number;
357
- y?: number;
358
- pointerType?: PointerTypes;
359
- };
360
- type mouseInteractionCallBack = (d: mouseInteractionParam) => void;
361
- type scrollPosition = {
362
- id: number;
363
- x: number;
364
- y: number;
365
- };
366
- type scrollCallback = (p: scrollPosition) => void;
367
- type styleSheetAddRule = {
368
- rule: string;
369
- index?: number | number[];
370
- };
371
- type styleSheetDeleteRule = {
372
- index: number | number[];
373
- };
374
- type styleSheetRuleParam = {
375
- id?: number;
376
- styleId?: number;
377
- removes?: styleSheetDeleteRule[];
378
- adds?: styleSheetAddRule[];
379
- replace?: string;
380
- replaceSync?: string;
381
- };
382
- type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;
383
- type adoptedStyleSheetParam = {
384
- id: number;
385
- styles?: {
386
- styleId: number;
387
- rules: styleSheetAddRule[];
388
- }[];
389
- styleIds: number[];
390
- };
391
- type styleDeclarationParam = {
392
- id?: number;
393
- styleId?: number;
394
- index: number[];
395
- set?: {
396
- property: string;
397
- value: string | null;
398
- priority: string | undefined;
399
- };
400
- remove?: {
401
- property: string;
402
- };
403
- };
404
- type styleDeclarationCallback = (s: styleDeclarationParam) => void;
405
- type canvasMutationCommand = {
406
- property: string;
407
- args: Array<unknown>;
408
- setter?: true;
409
- };
410
- type canvasMutationParam = {
411
- id: number;
412
- type: CanvasContext;
413
- commands: canvasMutationCommand[];
414
- } | ({
415
- id: number;
416
- type: CanvasContext;
417
- } & canvasMutationCommand);
418
- type canvasMutationCallback = (p: canvasMutationParam) => void;
419
- type fontParam = {
420
- family: string;
421
- fontSource: string;
422
- buffer: boolean;
423
- descriptors?: FontFaceDescriptors;
424
- };
425
- type fontCallback = (p: fontParam) => void;
426
- type viewportResizeDimension = {
427
- width: number;
428
- height: number;
429
- };
430
- type viewportResizeCallback = (d: viewportResizeDimension) => void;
431
- type inputValue = {
432
- text: string;
433
- isChecked: boolean;
434
- userTriggered?: boolean;
435
- };
436
- type inputCallback = (v: inputValue & {
437
- id: number;
438
- }) => void;
439
- declare const enum MediaInteractions {
440
- Play = 0,
441
- Pause = 1,
442
- Seeked = 2,
443
- VolumeChange = 3,
444
- RateChange = 4
445
- }
446
- type mediaInteractionParam = {
447
- type: MediaInteractions;
448
- id: number;
449
- currentTime?: number;
450
- volume?: number;
451
- muted?: boolean;
452
- loop?: boolean;
453
- playbackRate?: number;
454
- };
455
- type mediaInteractionCallback = (p: mediaInteractionParam) => void;
456
- type DocumentDimension = {
457
- x: number;
458
- y: number;
459
- relativeScale: number;
460
- absoluteScale: number;
461
- };
462
- type SelectionRange = {
463
- start: number;
464
- startOffset: number;
465
- end: number;
466
- endOffset: number;
467
- };
468
- type selectionParam = {
469
- ranges: Array<SelectionRange>;
470
- };
471
- type selectionCallback = (p: selectionParam) => void;
472
- type customElementParam = {
473
- define?: {
474
- name: string;
475
- };
476
- };
477
- type customElementCallback = (c: customElementParam) => void;
478
- type DeprecatedMirror = {
479
- map: {
480
- [key: number]: INode;
481
- };
482
- getId: (n: Node) => number;
483
- getNode: (id: number) => INode | null;
484
- removeNodeFromMap: (n: Node) => void;
485
- has: (id: number) => boolean;
486
- reset: () => void;
487
- };
488
- type throttleOptions = {
489
- leading?: boolean;
490
- trailing?: boolean;
491
- };
492
- type listenerHandler = () => void;
493
- type hookResetter = () => void;
494
- type playerMetaData = {
495
- startTime: number;
496
- endTime: number;
497
- totalTime: number;
498
- };
499
- type actionWithDelay = {
500
- doAction: () => void;
501
- delay: number;
502
- };
503
- type Handler = (event?: unknown) => void;
504
- type Emitter$1 = {
505
- on(type: string, handler: Handler): void;
506
- emit(type: string, event?: unknown): void;
507
- off(type: string, handler: Handler): void;
508
- };
509
- declare enum ReplayerEvents {
510
- Start = "start",
511
- Pause = "pause",
512
- Resume = "resume",
513
- Resize = "resize",
514
- Finish = "finish",
515
- FullsnapshotRebuilded = "fullsnapshot-rebuilded",
516
- LoadStylesheetStart = "load-stylesheet-start",
517
- LoadStylesheetEnd = "load-stylesheet-end",
518
- SkipStart = "skip-start",
519
- SkipEnd = "skip-end",
520
- MouseInteraction = "mouse-interaction",
521
- EventCast = "event-cast",
522
- CustomEvent = "custom-event",
523
- Flush = "flush",
524
- StateChange = "state-change",
525
- PlayBack = "play-back",
526
- Destroy = "destroy"
527
- }
528
- type KeepIframeSrcFn = (src: string) => boolean;
529
- declare global {
530
- interface Window {
531
- FontFace: typeof FontFace;
532
- }
533
- }
534
- type IWindow = Window & typeof globalThis;
535
-
536
- type PackFn = (event: eventWithTime) => string;
537
- type UnpackFn = (raw: string) => eventWithTime;
538
-
539
- interface IRRNode {
540
- parentElement: IRRNode | null;
541
- parentNode: IRRNode | null;
542
- ownerDocument: IRRDocument;
543
- readonly childNodes: IRRNode[];
544
- readonly ELEMENT_NODE: number;
545
- readonly TEXT_NODE: number;
546
- readonly nodeType: number;
547
- readonly nodeName: string;
548
- readonly RRNodeType: NodeType;
549
- firstChild: IRRNode | null;
550
- lastChild: IRRNode | null;
551
- previousSibling: IRRNode | null;
552
- nextSibling: IRRNode | null;
553
- textContent: string | null;
554
- contains(node: IRRNode): boolean;
555
- appendChild(newChild: IRRNode): IRRNode;
556
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
557
- removeChild(node: IRRNode): IRRNode;
558
- toString(): string;
559
- }
560
- interface IRRDocument extends IRRNode {
561
- documentElement: IRRElement | null;
562
- body: IRRElement | null;
563
- head: IRRElement | null;
564
- implementation: IRRDocument;
565
- firstElementChild: IRRElement | null;
566
- readonly nodeName: '#document';
567
- compatMode: 'BackCompat' | 'CSS1Compat';
568
- createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): IRRDocument;
569
- createDocumentType(qualifiedName: string, publicId: string, systemId: string): IRRDocumentType;
570
- createElement(tagName: string): IRRElement;
571
- createElementNS(_namespaceURI: string, qualifiedName: string): IRRElement;
572
- createTextNode(data: string): IRRText;
573
- createComment(data: string): IRRComment;
574
- createCDATASection(data: string): IRRCDATASection;
575
- open(): void;
576
- close(): void;
577
- write(content: string): void;
578
- }
579
- 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;
580
35
  tagName: string;
581
- attributes: Record<string, string>;
582
- shadowRoot: IRRElement | null;
583
- scrollLeft?: number;
584
- scrollTop?: number;
585
- id: string;
586
- className: string;
587
- classList: ClassList;
588
- style: CSSStyleDeclaration;
589
- attachShadow(init: ShadowRootInit): IRRElement;
590
- getAttribute(name: string): string | null;
591
- setAttribute(name: string, attribute: string): void;
592
- setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
593
- removeAttribute(name: string): void;
594
- dispatchEvent(event: Event): boolean;
595
- }
596
- interface IRRDocumentType extends IRRNode {
597
- readonly name: string;
598
- readonly publicId: string;
599
- readonly systemId: string;
600
- }
601
- interface IRRText extends IRRNode {
602
- readonly nodeName: '#text';
603
- data: string;
604
- }
605
- interface IRRComment extends IRRNode {
606
- readonly nodeName: '#comment';
607
- data: string;
608
- }
609
- interface IRRCDATASection extends IRRNode {
610
- readonly nodeName: '#cdata-section';
611
- 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;
612
54
  }
613
- declare class BaseRRNode implements IRRNode {
614
- parentElement: IRRNode | null;
615
- parentNode: IRRNode | null;
616
- ownerDocument: IRRDocument;
617
- firstChild: IRRNode | null;
618
- lastChild: IRRNode | null;
619
- previousSibling: IRRNode | null;
620
- nextSibling: IRRNode | null;
621
- textContent: string | null;
622
- readonly ELEMENT_NODE: number;
623
- readonly TEXT_NODE: number;
624
- readonly nodeType: number;
625
- readonly nodeName: string;
626
- readonly RRNodeType: NodeType;
627
- constructor(..._args: any[]);
628
- get childNodes(): IRRNode[];
629
- contains(node: IRRNode): boolean;
630
- appendChild(_newChild: IRRNode): IRRNode;
631
- insertBefore(_newChild: IRRNode, _refChild: IRRNode | null): IRRNode;
632
- removeChild(_node: IRRNode): IRRNode;
633
- 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;
634
92
  }
635
- declare class ClassList {
636
- private onChange;
637
- classes: string[];
638
- constructor(classText?: string, onChange?: ((newClassText: string) => void) | undefined);
639
- add: (...classNames: string[]) => void;
640
- 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
641
101
  }
642
- type CSSStyleDeclaration = Record<string, string> & {
643
- setProperty: (name: string, value: string | null, priority?: string | null) => void;
644
- 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;
645
131
  };
646
132
 
647
- declare const RRDocument_base: {
648
- new (...args: any[]): {
649
- readonly nodeType: number;
650
- readonly nodeName: "#document";
651
- readonly compatMode: "BackCompat" | "CSS1Compat";
652
- readonly RRNodeType: NodeType.Document;
653
- readonly documentElement: IRRElement | null;
654
- readonly body: IRRElement | null;
655
- readonly head: IRRElement | null;
656
- readonly implementation: IRRDocument;
657
- readonly firstElementChild: IRRElement | null;
658
- appendChild(newChild: IRRNode): IRRNode;
659
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
660
- removeChild(node: IRRNode): IRRNode;
661
- open(): void;
662
- close(): void;
663
- write(content: string): void;
664
- createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null | undefined): IRRDocument;
665
- createDocumentType(qualifiedName: string, publicId: string, systemId: string): IRRDocumentType;
666
- createElement(tagName: string): IRRElement;
667
- createElementNS(_namespaceURI: string, qualifiedName: string): IRRElement;
668
- createTextNode(data: string): IRRText;
669
- createComment(data: string): IRRComment;
670
- createCDATASection(data: string): IRRCDATASection;
671
- toString(): string;
672
- parentElement: IRRNode | null;
673
- parentNode: IRRNode | null;
674
- ownerDocument: IRRDocument;
675
- readonly childNodes: IRRNode[];
676
- readonly ELEMENT_NODE: number;
677
- readonly TEXT_NODE: number;
678
- firstChild: IRRNode | null;
679
- lastChild: IRRNode | null;
680
- previousSibling: IRRNode | null;
681
- nextSibling: IRRNode | null;
682
- textContent: string | null;
683
- 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;
684
157
  };
685
- } & typeof BaseRRNode;
686
- declare class RRDocument extends RRDocument_base {
687
- private UNSERIALIZED_STARTING_ID;
688
- private _unserializedId;
689
- get unserializedId(): number;
690
- mirror: Mirror;
691
- scrollData: scrollData | null;
692
- constructor(mirror?: Mirror);
693
- createDocument(_namespace: string | null, _qualifiedName: string | null, _doctype?: DocumentType | null): RRDocument;
694
- createDocumentType(qualifiedName: string, publicId: string, systemId: string): {
695
- readonly nodeType: number;
696
- readonly RRNodeType: NodeType.DocumentType;
697
- readonly nodeName: string;
698
- readonly name: string;
699
- readonly publicId: string;
700
- readonly systemId: string;
701
- toString(): string;
702
- parentElement: IRRNode | null;
703
- parentNode: IRRNode | null;
704
- ownerDocument: IRRDocument;
705
- readonly childNodes: IRRNode[];
706
- readonly ELEMENT_NODE: number;
707
- readonly TEXT_NODE: number;
708
- firstChild: IRRNode | null;
709
- lastChild: IRRNode | null;
710
- previousSibling: IRRNode | null;
711
- nextSibling: IRRNode | null;
712
- textContent: string | null;
713
- contains(node: IRRNode): boolean;
714
- appendChild(newChild: IRRNode): IRRNode;
715
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
716
- removeChild(node: IRRNode): IRRNode;
717
- } & BaseRRNode;
718
- createElement<K extends keyof HTMLElementTagNameMap>(tagName: K): RRElementType<K>;
719
- createElement(tagName: string): RRElement;
720
- createComment(data: string): {
721
- readonly nodeType: number;
722
- readonly nodeName: "#comment";
723
- readonly RRNodeType: NodeType.Comment;
724
- data: string;
725
- textContent: string;
726
- toString(): string;
727
- parentElement: IRRNode | null;
728
- parentNode: IRRNode | null;
729
- ownerDocument: IRRDocument;
730
- readonly childNodes: IRRNode[];
731
- readonly ELEMENT_NODE: number;
732
- readonly TEXT_NODE: number;
733
- firstChild: IRRNode | null;
734
- lastChild: IRRNode | null;
735
- previousSibling: IRRNode | null;
736
- nextSibling: IRRNode | null;
737
- contains(node: IRRNode): boolean;
738
- appendChild(newChild: IRRNode): IRRNode;
739
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
740
- removeChild(node: IRRNode): IRRNode;
741
- } & BaseRRNode;
742
- createCDATASection(data: string): {
743
- readonly nodeName: "#cdata-section";
744
- readonly nodeType: number;
745
- readonly RRNodeType: NodeType.CDATA;
746
- data: string;
747
- textContent: string;
748
- toString(): string;
749
- parentElement: IRRNode | null;
750
- parentNode: IRRNode | null;
751
- ownerDocument: IRRDocument;
752
- readonly childNodes: IRRNode[];
753
- readonly ELEMENT_NODE: number;
754
- readonly TEXT_NODE: number;
755
- firstChild: IRRNode | null;
756
- lastChild: IRRNode | null;
757
- previousSibling: IRRNode | null;
758
- nextSibling: IRRNode | null;
759
- contains(node: IRRNode): boolean;
760
- appendChild(newChild: IRRNode): IRRNode;
761
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
762
- removeChild(node: IRRNode): IRRNode;
763
- } & BaseRRNode;
764
- createTextNode(data: string): {
765
- readonly nodeType: number;
766
- readonly nodeName: "#text";
767
- readonly RRNodeType: NodeType.Text;
768
- data: string;
769
- textContent: string;
770
- toString(): string;
771
- parentElement: IRRNode | null;
772
- parentNode: IRRNode | null;
773
- ownerDocument: IRRDocument;
774
- readonly childNodes: IRRNode[];
775
- readonly ELEMENT_NODE: number;
776
- readonly TEXT_NODE: number;
777
- firstChild: IRRNode | null;
778
- lastChild: IRRNode | null;
779
- previousSibling: IRRNode | null;
780
- nextSibling: IRRNode | null;
781
- contains(node: IRRNode): boolean;
782
- appendChild(newChild: IRRNode): IRRNode;
783
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
784
- removeChild(node: IRRNode): IRRNode;
785
- } & BaseRRNode;
786
- destroyTree(): void;
787
- open(): void;
158
+ };
159
+
160
+ declare type blockClass = string | RegExp;
161
+
162
+ declare enum CanvasContext {
163
+ '2D' = 0,
164
+ WebGL = 1,
165
+ WebGL2 = 2
788
166
  }
789
- declare const RRElement_base: {
790
- new (tagName: string): {
791
- readonly nodeType: number;
792
- readonly RRNodeType: NodeType.Element;
793
- readonly nodeName: string;
794
- tagName: string;
795
- attributes: Record<string, string>;
796
- shadowRoot: IRRElement | null;
797
- scrollLeft?: number | undefined;
798
- scrollTop?: number | undefined;
799
- textContent: string;
800
- readonly classList: ClassList;
801
- readonly id: string;
802
- readonly className: string;
803
- readonly style: CSSStyleDeclaration;
804
- getAttribute(name: string): string | null;
805
- setAttribute(name: string, attribute: string): void;
806
- setAttributeNS(_namespace: string | null, qualifiedName: string, value: string): void;
807
- removeAttribute(name: string): void;
808
- appendChild(newChild: IRRNode): IRRNode;
809
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
810
- removeChild(node: IRRNode): IRRNode;
811
- attachShadow(_init: ShadowRootInit): IRRElement;
812
- dispatchEvent(_event: Event): boolean;
813
- toString(): string;
814
- parentElement: IRRNode | null;
815
- parentNode: IRRNode | null;
816
- ownerDocument: IRRDocument;
817
- readonly childNodes: IRRNode[];
818
- readonly ELEMENT_NODE: number;
819
- readonly TEXT_NODE: number;
820
- firstChild: IRRNode | null;
821
- lastChild: IRRNode | null;
822
- previousSibling: IRRNode | null;
823
- nextSibling: IRRNode | null;
824
- 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;
825
198
  };
826
- } & typeof BaseRRNode;
827
- declare class RRElement extends RRElement_base {
828
- inputData: inputData | null;
829
- scrollData: scrollData | null;
830
- }
831
- declare const RRMediaElement_base: {
832
- new (...args: any[]): {
833
- currentTime?: number | undefined;
834
- volume?: number | undefined;
835
- paused?: boolean | undefined;
836
- muted?: boolean | undefined;
837
- playbackRate?: number | undefined;
838
- loop?: boolean | undefined;
839
- attachShadow(_init: ShadowRootInit): IRRElement;
840
- play(): void;
841
- pause(): void;
842
- tagName: string;
843
- attributes: Record<string, string>;
844
- shadowRoot: IRRElement | null;
845
- scrollLeft?: number | undefined;
846
- scrollTop?: number | undefined;
847
- id: string;
848
- className: string;
849
- classList: ClassList;
850
- style: CSSStyleDeclaration;
851
- getAttribute(name: string): string | null;
852
- setAttribute(name: string, attribute: string): void;
853
- setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
854
- removeAttribute(name: string): void;
855
- dispatchEvent(event: Event): boolean;
856
- parentElement: IRRNode | null;
857
- parentNode: IRRNode | null;
858
- ownerDocument: IRRDocument;
859
- readonly childNodes: IRRNode[];
860
- readonly ELEMENT_NODE: number;
861
- readonly TEXT_NODE: number;
862
- readonly nodeType: number;
863
- readonly nodeName: string;
864
- readonly RRNodeType: NodeType;
865
- firstChild: IRRNode | null;
866
- lastChild: IRRNode | null;
867
- previousSibling: IRRNode | null;
868
- nextSibling: IRRNode | null;
869
- textContent: string | null;
870
- contains(node: IRRNode): boolean;
871
- appendChild(newChild: IRRNode): IRRNode;
872
- insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode;
873
- removeChild(node: IRRNode): IRRNode;
874
- toString(): string;
199
+ };
200
+
201
+ declare type customEvent<T = unknown> = {
202
+ type: EventType.Custom;
203
+ data: {
204
+ tag: string;
205
+ payload: T;
875
206
  };
876
- } & typeof RRElement;
877
- declare class RRMediaElement extends RRMediaElement_base {
878
- }
879
- declare class RRCanvasElement extends RRElement implements IRRElement {
880
- rr_dataURL: string | null;
881
- canvasMutations: {
882
- event: canvasEventWithTime;
883
- mutation: canvasMutationData;
884
- }[];
885
- 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
886
222
  }
887
- declare class RRStyleElement extends RRElement {
888
- 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;
889
277
  }
890
- declare class RRIFrameElement extends RRElement {
891
- contentDocument: RRDocument;
892
- 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
893
304
  }
894
- interface RRElementTagNameMap {
895
- audio: RRMediaElement;
896
- canvas: RRCanvasElement;
897
- iframe: RRIFrameElement;
898
- style: RRStyleElement;
899
- 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
900
356
  }
901
- type RRElementType<K extends keyof HTMLElementTagNameMap> = K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement;
902
- declare class Mirror implements IMirror<BaseRRNode> {
903
- private idNodeMap;
904
- private nodeMetaMap;
905
- getId(n: BaseRRNode | undefined | null): number;
906
- getNode(id: number): BaseRRNode | null;
907
- getIds(): number[];
908
- getMeta(n: BaseRRNode): serializedNodeWithId | null;
909
- removeNodeFromMap(n: BaseRRNode): void;
910
- has(id: number): boolean;
911
- hasNode(node: BaseRRNode): boolean;
912
- add(n: BaseRRNode, meta: serializedNodeWithId): void;
913
- replace(id: number, n: BaseRRNode): void;
914
- reset(): void;
915
- }
916
-
917
- declare function on(type: string, fn: EventListenerOrEventListenerObject, target?: Document | IWindow): listenerHandler;
918
- declare let _mirror: DeprecatedMirror;
919
- declare function throttle<T>(func: (arg: T) => void, wait: number, options?: throttleOptions): (...args: T[]) => void;
920
- declare function hookSetter<T>(target: T, key: string | number | symbol, d: PropertyDescriptor, isRevoked?: boolean, win?: Window & typeof globalThis): hookResetter;
921
- declare function patch(source: {
922
- [key: string]: any;
923
- }, name: string, replacement: (...args: unknown[]) => unknown): () => void;
924
- declare let nowTimestamp: () => number;
925
-
926
- declare function getWindowScroll(win: Window): {
927
- left: number;
928
- top: number;
929
- };
930
- declare function getWindowHeight(): number;
931
- declare function getWindowWidth(): number;
932
- declare function isBlocked(node: Node | null, blockClass: blockClass, blockSelector: string | null, checkAncestors: boolean): boolean;
933
- declare function isSerialized(n: Node, mirror: Mirror$1): boolean;
934
- declare function isIgnored(n: Node, mirror: Mirror$1): boolean;
935
- declare function isAncestorRemoved(target: Node, mirror: Mirror$1): boolean;
936
- declare function legacy_isTouchEvent(event: MouseEvent | TouchEvent | PointerEvent): event is TouchEvent;
937
- declare function polyfill(win?: Window & typeof globalThis): void;
938
- type ResolveTree = {
939
- value: addedNodeMutation;
940
- children: ResolveTree[];
941
- parent: ResolveTree | null;
942
- };
943
- declare function queueToResolveTrees(queue: addedNodeMutation[]): ResolveTree[];
944
- declare function iterateResolveTree(tree: ResolveTree, cb: (mutation: addedNodeMutation) => unknown): void;
945
- type AppendedIframe = {
946
- mutationInQueue: addedNodeMutation;
947
- builtNode: HTMLIFrameElement | RRIFrameElement;
948
- };
949
- declare function isSerializedIframe<TNode extends Node | BaseRRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
950
- declare function isSerializedStylesheet<TNode extends Node | BaseRRNode>(n: TNode, mirror: IMirror<TNode>): boolean;
951
- declare function getBaseDimension(node: Node, rootIframe: Node): DocumentDimension;
952
- declare function hasShadowRoot<T extends Node | BaseRRNode>(n: T): n is T & {
953
- shadowRoot: ShadowRoot;
954
- };
955
- declare function getNestedRule(rules: CSSRuleList, position: number[]): CSSGroupingRule;
956
- declare function getPositionsAndIndex(nestedIndex: number[]): {
957
- positions: number[];
958
- index: number | undefined;
959
- };
960
- declare function uniqueTextMutations(mutations: textMutation[]): textMutation[];
961
- declare class StyleSheetMirror {
962
- private id;
963
- private styleIDMap;
964
- private idStyleMap;
965
- getId(stylesheet: CSSStyleSheet): number;
966
- has(stylesheet: CSSStyleSheet): boolean;
967
- add(stylesheet: CSSStyleSheet, id?: number): number;
968
- getStyle(id: number): CSSStyleSheet | null;
969
- reset(): void;
970
- generateId(): number;
971
- }
972
- declare function getShadowHost(n: Node): Element | null;
973
- declare function getRootShadowHost(n: Node): Node;
974
- declare function shadowHostInDom(n: Node): boolean;
975
- declare function inDom(n: Node): boolean;
976
-
977
- type utils_d_AppendedIframe = AppendedIframe;
978
- type utils_d_StyleSheetMirror = StyleSheetMirror;
979
- declare const utils_d_StyleSheetMirror: typeof StyleSheetMirror;
980
- declare const utils_d__mirror: typeof _mirror;
981
- declare const utils_d_getBaseDimension: typeof getBaseDimension;
982
- declare const utils_d_getNestedRule: typeof getNestedRule;
983
- declare const utils_d_getPositionsAndIndex: typeof getPositionsAndIndex;
984
- declare const utils_d_getRootShadowHost: typeof getRootShadowHost;
985
- declare const utils_d_getShadowHost: typeof getShadowHost;
986
- declare const utils_d_getWindowHeight: typeof getWindowHeight;
987
- declare const utils_d_getWindowScroll: typeof getWindowScroll;
988
- declare const utils_d_getWindowWidth: typeof getWindowWidth;
989
- declare const utils_d_hasShadowRoot: typeof hasShadowRoot;
990
- declare const utils_d_hookSetter: typeof hookSetter;
991
- declare const utils_d_inDom: typeof inDom;
992
- declare const utils_d_isAncestorRemoved: typeof isAncestorRemoved;
993
- declare const utils_d_isBlocked: typeof isBlocked;
994
- declare const utils_d_isIgnored: typeof isIgnored;
995
- declare const utils_d_isSerialized: typeof isSerialized;
996
- declare const utils_d_isSerializedIframe: typeof isSerializedIframe;
997
- declare const utils_d_isSerializedStylesheet: typeof isSerializedStylesheet;
998
- declare const utils_d_iterateResolveTree: typeof iterateResolveTree;
999
- declare const utils_d_legacy_isTouchEvent: typeof legacy_isTouchEvent;
1000
- declare const utils_d_nowTimestamp: typeof nowTimestamp;
1001
- declare const utils_d_on: typeof on;
1002
- declare const utils_d_patch: typeof patch;
1003
- declare const utils_d_polyfill: typeof polyfill;
1004
- declare const utils_d_queueToResolveTrees: typeof queueToResolveTrees;
1005
- declare const utils_d_shadowHostInDom: typeof shadowHostInDom;
1006
- declare const utils_d_throttle: typeof throttle;
1007
- declare const utils_d_uniqueTextMutations: typeof uniqueTextMutations;
1008
- declare namespace utils_d {
1009
- export { type utils_d_AppendedIframe as AppendedIframe, utils_d_StyleSheetMirror as StyleSheetMirror, utils_d__mirror as _mirror, utils_d_getBaseDimension as getBaseDimension, utils_d_getNestedRule as getNestedRule, utils_d_getPositionsAndIndex as getPositionsAndIndex, utils_d_getRootShadowHost as getRootShadowHost, utils_d_getShadowHost as getShadowHost, utils_d_getWindowHeight as getWindowHeight, utils_d_getWindowScroll as getWindowScroll, utils_d_getWindowWidth as getWindowWidth, utils_d_hasShadowRoot as hasShadowRoot, utils_d_hookSetter as hookSetter, utils_d_inDom as inDom, utils_d_isAncestorRemoved as isAncestorRemoved, utils_d_isBlocked as isBlocked, utils_d_isIgnored as isIgnored, utils_d_isSerialized as isSerialized, utils_d_isSerializedIframe as isSerializedIframe, utils_d_isSerializedStylesheet as isSerializedStylesheet, utils_d_iterateResolveTree as iterateResolveTree, utils_d_legacy_isTouchEvent as legacy_isTouchEvent, utils_d_nowTimestamp as nowTimestamp, utils_d_on as on, utils_d_patch as patch, utils_d_polyfill as polyfill, utils_d_queueToResolveTrees as queueToResolveTrees, utils_d_shadowHostInDom as shadowHostInDom, utils_d_throttle as throttle, utils_d_uniqueTextMutations as uniqueTextMutations };
1010
- }
1011
-
1012
- declare class Timer {
1013
- timeOffset: number;
1014
- speed: number;
1015
- private actions;
1016
- private raf;
1017
- private lastTimestamp;
1018
- constructor(actions: actionWithDelay[] | undefined, config: {
1019
- speed: number;
1020
- });
1021
- addAction(action: actionWithDelay): void;
1022
- start(): void;
1023
- private rafCheck;
1024
- clear(): void;
1025
- setSpeed(speed: number): void;
1026
- isActive(): boolean;
1027
- private findActionIndex;
1028
- }
1029
-
1030
- declare enum InterpreterStatus {
1031
- NotStarted = 0,
1032
- Running = 1,
1033
- 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
1034
393
  }
1035
- declare type SingleOrArray<T> = T[] | T;
1036
- interface EventObject {
1037
- 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
1038
437
  }
1039
- declare type InitEvent = {
1040
- 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;
1041
477
  };
1042
- declare namespace StateMachine {
1043
- type Action<TContext extends object, TEvent extends EventObject> = string | AssignActionObject<TContext, TEvent> | ActionObject<TContext, TEvent> | ActionFunction<TContext, TEvent>;
1044
- type ActionMap<TContext extends object, TEvent extends EventObject> = Record<string, Exclude<Action<TContext, TEvent>, string>>;
1045
- interface ActionObject<TContext extends object, TEvent extends EventObject> {
1046
- type: string;
1047
- exec?: ActionFunction<TContext, TEvent>;
1048
- [key: string]: any;
1049
- }
1050
- type ActionFunction<TContext extends object, TEvent extends EventObject> = (context: TContext, event: TEvent | InitEvent) => void;
1051
- type AssignAction = 'xstate.assign';
1052
- interface AssignActionObject<TContext extends object, TEvent extends EventObject> extends ActionObject<TContext, TEvent> {
1053
- type: AssignAction;
1054
- assignment: Assigner<TContext, TEvent> | PropertyAssigner<TContext, TEvent>;
1055
- }
1056
- type Transition<TContext extends object, TEvent extends EventObject> = string | {
1057
- target?: string;
1058
- actions?: SingleOrArray<Action<TContext, TEvent>>;
1059
- cond?: (context: TContext, event: TEvent) => boolean;
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;
494
+ };
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;
1060
510
  };
1061
- interface State<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext>> {
1062
- value: TState['value'];
1063
- context: TContext;
1064
- actions: Array<ActionObject<TContext, TEvent>>;
1065
- changed?: boolean | undefined;
1066
- matches: <TSV extends TState['value']>(value: TSV) => this is TState extends {
1067
- value: TSV;
1068
- } ? TState & {
1069
- value: TSV;
1070
- } : never;
1071
- }
1072
- type AnyState = State<any, any, any>;
1073
- interface Config<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext> = {
1074
- value: any;
1075
- context: TContext;
1076
- }> {
1077
- id?: string;
1078
- initial: string;
1079
- context?: TContext;
1080
- states: {
1081
- [key in TState['value']]: {
1082
- on?: {
1083
- [K in TEvent['type']]?: SingleOrArray<Transition<TContext, TEvent extends {
1084
- type: K;
1085
- } ? TEvent : never>>;
1086
- };
1087
- exit?: SingleOrArray<Action<TContext, TEvent>>;
1088
- entry?: SingleOrArray<Action<TContext, TEvent>>;
1089
- };
1090
- };
1091
- }
1092
- interface Machine<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext>> {
1093
- config: StateMachine.Config<TContext, TEvent, TState>;
1094
- initialState: State<TContext, TEvent, TState>;
1095
- transition: (state: string | State<TContext, TEvent, TState>, event: TEvent['type'] | TEvent) => State<TContext, TEvent, TState>;
1096
- }
1097
- type StateListener<T extends AnyState> = (state: T) => void;
1098
- interface Service<TContext extends object, TEvent extends EventObject, TState extends Typestate<TContext> = {
1099
- value: any;
1100
- context: TContext;
1101
- }> {
1102
- send: (event: TEvent | TEvent['type']) => void;
1103
- subscribe: (listener: StateListener<State<TContext, TEvent, TState>>) => {
1104
- unsubscribe: () => void;
1105
- };
1106
- start: (initialState?: TState['value'] | {
1107
- context: TContext;
1108
- value: TState['value'];
1109
- }) => Service<TContext, TEvent, TState>;
1110
- stop: () => Service<TContext, TEvent, TState>;
1111
- readonly status: InterpreterStatus;
1112
- readonly state: State<TContext, TEvent, TState>;
1113
- }
1114
- type Assigner<TContext extends object, TEvent extends EventObject> = (context: TContext, event: TEvent) => Partial<TContext>;
1115
- type PropertyAssigner<TContext extends object, TEvent extends EventObject> = {
1116
- [K in keyof TContext]?: ((context: TContext, event: TEvent) => TContext[K]) | TContext[K];
511
+ remove?: {
512
+ property: string;
1117
513
  };
1118
- }
1119
- interface Typestate<TContext extends object> {
1120
- value: string;
1121
- context: TContext;
1122
- }
1123
-
1124
- type PlayerContext = {
1125
- events: eventWithTime[];
1126
- timer: Timer;
1127
- timeOffset: number;
1128
- baselineTime: number;
1129
- lastPlayedEvent: eventWithTime | null;
1130
- };
1131
- type PlayerEvent = {
1132
- type: 'PLAY';
1133
- payload: {
1134
- timeOffset: number;
1135
- };
1136
- } | {
1137
- type: 'CAST_EVENT';
1138
- payload: {
1139
- event: eventWithTime;
1140
- };
1141
- } | {
1142
- type: 'PAUSE';
1143
- } | {
1144
- type: 'TO_LIVE';
1145
- payload: {
1146
- baselineTime?: number;
1147
- };
1148
- } | {
1149
- type: 'ADD_EVENT';
1150
- payload: {
1151
- event: eventWithTime;
1152
- };
1153
- } | {
1154
- type: 'END';
1155
- };
1156
- type PlayerState = {
1157
- value: 'playing';
1158
- context: PlayerContext;
1159
- } | {
1160
- value: 'paused';
1161
- context: PlayerContext;
1162
- } | {
1163
- value: 'live';
1164
- context: PlayerContext;
1165
- };
1166
- type PlayerAssets = {
1167
- emitter: Emitter$1;
1168
- applyEventsSynchronously(events: Array<eventWithTime>): void;
1169
- getCastFn(event: eventWithTime, isSync: boolean): () => void;
1170
- };
1171
- declare function createPlayerService(context: PlayerContext, { getCastFn, applyEventsSynchronously, emitter }: PlayerAssets): StateMachine.Service<PlayerContext, PlayerEvent, PlayerState>;
1172
- type SpeedContext = {
1173
- normalSpeed: playerConfig['speed'];
1174
- timer: Timer;
1175
- };
1176
- type SpeedEvent = {
1177
- type: 'FAST_FORWARD';
1178
- payload: {
1179
- speed: playerConfig['speed'];
1180
- };
1181
- } | {
1182
- type: 'BACK_TO_NORMAL';
1183
- } | {
1184
- type: 'SET_SPEED';
1185
- payload: {
1186
- speed: playerConfig['speed'];
1187
- };
1188
- };
1189
- type SpeedState = {
1190
- value: 'normal';
1191
- context: SpeedContext;
1192
- } | {
1193
- value: 'skipping';
1194
- context: SpeedContext;
1195
- };
1196
- 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
+
1197
562
 
1198
- declare class Replayer {
1199
- wrapper: HTMLDivElement;
1200
- iframe: HTMLIFrameElement;
1201
- service: ReturnType<typeof createPlayerService>;
1202
- speedService: ReturnType<typeof createSpeedService>;
1203
- get timer(): Timer;
1204
- config: playerConfig;
1205
- usingVirtualDom: boolean;
1206
- virtualDom: RRDocument;
1207
- private mouse;
1208
- private mouseTail;
1209
- private tailPositions;
1210
- private emitter;
1211
- private nextUserInteractionEvent;
1212
- private legacy_missingNodeRetryMap;
1213
- private cache;
1214
- private imageMap;
1215
- private canvasEventMap;
1216
- private mirror;
1217
- private styleMirror;
1218
- private firstFullSnapshot;
1219
- private newDocumentQueue;
1220
- private mousePos;
1221
- private touchActive;
1222
- private lastMouseDownEvent;
1223
- private lastHoveredRootNode;
1224
- private lastSelectionData;
1225
- private constructedStyleMutations;
1226
- private adoptedStyleSheets;
1227
- constructor(events: Array<eventWithTime | string>, config?: Partial<playerConfig>);
1228
- on(event: string, handler: Handler): this;
1229
- off(event: string, handler: Handler): this;
1230
- setConfig(config: Partial<playerConfig>): void;
1231
- getMetaData(): playerMetaData;
1232
- getCurrentTime(): number;
1233
- getTimeOffset(): number;
1234
- getMirror(): Mirror$1;
1235
- play(timeOffset?: number): void;
1236
- pause(timeOffset?: number): void;
1237
- resume(timeOffset?: number): void;
1238
- destroy(): void;
1239
- startLive(baselineTime?: number): void;
1240
- addEvent(rawEvent: eventWithTime | string): void;
1241
- enableInteract(): void;
1242
- disableInteract(): void;
1243
- resetCache(): void;
1244
- private setupDom;
1245
- private handleResize;
1246
- private applyEventsSynchronously;
1247
- private getCastFn;
1248
- private rebuildFullSnapshot;
1249
- private insertStyleRules;
1250
- private attachDocumentToIframe;
1251
- private collectIframeAndAttachDocument;
1252
- private waitForStylesheetLoad;
1253
- private preloadAllImages;
1254
- private preloadImages;
1255
- private deserializeAndPreloadCanvasEvents;
1256
- private applyIncremental;
1257
- private applyMutation;
1258
- private applyScroll;
1259
- private applyInput;
1260
- private applySelection;
1261
- private applyStyleSheetMutation;
1262
- private applyStyleSheetRule;
1263
- private applyStyleDeclaration;
1264
- private applyAdoptedStyleSheet;
1265
- private legacy_resolveMissingNode;
1266
- private moveAndHover;
1267
- private drawMouseTail;
1268
- private hoverElements;
1269
- private isUserInteraction;
1270
- private backToNormal;
1271
- private warnNodeNotFound;
1272
- private warnCanvasMutationFailed;
1273
- private debugNodeNotFound;
1274
- private warn;
1275
- private debug;
1276
- }
1277
563
 
1278
- type recordOptions<T> = {
1279
- emit?: (e: T, isCheckout?: boolean) => void;
1280
- checkoutEveryNth?: number;
1281
- checkoutEveryNms?: number;
1282
- blockClass?: blockClass;
1283
- blockSelector?: string;
1284
- ignoreClass?: string;
1285
- ignoreSelector?: string;
1286
- maskTextClass?: maskTextClass;
1287
- maskTextSelector?: string;
1288
- maskAllInputs?: boolean;
1289
- maskInputOptions?: MaskInputOptions;
1290
- maskInputFn?: MaskInputFn;
1291
- maskTextFn?: MaskTextFn;
1292
- slimDOMOptions?: SlimDOMOptions | 'all' | true;
1293
- ignoreCSSAttributes?: Set<string>;
1294
- inlineStylesheet?: boolean;
1295
- hooks?: hooksParam;
1296
- packFn?: PackFn;
1297
- sampling?: SamplingStrategy;
1298
- dataURLOptions?: DataURLOptions;
1299
- recordCanvas?: boolean;
1300
- recordCrossOriginIframes?: boolean;
1301
- recordAfter?: 'DOMContentLoaded' | 'load';
1302
- userTriggeredOnInput?: boolean;
1303
- collectFonts?: boolean;
1304
- inlineImages?: boolean;
1305
- plugins?: RecordPlugin[];
1306
- mousemoveWait?: number;
1307
- keepIframeSrcFn?: KeepIframeSrcFn;
1308
- errorHandler?: ErrorHandler;
1309
- };
1310
- type ReplayPlugin = {
1311
- handler?: (event: eventWithTime, isSync: boolean, context: {
1312
- replayer: Replayer;
1313
- }) => void;
1314
- onBuild?: (node: Node | BaseRRNode, context: {
1315
- id: number;
1316
- replayer: Replayer;
1317
- }) => void;
1318
- getMirror?: (mirrors: {
1319
- nodeMirror: Mirror$1;
1320
- }) => void;
1321
- };
1322
- type playerConfig = {
1323
- speed: number;
1324
- maxSpeed: number;
1325
- root: Element;
1326
- loadTimeout: number;
1327
- skipInactive: boolean;
1328
- showWarning: boolean;
1329
- showDebug: boolean;
1330
- blockClass: string;
1331
- liveMode: boolean;
1332
- insertStyleRules: string[];
1333
- triggerFocus: boolean;
1334
- UNSAFE_replayCanvas: boolean;
1335
- pauseAnimation?: boolean;
1336
- mouseTail: boolean | {
1337
- duration?: number;
1338
- lineCap?: string;
1339
- lineWidth?: number;
1340
- strokeStyle?: string;
1341
- };
1342
- unpackFn?: UnpackFn;
1343
- useVirtualDom: boolean;
1344
- logger: {
1345
- log: (...args: Parameters<typeof console.log>) => void;
1346
- warn: (...args: Parameters<typeof console.warn>) => void;
1347
- };
1348
- plugins?: ReplayPlugin[];
1349
- };
1350
564
  declare global {
1351
565
  interface Window {
1352
566
  FontFace: typeof FontFace;
1353
567
  }
1354
568
  }
1355
- type ErrorHandler = (error: unknown) => void | boolean;
1356
569
 
1357
- 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
+
1358
617
  declare namespace record {
1359
618
  var addCustomEvent: <T>(tag: string, payload: T) => void;
1360
619
  var freezePage: () => void;
1361
620
  var takeFullSnapshot: (isCheckout?: boolean | undefined) => void;
1362
- var mirror: Mirror$1;
621
+ var mirror: Mirror;
1363
622
  }
1364
623
 
1365
- declare const addCustomEvent: <T>(tag: string, payload: T) => void;
1366
- declare const freezePage: () => void;
1367
-
1368
- declare const pack: PackFn;
1369
-
1370
- declare const unpack: UnpackFn;
1371
-
1372
- type StringifyOptions = {
1373
- stringLengthLimit?: number;
1374
- numOfKeysLimit: number;
1375
- depthOfLimit: number;
1376
- };
1377
- type LogRecordOptions = {
1378
- level?: LogLevel$1[];
1379
- lengthThreshold?: number;
1380
- stringifyOptions?: StringifyOptions;
1381
- logger?: Logger | 'console';
1382
- };
1383
- type LogData = {
1384
- level: LogLevel$1;
1385
- trace: string[];
1386
- payload: string[];
1387
- };
1388
- type Logger = {
1389
- assert?: typeof console.assert;
1390
- clear?: typeof console.clear;
1391
- count?: typeof console.count;
1392
- countReset?: typeof console.countReset;
1393
- debug?: typeof console.debug;
1394
- dir?: typeof console.dir;
1395
- dirxml?: typeof console.dirxml;
1396
- error?: typeof console.error;
1397
- group?: typeof console.group;
1398
- groupCollapsed?: typeof console.groupCollapsed;
1399
- groupEnd?: () => void;
1400
- info?: typeof console.info;
1401
- log?: typeof console.log;
1402
- table?: typeof console.table;
1403
- time?: typeof console.time;
1404
- timeEnd?: typeof console.timeEnd;
1405
- timeLog?: typeof console.timeLog;
1406
- trace?: typeof console.trace;
1407
- warn?: typeof console.warn;
1408
- };
1409
- type LogLevel$1 = keyof Logger;
1410
- declare const PLUGIN_NAME = "rrweb/console@1";
1411
- declare const getRecordConsolePlugin: (options?: LogRecordOptions) => RecordPlugin;
1412
624
 
1413
- type ReplayLogger = Partial<Record<LogLevel$1, (data: LogData) => void>>;
1414
- type LogReplayConfig = {
1415
- level?: LogLevel$1[];
1416
- replayLogger?: ReplayLogger;
1417
- };
1418
- declare const getReplayConsolePlugin: (options?: LogReplayConfig) => ReplayPlugin;
625
+ declare global {
626
+ interface Window {
627
+ FontFace: typeof FontFace;
628
+ Array: typeof Array;
629
+ }
630
+ }
1419
631
 
1420
- type rrweb_EventType = EventType;
1421
- declare const rrweb_EventType: typeof EventType;
1422
- type rrweb_IncrementalSource = IncrementalSource;
1423
- declare const rrweb_IncrementalSource: typeof IncrementalSource;
1424
- type rrweb_LogData = LogData;
1425
- type rrweb_Logger = Logger;
1426
- type rrweb_MouseInteractions = MouseInteractions;
1427
- declare const rrweb_MouseInteractions: typeof MouseInteractions;
1428
- declare const rrweb_PLUGIN_NAME: typeof PLUGIN_NAME;
1429
- type rrweb_Replayer = Replayer;
1430
- declare const rrweb_Replayer: typeof Replayer;
1431
- type rrweb_ReplayerEvents = ReplayerEvents;
1432
- declare const rrweb_ReplayerEvents: typeof ReplayerEvents;
1433
- type rrweb_StringifyOptions = StringifyOptions;
1434
- declare const rrweb_addCustomEvent: typeof addCustomEvent;
1435
- declare const rrweb_freezePage: typeof freezePage;
1436
- declare const rrweb_getRecordConsolePlugin: typeof getRecordConsolePlugin;
1437
- declare const rrweb_getReplayConsolePlugin: typeof getReplayConsolePlugin;
1438
- declare const rrweb_pack: typeof pack;
1439
- declare const rrweb_record: typeof record;
1440
- type rrweb_recordOptions<T> = recordOptions<T>;
1441
- declare const rrweb_unpack: typeof unpack;
1442
- declare namespace rrweb {
1443
- export { rrweb_EventType as EventType, rrweb_IncrementalSource as IncrementalSource, type rrweb_LogData as LogData, type LogLevel$1 as LogLevel, type rrweb_Logger as Logger, rrweb_MouseInteractions as MouseInteractions, rrweb_PLUGIN_NAME as PLUGIN_NAME, rrweb_Replayer as Replayer, rrweb_ReplayerEvents as ReplayerEvents, type rrweb_StringifyOptions as StringifyOptions, rrweb_addCustomEvent as addCustomEvent, rrweb_freezePage as freezePage, rrweb_getRecordConsolePlugin as getRecordConsolePlugin, rrweb_getReplayConsolePlugin as getReplayConsolePlugin, _mirror as mirror, rrweb_pack as pack, rrweb_record as record, type rrweb_recordOptions as recordOptions, rrweb_unpack as unpack, utils_d as utils };
632
+ declare const _rrweb_record_record: typeof record;
633
+ declare namespace _rrweb_record {
634
+ export { _rrweb_record_record as record };
1444
635
  }
1445
636
 
1446
637
  interface XhrResponse {
@@ -1875,6 +1066,7 @@ interface TextUrlPromptCard extends BaseCard {
1875
1066
  promptActionType: PromptActionType;
1876
1067
  required: boolean;
1877
1068
  richTextBody: RichTextBody;
1069
+ questionHtml?: string;
1878
1070
  };
1879
1071
  routingOptions: RoutingOptions;
1880
1072
  };
@@ -1900,6 +1092,7 @@ interface ConsentLegalCard extends BaseCard {
1900
1092
  richTextBody: RichTextBody;
1901
1093
  skipButtonText: string;
1902
1094
  submitButtonText: string;
1095
+ questionHtml?: string;
1903
1096
  };
1904
1097
  routingOptions: RoutingOptions;
1905
1098
  };
@@ -2066,6 +1259,7 @@ interface MatrixCard extends BaseCard {
2066
1259
  buttonText?: string;
2067
1260
  captionText: string;
2068
1261
  conceptUrl: ConceptUrl;
1262
+ displayMatrixAsAccordion?: boolean;
2069
1263
  matrixColumn: {
2070
1264
  label: string;
2071
1265
  value: string;
@@ -2152,6 +1346,7 @@ declare enum SprigEvent {
2152
1346
  FeedbackButtonLoaded = "feedback.button.loaded",
2153
1347
  SDKReady = "sdk.ready",
2154
1348
  SurveyAppeared = "survey.appeared",
1349
+ SurveyCloseRequested = "survey.closeRequested",//This event signals to mobile the survey overlay can close
2155
1350
  SurveyClosed = "survey.closed",
2156
1351
  SurveyDimensions = "survey.dimensions",
2157
1352
  SurveyFadingOut = "survey.fadingOut",
@@ -2256,6 +1451,7 @@ type SprigEventMap = {
2256
1451
  contentFrameHeight: number;
2257
1452
  contentFrameWidth: number;
2258
1453
  name: string;
1454
+ "survey.id": number;
2259
1455
  }
2260
1456
  ];
2261
1457
  [SprigEvent.SurveyClosed]: [
@@ -2263,6 +1459,7 @@ type SprigEventMap = {
2263
1459
  initiator?: string;
2264
1460
  name: string;
2265
1461
  studyType?: StudyType;
1462
+ "survey.id": number;
2266
1463
  }
2267
1464
  ];
2268
1465
  [SprigEvent.SurveyFadingOut]: [];
@@ -2270,12 +1467,14 @@ type SprigEventMap = {
2270
1467
  {
2271
1468
  name: string;
2272
1469
  contentFrameHeight: number;
1470
+ "survey.id": number;
2273
1471
  }
2274
1472
  ];
2275
1473
  [SprigEvent.SurveyWidth]: [
2276
1474
  {
2277
1475
  name: string;
2278
1476
  contentFrameWidth: number;
1477
+ "survey.id": number;
2279
1478
  }
2280
1479
  ];
2281
1480
  [SprigEvent.SurveyLifeCycle]: [{
@@ -2287,11 +1486,20 @@ type SprigEventMap = {
2287
1486
  "survey.id": number;
2288
1487
  }
2289
1488
  ];
1489
+ [SprigEvent.SurveyCloseRequested]: [
1490
+ {
1491
+ initiator: DismissReason;
1492
+ name?: string;
1493
+ studyType?: StudyType;
1494
+ "survey.id": number;
1495
+ }
1496
+ ];
2290
1497
  [SprigEvent.SurveyWillClose]: [
2291
1498
  {
2292
1499
  initiator: DismissReason;
2293
1500
  name?: string;
2294
1501
  studyType?: StudyType;
1502
+ "survey.id": number;
2295
1503
  }
2296
1504
  ];
2297
1505
  [SprigEvent.SurveyWillPresent]: [
@@ -2308,6 +1516,7 @@ type SprigEventMap = {
2308
1516
  answeredAt?: number;
2309
1517
  questionIndex?: number;
2310
1518
  value: unknown;
1519
+ "survey.id": number;
2311
1520
  }
2312
1521
  ];
2313
1522
  [SprigEvent.ReplayCapture]: [
@@ -2371,14 +1580,6 @@ type SprigEventMap = {
2371
1580
  declare const eventEmitter: Emitter<SprigEventMap>;
2372
1581
  type SprigEventEmitter = typeof eventEmitter;
2373
1582
 
2374
- declare const LogLevels: {
2375
- readonly Error: 1;
2376
- readonly Warn: 2;
2377
- readonly Info: 3;
2378
- readonly Debug: 4;
2379
- };
2380
- type LogLevel = (typeof LogLevels)[keyof typeof LogLevels];
2381
-
2382
1583
  type FramePosition = "bottomLeft" | "bottomRight" | "center" | "topLeft" | "topRight";
2383
1584
  type Platform = "email" | "link" | "web";
2384
1585
  type InstallationMethod = "web-npm" | "web-npm-bundled" | "web-gtm" | "web-segment" | "android-segment" | "react-native-segment" | "ios-segment" | "web-snippet";
@@ -2459,7 +1660,6 @@ interface Config extends MobileReplayConfig {
2459
1660
  isPreview?: boolean;
2460
1661
  launchDarklyEnabled?: boolean;
2461
1662
  locale: string;
2462
- logLevel?: LogLevel;
2463
1663
  logBufferLimit?: number;
2464
1664
  marketingUrl?: string;
2465
1665
  maxAttrNameLength: number;
@@ -2480,7 +1680,6 @@ interface Config extends MobileReplayConfig {
2480
1680
  previewKey?: string | null;
2481
1681
  previewMode?: boolean;
2482
1682
  productConfig?: AppProductConfig;
2483
- replayNonce?: string;
2484
1683
  replaySettings?: object;
2485
1684
  requireUserIdForTracking: boolean;
2486
1685
  responseGroupUid: UUID;
@@ -2727,6 +1926,7 @@ declare namespace sprigConfig {
2727
1926
  envId: string;
2728
1927
  error?: Error;
2729
1928
  feedbackCustomStyles?: string;
1929
+ forceDirectEmbed?: boolean;
2730
1930
  frameId: string;
2731
1931
  isMobileSDK?: boolean;
2732
1932
  loaded: boolean;
@@ -2736,9 +1936,14 @@ declare namespace sprigConfig {
2736
1936
  mobileHeadersJSON?: string;
2737
1937
  nonce?: string;
2738
1938
  partnerAnonymousId: string | null;
1939
+ pointerDownTarget?: EventTarget | null;
2739
1940
  replayLibraryURL?: string;
2740
- replayNonce?: string;
2741
- reportError: (name: string, err: Error, extraInfo?: object, bodyInfo?: object) => void;
1941
+ reportError: (
1942
+ name: string,
1943
+ err: Error,
1944
+ extraInfo?: object,
1945
+ bodyInfo?: object,
1946
+ ) => void;
2742
1947
  sampleRate?: number;
2743
1948
  token: string | null;
2744
1949
  upchunkLibraryURL?: string;
@@ -2750,14 +1955,7 @@ declare namespace sprigConfig {
2750
1955
  };
2751
1956
  };
2752
1957
  }
2753
- type ArgumentTypes<F> = F extends (...args: infer A) => unknown ? A : never;
2754
- type ArgumentType<T> = T extends (arg1: infer U, ...args: unknown[]) => unknown
2755
- ? U
2756
- : unknown;
2757
- type PublicOf<T> = { [K in keyof T]: T[K] };
2758
- type rrwebRecord = (typeof rrweb)["record"];
2759
- type rrwebCustomEvent = (typeof rrweb)["record"]["addCustomEvent"];
2760
- type rrwebFullSnapshot = (typeof rrweb)["record"]["takeFullSnapshot"];
1958
+
2761
1959
  declare global {
2762
1960
  interface Window {
2763
1961
  __cfg: Config;
@@ -2778,17 +1976,9 @@ declare global {
2778
1976
  _Sprig?: sprigConfig.WindowSprig;
2779
1977
  Sprig: sprigConfig.WindowSprig;
2780
1978
  UserLeap: sprigConfig.WindowSprig;
2781
- rrwebRecord?: {
2782
- addCustomEvent: (
2783
- ...args: ArgumentTypes<rrwebCustomEvent>
2784
- ) => PublicOf<ReturnType<rrwebCustomEvent>>;
2785
- takeFullSnapshot: (
2786
- ...args: ArgumentTypes<rrwebFullSnapshot>
2787
- ) => PublicOf<ReturnType<rrwebFullSnapshot>>;
2788
- } & ((
2789
- arg: Omit<ArgumentType<rrwebRecord>, "hooks">,
2790
- ) => PublicOf<ReturnType<rrwebRecord>>);
2791
- sprigAPI?: object;
1979
+ rrwebRecord?: (typeof _rrweb_record)["record"];
1980
+ sprigAPI?: { openUrl: (url: string) => void };
1981
+ SprigLoggerCallback?: (message: string) => void;
2792
1982
  }
2793
1983
 
2794
1984
  type WindowSprig = sprigConfig.WindowSprig;
@@ -2822,10 +2012,7 @@ declare class SprigAPI {
2822
2012
  SURVEY_DIMENSIONS: SprigEvent;
2823
2013
  SURVEY_FADING_OUT: SprigEvent;
2824
2014
  SURVEY_HEIGHT: SprigEvent;
2825
- SURVEY_WIDTH: SprigEvent; /**
2826
- * Track an event to show survey if eligible
2827
- * @param eventName name of event to track
2828
- */
2015
+ SURVEY_WIDTH: SprigEvent;
2829
2016
  SURVEY_PRESENTED: SprigEvent;
2830
2017
  SURVEY_LIFE_CYCLE: SprigEvent;
2831
2018
  SURVEY_WILL_CLOSE: SprigEvent;