@openreplay/tracker 3.4.8 → 3.4.9

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.
@@ -4,7 +4,7 @@ import Observer from "./observer.js";
4
4
  import Ticker from "./ticker.js";
5
5
  import type { Options as ObserverOptions } from "./observer.js";
6
6
  import type { Options as WebworkerOptions } from "../messages/webworker.js";
7
- interface OnStartInfo {
7
+ export interface OnStartInfo {
8
8
  sessionID: string;
9
9
  sessionToken: string;
10
10
  userUUID: string;
package/cjs/app/index.js CHANGED
@@ -17,7 +17,7 @@ class App {
17
17
  this.commitCallbacks = [];
18
18
  this._sessionID = null;
19
19
  this.isActive = false;
20
- this.version = '3.4.8';
20
+ this.version = '3.4.9';
21
21
  this.projectKey = projectKey;
22
22
  this.options = Object.assign({
23
23
  revID: '',
package/cjs/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import { Options as ExceptionOptions } from "./modules/exception.js";
8
8
  import { Options as InputOptions } from "./modules/input.js";
9
9
  import { Options as PerformanceOptions } from "./modules/performance.js";
10
10
  import { Options as TimingOptions } from "./modules/timing.js";
11
+ export type { OnStartInfo } from './app/index.js';
11
12
  export declare type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & PerformanceOptions & TimingOptions> & {
12
13
  projectID?: number;
13
14
  projectKey: string;
@@ -22,7 +23,7 @@ export default class API {
22
23
  use<T>(fn: (app: App | null, options?: Options) => T): T;
23
24
  isActive(): boolean;
24
25
  active(): boolean;
25
- start(): void;
26
+ start(): Promise<import("./app/index.js").OnStartInfo>;
26
27
  stop(): void;
27
28
  getSessionToken(): string | null | undefined;
28
29
  getSessionID(): string | null | undefined;
package/cjs/index.js CHANGED
@@ -115,7 +115,7 @@ class API {
115
115
  // no-cors issue only with text/plain or not-set Content-Type
116
116
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
117
117
  req.send(JSON.stringify({
118
- trackerVersion: '3.4.8',
118
+ trackerVersion: '3.4.9',
119
119
  projectKey: options.projectKey,
120
120
  doNotTrack,
121
121
  // TODO: add precise reason (an exact API missing)
@@ -138,12 +138,12 @@ class API {
138
138
  start() {
139
139
  if (!utils_js_1.IN_BROWSER) {
140
140
  console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${utils_js_1.DOCS_HOST}${DOCS_SETUP}`);
141
- return;
141
+ return Promise.reject("Trying to start not in browser.");
142
142
  }
143
143
  if (this.app === null) {
144
- return;
144
+ return Promise.reject("Browser doesn't support required api, or doNotTrack is active.");
145
145
  }
146
- this.app.start();
146
+ return this.app.start();
147
147
  }
148
148
  stop() {
149
149
  if (this.app === null) {
@@ -4,7 +4,7 @@ import Observer from "./observer.js";
4
4
  import Ticker from "./ticker.js";
5
5
  import type { Options as ObserverOptions } from "./observer.js";
6
6
  import type { Options as WebworkerOptions } from "../messages/webworker.js";
7
- interface OnStartInfo {
7
+ export interface OnStartInfo {
8
8
  sessionID: string;
9
9
  sessionToken: string;
10
10
  userUUID: string;
package/lib/app/index.js CHANGED
@@ -14,7 +14,7 @@ export default class App {
14
14
  this.commitCallbacks = [];
15
15
  this._sessionID = null;
16
16
  this.isActive = false;
17
- this.version = '3.4.8';
17
+ this.version = '3.4.9';
18
18
  this.projectKey = projectKey;
19
19
  this.options = Object.assign({
20
20
  revID: '',
package/lib/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import { Options as ExceptionOptions } from "./modules/exception.js";
8
8
  import { Options as InputOptions } from "./modules/input.js";
9
9
  import { Options as PerformanceOptions } from "./modules/performance.js";
10
10
  import { Options as TimingOptions } from "./modules/timing.js";
11
+ export type { OnStartInfo } from './app/index.js';
11
12
  export declare type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & InputOptions & PerformanceOptions & TimingOptions> & {
12
13
  projectID?: number;
13
14
  projectKey: string;
@@ -22,7 +23,7 @@ export default class API {
22
23
  use<T>(fn: (app: App | null, options?: Options) => T): T;
23
24
  isActive(): boolean;
24
25
  active(): boolean;
25
- start(): void;
26
+ start(): Promise<import("./app/index.js").OnStartInfo>;
26
27
  stop(): void;
27
28
  getSessionToken(): string | null | undefined;
28
29
  getSessionID(): string | null | undefined;
package/lib/index.js CHANGED
@@ -111,7 +111,7 @@ export default class API {
111
111
  // no-cors issue only with text/plain or not-set Content-Type
112
112
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
113
113
  req.send(JSON.stringify({
114
- trackerVersion: '3.4.8',
114
+ trackerVersion: '3.4.9',
115
115
  projectKey: options.projectKey,
116
116
  doNotTrack,
117
117
  // TODO: add precise reason (an exact API missing)
@@ -134,12 +134,12 @@ export default class API {
134
134
  start() {
135
135
  if (!IN_BROWSER) {
136
136
  console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${DOCS_HOST}${DOCS_SETUP}`);
137
- return;
137
+ return Promise.reject("Trying to start not in browser.");
138
138
  }
139
139
  if (this.app === null) {
140
- return;
140
+ return Promise.reject("Browser doesn't support required api, or doNotTrack is active.");
141
141
  }
142
- this.app.start();
142
+ return this.app.start();
143
143
  }
144
144
  stop() {
145
145
  if (this.app === null) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openreplay/tracker",
3
3
  "description": "The OpenReplay tracker main package",
4
- "version": "3.4.8",
4
+ "version": "3.4.9",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"