@oxvo/browser 7.3.0 → 7.3.4

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 (35) hide show
  1. package/README.md +32 -0
  2. package/dist/cjs/entry.js +1452 -307
  3. package/dist/cjs/entry.js.map +1 -1
  4. package/dist/cjs/index.js +1452 -307
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/main/app/canvas.d.ts +5 -0
  7. package/dist/cjs/main/app/cross_domain_iframe.d.ts +44 -0
  8. package/dist/cjs/main/app/index.d.ts +53 -13
  9. package/dist/cjs/main/app/messages.gen.d.ts +2 -0
  10. package/dist/cjs/main/app/session.d.ts +1 -0
  11. package/dist/cjs/main/entry.d.ts +5 -5
  12. package/dist/cjs/main/index.d.ts +1 -1
  13. package/dist/cjs/main/modules/analytics/index.d.ts +5 -0
  14. package/dist/cjs/package.json +1 -0
  15. package/dist/lib/entry.js +1452 -307
  16. package/dist/lib/entry.js.map +1 -1
  17. package/dist/lib/index.js +1452 -307
  18. package/dist/lib/index.js.map +1 -1
  19. package/dist/lib/main/app/canvas.d.ts +5 -0
  20. package/dist/lib/main/app/cross_domain_iframe.d.ts +44 -0
  21. package/dist/lib/main/app/index.d.ts +53 -13
  22. package/dist/lib/main/app/messages.gen.d.ts +2 -0
  23. package/dist/lib/main/app/session.d.ts +1 -0
  24. package/dist/lib/main/entry.d.ts +5 -5
  25. package/dist/lib/main/index.d.ts +1 -1
  26. package/dist/lib/main/modules/analytics/index.d.ts +5 -0
  27. package/dist/types/main/app/canvas.d.ts +5 -0
  28. package/dist/types/main/app/cross_domain_iframe.d.ts +44 -0
  29. package/dist/types/main/app/index.d.ts +53 -13
  30. package/dist/types/main/app/messages.gen.d.ts +2 -0
  31. package/dist/types/main/app/session.d.ts +1 -0
  32. package/dist/types/main/entry.d.ts +5 -5
  33. package/dist/types/main/index.d.ts +1 -1
  34. package/dist/types/main/modules/analytics/index.d.ts +5 -0
  35. package/package.json +4 -3
@@ -20,6 +20,8 @@ declare class CanvasRecorder {
20
20
  private uploadQueue;
21
21
  private readonly MAX_CONCURRENT_UPLOADS;
22
22
  private readonly MAX_QUEUE_SIZE;
23
+ private readonly MAX_UPLOAD_ATTEMPTS;
24
+ private readonly MAX_RETRY_DELAY_MS;
23
25
  private readonly pendingBatches;
24
26
  private isProcessingQueue;
25
27
  constructor(app: App, options: Options);
@@ -39,7 +41,10 @@ declare class CanvasRecorder {
39
41
  }[], canvasId: number, createdAt: number): void;
40
42
  private processUploadQueue;
41
43
  private uploadBatch;
44
+ private isRetryableUploadStatus;
45
+ private waitBeforeUploadRetry;
42
46
  private cleanupCanvas;
47
+ flushPendingSnapshots(): void;
43
48
  clear(): void;
44
49
  }
45
50
  export default CanvasRecorder;
