@sprig-technologies/sprig-bundled 2.24.7 → 2.36.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,34 @@ 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
-
1012
+ type MultiChoiceSecondaryValueType = Record<string, {
1013
+ userText: string;
1014
+ }> | null;
2014
1015
  interface RecordedTaskResponseValueType {
2015
1016
  mediaRecordingUids?: string[] | null;
2016
1017
  taskDurationMillisecond?: number;
2017
1018
  taskStatus: TaskStatus;
2018
1019
  }
2019
- declare enum BooleanOperator {
2020
- And = 1,
2021
- Or = 2
2022
- }
1020
+ declare const BOOLEAN_OPERATOR: {
1021
+ readonly And: 1;
1022
+ readonly Or: 2;
1023
+ };
1024
+ type BooleanOperator = (typeof BOOLEAN_OPERATOR)[keyof typeof BOOLEAN_OPERATOR];
2023
1025
 
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
- }
1026
+ type CardType = "consentlegal" | "likert" | "matrix" | "multiplechoice" | "multipleselect" | "nps" | "open" | "rankorder" | "recordedtask" | "texturlprompt" | "thanks" | "uploading" | "videovoice";
2037
1027
  type ConceptUrl = string | null;
2038
1028
  interface BaseCard {
2039
1029
  name: number;
2040
1030
  surveyId: number;
2041
1031
  updatedAt: string;
2042
1032
  value?: unknown;
1033
+ type: CardType;
1034
+ groupId?: number;
1035
+ secondaryValue?: MultiChoiceSecondaryValueType | null;
2043
1036
  }
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;
1037
+ type Comparator = "answered" | "contains" | "notcontains" | "list_dni" | "eq" | "given_up" | "gt" | "gte" | "lt" | "lte" | "list_all" | "list_alo" | "list_exact" | "neq" | "partial" | "skipped";
1038
+ type Randomize = "none" | "all";
1039
+ type DefaultComparator = Extract<Comparator, "answered" | "skipped">;
2062
1040
  type RoutingOption<C extends Comparator = DefaultComparator> = OldRoutingOption<C> | GroupRoutingOption;
