WHAT IS THIS CONTEXT GRABBING OMG

This commit is contained in:
Ritul Jadhav 2026-03-27 00:32:01 +05:30
parent 85c0d4bab5
commit 8416078496

View File

@ -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)
|| ''
);