@@ -0,0 +1,44 @@
1
+ import type Message from './messages.gen.js';
2
+ export declare const CROSS_DOMAIN_IFRAME_PROTOCOL_VERSION: 1;
3
+ export declare const CROSS_DOMAIN_IFRAME_ALLOWED_MESSAGE_TYPES: ReadonlySet<number>;
4
+ export type CrossDomainIframeEnvelope = {
5
+ protocolVersion: typeof CROSS_DOMAIN_IFRAME_PROTOCOL_VERSION;
6
+ context: string;
7
+ nonce: string;
8
+ capability: string;
9
+ };
10
+ export type CrossDomainIframeHandshake = Omit<CrossDomainIframeEnvelope, 'capability'> & {
11
+ projectKey: string;
12
+ };
13
+ export type CrossDomainIframeSession = {
14
+ sessionID: string;
15
+ projectID?: string;
16
+ startedAt: number;
17
+ delayMs: number;
18
+ userUUID: string;
19
+ };
20
+ export type CrossDomainIframeCanvas = {
21
+ enabled: boolean;
22
+ quality?: 'low' | 'medium' | 'high';
23
+ fps?: number;
24
+ framesSupport?: boolean;
25
+ };
26
+ type ParsedIframeBatch = {
27
+ messages: Message[];
28
+ bytes: number;
29
+ } | null;
30
+ export declare function normalizeCrossDomainOrigin(value: unknown): string | null;
31
+ export declare function normalizeCrossDomainOrigins(values: unknown): Set<string>;
32
+ export declare function createCrossDomainSecret(): string | null;
33
+ export declare function parseCrossDomainHandshake(data: unknown, expectedLine: string, expectedProjectKey: string): CrossDomainIframeHandshake | null;
34
+ export declare function matchesCrossDomainEnvelope(data: unknown, expectedLine: string, expected: CrossDomainIframeEnvelope): data is Record<string, unknown> & CrossDomainIframeEnvelope;
35
+ export declare function parseCrossDomainFrameInit(data: unknown, expectedLine: string, expected: Pick<CrossDomainIframeEnvelope, 'context' | 'nonce'>): (CrossDomainIframeEnvelope & {
36
+ id: number;
37
+ frameOrderNumber: number;
38
+ frameLevel: number;
39
+ capabilityExpiresAt: number;
40
+ session: CrossDomainIframeSession;
41
+ canvas?: CrossDomainIframeCanvas;
42
+ }) | null;
43
+ export declare function parseCrossDomainIframeBatch(messages: unknown): ParsedIframeBatch;
44
+ export {};
@@ -30,6 +30,7 @@ export interface StartOptions {
30
30
  interface OnStartInfo {
31
31
  sessionID: string;
32
32
  sessionToken: string;
33
+ assistToken?: string;
33
34
  userUUID: string;
34
35
  }
35
36
  declare const CANCELED: "canceled";
@@ -97,11 +98,16 @@ type AppOptions = {
97
98
  * */
98
99
  enabled?: boolean;
99
100
  /**
100
- * used to send message up, will be '*' by default
101
- * (check your CSP settings)
102
- * @default '*'
101
+ * Exact parent origin used by a tracker running inside a child iframe.
102
+ * Wildcards are rejected.
103
103
  * */
104
104
  parentDomain?: string;
105
+ /**
106
+ * Exact child origins allowed to join the top-level recording. The
107
+ * cross-domain listener is not installed unless this list is non-empty.
108
+ * Wildcards are rejected.
109
+ * */
110
+ childOrigins?: string[];
105
111
  };
106
112
  networkCapture?: NetworkOptions;
107
113
  /**
@@ -162,6 +168,8 @@ export default class App {
162
168
  private canvasRecorder;
163
169
  private conditionsManager;
164
170
  private readonly markerWatcher;
171
+ private readonly bootstrapAttempts;
172
+ private offlineRecordingSessionToken;
165
173
  get tagMatcher(): TagMatcher;
166
174
  private canStart;
167
175
  private rootId;
@@ -169,22 +177,43 @@ export default class App {
169
177
  private frameOderNumber;
170
178
  private frameLevel;
171
179
  private emptyBatchCounter;
180
+ private readonly crossDomainChildOrigins;
181
+ private readonly crossDomainParentOrigin;
182
+ private readonly crossDomainFrameNonce;
183
+ private crossDomainFrameCapability;
184
+ private crossDomainFrameCapabilityExpiresAt;
185
+ private crossDomainFrameSession;
186
+ private crossDomainFrameCanvas;
187
+ private crossDomainResumeAfterHandshake;
188
+ private crossDomainConnectionRequested;
189
+ private readonly crossDomainFrames;
190
+ private readonly crossDomainEnvelopeBudgets;
191
+ private readonly pendingCrossDomainFrames;
192
+ private crossDomainAuthorizationGeneration;
193
+ private nextCrossDomainFrameOrder;
194
+ private crossDomainCanvasConfig;
172
195
  constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>, signalError: (error: string, apis: string[]) => void, insideIframe: boolean);
173
196
  /** used by child iframes for crossdomain only */
174
197
  parentActive: boolean;
175
198
  checkStatus: () => boolean;
199
+ private postToParent;
200
+ private postHandshakeToParent;
201
+ private applyCrossDomainFrameInit;
202
+ private clearCrossDomainFrameAuthorization;
176
203
  parentCrossDomainFrameListener: (event: MessageEvent) => void;
177
- trackedFrames: string[];
178
- private frameLastSeen;
179
- private readonly FRAME_STALE_MS;
180
- private pruneStaleFrames;
204
+ private findCrossDomainFrame;
205
+ private revokeCrossDomainFrame;
206
+ private pruneDetachedCrossDomainFrames;
207
+ private currentCrossDomainSession;
208
+ private frameInitPayload;
209
+ private rotateCrossDomainFrameCapability;
210
+ private crossDomainFrameNeedsRotation;
211
+ private postToCrossDomainFrame;
212
+ private consumeCrossDomainEnvelopeBudget;
213
+ private establishCrossDomainFrame;
214
+ private validatedCrossDomainFrame;
215
+ private consumeCrossDomainFrameBudget;
181
216
  crossDomainIframeListener: (event: MessageEvent) => void;
182
- /**
183
- * { command : [remaining iframes] }
184
- * + order of commands
185
- **/
186
- pollingQueue: Record<string, any>;
187
- private readonly addCommand;
188
217
  bootChildrenFrames: () => Promise<void>;
189
218
  killChildrenFrames: () => void;
190
219
  signalIframeTracker: () => void;
@@ -221,6 +250,15 @@ export default class App {
221
250
  checkRequiredVersion(version: string): boolean;
222
251
  private getTrackerInfo;
223
252
  private buildStartPayload;
253
+ private getBootstrapAttemptStorageKey;
254
+ private isValidBootstrapAttempt;
255
+ private removeStoredBootstrapAttempt;
256
+ private loadBootstrapAttempt;
257
+ private getOrCreateBootstrapAttempt;
258
+ private clearBootstrapAttempt;
259
+ private buildBootstrapIntentFingerprint;
260
+ private parseBootstrapIntent;
261
+ private bootstrapIntentsMatch;
224
262
  getSessionMeta(): {
225
263
  userUUID: string | null;
226
264
  projectKey: string;
@@ -294,6 +332,7 @@ export default class App {
294
332
  uploadOfflineRecording(): Promise<void>;
295
333
  prevOpts: StartOptions;
296
334
  private userStartCallback?;
335
+ private startCrossDomainFrame;
297
336
  private _start;
298
337
  restartCanvasTracking: () => void;
299
338
  attachResanitizeCallback: (cb: (node: Node, id: number) => void) => void;
@@ -302,6 +341,7 @@ export default class App {
302
341
  checkSanitization: (el: Node) => SanitizeLevel | undefined;
303
342
  flushBuffer: (buffer: Message[]) => Promise<unknown>;
304
343
  waitStart(): Promise<unknown>;
344
+ private waitCrossDomainStart;
305
345
  waitStarted(): Promise<unknown>;
306
346
  waitStatus(status: ActivityState): Promise<unknown>;
307
347
  /**
@@ -1,5 +1,7 @@
1
1
  import * as Messages from '../../common/messages.gen.js';
2
2
  export { default, Type } from '../../common/messages.gen.js';
3
+ export type MessageFieldType = 'number' | 'string' | 'boolean';
4
+ export declare const MESSAGE_FIELD_TYPES: Readonly<Record<number, readonly MessageFieldType[]>>;
3
5
  export declare function Timestamp(timestamp: number): Messages.Timestamp;
4
6
  export declare function SetPageLocationDeprecated(url: string, referrer: string, navigationStart: number): Messages.SetPageLocationDeprecated;
5
7
  export declare function SetViewportSize(width: number, height: number): Messages.SetViewportSize;
@@ -47,6 +47,7 @@ export default class Session {
47
47
  getSessionSecret: (projectKey?: string) => string | undefined;
48
48
  getRawSecretWithProject: () => string | null;
49
49
  setSessionSecret: (token: string, projectKey: string) => void;
50
+ clearSessionSecret: () => void;
50
51
  applySessionHash(hash: string): void;
51
52
  getSessionHash(): string | undefined;
52
53
  getTabId(): string;
@@ -1,6 +1,6 @@
1
- import TrackerClass from './index';
2
- export { default as App } from './app/index';
3
- export { default as browser, default as oxvosessions } from './singleton';
4
- export { SanitizeLevel, Messages, Options } from './index';
5
- export { default as Analytics } from './modules/analytics/index';
1
+ import TrackerClass from './index.js';
2
+ export { default as App } from './app/index.js';
3
+ export { default as browser, default as oxvosessions } from './singleton.js';
4
+ export { SanitizeLevel, Messages, Options } from './index.js';
5
+ export { default as Analytics } from './modules/analytics/index.js';
6
6
  export default TrackerClass;
@@ -1,4 +1,4 @@
1
- import App from './app/index';
1
+ import App from './app/index.js';
2
2
  export { default as App } from './app/index.js';
3
3
  import * as _Messages from './app/messages.gen.js';
4
4
  export declare const Messages: typeof _Messages;
@@ -32,6 +32,7 @@ export default class Analytics {
32
32
  private readonly getTimestamp;
33
33
  private readonly setUserId;
34
34
  private readonly standalone;
35
+ private pendingStartAttempt;
35
36
  /**
36
37
  * @param localStorage Class or Object that implements Storage-like interface that stores
37
38
  * values persistently like window.localStorage or any other file-based storage
@@ -50,6 +51,10 @@ export default class Analytics {
50
51
  constructor(options: Options);
51
52
  _getToken: () => string | null;
52
53
  _getTimestamp: () => number;
54
+ private loadStartAttempt;
55
+ private isValidStartAttempt;
56
+ private startAttempt;
57
+ private clearStartAttempt;
53
58
  init: () => Promise<void>;
54
59
  /**
55
60
  * Used by tracker when running in blundled mode
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}