@openreplay/tracker 13.0.2 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/bun.lockb +0 -0
  3. package/cjs/app/index.d.ts +38 -16
  4. package/cjs/app/index.js +417 -236
  5. package/cjs/app/messages.gen.d.ts +6 -3
  6. package/cjs/app/messages.gen.js +44 -10
  7. package/cjs/app/nodes.d.ts +2 -0
  8. package/cjs/app/nodes.js +15 -1
  9. package/cjs/app/observer/iframe_observer.d.ts +1 -0
  10. package/cjs/app/observer/iframe_observer.js +9 -0
  11. package/cjs/app/observer/iframe_offsets.js +0 -1
  12. package/cjs/app/observer/top_observer.d.ts +1 -0
  13. package/cjs/app/observer/top_observer.js +14 -0
  14. package/cjs/common/messages.gen.d.ts +38 -10
  15. package/cjs/index.d.ts +1 -0
  16. package/cjs/index.js +17 -8
  17. package/cjs/modules/conditionsManager.js +2 -2
  18. package/cjs/modules/mouse.js +14 -1
  19. package/cjs/modules/scroll.d.ts +1 -1
  20. package/cjs/modules/scroll.js +9 -4
  21. package/cjs/modules/viewport.js +2 -2
  22. package/cjs/utils.d.ts +2 -1
  23. package/cjs/utils.js +33 -6
  24. package/lib/app/index.d.ts +38 -16
  25. package/lib/app/index.js +399 -218
  26. package/lib/app/messages.gen.d.ts +6 -3
  27. package/lib/app/messages.gen.js +37 -6
  28. package/lib/app/nodes.d.ts +2 -0
  29. package/lib/app/nodes.js +15 -1
  30. package/lib/app/observer/iframe_observer.d.ts +1 -0
  31. package/lib/app/observer/iframe_observer.js +9 -0
  32. package/lib/app/observer/iframe_offsets.js +0 -1
  33. package/lib/app/observer/top_observer.d.ts +1 -0
  34. package/lib/app/observer/top_observer.js +14 -0
  35. package/lib/common/messages.gen.d.ts +38 -10
  36. package/lib/common/tsconfig.tsbuildinfo +1 -1
  37. package/lib/index.d.ts +1 -0
  38. package/lib/index.js +18 -9
  39. package/lib/modules/conditionsManager.js +2 -2
  40. package/lib/modules/mouse.js +14 -1
  41. package/lib/modules/scroll.d.ts +1 -1
  42. package/lib/modules/scroll.js +9 -4
  43. package/lib/modules/viewport.js +2 -2
  44. package/lib/utils.d.ts +2 -1
  45. package/lib/utils.js +31 -5
  46. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 15.0.0
2
+
3
+ - updated graphql plugin and messages
4
+
5
+ # 14.0.0
6
+
7
+ - titles for tabs
8
+ - new `MouseClick` message to introduce heatmaps instead of clickmaps
9
+ - crossdomain iframe tracking functionality
10
+
1
11
  # 13.0.2
2
12
 
3
13
  - more file extensions for canvas
package/bun.lockb CHANGED
Binary file
@@ -1,17 +1,17 @@
1
+ import type { Options as WebworkerOptions } from '../common/interaction.js';
2
+ import AttributeSender from '../modules/attributeSender.js';
1
3
  import FeatureFlags from '../modules/featureFlags.js';
4
+ import type { Options as NetworkOptions } from '../modules/network.js';
5
+ import Logger, { ILogLevel } from './logger.js';
2
6
  import Message from './messages.gen.js';
3
7
  import Nodes from './nodes.js';
4
- import Observer from './observer/top_observer.js';
5
- import Sanitizer from './sanitizer.js';
6
- import Ticker from './ticker.js';
7
- import Logger, { ILogLevel } from './logger.js';
8
- import Session from './session.js';
9
- import AttributeSender from '../modules/attributeSender.js';
10
8
  import type { Options as ObserverOptions } from './observer/top_observer.js';
9
+ import Observer from './observer/top_observer.js';
11
10
  import type { Options as SanitizerOptions } from './sanitizer.js';
11
+ import Sanitizer from './sanitizer.js';
12
12
  import type { Options as SessOptions } from './session.js';