2063
1041
  type OldRoutingOption<C extends Comparator = DefaultComparator> = {
2064
1042
  comparator: C;
@@ -2080,10 +1058,12 @@ type RoutingGroupOption = {
2080
1058
  type RoutingOptions<C extends Comparator = DefaultComparator> = RoutingOption<C | DefaultComparator>[] | null;
2081
1059
  /** @example <p>Body</p> */
2082
1060
  type RichTextBody = string;
2083
- declare const enum PromptActionType {
2084
- Continue = "CONTINUE",
2085
- External = "EXTERNAL"
1061
+ declare enum PromptActionTypeEnum {
1062
+ CONTINUE = "CONTINUE",
1063
+ EXTERNAL = "EXTERNAL",
1064
+ NO_BUTTON = "NO_BUTTON"
2086
1065
  }
1066
+ type PromptActionType = keyof typeof PromptActionTypeEnum;
2087
1067
  interface TextUrlPromptCard extends BaseCard {
2088
1068
  props: {
2089
1069
  message: string;
@@ -2097,16 +1077,13 @@ interface TextUrlPromptCard extends BaseCard {
2097
1077
  promptActionType: PromptActionType;
2098
1078
  required: boolean;
2099
1079
  richTextBody: RichTextBody;
1080
+ questionHtml?: string;
2100
1081
  };
2101
1082
  routingOptions: RoutingOptions;
2102
1083
  };
2103
- type: CardType.TextUrlPrompt;
2104
- }
2105
- declare const enum AvPermission {
2106
- Camera = "camera",
2107
- Microphone = "microphone",
2108
- Screen = "screen"
1084
+ type: "texturlprompt";
2109
1085
  }
1086
+ type AvPermission = "camera" | "microphone" | "screen";
2110
1087
  interface ConsentLegalCard extends BaseCard {
2111
1088
  props: {
2112
1089
  message: string;
@@ -2126,21 +1103,18 @@ interface ConsentLegalCard extends BaseCard {
2126
1103
  richTextBody: RichTextBody;
2127
1104
  skipButtonText: string;
2128
1105
  submitButtonText: string;
1106
+ questionHtml?: string;
2129
1107
  };
2130
1108
  routingOptions: RoutingOptions;
2131
1109
  };
2132
- type: CardType.ConsentLegal;
1110
+ type: "consentlegal";
2133
1111
  }
2134
1112
  interface BaseTaskPage {
2135
1113
  buttonText: string;
2136
1114
  headline: string;
1115
+ type: RecordedTaskPageType;
2137
1116
  }
2138
- declare const enum RecordedTaskPageType {
2139
- AvPermission = "av_permission",
2140
- ScreenPermission = "screen_permission",
2141
- StartTask = "start_task",
2142
- CompleteTask = "complete_task"
2143
- }
1117
+ type RecordedTaskPageType = "av_permission" | "screen_permission" | "start_task" | "complete_task";
2144
1118
  interface PermissionTaskPage extends BaseTaskPage {
2145
1119
  captionText: string;
2146
1120
  headline: string;
@@ -2152,7 +1126,7 @@ interface PermissionTaskPage extends BaseTaskPage {
2152
1126
  skipButtonText?: string;
2153
1127
  svg: string;
2154
1128
  tryAgainButtonText: string;
2155
- type: RecordedTaskPageType.AvPermission;
1129
+ type: "av_permission";
2156
1130
  }
2157
1131
  interface ScreenTaskPage extends BaseTaskPage {
2158
1132
  captionText: string;
@@ -2160,19 +1134,19 @@ interface ScreenTaskPage extends BaseTaskPage {
2160
1134
  permissionDeniedHeadline: string;
2161
1135
  selectTabText: string;
2162
1136
  skipButtonText: string;
2163
- type: RecordedTaskPageType.ScreenPermission;
1137
+ type: "screen_permission";
2164
1138
  }
2165
1139
  interface StartTaskPage extends BaseTaskPage {
2166
1140
  captionText?: string;
2167
1141
  skipButtonText: string;
2168
1142
  taskDetail: string;
2169
- type: RecordedTaskPageType.StartTask;
1143
+ type: "start_task";
2170
1144
  }
2171
1145
  interface CompleteTaskPage extends BaseTaskPage {
2172
1146
  captionText?: string;
2173
1147
  skipButtonText: string;
2174
1148
  taskDetail: string;
2175
- type: RecordedTaskPageType.CompleteTask;
1149
+ type: "complete_task";
2176
1150
  }
2177
1151
  type RecordedTaskPage = PermissionTaskPage | ScreenTaskPage | StartTaskPage | CompleteTaskPage;
2178
1152
  interface RecordedTaskCardProperties {
@@ -2188,9 +1162,9 @@ interface RecordedTaskCard extends BaseCard {
2188
1162
  message: string;
2189
1163
  options: [];
2190
1164
  properties: RecordedTaskCardProperties;
2191
- routingOptions: RoutingOptions<Comparator.GivenUp>;
1165
+ routingOptions: RoutingOptions<"given_up">;
2192
1166
  };
2193
- type: CardType.RecordedTask;
1167
+ type: "recordedtask";
2194
1168
  }
2195
1169
  interface Labels {
2196
1170
  left: string;
@@ -2200,11 +1174,7 @@ interface RatingIcon {
2200
1174
  idx?: number;
2201
1175
  svg: string;
2202
1176
  }
2203
- declare enum ScaleLabelType {
2204
- Number = "number",
2205
- Smiley = "smiley",
2206
- Star = "star"
2207
- }
1177
+ type ScaleLabelType = "number" | "smiley" | "star";
2208
1178
  interface LikertCard extends BaseCard {
2209
1179
  props: {
2210
1180
  labels: Labels;
@@ -2220,9 +1190,9 @@ interface LikertCard extends BaseCard {
2220
1190
  scaleLabelType: ScaleLabelType;
2221
1191
  required: boolean;
2222
1192
  };
2223
- routingOptions: RoutingOptions<Comparator.Equal | Comparator.GivenUp | Comparator.GreaterThan | Comparator.GreaterThanOrEqual | Comparator.LessThan | Comparator.LessThanOrEqual | Comparator.NotEqual>;
1193
+ routingOptions: RoutingOptions<"eq" | "given_up" | "gt" | "gte" | "lt" | "lte" | "neq">;
2224
1194
  };
2225
- type: CardType.Likert;
1195
+ type: "likert";
2226
1196
  }
2227
1197
  interface OpenTextCard extends BaseCard {
2228
1198
  props: {
@@ -2233,14 +1203,15 @@ interface OpenTextCard extends BaseCard {
2233
1203
  buttonText?: string;
2234
1204
  captionText?: string;
2235
1205
  conceptUrl: ConceptUrl;
1206
+ footerHtml?: string;
2236
1207
  openTextPlaceholder?: string;
2237
1208
  required: boolean;
2238
1209
  richTextBody: RichTextBody;
2239
1210
  skipButtonText?: string;
2240
1211
  };
2241
- routingOptions: RoutingOptions<Comparator.Contains | Comparator.DoesNotContain>;
1212
+ routingOptions: RoutingOptions<"contains" | "notcontains">;
2242
1213
  };
2243
- type: CardType.Open;
1214
+ type: "open";
2244
1215
  }
2245
1216
  interface MultipleChoiceOption {
2246
1217
  createdAt: string;
@@ -2248,7 +1219,9 @@ interface MultipleChoiceOption {
2248
1219
  id: number;
2249
1220
  label: string;
2250
1221
  optionProperties: null | {
2251
- allowsTextEntry: boolean;
1222
+ allowsTextEntry?: boolean;
1223
+ noneOfTheAbove?: boolean;
1224
+ isPinned?: boolean;
2252
1225
  };
2253
1226
  order: number;
2254
1227
  productId: number;
@@ -2264,7 +1237,16 @@ interface CommonMultipleChoiceProps {
2264
1237
  buttonText?: string;
2265
1238
  captionText: string;
2266
1239
  conceptUrl: ConceptUrl;
2267
- randomize: "none" | "keeplast" | "all";
1240
+ isDropdown?: boolean;
1241
+ /**
1242
+ * Placeholder text on the dropdown button when no items are selected
1243
+ */
1244
+ dropdownPlaceholderText?: string;
1245
+ /**
1246
+ * Text when multiple items are selected, such as "2 items selected" / "3 items selected"
1247
+ */
1248
+ dropdownMultiselectedText?: string;
1249
+ randomize: Randomize;
2268
1250
  required: boolean;
2269
1251
  };
2270
1252
  }
@@ -2273,33 +1255,76 @@ interface MultiChoiceCard<C extends Comparator = DefaultComparator> extends Base
2273
1255
  routingOptions: RoutingOptions<C>;
2274
1256
  };
2275
1257
  }
2276
- interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<Comparator.Equal | Comparator.NotEqual | Comparator.ListAtLeastOne | Comparator.DoesNotInclude> {
2277
- type: CardType.MultipleChoice;
1258
+ interface MultipleChoiceSingleSelectCard extends MultiChoiceCard<"eq" | "neq" | "list_alo" | "list_dni"> {
1259
+ type: "multiplechoice";
2278
1260
  }
2279
- interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<Comparator.ListAll | Comparator.ListAtLeastOne | Comparator.ListExact | Comparator.DoesNotInclude> {
2280
- type: CardType.MultipleSelect;
1261
+ interface MultipleChoiceMultiSelectCard extends MultiChoiceCard<"list_all" | "list_alo" | "list_exact" | "list_dni"> {
1262
+ type: "multipleselect";
2281
1263
  }
2282
- interface NPSCard extends BaseCard {
1264
+ interface MatrixCard extends BaseCard {
2283
1265
  props: {
2284
- labels: {
2285
- left: string;
2286
- right: string;
1266
+ options: MultipleChoiceOption[];
1267
+ message: string;
1268
+ routingOptions: RoutingOptions<"skipped" | "partial" | "answered">;
1269
+ properties: {
1270
+ buttonText?: string;
1271
+ captionText: string;
1272
+ conceptUrl: ConceptUrl;
1273
+ displayMatrixAsAccordion?: boolean;
1274
+ matrixColumn: {
1275
+ label: string;
1276
+ value: string;
1277
+ }[];
1278
+ randomize: Randomize;
1279
+ required: boolean;
2287
1280
  };
1281
+ };
1282
+ type: "matrix";
1283
+ }
1284
+ interface NPSCard extends BaseCard {
1285
+ props: {
1286
+ labels: Labels;
2288
1287
  message: string;
2289
1288
  options: [];
2290
1289
  properties: {
2291
1290
  buttonText?: string;
2292
1291
  captionText: string;
2293
1292
  conceptUrl: null;
2294
- labels: {
2295
- left: string;
2296
- right: string;
2297
- };
1293
+ labels: Labels;
1294
+ required: boolean;
1295
+ };
1296
+ routingOptions: RoutingOptions<"eq" | "gt" | "gte" | "lt" | "lte" | "neq">;
1297
+ };
1298
+ type: "nps";
1299
+ }
1300
+ interface RankOrderOption {
1301
+ createdAt: string;
1302
+ deletedAt: null;
1303
+ id: number;
1304
+ label: string;
1305
+ order: number;
1306
+ productId: number;
1307
+ surveyId: number;
1308
+ surveyQuestionId: number;
1309
+ updatedAt: string;
1310
+ value: string;
1311
+ }
1312
+ interface RankOderType extends BaseCard {
1313
+ props: {
1314
+ labels: Labels;
1315
+ message: string;
1316
+ options: RankOrderOption[];
1317
+ properties: {
1318
+ captionText: string;
1319
+ buttonText?: string;
1320
+ conceptUrl: ConceptUrl;
1321
+ labels: Labels;
2298
1322
  required: boolean;
1323
+ randomize: Randomize;
2299
1324
  };
2300
- routingOptions: RoutingOptions<Comparator.Equal | Comparator.GreaterThan | Comparator.GreaterThanOrEqual | Comparator.LessThan | Comparator.LessThanOrEqual | Comparator.NotEqual>;
1325
+ routingOptions: RoutingOptions<"eq" | "gt" | "gte" | "lt" | "lte" | "neq">;
2301
1326
  };
2302
- type: CardType.NPS;
1327
+ type: "rankorder";
2303
1328
  }
2304
1329
  interface VideoVoiceCard extends BaseCard {
2305
1330
  props: {
@@ -2309,6 +1334,7 @@ interface VideoVoiceCard extends BaseCard {
2309
1334
  buttonText: string;
2310
1335
  captionText: string;
2311
1336
  conceptUrl: null;
1337
+ hideRecordedPrompt?: boolean;
2312
1338
  mediaType: "video" | "audio";
2313
1339
  required: boolean;
2314
1340
  skipButtonText: string;
@@ -2317,9 +1343,95 @@ interface VideoVoiceCard extends BaseCard {
2317
1343
  };
2318
1344
  routingOptions: RoutingOptions;
2319
1345
  };
2320
- type: CardType.VideoVoice;
1346
+ type: "videovoice";
1347
+ }
1348
+ type Card = TextUrlPromptCard | ConsentLegalCard | RecordedTaskCard | LikertCard | OpenTextCard | MatrixCard | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | RankOderType | VideoVoiceCard;
1349
+
1350
+ type InteractiveMatchType = "exactly" | "legacy";
1351
+ type PageUrlMatchType = "contains" | "exactly" | "legacy" | "notContains" | "regex" | "startsWith";
1352
+ interface InteractiveEvent {
1353
+ id: number;
1354
+ matchType: InteractiveMatchType;
1355
+ name: string;
1356
+ pattern: string;
1357
+ properties: {
1358
+ innerText: string;
1359
+ selector?: string;
1360
+ type?: "click";
1361
+ };
1362
+ }
1363
+ interface PageUrlEvent {
1364
+ id: number;
1365
+ matchType: PageUrlMatchType;
1366
+ pattern: string;
1367
+ }
1368
+
1369
+ declare enum DismissReason {
1370
+ Closed = "close.click",// user clicked the close button
1371
+ Complete = "survey.completed",// user answered all questions
1372
+ FeedbackClosed = "feedback.closed",// user either clicked on feedback button or close button
1373
+ PageChange = "page.change",// productConfig.dismissOnPageChange == true and we detected a page change (excludes hash/query param changes)
1374
+ API = "api",// JS called Sprig('dismissActiveSurvey')
1375
+ Override = "override"
1376
+ }
1377
+ type StudyType = "feedbackButton" | "inProductSurvey" | "longFormSurvey";
1378
+ declare enum SprigEvent {
1379
+ ReplayCapture = "replay.capture",
1380
+ ReplayPaused = "replay.paused",
1381
+ ReplayResumed = "replay.resumed",
1382
+ FeedbackButtonLoaded = "feedback.button.loaded",
1383
+ SDKReady = "sdk.ready",
1384
+ SurveyAppeared = "survey.appeared",
1385
+ SurveyCloseRequested = "survey.closeRequested",//This event signals to mobile the survey overlay can close
1386
+ SurveyClosed = "survey.closed",
1387
+ SurveyDimensions = "survey.dimensions",
1388
+ SurveyFadingOut = "survey.fadingOut",
1389
+ SurveyHeight = "survey.height",
1390
+ SurveyPresented = "survey.presented",
1391
+ SurveyLifeCycle = "survey.lifeCycle",
1392
+ SurveyWidth = "survey.width",
1393
+ SurveyWillClose = "survey.willClose",
1394
+ SurveyWillPresent = "survey.will.present",
1395
+ CloseSurveyOnOverlayClick = "close.survey.overlayClick",
1396
+ VisitorIDUpdated = "visitor.id.updated",
1397
+ QuestionAnswered = "question.answered"
1398
+ }
1399
+ declare const EVENTS: {
1400
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
1401
+ SDK_READY: SprigEvent;
1402
+ SURVEY_APPEARED: SprigEvent;
1403
+ SURVEY_CLOSED: SprigEvent;
1404
+ SURVEY_DIMENSIONS: SprigEvent;
1405
+ SURVEY_FADING_OUT: SprigEvent;
1406
+ SURVEY_HEIGHT: SprigEvent;
1407
+ SURVEY_WIDTH: SprigEvent;
1408
+ SURVEY_PRESENTED: SprigEvent;
1409
+ SURVEY_LIFE_CYCLE: SprigEvent;
1410
+ SURVEY_WILL_CLOSE: SprigEvent;
1411
+ SURVEY_WILL_PRESENT: SprigEvent;
1412
+ QUESTION_ANSWERED: SprigEvent;
1413
+ REPLAY_CAPTURE: SprigEvent;
1414
+ CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
1415
+ VISITOR_ID_UPDATED: SprigEvent;
1416
+ DATA: {
1417
+ DISMISS_REASONS: {
1418
+ API: DismissReason;
1419
+ CLOSED: DismissReason;
1420
+ COMPLETE: DismissReason;
1421
+ PAGE_CHANGE: DismissReason;
1422
+ OVERRIDE: DismissReason;
1423
+ };
1424
+ SURVEY_ID: string;
1425
+ };
1426
+ };
1427
+
1428
+ 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";
1429
+ type ThresholdType = "max" | "min";
1430
+ interface MetricThreshold {
1431
+ metric: Metric;
1432
+ type: ThresholdType;
1433
+ value: number;
2321
1434
  }
2322
- type Card = TextUrlPromptCard | ConsentLegalCard | RecordedTaskCard | LikertCard | OpenTextCard | MultipleChoiceSingleSelectCard | MultipleChoiceMultiSelectCard | NPSCard | VideoVoiceCard;
2323
1435
 
2324
1436
  interface RecordedTaskResponseType {
2325
1437
  questionId: number;
@@ -2327,35 +1439,63 @@ interface RecordedTaskResponseType {
2327
1439
  value: RecordedTaskResponseValueType;
2328
1440
  }
2329
1441
 
1442
+ type SurveyState = "ready" | "no survey";
1443
+ type ReplayDurationType = "after" | "before" | "beforeAndAfter";
1444
+
1445
+ interface MobileReplayConfig {
1446
+ mobileMetricsReportingEnabled?: boolean;
1447
+ metricsReportingInterval?: number;
1448
+ metricsThresholds?: MetricThreshold[];
1449
+ maxMobileReplayDurationSeconds?: number;
1450
+ mobileReplaySettings?: {
1451
+ hideAllFormContents: boolean;
1452
+ hidePasswordsOnly: boolean;
1453
+ hideAllImages: boolean;
1454
+ };
1455
+ }
2330
1456
  type SprigEventMap = {
2331
- [InternalEventName.CurrentQuestion]: [
1457
+ "survey.question": [
2332
1458
  {
2333
- [InternalEventData.QuestionId]: number;
2334
- [InternalEventData.Props]: unknown;
1459
+ qid: number;
1460
+ props: unknown;
2335
1461
  }
2336
1462
  ];
2337
- [InternalEventName.RecordedTaskPermissionScreen]: [];
2338
- [InternalEventName.RecordedTaskStart]: [];
2339
- [InternalEventName.SurveyComplete]: [];
2340
- [InternalEventName.VerifyViewVersion]: [
1463
+ "recorded.task.permission.screen": [];
1464
+ "recorded.task.start": [];
1465
+ "survey.complete": [number];
1466
+ "verify.view.version": [
2341
1467
  {
2342
- [InternalEventData.ViewVersion]: string;
1468
+ "view.version": string;
2343
1469
  }
2344
1470
  ];
2345
1471
  [SprigEvent.CloseSurveyOnOverlayClick]: [];
2346
- [SprigEvent.SDKReady]: [];
2347
- [SprigEvent.SurveyAppeared]: [];
1472
+ [SprigEvent.FeedbackButtonLoaded]: [
1473
+ {
1474
+ name: string;
1475
+ "survey.id"?: number;
1476
+ }
1477
+ ];
1478
+ [SprigEvent.SDKReady]: [MobileReplayConfig];
1479
+ [SprigEvent.SurveyAppeared]: [
1480
+ {
1481
+ name: string;
1482
+ "survey.id": number;
1483
+ }
1484
+ ];
2348
1485
  [SprigEvent.SurveyDimensions]: [
2349
1486
  {
2350
1487
  contentFrameHeight: number;
2351
1488
  contentFrameWidth: number;
2352
1489
  name: string;
1490
+ "survey.id": number;
2353
1491
  }
2354
1492
  ];
2355
1493
  [SprigEvent.SurveyClosed]: [
2356
1494
  {
2357
1495
  initiator?: string;
2358
1496
  name: string;
1497
+ studyType?: StudyType;
1498
+ "survey.id": number;
2359
1499
  }
2360
1500
  ];
2361
1501
  [SprigEvent.SurveyFadingOut]: [];
@@ -2363,6 +1503,14 @@ type SprigEventMap = {
2363
1503
  {
2364
1504
  name: string;
2365
1505
  contentFrameHeight: number;
1506
+ "survey.id": number;
1507
+ }
1508
+ ];
1509
+ [SprigEvent.SurveyWidth]: [
1510
+ {
1511
+ name: string;
1512
+ contentFrameWidth: number;
1513
+ "survey.id": number;
2366
1514
  }
2367
1515
  ];
2368
1516
  [SprigEvent.SurveyLifeCycle]: [{
@@ -2371,12 +1519,23 @@ type SprigEventMap = {
2371
1519
  [SprigEvent.SurveyPresented]: [
2372
1520
  {
2373
1521
  name: string;
1522
+ "survey.id": number;
1523
+ }
1524
+ ];
1525
+ [SprigEvent.SurveyCloseRequested]: [
1526
+ {
1527
+ initiator: DismissReason;
1528
+ name?: string;
1529
+ studyType?: StudyType;
1530
+ "survey.id": number;
2374
1531
  }
2375
1532
  ];
2376
1533
  [SprigEvent.SurveyWillClose]: [
2377
1534
  {
2378
1535
  initiator: DismissReason;
2379
1536
  name?: string;
1537
+ studyType?: StudyType;
1538
+ "survey.id": number;
2380
1539
  }
2381
1540
  ];
2382
1541
  [SprigEvent.SurveyWillPresent]: [
@@ -2393,104 +1552,87 @@ type SprigEventMap = {
2393
1552
  answeredAt?: number;
2394
1553
  questionIndex?: number;
2395
1554
  value: unknown;
1555
+ "survey.id": number;
1556
+ }
1557
+ ];
1558
+ [SprigEvent.ReplayCapture]: [
1559
+ {
1560
+ responseGroupUid: string;
1561
+ hasQuestions: boolean;
1562
+ uploadId: string;
1563
+ seconds: number;
1564
+ replayType: ReplayDurationType;
1565
+ generateVideoUploadUrlPayload: {
1566
+ isReplay: boolean;
1567
+ mediaRecordingUid: string;
1568
+ mediaType: MediaType;
1569
+ questionId: number;
1570
+ responseGroupUid: string;
1571
+ surveyId: number;
1572
+ updatedAt: string;
1573
+ visitorId: string | null;
1574
+ };
1575
+ surveyId: number;
2396
1576
  }
2397
1577
  ];
2398
- [SprigRecordingEvent.AvPermission]: [
1578
+ [SprigEvent.ReplayPaused]: [];
1579
+ [SprigEvent.ReplayResumed]: [];
1580
+ "av.permission": [
2399
1581
  {
2400
- [SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
2401
- [SprigRecordingEventData.PermissionDescriptors]: AvPermission[];
1582
+ "stream.ready": (avStream: MediaStream | null, captureStream?: MediaStream | null) => void;
1583
+ "permission.descriptors": AvPermission[];
2402
1584
  }
2403
1585
  ];
2404
- [SprigRecordingEvent.BeginRecording]: [
1586
+ "begin.recording": [
2405
1587
  {
2406
- [SprigRecordingEventData.RecordingMediaTypes]: MediaType[];
2407
- [SprigRecordingEventData.StartRecordingCallback]: (mediaRecordingUids: UUID[]) => void;
1588
+ "recording.media.types": MediaType[];
1589
+ "start.recording.callback": (mediaRecordingUids: UUID[]) => void;
2408
1590
  }
2409
1591
  ];
2410
- [SprigRecordingEvent.FinishTask]: [
1592
+ "finish.task": [
2411
1593
  {
2412
- [SprigRecordingEventData.BeginCallback]: (mediaRecordingUid: UUID) => void;
2413
- [SprigRecordingEventData.CurrentIndex]: number;
2414
- [SprigRecordingEventData.PassthroughData]: PassthroughData;
2415
- [SprigRecordingEventData.ProgressCallback]: (mediaRecordingUid: UUID, data: {
1594
+ "begin.callback": (mediaRecordingUid: UUID) => void;
1595
+ "current.index": number;
1596
+ "passthrough.data": PassthroughData;
1597
+ "progress.callback": (mediaRecordingUid: UUID, data: {
2416
1598
  detail: number;
2417
1599
  }) => void;
2418
- [SprigRecordingEventData.TaskCompleteCallback]: (taskDurationMillisecond: number) => void;
2419
- [SprigRecordingEventData.TaskResponse]: RecordedTaskResponseType;
2420
- [SprigRecordingEventData.UploadCallback]: (mediaRecordingUid: UUID | null, successOrError: true | unknown) => void;
1600
+ "task.complete.callback": (taskDurationMillisecond: number) => void;
1601
+ "task.response": RecordedTaskResponseType;
1602
+ "upload.callback": (mediaRecordingUid: UUID | null, successOrError: true | unknown) => void;
2421
1603
  }
2422
1604
  ];
2423
- [SprigRecordingEvent.PermissionStatus]: [
1605
+ "permission.status": [
2424
1606
  {
2425
- [SprigRecordingEventData.PermissionStatusCallback]: (avStream: MediaStream | undefined, hasVideoPermission: boolean, hasScreenPermission: boolean, captureStream: MediaStream | undefined) => void;
1607
+ "permission.status.callback": (avStream: MediaStream | undefined, hasVideoPermission: boolean, hasScreenPermission: boolean, captureStream: MediaStream | undefined) => void;
2426
1608
  }
2427
1609
  ];
2428
- [SprigRecordingEvent.ScreenPermission]: [
1610
+ "screen.permission": [
2429
1611
  {
2430
- [SprigRecordingEventData.ScreenPermissionRequested]?: (data: boolean) => void;
2431
- [SprigRecordingEventData.StreamReadyCallback]: (avStream: MediaStream | null, captureStream: MediaStream | null) => void;
1612
+ "screen.permission.requested"?: (data: boolean) => void;
1613
+ "stream.ready.callback": (avStream: MediaStream | null, captureStream: MediaStream | null) => void;
2432
1614
  }
2433
1615
  ];
2434
- [SprigRecordingEvent.StartTask]: [];
1616
+ "start.task": [];
2435
1617
  };
2436
1618
  declare const eventEmitter: Emitter<SprigEventMap>;
2437
1619
  type SprigEventEmitter = typeof eventEmitter;
2438
1620
 
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
- }
1621
+ type FramePosition = "bottomLeft" | "bottomRight" | "center" | "topLeft" | "topRight";
1622
+ type Platform = "email" | "link" | "web";
1623
+ type InstallationMethod = "web-npm" | "web-npm-bundled" | "web-gtm" | "web-segment" | "android-segment" | "react-native-segment" | "ios-segment" | "web-snippet";
2489
1624
  interface Answer {
2490
1625
  questionId: number;
2491
1626
  value: unknown;
2492
1627
  }
2493
- interface Config {
1628
+ type FeedbackPlacement = "center-left" | "center-right" | "bottom-left" | "bottom-right";
1629
+ type FeedbackDesktopDisplay = "center-modal" | "slider";
1630
+ interface AppProductConfig {
1631
+ framePosition?: FramePosition;
1632
+ desktopDisplay?: FeedbackDesktopDisplay;
1633
+ placement?: FeedbackPlacement;
1634
+ }
1635
+ interface Config extends MobileReplayConfig {
2494
1636
  allResponses: unknown[];
2495
1637
  answers?: Answer[];
2496
1638
  apiURL: string;
@@ -2508,7 +1650,7 @@ interface Config {
2508
1650
  };
2509
1651
  };
2510
1652
  customMetadata?: Record<string, unknown>;
2511
- customStyles: string;
1653
+ customStyles?: string;
2512
1654
  dismissOnPageChange: boolean;
2513
1655
  forceBrandedLogo?: boolean;
2514
1656
  endCard?: {
@@ -2526,30 +1668,37 @@ interface Config {
2526
1668
  frame: HTMLIFrameElement & {
2527
1669
  eventEmitter?: SprigEventEmitter;
2528
1670
  setHeight?: (height: number) => void;
1671
+ setWidth?: (width: number) => void;
2529
1672
  };
2530
1673
  framePosition: FramePosition;
2531
1674
  headers: {
2532
1675
  "accept-language"?: string;
2533
1676
  /** @example "Bearer 123" */
2534
1677
  Authorization?: string;
2535
- "Content-Type": string;
2536
- "userleap-platform": Platform;
1678
+ "Content-Type"?: string;
1679
+ "userleap-platform": Platform | "ios" | "android" | "video_recorder";
1680
+ "sprig-modules"?: string;
2537
1681
  /** @example "SJcVfq-7QQ" */
2538
- [HttpHeader.EnvironmentID]?: string;
2539
- [HttpHeader.InstallationMethod]: InstallationMethod;
2540
- [HttpHeader.PartnerAnonymousId]?: string;
2541
- [HttpHeader.PreviewMode]?: string;
1682
+ "x-ul-environment-id"?: string;
1683
+ "x-ul-installation-method": InstallationMethod;
1684
+ "x-ul-anonymous-id"?: string;
1685
+ "x-ul-error"?: string;
1686
+ "x-ul-preview-mode"?: string;
2542
1687
  /** @example "2.18.0" */
2543
- "x-ul-sdk-version": string;
2544
- [HttpHeader.UserID]?: string;
2545
- [HttpHeader.VisitorID]?: UUID;
1688
+ "x-ul-sdk-version"?: string;
1689
+ /** For web-bundled sdk */
1690
+ "x-ul-package-version"?: string;
1691
+ "x-ul-user-id"?: string;
1692
+ "x-ul-visitor-id"?: string;
2546
1693
  };
2547
1694
  installationMethod?: InstallationMethod;
2548
1695
  interactiveEvents: InteractiveEvent[];
2549
1696
  interactiveEventsHandler?: (e: MouseEvent) => void;
1697
+ isOnQuestionsTab?: boolean;
2550
1698
  isPreview?: boolean;
2551
1699
  launchDarklyEnabled?: boolean;
2552
1700
  locale: string;
1701
+ logBufferLimit?: number;
2553
1702
  marketingUrl?: string;
2554
1703
  maxAttrNameLength: number;
2555
1704
  maxAttrValueLength: number;
@@ -2561,13 +1710,15 @@ interface Config {
2561
1710
  mode?: string;
2562
1711
  mute?: boolean;
2563
1712
  optimizelyEnabled?: boolean;
1713
+ outstandingTransactionLimit?: number | null;
2564
1714
  overlayStyle: "light";
2565
1715
  overlayStyleMobile: "none";
2566
1716
  pageUrlEvents: PageUrlEvent[];
2567
1717
  path?: string;
2568
1718
  platform?: Platform;
2569
1719
  previewKey?: string | null;
2570
- replayNonce?: string;
1720
+ previewMode?: boolean;
1721
+ productConfig?: AppProductConfig;
2571
1722
  replaySettings?: object;
2572
1723
  requireUserIdForTracking: boolean;
2573
1724
  responseGroupUid: UUID;
@@ -2576,10 +1727,13 @@ interface Config {
2576
1727
  slugName: null;
2577
1728
  startingQuestionIdx?: number | null;
2578
1729
  styleNonce?: string;
1730
+ studyType?: StudyType;
2579
1731
  surveyId: number;
2580
1732
  tabTitle: string;
1733
+ trackPageViewUrl?: string;
2581
1734
  ulEvents: typeof SprigEvent;
2582
1735
  UpChunk: Window["UpChunk"];
1736
+ upchunkLibraryURL?: string;
2583
1737
  useDesktopPrototype?: boolean;
2584
1738
  useMobileStyling: boolean;
2585
1739
  userId: UUID | null;
@@ -2592,33 +1746,54 @@ interface Config {
2592
1746
  };
2593
1747
  }
2594
1748
 
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"
1749
+ interface Experiment {
1750
+ id: string;
1751
+ variation?: string;
2602
1752
  }
1753
+
1754
+ type QueueItem = [string, ...unknown[]] | (() => void);
1755
+ declare class SprigQueue {
1756
+ paused: boolean;
1757
+ queue: QueueItem[];
1758
+ ul: WindowSprig;
1759
+ constructor(ul: WindowSprig, queue: QueueItem[]);
1760
+ flush(queue: QueueItem[]): void;
1761
+ isPaused(): boolean;
1762
+ pause(): void;
1763
+ unpause(): void;
1764
+ push(action: QueueItem): void;
1765
+ perform(func: () => void): void | Promise<unknown>;
1766
+ /**
1767
+ * Removes all queued items
1768
+ */
1769
+ empty(): void;
1770
+ }
1771
+
2603
1772
  type EventDigest = {
2604
1773
  timestamp: number;
2605
- type: ReplayEventType.Click;
1774
+ type: "Sprig_Click";
2606
1775
  } | {
2607
1776
  timestamp: number;
2608
1777
  name: string;
2609
- type: ReplayEventType.Event;
1778
+ type: "Sprig_TrackEvent";
2610
1779
  } | {
2611
1780
  timestamp: number;
2612
- type: ReplayEventType.PageView;
1781
+ type: "Sprig_PageView";
2613
1782
  url: string;
2614
1783
  } | {
2615
1784
  timestamp: number;
2616
1785
  surveyId: string;
2617
- type: ReplayEventType.SurveyShown;
1786
+ type: "Sprig_ShowSurvey";
2618
1787
  } | {
2619
1788
  timestamp: number;
2620
1789
  surveyId: string;
2621
- type: ReplayEventType.SurveySubmitted;
1790
+ type: "Sprig_SubmitSurvey";
1791
+ } | {
1792
+ timestamp: number;
1793
+ type: "Sprig_ReplayPaused";
1794
+ } | {
1795
+ timestamp: number;
1796
+ type: "Sprig_ReplayResumed";
2622
1797
  };
2623
1798
 
2624
1799
  declare namespace optimizely {
@@ -2663,6 +1838,7 @@ declare namespace optimizely {
2663
1838
  declare namespace sprigConfig {
2664
1839
  type IdentifyResult = Promise<
2665
1840
  | {
1841
+ error?: Error;
2666
1842
  success: boolean;
2667
1843
  message?: string;
2668
1844
  surveyState?: SurveyState;
@@ -2687,7 +1863,7 @@ declare namespace sprigConfig {
2687
1863
  surveyId: number;
2688
1864
  responseGroupUuid: string;
2689
1865
  eventDigest?: EventDigest[];
2690
- }) => Promise<void>;
1866
+ }) => Promise<boolean>;
2691
1867
  _generateVideoUploadUrl: (body: {
2692
1868
  mediaRecordingUid?: string;
2693
1869
  mediaType?: MediaType;
@@ -2696,13 +1872,16 @@ declare namespace sprigConfig {
2696
1872
  surveyId?: number;
2697
1873
  updatedAt?: string;
2698
1874
  visitorId?: string | null;
1875
+ isReplay?: boolean;
2699
1876
  }) => Promise<string | null>;
2700
1877
  _previewSurvey: (surveyTemplateId: UUID) => void;
2701
1878
  _reviewSurvey: (surveyId: number) => void;
1879
+ _reportMetric: (name: Metric, value: number) => void;
2702
1880
 
2703
1881
  // external apis
2704
1882
  addListener: (event: SprigEvent, listener: SprigListener) => Promise<void>;
2705
1883
  addSurveyListener: (listener: SprigListener) => Promise<void>;
1884
+ applyFeedbackStyles: (styles: { button?: string; view?: string }) => void;
2706
1885
  applyStyles: (styleString: string) => void;
2707
1886
  dismissActiveSurvey: (reason?: DismissReason) => void;
2708
1887
  displaySurvey: (surveyId: number) => IdentifyResult;
@@ -2715,7 +1894,7 @@ declare namespace sprigConfig {
2715
1894
  importLaunchDarklyData: (data: Record<string, number | undefined>) => void;
2716
1895
  integrateOptimizely: (
2717
1896
  strData: string | { experiments: Experiment[] },
2718
- isOverride?: boolean
1897
+ isOverride?: boolean,
2719
1898
  ) => void;
2720
1899
  integrateOptimizelyClient: (client: Client) => void;
2721
1900
  logoutUser: () => void;
@@ -2725,22 +1904,25 @@ declare namespace sprigConfig {
2725
1904
  removeAttributes: (attributes: SprigAttributes) => IdentifyResult;
2726
1905
  removeListener: (
2727
1906
  event: SprigEvent,
2728
- listener: SprigListener
1907
+ listener: SprigListener,
2729
1908
  ) => Promise<void>;
2730
1909
  removeSurveyListener: (listener: SprigListener) => Promise<void>;
2731
1910
  reviewSurvey: (surveyId: number) => void;
2732
- setAttribute: (attribute: string, value: string | number) => IdentifyResult;
1911
+ setAttribute: (
1912
+ attribute: string,
1913
+ value: string | number | boolean,
1914
+ ) => IdentifyResult;
2733
1915
  setAttributes: (attributes?: SprigAttributes) => IdentifyResult;
2734
1916
  setPartnerAnonymousId: (
2735
- partnerAnonymousId: string
1917
+ partnerAnonymousId: string,
2736
1918
  ) => Promise<{ success: boolean; message?: string }>;
2737
1919
  setVisitorAttribute: (
2738
1920
  attribute: string,
2739
- value: string | number
1921
+ value: string | number,
2740
1922
  ) => IdentifyResult;
2741
1923
  setWindowDimensions: (
2742
1924
  width: number | string,
2743
- height: number | string
1925
+ height: number | string,
2744
1926
  ) => void;
2745
1927
  setEmail: (email: string) => IdentifyResult;
2746
1928
  setPreviewKey: (previewKey: string) => void;
@@ -2752,14 +1934,18 @@ declare namespace sprigConfig {
2752
1934
  eventName: string,
2753
1935
  properties?: TrackPayload["properties"],
2754
1936
  metadata?: SprigMetadata,
2755
- showSurveyCallback?: (surveyId?: number) => Promise<boolean>
1937
+ showSurveyCallback?: (surveyId?: number) => Promise<boolean>,
2756
1938
  ) => IdentifyResult;
2757
1939
  trackPageView: (
2758
1940
  url: string,
2759
1941
  properties?: SprigProperties,
2760
- showSurveyCallback?: (surveyId?: number) => Promise<boolean>
1942
+ showSurveyCallback?: (surveyId?: number) => Promise<boolean>,
1943
+ calledFromApi?: boolean,
2761
1944
  ) => void;
1945
+ trackHistory?: ({ event: string }) => void;
2762
1946
  unmute: () => void;
1947
+ pauseReplayRecording: () => void;
1948
+ resumeReplayRecording: () => void;
2763
1949
  }
2764
1950
 
2765
1951
  type SprigCommand = keyof SprigAPIActions;
@@ -2772,7 +1958,10 @@ declare namespace sprigConfig {
2772
1958
  SprigAPIActions &
2773
1959
  SprigCommands & {
2774
1960
  _API_URL: string;
2775
- _config: Config;
1961
+ _config: Config & {
1962
+ desktopDisplay?: string;
1963
+ previewLanguage?: string;
1964
+ };
2776
1965
  _gtm: unknown; // TODO: determine if boolean?
2777
1966
  _queue: SprigQueue;
2778
1967
  _segment: unknown; // TODO: determine if boolean?
@@ -2784,19 +1973,29 @@ declare namespace sprigConfig {
2784
1973
  email?: string | null;
2785
1974
  envId: string;
2786
1975
  error?: Error;
1976
+ feedbackCustomStyles?: string;
1977
+ forceDirectEmbed?: boolean;
2787
1978
  frameId: string;
1979
+ isMobileSDK?: boolean;
2788
1980
  loaded: boolean;
2789
1981
  locale?: string;
2790
- localStorageAvailable: boolean;
2791
1982
  maxHeight?: number | string;
2792
1983
  maxInflightReplayRequests?: number;
1984
+ outstandingTransactionLimit?: number | null;
2793
1985
  mobileHeadersJSON?: string;
2794
1986
  nonce?: string;
2795
1987
  partnerAnonymousId: string | null;
2796
- replayNonce?: string;
2797
- reportError: (name: string, err: Error, extraInfo?: object) => void;
1988
+ pointerDownTarget?: EventTarget | null;
1989
+ replayLibraryURL?: string;
1990
+ reportError: (
1991
+ name: string,
1992
+ err: Error,
1993
+ extraInfo?: object,
1994
+ bodyInfo?: object,
1995
+ ) => void;
2798
1996
  sampleRate?: number;
2799
1997
  token: string | null;
1998
+ upchunkLibraryURL?: string;
2800
1999
  UPDATES: typeof EVENTS;
2801
2000
  viewSDKURL?: string;
2802
2001
  windowDimensions?: {
@@ -2805,49 +2004,42 @@ declare namespace sprigConfig {
2805
2004
  };
2806
2005
  };
2807
2006
  }
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"];
2007
+
2818
2008
  declare global {
2819
2009
  interface Window {
2820
2010
  __cfg: Config;
2821
2011
  attachEvent?: typeof window.addEventListener;
2012
+ Backbone: {
2013
+ history: typeof window.history;
2014
+ };
2822
2015
  Intercom: { ul_wasVisible?: boolean } & ((
2823
2016
  method: string,
2824
- data: unknown
2017
+ data?: unknown,
2825
2018
  ) => void);
2826
2019
  optimizely?: optimizely.Optimizely;
2827
2020
  optimizelyDatafile?: object;
2828
2021
  previewMode?: unknown;
2829
2022
  UpChunk: {
2830
- createUpload: (
2831
- ...args: ArgumentTypes<createUpload>
2832
- ) => PublicOf<ReturnType<createUpload>>;
2023
+ createUpload: typeof createUpload;
2833
2024
  };
2834
2025
  _Sprig?: sprigConfig.WindowSprig;
2835
2026
  Sprig: sprigConfig.WindowSprig;
2836
2027
  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;
2028
+ rrwebRecord?: (typeof _rrweb_record)["record"];
2029
+ sprigAPI?: { openUrl: (url: string) => void };
2030
+ SprigLoggerCallback?: (message: string) => void;
2845
2031
  }
2846
2032
 
2847
2033
  type WindowSprig = sprigConfig.WindowSprig;
2848
2034
  type SprigAttributes = Record<string, boolean | number | string>;
2849
2035
  type SprigListener = Listener<unknown[]>;
2850
- type SprigMetadata = Record<string, unknown>;
2036
+ type SprigMetadata = {
2037
+ url?: string;
2038
+ trackPageView?: boolean;
2039
+ optimizelyExperiments?: object;
2040
+ launchDarklyFlags?: object;
2041
+ eventProperties?: SprigProperties;
2042
+ };
2851
2043
  type SprigProperties = Record<string, unknown>;
2852
2044
  type SprigAPIActions = sprigConfig.SprigAPIActions;
2853
2045
  type TrackPayload = sprigConfig.TrackPayload;
@@ -2862,28 +2054,36 @@ declare class SprigAPI {
2862
2054
  * Include external events emitted from Sprig
2863
2055
  */
2864
2056
  UPDATES: {
2057
+ FEEDBACK_BUTTON_LOADED: SprigEvent;
2865
2058
  SDK_READY: SprigEvent;
2866
2059
  SURVEY_APPEARED: SprigEvent;
2867
2060
  SURVEY_CLOSED: SprigEvent;
2868
2061
  SURVEY_DIMENSIONS: SprigEvent;
2869
2062
  SURVEY_FADING_OUT: SprigEvent;
2870
2063
  SURVEY_HEIGHT: SprigEvent;
2064
+ SURVEY_WIDTH: SprigEvent;
2871
2065
  SURVEY_PRESENTED: SprigEvent;
2872
2066
  SURVEY_LIFE_CYCLE: SprigEvent;
2873
2067
  SURVEY_WILL_CLOSE: SprigEvent;
2874
2068
  SURVEY_WILL_PRESENT: SprigEvent;
2875
2069
  QUESTION_ANSWERED: SprigEvent;
2876
- CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent;
2070
+ REPLAY_CAPTURE: SprigEvent;
2071
+ CLOSE_SURVEY_ON_OVERLAY_CLICK: SprigEvent; /**
2072
+ * Tracks a page view with the provided URL and additional event properties.
2073
+ */
2877
2074
  VISITOR_ID_UPDATED: SprigEvent;
2878
2075
  DATA: {
2879
2076
  DISMISS_REASONS: {
2880
2077
  API: DismissReason;
2881
2078
  CLOSED: DismissReason;
2079
+ /**
2080
+ * Apply a css string representing the customized styles
2081
+ */
2882
2082
  COMPLETE: DismissReason;
2883
2083
  PAGE_CHANGE: DismissReason;
2884
2084
  OVERRIDE: DismissReason;
2885
2085
  };
2886
- SURVEY_ID: SprigEventData;
2086
+ SURVEY_ID: string;
2887
2087
  };
2888
2088
  };
2889
2089
  /**
@@ -2905,7 +2105,7 @@ declare class SprigAPI {
2905
2105
  /**
2906
2106
  * Set an arbitrary attribute on the visitor
2907
2107
  */
2908
- setAttribute(attribute: string, value: string): void;
2108
+ setAttribute(attribute: string, value: string | number | boolean): void;
2909
2109
  /**
2910
2110
  * Set attributes on visitor
2911
2111
  */
@@ -2980,6 +2180,14 @@ declare class SprigAPI {
2980
2180
  * Clears Sprig from window
2981
2181
  */
2982
2182
  teardown(): void;
2183
+ /**
2184
+ * Pause replay recording
2185
+ */
2186
+ pauseReplayRecording(): void;
2187
+ /**
2188
+ * Resume replay recording
2189
+ */
2190
+ resumeReplayRecording(): void;
2983
2191
  }
2984
2192
  type NpmConfig = {
2985
2193
  envId?: string;
@@ -2996,4 +2204,4 @@ declare const sprig: {
2996
2204
  };
2997
2205
  type WindowSprig$1 = typeof window.Sprig;
2998
2206
 
2999
- export { DismissReason, SprigAPI, SprigEvent, WindowSprig$1 as WindowSprig, sprig };
2207
+ export { DismissReason, SprigAPI, SprigEvent, type WindowSprig$1 as WindowSprig, sprig };