@base44-preview/sdk 0.8.11-pr.64.91ff6ae → 0.8.11-pr.65.dc85e14
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.
|
@@ -2,6 +2,7 @@ import { AxiosInstance } from "axios";
|
|
|
2
2
|
import { TrackEventParams, AnalyticsModuleOptions } from "./analytics.types";
|
|
3
3
|
import type { AuthModule } from "./auth.types";
|
|
4
4
|
export declare const USER_HEARTBEAT_EVENT_NAME = "__user_heartbeat_event__";
|
|
5
|
+
export declare const ANALYTICS_REFERRER_EVENT_NAME = "__referrer_event__";
|
|
5
6
|
export declare const ANALYTICS_CONFIG_ENABLE_URL_PARAM_KEY = "analytics-enable";
|
|
6
7
|
export declare const ANALYTICS_SESSION_ID_LOCAL_STORAGE_KEY = "base44_analytics_session_id";
|
|
7
8
|
export interface AnalyticsModuleArgs {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getSharedInstance } from "../utils/sharedInstance";
|
|
2
2
|
import { generateUuid } from "../utils/common";
|
|
3
3
|
export const USER_HEARTBEAT_EVENT_NAME = "__user_heartbeat_event__";
|
|
4
|
+
export const ANALYTICS_REFERRER_EVENT_NAME = "__referrer_event__";
|
|
4
5
|
export const ANALYTICS_CONFIG_ENABLE_URL_PARAM_KEY = "analytics-enable";
|
|
5
6
|
export const ANALYTICS_SESSION_ID_LOCAL_STORAGE_KEY = "base44_analytics_session_id";
|
|
6
7
|
const defaultConfiguration = {
|
|
@@ -20,6 +21,7 @@ const analyticsSharedState = getSharedInstance(ANALYTICS_SHARED_STATE_NAME, () =
|
|
|
20
21
|
requestsQueue: [],
|
|
21
22
|
isProcessing: false,
|
|
22
23
|
isHeartBeatProcessing: false,
|
|
24
|
+
wasReferrerTracked: false,
|
|
23
25
|
sessionContext: null,
|
|
24
26
|
config: {
|
|
25
27
|
...defaultConfiguration,
|
|
@@ -124,6 +126,8 @@ export const createAnalyticsModule = ({ axiosClient, serverUrl, appId, userAuthM
|
|
|
124
126
|
startProcessing();
|
|
125
127
|
// start the heart beat processor //
|
|
126
128
|
clearHeartBeatProcessor = startHeartBeatProcessor(track);
|
|
129
|
+
// track the referrer event //
|
|
130
|
+
trackReferrerEvent(track);
|
|
127
131
|
// start the visibility change listener //
|
|
128
132
|
if (typeof window !== "undefined") {
|
|
129
133
|
window.addEventListener("visibilitychange", onVisibilityChange);
|
|
@@ -166,6 +170,15 @@ function startHeartBeatProcessor(track) {
|
|
|
166
170
|
analyticsSharedState.isHeartBeatProcessing = false;
|
|
167
171
|
};
|
|
168
172
|
}
|
|
173
|
+
function trackReferrerEvent(track) {
|
|
174
|
+
if (typeof window === "undefined" || analyticsSharedState.wasReferrerTracked)
|
|
175
|
+
return;
|
|
176
|
+
analyticsSharedState.wasReferrerTracked = true;
|
|
177
|
+
const referrer = document.referrer;
|
|
178
|
+
if (!referrer)
|
|
179
|
+
return;
|
|
180
|
+
track({ eventName: ANALYTICS_REFERRER_EVENT_NAME, properties: { referrer } });
|
|
181
|
+
}
|
|
169
182
|
function getEventIntrinsicData() {
|
|
170
183
|
return {
|
|
171
184
|
timestamp: new Date().toISOString(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/sdk",
|
|
3
|
-
"version": "0.8.11-pr.
|
|
3
|
+
"version": "0.8.11-pr.65.dc85e14",
|
|
4
4
|
"description": "JavaScript SDK for Base44 API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,18 +32,15 @@
|
|
|
32
32
|
"@types/hast": "^3.0.4",
|
|
33
33
|
"@types/node": "^25.0.1",
|
|
34
34
|
"@types/unist": "^3.0.3",
|
|
35
|
-
"@typescript-eslint/parser": "^8.51.0",
|
|
36
35
|
"@vitest/coverage-istanbul": "^1.0.0",
|
|
37
36
|
"@vitest/coverage-v8": "^1.0.0",
|
|
38
37
|
"@vitest/ui": "^1.0.0",
|
|
39
38
|
"dotenv": "^16.3.1",
|
|
40
|
-
"eslint": "^
|
|
41
|
-
"eslint-plugin-import": "^2.32.0",
|
|
39
|
+
"eslint": "^8.54.0",
|
|
42
40
|
"nock": "^13.4.0",
|
|
43
41
|
"typedoc": "^0.28.14",
|
|
44
42
|
"typedoc-plugin-markdown": "^4.9.0",
|
|
45
43
|
"typescript": "^5.3.2",
|
|
46
|
-
"typescript-eslint": "^8.51.0",
|
|
47
44
|
"vitest": "^1.6.1"
|
|
48
45
|
},
|
|
49
46
|
"keywords": [
|
|
@@ -60,5 +57,6 @@
|
|
|
60
57
|
"bugs": {
|
|
61
58
|
"url": "https://github.com/base44/sdk/issues"
|
|
62
59
|
},
|
|
63
|
-
"homepage": "https://github.com/base44/sdk#readme"
|
|
60
|
+
"homepage": "https://github.com/base44/sdk#readme",
|
|
61
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
64
62
|
}
|