feat(analytics): persona logging upgrade and Sentry system config
Add client-logging SDK, expanded event taxonomy, API observability, admin domain events UI, and move SENTRY_DSN to HQ system settings with @sentry/node bootstrap after config preload. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
const SESSION_KEY = 'dukang_session_id';
|
||||
|
||||
export function getSessionId(): string {
|
||||
if (typeof localStorage === 'undefined') return 'ssr';
|
||||
let id = localStorage.getItem(SESSION_KEY);
|
||||
if (!id) {
|
||||
id =
|
||||
typeof crypto !== 'undefined' && 'randomUUID' in crypto
|
||||
? crypto.randomUUID()
|
||||
: `s_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
||||
localStorage.setItem(SESSION_KEY, id);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
export function touchSession(): string {
|
||||
return getSessionId();
|
||||
}
|
||||
Reference in New Issue
Block a user