Use uuid package instead of crypto package (#9191)

Fixes #9186
This commit is contained in:
Félix Malfait
2024-12-23 12:04:15 +01:00
committed by GitHub
parent 80bc38fc96
commit 164f010501
2 changed files with 4 additions and 10 deletions

View File

@ -1,4 +1,5 @@
import { useCallback } from 'react';
import { v4 } from 'uuid';
import { useTrackMutation } from '~/generated/graphql';
export interface EventData {
pathname: string;
@ -19,7 +20,7 @@ export const getSessionId = (): string => {
};
export const setSessionId = (domain?: string): void => {
const sessionId = getSessionId() || crypto.randomUUID();
const sessionId = getSessionId() || v4();
const baseCookie = `${ANALYTICS_COOKIE_NAME}=${sessionId}; Max-Age=1800; path=/; secure`;
const cookie = domain ? baseCookie + `; domain=${domain}` : baseCookie;