posthog-js 1.78.1 → 1.78.2

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/module.d.ts CHANGED
@@ -6,21 +6,21 @@ declare enum NodeType {
6
6
  CDATA = 4,
7
7
  Comment = 5
8
8
  }
9
- declare type documentNode = {
9
+ type documentNode = {
10
10
  type: NodeType.Document;
11
11
  childNodes: serializedNodeWithId[];
12
12
  compatMode?: string;
13
13
  };
14
- declare type documentTypeNode = {
14
+ type documentTypeNode = {
15
15
  type: NodeType.DocumentType;
16
16
  name: string;
17
17
  publicId: string;
18
18
  systemId: string;
19
19
  };
20
- declare type attributes = {
20
+ type attributes = {
21
21
  [key: string]: string | number | true | null;
22
22
  };
23
- declare type elementNode = {
23
+ type elementNode = {
24
24
  type: NodeType.Element;
25
25
  tagName: string;
26
26
  attributes: attributes;
@@ -28,25 +28,25 @@ declare type elementNode = {
28
28
  isSVG?: true;
29
29
  needBlock?: boolean;
30
30
  };
31
- declare type textNode = {
31
+ type textNode = {
32
32
  type: NodeType.Text;
33
33
  textContent: string;
34
34
  isStyle?: true;
35
35
  };
36
- declare type cdataNode = {
36
+ type cdataNode = {
37
37
  type: NodeType.CDATA;
38
38
  textContent: '';
39
39
  };
40
- declare type commentNode = {
40
+ type commentNode = {
41
41
  type: NodeType.Comment;
42
42
  textContent: string;
43
43
  };
44
- declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
44
+ type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
45
45
  rootId?: number;
46
46
  isShadowHost?: boolean;
47
47
  isShadow?: boolean;
48
48
  };
49
- declare type serializedNodeWithId = serializedNode & {
49
+ type serializedNodeWithId = serializedNode & {
50
50
  id: number;
51
51
  };
52
52
  interface IMirror<TNode> {
@@ -61,7 +61,7 @@ interface IMirror<TNode> {
61
61
  replace(id: number, n: TNode): void;
62
62
  reset(): void;
63
63
  }
64
- declare type MaskInputOptions = Partial<{
64
+ type MaskInputOptions = Partial<{
65
65
  color: boolean;
66
66
  date: boolean;
67
67
  'datetime-local': boolean;
@@ -79,7 +79,7 @@ declare type MaskInputOptions = Partial<{
79
79
  select: boolean;
80
80
  password: boolean;
81
81
  }>;
82
- declare type SlimDOMOptions = Partial<{
82
+ type SlimDOMOptions = Partial<{
83
83
  script: boolean;
84
84
  comment: boolean;
85
85
  headFavicon: boolean;
@@ -91,12 +91,12 @@ declare type SlimDOMOptions = Partial<{
91
91
  headMetaAuthorship: boolean;
92
92
  headMetaVerification: boolean;
93
93
  }>;
94
- declare type DataURLOptions = Partial<{
94
+ type DataURLOptions = Partial<{
95
95
  type: string;
96
96
  quality: number;
97
97
  }>;
98
- declare type MaskTextFn = (text: string) => string;
99
- declare type MaskInputFn = (text: string, element: HTMLElement) => string;
98
+ type MaskTextFn = (text: string) => string;
99
+ type MaskInputFn = (text: string, element: HTMLElement) => string;
100
100
 
101
101
  declare class Mirror implements IMirror<Node> {
102
102
  private idNodeMap;
@@ -572,15 +572,15 @@ declare enum EventType {
572
572
  Custom = 5,
573
573
  Plugin = 6
574
574
  }
575
- declare type domContentLoadedEvent = {
575
+ type domContentLoadedEvent = {
576
576
  type: EventType.DomContentLoaded;
577
577
  data: unknown;
578
578
  };
579
- declare type loadedEvent = {
579
+ type loadedEvent = {
580
580
  type: EventType.Load;
581
581
  data: unknown;
582
582
  };
583
- declare type fullSnapshotEvent = {
583
+ type fullSnapshotEvent = {
584
584
  type: EventType.FullSnapshot;
585
585
  data: {
586
586
  node: serializedNodeWithId;
@@ -590,11 +590,11 @@ declare type fullSnapshotEvent = {
590
590
  };
591
591
  };
592
592
  };
593
- declare type incrementalSnapshotEvent = {
593
+ type incrementalSnapshotEvent = {
594
594
  type: EventType.IncrementalSnapshot;
595
595
  data: incrementalData;
596
596
  };
597
- declare type metaEvent = {
597
+ type metaEvent = {
598
598
  type: EventType.Meta;
599
599
  data: {
600
600
  href: string;
@@ -602,14 +602,14 @@ declare type metaEvent = {
602
602
  height: number;
603
603
  };
604
604
  };
605
- declare type customEvent<T = unknown> = {
605
+ type customEvent<T = unknown> = {
606
606
  type: EventType.Custom;
607
607
  data: {
608
608
  tag: string;
609
609
  payload: T;
610
610
  };
611
611
  };
612
- declare type pluginEvent<T = unknown> = {
612
+ type pluginEvent<T = unknown> = {
613
613
  type: EventType.Plugin;
614
614
  data: {
615
615
  plugin: string;
@@ -634,56 +634,56 @@ declare enum IncrementalSource {
634
634
  Selection = 14,
635
635
  AdoptedStyleSheet = 15
636
636
  }
637
- declare type mutationData = {
637
+ type mutationData = {
638
638
  source: IncrementalSource.Mutation;
639
639
  } & mutationCallbackParam;
640
- declare type mousemoveData = {
640
+ type mousemoveData = {
641
641
  source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
642
642
  positions: mousePosition[];
643
643
  };
644
- declare type mouseInteractionData = {
644
+ type mouseInteractionData = {
645
645
  source: IncrementalSource.MouseInteraction;
646
646
  } & mouseInteractionParam;
647
- declare type scrollData = {
647
+ type scrollData = {
648
648
  source: IncrementalSource.Scroll;
649
649
  } & scrollPosition;
650
- declare type viewportResizeData = {
650
+ type viewportResizeData = {
651
651
  source: IncrementalSource.ViewportResize;
652
652
  } & viewportResizeDimension;
653
- declare type inputData = {
653
+ type inputData = {
654
654
  source: IncrementalSource.Input;
655
655
  id: number;
656
656
  } & inputValue;
657
- declare type mediaInteractionData = {
657
+ type mediaInteractionData = {
658
658
  source: IncrementalSource.MediaInteraction;
659
659
  } & mediaInteractionParam;
660
- declare type styleSheetRuleData = {
660
+ type styleSheetRuleData = {
661
661
  source: IncrementalSource.StyleSheetRule;
662
662
  } & styleSheetRuleParam;
663
- declare type styleDeclarationData = {
663
+ type styleDeclarationData = {
664
664
  source: IncrementalSource.StyleDeclaration;
665
665
  } & styleDeclarationParam;
666
- declare type canvasMutationData = {
666
+ type canvasMutationData = {
667
667
  source: IncrementalSource.CanvasMutation;
668
668
  } & canvasMutationParam;
669
- declare type fontData = {
669
+ type fontData = {
670
670
  source: IncrementalSource.Font;
671
671
  } & fontParam;
672
- declare type selectionData = {
672
+ type selectionData = {
673
673
  source: IncrementalSource.Selection;
674
674
  } & selectionParam;
675
- declare type adoptedStyleSheetData = {
675
+ type adoptedStyleSheetData = {
676
676
  source: IncrementalSource.AdoptedStyleSheet;
677
677
  } & adoptedStyleSheetParam;
678
- declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData;
679
- declare type event = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
680
- declare type eventWithTime = event & {
678
+ type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData;
679
+ type event = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent;
680
+ type eventWithTime = event & {
681
681
  timestamp: number;
682
682
  delay?: number;
683
683
  };
684
- declare type blockClass = string | RegExp;
685
- declare type maskTextClass = string | RegExp;
686
- declare type SamplingStrategy = Partial<{
684
+ type blockClass = string | RegExp;
685
+ type maskTextClass = string | RegExp;
686
+ type SamplingStrategy = Partial<{
687
687
  mousemove: boolean | number;
688
688
  mousemoveCallback: number;
689
689
  mouseInteraction: boolean | Record<string, boolean | undefined>;
@@ -699,7 +699,7 @@ interface ICrossOriginIframeMirror {
699
699
  getRemoteIds(iframe: HTMLIFrameElement, parentId: number[]): number[];
700
700
  reset(iframe?: HTMLIFrameElement): void;
701
701
  }
702
- declare type RecordPlugin<TOptions = unknown> = {
702
+ type RecordPlugin<TOptions = unknown> = {
703
703
  name: string;
704
704
  observer?: (cb: (...args: Array<unknown>) => void, win: IWindow, options: TOptions) => listenerHandler;
705
705
  eventProcessor?: <TExtend>(event: eventWithTime) => eventWithTime & TExtend;
@@ -710,7 +710,7 @@ declare type RecordPlugin<TOptions = unknown> = {
710
710
  }) => void;
711
711
  options: TOptions;
712
712
  };
713
- declare type hooksParam = {
713
+ type hooksParam = {
714
714
  mutation?: mutationCallBack;
715
715
  mousemove?: mousemoveCallBack;
716
716
  mouseInteraction?: mouseInteractionCallBack;
@@ -724,41 +724,41 @@ declare type hooksParam = {
724
724
  font?: fontCallback;
725
725
  selection?: selectionCallback;
726
726
  };
727
- declare type textMutation = {
727
+ type textMutation = {
728
728
  id: number;
729
729
  value: string | null;
730
730
  };
731
- declare type styleAttributeValue = {
731
+ type styleOMValue = {
732
732
  [key: string]: styleValueWithPriority | string | false;
733
733
  };
734
- declare type styleValueWithPriority = [string, string];
735
- declare type attributeMutation = {
734
+ type styleValueWithPriority = [string, string];
735
+ type attributeMutation = {
736
736
  id: number;
737
737
  attributes: {
738
- [key: string]: string | styleAttributeValue | null;
738
+ [key: string]: string | styleOMValue | null;
739
739
  };
740
740
  };
741
- declare type removedNodeMutation = {
741
+ type removedNodeMutation = {
742
742
  parentId: number;
743
743
  id: number;
744
744
  isShadow?: boolean;
745
745
  };
746
- declare type addedNodeMutation = {
746
+ type addedNodeMutation = {
747
747
  parentId: number;
748
748
  previousId?: number | null;
749
749
  nextId: number | null;
750
750
  node: serializedNodeWithId;
751
751
  };
752
- declare type mutationCallbackParam = {
752
+ type mutationCallbackParam = {
753
753
  texts: textMutation[];
754
754
  attributes: attributeMutation[];
755
755
  removes: removedNodeMutation[];
756
756
  adds: addedNodeMutation[];
757
757
  isAttachIframe?: true;
758
758
  };
759
- declare type mutationCallBack = (m: mutationCallbackParam) => void;
760
- declare type mousemoveCallBack = (p: mousePosition[], source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag) => void;
761
- declare type mousePosition = {
759
+ type mutationCallBack = (m: mutationCallbackParam) => void;
760
+ type mousemoveCallBack = (p: mousePosition[], source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag) => void;
761
+ type mousePosition = {
762
762
  x: number;
763
763
  y: number;
764
764
  id: number;
@@ -787,28 +787,28 @@ declare enum CanvasContext {
787
787
  WebGL = 1,
788
788
  WebGL2 = 2
789
789
  }
790
- declare type mouseInteractionParam = {
790
+ type mouseInteractionParam = {
791
791
  type: MouseInteractions;
792
792
  id: number;
793
793
  x: number;
794
794
  y: number;
795
795
  pointerType?: PointerTypes;
796
796
  };
797
- declare type mouseInteractionCallBack = (d: mouseInteractionParam) => void;
798
- declare type scrollPosition = {
797
+ type mouseInteractionCallBack = (d: mouseInteractionParam) => void;
798
+ type scrollPosition = {
799
799
  id: number;
800
800
  x: number;
801
801
  y: number;
802
802
  };
803
- declare type scrollCallback = (p: scrollPosition) => void;
804
- declare type styleSheetAddRule = {
803
+ type scrollCallback = (p: scrollPosition) => void;
804
+ type styleSheetAddRule = {
805
805
  rule: string;
806
806
  index?: number | number[];
807
807
  };
808
- declare type styleSheetDeleteRule = {
808
+ type styleSheetDeleteRule = {
809
809
  index: number | number[];
810
810
  };
811
- declare type styleSheetRuleParam = {
811
+ type styleSheetRuleParam = {
812
812
  id?: number;
813
813
  styleId?: number;
814
814
  removes?: styleSheetDeleteRule[];
@@ -816,8 +816,8 @@ declare type styleSheetRuleParam = {
816
816
  replace?: string;
817
817
  replaceSync?: string;
818
818
  };
819
- declare type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;
820
- declare type adoptedStyleSheetParam = {
819
+ type styleSheetRuleCallback = (s: styleSheetRuleParam) => void;
820
+ type adoptedStyleSheetParam = {
821
821
  id: number;
822
822
  styles?: {
823
823
  styleId: number;
@@ -825,7 +825,7 @@ declare type adoptedStyleSheetParam = {
825
825
  }[];
826
826
  styleIds: number[];
827
827
  };
828
- declare type styleDeclarationParam = {
828
+ type styleDeclarationParam = {
829
829
  id?: number;
830
830
  styleId?: number;
831
831
  index: number[];
@@ -838,13 +838,13 @@ declare type styleDeclarationParam = {
838
838
  property: string;
839
839
  };
840
840
  };
841
- declare type styleDeclarationCallback = (s: styleDeclarationParam) => void;
842
- declare type canvasMutationCommand = {
841
+ type styleDeclarationCallback = (s: styleDeclarationParam) => void;
842
+ type canvasMutationCommand = {
843
843
  property: string;
844
844
  args: Array<unknown>;
845
845
  setter?: true;
846
846
  };
847
- declare type canvasMutationParam = {
847
+ type canvasMutationParam = {
848
848
  id: number;
849
849
  type: CanvasContext;
850
850
  commands: canvasMutationCommand[];
@@ -852,25 +852,25 @@ declare type canvasMutationParam = {
852
852
  id: number;
853
853
  type: CanvasContext;
854
854
  } & canvasMutationCommand);
855
- declare type canvasMutationCallback = (p: canvasMutationParam) => void;
856
- declare type fontParam = {
855
+ type canvasMutationCallback = (p: canvasMutationParam) => void;
856
+ type fontParam = {
857
857
  family: string;
858
858
  fontSource: string;
859
859
  buffer: boolean;
860
860
  descriptors?: FontFaceDescriptors;
861
861
  };
862
- declare type fontCallback = (p: fontParam) => void;
863
- declare type viewportResizeDimension = {
862
+ type fontCallback = (p: fontParam) => void;
863
+ type viewportResizeDimension = {
864
864
  width: number;
865
865
  height: number;
866
866
  };
867
- declare type viewportResizeCallback = (d: viewportResizeDimension) => void;
868
- declare type inputValue = {
867
+ type viewportResizeCallback = (d: viewportResizeDimension) => void;
868
+ type inputValue = {
869
869
  text: string;
870
870
  isChecked: boolean;
871
871
  userTriggered?: boolean;
872
872
  };
873
- declare type inputCallback = (v: inputValue & {
873
+ type inputCallback = (v: inputValue & {
874
874
  id: number;
875
875
  }) => void;
876
876
  declare const enum MediaInteractions {
@@ -880,7 +880,7 @@ declare const enum MediaInteractions {
880
880
  VolumeChange = 3,
881
881
  RateChange = 4
882
882
  }
883
- declare type mediaInteractionParam = {
883
+ type mediaInteractionParam = {
884
884
  type: MediaInteractions;
885
885
  id: number;
886
886
  currentTime?: number;
@@ -888,25 +888,25 @@ declare type mediaInteractionParam = {
888
888
  muted?: boolean;
889
889
  playbackRate?: number;
890
890
  };
891
- declare type mediaInteractionCallback = (p: mediaInteractionParam) => void;
892
- declare type SelectionRange = {
891
+ type mediaInteractionCallback = (p: mediaInteractionParam) => void;
892
+ type SelectionRange = {
893
893
  start: number;
894
894
  startOffset: number;
895
895
  end: number;
896
896
  endOffset: number;
897
897
  };
898
- declare type selectionParam = {
898
+ type selectionParam = {
899
899
  ranges: Array<SelectionRange>;
900
900
  };
901
- declare type selectionCallback = (p: selectionParam) => void;
902
- declare type listenerHandler = () => void;
903
- declare type KeepIframeSrcFn = (src: string) => boolean;
901
+ type selectionCallback = (p: selectionParam) => void;
902
+ type listenerHandler = () => void;
903
+ type KeepIframeSrcFn = (src: string) => boolean;
904
904
  declare global {
905
905
  interface Window {
906
906
  FontFace: typeof FontFace;
907
907
  }
908
908
  }
909
- declare type IWindow = Window & typeof globalThis;
909
+ type IWindow = Window & typeof globalThis;
910
910
 
911
911
  declare type rrwebRecord = {
912
912
  (options: recordOptions<eventWithTime>): listenerHandler;