@oxvo/browser 7.3.0 → 7.4.15

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 (41) hide show
  1. package/README.md +32 -0
  2. package/dist/cjs/entry.js +1961 -377
  3. package/dist/cjs/entry.js.map +1 -1
  4. package/dist/cjs/index.js +1955 -377
  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/debugRedaction.d.ts +11 -0
  9. package/dist/cjs/main/app/index.d.ts +70 -14
  10. package/dist/cjs/main/app/messages.gen.d.ts +2 -0
  11. package/dist/cjs/main/app/session.d.ts +1 -0
  12. package/dist/cjs/main/entry.d.ts +5 -5
  13. package/dist/cjs/main/index.d.ts +6 -1
  14. package/dist/cjs/main/modules/analytics/index.d.ts +5 -0
  15. package/dist/cjs/main/singleton.d.ts +5 -0
  16. package/dist/cjs/package.json +1 -0
  17. package/dist/lib/entry.js +1961 -377
  18. package/dist/lib/entry.js.map +1 -1
  19. package/dist/lib/index.js +1955 -377
  20. package/dist/lib/index.js.map +1 -1
  21. package/dist/lib/main/app/canvas.d.ts +5 -0
  22. package/dist/lib/main/app/cross_domain_iframe.d.ts +44 -0
  23. package/dist/lib/main/app/debugRedaction.d.ts +11 -0
  24. package/dist/lib/main/app/index.d.ts +70 -14
  25. package/dist/lib/main/app/messages.gen.d.ts +2 -0
  26. package/dist/lib/main/app/session.d.ts +1 -0
  27. package/dist/lib/main/entry.d.ts +5 -5
  28. package/dist/lib/main/index.d.ts +6 -1
  29. package/dist/lib/main/modules/analytics/index.d.ts +5 -0
  30. package/dist/lib/main/singleton.d.ts +5 -0
  31. package/dist/types/main/app/canvas.d.ts +5 -0
  32. package/dist/types/main/app/cross_domain_iframe.d.ts +44 -0
  33. package/dist/types/main/app/debugRedaction.d.ts +11 -0
  34. package/dist/types/main/app/index.d.ts +70 -14
  35. package/dist/types/main/app/messages.gen.d.ts +2 -0
  36. package/dist/types/main/app/session.d.ts +1 -0
  37. package/dist/types/main/entry.d.ts +5 -5
  38. package/dist/types/main/index.d.ts +6 -1
  39. package/dist/types/main/modules/analytics/index.d.ts +5 -0
  40. package/dist/types/main/singleton.d.ts +5 -0
  41. package/package.json +5 -4
