@datadog/browser-core
Advanced tools
Comparing version 1.24.0 to 1.24.1
@@ -15,7 +15,2 @@ export declare const COOKIE_ACCESS_DELAY = 1000; | ||
export declare function areCookiesAuthorized(options: CookieOptions): boolean; | ||
/** | ||
* No API to retrieve it, number of levels for subdomain and suffix are unknown | ||
* strategy: find the minimal domain on which cookies are allowed to be set | ||
* https://web.dev/same-site-same-origin/#site | ||
*/ | ||
export declare function getCurrentSite(): string | undefined; |
@@ -52,3 +52,5 @@ "use strict"; | ||
try { | ||
var testCookieName = 'dd_cookie_test'; | ||
// Use a unique cookie name to avoid issues when the SDK is initialized multiple times during | ||
// the test cookie lifetime | ||
var testCookieName = "dd_cookie_test_" + utils_1.generateUUID(); | ||
var testCookieValue = 'test'; | ||
@@ -69,14 +71,20 @@ setCookie(testCookieName, testCookieValue, utils_1.ONE_SECOND, options); | ||
*/ | ||
var getCurrentSiteCache; | ||
function getCurrentSite() { | ||
var testCookieName = 'dd_site_test'; | ||
var testCookieValue = 'test'; | ||
var domainLevels = window.location.hostname.split('.'); | ||
var candidateDomain = domainLevels.pop(); | ||
while (domainLevels.length && !getCookie(testCookieName)) { | ||
candidateDomain = domainLevels.pop() + "." + candidateDomain; | ||
setCookie(testCookieName, testCookieValue, utils_1.ONE_SECOND, { domain: candidateDomain }); | ||
if (getCurrentSiteCache === undefined) { | ||
// Use a unique cookie name to avoid issues when the SDK is initialized multiple times during | ||
// the test cookie lifetime | ||
var testCookieName = "dd_site_test_" + utils_1.generateUUID(); | ||
var testCookieValue = 'test'; | ||
var domainLevels = window.location.hostname.split('.'); | ||
var candidateDomain = domainLevels.pop(); | ||
while (domainLevels.length && !getCookie(testCookieName)) { | ||
candidateDomain = domainLevels.pop() + "." + candidateDomain; | ||
setCookie(testCookieName, testCookieValue, utils_1.ONE_SECOND, { domain: candidateDomain }); | ||
} | ||
getCurrentSiteCache = candidateDomain; | ||
} | ||
return candidateDomain; | ||
return getCurrentSiteCache; | ||
} | ||
exports.getCurrentSite = getCurrentSite; | ||
//# sourceMappingURL=cookie.js.map |
@@ -15,3 +15,3 @@ import { Configuration } from './configuration'; | ||
stack?: string; | ||
origin: ErrorOrigin; | ||
origin: ErrorSource; | ||
} | ||
@@ -23,3 +23,3 @@ export interface HttpContext { | ||
} | ||
export declare enum ErrorOrigin { | ||
export declare enum ErrorSource { | ||
AGENT = "agent", | ||
@@ -44,3 +44,3 @@ CONSOLE = "console", | ||
kind: string | undefined; | ||
origin: ErrorOrigin; | ||
origin: ErrorSource; | ||
}; | ||
@@ -47,0 +47,0 @@ }; |
@@ -11,10 +11,10 @@ "use strict"; | ||
var xhrProxy_1 = require("./xhrProxy"); | ||
var ErrorOrigin; | ||
(function (ErrorOrigin) { | ||
ErrorOrigin["AGENT"] = "agent"; | ||
ErrorOrigin["CONSOLE"] = "console"; | ||
ErrorOrigin["NETWORK"] = "network"; | ||
ErrorOrigin["SOURCE"] = "source"; | ||
ErrorOrigin["LOGGER"] = "logger"; | ||
})(ErrorOrigin = exports.ErrorOrigin || (exports.ErrorOrigin = {})); | ||
var ErrorSource; | ||
(function (ErrorSource) { | ||
ErrorSource["AGENT"] = "agent"; | ||
ErrorSource["CONSOLE"] = "console"; | ||
ErrorSource["NETWORK"] = "network"; | ||
ErrorSource["SOURCE"] = "source"; | ||
ErrorSource["LOGGER"] = "logger"; | ||
})(ErrorSource = exports.ErrorSource || (exports.ErrorSource = {})); | ||
var filteredErrorsObservable; | ||
@@ -45,3 +45,3 @@ function startErrorCollection(configuration) { | ||
error: { | ||
origin: ErrorOrigin.AGENT, | ||
origin: ErrorSource.AGENT, | ||
}, | ||
@@ -70,3 +70,3 @@ }, | ||
error: { | ||
origin: ErrorOrigin.CONSOLE, | ||
origin: ErrorSource.CONSOLE, | ||
}, | ||
@@ -123,3 +123,3 @@ }, | ||
kind: stackTrace.name, | ||
origin: ErrorOrigin.SOURCE, | ||
origin: ErrorSource.SOURCE, | ||
}, | ||
@@ -151,3 +151,3 @@ }, | ||
error: { | ||
origin: ErrorOrigin.NETWORK, | ||
origin: ErrorSource.NETWORK, | ||
stack: truncateResponse(request.response, configuration) || 'Failed to load', | ||
@@ -154,0 +154,0 @@ }, |
export { DEFAULT_CONFIGURATION, Configuration, UserConfiguration, isIntakeRequest, buildCookieOptions, } from './configuration'; | ||
export { ErrorMessage, ErrorContext, HttpContext, ErrorOrigin, ErrorObservable } from './errorCollection'; | ||
export { ErrorMessage, ErrorContext, HttpContext, ErrorSource, ErrorObservable } from './errorCollection'; | ||
export { BuildEnv, BuildMode, Datacenter, defineGlobal, makeGlobal, commonInit, checkCookiesAuthorized, checkIsNotLocalFile, } from './init'; | ||
@@ -4,0 +4,0 @@ export { InternalMonitoring, MonitoringMessage, monitored, monitor, addMonitoringMessage } from './internalMonitoring'; |
@@ -9,3 +9,3 @@ "use strict"; | ||
var errorCollection_1 = require("./errorCollection"); | ||
exports.ErrorOrigin = errorCollection_1.ErrorOrigin; | ||
exports.ErrorSource = errorCollection_1.ErrorSource; | ||
var init_1 = require("./init"); | ||
@@ -12,0 +12,0 @@ exports.BuildMode = init_1.BuildMode; |
@@ -17,3 +17,3 @@ export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
} | ||
export declare enum ResourceKind { | ||
export declare enum ResourceType { | ||
DOCUMENT = "document", | ||
@@ -20,0 +20,0 @@ XHR = "xhr", |
@@ -20,15 +20,15 @@ "use strict"; | ||
})(DOM_EVENT = exports.DOM_EVENT || (exports.DOM_EVENT = {})); | ||
var ResourceKind; | ||
(function (ResourceKind) { | ||
ResourceKind["DOCUMENT"] = "document"; | ||
ResourceKind["XHR"] = "xhr"; | ||
ResourceKind["BEACON"] = "beacon"; | ||
ResourceKind["FETCH"] = "fetch"; | ||
ResourceKind["CSS"] = "css"; | ||
ResourceKind["JS"] = "js"; | ||
ResourceKind["IMAGE"] = "image"; | ||
ResourceKind["FONT"] = "font"; | ||
ResourceKind["MEDIA"] = "media"; | ||
ResourceKind["OTHER"] = "other"; | ||
})(ResourceKind = exports.ResourceKind || (exports.ResourceKind = {})); | ||
var ResourceType; | ||
(function (ResourceType) { | ||
ResourceType["DOCUMENT"] = "document"; | ||
ResourceType["XHR"] = "xhr"; | ||
ResourceType["BEACON"] = "beacon"; | ||
ResourceType["FETCH"] = "fetch"; | ||
ResourceType["CSS"] = "css"; | ||
ResourceType["JS"] = "js"; | ||
ResourceType["IMAGE"] = "image"; | ||
ResourceType["FONT"] = "font"; | ||
ResourceType["MEDIA"] = "media"; | ||
ResourceType["OTHER"] = "other"; | ||
})(ResourceType = exports.ResourceType || (exports.ResourceType = {})); | ||
var RequestType; | ||
@@ -35,0 +35,0 @@ (function (RequestType) { |
@@ -15,7 +15,2 @@ export declare const COOKIE_ACCESS_DELAY = 1000; | ||
export declare function areCookiesAuthorized(options: CookieOptions): boolean; | ||
/** | ||
* No API to retrieve it, number of levels for subdomain and suffix are unknown | ||
* strategy: find the minimal domain on which cookies are allowed to be set | ||
* https://web.dev/same-site-same-origin/#site | ||
*/ | ||
export declare function getCurrentSite(): string | undefined; |
@@ -1,2 +0,2 @@ | ||
import { findCommaSeparatedValue, ONE_SECOND } from './utils'; | ||
import { findCommaSeparatedValue, generateUUID, ONE_SECOND } from './utils'; | ||
export var COOKIE_ACCESS_DELAY = ONE_SECOND; | ||
@@ -47,3 +47,5 @@ export function cacheCookieAccess(name, options) { | ||
try { | ||
var testCookieName = 'dd_cookie_test'; | ||
// Use a unique cookie name to avoid issues when the SDK is initialized multiple times during | ||
// the test cookie lifetime | ||
var testCookieName = "dd_cookie_test_" + generateUUID(); | ||
var testCookieValue = 'test'; | ||
@@ -63,13 +65,19 @@ setCookie(testCookieName, testCookieValue, ONE_SECOND, options); | ||
*/ | ||
var getCurrentSiteCache; | ||
export function getCurrentSite() { | ||
var testCookieName = 'dd_site_test'; | ||
var testCookieValue = 'test'; | ||
var domainLevels = window.location.hostname.split('.'); | ||
var candidateDomain = domainLevels.pop(); | ||
while (domainLevels.length && !getCookie(testCookieName)) { | ||
candidateDomain = domainLevels.pop() + "." + candidateDomain; | ||
setCookie(testCookieName, testCookieValue, ONE_SECOND, { domain: candidateDomain }); | ||
if (getCurrentSiteCache === undefined) { | ||
// Use a unique cookie name to avoid issues when the SDK is initialized multiple times during | ||
// the test cookie lifetime | ||
var testCookieName = "dd_site_test_" + generateUUID(); | ||
var testCookieValue = 'test'; | ||
var domainLevels = window.location.hostname.split('.'); | ||
var candidateDomain = domainLevels.pop(); | ||
while (domainLevels.length && !getCookie(testCookieName)) { | ||
candidateDomain = domainLevels.pop() + "." + candidateDomain; | ||
setCookie(testCookieName, testCookieValue, ONE_SECOND, { domain: candidateDomain }); | ||
} | ||
getCurrentSiteCache = candidateDomain; | ||
} | ||
return candidateDomain; | ||
return getCurrentSiteCache; | ||
} | ||
//# sourceMappingURL=cookie.js.map |
@@ -15,3 +15,3 @@ import { Configuration } from './configuration'; | ||
stack?: string; | ||
origin: ErrorOrigin; | ||
origin: ErrorSource; | ||
} | ||
@@ -23,3 +23,3 @@ export interface HttpContext { | ||
} | ||
export declare enum ErrorOrigin { | ||
export declare enum ErrorSource { | ||
AGENT = "agent", | ||
@@ -44,3 +44,3 @@ CONSOLE = "console", | ||
kind: string | undefined; | ||
origin: ErrorOrigin; | ||
origin: ErrorSource; | ||
}; | ||
@@ -47,0 +47,0 @@ }; |
@@ -9,10 +9,10 @@ import { __spreadArrays } from "tslib"; | ||
import { resetXhrProxy, startXhrProxy } from './xhrProxy'; | ||
export var ErrorOrigin; | ||
(function (ErrorOrigin) { | ||
ErrorOrigin["AGENT"] = "agent"; | ||
ErrorOrigin["CONSOLE"] = "console"; | ||
ErrorOrigin["NETWORK"] = "network"; | ||
ErrorOrigin["SOURCE"] = "source"; | ||
ErrorOrigin["LOGGER"] = "logger"; | ||
})(ErrorOrigin || (ErrorOrigin = {})); | ||
export var ErrorSource; | ||
(function (ErrorSource) { | ||
ErrorSource["AGENT"] = "agent"; | ||
ErrorSource["CONSOLE"] = "console"; | ||
ErrorSource["NETWORK"] = "network"; | ||
ErrorSource["SOURCE"] = "source"; | ||
ErrorSource["LOGGER"] = "logger"; | ||
})(ErrorSource || (ErrorSource = {})); | ||
var filteredErrorsObservable; | ||
@@ -42,3 +42,3 @@ export function startErrorCollection(configuration) { | ||
error: { | ||
origin: ErrorOrigin.AGENT, | ||
origin: ErrorSource.AGENT, | ||
}, | ||
@@ -66,3 +66,3 @@ }, | ||
error: { | ||
origin: ErrorOrigin.CONSOLE, | ||
origin: ErrorSource.CONSOLE, | ||
}, | ||
@@ -115,3 +115,3 @@ }, | ||
kind: stackTrace.name, | ||
origin: ErrorOrigin.SOURCE, | ||
origin: ErrorSource.SOURCE, | ||
}, | ||
@@ -141,3 +141,3 @@ }, | ||
error: { | ||
origin: ErrorOrigin.NETWORK, | ||
origin: ErrorSource.NETWORK, | ||
stack: truncateResponse(request.response, configuration) || 'Failed to load', | ||
@@ -144,0 +144,0 @@ }, |
export { DEFAULT_CONFIGURATION, Configuration, UserConfiguration, isIntakeRequest, buildCookieOptions, } from './configuration'; | ||
export { ErrorMessage, ErrorContext, HttpContext, ErrorOrigin, ErrorObservable } from './errorCollection'; | ||
export { ErrorMessage, ErrorContext, HttpContext, ErrorSource, ErrorObservable } from './errorCollection'; | ||
export { BuildEnv, BuildMode, Datacenter, defineGlobal, makeGlobal, commonInit, checkCookiesAuthorized, checkIsNotLocalFile, } from './init'; | ||
@@ -4,0 +4,0 @@ export { InternalMonitoring, MonitoringMessage, monitored, monitor, addMonitoringMessage } from './internalMonitoring'; |
export { DEFAULT_CONFIGURATION, isIntakeRequest, buildCookieOptions, } from './configuration'; | ||
export { ErrorOrigin } from './errorCollection'; | ||
export { ErrorSource } from './errorCollection'; | ||
export { BuildMode, Datacenter, defineGlobal, makeGlobal, commonInit, checkCookiesAuthorized, checkIsNotLocalFile, } from './init'; | ||
@@ -4,0 +4,0 @@ export { monitored, monitor, addMonitoringMessage } from './internalMonitoring'; |
@@ -17,3 +17,3 @@ export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
} | ||
export declare enum ResourceKind { | ||
export declare enum ResourceType { | ||
DOCUMENT = "document", | ||
@@ -20,0 +20,0 @@ XHR = "xhr", |
@@ -18,15 +18,15 @@ import { __spreadArrays } from "tslib"; | ||
})(DOM_EVENT || (DOM_EVENT = {})); | ||
export var ResourceKind; | ||
(function (ResourceKind) { | ||
ResourceKind["DOCUMENT"] = "document"; | ||
ResourceKind["XHR"] = "xhr"; | ||
ResourceKind["BEACON"] = "beacon"; | ||
ResourceKind["FETCH"] = "fetch"; | ||
ResourceKind["CSS"] = "css"; | ||
ResourceKind["JS"] = "js"; | ||
ResourceKind["IMAGE"] = "image"; | ||
ResourceKind["FONT"] = "font"; | ||
ResourceKind["MEDIA"] = "media"; | ||
ResourceKind["OTHER"] = "other"; | ||
})(ResourceKind || (ResourceKind = {})); | ||
export var ResourceType; | ||
(function (ResourceType) { | ||
ResourceType["DOCUMENT"] = "document"; | ||
ResourceType["XHR"] = "xhr"; | ||
ResourceType["BEACON"] = "beacon"; | ||
ResourceType["FETCH"] = "fetch"; | ||
ResourceType["CSS"] = "css"; | ||
ResourceType["JS"] = "js"; | ||
ResourceType["IMAGE"] = "image"; | ||
ResourceType["FONT"] = "font"; | ||
ResourceType["MEDIA"] = "media"; | ||
ResourceType["OTHER"] = "other"; | ||
})(ResourceType || (ResourceType = {})); | ||
export var RequestType; | ||
@@ -33,0 +33,0 @@ (function (RequestType) { |
{ | ||
"name": "@datadog/browser-core", | ||
"version": "1.24.0", | ||
"version": "1.24.1", | ||
"license": "Apache-2.0", | ||
@@ -26,3 +26,3 @@ "main": "cjs/index.js", | ||
}, | ||
"gitHead": "e161cbd59fa9c6568579036c42d1ec214e938117" | ||
"gitHead": "0eef20c05fe9654815b7c1599b8357cfeaa10ce5" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { findCommaSeparatedValue, ONE_SECOND } from './utils' | ||
import { findCommaSeparatedValue, generateUUID, ONE_SECOND } from './utils' | ||
@@ -65,3 +65,5 @@ export const COOKIE_ACCESS_DELAY = ONE_SECOND | ||
try { | ||
const testCookieName = 'dd_cookie_test' | ||
// Use a unique cookie name to avoid issues when the SDK is initialized multiple times during | ||
// the test cookie lifetime | ||
const testCookieName = `dd_cookie_test_${generateUUID()}` | ||
const testCookieValue = 'test' | ||
@@ -81,13 +83,19 @@ setCookie(testCookieName, testCookieValue, ONE_SECOND, options) | ||
*/ | ||
let getCurrentSiteCache: string | undefined | ||
export function getCurrentSite() { | ||
const testCookieName = 'dd_site_test' | ||
const testCookieValue = 'test' | ||
if (getCurrentSiteCache === undefined) { | ||
// Use a unique cookie name to avoid issues when the SDK is initialized multiple times during | ||
// the test cookie lifetime | ||
const testCookieName = `dd_site_test_${generateUUID()}` | ||
const testCookieValue = 'test' | ||
const domainLevels = window.location.hostname.split('.') | ||
let candidateDomain = domainLevels.pop() | ||
while (domainLevels.length && !getCookie(testCookieName)) { | ||
candidateDomain = `${domainLevels.pop()}.${candidateDomain}` | ||
setCookie(testCookieName, testCookieValue, ONE_SECOND, { domain: candidateDomain }) | ||
const domainLevels = window.location.hostname.split('.') | ||
let candidateDomain = domainLevels.pop() | ||
while (domainLevels.length && !getCookie(testCookieName)) { | ||
candidateDomain = `${domainLevels.pop()}.${candidateDomain}` | ||
setCookie(testCookieName, testCookieValue, ONE_SECOND, { domain: candidateDomain }) | ||
} | ||
getCurrentSiteCache = candidateDomain | ||
} | ||
return candidateDomain | ||
return getCurrentSiteCache | ||
} |
@@ -21,3 +21,3 @@ import { Configuration, isIntakeRequest } from './configuration' | ||
stack?: string | ||
origin: ErrorOrigin | ||
origin: ErrorSource | ||
} | ||
@@ -31,3 +31,3 @@ | ||
export enum ErrorOrigin { | ||
export enum ErrorSource { | ||
AGENT = 'agent', | ||
@@ -66,3 +66,3 @@ CONSOLE = 'console', | ||
error: { | ||
origin: ErrorOrigin.AGENT, | ||
origin: ErrorSource.AGENT, | ||
}, | ||
@@ -88,3 +88,3 @@ }, | ||
error: { | ||
origin: ErrorOrigin.CONSOLE, | ||
origin: ErrorSource.CONSOLE, | ||
}, | ||
@@ -141,3 +141,3 @@ }, | ||
kind: stackTrace.name, | ||
origin: ErrorOrigin.SOURCE, | ||
origin: ErrorSource.SOURCE, | ||
}, | ||
@@ -170,3 +170,3 @@ }, | ||
error: { | ||
origin: ErrorOrigin.NETWORK, | ||
origin: ErrorSource.NETWORK, | ||
stack: truncateResponse(request.response, configuration) || 'Failed to load', | ||
@@ -173,0 +173,0 @@ }, |
@@ -8,3 +8,3 @@ export { | ||
} from './configuration' | ||
export { ErrorMessage, ErrorContext, HttpContext, ErrorOrigin, ErrorObservable } from './errorCollection' | ||
export { ErrorMessage, ErrorContext, HttpContext, ErrorSource, ErrorObservable } from './errorCollection' | ||
export { | ||
@@ -11,0 +11,0 @@ BuildEnv, |
@@ -20,3 +20,3 @@ export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> | ||
export enum ResourceKind { | ||
export enum ResourceType { | ||
DOCUMENT = 'document', | ||
@@ -35,4 +35,4 @@ XHR = 'xhr', | ||
export enum RequestType { | ||
FETCH = ResourceKind.FETCH, | ||
XHR = ResourceKind.XHR, | ||
FETCH = ResourceType.FETCH, | ||
XHR = ResourceType.XHR, | ||
} | ||
@@ -39,0 +39,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
513057
9696