@sprig-technologies/sprig-bundled 1.0.0-beta.2 → 1.0.1

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