From 8416078496fbec8a621c3bddc59e5871af34484d Mon Sep 17 00:00:00 2001 From: Ritul Date: Fri, 27 Mar 2026 00:32:01 +0530 Subject: [PATCH] WHAT IS THIS CONTEXT GRABBING OMG --- client/src/utils/runtimeContext.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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) || '' );