Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 12x 12x 28x 28x 28x 28x 28x 28x 12x 53x 53x 53x 4x 4x 9x 9x 40x 40x 53x 53x 2x 53x | export const DEFAULT_AGENT_VERSION = '3'
export function getAgentScriptEndpoint(baseCdnUrl: string, searchParams: URLSearchParams): string {
const apiKey = searchParams.get('apiKey')
const apiVersion = searchParams.get('version') || DEFAULT_AGENT_VERSION
const base = `https://${baseCdnUrl}/v${apiVersion}/${apiKey}`
const loaderVersion = searchParams.get('loaderVersion')
const lv = loaderVersion ? `/loader_v${loaderVersion}.js` : ''
return `${base}${lv}`
}
export function getVisitorIdEndpoint(
baseIngressUrl: string,
searchParams: URLSearchParams,
pathSuffix: string | undefined = undefined
): string {
const region = searchParams.get('region') || 'us'
let prefix = ''
switch (region) {
case 'eu':
prefix = 'eu.'
break
case 'ap':
prefix = 'ap.'
break
default:
prefix = ''
break
}
let suffix = pathSuffix ?? ''
if (suffix.length > 0 && !suffix.startsWith('/')) {
suffix = '/' + suffix
}
return `https://${prefix}${baseIngressUrl}${suffix}`
}
|