@nexly/web 0.15.0 → 0.15.2
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/dist/browser-meta.d.ts.map +1 -1
- package/dist/browser-meta.js +6 -1
- package/dist/session.d.ts +4 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +7 -3
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-meta.d.ts","sourceRoot":"","sources":["../src/browser-meta.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,4EAA4E;AAC5E,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmE5D;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"browser-meta.d.ts","sourceRoot":"","sources":["../src/browser-meta.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,4EAA4E;AAC5E,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmE5D;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgB1D;AAED,8DAA8D;AAC9D,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE5D"}
|
package/dist/browser-meta.js
CHANGED
|
@@ -89,7 +89,12 @@ export function collectEventMeta() {
|
|
|
89
89
|
out.visitor_id = safe(() => getVisitorId());
|
|
90
90
|
out.session_id = safe(() => getSessionId());
|
|
91
91
|
out.url = safe(() => window.location.href);
|
|
92
|
-
|
|
92
|
+
const pathname = safe(() => window.location.pathname);
|
|
93
|
+
out.pathname = pathname;
|
|
94
|
+
// Engagement/lifecycle events dispatch directly via sendBeaconCollect and
|
|
95
|
+
// bypass NexlyBase.dispatch (which adds `path` from getDefaultPath). Include
|
|
96
|
+
// `path` here so every event carries it.
|
|
97
|
+
out.path = pathname;
|
|
93
98
|
return filterEmpty(out);
|
|
94
99
|
}
|
|
95
100
|
/** Legacy: full browser metadata (session + event merged). */
|
package/dist/session.d.ts
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
export declare function getVisitorId(): string;
|
|
5
5
|
/**
|
|
6
6
|
* Session ID with 30-minute inactivity timeout.
|
|
7
|
+
*
|
|
8
|
+
* Stored in `localStorage` (not `sessionStorage`) so the same session is shared
|
|
9
|
+
* across tabs and survives tab/window close. The 30-minute inactivity window is
|
|
10
|
+
* enforced via `SESSION_TS_KEY`, matching Plausible's visit definition.
|
|
7
11
|
*/
|
|
8
12
|
export declare function getSessionId(): string;
|
|
9
13
|
//# sourceMappingURL=session.d.ts.map
|
package/dist/session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAoBA;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAUrC;AAED
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAoBA;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAUrC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAkBrC"}
|
package/dist/session.js
CHANGED
|
@@ -30,12 +30,16 @@ export function getVisitorId() {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Session ID with 30-minute inactivity timeout.
|
|
33
|
+
*
|
|
34
|
+
* Stored in `localStorage` (not `sessionStorage`) so the same session is shared
|
|
35
|
+
* across tabs and survives tab/window close. The 30-minute inactivity window is
|
|
36
|
+
* enforced via `SESSION_TS_KEY`, matching Plausible's visit definition.
|
|
33
37
|
*/
|
|
34
38
|
export function getSessionId() {
|
|
35
|
-
if (typeof
|
|
39
|
+
if (typeof localStorage === 'undefined') {
|
|
36
40
|
return generateId();
|
|
37
41
|
}
|
|
38
|
-
const existing =
|
|
42
|
+
const existing = localStorage.getItem(SESSION_KEY);
|
|
39
43
|
const tsRaw = localStorage.getItem(SESSION_TS_KEY);
|
|
40
44
|
const lastTs = tsRaw ? Number(tsRaw) : 0;
|
|
41
45
|
const now = nowMs();
|
|
@@ -44,7 +48,7 @@ export function getSessionId() {
|
|
|
44
48
|
return existing;
|
|
45
49
|
}
|
|
46
50
|
const id = generateId();
|
|
47
|
-
|
|
51
|
+
localStorage.setItem(SESSION_KEY, id);
|
|
48
52
|
localStorage.setItem(SESSION_TS_KEY, String(now));
|
|
49
53
|
return id;
|
|
50
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexly/web",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "Nexly browser ingest SDK: sendBeacon transport, DOM metadata, engagement listeners on top of @nexly/core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"node": ">=20"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@nexly/core": "0.15.
|
|
41
|
+
"@nexly/core": "0.15.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typescript": "~6.0.2"
|