@@ -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 {};
@@ -0,0 +1,11 @@
1
+ export declare const redactDebugText: (value: string) => string;
2
+ type DebugRedactionState = {
3
+ seen: WeakSet<object>;
4
+ remainingItems: number;
5
+ remainingText: number;
6
+ };
7
+ export declare const redactDebugValue: (value: unknown, state?: DebugRedactionState, depth?: number) => unknown;
8
+ export declare const redactDebugArgs: (values: unknown[]) => unknown[];
9
+ export declare const debugValueText: (value: unknown) => string;
10
+ export declare const redactedErrorFrom: (value: unknown, fallback: string, knownSecrets?: ReadonlyArray<string | null | undefined>) => Error;
11
+ export {};
@@ -30,9 +30,19 @@ export interface StartOptions {
30
30
  interface OnStartInfo {
31
31
  sessionID: string;
32
32
  sessionToken: string;
33
+ assistToken?: string;
33
34
  userUUID: string;
34
35
  }
36
+ type AssistSessionGrant = Readonly<{
37
+ sessionId: string;
38
+ token: string;
39
+ }>;
35
40
  declare const CANCELED: "canceled";
41
+ export type MessengerLinkageChallenge = Readonly<{
42
+ challenge: string;
43
+ sessionId: string;
44
+ expiresIn: number;
45
+ }>;
36
46
  type SuccessfulStart = OnStartInfo & {
37
47
  success: true;
38
48
  };
@@ -97,11 +107,16 @@ type AppOptions = {
97
107
  * */
98
108
  enabled?: boolean;
99
109
  /**
100
- * used to send message up, will be '*' by default
101
- * (check your CSP settings)
102
- * @default '*'
110
+ * Exact parent origin used by a tracker running inside a child iframe.
111
+ * Wildcards are rejected.
103
112
  * */
104
113
  parentDomain?: string;
114
+ /**
115
+ * Exact child origins allowed to join the top-level recording. The
116
+ * cross-domain listener is not installed unless this list is non-empty.
117
+ * Wildcards are rejected.
118
+ * */
119
+ childOrigins?: string[];
105
120
  };
106
121
  networkCapture?: NetworkOptions;
107
122
  /**
@@ -162,6 +177,9 @@ export default class App {
162
177
  private canvasRecorder;
163
178
  private conditionsManager;
164
179
  private readonly markerWatcher;
180
+ private readonly bootstrapAttempts;
181
+ private offlineRecordingSessionToken;
182
+ private assistSessionGrant;
165
183
  get tagMatcher(): TagMatcher;
166
184
  private canStart;
167
185
  private rootId;
@@ -169,22 +187,43 @@ export default class App {
169
187
  private frameOderNumber;
170
188
  private frameLevel;
171
189
  private emptyBatchCounter;
190
+ private readonly crossDomainChildOrigins;
191
+ private readonly crossDomainParentOrigin;
192
+ private readonly crossDomainFrameNonce;
193
+ private crossDomainFrameCapability;
194
+ private crossDomainFrameCapabilityExpiresAt;
195
+ private crossDomainFrameSession;
196
+ private crossDomainFrameCanvas;
197
+ private crossDomainResumeAfterHandshake;
198
+ private crossDomainConnectionRequested;
199
+ private readonly crossDomainFrames;
200
+ private readonly crossDomainEnvelopeBudgets;
201
+ private readonly pendingCrossDomainFrames;
202
+ private crossDomainAuthorizationGeneration;
203
+ private nextCrossDomainFrameOrder;
204
+ private crossDomainCanvasConfig;
172
205
  constructor(projectKey: string, sessionToken: string | undefined, options: Partial<Options>, signalError: (error: string, apis: string[]) => void, insideIframe: boolean);
173
206
  /** used by child iframes for crossdomain only */
174
207
  parentActive: boolean;
175
208
  checkStatus: () => boolean;
209
+ private postToParent;
210
+ private postHandshakeToParent;
211
+ private applyCrossDomainFrameInit;
212
+ private clearCrossDomainFrameAuthorization;
176
213
  parentCrossDomainFrameListener: (event: MessageEvent) => void;
177
- trackedFrames: string[];
178
- private frameLastSeen;
179
- private readonly FRAME_STALE_MS;
180
- private pruneStaleFrames;
214
+ private findCrossDomainFrame;
215
+ private revokeCrossDomainFrame;
216
+ private pruneDetachedCrossDomainFrames;
217
+ private currentCrossDomainSession;
218
+ private frameInitPayload;
219
+ private rotateCrossDomainFrameCapability;
220
+ private crossDomainFrameNeedsRotation;
221
+ private postToCrossDomainFrame;
222
+ private consumeCrossDomainEnvelopeBudget;
223
+ private establishCrossDomainFrame;
224
+ private validatedCrossDomainFrame;
225
+ private consumeCrossDomainFrameBudget;
181
226
  crossDomainIframeListener: (event: MessageEvent) => void;
182
- /**
183
- * { command : [remaining iframes] }
184
- * + order of commands
185
- **/
186
- pollingQueue: Record<string, any>;
187
- private readonly addCommand;
188
227
  bootChildrenFrames: () => Promise<void>;
189
228
  killChildrenFrames: () => void;
190
229
  signalIframeTracker: () => void;
@@ -221,18 +260,33 @@ export default class App {
221
260
  checkRequiredVersion(version: string): boolean;
222
261
  private getTrackerInfo;
223
262
  private buildStartPayload;
263
+ private getBootstrapAttemptStorageKey;
264
+ private isValidBootstrapAttempt;
265
+ private removeStoredBootstrapAttempt;
266
+ private loadBootstrapAttempt;
267
+ private getOrCreateBootstrapAttempt;
268
+ private clearBootstrapAttempt;
269
+ private buildBootstrapIntentFingerprint;
270
+ private parseBootstrapIntent;
271
+ private bootstrapIntentsMatch;
224
272
  getSessionMeta(): {
225
273
  userUUID: string | null;
226
274
  projectKey: string;
227
275
  revID: string;
228
276
  trackerVersion: string;
229
277
  isSnippet: boolean;
278
+ metadata: {
279
+ [x: string]: string;
280
+ };
230
281
  sessionID: string | undefined;
231
- metadata: Record<string, string>;
232
282
  userID: string | null;
233
283
  timestamp: number;
234
284
  projectID?: string;
235
285
  };
286
+ requestMessengerLinkageChallenge(): Promise<MessengerLinkageChallenge | null>;
287
+ getAssistSessionGrant(): AssistSessionGrant | null;
288
+ private setAssistSessionGrant;
289
+ private clearAssistSessionGrant;
236
290
  getSessionSecret(): string | undefined;
237
291
  getSessionKey(): string | undefined;
238
292
  getSessionLink(options?: {
@@ -294,6 +348,7 @@ export default class App {
294
348
  uploadOfflineRecording(): Promise<void>;
295
349
  prevOpts: StartOptions;
296
350
  private userStartCallback?;
351
+ private startCrossDomainFrame;
297
352
  private _start;
298
353
  restartCanvasTracking: () => void;
299
354
  attachResanitizeCallback: (cb: (node: Node, id: number) => void) => void;
@@ -302,6 +357,7 @@ export default class App {
302
357
  checkSanitization: (el: Node) => SanitizeLevel | undefined;
303
358
  flushBuffer: (buffer: Message[]) => Promise<unknown>;
304
359
  waitStart(): Promise<unknown>;
360
+ private waitCrossDomainStart;
305
361
  waitStarted(): Promise<unknown>;
306
362
  waitStatus(status: ActivityState): Promise<unknown>;
307
363
  /**
@@ -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;
@@ -109,6 +109,11 @@ export default class API {
109
109
  stop(): string | undefined;
110
110
  forceFlushBatch(): void;
111
111
  getSessionSecret(): string | null | undefined;
112
+ requestMessengerLinkageChallenge(): Promise<Readonly<{
113
+ challenge: string;
114
+ sessionId: string;
115
+ expiresIn: number;
116
+ }> | null>;
112
117
  getSessionMeta(): SessionInfo | null;
113
118
  getSessionKey(): string | null | undefined;
114
119
  getTabId(): string | null;
@@ -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
@@ -34,6 +34,11 @@ declare class BrowserSingleton {
34
34
  }): string | undefined;
35
35
  getSessionKey(): string | null | undefined;
36
36
  getSessionSecret(): string | null | undefined;
37
+ requestMessengerLinkageChallenge(): Promise<Readonly<{
38
+ challenge: string;
39
+ sessionId: string;
40
+ expiresIn: number;
41
+ }> | null>;
37
42
  track(key: string, payload?: any, issue?: boolean): void;
38
43
  report(key: string, payload?: any): void;
39
44
  handleError(e: Error | ErrorEvent | PromiseRejectionEvent, metadata?: Record<string, any>): void;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}