@brainfish-ai/web-tracker 0.0.4-alpha.11 → 0.0.4-alpha.13
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/package.json +2 -2
- package/src/index.ts +0 -1
- package/src/tracker.ts +5 -5
- package/tsconfig.json +3 -2
- package/vite.config.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainfish-ai/web-tracker",
|
|
3
|
-
"version": "0.0.4-alpha.
|
|
3
|
+
"version": "0.0.4-alpha.13",
|
|
4
4
|
"module": "index.ts",
|
|
5
5
|
"description": "Brainfish Tracker for Web",
|
|
6
6
|
"private": false,
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"vite-tsconfig-paths": "^4.2.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@brainfish-ai/tracker-sdk": "0.0.1-alpha.
|
|
26
|
+
"@brainfish-ai/tracker-sdk": "0.0.1-alpha.3",
|
|
27
27
|
"html-to-image": "^1.11.11",
|
|
28
28
|
"redact-pii": "^3.4.0",
|
|
29
29
|
"rrweb": "^2.0.0-alpha.4",
|
package/src/index.ts
CHANGED
|
@@ -27,7 +27,6 @@ export const VERSION = import.meta.env.PACKAGE_VERSION as string;
|
|
|
27
27
|
export class Tracker extends TrackerSdk {
|
|
28
28
|
private lastPath = '';
|
|
29
29
|
private debounceTimer: ReturnType<typeof setTimeout> | null = null;
|
|
30
|
-
static mock: any;
|
|
31
30
|
|
|
32
31
|
constructor(public options: TrackerOptions) {
|
|
33
32
|
super({
|
package/src/tracker.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Tracker } from './index';
|
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
5
|
-
|
|
5
|
+
BrainfishAnalytics: {
|
|
6
6
|
q?: [string, ...any[]];
|
|
7
7
|
(method: string, ...args: any[]): void;
|
|
8
8
|
};
|
|
@@ -10,8 +10,8 @@ declare global {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
((window) => {
|
|
13
|
-
if (window.
|
|
14
|
-
const queue = window.
|
|
13
|
+
if (window.BrainfishAnalytics && 'q' in window.BrainfishAnalytics) {
|
|
14
|
+
const queue = window.BrainfishAnalytics.q || [];
|
|
15
15
|
const tracker = new Tracker(queue.shift()[1]) as any;
|
|
16
16
|
queue.forEach((item) => {
|
|
17
17
|
if (item[0] in tracker) {
|
|
@@ -19,12 +19,12 @@ declare global {
|
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
window.
|
|
22
|
+
window.BrainfishAnalytics = (t, ...args) => {
|
|
23
23
|
const fn = tracker[t] ? tracker[t].bind(tracker) : undefined;
|
|
24
24
|
if (typeof fn === 'function') {
|
|
25
25
|
fn(...args);
|
|
26
26
|
} else {
|
|
27
|
-
console.warn(`
|
|
27
|
+
console.warn(`Method ${t} does not exist on BrainfishAnalytics`);
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
}
|
package/tsconfig.json
CHANGED
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
"esModuleInterop": true,
|
|
9
9
|
"types": ["vite/client", "jest"],
|
|
10
10
|
"baseUrl": ".",
|
|
11
|
-
"declaration": true
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"resolveJsonModule": true
|
|
12
13
|
},
|
|
13
|
-
"include": ["src"],
|
|
14
|
+
"include": ["src", "./package.json"],
|
|
14
15
|
"exclude": ["src/**/*.test.ts", "src/**/*.spec.ts", "src/**/tests/**"]
|
|
15
16
|
}
|