sobey-monitor-sdk 1.1.12 → 1.1.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/dist/core/context.d.ts +2 -1
- package/dist/index.cjs.js +20 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +20 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +20 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -180,12 +180,30 @@
|
|
|
180
180
|
this.breadcrumbs = [];
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
|
-
*
|
|
183
|
+
* 生成或获取会话 ID
|
|
184
|
+
* sessionId 保存在 sessionStorage 中,同一标签页会话期间保持不变
|
|
184
185
|
*/
|
|
185
186
|
generateSessionId() {
|
|
187
|
+
const storageKey = '__sobey_monitor_session_id__';
|
|
188
|
+
try {
|
|
189
|
+
const existing = sessionStorage.getItem(storageKey);
|
|
190
|
+
if (existing) {
|
|
191
|
+
return existing;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
// sessionStorage 不可用,继续生成新的
|
|
196
|
+
}
|
|
186
197
|
const timestamp = Date.now().toString(36);
|
|
187
198
|
const randomPart = Math.random().toString(36).substring(2, 10);
|
|
188
|
-
|
|
199
|
+
const newSessionId = `${timestamp}-${randomPart}`;
|
|
200
|
+
try {
|
|
201
|
+
sessionStorage.setItem(storageKey, newSessionId);
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
// 忽略存储错误
|
|
205
|
+
}
|
|
206
|
+
return newSessionId;
|
|
189
207
|
}
|
|
190
208
|
/**
|
|
191
209
|
* 收集设备信息
|