13
- import type { Options as NetworkOptions } from '../modules/network.js';
14
- import type { Options as WebworkerOptions } from '../common/interaction.js';
13
+ import Session from './session.js';
14
+ import Ticker from './ticker.js';
15
15
  export interface StartOptions {
16
16
  userID?: string;
17
17
  metadata?: Record<string, string>;
@@ -81,14 +81,25 @@ type AppOptions = {
81
81
  * */
82
82
  fileExt?: 'webp' | 'png' | 'jpeg' | 'avif';
83
83
  };
84
- /** @deprecated */
85
- onStart?: StartCallback;
84
+ crossdomain?: {
85
+ /**
86
+ * @default false
87
+ * */
88
+ enabled?: boolean;
89
+ /**
90
+ * used to send message up, will be '*' by default
91
+ * (check your CSP settings)
92
+ * @default '*'
93
+ * */
94
+ parentDomain?: string;
95
+ };
86
96
  network?: NetworkOptions;
87
97
  } & WebworkerOptions & SessOptions;
88
98
  export type Options = AppOptions & ObserverOptions & SanitizerOptions;
89
99
  export declare const DEFAULT_INGEST_POINT = "https://api.openreplay.com/ingest";
90
100
  export default class App {
91
101
  private readonly signalError;
102
+ private readonly insideIframe;
92
103
  readonly nodes: Nodes;
93
104
  readonly ticker: Ticker;
94
105
  readonly projectKey: string;
@@ -114,21 +125,29 @@ export default class App {
114
125
  private readonly revID;
115
126
  private activityState;
116
127
  private readonly version;
117
- private readonly worker?;
128
+ private worker?;
118
129
  attributeSender: AttributeSender;
119
130
  featureFlags: FeatureFlags;
120
131
  socketMode: boolean;
121
132
  private compressionThreshold;
122
- private restartAttempts;
123
133
  private readonly bc;
124
134
  private readonly contextId;
125
135
  private canvasRecorder;
126
136
  private uxtManager;
127
137
  private conditionsManager;
128
138
  private readonly tagWatcher;
129
- constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>, signalError: (error: string, apis: string[]) => void);
139
+ private canStart;
140
+ private rootId;
141
+ private pageFrames;
142
+ private frameOderNumber;
143
+ private readonly initialHostName;
144
+ constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>, signalError: (error: string, apis: string[]) => void, insideIframe: boolean);
145
+ startTimeout: ReturnType<typeof setTimeout> | null;
146
+ private allowAppStart;
147
+ private checkNodeId;
148
+ private initWorker;
149
+ private handleWorkerMsg;
130
150
  private _debug;
131
- private _usingOldFetchPlugin;
132
151
  send(message: Message, urgent?: boolean): void;
133
152
  /**
134
153
  * Normal workflow: add timestamp and tab data to batch, then commit it
@@ -185,10 +204,11 @@ export default class App {
185
204
  private checkSessionToken;
186
205
  /**
187
206
  * start buffering messages without starting the actual session, which gives
188
- * user 30 seconds to "activate" and record session by calling `start()` on conditional trigger
207
+ * user 30 seconds to "activate" and record session by calling `start()` on conditional trigger,
189
208
  * and we will then send buffered batch, so it won't get lost
190
209
  * */
191
210
  coldStart(startOpts?: StartOptions, conditional?: boolean): Promise<void>;
211
+ private setupConditionalStart;
192
212
  onSessionSent: () => void;
193
213
  /**
194
214
  * Starts offline session recording
@@ -203,7 +223,7 @@ export default class App {
203
223
  /**
204
224
  * Saves the captured messages in localStorage (or whatever is used in its place)
205
225
  *
206
- * Then when this.offlineRecording is called, it will preload this messages and clear the storage item
226
+ * Then, when this.offlineRecording is called, it will preload this messages and clear the storage item
207
227
  *
208
228
  * Keeping the size of local storage reasonable is up to the end users of this library
209
229
  * */
@@ -230,6 +250,8 @@ export default class App {
230
250
  onUxtCb: never[];
231
251
  addOnUxtCb(cb: (id: number) => void): void;
232
252
  getUxtId(): number | null;
253
+ waitStart(): Promise<unknown>;
254
+ waitStarted(): Promise<unknown>;
233
255
  /**
234
256
  * basically we ask other tabs during constructor
235
257
  * and here we just apply 10ms delay just in case