diff --git a/client/src/utils/runtimeContext.js b/client/src/utils/runtimeContext.js index 3265f6e..fab55fb 100644 --- a/client/src/utils/runtimeContext.js +++ b/client/src/utils/runtimeContext.js @@ -1,3 +1,10 @@ +const COMPANY_ID_QUERY_KEYS = [ + 'companyId', + 'company_id', + 'blt-gtw-fc-cid', + 'bltt-gtw-f-c-cid', +]; + function getRuntimeUrl() { if (typeof window === 'undefined') return null; @@ -39,9 +46,9 @@ export function getRuntimeCompanyId() { const referrerUrl = getReferrerUrl(); return ( - getFirstSearchParam(runtimeUrl, ['companyId', 'company_id', 'bltt-gtw-f-c-cid']) + getFirstSearchParam(runtimeUrl, COMPANY_ID_QUERY_KEYS) || getPathMatch(runtimeUrl?.pathname || '', /\/company\/([^/]+)/i) - || getFirstSearchParam(referrerUrl, ['companyId', 'company_id']) + || getFirstSearchParam(referrerUrl, COMPANY_ID_QUERY_KEYS) || getPathMatch(referrerUrl?.pathname || '', /\/company\/([^/]+)/i) || '' );