@openreplay/tracker 14.0.9 → 14.0.10-beta.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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 14.0.10
2
+
3
+ - adjust timestamps for messages from tracker instances inside child iframes (if they were loaded later)
4
+ - restart child trackers if parent tracker is restarted
5
+ - fixes for general stability of crossdomain iframe tracking
6
+
1
7
  # 14.0.9
2
8
 
3
9
  - more stable crossdomain iframe tracking (refactored child/parent process discovery)
@@ -18,6 +18,12 @@ export interface StartOptions {
18
18
  forceNew?: boolean;
19
19
  sessionHash?: string;
20
20
  assistOnly?: boolean;
21
+ /**
22
+ * @deprecated We strongly advise to use .start().then instead.
23
+ *
24
+ * This method is kept for snippet compatibility only
25
+ * */
26
+ startCallback?: (result: StartPromiseReturn) => void;
21
27
  }
22
28
  interface OnStartInfo {
23
29
  sessionID: string;
@@ -37,6 +43,12 @@ declare const SuccessfulStart: (body: OnStartInfo) => SuccessfulStart;
37
43
  export type StartPromiseReturn = SuccessfulStart | UnsuccessfulStart;
38
44
  type StartCallback = (i: OnStartInfo) => void;
39
45
  type CommitCallback = (messages: Array<Message>) => void;
46
+ declare enum ActivityState {
47
+ NotActive = 0,
48
+ Starting = 1,
49
+ Active = 2,
50
+ ColdStart = 3
51
+ }
40
52
  type AppOptions = {
41
53
  revID: string;
42
54
  node_id: string;
@@ -94,12 +106,18 @@ type AppOptions = {
94
106
  parentDomain?: string;
95
107
  };
96
108
  network?: NetworkOptions;
109
+ /**
110
+ * use this flag if you're using Angular
111
+ * basically goes around window.Zone api changes to mutation observer
112
+ * and event listeners
113
+ * */
114
+ angularMode?: boolean;
97
115
  } & WebworkerOptions & SessOptions;
98
116
  export type Options = AppOptions & ObserverOptions & SanitizerOptions;
99
117
  export declare const DEFAULT_INGEST_POINT = "https://api.openreplay.com/ingest";
100
118
  export default class App {
101
119
  private readonly signalError;
102
- private readonly insideIframe;
120
+ readonly insideIframe: boolean;
103
121
  readonly nodes: Nodes;
104
122
  readonly ticker: Ticker;
105
123
  readonly projectKey: string;
@@ -140,18 +158,29 @@ export default class App {
140
158
  private rootId;
141
159
  private pageFrames;
142
160
  private frameOderNumber;
143
- private readonly initialHostName;
144
161
  private features;
145
162
  constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>, signalError: (error: string, apis: string[]) => void, insideIframe: boolean);
146
163
  /** used by child iframes for crossdomain only */
147
164
  parentActive: boolean;
148
165
  checkStatus: () => boolean;
149
- /** used by child iframes for crossdomain only */
150
- /** track app instances in crossdomain child iframes */
151
- crossdomainIframesModule: () => void;
166
+ parentCrossDomainFrameListener: (event: MessageEvent) => void;
167
+ /**
168
+ * context ids for iframes,
169
+ * order is not so important as long as its consistent
170
+ * */
171
+ trackedFrames: string[];
172
+ crossDomainIframeListener: (event: MessageEvent) => void;
173
+ /**
174
+ * { command : [remaining iframes] }
175
+ * + order of commands
176
+ **/
177
+ pollingQueue: Record<string, any>;
178
+ private readonly addCommand;
179
+ bootChildrenFrames: () => Promise<void>;
180
+ killChildrenFrames: () => void;
152
181
  signalIframeTracker: () => void;
153
182
  startTimeout: ReturnType<typeof setTimeout> | null;
154
- private allowAppStart;
183
+ allowAppStart(): void;
155
184
  private checkNodeId;
156
185
  private initWorker;
157
186
  private handleWorkerMsg;
@@ -176,9 +205,9 @@ export default class App {
176
205
  timestamp(): number;
177
206
  safe<T extends (this: any, ...args: any[]) => void>(fn: T): T;
178
207
  attachCommitCallback(cb: CommitCallback): void;
179
- attachStartCallback(cb: StartCallback, useSafe?: boolean): void;
180
- attachStopCallback(cb: () => any, useSafe?: boolean): void;
181
- attachEventListener(target: EventTarget, type: string, listener: EventListener, useSafe?: boolean, useCapture?: boolean): void;
208
+ attachStartCallback: (cb: StartCallback, useSafe?: boolean) => void;
209
+ attachStopCallback: (cb: () => any, useSafe?: boolean) => void;
210
+ attachEventListener: (target: EventTarget, type: string, listener: EventListener, useSafe?: boolean, useCapture?: boolean) => void;
182
211
  checkRequiredVersion(version: string): boolean;
183
212
  private getTrackerInfo;
184
213
  getSessionInfo(): {
@@ -260,6 +289,7 @@ export default class App {
260
289
  getUxtId(): number | null;
261
290
  waitStart(): Promise<unknown>;
262
291
  waitStarted(): Promise<unknown>;
292
+ waitStatus(status: ActivityState): Promise<unknown>;
263
293
  /**
264
294
  * basically we ask other tabs during constructor
265
295
  * and here we just apply 10ms delay just in case