@datadog/browser-core
Advanced tools
Comparing version 4.50.0 to 4.50.1
@@ -9,3 +9,3 @@ "use strict"; | ||
var publicApi = (0, polyfills_1.assign)({ | ||
version: "4.50.0", | ||
version: "4.50.1", | ||
// This API method is intentionally not monitored, since the only thing executed is the | ||
@@ -12,0 +12,0 @@ // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and |
@@ -70,3 +70,3 @@ "use strict"; | ||
var retry = _b.retry, flushReason = _b.flushReason, encoding = _b.encoding; | ||
var tags = ["sdk_version:".concat("4.50.0"), "api:".concat(api)].concat(configurationTags); | ||
var tags = ["sdk_version:".concat("4.50.1"), "api:".concat(api)].concat(configurationTags); | ||
if (flushReason && (0, experimentalFeatures_1.isExperimentalFeatureEnabled)(experimentalFeatures_1.ExperimentalFeature.COLLECT_FLUSH_REASON)) { | ||
@@ -82,3 +82,3 @@ tags.push("flush_reason:".concat(flushReason)); | ||
"dd-api-key=".concat(clientToken), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("4.50.0")), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("4.50.1")), | ||
'dd-evp-origin=browser', | ||
@@ -85,0 +85,0 @@ "dd-request-id=".concat((0, stringUtils_1.generateUUID)()), |
import type { ClocksState } from '../../tools/utils/timeUtils'; | ||
export interface ErrorWithCause extends Error { | ||
export interface ErrorWithCause extends Omit<Error, 'cause'> { | ||
cause?: unknown; | ||
@@ -4,0 +4,0 @@ } |
@@ -54,3 +54,3 @@ "use strict"; | ||
service: telemetryService, | ||
version: "4.50.0", | ||
version: "4.50.1", | ||
source: 'browser', | ||
@@ -57,0 +57,0 @@ _dd: { |
@@ -17,3 +17,2 @@ /** | ||
interface Display { | ||
(api: ConsoleApiName, ...args: any[]): void; | ||
debug: typeof console.debug; | ||
@@ -25,3 +24,2 @@ log: typeof console.log; | ||
} | ||
export declare const display: Display; | ||
/** | ||
@@ -37,2 +35,4 @@ * When building JS bundles, some users might use a plugin[1] or configuration[2] to remove | ||
export declare const globalConsole: Console; | ||
export declare const originalConsoleMethods: Display; | ||
export declare const display: Display; | ||
export {}; |
@@ -11,3 +11,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.globalConsole = exports.display = exports.ConsoleApiName = void 0; | ||
exports.display = exports.originalConsoleMethods = exports.globalConsole = exports.ConsoleApiName = void 0; | ||
exports.ConsoleApiName = { | ||
@@ -20,13 +20,2 @@ log: 'log', | ||
}; | ||
var display = function (api) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
if (!Object.prototype.hasOwnProperty.call(exports.ConsoleApiName, api)) { | ||
api = exports.ConsoleApiName.log; | ||
} | ||
exports.display[api].apply(exports.display, args); | ||
}; | ||
exports.display = display; | ||
/** | ||
@@ -42,8 +31,14 @@ * When building JS bundles, some users might use a plugin[1] or configuration[2] to remove | ||
exports.globalConsole = console; | ||
exports.originalConsoleMethods = {}; | ||
Object.keys(exports.ConsoleApiName).forEach(function (name) { | ||
exports.originalConsoleMethods[name] = exports.globalConsole[name]; | ||
}); | ||
var PREFIX = 'Datadog Browser SDK:'; | ||
exports.display.debug = exports.globalConsole.debug.bind(exports.globalConsole, PREFIX); | ||
exports.display.log = exports.globalConsole.log.bind(exports.globalConsole, PREFIX); | ||
exports.display.info = exports.globalConsole.info.bind(exports.globalConsole, PREFIX); | ||
exports.display.warn = exports.globalConsole.warn.bind(exports.globalConsole, PREFIX); | ||
exports.display.error = exports.globalConsole.error.bind(exports.globalConsole, PREFIX); | ||
exports.display = { | ||
debug: exports.originalConsoleMethods.debug.bind(exports.globalConsole, PREFIX), | ||
log: exports.originalConsoleMethods.log.bind(exports.globalConsole, PREFIX), | ||
info: exports.originalConsoleMethods.info.bind(exports.globalConsole, PREFIX), | ||
warn: exports.originalConsoleMethods.warn.bind(exports.globalConsole, PREFIX), | ||
error: exports.originalConsoleMethods.error.bind(exports.globalConsole, PREFIX), | ||
}; | ||
//# sourceMappingURL=display.js.map |
@@ -1,2 +0,1 @@ | ||
import { ConsoleApiName } from './display'; | ||
export declare function startMonitorErrorCollection(newOnMonitorErrorCollected: (error: unknown) => void): void; | ||
@@ -9,2 +8,2 @@ export declare function setDebugMode(newDebugMode: boolean): void; | ||
export declare function callMonitored<T extends (this: void) => any>(fn: T): ReturnType<T> | undefined; | ||
export declare function displayIfDebugEnabled(api: ConsoleApiName, ...args: any[]): void; | ||
export declare function displayIfDebugEnabled(...args: any[]): void; |
@@ -54,3 +54,3 @@ "use strict"; | ||
catch (e) { | ||
displayIfDebugEnabled(display_1.ConsoleApiName.error, e); | ||
displayIfDebugEnabled(e); | ||
if (onMonitorErrorCollected) { | ||
@@ -61,3 +61,3 @@ try { | ||
catch (e) { | ||
displayIfDebugEnabled(display_1.ConsoleApiName.error, e); | ||
displayIfDebugEnabled(e); | ||
} | ||
@@ -68,9 +68,9 @@ } | ||
exports.callMonitored = callMonitored; | ||
function displayIfDebugEnabled(api) { | ||
function displayIfDebugEnabled() { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
if (debugMode) { | ||
display_1.display.apply(void 0, __spreadArray([api, '[MONITOR]'], args, false)); | ||
display_1.display.error.apply(display_1.display, __spreadArray(['[MONITOR]'], args, false)); | ||
} | ||
@@ -77,0 +77,0 @@ } |
export declare function isIE(): boolean; | ||
export declare function isChromium(): boolean; | ||
export declare function isSafari(): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isChromium = exports.isIE = void 0; | ||
exports.isSafari = exports.isChromium = exports.isIE = void 0; | ||
var browserIsIE; | ||
function isIE() { | ||
return Boolean(document.documentMode); | ||
return browserIsIE !== null && browserIsIE !== void 0 ? browserIsIE : (browserIsIE = Boolean(document.documentMode)); | ||
} | ||
exports.isIE = isIE; | ||
var browserIsChromium; | ||
function isChromium() { | ||
return !!window.chrome || /HeadlessChrome/.test(window.navigator.userAgent); | ||
return (browserIsChromium !== null && browserIsChromium !== void 0 ? browserIsChromium : (browserIsChromium = !!window.chrome || /HeadlessChrome/.test(window.navigator.userAgent))); | ||
} | ||
exports.isChromium = isChromium; | ||
var browserIsSafari; | ||
function isSafari() { | ||
return browserIsSafari !== null && browserIsSafari !== void 0 ? browserIsSafari : (browserIsSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)); | ||
} | ||
exports.isSafari = isSafari; | ||
//# sourceMappingURL=browserDetection.js.map |
@@ -6,3 +6,3 @@ import { catchUserErrors } from '../tools/catchUserErrors'; | ||
var publicApi = assign({ | ||
version: "4.50.0", | ||
version: "4.50.1", | ||
// This API method is intentionally not monitored, since the only thing executed is the | ||
@@ -9,0 +9,0 @@ // user-provided 'callback'. All SDK usages executed in the callback should be monitored, and |
@@ -66,3 +66,3 @@ import { timeStampNow } from '../../tools/utils/timeUtils'; | ||
var retry = _b.retry, flushReason = _b.flushReason, encoding = _b.encoding; | ||
var tags = ["sdk_version:".concat("4.50.0"), "api:".concat(api)].concat(configurationTags); | ||
var tags = ["sdk_version:".concat("4.50.1"), "api:".concat(api)].concat(configurationTags); | ||
if (flushReason && isExperimentalFeatureEnabled(ExperimentalFeature.COLLECT_FLUSH_REASON)) { | ||
@@ -78,3 +78,3 @@ tags.push("flush_reason:".concat(flushReason)); | ||
"dd-api-key=".concat(clientToken), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("4.50.0")), | ||
"dd-evp-origin-version=".concat(encodeURIComponent("4.50.1")), | ||
'dd-evp-origin=browser', | ||
@@ -81,0 +81,0 @@ "dd-request-id=".concat(generateUUID()), |
import type { ClocksState } from '../../tools/utils/timeUtils'; | ||
export interface ErrorWithCause extends Error { | ||
export interface ErrorWithCause extends Omit<Error, 'cause'> { | ||
cause?: unknown; | ||
@@ -4,0 +4,0 @@ } |
@@ -51,3 +51,3 @@ import { ConsoleApiName } from '../../tools/display'; | ||
service: telemetryService, | ||
version: "4.50.0", | ||
version: "4.50.1", | ||
source: 'browser', | ||
@@ -54,0 +54,0 @@ _dd: { |
@@ -17,3 +17,2 @@ /** | ||
interface Display { | ||
(api: ConsoleApiName, ...args: any[]): void; | ||
debug: typeof console.debug; | ||
@@ -25,3 +24,2 @@ log: typeof console.log; | ||
} | ||
export declare const display: Display; | ||
/** | ||
@@ -37,2 +35,4 @@ * When building JS bundles, some users might use a plugin[1] or configuration[2] to remove | ||
export declare const globalConsole: Console; | ||
export declare const originalConsoleMethods: Display; | ||
export declare const display: Display; | ||
export {}; |
@@ -16,12 +16,2 @@ /* eslint-disable local-rules/disallow-side-effects */ | ||
}; | ||
export var display = function (api) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
if (!Object.prototype.hasOwnProperty.call(ConsoleApiName, api)) { | ||
api = ConsoleApiName.log; | ||
} | ||
display[api].apply(display, args); | ||
}; | ||
/** | ||
@@ -37,8 +27,14 @@ * When building JS bundles, some users might use a plugin[1] or configuration[2] to remove | ||
export var globalConsole = console; | ||
export var originalConsoleMethods = {}; | ||
Object.keys(ConsoleApiName).forEach(function (name) { | ||
originalConsoleMethods[name] = globalConsole[name]; | ||
}); | ||
var PREFIX = 'Datadog Browser SDK:'; | ||
display.debug = globalConsole.debug.bind(globalConsole, PREFIX); | ||
display.log = globalConsole.log.bind(globalConsole, PREFIX); | ||
display.info = globalConsole.info.bind(globalConsole, PREFIX); | ||
display.warn = globalConsole.warn.bind(globalConsole, PREFIX); | ||
display.error = globalConsole.error.bind(globalConsole, PREFIX); | ||
export var display = { | ||
debug: originalConsoleMethods.debug.bind(globalConsole, PREFIX), | ||
log: originalConsoleMethods.log.bind(globalConsole, PREFIX), | ||
info: originalConsoleMethods.info.bind(globalConsole, PREFIX), | ||
warn: originalConsoleMethods.warn.bind(globalConsole, PREFIX), | ||
error: originalConsoleMethods.error.bind(globalConsole, PREFIX), | ||
}; | ||
//# sourceMappingURL=display.js.map |
@@ -1,2 +0,1 @@ | ||
import { ConsoleApiName } from './display'; | ||
export declare function startMonitorErrorCollection(newOnMonitorErrorCollected: (error: unknown) => void): void; | ||
@@ -9,2 +8,2 @@ export declare function setDebugMode(newDebugMode: boolean): void; | ||
export declare function callMonitored<T extends (this: void) => any>(fn: T): ReturnType<T> | undefined; | ||
export declare function displayIfDebugEnabled(api: ConsoleApiName, ...args: any[]): void; | ||
export declare function displayIfDebugEnabled(...args: any[]): void; |
@@ -10,3 +10,3 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
}; | ||
import { ConsoleApiName, display } from './display'; | ||
import { display } from './display'; | ||
var onMonitorErrorCollected; | ||
@@ -47,3 +47,3 @@ var debugMode = false; | ||
catch (e) { | ||
displayIfDebugEnabled(ConsoleApiName.error, e); | ||
displayIfDebugEnabled(e); | ||
if (onMonitorErrorCollected) { | ||
@@ -54,3 +54,3 @@ try { | ||
catch (e) { | ||
displayIfDebugEnabled(ConsoleApiName.error, e); | ||
displayIfDebugEnabled(e); | ||
} | ||
@@ -60,11 +60,11 @@ } | ||
} | ||
export function displayIfDebugEnabled(api) { | ||
export function displayIfDebugEnabled() { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
if (debugMode) { | ||
display.apply(void 0, __spreadArray([api, '[MONITOR]'], args, false)); | ||
display.error.apply(display, __spreadArray(['[MONITOR]'], args, false)); | ||
} | ||
} | ||
//# sourceMappingURL=monitor.js.map |
export declare function isIE(): boolean; | ||
export declare function isChromium(): boolean; | ||
export declare function isSafari(): boolean; |
@@ -0,7 +1,13 @@ | ||
var browserIsIE; | ||
export function isIE() { | ||
return Boolean(document.documentMode); | ||
return browserIsIE !== null && browserIsIE !== void 0 ? browserIsIE : (browserIsIE = Boolean(document.documentMode)); | ||
} | ||
var browserIsChromium; | ||
export function isChromium() { | ||
return !!window.chrome || /HeadlessChrome/.test(window.navigator.userAgent); | ||
return (browserIsChromium !== null && browserIsChromium !== void 0 ? browserIsChromium : (browserIsChromium = !!window.chrome || /HeadlessChrome/.test(window.navigator.userAgent))); | ||
} | ||
var browserIsSafari; | ||
export function isSafari() { | ||
return browserIsSafari !== null && browserIsSafari !== void 0 ? browserIsSafari : (browserIsSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)); | ||
} | ||
//# sourceMappingURL=browserDetection.js.map |
{ | ||
"name": "@datadog/browser-core", | ||
"version": "4.50.0", | ||
"version": "4.50.1", | ||
"license": "Apache-2.0", | ||
@@ -26,3 +26,3 @@ "main": "cjs/index.js", | ||
}, | ||
"gitHead": "6bb23089915b99c9dab8edbf0131b5edc09eb4b5" | ||
"gitHead": "2f7a2b0b88ec8e9b5ffef9bdb7f8ace9b97ccafc" | ||
} |
import type { ClocksState } from '../../tools/utils/timeUtils' | ||
export interface ErrorWithCause extends Error { | ||
// TS v4.6 introduced Error.cause[1] typed as `Error`. TS v4.8 changed Error.cause to be | ||
// `unknown`[2]. | ||
// | ||
// Because we still support TS 3.8, we need to declare our own type. We can remove it once we drop | ||
// support for TS v4.7 and before. The 'cause' property defined by TS needs to be omitted because | ||
// we define it with a type `unknown` which is incompatible with TS 4.6 and 4.7. | ||
// | ||
// [1]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-6/#target-es2022 | ||
// [2]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#lib-d-ts-updates | ||
export interface ErrorWithCause extends Omit<Error, 'cause'> { | ||
cause?: unknown | ||
@@ -5,0 +14,0 @@ } |
@@ -21,3 +21,2 @@ /* eslint-disable local-rules/disallow-side-effects */ | ||
interface Display { | ||
(api: ConsoleApiName, ...args: any[]): void | ||
debug: typeof console.debug | ||
@@ -30,9 +29,2 @@ log: typeof console.log | ||
export const display: Display = (api, ...args) => { | ||
if (!Object.prototype.hasOwnProperty.call(ConsoleApiName, api)) { | ||
api = ConsoleApiName.log | ||
} | ||
display[api](...args) | ||
} | ||
/** | ||
@@ -48,8 +40,16 @@ * When building JS bundles, some users might use a plugin[1] or configuration[2] to remove | ||
export const globalConsole = console | ||
export const originalConsoleMethods = {} as Display | ||
Object.keys(ConsoleApiName).forEach((name) => { | ||
originalConsoleMethods[name as ConsoleApiName] = globalConsole[name as ConsoleApiName] | ||
}) | ||
const PREFIX = 'Datadog Browser SDK:' | ||
display.debug = globalConsole.debug.bind(globalConsole, PREFIX) | ||
display.log = globalConsole.log.bind(globalConsole, PREFIX) | ||
display.info = globalConsole.info.bind(globalConsole, PREFIX) | ||
display.warn = globalConsole.warn.bind(globalConsole, PREFIX) | ||
display.error = globalConsole.error.bind(globalConsole, PREFIX) | ||
export const display: Display = { | ||
debug: originalConsoleMethods.debug.bind(globalConsole, PREFIX), | ||
log: originalConsoleMethods.log.bind(globalConsole, PREFIX), | ||
info: originalConsoleMethods.info.bind(globalConsole, PREFIX), | ||
warn: originalConsoleMethods.warn.bind(globalConsole, PREFIX), | ||
error: originalConsoleMethods.error.bind(globalConsole, PREFIX), | ||
} |
@@ -1,2 +0,2 @@ | ||
import { ConsoleApiName, display } from './display' | ||
import { display } from './display' | ||
@@ -53,3 +53,3 @@ let onMonitorErrorCollected: undefined | ((error: unknown) => void) | ||
} catch (e) { | ||
displayIfDebugEnabled(ConsoleApiName.error, e) | ||
displayIfDebugEnabled(e) | ||
if (onMonitorErrorCollected) { | ||
@@ -59,3 +59,3 @@ try { | ||
} catch (e) { | ||
displayIfDebugEnabled(ConsoleApiName.error, e) | ||
displayIfDebugEnabled(e) | ||
} | ||
@@ -66,6 +66,6 @@ } | ||
export function displayIfDebugEnabled(api: ConsoleApiName, ...args: any[]) { | ||
export function displayIfDebugEnabled(...args: any[]) { | ||
if (debugMode) { | ||
display(api, '[MONITOR]', ...args) | ||
display.error('[MONITOR]', ...args) | ||
} | ||
} |
@@ -0,7 +1,17 @@ | ||
let browserIsIE: boolean | undefined | ||
export function isIE() { | ||
return Boolean((document as any).documentMode) | ||
return browserIsIE ?? (browserIsIE = Boolean((document as any).documentMode)) | ||
} | ||
let browserIsChromium: boolean | undefined | ||
export function isChromium() { | ||
return !!(window as any).chrome || /HeadlessChrome/.test(window.navigator.userAgent) | ||
return ( | ||
browserIsChromium ?? | ||
(browserIsChromium = !!(window as any).chrome || /HeadlessChrome/.test(window.navigator.userAgent)) | ||
) | ||
} | ||
let browserIsSafari: boolean | undefined | ||
export function isSafari() { | ||
return browserIsSafari ?? (browserIsSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
982485
17298