clientId.js (363B)
1 const STORAGE_CLIENT_ID = 'snow_client_id'; 2 3 export function getOrCreateClientId() { 4 try { 5 const existing = localStorage.getItem(STORAGE_CLIENT_ID); 6 if (existing) return existing; 7 } catch { 8 /* ignore */ 9 } 10 11 const id = crypto.randomUUID(); 12 try { 13 localStorage.setItem(STORAGE_CLIENT_ID, id); 14 } catch { 15 /* ignore */ 16 } 17 return id; 18 }