aboutsummaryrefslogtreecommitdiffstats
path: root/demo/dist/demo.js
diff options
context:
space:
mode:
Diffstat (limited to 'demo/dist/demo.js')
-rw-r--r--demo/dist/demo.js2235
1 files changed, 971 insertions, 1264 deletions
diff --git a/demo/dist/demo.js b/demo/dist/demo.js
index 4f290b9d..e470aa27 100644
--- a/demo/dist/demo.js
+++ b/demo/dist/demo.js
@@ -4665,7 +4665,7 @@ typeof navigator === "object" && (function () {
var checkIfURLSearchParamsSupported = function checkIfURLSearchParamsSupported() {
try {
var URLSearchParams = global.URLSearchParams;
- return new URLSearchParams('?a=1').toString() === 'a=1' && typeof URLSearchParams.prototype.set === 'function' && typeof URLSearchParams.prototype.entries === 'function';
+ return new URLSearchParams('?a=1').toString() === 'a=1' && typeof URLSearchParams.prototype.set === 'function';
} catch (e) {
return false;
}
@@ -4789,11 +4789,7 @@ typeof navigator === "object" && (function () {
anchorElement.href = anchorElement.href; // force href to refresh
}
- var inputElement = doc.createElement('input');
- inputElement.type = 'url';
- inputElement.value = url;
-
- if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href) || !inputElement.checkValidity() && !base) {
+ if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href)) {
throw new TypeError('Invalid URL');
}
@@ -5773,7 +5769,6 @@ typeof navigator === "object" && (function () {
}
/** JSDoc */
- // eslint-disable-next-line import/export
var Severity;
(function (Severity) {
@@ -5797,7 +5792,8 @@ typeof navigator === "object" && (function () {
/** JSDoc */
Severity["Critical"] = "critical";
- })(Severity || (Severity = {})); // eslint-disable-next-line @typescript-eslint/no-namespace, import/export
+ })(Severity || (Severity = {})); // tslint:disable:completed-docs
+ // tslint:disable:no-unnecessary-qualifier no-namespace
(function (Severity) {
@@ -5838,7 +5834,6 @@ typeof navigator === "object" && (function () {
})(Severity || (Severity = {}));
/** The status of an event. */
- // eslint-disable-next-line import/export
var Status;
(function (Status) {
@@ -5859,7 +5854,8 @@ typeof navigator === "object" && (function () {
/** A server-side error ocurred during submission. */
Status["Failed"] = "failed";
- })(Status || (Status = {})); // eslint-disable-next-line @typescript-eslint/no-namespace, import/export
+ })(Status || (Status = {})); // tslint:disable:completed-docs
+ // tslint:disable:no-unnecessary-qualifier no-namespace
(function (Status) {
@@ -5916,28 +5912,26 @@ typeof navigator === "object" && (function () {
var setPrototypeOf = Object.setPrototypeOf || ({
__proto__: []
- } instanceof Array ? setProtoOf : mixinProperties);
+ } instanceof Array ? setProtoOf : mixinProperties); // tslint:disable-line:no-unbound-method
+
/**
* setPrototypeOf polyfill using __proto__
*/
- // eslint-disable-next-line @typescript-eslint/ban-types
function setProtoOf(obj, proto) {
- // @ts-ignore __proto__ does not exist on obj
+ // @ts-ignore
obj.__proto__ = proto;
return obj;
}
/**
* setPrototypeOf polyfill using mixin
*/
- // eslint-disable-next-line @typescript-eslint/ban-types
function mixinProperties(obj, proto) {
for (var prop in proto) {
- // eslint-disable-next-line no-prototype-builtins
if (!obj.hasOwnProperty(prop)) {
- // @ts-ignore typescript complains about indexing so we remove
+ // @ts-ignore
obj[prop] = proto[prop];
}
}
@@ -5957,7 +5951,8 @@ typeof navigator === "object" && (function () {
var _this = _super.call(this, message) || this;
- _this.message = message;
+ _this.message = message; // tslint:disable:no-unsafe-any
+
_this.name = _newTarget.prototype.constructor.name;
setPrototypeOf(_this, _newTarget.prototype);
return _this;
@@ -5966,10 +5961,6 @@ typeof navigator === "object" && (function () {
return SentryError;
}(Error);
- /* eslint-disable @typescript-eslint/no-explicit-any */
-
- /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
-
/**
* Checks whether given value's type is one of a few Error or Error-like
* {@link isError}.
@@ -6067,6 +6058,7 @@ typeof navigator === "object" && (function () {
*/
function isEvent(wat) {
+ // tslint:disable-next-line:strict-type-predicates
return typeof Event !== 'undefined' && isInstanceOf(wat, Event);
}
/**
@@ -6078,6 +6070,7 @@ typeof navigator === "object" && (function () {
*/
function isElement(wat) {
+ // tslint:disable-next-line:strict-type-predicates
return typeof Element !== 'undefined' && isInstanceOf(wat, Element);
}
/**
@@ -6097,8 +6090,8 @@ typeof navigator === "object" && (function () {
*/
function isThenable$1(wat) {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- return Boolean(wat && wat.then && typeof wat.then === 'function');
+ // tslint:disable:no-unsafe-any
+ return Boolean(wat && wat.then && typeof wat.then === 'function'); // tslint:enable:no-unsafe-any
}
/**
* Checks whether given value's type is a SyntheticEvent
@@ -6109,6 +6102,7 @@ typeof navigator === "object" && (function () {
*/
function isSyntheticEvent(wat) {
+ // tslint:disable-next-line:no-unsafe-any
return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;
}
/**
@@ -6122,6 +6116,7 @@ typeof navigator === "object" && (function () {
function isInstanceOf(wat, base) {
try {
+ // tslint:disable-next-line:no-unsafe-any
return wat instanceof base;
} catch (_e) {
return false;
@@ -7375,7 +7370,8 @@ typeof navigator === "object" && (function () {
function truncate(str, max) {
if (max === void 0) {
max = 0;
- }
+ } // tslint:disable-next-line:strict-type-predicates
+
if (typeof str !== 'string' || max === 0) {
return str;
@@ -7389,14 +7385,13 @@ typeof navigator === "object" && (function () {
* @param delimiter string to be placed in-between values
* @returns Joined values
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
function safeJoin(input, delimiter) {
if (!Array.isArray(input)) {
return '';
}
- var output = []; // eslint-disable-next-line @typescript-eslint/prefer-for-of
+ var output = []; // tslint:disable-next-line:prefer-for-of
for (var i = 0; i < input.length; i++) {
var value = input[i];
@@ -7437,10 +7432,9 @@ typeof navigator === "object" && (function () {
*
* @param request The module path to resolve
*/
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
function dynamicRequire(mod, request) {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ // tslint:disable-next-line: no-unsafe-any
return mod.require(request);
}
/**
@@ -7450,6 +7444,7 @@ typeof navigator === "object" && (function () {
*/
function isNodeEnv() {
+ // tslint:disable:strict-type-predicates
return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
}
var fallbackGlobalObject = {};
@@ -7476,10 +7471,10 @@ typeof navigator === "object" && (function () {
// Use window.crypto API if available
var arr = new Uint16Array(8);
crypto.getRandomValues(arr); // set 4 in byte 7
- // eslint-disable-next-line no-bitwise
+ // tslint:disable-next-line:no-bitwise
arr[3] = arr[3] & 0xfff | 0x4000; // set 2 most significant bits of byte 9 to '10'
- // eslint-disable-next-line no-bitwise
+ // tslint:disable-next-line:no-bitwise
arr[4] = arr[4] & 0x3fff | 0x8000;
@@ -7498,8 +7493,8 @@ typeof navigator === "object" && (function () {
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
- // eslint-disable-next-line no-bitwise
- var r = Math.random() * 16 | 0; // eslint-disable-next-line no-bitwise
+ // tslint:disable-next-line:no-bitwise
+ var r = Math.random() * 16 | 0; // tslint:disable-next-line:no-bitwise
var v = c === 'x' ? r : r & 0x3 | 0x8;
return v.toString(16);
@@ -7518,7 +7513,7 @@ typeof navigator === "object" && (function () {
return {};
}
- var match = url.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
+ var match = url.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
if (!match) {
return {};
@@ -7612,12 +7607,11 @@ typeof navigator === "object" && (function () {
try {
- // @ts-ignore Type 'Mechanism | {}' is not assignable to type 'Mechanism | undefined'
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ // @ts-ignore
+ // tslint:disable:no-non-null-assertion
event.exception.values[0].mechanism = event.exception.values[0].mechanism || {};
Object.keys(mechanism).forEach(function (key) {
- // @ts-ignore Mechanism has no index signature
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ // @ts-ignore
event.exception.values[0].mechanism[key] = mechanism[key];
});
} catch (_oO) {// no-empty
@@ -7655,7 +7649,7 @@ typeof navigator === "object" && (function () {
var len = 0;
var separator = ' > ';
var sepLength = separator.length;
- var nextStr = void 0; // eslint-disable-next-line no-plusplus
+ var nextStr = void 0;
while (currentElem && height++ < MAX_TRAVERSE_HEIGHT) {
nextStr = _htmlElementAsString(currentElem); // bail out if
@@ -7700,8 +7694,7 @@ typeof navigator === "object" && (function () {
if (elem.id) {
out.push("#" + elem.id);
- } // eslint-disable-next-line prefer-const
-
+ }
className = elem.className;
@@ -7713,10 +7706,10 @@ typeof navigator === "object" && (function () {
}
}
- var allowedAttrs = ['type', 'name', 'title', 'alt'];
+ var attrWhitelist = ['type', 'name', 'title', 'alt'];
- for (i = 0; i < allowedAttrs.length; i++) {
- key = allowedAttrs[i];
+ for (i = 0; i < attrWhitelist.length; i++) {
+ key = attrWhitelist[i];
attr = elem.getAttribute(key);
if (attr) {
@@ -7752,25 +7745,22 @@ typeof navigator === "object" && (function () {
}
}
- var performance = getGlobalObject().performance;
-
- if (!performance || !performance.now) {
- return performanceFallback;
- } // Polyfill for performance.timeOrigin.
- //
- // While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin
- // is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.
-
-
- if (performance.timeOrigin === undefined) {
- // As of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always a
- // valid fallback. In the absence of a initial time provided by the browser, fallback to INITIAL_TIME.
- // @ts-ignore ignored because timeOrigin is a readonly property but we want to override
- // eslint-disable-next-line deprecation/deprecation
- performance.timeOrigin = performance.timing && performance.timing.navigationStart || INITIAL_TIME;
+ if (getGlobalObject().performance) {
+ // Polyfill for performance.timeOrigin.
+ //
+ // While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin
+ // is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.
+ // tslint:disable-next-line:strict-type-predicates
+ if (performance.timeOrigin === undefined) {
+ // As of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always a
+ // valid fallback. In the absence of a initial time provided by the browser, fallback to INITIAL_TIME.
+ // @ts-ignore
+ // tslint:disable-next-line:deprecation
+ performance.timeOrigin = performance.timing && performance.timing.navigationStart || INITIAL_TIME;
+ }
}
- return performance;
+ return getGlobalObject().performance || performanceFallback;
}();
/**
* Returns a timestamp in seconds with milliseconds precision since the UNIX epoch calculated with the monotonic clock.
@@ -7865,7 +7855,7 @@ typeof navigator === "object" && (function () {
}
consoleSandbox(function () {
- global$1.console.log(PREFIX + "[Log]: " + args.join(' '));
+ global$1.console.log(PREFIX + "[Log]: " + args.join(' ')); // tslint:disable-line:no-console
});
};
/** JSDoc */
@@ -7883,7 +7873,7 @@ typeof navigator === "object" && (function () {
}
consoleSandbox(function () {
- global$1.console.warn(PREFIX + "[Warn]: " + args.join(' '));
+ global$1.console.warn(PREFIX + "[Warn]: " + args.join(' ')); // tslint:disable-line:no-console
});
};
/** JSDoc */
@@ -7901,7 +7891,7 @@ typeof navigator === "object" && (function () {
}
consoleSandbox(function () {
- global$1.console.error(PREFIX + "[Error]: " + args.join(' '));
+ global$1.console.error(PREFIX + "[Error]: " + args.join(' ')); // tslint:disable-line:no-console
});
};
@@ -8253,11 +8243,7 @@ typeof navigator === "object" && (function () {
return function WeakSet() { return init(this, arguments.length ? arguments[0] : undefined); };
}, collectionWeak);
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
-
- /* eslint-disable @typescript-eslint/no-explicit-any */
-
- /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
+ // tslint:disable:no-unsafe-any
/**
* Memo class used for decycle json objects. Uses WeakSet if available otherwise array.
@@ -8266,6 +8252,7 @@ typeof navigator === "object" && (function () {
/** @class */
function () {
function Memo() {
+ // tslint:disable-next-line
this._hasWeakSet = typeof WeakSet === 'function';
this._inner = this._hasWeakSet ? new WeakSet() : [];
}
@@ -8284,7 +8271,7 @@ typeof navigator === "object" && (function () {
this._inner.add(obj);
return false;
- } // eslint-disable-next-line @typescript-eslint/prefer-for-of
+ } // tslint:disable-next-line:prefer-for-of
for (var i = 0; i < this._inner.length; i++) {
@@ -8347,6 +8334,7 @@ typeof navigator === "object" && (function () {
var original = source[name];
var wrapped = replacement(original); // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work
// otherwise it'll throw "TypeError: Object.defineProperties called on non-object"
+ // tslint:disable-next-line:strict-type-predicates
if (typeof wrapped === 'function') {
try {
@@ -8372,7 +8360,8 @@ typeof navigator === "object" && (function () {
*/
function urlEncode(object) {
- return Object.keys(object).map(function (key) {
+ return Object.keys(object).map( // tslint:disable-next-line:no-unsafe-any
+ function (key) {
return encodeURIComponent(key) + "=" + encodeURIComponent(object[key]);
}).join('&');
}
@@ -8416,7 +8405,8 @@ typeof navigator === "object" && (function () {
source.currentTarget = isElement(event_1.currentTarget) ? htmlTreeAsString(event_1.currentTarget) : Object.prototype.toString.call(event_1.currentTarget);
} catch (_oO) {
source.currentTarget = '<unknown>';
- }
+ } // tslint:disable-next-line:strict-type-predicates
+
if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {
source.detail = event_1.detail;
@@ -8437,7 +8427,7 @@ typeof navigator === "object" && (function () {
function utf8Length(value) {
- // eslint-disable-next-line no-bitwise
+ // tslint:disable-next-line:no-bitwise
return ~-encodeURI(value).split(/%..|./).length;
}
/** Calculates bytes size of input object */
@@ -8497,6 +8487,7 @@ typeof navigator === "object" && (function () {
* - serializes Error objects
* - filter global objects
*/
+ // tslint:disable-next-line:cyclomatic-complexity
function normalizeValue(value, key) {
@@ -8523,7 +8514,8 @@ typeof navigator === "object" && (function () {
if (isSyntheticEvent(value)) {
return '[SyntheticEvent]';
- }
+ } // tslint:disable-next-line:no-tautology-expression
+
if (typeof value === 'number' && value !== value) {
return '[NaN]';
@@ -8547,7 +8539,6 @@ typeof navigator === "object" && (function () {
* @param depth Optional number indicating how deep should walking be performed
* @param memo Optional Memo class handling decycling
*/
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
function walk(key, value, depth, memo) {
@@ -8562,15 +8553,13 @@ typeof navigator === "object" && (function () {
if (depth === 0) {
return serializeValue(value);
- }
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
- // If value implements `toJSON` method, call it and return early
+ } // If value implements `toJSON` method, call it and return early
+ // tslint:disable:no-unsafe-any
if (value !== null && value !== undefined && typeof value.toJSON === 'function') {
return value.toJSON();
- }
- /* eslint-enable @typescript-eslint/no-unsafe-member-access */
+ } // tslint:enable:no-unsafe-any
// If normalized value is a primitive, there are no branches left to walk, so we can just bail out, as theres no point in going down that branch any further
@@ -8617,10 +8606,10 @@ typeof navigator === "object" && (function () {
* - Takes care of Error objects serialization
* - Optionally limit depth of final output
*/
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
function normalize$1(input, depth) {
try {
+ // tslint:disable-next-line:no-unsafe-any
return JSON.parse(JSON.stringify(input, function (key, value) {
return walk(key, value, depth);
}));
@@ -8633,12 +8622,12 @@ typeof navigator === "object" && (function () {
* and truncated list that will be used inside the event message.
* eg. `Non-error exception captured with keys: foo, bar, baz`
*/
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
function extractExceptionKeysForMessage(exception, maxLength) {
if (maxLength === void 0) {
maxLength = 40;
- }
+ } // tslint:disable:strict-type-predicates
+
var keys = Object.keys(getWalkSource(exception));
keys.sort();
@@ -8796,7 +8785,6 @@ typeof navigator === "object" && (function () {
if (_this._state === States.RESOLVED) {
if (handler.onfulfilled) {
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
handler.onfulfilled(_this._value);
}
}
@@ -8820,6 +8808,12 @@ typeof navigator === "object" && (function () {
/** JSDoc */
+ SyncPromise.prototype.toString = function () {
+ return '[object SyncPromise]';
+ };
+ /** JSDoc */
+
+
SyncPromise.resolve = function (value) {
return new SyncPromise(function (resolve) {
resolve(value);
@@ -8947,12 +8941,6 @@ typeof navigator === "object" && (function () {
});
});
};
- /** JSDoc */
-
-
- SyncPromise.prototype.toString = function () {
- return '[object SyncPromise]';
- };
return SyncPromise;
}();
@@ -9067,8 +9055,11 @@ typeof navigator === "object" && (function () {
}
try {
- new Headers();
- new Request('');
+ // tslint:disable-next-line:no-unused-expression
+ new Headers(); // tslint:disable-next-line:no-unused-expression
+
+ new Request(''); // tslint:disable-next-line:no-unused-expression
+
new Response();
return true;
} catch (e) {
@@ -9078,7 +9069,6 @@ typeof navigator === "object" && (function () {
/**
* isNativeFetch checks if the given function is a native implementation of fetch()
*/
- // eslint-disable-next-line @typescript-eslint/ban-types
function isNativeFetch(func) {
return func && /^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(func.toString());
@@ -9097,7 +9087,7 @@ typeof navigator === "object" && (function () {
}
var global = getGlobalObject(); // Fast path to avoid DOM I/O
- // eslint-disable-next-line @typescript-eslint/unbound-method
+ // tslint:disable-next-line:no-unbound-method
if (isNativeFetch(global.fetch)) {
return true;
@@ -9106,7 +9096,7 @@ typeof navigator === "object" && (function () {
var result = false;
- var doc = global.document; // eslint-disable-next-line deprecation/deprecation
+ var doc = global.document; // tslint:disable-next-line:no-unbound-method deprecation
if (doc && typeof doc.createElement === "function") {
try {
@@ -9115,7 +9105,7 @@ typeof navigator === "object" && (function () {
doc.head.appendChild(sandbox);
if (sandbox.contentWindow && sandbox.contentWindow.fetch) {
- // eslint-disable-next-line @typescript-eslint/unbound-method
+ // tslint:disable-next-line:no-unbound-method
result = isNativeFetch(sandbox.contentWindow.fetch);
}
@@ -9144,6 +9134,7 @@ typeof navigator === "object" && (function () {
}
try {
+ // tslint:disable:no-unused-expression
new Request('_', {
referrerPolicy: 'origin'
});
@@ -9164,13 +9155,9 @@ typeof navigator === "object" && (function () {
// a try/catch block*, will cause Chrome to output an error to console.error
// borrowed from: https://github.com/angular/angular.js/pull/13945/files
var global = getGlobalObject();
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ var chrome = global.chrome; // tslint:disable-next-line:no-unsafe-any
- var chrome = global.chrome;
var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;
- /* eslint-enable @typescript-eslint/no-unsafe-member-access */
-
var hasHistoryApi = 'history' in global && !!global.history.pushState && !!global.history.replaceState;
return !isChromePackagedApp && hasHistoryApi;
}
@@ -9239,6 +9226,7 @@ typeof navigator === "object" && (function () {
function addInstrumentationHandler(handler) {
+ // tslint:disable-next-line:strict-type-predicates
if (!handler || typeof handler.type !== 'string' || typeof handler.callback !== 'function') {
return;
}
@@ -9335,29 +9323,23 @@ typeof navigator === "object" && (function () {
},
startTimestamp: Date.now()
};
- triggerHandlers('fetch', _assign({}, commonHandlerData)); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
-
+ triggerHandlers('fetch', _assign({}, commonHandlerData));
return originalFetch.apply(global$2, args).then(function (response) {
- triggerHandlers('fetch', _assign(_assign({}, commonHandlerData), {
+ triggerHandlers('fetch', _assign({}, commonHandlerData, {
endTimestamp: Date.now(),
response: response
}));
return response;
}, function (error) {
- triggerHandlers('fetch', _assign(_assign({}, commonHandlerData), {
+ triggerHandlers('fetch', _assign({}, commonHandlerData, {
endTimestamp: Date.now(),
error: error
- })); // NOTE: If you are a Sentry user, and you are seeing this stack frame,
- // it means the sentry.javascript SDK caught an error invoking your application code.
- // This is expected behavior and NOT indicative of a bug with sentry.javascript.
-
+ }));
throw error;
});
};
});
}
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
-
/** Extract `method` from fetch call arguments */
@@ -9394,8 +9376,6 @@ typeof navigator === "object" && (function () {
return String(fetchArgs[0]);
}
- /* eslint-enable @typescript-eslint/no-unsafe-member-access */
-
/** JSDoc */
@@ -9411,61 +9391,19 @@ typeof navigator === "object" && (function () {
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
- } // eslint-disable-next-line @typescript-eslint/no-this-alias
-
+ }
- var xhr = this;
var url = args[1];
- xhr.__sentry_xhr__ = {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ this.__sentry_xhr__ = {
method: isString(args[0]) ? args[0].toUpperCase() : args[0],
url: args[1]
}; // if Sentry key appears in URL, don't capture it as a request
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- if (isString(url) && xhr.__sentry_xhr__.method === 'POST' && url.match(/sentry_key/)) {
- xhr.__sentry_own_request__ = true;
- }
-
- var onreadystatechangeHandler = function onreadystatechangeHandler() {
- if (xhr.readyState === 4) {
- try {
- // touching statusCode in some platforms throws
- // an exception
- if (xhr.__sentry_xhr__) {
- xhr.__sentry_xhr__.status_code = xhr.status;
- }
- } catch (e) {
- /* do nothing */
- }
-
- triggerHandlers('xhr', {
- args: args,
- endTimestamp: Date.now(),
- startTimestamp: Date.now(),
- xhr: xhr
- });
- }
- };
-
- if ('onreadystatechange' in xhr && typeof xhr.onreadystatechange === 'function') {
- fill(xhr, 'onreadystatechange', function (original) {
- return function () {
- var readyStateArgs = [];
-
- for (var _i = 0; _i < arguments.length; _i++) {
- readyStateArgs[_i] = arguments[_i];
- }
-
- onreadystatechangeHandler();
- return original.apply(xhr, readyStateArgs);
- };
- });
- } else {
- xhr.addEventListener('readystatechange', onreadystatechangeHandler);
+ if (isString(url) && this.__sentry_xhr__.method === 'POST' && url.match(/sentry_key/)) {
+ this.__sentry_own_request__ = true;
}
- return originalOpen.apply(xhr, args);
+ return originalOpen.apply(this, args);
};
});
fill(xhrproto, 'send', function (originalSend) {
@@ -9476,10 +9414,30 @@ typeof navigator === "object" && (function () {
args[_i] = arguments[_i];
}
- triggerHandlers('xhr', {
+ var xhr = this; // tslint:disable-line:no-this-assignment
+
+ var commonHandlerData = {
args: args,
startTimestamp: Date.now(),
- xhr: this
+ xhr: xhr
+ };
+ triggerHandlers('xhr', _assign({}, commonHandlerData));
+ xhr.addEventListener('readystatechange', function () {
+ if (xhr.readyState === 4) {
+ try {
+ // touching statusCode in some platforms throws
+ // an exception
+ if (xhr.__sentry_xhr__) {
+ xhr.__sentry_xhr__.status_code = xhr.status;
+ }
+ } catch (e) {
+ /* do nothing */
+ }
+
+ triggerHandlers('xhr', _assign({}, commonHandlerData, {
+ endTimestamp: Date.now()
+ }));
+ }
});
return originalSend.apply(this, args);
};
@@ -9562,14 +9520,11 @@ typeof navigator === "object" && (function () {
global$2.document.addEventListener('keypress', keypressEventHandler(triggerHandlers.bind(null, 'dom')), false); // After hooking into document bubbled up click and keypresses events, we also hook into user handled click & keypresses.
['EventTarget', 'Node'].forEach(function (target) {
- /* eslint-disable @typescript-eslint/no-unsafe-member-access */
- var proto = global$2[target] && global$2[target].prototype; // eslint-disable-next-line no-prototype-builtins
+ var proto = global$2[target] && global$2[target].prototype;
if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {
return;
}
- /* eslint-enable @typescript-eslint/no-unsafe-member-access */
-
fill(proto, 'addEventListener', function (original) {
return function (eventName, fn, options) {
@@ -9606,12 +9561,14 @@ typeof navigator === "object" && (function () {
});
fill(proto, 'removeEventListener', function (original) {
return function (eventName, fn, options) {
+ var callback = fn;
+
try {
- original.call(this, eventName, fn.__sentry_wrapped__, options);
+ callback = callback && (callback.__sentry_wrapped__ || callback);
} catch (e) {// ignore, accessing __sentry_wrapped__ will throw in some Selenium environments
}
- return original.call(this, eventName, fn, options);
+ return original.call(this, eventName, callback, options);
};
});
});
@@ -9728,7 +9685,6 @@ typeof navigator === "object" && (function () {
});
if (_oldOnErrorHandler) {
- // eslint-disable-next-line prefer-rest-params
return _oldOnErrorHandler.apply(this, arguments);
}
@@ -9746,7 +9702,6 @@ typeof navigator === "object" && (function () {
triggerHandlers('unhandledrejection', e);
if (_oldOnUnhandledRejectionHandler) {
- // eslint-disable-next-line prefer-rest-params
return _oldOnUnhandledRejectionHandler.apply(this, arguments);
}
@@ -9756,7 +9711,7 @@ typeof navigator === "object" && (function () {
/** Regular expression used to parse a Dsn. */
- var DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/;
+ var DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w\.-]+)(?::(\d+))?\/(.+)/;
/** Error message */
var ERROR_MESSAGE = 'Invalid Dsn';
@@ -9789,7 +9744,8 @@ typeof navigator === "object" && (function () {
Dsn.prototype.toString = function (withPassword) {
if (withPassword === void 0) {
withPassword = false;
- }
+ } // tslint:disable-next-line:no-this-assignment
+
var _a = this,
host = _a.host,
@@ -9831,14 +9787,6 @@ typeof navigator === "object" && (function () {
projectId = split.pop();
}
- if (projectId) {
- var projectMatch = projectId.match(/^\d+/);
-
- if (projectMatch) {
- projectId = projectMatch[0];
- }
- }
-
this._fromComponents({
host: host,
pass: pass,
@@ -9869,20 +9817,16 @@ typeof navigator === "object" && (function () {
['protocol', 'user', 'host', 'projectId'].forEach(function (component) {
if (!_this[component]) {
- throw new SentryError(ERROR_MESSAGE + ": " + component + " missing");
+ throw new SentryError(ERROR_MESSAGE);
}
});
- if (!this.projectId.match(/^\d+$/)) {
- throw new SentryError(ERROR_MESSAGE + ": Invalid projectId " + this.projectId);
- }
-
if (this.protocol !== 'http' && this.protocol !== 'https') {
- throw new SentryError(ERROR_MESSAGE + ": Invalid protocol " + this.protocol);
+ throw new SentryError(ERROR_MESSAGE);
}
if (this.port && isNaN(parseInt(this.port, 10))) {
- throw new SentryError(ERROR_MESSAGE + ": Invalid port " + this.port);
+ throw new SentryError(ERROR_MESSAGE);
}
};
@@ -9916,39 +9860,13 @@ typeof navigator === "object" && (function () {
this._tags = {};
/** Extra */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
this._extra = {};
/** Contexts */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- this._contexts = {};
+ this._context = {};
}
/**
- * Inherit values from the parent scope.
- * @param scope to clone.
- */
-
-
- Scope.clone = function (scope) {
- var newScope = new Scope();
-
- if (scope) {
- newScope._breadcrumbs = __spread(scope._breadcrumbs);
- newScope._tags = _assign({}, scope._tags);
- newScope._extra = _assign({}, scope._extra);
- newScope._contexts = _assign({}, scope._contexts);
- newScope._user = scope._user;
- newScope._level = scope._level;
- newScope._span = scope._span;
- newScope._transactionName = scope._transactionName;
- newScope._fingerprint = scope._fingerprint;
- newScope._eventProcessors = __spread(scope._eventProcessors);
- }
-
- return newScope;
- };
- /**
* Add internal on change listener. Used for sub SDKs that need to store the scope.
* @hidden
*/
@@ -9968,6 +9886,55 @@ typeof navigator === "object" && (function () {
return this;
};
/**
+ * This will be called on every set call.
+ */
+
+
+ Scope.prototype._notifyScopeListeners = function () {
+ var _this = this;
+
+ if (!this._notifyingListeners) {
+ this._notifyingListeners = true;
+ setTimeout(function () {
+ _this._scopeListeners.forEach(function (callback) {
+ callback(_this);
+ });
+
+ _this._notifyingListeners = false;
+ });
+ }
+ };
+ /**
+ * This will be called after {@link applyToEvent} is finished.
+ */
+
+
+ Scope.prototype._notifyEventProcessors = function (processors, event, hint, index) {
+ var _this = this;
+
+ if (index === void 0) {
+ index = 0;
+ }
+
+ return new SyncPromise(function (resolve, reject) {
+ var processor = processors[index]; // tslint:disable-next-line:strict-type-predicates
+
+ if (event === null || typeof processor !== 'function') {
+ resolve(event);
+ } else {
+ var result = processor(_assign({}, event), hint);
+
+ if (isThenable$1(result)) {
+ result.then(function (final) {
+ return _this._notifyEventProcessors(processors, final, hint, index + 1).then(resolve);
+ }).then(null, reject);
+ } else {
+ _this._notifyEventProcessors(processors, result, hint, index + 1).then(resolve).then(null, reject);
+ }
+ }
+ });
+ };
+ /**
* @inheritDoc
*/
@@ -9985,7 +9952,7 @@ typeof navigator === "object" && (function () {
Scope.prototype.setTags = function (tags) {
- this._tags = _assign(_assign({}, this._tags), tags);
+ this._tags = _assign({}, this._tags, tags);
this._notifyScopeListeners();
@@ -9999,7 +9966,7 @@ typeof navigator === "object" && (function () {
Scope.prototype.setTag = function (key, value) {
var _a;
- this._tags = _assign(_assign({}, this._tags), (_a = {}, _a[key] = value, _a));
+ this._tags = _assign({}, this._tags, (_a = {}, _a[key] = value, _a));
this._notifyScopeListeners();
@@ -10011,7 +9978,7 @@ typeof navigator === "object" && (function () {
Scope.prototype.setExtras = function (extras) {
- this._extra = _assign(_assign({}, this._extra), extras);
+ this._extra = _assign({}, this._extra, extras);
this._notifyScopeListeners();
@@ -10025,7 +9992,7 @@ typeof navigator === "object" && (function () {
Scope.prototype.setExtra = function (key, extra) {
var _a;
- this._extra = _assign(_assign({}, this._extra), (_a = {}, _a[key] = extra, _a));
+ this._extra = _assign({}, this._extra, (_a = {}, _a[key] = extra, _a));
this._notifyScopeListeners();
@@ -10060,32 +10027,26 @@ typeof navigator === "object" && (function () {
*/
- Scope.prototype.setTransactionName = function (name) {
- this._transactionName = name;
+ Scope.prototype.setTransaction = function (transaction) {
+ this._transaction = transaction;
+
+ if (this._span) {
+ this._span.transaction = transaction;
+ }
this._notifyScopeListeners();
return this;
};
/**
- * Can be removed in major version.
- * @deprecated in favor of {@link this.setTransactionName}
- */
-
-
- Scope.prototype.setTransaction = function (name) {
- return this.setTransactionName(name);
- };
- /**
* @inheritDoc
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
Scope.prototype.setContext = function (key, context) {
var _a;
- this._contexts = _assign(_assign({}, this._contexts), (_a = {}, _a[key] = context, _a));
+ this._context = _assign({}, this._context, (_a = {}, _a[key] = context, _a));
this._notifyScopeListeners();
@@ -10104,7 +10065,8 @@ typeof navigator === "object" && (function () {
return this;
};
/**
- * @inheritDoc
+ * Internal getter for Span, used in Hub.
+ * @hidden
*/
@@ -10112,71 +10074,28 @@ typeof navigator === "object" && (function () {
return this._span;
};
/**
- * @inheritDoc
- */
-
-
- Scope.prototype.getTransaction = function () {
- var span = this.getSpan();
-
- if (span && span.spanRecorder && span.spanRecorder.spans[0]) {
- return span.spanRecorder.spans[0];
- }
-
- return undefined;
- };
- /**
- * @inheritDoc
+ * Inherit values from the parent scope.
+ * @param scope to clone.
*/
- Scope.prototype.update = function (captureContext) {
- if (!captureContext) {
- return this;
- }
-
- if (typeof captureContext === 'function') {
- var updatedScope = captureContext(this);
- return updatedScope instanceof Scope ? updatedScope : this;
- }
-
- if (captureContext instanceof Scope) {
- this._tags = _assign(_assign({}, this._tags), captureContext._tags);
- this._extra = _assign(_assign({}, this._extra), captureContext._extra);
- this._contexts = _assign(_assign({}, this._contexts), captureContext._contexts);
-
- if (captureContext._user) {
- this._user = captureContext._user;
- }
-
- if (captureContext._level) {
- this._level = captureContext._level;
- }
-
- if (captureContext._fingerprint) {
- this._fingerprint = captureContext._fingerprint;
- }
- } else if (isPlainObject(captureContext)) {
- // eslint-disable-next-line no-param-reassign
- captureContext = captureContext;
- this._tags = _assign(_assign({}, this._tags), captureContext.tags);
- this._extra = _assign(_assign({}, this._extra), captureContext.extra);
- this._contexts = _assign(_assign({}, this._contexts), captureContext.contexts);
-
- if (captureContext.user) {
- this._user = captureContext.user;
- }
-
- if (captureContext.level) {
- this._level = captureContext.level;
- }
+ Scope.clone = function (scope) {
+ var newScope = new Scope();
- if (captureContext.fingerprint) {
- this._fingerprint = captureContext.fingerprint;
- }
+ if (scope) {
+ newScope._breadcrumbs = __spread(scope._breadcrumbs);
+ newScope._tags = _assign({}, scope._tags);
+ newScope._extra = _assign({}, scope._extra);
+ newScope._context = _assign({}, scope._context);
+ newScope._user = scope._user;
+ newScope._level = scope._level;
+ newScope._span = scope._span;
+ newScope._transaction = scope._transaction;
+ newScope._fingerprint = scope._fingerprint;
+ newScope._eventProcessors = __spread(scope._eventProcessors);
}
- return this;
+ return newScope;
};
/**
* @inheritDoc
@@ -10188,9 +10107,9 @@ typeof navigator === "object" && (function () {
this._tags = {};
this._extra = {};
this._user = {};
- this._contexts = {};
+ this._context = {};
this._level = undefined;
- this._transactionName = undefined;
+ this._transaction = undefined;
this._fingerprint = undefined;
this._span = undefined;
@@ -10227,6 +10146,25 @@ typeof navigator === "object" && (function () {
return this;
};
/**
+ * Applies fingerprint from the scope to the event if there's one,
+ * uses message if there's one instead or get rid of empty fingerprint
+ */
+
+
+ Scope.prototype._applyFingerprint = function (event) {
+ // Make sure it's an array first and we actually have something in place
+ event.fingerprint = event.fingerprint ? Array.isArray(event.fingerprint) ? event.fingerprint : [event.fingerprint] : []; // If we have something on the scope, then merge it with event
+
+ if (this._fingerprint) {
+ event.fingerprint = event.fingerprint.concat(this._fingerprint);
+ } // If we have no data at all, remove empty array default
+
+
+ if (event.fingerprint && !event.fingerprint.length) {
+ delete event.fingerprint;
+ }
+ };
+ /**
* Applies the current context and fingerprint to the event.
* Note that breadcrumbs will be added by the client.
* Also if the event has already breadcrumbs on it, we do not merge them.
@@ -10238,31 +10176,28 @@ typeof navigator === "object" && (function () {
Scope.prototype.applyToEvent = function (event, hint) {
if (this._extra && Object.keys(this._extra).length) {
- event.extra = _assign(_assign({}, this._extra), event.extra);
+ event.extra = _assign({}, this._extra, event.extra);
}
if (this._tags && Object.keys(this._tags).length) {
- event.tags = _assign(_assign({}, this._tags), event.tags);
+ event.tags = _assign({}, this._tags, event.tags);
}
if (this._user && Object.keys(this._user).length) {
- event.user = _assign(_assign({}, this._user), event.user);
+ event.user = _assign({}, this._user, event.user);
}
- if (this._contexts && Object.keys(this._contexts).length) {
- event.contexts = _assign(_assign({}, this._contexts), event.contexts);
+ if (this._context && Object.keys(this._context).length) {
+ event.contexts = _assign({}, this._context, event.contexts);
}
if (this._level) {
event.level = this._level;
}
- if (this._transactionName) {
- event.transaction = this._transactionName;
- } // We want to set the trace context for normal events only if there isn't already
- // a trace context on the event. There is a product feature in place where we link
- // errors with transaction and it relys on that.
-
+ if (this._transaction) {
+ event.transaction = this._transaction;
+ }
if (this._span) {
event.contexts = _assign({
@@ -10276,74 +10211,6 @@ typeof navigator === "object" && (function () {
event.breadcrumbs = event.breadcrumbs.length > 0 ? event.breadcrumbs : undefined;
return this._notifyEventProcessors(__spread(getGlobalEventProcessors(), this._eventProcessors), event, hint);
};
- /**
- * This will be called after {@link applyToEvent} is finished.
- */
-
-
- Scope.prototype._notifyEventProcessors = function (processors, event, hint, index) {
- var _this = this;
-
- if (index === void 0) {
- index = 0;
- }
-
- return new SyncPromise(function (resolve, reject) {
- var processor = processors[index];
-
- if (event === null || typeof processor !== 'function') {
- resolve(event);
- } else {
- var result = processor(_assign({}, event), hint);
-
- if (isThenable$1(result)) {
- result.then(function (final) {
- return _this._notifyEventProcessors(processors, final, hint, index + 1).then(resolve);
- }).then(null, reject);
- } else {
- _this._notifyEventProcessors(processors, result, hint, index + 1).then(resolve).then(null, reject);
- }
- }
- });
- };
- /**
- * This will be called on every set call.
- */
-
-
- Scope.prototype._notifyScopeListeners = function () {
- var _this = this;
-
- if (!this._notifyingListeners) {
- this._notifyingListeners = true;
- setTimeout(function () {
- _this._scopeListeners.forEach(function (callback) {
- callback(_this);
- });
-
- _this._notifyingListeners = false;
- });
- }
- };
- /**
- * Applies fingerprint from the scope to the event if there's one,
- * uses message if there's one instead or get rid of empty fingerprint
- */
-
-
- Scope.prototype._applyFingerprint = function (event) {
- // Make sure it's an array first and we actually have something in place
- event.fingerprint = event.fingerprint ? Array.isArray(event.fingerprint) ? event.fingerprint : [event.fingerprint] : []; // If we have something on the scope, then merge it with event
-
- if (this._fingerprint) {
- event.fingerprint = event.fingerprint.concat(this._fingerprint);
- } // If we have no data at all, remove empty array default
-
-
- if (event.fingerprint && !event.fingerprint.length) {
- delete event.fingerprint;
- }
- };
return Scope;
}();
@@ -10370,8 +10237,8 @@ typeof navigator === "object" && (function () {
/**
* API compatibility version of this hub.
*
- * WARNING: This number should only be increased when the global interface
- * changes and new methods are introduced.
+ * WARNING: This number should only be incresed when the global interface
+ * changes a and new methods are introduced.
*
* @hidden
*/
@@ -10422,10 +10289,31 @@ typeof navigator === "object" && (function () {
client: client,
scope: scope
});
-
- this.bindClient(client);
}
/**
+ * Internal helper function to call a method on the top client if it exists.
+ *
+ * @param method The method to call on the client.
+ * @param args Arguments to pass to the client function.
+ */
+
+
+ Hub.prototype._invokeClient = function (method) {
+ var _a;
+
+ var args = [];
+
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+
+ var top = this.getStackTop();
+
+ if (top && top.client && top.client[method]) {
+ (_a = top.client)[method].apply(_a, __spread(args, [top.scope]));
+ }
+ };
+ /**
* @inheritDoc
*/
@@ -10513,7 +10401,6 @@ typeof navigator === "object" && (function () {
/**
* @inheritDoc
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
Hub.prototype.captureException = function (exception, hint) {
@@ -10538,7 +10425,7 @@ typeof navigator === "object" && (function () {
};
}
- this._invokeClient('captureException', exception, _assign(_assign({}, finalHint), {
+ this._invokeClient('captureException', exception, _assign({}, finalHint, {
event_id: eventId
}));
@@ -10571,7 +10458,7 @@ typeof navigator === "object" && (function () {
};
}
- this._invokeClient('captureMessage', message, level, _assign(_assign({}, finalHint), {
+ this._invokeClient('captureMessage', message, level, _assign({}, finalHint, {
event_id: eventId
}));
@@ -10585,7 +10472,7 @@ typeof navigator === "object" && (function () {
Hub.prototype.captureEvent = function (event, hint) {
var eventId = this._lastEventId = uuid4();
- this._invokeClient('captureEvent', event, _assign(_assign({}, hint), {
+ this._invokeClient('captureEvent', event, _assign({}, hint, {
event_id: eventId
}));
@@ -10609,8 +10496,7 @@ typeof navigator === "object" && (function () {
if (!top.scope || !top.client) {
return;
- } // eslint-disable-next-line @typescript-eslint/unbound-method
-
+ }
var _a = top.client.getOptions && top.client.getOptions() || {},
_b = _a.beforeBreadcrumb,
@@ -10711,7 +10597,6 @@ typeof navigator === "object" && (function () {
/**
* @inheritDoc
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
Hub.prototype.setContext = function (name, context) {
@@ -10773,16 +10658,12 @@ typeof navigator === "object" && (function () {
*/
- Hub.prototype.startSpan = function (context) {
- return this._callExtensionMethod('startSpan', context);
- };
- /**
- * @inheritDoc
- */
-
+ Hub.prototype.startSpan = function (spanOrSpanContext, forceNoChild) {
+ if (forceNoChild === void 0) {
+ forceNoChild = false;
+ }
- Hub.prototype.startTransaction = function (context) {
- return this._callExtensionMethod('startTransaction', context);
+ return this._callExtensionMethod('startSpan', spanOrSpanContext, forceNoChild);
};
/**
* @inheritDoc
@@ -10793,35 +10674,9 @@ typeof navigator === "object" && (function () {
return this._callExtensionMethod('traceHeaders');
};
/**
- * Internal helper function to call a method on the top client if it exists.
- *
- * @param method The method to call on the client.
- * @param args Arguments to pass to the client function.
- */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
-
-
- Hub.prototype._invokeClient = function (method) {
- var _a;
-
- var args = [];
-
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
- }
-
- var top = this.getStackTop();
-
- if (top && top.client && top.client[method]) {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
- (_a = top.client)[method].apply(_a, __spread(args, [top.scope]));
- }
- };
- /**
* Calls global extension method and binding current instance to the function call
*/
- // @ts-ignore Function lacks ending return statement and return type does not include 'undefined'. ts(2366)
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ // @ts-ignore
Hub.prototype._callExtensionMethod = function (method) {
@@ -10832,7 +10687,7 @@ typeof navigator === "object" && (function () {
}
var carrier = getMainCarrier();
- var sentry = carrier.__SENTRY__;
+ var sentry = carrier.__SENTRY__; // tslint:disable-next-line: strict-type-predicates
if (sentry && sentry.extensions && typeof sentry.extensions[method] === 'function') {
return sentry.extensions[method].apply(this, args);
@@ -10890,7 +10745,7 @@ typeof navigator === "object" && (function () {
return getHubFromCarrier(registry);
}
/**
- * Try to read the hub from an active domain, and fallback to the registry if one doesn't exist
+ * Try to read the hub from an active domain, fallback to the registry if one doesnt exist
* @returns discovered hub
*/
@@ -10898,20 +10753,18 @@ typeof navigator === "object" && (function () {
try {
var property = 'domain';
var carrier = getMainCarrier();
- var sentry = carrier.__SENTRY__;
+ var sentry = carrier.__SENTRY__; // tslint:disable-next-line: strict-type-predicates
if (!sentry || !sentry.extensions || !sentry.extensions[property]) {
return getHubFromCarrier(registry);
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
-
-
- var domain = sentry.extensions[property]; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ }
- var activeDomain = domain.active; // If there's no active domain, just return global hub
+ var domain = sentry.extensions[property];
+ var activeDomain = domain.active; // If there no active domain, just return global hub
if (!activeDomain) {
return getHubFromCarrier(registry);
- } // If there's no hub on current domain, or it's an old API, assign a new one
+ } // If there's no hub on current domain, or its an old API, assign a new one
if (!hasHubOnCarrier(activeDomain) || getHubFromCarrier(activeDomain).isOlderThan(API_VERSION)) {
@@ -10977,7 +10830,6 @@ typeof navigator === "object" && (function () {
* @param method function to call on hub.
* @param args to pass to function.
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
function callOnHub(method) {
var args = [];
@@ -10989,7 +10841,7 @@ typeof navigator === "object" && (function () {
var hub = getCurrentHub();
if (hub && hub[method]) {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ // tslint:disable-next-line:no-unsafe-any
return hub[method].apply(hub, __spread(args));
}
@@ -11001,10 +10853,9 @@ typeof navigator === "object" && (function () {
* @param exception An exception-like object.
* @returns The generated eventId.
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
- function captureException(exception, captureContext) {
+ function captureException(exception) {
var syntheticException;
try {
@@ -11014,7 +10865,6 @@ typeof navigator === "object" && (function () {
}
return callOnHub('captureException', exception, {
- captureContext: captureContext,
originalException: exception,
syntheticException: syntheticException
});
@@ -11054,40 +10904,33 @@ typeof navigator === "object" && (function () {
API.prototype.getDsn = function () {
return this._dsnObject;
};
- /** Returns the prefix to construct Sentry ingestion API endpoints. */
-
-
- API.prototype.getBaseApiEndpoint = function () {
- var dsn = this._dsnObject;
- var protocol = dsn.protocol ? dsn.protocol + ":" : '';
- var port = dsn.port ? ":" + dsn.port : '';
- return protocol + "//" + dsn.host + port + (dsn.path ? "/" + dsn.path : '') + "/api/";
- };
- /** Returns the store endpoint URL. */
+ /** Returns a string with auth headers in the url to the store endpoint. */
API.prototype.getStoreEndpoint = function () {
- return this._getIngestEndpoint('store');
+ return "" + this._getBaseUrl() + this.getStoreEndpointPath();
};
- /**
- * Returns the store endpoint URL with auth in the query string.
- *
- * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.
- */
+ /** Returns the store endpoint with auth added in url encoded. */
API.prototype.getStoreEndpointWithUrlEncodedAuth = function () {
- return this.getStoreEndpoint() + "?" + this._encodedAuth();
+ var dsn = this._dsnObject;
+ var auth = {
+ sentry_key: dsn.user,
+ sentry_version: SENTRY_API_VERSION
+ }; // Auth is intentionally sent as part of query string (NOT as custom HTTP header)
+ // to avoid preflight CORS requests
+
+ return this.getStoreEndpoint() + "?" + urlEncode(auth);
};
- /**
- * Returns the envelope endpoint URL with auth in the query string.
- *
- * Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.
- */
+ /** Returns the base path of the url including the port. */
- API.prototype.getEnvelopeEndpointWithUrlEncodedAuth = function () {
- return this._getEnvelopeEndpoint() + "?" + this._encodedAuth();
+ API.prototype._getBaseUrl = function () {
+ var dsn = this._dsnObject;
+ var protocol = dsn.protocol ? dsn.protocol + ":" : '';
+ var port = dsn.port ? ":" + dsn.port : '';
+ return protocol + "//" + dsn.host + port;
};
/** Returns only the path component for the store endpoint. */
@@ -11096,10 +10939,7 @@ typeof navigator === "object" && (function () {
var dsn = this._dsnObject;
return (dsn.path ? "/" + dsn.path : '') + "/api/" + dsn.projectId + "/store/";
};
- /**
- * Returns an object that can be used in request headers.
- * This is needed for node and the old /store endpoint in sentry
- */
+ /** Returns an object that can be used in request headers. */
API.prototype.getRequestHeaders = function (clientName, clientVersion) {
@@ -11126,7 +10966,7 @@ typeof navigator === "object" && (function () {
}
var dsn = this._dsnObject;
- var endpoint = this.getBaseApiEndpoint() + "embed/error-page/";
+ var endpoint = "" + this._getBaseUrl() + (dsn.path ? "/" + dsn.path : '') + "/api/embed/error-page/";
var encodedOptions = [];
encodedOptions.push("dsn=" + dsn.toString());
@@ -11154,33 +10994,6 @@ typeof navigator === "object" && (function () {
return endpoint;
};
- /** Returns the envelope endpoint URL. */
-
-
- API.prototype._getEnvelopeEndpoint = function () {
- return this._getIngestEndpoint('envelope');
- };
- /** Returns the ingest API endpoint for target. */
-
-
- API.prototype._getIngestEndpoint = function (target) {
- var base = this.getBaseApiEndpoint();
- var dsn = this._dsnObject;
- return "" + base + dsn.projectId + "/" + target + "/";
- };
- /** Returns a URL-encoded string with auth config suitable for a query string. */
-
-
- API.prototype._encodedAuth = function () {
- var dsn = this._dsnObject;
- var auth = {
- // We send only the minimum set of required information. See
- // https://github.com/getsentry/sentry-javascript/issues/2572.
- sentry_key: dsn.user,
- sentry_version: SENTRY_API_VERSION
- };
- return urlEncode(auth);
- };
return API;
}();
@@ -11316,17 +11129,23 @@ typeof navigator === "object" && (function () {
/**
* @inheritDoc
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
BaseClient.prototype.captureException = function (exception, hint, scope) {
var _this = this;
var eventId = hint && hint.event_id;
- this._processing = true; // eslint-disable-next-line @typescript-eslint/no-floating-promises
+ this._processing = true;
this._getBackend().eventFromException(exception, hint).then(function (event) {
- eventId = _this.captureEvent(event, hint, scope);
+ return _this._processEvent(event, hint, scope);
+ }).then(function (finalEvent) {
+ // We need to check for finalEvent in case beforeSend returned null
+ eventId = finalEvent && finalEvent.event_id;
+ _this._processing = false;
+ }).then(null, function (reason) {
+ logger.error(reason);
+ _this._processing = false;
});
return eventId;
@@ -11341,10 +11160,16 @@ typeof navigator === "object" && (function () {
var eventId = hint && hint.event_id;
this._processing = true;
- var promisedEvent = isPrimitive(message) ? this._getBackend().eventFromMessage("" + message, level, hint) : this._getBackend().eventFromException(message, hint); // eslint-disable-next-line @typescript-eslint/no-floating-promises
-
+ var promisedEvent = isPrimitive(message) ? this._getBackend().eventFromMessage("" + message, level, hint) : this._getBackend().eventFromException(message, hint);
promisedEvent.then(function (event) {
- eventId = _this.captureEvent(event, hint, scope);
+ return _this._processEvent(event, hint, scope);
+ }).then(function (finalEvent) {
+ // We need to check for finalEvent in case beforeSend returned null
+ eventId = finalEvent && finalEvent.event_id;
+ _this._processing = false;
+ }).then(null, function (reason) {
+ logger.error(reason);
+ _this._processing = false;
});
return eventId;
};
@@ -11489,7 +11314,7 @@ typeof navigator === "object" && (function () {
* nested objects, such as the context, keys are merged.
*
* @param event The original event.
- * @param hint May contain additional information about the original exception.
+ * @param hint May contain additional informartion about the original exception.
* @param scope A scope containing event metadata.
* @returns A new event with more information.
*/
@@ -11498,36 +11323,62 @@ typeof navigator === "object" && (function () {
BaseClient.prototype._prepareEvent = function (event, scope, hint) {
var _this = this;
- var _a = this.getOptions().normalizeDepth,
- normalizeDepth = _a === void 0 ? 3 : _a;
+ var _a = this.getOptions(),
+ environment = _a.environment,
+ release = _a.release,
+ dist = _a.dist,
+ _b = _a.maxValueLength,
+ maxValueLength = _b === void 0 ? 250 : _b,
+ _c = _a.normalizeDepth,
+ normalizeDepth = _c === void 0 ? 3 : _c;
- var prepared = _assign(_assign({}, event), {
- event_id: event.event_id || (hint && hint.event_id ? hint.event_id : uuid4()),
- timestamp: event.timestamp || timestampWithMs()
- });
+ var prepared = _assign({}, event);
- this._applyClientOptions(prepared);
+ if (prepared.environment === undefined && environment !== undefined) {
+ prepared.environment = environment;
+ }
+
+ if (prepared.release === undefined && release !== undefined) {
+ prepared.release = release;
+ }
+
+ if (prepared.dist === undefined && dist !== undefined) {
+ prepared.dist = dist;
+ }
+
+ if (prepared.message) {
+ prepared.message = truncate(prepared.message, maxValueLength);
+ }
+
+ var exception = prepared.exception && prepared.exception.values && prepared.exception.values[0];
+
+ if (exception && exception.value) {
+ exception.value = truncate(exception.value, maxValueLength);
+ }
- this._applyIntegrationsMetadata(prepared); // If we have scope given to us, use it as the base for further modifications.
- // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.
+ var request = prepared.request;
+ if (request && request.url) {
+ request.url = truncate(request.url, maxValueLength);
+ }
- var finalScope = scope;
+ if (prepared.event_id === undefined) {
+ prepared.event_id = hint && hint.event_id ? hint.event_id : uuid4();
+ }
- if (hint && hint.captureContext) {
- finalScope = Scope.clone(finalScope).update(hint.captureContext);
- } // We prepare the result here with a resolved Event.
+ this._addIntegrations(prepared.sdk); // We prepare the result here with a resolved Event.
var result = SyncPromise.resolve(prepared); // This should be the last thing called, since we want that
// {@link Hub.addEventProcessor} gets the finished prepared event.
- if (finalScope) {
+ if (scope) {
// In case we have a hub we reassign it.
- result = finalScope.applyToEvent(prepared, hint);
+ result = scope.applyToEvent(prepared, hint);
}
return result.then(function (evt) {
+ // tslint:disable-next-line:strict-type-predicates
if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
return _this._normalizeEvent(evt, normalizeDepth);
}
@@ -11550,79 +11401,22 @@ typeof navigator === "object" && (function () {
BaseClient.prototype._normalizeEvent = function (event, depth) {
if (!event) {
return null;
- }
+ } // tslint:disable:no-unsafe-any
- var normalized = _assign(_assign(_assign(_assign(_assign({}, event), event.breadcrumbs && {
+
+ return _assign({}, event, event.breadcrumbs && {
breadcrumbs: event.breadcrumbs.map(function (b) {
- return _assign(_assign({}, b), b.data && {
+ return _assign({}, b, b.data && {
data: normalize$1(b.data, depth)
});
})
- }), event.user && {
+ }, event.user && {
user: normalize$1(event.user, depth)
- }), event.contexts && {
+ }, event.contexts && {
contexts: normalize$1(event.contexts, depth)
- }), event.extra && {
+ }, event.extra && {
extra: normalize$1(event.extra, depth)
- }); // event.contexts.trace stores information about a Transaction. Similarly,
- // event.spans[] stores information about child Spans. Given that a
- // Transaction is conceptually a Span, normalization should apply to both
- // Transactions and Spans consistently.
- // For now the decision is to skip normalization of Transactions and Spans,
- // so this block overwrites the normalized event to add back the original
- // Transaction information prior to normalization.
-
-
- if (event.contexts && event.contexts.trace) {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- normalized.contexts.trace = event.contexts.trace;
- }
-
- return normalized;
- };
- /**
- * Enhances event using the client configuration.
- * It takes care of all "static" values like environment, release and `dist`,
- * as well as truncating overly long values.
- * @param event event instance to be enhanced
- */
-
-
- BaseClient.prototype._applyClientOptions = function (event) {
- var _a = this.getOptions(),
- environment = _a.environment,
- release = _a.release,
- dist = _a.dist,
- _b = _a.maxValueLength,
- maxValueLength = _b === void 0 ? 250 : _b;
-
- if (event.environment === undefined && environment !== undefined) {
- event.environment = environment;
- }
-
- if (event.release === undefined && release !== undefined) {
- event.release = release;
- }
-
- if (event.dist === undefined && dist !== undefined) {
- event.dist = dist;
- }
-
- if (event.message) {
- event.message = truncate(event.message, maxValueLength);
- }
-
- var exception = event.exception && event.exception.values && event.exception.values[0];
-
- if (exception && exception.value) {
- exception.value = truncate(exception.value, maxValueLength);
- }
-
- var request = event.request;
-
- if (request && request.url) {
- request.url = truncate(request.url, maxValueLength);
- }
+ });
};
/**
* This function adds all used integrations to the SDK info in the event.
@@ -11630,8 +11424,7 @@ typeof navigator === "object" && (function () {
*/
- BaseClient.prototype._applyIntegrationsMetadata = function (event) {
- var sdkInfo = event.sdk;
+ BaseClient.prototype._addIntegrations = function (sdkInfo) {
var integrationsArray = Object.keys(this._integrations);
if (sdkInfo && integrationsArray.length > 0) {
@@ -11639,15 +11432,6 @@ typeof navigator === "object" && (function () {
}
};
/**
- * Tells the backend to send this event
- * @param event The Sentry event to send
- */
-
-
- BaseClient.prototype._sendEvent = function (event) {
- this._getBackend().sendEvent(event);
- };
- /**
* Processes an event (either error or message) and sends it to Sentry.
*
* This also adds breadcrumbs and context information to the event. However,
@@ -11656,15 +11440,14 @@ typeof navigator === "object" && (function () {
*
*
* @param event The event to send to Sentry.
- * @param hint May contain additional information about the original exception.
+ * @param hint May contain additional informartion about the original exception.
* @param scope A scope containing event metadata.
* @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
*/
BaseClient.prototype._processEvent = function (event, hint, scope) {
- var _this = this; // eslint-disable-next-line @typescript-eslint/unbound-method
-
+ var _this = this;
var _a = this.getOptions(),
beforeSend = _a.beforeSend,
@@ -11672,13 +11455,11 @@ typeof navigator === "object" && (function () {
if (!this._isEnabled()) {
return SyncPromise.reject('SDK not enabled, will not send event.');
- }
-
- var isTransaction = event.type === 'transaction'; // 1.0 === 100% events are sent
+ } // 1.0 === 100% events are sent
// 0.0 === 0% events are sent
- // Sampling for transaction happens somewhere else
- if (!isTransaction && typeof sampleRate === 'number' && Math.random() > sampleRate) {
+
+ if (typeof sampleRate === 'number' && Math.random() > sampleRate) {
return SyncPromise.reject('This event has been sampled, will not send event.');
}
@@ -11690,16 +11471,16 @@ typeof navigator === "object" && (function () {
}
var finalEvent = prepared;
- var isInternalException = hint && hint.data && hint.data.__sentry__ === true; // We skip beforeSend in case of transactions
+ var isInternalException = hint && hint.data && hint.data.__sentry__ === true;
- if (isInternalException || !beforeSend || isTransaction) {
- _this._sendEvent(finalEvent);
+ if (isInternalException || !beforeSend) {
+ _this._getBackend().sendEvent(finalEvent);
resolve(finalEvent);
return;
}
- var beforeSendResult = beforeSend(prepared, hint);
+ var beforeSendResult = beforeSend(prepared, hint); // tslint:disable-next-line:strict-type-predicates
if (typeof beforeSendResult === 'undefined') {
logger.error('`beforeSend` method has to return `null` or a valid event.');
@@ -11715,7 +11496,7 @@ typeof navigator === "object" && (function () {
} // From here on we are really async
- _this._sendEvent(finalEvent);
+ _this._getBackend().sendEvent(finalEvent);
resolve(finalEvent);
}
@@ -11746,7 +11527,7 @@ typeof navigator === "object" && (function () {
} // From here on we are really async
- _this._sendEvent(processedEvent);
+ _this._getBackend().sendEvent(processedEvent);
resolve(processedEvent);
}).then(null, function (e) {
@@ -11805,9 +11586,16 @@ typeof navigator === "object" && (function () {
this._transport = this._setupTransport();
}
/**
+ * Sets up the transport so it can be used later to send requests.
+ */
+
+
+ BaseBackend.prototype._setupTransport = function () {
+ return new NoopTransport();
+ };
+ /**
* @inheritDoc
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
BaseBackend.prototype.eventFromException = function (_exception, _hint) {
@@ -11839,52 +11627,10 @@ typeof navigator === "object" && (function () {
BaseBackend.prototype.getTransport = function () {
return this._transport;
};
- /**
- * Sets up the transport so it can be used later to send requests.
- */
-
-
- BaseBackend.prototype._setupTransport = function () {
- return new NoopTransport();
- };
return BaseBackend;
}();
- /** Creates a SentryRequest from an event. */
-
- function eventToSentryRequest(event, api) {
- var useEnvelope = event.type === 'transaction';
- var req = {
- body: JSON.stringify(event),
- url: useEnvelope ? api.getEnvelopeEndpointWithUrlEncodedAuth() : api.getStoreEndpointWithUrlEncodedAuth()
- }; // https://develop.sentry.dev/sdk/envelopes/
- // Since we don't need to manipulate envelopes nor store them, there is no
- // exported concept of an Envelope with operations including serialization and
- // deserialization. Instead, we only implement a minimal subset of the spec to
- // serialize events inline here.
-
- if (useEnvelope) {
- var envelopeHeaders = JSON.stringify({
- event_id: event.event_id,
- // We need to add * 1000 since we divide it by 1000 by default but JS works with ms precision
- // The reason we use timestampWithMs here is that all clocks across the SDK use the same clock
- sent_at: new Date(timestampWithMs() * 1000).toISOString()
- });
- var itemHeaders = JSON.stringify({
- type: event.type
- }); // The trailing newline is optional. We intentionally don't send it to avoid
- // sending unnecessary bytes.
- //
- // const envelope = `${envelopeHeaders}\n${itemHeaders}\n${req.body}\n`;
-
- var envelope = envelopeHeaders + "\n" + itemHeaders + "\n" + req.body;
- req.body = envelope;
- }
-
- return req;
- }
-
/**
* Internal function to create a new SDK client instance. The client is
* installed and then bound to the current scope.
@@ -11921,8 +11667,7 @@ typeof navigator === "object" && (function () {
FunctionToString.prototype.setupOnce = function () {
- // eslint-disable-next-line @typescript-eslint/unbound-method
- originalFunctionToString = Function.prototype.toString; // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ originalFunctionToString = Function.prototype.toString;
Function.prototype.toString = function () {
var args = [];
@@ -11931,7 +11676,8 @@ typeof navigator === "object" && (function () {
args[_i] = arguments[_i];
}
- var context = this.__sentry_original__ || this;
+ var context = this.__sentry_original__ || this; // tslint:disable-next-line:no-unsafe-any
+
return originalFunctionToString.apply(context, args);
};
};
@@ -12022,13 +11768,13 @@ typeof navigator === "object" && (function () {
return true;
}
- if (this._isDeniedUrl(event, options)) {
- logger.warn("Event dropped due to being matched by `denyUrls` option.\nEvent: " + getEventDescription(event) + ".\nUrl: " + this._getEventFilterUrl(event));
+ if (this._isBlacklistedUrl(event, options)) {
+ logger.warn("Event dropped due to being matched by `blacklistUrls` option.\nEvent: " + getEventDescription(event) + ".\nUrl: " + this._getEventFilterUrl(event));
return true;
}
- if (!this._isAllowedUrl(event, options)) {
- logger.warn("Event dropped due to not being matched by `allowUrls` option.\nEvent: " + getEventDescription(event) + ".\nUrl: " + this._getEventFilterUrl(event));
+ if (!this._isWhitelistedUrl(event, options)) {
+ logger.warn("Event dropped due to not being matched by `whitelistUrls` option.\nEvent: " + getEventDescription(event) + ".\nUrl: " + this._getEventFilterUrl(event));
return true;
}
@@ -12038,6 +11784,10 @@ typeof navigator === "object" && (function () {
InboundFilters.prototype._isSentryError = function (event, options) {
+ if (options === void 0) {
+ options = {};
+ }
+
if (!options.ignoreInternal) {
return false;
}
@@ -12052,6 +11802,10 @@ typeof navigator === "object" && (function () {
InboundFilters.prototype._isIgnoredError = function (event, options) {
+ if (options === void 0) {
+ options = {};
+ }
+
if (!options.ignoreErrors || !options.ignoreErrors.length) {
return false;
}
@@ -12066,30 +11820,38 @@ typeof navigator === "object" && (function () {
/** JSDoc */
- InboundFilters.prototype._isDeniedUrl = function (event, options) {
- // TODO: Use Glob instead?
- if (!options.denyUrls || !options.denyUrls.length) {
+ InboundFilters.prototype._isBlacklistedUrl = function (event, options) {
+ if (options === void 0) {
+ options = {};
+ } // TODO: Use Glob instead?
+
+
+ if (!options.blacklistUrls || !options.blacklistUrls.length) {
return false;
}
var url = this._getEventFilterUrl(event);
- return !url ? false : options.denyUrls.some(function (pattern) {
+ return !url ? false : options.blacklistUrls.some(function (pattern) {
return isMatchingPattern(url, pattern);
});
};
/** JSDoc */
- InboundFilters.prototype._isAllowedUrl = function (event, options) {
- // TODO: Use Glob instead?
- if (!options.allowUrls || !options.allowUrls.length) {
+ InboundFilters.prototype._isWhitelistedUrl = function (event, options) {
+ if (options === void 0) {
+ options = {};
+ } // TODO: Use Glob instead?
+
+
+ if (!options.whitelistUrls || !options.whitelistUrls.length) {
return true;
}
var url = this._getEventFilterUrl(event);
- return !url ? true : options.allowUrls.some(function (pattern) {
+ return !url ? true : options.whitelistUrls.some(function (pattern) {
return isMatchingPattern(url, pattern);
});
};
@@ -12102,10 +11864,10 @@ typeof navigator === "object" && (function () {
}
return {
- allowUrls: __spread(this._options.whitelistUrls || [], this._options.allowUrls || [], clientOptions.whitelistUrls || [], clientOptions.allowUrls || []),
- denyUrls: __spread(this._options.blacklistUrls || [], this._options.denyUrls || [], clientOptions.blacklistUrls || [], clientOptions.denyUrls || []),
+ blacklistUrls: __spread(this._options.blacklistUrls || [], clientOptions.blacklistUrls || []),
ignoreErrors: __spread(this._options.ignoreErrors || [], clientOptions.ignoreErrors || [], DEFAULT_IGNORE_ERRORS),
- ignoreInternal: typeof this._options.ignoreInternal !== 'undefined' ? this._options.ignoreInternal : true
+ ignoreInternal: typeof this._options.ignoreInternal !== 'undefined' ? this._options.ignoreInternal : true,
+ whitelistUrls: __spread(this._options.whitelistUrls || [], clientOptions.whitelistUrls || [])
};
};
/** JSDoc */
@@ -12169,26 +11931,16 @@ typeof navigator === "object" && (function () {
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
// We need this specific case for now because we want no other regex to match.
- var gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i;
+ var gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i;
var winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
var geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
- var chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/; // Based on our own mapping pattern - https://github.com/getsentry/sentry/blob/9f08305e09866c8bd6d0c24f5b0aabdd7dd6c59c/src/sentry/lang/javascript/errormapping.py#L83-L108
-
- var reactMinifiedRegexp = /Minified React error #\d+;/i;
+ var chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/;
/** JSDoc */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
function computeStackTrace(ex) {
+ // tslint:disable:no-unsafe-any
var stack = null;
- var popSize = 0;
-
- if (ex) {
- if (typeof ex.framesToPop === 'number') {
- popSize = ex.framesToPop;
- } else if (reactMinifiedRegexp.test(ex.message)) {
- popSize = 1;
- }
- }
+ var popSize = ex && ex.framesToPop;
try {
// This must be tried first because Opera 10 *destroys*
@@ -12219,9 +11971,10 @@ typeof navigator === "object" && (function () {
};
}
/** JSDoc */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, complexity
+ // tslint:disable-next-line:cyclomatic-complexity
function computeStackTraceFromStackProp(ex) {
+ // tslint:disable:no-conditional-assignment
if (!ex || !ex.stack) {
return null;
}
@@ -12311,7 +12064,6 @@ typeof navigator === "object" && (function () {
};
}
/** JSDoc */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
function computeStackTraceFromStacktraceProp(ex) {
@@ -12324,12 +12076,13 @@ typeof navigator === "object" && (function () {
var stacktrace = ex.stacktrace;
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
- var opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\((.*)\))? in (.*):\s*$/i;
+ var opera11Regex = / line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i;
var lines = stacktrace.split('\n');
var stack = [];
var parts;
for (var line = 0; line < lines.length; line += 2) {
+ // tslint:disable:no-conditional-assignment
var element = null;
if (parts = opera10Regex.exec(lines[line])) {
@@ -12374,7 +12127,7 @@ typeof navigator === "object" && (function () {
function popFrames(stacktrace, popSize) {
try {
- return _assign(_assign({}, stacktrace), {
+ return _assign({}, stacktrace, {
stack: stacktrace.stack.slice(popSize)
});
} catch (e) {
@@ -12386,7 +12139,6 @@ typeof navigator === "object" && (function () {
* https://github.com/getsentry/sentry-javascript/issues/1949
* In this specific case we try to extract stacktrace.message.error.message
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
function extractMessage(ex) {
@@ -12421,7 +12173,8 @@ typeof navigator === "object" && (function () {
exception.stacktrace = {
frames: frames
};
- }
+ } // tslint:disable-next-line:strict-type-predicates
+
if (exception.type === undefined && exception.value === '') {
exception.value = 'Unrecoverable error caught';
@@ -12491,7 +12244,7 @@ typeof navigator === "object" && (function () {
} // The frame where the crash happened, should be the last entry in the array
- return localStack.slice(0, STACKTRACE_LIMIT).map(function (frame) {
+ return localStack.map(function (frame) {
return {
colno: frame.column === null ? undefined : frame.column,
filename: frame.url || localStack[0].url,
@@ -12499,56 +12252,10 @@ typeof navigator === "object" && (function () {
in_app: true,
lineno: frame.line === null ? undefined : frame.line
};
- }).reverse();
+ }).slice(0, STACKTRACE_LIMIT).reverse();
}
- /**
- * Builds and Event from a Exception
- * @hidden
- */
-
- function eventFromException(options, exception, hint) {
- var syntheticException = hint && hint.syntheticException || undefined;
- var event = eventFromUnknownInput(exception, syntheticException, {
- attachStacktrace: options.attachStacktrace
- });
- addExceptionMechanism(event, {
- handled: true,
- type: 'generic'
- });
- event.level = Severity.Error;
-
- if (hint && hint.event_id) {
- event.event_id = hint.event_id;
- }
-
- return SyncPromise.resolve(event);
- }
- /**
- * Builds and Event from a Message
- * @hidden
- */
-
- function eventFromMessage(options, message, level, hint) {
- if (level === void 0) {
- level = Severity.Info;
- }
-
- var syntheticException = hint && hint.syntheticException || undefined;
- var event = eventFromString(message, syntheticException, {
- attachStacktrace: options.attachStacktrace
- });
- event.level = level;
-
- if (hint && hint.event_id) {
- event.event_id = hint.event_id;
- }
-
- return SyncPromise.resolve(event);
- }
- /**
- * @hidden
- */
+ /** JSDoc */
function eventFromUnknownInput(exception, syntheticException, options) {
if (options === void 0) {
@@ -12559,9 +12266,9 @@ typeof navigator === "object" && (function () {
if (isErrorEvent(exception) && exception.error) {
// If it is an ErrorEvent with `error` property, extract it to get actual Error
- var errorEvent = exception; // eslint-disable-next-line no-param-reassign
+ var errorEvent = exception;
+ exception = errorEvent.error; // tslint:disable-line:no-parameter-reassignment
- exception = errorEvent.error;
event = eventFromStacktrace(computeStackTrace(exception));
return event;
}
@@ -12612,10 +12319,9 @@ typeof navigator === "object" && (function () {
synthetic: true
});
return event;
- }
- /**
- * @hidden
- */
+ } // this._options.attachStacktrace
+
+ /** JSDoc */
function eventFromString(input, syntheticException, options) {
if (options === void 0) {
@@ -12647,9 +12353,7 @@ typeof navigator === "object" && (function () {
/** A simple buffer holding all requests. */
this._buffer = new PromiseBuffer(30);
- this._api = new API(this.options.dsn); // eslint-disable-next-line deprecation/deprecation
-
- this.url = this._api.getStoreEndpointWithUrlEncodedAuth();
+ this.url = new API(this.options.dsn).getStoreEndpointWithUrlEncodedAuth();
}
/**
* @inheritDoc
@@ -12703,9 +12407,8 @@ typeof navigator === "object" && (function () {
});
}
- var sentryReq = eventToSentryRequest(event, this._api);
- var options = {
- body: sentryReq.body,
+ var defaultOptions = {
+ body: JSON.stringify(event),
method: 'POST',
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default
// https://caniuse.com/#feat=referrer-policy
@@ -12714,16 +12417,12 @@ typeof navigator === "object" && (function () {
referrerPolicy: supportsReferrerPolicy() ? 'origin' : ''
};
- if (this.options.fetchParameters !== undefined) {
- Object.assign(options, this.options.fetchParameters);
- }
-
if (this.options.headers !== undefined) {
- options.headers = this.options.headers;
+ defaultOptions.headers = this.options.headers;
}
return this._buffer.add(new SyncPromise(function (resolve, reject) {
- global$3.fetch(sentryReq.url, options).then(function (response) {
+ global$3.fetch(_this.url, defaultOptions).then(function (response) {
var status = Status.fromHttpCode(response.status);
if (status === Status.Success) {
@@ -12735,13 +12434,7 @@ typeof navigator === "object" && (function () {
if (status === Status.RateLimit) {
var now = Date.now();
- /**
- * "The name is case-insensitive."
- * https://developer.mozilla.org/en-US/docs/Web/API/Headers/get
- */
-
- var retryAfterHeader = response.headers.get('Retry-After');
- _this._disabledUntil = new Date(now + parseRetryAfterHeader(now, retryAfterHeader));
+ _this._disabledUntil = new Date(now + parseRetryAfterHeader(now, response.headers.get('Retry-After')));
logger.warn("Too many requests, backing off till: " + _this._disabledUntil);
}
@@ -12784,7 +12477,6 @@ typeof navigator === "object" && (function () {
});
}
- var sentryReq = eventToSentryRequest(event, this._api);
return this._buffer.add(new SyncPromise(function (resolve, reject) {
var request = new XMLHttpRequest();
@@ -12804,20 +12496,14 @@ typeof navigator === "object" && (function () {
if (status === Status.RateLimit) {
var now = Date.now();
- /**
- * "The search for the header name is case-insensitive."
- * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getResponseHeader
- */
-
- var retryAfterHeader = request.getResponseHeader('Retry-After');
- _this._disabledUntil = new Date(now + parseRetryAfterHeader(now, retryAfterHeader));
+ _this._disabledUntil = new Date(now + parseRetryAfterHeader(now, request.getResponseHeader('Retry-After')));
logger.warn("Too many requests, backing off till: " + _this._disabledUntil);
}
reject(request);
};
- request.open('POST', sentryReq.url);
+ request.open('POST', _this.url);
for (var header in _this.options.headers) {
if (_this.options.headers.hasOwnProperty(header)) {
@@ -12825,7 +12511,7 @@ typeof navigator === "object" && (function () {
}
}
- request.send(sentryReq.body);
+ request.send(JSON.stringify(event));
}));
};
@@ -12850,8 +12536,47 @@ typeof navigator === "object" && (function () {
*/
+ BrowserBackend.prototype._setupTransport = function () {
+ if (!this._options.dsn) {
+ // We return the noop transport here in case there is no Dsn.
+ return _super.prototype._setupTransport.call(this);
+ }
+
+ var transportOptions = _assign({}, this._options.transportOptions, {
+ dsn: this._options.dsn
+ });
+
+ if (this._options.transport) {
+ return new this._options.transport(transportOptions);
+ }
+
+ if (supportsFetch()) {
+ return new FetchTransport(transportOptions);
+ }
+
+ return new XHRTransport(transportOptions);
+ };
+ /**
+ * @inheritDoc
+ */
+
+
BrowserBackend.prototype.eventFromException = function (exception, hint) {
- return eventFromException(this._options, exception, hint);
+ var syntheticException = hint && hint.syntheticException || undefined;
+ var event = eventFromUnknownInput(exception, syntheticException, {
+ attachStacktrace: this._options.attachStacktrace
+ });
+ addExceptionMechanism(event, {
+ handled: true,
+ type: 'generic'
+ });
+ event.level = Severity.Error;
+
+ if (hint && hint.event_id) {
+ event.event_id = hint.event_id;
+ }
+
+ return SyncPromise.resolve(event);
};
/**
* @inheritDoc
@@ -12863,36 +12588,116 @@ typeof navigator === "object" && (function () {
level = Severity.Info;
}
- return eventFromMessage(this._options, message, level, hint);
+ var syntheticException = hint && hint.syntheticException || undefined;
+ var event = eventFromString(message, syntheticException, {
+ attachStacktrace: this._options.attachStacktrace
+ });
+ event.level = level;
+
+ if (hint && hint.event_id) {
+ event.event_id = hint.event_id;
+ }
+
+ return SyncPromise.resolve(event);
};
+
+ return BrowserBackend;
+ }(BaseBackend);
+
+ var SDK_NAME = 'sentry.javascript.browser';
+ var SDK_VERSION = '5.15.5';
+
+ /**
+ * The Sentry Browser SDK Client.
+ *
+ * @see BrowserOptions for documentation on configuration options.
+ * @see SentryClient for usage documentation.
+ */
+
+ var BrowserClient =
+ /** @class */
+ function (_super) {
+ __extends(BrowserClient, _super);
/**
- * @inheritDoc
+ * Creates a new Browser SDK instance.
+ *
+ * @param options Configuration options for this SDK.
*/
- BrowserBackend.prototype._setupTransport = function () {
- if (!this._options.dsn) {
- // We return the noop transport here in case there is no Dsn.
- return _super.prototype._setupTransport.call(this);
+ function BrowserClient(options) {
+ if (options === void 0) {
+ options = {};
}
- var transportOptions = _assign(_assign({}, this._options.transportOptions), {
- dsn: this._options.dsn
+ return _super.call(this, BrowserBackend, options) || this;
+ }
+ /**
+ * @inheritDoc
+ */
+
+
+ BrowserClient.prototype._prepareEvent = function (event, scope, hint) {
+ event.platform = event.platform || 'javascript';
+ event.sdk = _assign({}, event.sdk, {
+ name: SDK_NAME,
+ packages: __spread(event.sdk && event.sdk.packages || [], [{
+ name: 'npm:@sentry/browser',
+ version: SDK_VERSION
+ }]),
+ version: SDK_VERSION
});
+ return _super.prototype._prepareEvent.call(this, event, scope, hint);
+ };
+ /**
+ * Show a report dialog to the user to send feedback to a specific event.
+ *
+ * @param options Set individual options for the dialog
+ */
- if (this._options.transport) {
- return new this._options.transport(transportOptions);
+
+ BrowserClient.prototype.showReportDialog = function (options) {
+ if (options === void 0) {
+ options = {};
+ } // doesn't work without a document (React Native)
+
+
+ var document = getGlobalObject().document;
+
+ if (!document) {
+ return;
}
- if (supportsFetch()) {
- return new FetchTransport(transportOptions);
+ if (!this._isEnabled()) {
+ logger.error('Trying to call showReportDialog with Sentry Client is disabled');
+ return;
}
- return new XHRTransport(transportOptions);
+ var dsn = options.dsn || this.getDsn();
+
+ if (!options.eventId) {
+ logger.error('Missing `eventId` option in showReportDialog call');
+ return;
+ }
+
+ if (!dsn) {
+ logger.error('Missing `Dsn` option in showReportDialog call');
+ return;
+ }
+
+ var script = document.createElement('script');
+ script.async = true;
+ script.src = new API(dsn).getReportDialogEndpoint(options);
+
+ if (options.onLoad) {
+ script.onload = options.onLoad;
+ }
+
+ (document.head || document.body).appendChild(script);
};
- return BrowserBackend;
- }(BaseBackend);
+ return BrowserClient;
+ }(BaseClient);
var ignoreOnError = 0;
/**
@@ -12925,7 +12730,8 @@ typeof navigator === "object" && (function () {
function wrap$1(fn, options, before) {
if (options === void 0) {
options = {};
- }
+ } // tslint:disable-next-line:strict-type-predicates
+
if (typeof fn !== 'function') {
return fn;
@@ -12947,18 +12753,15 @@ typeof navigator === "object" && (function () {
// Bail on wrapping and return the function as-is (defers to window.onerror).
return fn;
}
- /* eslint-disable prefer-rest-params */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
-
var sentryWrapped = function sentryWrapped() {
- var args = Array.prototype.slice.call(arguments);
+ var args = Array.prototype.slice.call(arguments); // tslint:disable:no-unsafe-any
try {
+ // tslint:disable-next-line:strict-type-predicates
if (before && typeof before === 'function') {
before.apply(this, arguments);
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
-
+ }
var wrappedArguments = args.map(function (arg) {
return wrap$1(arg, options);
@@ -12969,7 +12772,6 @@ typeof navigator === "object" && (function () {
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
// means the sentry.javascript SDK caught an error invoking your application code. This
// is expected behavior and NOT indicative of a bug with sentry.javascript.
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return fn.handleEvent.apply(this, wrappedArguments);
} // Attempt to invoke user-land function
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
@@ -12977,7 +12779,7 @@ typeof navigator === "object" && (function () {
// is expected behavior and NOT indicative of a bug with sentry.javascript.
- return fn.apply(this, wrappedArguments);
+ return fn.apply(this, wrappedArguments); // tslint:enable:no-unsafe-any
} catch (ex) {
ignoreNextOnError();
withScope(function (scope) {
@@ -12989,7 +12791,7 @@ typeof navigator === "object" && (function () {
addExceptionMechanism(processedEvent, options.mechanism);
}
- processedEvent.extra = _assign(_assign({}, processedEvent.extra), {
+ processedEvent.extra = _assign({}, processedEvent.extra, {
arguments: args
});
return processedEvent;
@@ -12998,9 +12800,7 @@ typeof navigator === "object" && (function () {
});
throw ex;
}
- };
- /* eslint-enable prefer-rest-params */
- // Accessing some objects may throw
+ }; // Accessing some objects may throw
// ref: https://github.com/getsentry/sentry-javascript/issues/1168
@@ -13010,7 +12810,7 @@ typeof navigator === "object" && (function () {
sentryWrapped[property] = fn[property];
}
}
- } catch (_oO) {} // eslint-disable-line no-empty
+ } catch (_oO) {} // tslint:disable-line:no-empty
fn.prototype = fn.prototype || {};
@@ -13041,42 +12841,12 @@ typeof navigator === "object" && (function () {
return fn.name;
}
});
- } // eslint-disable-next-line no-empty
-
- } catch (_oO) {}
-
- return sentryWrapped;
- }
- /**
- * Injects the Report Dialog script
- * @hidden
- */
-
- function injectReportDialog(options) {
- if (options === void 0) {
- options = {};
- }
-
- if (!options.eventId) {
- logger.error("Missing eventId option in showReportDialog call");
- return;
- }
-
- if (!options.dsn) {
- logger.error("Missing dsn option in showReportDialog call");
- return;
- }
-
- var script = document.createElement('script');
- script.async = true;
- script.src = new API(options.dsn).getReportDialogEndpoint(options);
-
- if (options.onLoad) {
- // eslint-disable-next-line @typescript-eslint/unbound-method
- script.onload = options.onLoad;
+ }
+ } catch (_oO) {
+ /*no-empty*/
}
- (document.head || document.body).appendChild(script);
+ return sentryWrapped;
}
/** Global handlers */
@@ -13132,7 +12902,6 @@ typeof navigator === "object" && (function () {
}
addInstrumentationHandler({
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
callback: function callback(data) {
var error = data.error;
var currentHub = getCurrentHub();
@@ -13171,7 +12940,6 @@ typeof navigator === "object" && (function () {
}
addInstrumentationHandler({
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
callback: function callback(e) {
var error = e; // dig the object of the rejection out of known event types
@@ -13221,7 +12989,6 @@ typeof navigator === "object" && (function () {
/**
* This function creates a stack from an old, error-less onerror handler.
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
GlobalHandlers.prototype._eventFromIncompleteOnError = function (msg, url, line, column) {
@@ -13252,7 +13019,6 @@ typeof navigator === "object" && (function () {
/**
* This function creates an Event from an TraceKitStackTrace that has part of it missing.
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
GlobalHandlers.prototype._eventFromIncompleteRejection = function (error) {
@@ -13266,7 +13032,6 @@ typeof navigator === "object" && (function () {
};
};
/** JSDoc */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
GlobalHandlers.prototype._enhanceEventWithInitialFrame = function (event, url, line, column) {
@@ -13300,63 +13065,24 @@ typeof navigator === "object" && (function () {
return GlobalHandlers;
}();
- var DEFAULT_EVENT_TARGET = ['EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload'];
/** Wrap timer functions and event targets to catch errors and provide better meta data */
var TryCatch =
/** @class */
function () {
- /**
- * @inheritDoc
- */
- function TryCatch(options) {
+ function TryCatch() {
+ /** JSDoc */
+ this._ignoreOnError = 0;
/**
* @inheritDoc
*/
+
this.name = TryCatch.id;
- this._options = _assign({
- XMLHttpRequest: true,
- eventTarget: true,
- requestAnimationFrame: true,
- setInterval: true,
- setTimeout: true
- }, options);
}
- /**
- * Wrap timer functions and event targets to catch errors
- * and provide better metadata.
- */
-
-
- TryCatch.prototype.setupOnce = function () {
- var global = getGlobalObject();
-
- if (this._options.setTimeout) {
- fill(global, 'setTimeout', this._wrapTimeFunction.bind(this));
- }
-
- if (this._options.setInterval) {
- fill(global, 'setInterval', this._wrapTimeFunction.bind(this));
- }
-
- if (this._options.requestAnimationFrame) {
- fill(global, 'requestAnimationFrame', this._wrapRAF.bind(this));
- }
-
- if (this._options.XMLHttpRequest && 'XMLHttpRequest' in global) {
- fill(XMLHttpRequest.prototype, 'send', this._wrapXHR.bind(this));
- }
-
- if (this._options.eventTarget) {
- var eventTarget = Array.isArray(this._options.eventTarget) ? this._options.eventTarget : DEFAULT_EVENT_TARGET;
- eventTarget.forEach(this._wrapEventTarget.bind(this));
- }
- };
/** JSDoc */
TryCatch.prototype._wrapTimeFunction = function (original) {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
return function () {
var args = [];
@@ -13378,14 +13104,11 @@ typeof navigator === "object" && (function () {
};
};
/** JSDoc */
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
TryCatch.prototype._wrapRAF = function (original) {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
return function (callback) {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- return original.call(this, wrap$1(callback, {
+ return original(wrap$1(callback, {
mechanism: {
data: {
function: 'requestAnimationFrame',
@@ -13401,10 +13124,8 @@ typeof navigator === "object" && (function () {
TryCatch.prototype._wrapEventTarget = function (target) {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- var global = getGlobalObject(); // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
-
- var proto = global[target] && global[target].prototype; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ var global = getGlobalObject();
+ var proto = global[target] && global[target].prototype;
if (!proto || !proto.hasOwnProperty || !proto.hasOwnProperty('addEventListener')) {
return;
@@ -13413,6 +13134,7 @@ typeof navigator === "object" && (function () {
fill(proto, 'addEventListener', function (original) {
return function (eventName, fn, options) {
try {
+ // tslint:disable-next-line:no-unbound-method strict-type-predicates
if (typeof fn.handleEvent === 'function') {
fn.handleEvent = wrap$1(fn.handleEvent.bind(fn), {
mechanism: {
@@ -13429,8 +13151,7 @@ typeof navigator === "object" && (function () {
} catch (err) {// can sometimes get 'Permission denied to access property "handle Event'
}
- return original.call(this, eventName, // eslint-disable-next-line @typescript-eslint/no-explicit-any
- wrap$1(fn, {
+ return original.call(this, eventName, wrap$1(fn, {
mechanism: {
data: {
function: 'addEventListener',
@@ -13445,29 +13166,14 @@ typeof navigator === "object" && (function () {
});
fill(proto, 'removeEventListener', function (original) {
return function (eventName, fn, options) {
- /**
- * There are 2 possible scenarios here:
- *
- * 1. Someone passes a callback, which was attached prior to Sentry initialization, or by using unmodified
- * method, eg. `document.addEventListener.call(el, name, handler). In this case, we treat this function
- * as a pass-through, and call original `removeEventListener` with it.
- *
- * 2. Someone passes a callback, which was attached after Sentry was initialized, which means that it was using
- * our wrapped version of `addEventListener`, which internally calls `wrap` helper.
- * This helper "wraps" whole callback inside a try/catch statement, and attached appropriate metadata to it,
- * in order for us to make a distinction between wrapped/non-wrapped functions possible.
- * If a function was wrapped, it has additional property of `__sentry_wrapped__`, holding the handler.
- *
- * When someone adds a handler prior to initialization, and then do it again, but after,
- * then we have to detach both of them. Otherwise, if we'd detach only wrapped one, it'd be impossible
- * to get rid of the initial handler and it'd stick there forever.
- */
+ var callback = fn;
+
try {
- original.call(this, eventName, fn.__sentry_wrapped__, options);
+ callback = callback && (callback.__sentry_wrapped__ || callback);
} catch (e) {// ignore, accessing __sentry_wrapped__ will throw in some Selenium environments
}
- return original.call(this, eventName, fn, options);
+ return original.call(this, eventName, callback, options);
};
});
};
@@ -13475,20 +13181,18 @@ typeof navigator === "object" && (function () {
TryCatch.prototype._wrapXHR = function (originalSend) {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
- } // eslint-disable-next-line @typescript-eslint/no-this-alias
+ }
+ var xhr = this; // tslint:disable-line:no-this-assignment
- var xhr = this;
var xmlHttpRequestProps = ['onload', 'onerror', 'onprogress', 'onreadystatechange'];
xmlHttpRequestProps.forEach(function (prop) {
if (prop in xhr && typeof xhr[prop] === 'function') {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
fill(xhr, prop, function (original) {
var wrapOptions = {
mechanism: {
@@ -13514,6 +13218,25 @@ typeof navigator === "object" && (function () {
};
};
/**
+ * Wrap timer functions and event targets to catch errors
+ * and provide better metadata.
+ */
+
+
+ TryCatch.prototype.setupOnce = function () {
+ this._ignoreOnError = this._ignoreOnError;
+ var global = getGlobalObject();
+ fill(global, 'setTimeout', this._wrapTimeFunction.bind(this));
+ fill(global, 'setInterval', this._wrapTimeFunction.bind(this));
+ fill(global, 'requestAnimationFrame', this._wrapRAF.bind(this));
+
+ if ('XMLHttpRequest' in global) {
+ fill(XMLHttpRequest.prototype, 'send', this._wrapXHR.bind(this));
+ }
+
+ ['EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload'].forEach(this._wrapEventTarget.bind(this));
+ };
+ /**
* @inheritDoc
*/
@@ -13548,116 +13271,8 @@ typeof navigator === "object" && (function () {
}, options);
}
/**
- * Create a breadcrumb of `sentry` from the events themselves
- */
-
-
- Breadcrumbs.prototype.addSentryBreadcrumb = function (event) {
- if (!this._options.sentry) {
- return;
- }
-
- getCurrentHub().addBreadcrumb({
- category: "sentry." + (event.type === 'transaction' ? 'transaction' : 'event'),
- event_id: event.event_id,
- level: event.level,
- message: getEventDescription(event)
- }, {
- event: event
- });
- };
- /**
- * Instrument browser built-ins w/ breadcrumb capturing
- * - Console API
- * - DOM API (click/typing)
- * - XMLHttpRequest API
- * - Fetch API
- * - History API
- */
-
-
- Breadcrumbs.prototype.setupOnce = function () {
- var _this = this;
-
- if (this._options.console) {
- addInstrumentationHandler({
- callback: function callback() {
- var args = [];
-
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
-
- _this._consoleBreadcrumb.apply(_this, __spread(args));
- },
- type: 'console'
- });
- }
-
- if (this._options.dom) {
- addInstrumentationHandler({
- callback: function callback() {
- var args = [];
-
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
-
- _this._domBreadcrumb.apply(_this, __spread(args));
- },
- type: 'dom'
- });
- }
-
- if (this._options.xhr) {
- addInstrumentationHandler({
- callback: function callback() {
- var args = [];
-
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
-
- _this._xhrBreadcrumb.apply(_this, __spread(args));
- },
- type: 'xhr'
- });
- }
-
- if (this._options.fetch) {
- addInstrumentationHandler({
- callback: function callback() {
- var args = [];
-
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
-
- _this._fetchBreadcrumb.apply(_this, __spread(args));
- },
- type: 'fetch'
- });
- }
-
- if (this._options.history) {
- addInstrumentationHandler({
- callback: function callback() {
- var args = [];
-
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
-
- _this._historyBreadcrumb.apply(_this, __spread(args));
- },
- type: 'history'
- });
- }
- };
- /**
* Creates breadcrumbs from console API calls
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
Breadcrumbs.prototype._consoleBreadcrumb = function (handlerData) {
@@ -13689,7 +13304,6 @@ typeof navigator === "object" && (function () {
/**
* Creates breadcrumbs from DOM API calls
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
Breadcrumbs.prototype._domBreadcrumb = function (handlerData) {
@@ -13716,7 +13330,6 @@ typeof navigator === "object" && (function () {
/**
* Creates breadcrumbs from XHR API calls
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
Breadcrumbs.prototype._xhrBreadcrumb = function (handlerData) {
@@ -13734,12 +13347,16 @@ typeof navigator === "object" && (function () {
xhr: handlerData.xhr
});
return;
+ } // We only capture issued sentry requests
+
+
+ if (this._options.sentry && handlerData.xhr.__sentry_own_request__) {
+ addSentryBreadcrumb(handlerData.args[0]);
}
};
/**
* Creates breadcrumbs from fetch API calls
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
Breadcrumbs.prototype._fetchBreadcrumb = function (handlerData) {
@@ -13748,15 +13365,25 @@ typeof navigator === "object" && (function () {
return;
}
- if (handlerData.fetchData.url.match(/sentry_key/) && handlerData.fetchData.method === 'POST') {
- // We will not create breadcrumbs for fetch requests that contain `sentry_key` (internal sentry requests)
- return;
+ var client = getCurrentHub().getClient();
+ var dsn = client && client.getDsn();
+
+ if (this._options.sentry && dsn) {
+ var filterUrl = new API(dsn).getStoreEndpoint(); // if Sentry key appears in URL, don't capture it as a request
+ // but rather as our own 'sentry' type breadcrumb
+
+ if (filterUrl && handlerData.fetchData.url.indexOf(filterUrl) !== -1 && handlerData.fetchData.method === 'POST' && handlerData.args[1] && handlerData.args[1].body) {
+ addSentryBreadcrumb(handlerData.args[1].body);
+ return;
+ }
}
if (handlerData.error) {
getCurrentHub().addBreadcrumb({
category: 'fetch',
- data: handlerData.fetchData,
+ data: _assign({}, handlerData.fetchData, {
+ status_code: handlerData.response.status
+ }),
level: Severity.Error,
type: 'http'
}, {
@@ -13766,7 +13393,7 @@ typeof navigator === "object" && (function () {
} else {
getCurrentHub().addBreadcrumb({
category: 'fetch',
- data: _assign(_assign({}, handlerData.fetchData), {
+ data: _assign({}, handlerData.fetchData, {
status_code: handlerData.response.status
}),
type: 'http'
@@ -13779,7 +13406,6 @@ typeof navigator === "object" && (function () {
/**
* Creates breadcrumbs from history API calls
*/
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
Breadcrumbs.prototype._historyBreadcrumb = function (handlerData) {
@@ -13797,10 +13423,12 @@ typeof navigator === "object" && (function () {
if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) {
+ // tslint:disable-next-line:no-parameter-reassignment
to = parsedTo.relative;
}
if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) {
+ // tslint:disable-next-line:no-parameter-reassignment
from = parsedFrom.relative;
}
@@ -13813,6 +13441,94 @@ typeof navigator === "object" && (function () {
});
};
/**
+ * Instrument browser built-ins w/ breadcrumb capturing
+ * - Console API
+ * - DOM API (click/typing)
+ * - XMLHttpRequest API
+ * - Fetch API
+ * - History API
+ */
+
+
+ Breadcrumbs.prototype.setupOnce = function () {
+ var _this = this;
+
+ if (this._options.console) {
+ addInstrumentationHandler({
+ callback: function callback() {
+ var args = [];
+
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+
+ _this._consoleBreadcrumb.apply(_this, __spread(args));
+ },
+ type: 'console'
+ });
+ }
+
+ if (this._options.dom) {
+ addInstrumentationHandler({
+ callback: function callback() {
+ var args = [];
+
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+
+ _this._domBreadcrumb.apply(_this, __spread(args));
+ },
+ type: 'dom'
+ });
+ }
+
+ if (this._options.xhr) {
+ addInstrumentationHandler({
+ callback: function callback() {
+ var args = [];
+
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+
+ _this._xhrBreadcrumb.apply(_this, __spread(args));
+ },
+ type: 'xhr'
+ });
+ }
+
+ if (this._options.fetch) {
+ addInstrumentationHandler({
+ callback: function callback() {
+ var args = [];
+
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+
+ _this._fetchBreadcrumb.apply(_this, __spread(args));
+ },
+ type: 'fetch'
+ });
+ }
+
+ if (this._options.history) {
+ addInstrumentationHandler({
+ callback: function callback() {
+ var args = [];
+
+ for (var _i = 0; _i < arguments.length; _i++) {
+ args[_i] = arguments[_i];
+ }
+
+ _this._historyBreadcrumb.apply(_this, __spread(args));
+ },
+ type: 'history'
+ });
+ }
+ };
+ /**
* @inheritDoc
*/
@@ -13820,6 +13536,26 @@ typeof navigator === "object" && (function () {
Breadcrumbs.id = 'Breadcrumbs';
return Breadcrumbs;
}();
+ /**
+ * Create a breadcrumb of `sentry` from the events themselves
+ */
+
+ function addSentryBreadcrumb(serializedData) {
+ // There's always something that can go wrong with deserialization...
+ try {
+ var event_1 = JSON.parse(serializedData);
+ getCurrentHub().addBreadcrumb({
+ category: "sentry." + (event_1.type === 'transaction' ? 'transaction' : 'event'),
+ event_id: event_1.event_id,
+ level: event_1.level || Severity.fromString('error'),
+ message: getEventDescription(event_1)
+ }, {
+ event: event_1
+ });
+ } catch (_oO) {
+ logger.error('Error while adding sentry type breadcrumb');
+ }
+ }
var DEFAULT_KEY = 'cause';
var DEFAULT_LIMIT = 5;
@@ -13924,13 +13660,14 @@ typeof navigator === "object" && (function () {
if (getCurrentHub().getIntegration(UserAgent)) {
if (!global$4.navigator || !global$4.location) {
return event;
- }
+ } // Request Interface: https://docs.sentry.io/development/sdk-dev/event-payloads/request/
+
var request = event.request || {};
request.url = request.url || global$4.location.href;
request.headers = request.headers || {};
request.headers['User-Agent'] = global$4.navigator.userAgent;
- return _assign(_assign({}, event), {
+ return _assign({}, event, {
request: request
});
}
@@ -13947,97 +13684,6 @@ typeof navigator === "object" && (function () {
return UserAgent;
}();
- var SDK_NAME = 'sentry.javascript.browser';
- var SDK_VERSION = '5.22.3';
-
- /**
- * The Sentry Browser SDK Client.
- *
- * @see BrowserOptions for documentation on configuration options.
- * @see SentryClient for usage documentation.
- */
-
- var BrowserClient =
- /** @class */
- function (_super) {
- __extends(BrowserClient, _super);
- /**
- * Creates a new Browser SDK instance.
- *
- * @param options Configuration options for this SDK.
- */
-
-
- function BrowserClient(options) {
- if (options === void 0) {
- options = {};
- }
-
- return _super.call(this, BrowserBackend, options) || this;
- }
- /**
- * Show a report dialog to the user to send feedback to a specific event.
- *
- * @param options Set individual options for the dialog
- */
-
-
- BrowserClient.prototype.showReportDialog = function (options) {
- if (options === void 0) {
- options = {};
- } // doesn't work without a document (React Native)
-
-
- var document = getGlobalObject().document;
-
- if (!document) {
- return;
- }
-
- if (!this._isEnabled()) {
- logger.error('Trying to call showReportDialog with Sentry Client disabled');
- return;
- }
-
- injectReportDialog(_assign(_assign({}, options), {
- dsn: options.dsn || this.getDsn()
- }));
- };
- /**
- * @inheritDoc
- */
-
-
- BrowserClient.prototype._prepareEvent = function (event, scope, hint) {
- event.platform = event.platform || 'javascript';
- event.sdk = _assign(_assign({}, event.sdk), {
- name: SDK_NAME,
- packages: __spread(event.sdk && event.sdk.packages || [], [{
- name: 'npm:@sentry/browser',
- version: SDK_VERSION
- }]),
- version: SDK_VERSION
- });
- return _super.prototype._prepareEvent.call(this, event, scope, hint);
- };
- /**
- * @inheritDoc
- */
-
-
- BrowserClient.prototype._sendEvent = function (event) {
- var integration = this.getIntegration(Breadcrumbs);
-
- if (integration) {
- integration.addSentryBreadcrumb(event);
- }
-
- _super.prototype._sendEvent.call(this, event);
- };
-
- return BrowserClient;
- }(BaseClient);
-
var defaultIntegrations = [new InboundFilters(), new FunctionToString(), new TryCatch(), new Breadcrumbs(), new GlobalHandlers(), new LinkedErrors(), new UserAgent()];
/**
* The Sentry Browser SDK Client.
@@ -14817,7 +14463,7 @@ typeof navigator === "object" && (function () {
check$1(typeof self == 'object' && self) ||
check$1(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
// eslint-disable-next-line no-new-func
- Function('return this')();
+ (function () { return this; })() || Function('return this')();
var fails$1 = function (exec) {
try {
@@ -15012,7 +14658,7 @@ typeof navigator === "object" && (function () {
(module.exports = function (key, value) {
return sharedStore$1[key] || (sharedStore$1[key] = value !== undefined ? value : {});
})('versions', []).push({
- version: '3.6.5',
+ version: '3.7.0',
mode: 'global',
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
});
@@ -15050,11 +14696,12 @@ typeof navigator === "object" && (function () {
};
if (nativeWeakMap$1) {
- var store$3 = new WeakMap$4();
+ var store$3 = sharedStore$1.state || (sharedStore$1.state = new WeakMap$4());
var wmget$1 = store$3.get;
var wmhas$1 = store$3.has;
var wmset$1 = store$3.set;
set$3 = function (it, metadata) {
+ metadata.facade = it;
wmset$1.call(store$3, it, metadata);
return metadata;
};
@@ -15068,6 +14715,7 @@ typeof navigator === "object" && (function () {
var STATE$1 = sharedKey$1('state');
hiddenKeys$2[STATE$1] = true;
set$3 = function (it, metadata) {
+ metadata.facade = it;
createNonEnumerableProperty$1(it, STATE$1, metadata);
return metadata;
};
@@ -15096,9 +14744,15 @@ typeof navigator === "object" && (function () {
var unsafe = options ? !!options.unsafe : false;
var simple = options ? !!options.enumerable : false;
var noTargetGet = options ? !!options.noTargetGet : false;
+ var state;
if (typeof value == 'function') {
- if (typeof key == 'string' && !has$2(value, 'name')) createNonEnumerableProperty$1(value, 'name', key);
- enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
+ if (typeof key == 'string' && !has$2(value, 'name')) {
+ createNonEnumerableProperty$1(value, 'name', key);
+ }
+ state = enforceInternalState(value);
+ if (!state.source) {
+ state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
+ }
}
if (O === global_1$1) {
if (simple) O[key] = value;
@@ -15724,14 +15378,20 @@ typeof navigator === "object" && (function () {
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
addToUnscopables$1(FIND$1);
+ var iteratorClose = function (iterator) {
+ var returnMethod = iterator['return'];
+ if (returnMethod !== undefined) {
+ return anObject$1(returnMethod.call(iterator)).value;
+ }
+ };
+
// call something on iterator step with safe closing on error
var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) {
try {
return ENTRIES ? fn(anObject$1(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch (error) {
- var returnMethod = iterator['return'];
- if (returnMethod !== undefined) anObject$1(returnMethod.call(iterator));
+ iteratorClose(iterator);
throw error;
}
};
@@ -16452,11 +16112,11 @@ typeof navigator === "object" && (function () {
var regexp = /./;
try {
'/./'[METHOD_NAME](regexp);
- } catch (e) {
+ } catch (error1) {
try {
regexp[MATCH$4] = false;
return '/./'[METHOD_NAME](regexp);
- } catch (f) { /* empty */ }
+ } catch (error2) { /* empty */ }
} return false;
};
@@ -16776,16 +16436,31 @@ typeof navigator === "object" && (function () {
var internalMetadata_3$1 = internalMetadata$1.getWeakData;
var internalMetadata_4$1 = internalMetadata$1.onFreeze;
- var iterate_1$1 = createCommonjsModule(function (module) {
var Result = function (stopped, result) {
this.stopped = stopped;
this.result = result;
};
- var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) {
- var boundFunction = functionBindContext$1(fn, that, AS_ENTRIES ? 2 : 1);
+ var iterate = function (iterable, unboundFunction, options) {
+ var that = options && options.that;
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
+ var fn = functionBindContext$1(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
var iterator, iterFn, index, length, result, next, step;
+ var stop = function (condition) {
+ if (iterator) iteratorClose(iterator);
+ return new Result(true, condition);
+ };
+
+ var callFn = function (value) {
+ if (AS_ENTRIES) {
+ anObject$1(value);
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
+ };
+
if (IS_ITERATOR) {
iterator = iterable;
} else {
@@ -16794,9 +16469,7 @@ typeof navigator === "object" && (function () {
// optimisation for array iterators
if (isArrayIteratorMethod$1(iterFn)) {
for (index = 0, length = toLength$1(iterable.length); length > index; index++) {
- result = AS_ENTRIES
- ? boundFunction(anObject$1(step = iterable[index])[0], step[1])
- : boundFunction(iterable[index]);
+ result = callFn(iterable[index]);
if (result && result instanceof Result) return result;
} return new Result(false);
}
@@ -16805,16 +16478,16 @@ typeof navigator === "object" && (function () {
next = iterator.next;
while (!(step = next.call(iterator)).done) {
- result = callWithSafeIterationClosing$1(iterator, boundFunction, step.value, AS_ENTRIES);
+ try {
+ result = callFn(step.value);
+ } catch (error) {
+ iteratorClose(iterator);
+ throw error;
+ }
if (typeof result == 'object' && result && result instanceof Result) return result;
} return new Result(false);
};
- iterate.stop = function (result) {
- return new Result(true, result);
- };
- });
-
var anInstance$1 = function (it, Constructor, name) {
if (!(it instanceof Constructor)) {
throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
@@ -16878,7 +16551,7 @@ typeof navigator === "object" && (function () {
Constructor = wrapper(function (dummy, iterable) {
anInstance$1(dummy, Constructor, CONSTRUCTOR_NAME);
var that = inheritIfRequired$1(new NativeConstructor(), dummy, Constructor);
- if (iterable != undefined) iterate_1$1(iterable, that[ADDER], that, IS_MAP);
+ if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
return that;
});
Constructor.prototype = NativePrototype;
@@ -16968,7 +16641,7 @@ typeof navigator === "object" && (function () {
id: id$3++,
frozen: undefined
});
- if (iterable != undefined) iterate_1$1(iterable, that[ADDER], that, IS_MAP);
+ if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
});
var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
@@ -17806,7 +17479,7 @@ typeof navigator === "object" && (function () {
var URLSearchParamsPrototype$1 = URLSearchParamsConstructor$1.prototype;
redefineAll$1(URLSearchParamsPrototype$1, {
- // `URLSearchParams.prototype.appent` method
+ // `URLSearchParams.prototype.append` method
// https://url.spec.whatwg.org/#dom-urlsearchparams-append
append: function append(name, value) {
validateArgumentsLength$1(arguments.length, 2);
@@ -19959,6 +19632,8 @@ typeof navigator === "object" && (function () {
var engineIsIos$1 = /(iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent$1);
+ var engineIsNode = classofRaw$1(global_1$1.process) == 'process';
+
var location$1 = global_1$1.location;
var set$4 = global_1$1.setImmediate;
var clear$1 = global_1$1.clearImmediate;
@@ -20011,7 +19686,7 @@ typeof navigator === "object" && (function () {
delete queue$1[id];
};
// Node.js 0.8-
- if (classofRaw$1(process$6) == 'process') {
+ if (engineIsNode) {
defer$1 = function (id) {
process$6.nextTick(runner$1(id));
};
@@ -20033,8 +19708,8 @@ typeof navigator === "object" && (function () {
global_1$1.addEventListener &&
typeof postMessage == 'function' &&
!global_1$1.importScripts &&
- !fails$1(post$1) &&
- location$1.protocol !== 'file:'
+ location$1 && location$1.protocol !== 'file:' &&
+ !fails$1(post$1)
) {
defer$1 = post$1;
global_1$1.addEventListener('message', listener$1, false);
@@ -20060,14 +19735,14 @@ typeof navigator === "object" && (function () {
};
var getOwnPropertyDescriptor$7 = objectGetOwnPropertyDescriptor$1.f;
-
var macrotask$1 = task$2.set;
+
var MutationObserver$2 = global_1$1.MutationObserver || global_1$1.WebKitMutationObserver;
+ var document$4 = global_1$1.document;
var process$7 = global_1$1.process;
var Promise$2 = global_1$1.Promise;
- var IS_NODE$2 = classofRaw$1(process$7) == 'process';
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
var queueMicrotaskDescriptor$1 = getOwnPropertyDescriptor$7(global_1$1, 'queueMicrotask');
var queueMicrotask$1 = queueMicrotaskDescriptor$1 && queueMicrotaskDescriptor$1.value;
@@ -20078,7 +19753,7 @@ typeof navigator === "object" && (function () {
if (!queueMicrotask$1) {
flush$1 = function () {
var parent, fn;
- if (IS_NODE$2 && (parent = process$7.domain)) parent.exit();
+ if (engineIsNode && (parent = process$7.domain)) parent.exit();
while (head$1) {
fn = head$1.fn;
head$1 = head$1.next;
@@ -20093,15 +19768,10 @@ typeof navigator === "object" && (function () {
if (parent) parent.enter();
};
- // Node.js
- if (IS_NODE$2) {
- notify$2 = function () {
- process$7.nextTick(flush$1);
- };
// browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
- } else if (MutationObserver$2 && !engineIsIos$1) {
+ if (!engineIsIos$1 && !engineIsNode && MutationObserver$2 && document$4) {
toggle$1 = true;
- node$1 = document.createTextNode('');
+ node$1 = document$4.createTextNode('');
new MutationObserver$2(flush$1).observe(node$1, { characterData: true });
notify$2 = function () {
node$1.data = toggle$1 = !toggle$1;
@@ -20114,6 +19784,11 @@ typeof navigator === "object" && (function () {
notify$2 = function () {
then$1.call(promise$1, flush$1);
};
+ // Node.js without promises
+ } else if (engineIsNode) {
+ notify$2 = function () {
+ process$7.nextTick(flush$1);
+ };
// for other environments - macrotask based on:
// - setImmediate
// - MessageChannel
@@ -20192,6 +19867,7 @@ typeof navigator === "object" && (function () {
+
var SPECIES$c = wellKnownSymbol$1('species');
var PROMISE$1 = 'Promise';
var getInternalState$8 = internalState$1.get;
@@ -20199,13 +19875,13 @@ typeof navigator === "object" && (function () {
var getInternalPromiseState$1 = internalState$1.getterFor(PROMISE$1);
var PromiseConstructor$1 = nativePromiseConstructor$1;
var TypeError$2 = global_1$1.TypeError;
- var document$4 = global_1$1.document;
+ var document$5 = global_1$1.document;
var process$8 = global_1$1.process;
var $fetch$3 = getBuiltIn$1('fetch');
var newPromiseCapability$3 = newPromiseCapability$2.f;
var newGenericPromiseCapability$1 = newPromiseCapability$3;
- var IS_NODE$3 = classofRaw$1(process$8) == 'process';
- var DISPATCH_EVENT$1 = !!(document$4 && document$4.createEvent && global_1$1.dispatchEvent);
+ var DISPATCH_EVENT$1 = !!(document$5 && document$5.createEvent && global_1$1.dispatchEvent);
+ var NATIVE_REJECTION_EVENT = typeof PromiseRejectionEvent == 'function';
var UNHANDLED_REJECTION$1 = 'unhandledrejection';
var REJECTION_HANDLED$1 = 'rejectionhandled';
var PENDING$1 = 0;
@@ -20223,7 +19899,7 @@ typeof navigator === "object" && (function () {
// We can't detect it synchronously, so just check versions
if (engineV8Version$1 === 66) return true;
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
- if (!IS_NODE$3 && typeof PromiseRejectionEvent != 'function') return true;
+ if (!engineIsNode && !NATIVE_REJECTION_EVENT) return true;
}
// We can't use @@species feature detection in V8 since it causes
// deoptimization and performance degradation
@@ -20249,7 +19925,7 @@ typeof navigator === "object" && (function () {
return isObject$2(it) && typeof (then = it.then) == 'function' ? then : false;
};
- var notify$3 = function (promise, state, isReject) {
+ var notify$3 = function (state, isReject) {
if (state.notified) return;
state.notified = true;
var chain = state.reactions;
@@ -20268,7 +19944,7 @@ typeof navigator === "object" && (function () {
try {
if (handler) {
if (!ok) {
- if (state.rejection === UNHANDLED$1) onHandleUnhandled$1(promise, state);
+ if (state.rejection === UNHANDLED$1) onHandleUnhandled$1(state);
state.rejection = HANDLED$1;
}
if (handler === true) result = value;
@@ -20293,36 +19969,37 @@ typeof navigator === "object" && (function () {
}
state.reactions = [];
state.notified = false;
- if (isReject && !state.rejection) onUnhandled$1(promise, state);
+ if (isReject && !state.rejection) onUnhandled$1(state);
});
};
var dispatchEvent$1 = function (name, promise, reason) {
var event, handler;
if (DISPATCH_EVENT$1) {
- event = document$4.createEvent('Event');
+ event = document$5.createEvent('Event');
event.promise = promise;
event.reason = reason;
event.initEvent(name, false, true);
global_1$1.dispatchEvent(event);
} else event = { promise: promise, reason: reason };
- if (handler = global_1$1['on' + name]) handler(event);
+ if (!NATIVE_REJECTION_EVENT && (handler = global_1$1['on' + name])) handler(event);
else if (name === UNHANDLED_REJECTION$1) hostReportErrors$1('Unhandled promise rejection', reason);
};
- var onUnhandled$1 = function (promise, state) {
+ var onUnhandled$1 = function (state) {
task$3.call(global_1$1, function () {
+ var promise = state.facade;
var value = state.value;
var IS_UNHANDLED = isUnhandled$1(state);
var result;
if (IS_UNHANDLED) {
result = perform$1(function () {
- if (IS_NODE$3) {
+ if (engineIsNode) {
process$8.emit('unhandledRejection', value, promise);
} else dispatchEvent$1(UNHANDLED_REJECTION$1, promise, value);
});
// Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
- state.rejection = IS_NODE$3 || isUnhandled$1(state) ? UNHANDLED$1 : HANDLED$1;
+ state.rejection = engineIsNode || isUnhandled$1(state) ? UNHANDLED$1 : HANDLED$1;
if (result.error) throw result.value;
}
});
@@ -20332,55 +20009,56 @@ typeof navigator === "object" && (function () {
return state.rejection !== HANDLED$1 && !state.parent;
};
- var onHandleUnhandled$1 = function (promise, state) {
+ var onHandleUnhandled$1 = function (state) {
task$3.call(global_1$1, function () {
- if (IS_NODE$3) {
+ var promise = state.facade;
+ if (engineIsNode) {
process$8.emit('rejectionHandled', promise);
} else dispatchEvent$1(REJECTION_HANDLED$1, promise, state.value);
});
};
- var bind$1 = function (fn, promise, state, unwrap) {
+ var bind$1 = function (fn, state, unwrap) {
return function (value) {
- fn(promise, state, value, unwrap);
+ fn(state, value, unwrap);
};
};
- var internalReject$1 = function (promise, state, value, unwrap) {
+ var internalReject$1 = function (state, value, unwrap) {
if (state.done) return;
state.done = true;
if (unwrap) state = unwrap;
state.value = value;
state.state = REJECTED$1;
- notify$3(promise, state, true);
+ notify$3(state, true);
};
- var internalResolve$1 = function (promise, state, value, unwrap) {
+ var internalResolve$1 = function (state, value, unwrap) {
if (state.done) return;
state.done = true;
if (unwrap) state = unwrap;
try {
- if (promise === value) throw TypeError$2("Promise can't be resolved itself");
+ if (state.facade === value) throw TypeError$2("Promise can't be resolved itself");
var then = isThenable$2(value);
if (then) {
microtask$1(function () {
var wrapper = { done: false };
try {
then.call(value,
- bind$1(internalResolve$1, promise, wrapper, state),
- bind$1(internalReject$1, promise, wrapper, state)
+ bind$1(internalResolve$1, wrapper, state),
+ bind$1(internalReject$1, wrapper, state)
);
} catch (error) {
- internalReject$1(promise, wrapper, error, state);
+ internalReject$1(wrapper, error, state);
}
});
} else {
state.value = value;
state.state = FULFILLED$1;
- notify$3(promise, state, false);
+ notify$3(state, false);
}
} catch (error) {
- internalReject$1(promise, { done: false }, error, state);
+ internalReject$1({ done: false }, error, state);
}
};
@@ -20393,9 +20071,9 @@ typeof navigator === "object" && (function () {
Internal$1.call(this);
var state = getInternalState$8(this);
try {
- executor(bind$1(internalResolve$1, this, state), bind$1(internalReject$1, this, state));
+ executor(bind$1(internalResolve$1, state), bind$1(internalReject$1, state));
} catch (error) {
- internalReject$1(this, state, error);
+ internalReject$1(state, error);
}
};
// eslint-disable-next-line no-unused-vars
@@ -20419,10 +20097,10 @@ typeof navigator === "object" && (function () {
var reaction = newPromiseCapability$3(speciesConstructor$1(this, PromiseConstructor$1));
reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
reaction.fail = typeof onRejected == 'function' && onRejected;
- reaction.domain = IS_NODE$3 ? process$8.domain : undefined;
+ reaction.domain = engineIsNode ? process$8.domain : undefined;
state.parent = true;
state.reactions.push(reaction);
- if (state.state != PENDING$1) notify$3(this, state, false);
+ if (state.state != PENDING$1) notify$3(state, false);
return reaction.promise;
},
// `Promise.prototype.catch` method
@@ -20435,8 +20113,8 @@ typeof navigator === "object" && (function () {
var promise = new Internal$1();
var state = getInternalState$8(promise);
this.promise = promise;
- this.resolve = bind$1(internalResolve$1, promise, state);
- this.reject = bind$1(internalReject$1, promise, state);
+ this.resolve = bind$1(internalResolve$1, state);
+ this.reject = bind$1(internalReject$1, state);
};
newPromiseCapability$2.f = newPromiseCapability$3 = function (C) {
return C === PromiseConstructor$1 || C === PromiseWrapper$1
@@ -20507,7 +20185,7 @@ typeof navigator === "object" && (function () {
var values = [];
var counter = 0;
var remaining = 1;
- iterate_1$1(iterable, function (promise) {
+ iterate(iterable, function (promise) {
var index = counter++;
var alreadyCalled = false;
values.push(undefined);
@@ -20532,7 +20210,7 @@ typeof navigator === "object" && (function () {
var reject = capability.reject;
var result = perform$1(function () {
var $promiseResolve = aFunction$3(C.resolve);
- iterate_1$1(iterable, function (promise) {
+ iterate(iterable, function (promise) {
$promiseResolve.call(C, promise).then(capability.resolve, reject);
});
});
@@ -20779,12 +20457,17 @@ typeof navigator === "object" && (function () {
+
+
var STRICT_METHOD$a = arrayMethodIsStrict$1('reduce');
var USES_TO_LENGTH$i = arrayMethodUsesToLength$1('reduce', { 1: 0 });
+ // Chrome 80-82 has a critical bug
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
+ var CHROME_BUG = !engineIsNode && engineV8Version$1 > 79 && engineV8Version$1 < 83;
// `Array.prototype.reduce` method
// https://tc39.github.io/ecma262/#sec-array.prototype.reduce
- _export$1({ target: 'Array', proto: true, forced: !STRICT_METHOD$a || !USES_TO_LENGTH$i }, {
+ _export$1({ target: 'Array', proto: true, forced: !STRICT_METHOD$a || !USES_TO_LENGTH$i || CHROME_BUG }, {
reduce: function reduce(callbackfn /* , initialValue */) {
return $reduce$1(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
}
@@ -24003,7 +23686,7 @@ typeof navigator === "object" && (function () {
// Sprite (for icons)
loadSprite: true,
iconPrefix: 'plyr',
- iconUrl: 'https://cdn.plyr.io/3.6.2/plyr.svg',
+ iconUrl: 'https://cdn.plyr.io/3.6.3/plyr.svg',
// Blank video (used to prevent errors on source change)
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
// Quality default
@@ -24121,7 +23804,7 @@ typeof navigator === "object" && (function () {
vimeo: {
sdk: 'https://player.vimeo.com/api/player.js',
iframe: 'https://player.vimeo.com/video/{0}?{1}',
- api: 'https://vimeo.com/api/v2/video/{0}.json'
+ api: 'https://vimeo.com/api/oembed.json?url={0}'
},
youtube: {
sdk: 'https://www.youtube.com/iframe_api',
@@ -24291,24 +23974,27 @@ typeof navigator === "object" && (function () {
title: false,
speed: true,
transparent: false,
+ // Custom settings from Plyr
+ customControls: true,
+ referrerPolicy: null,
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
// Whether the owner of the video has a Pro or Business account
// (which allows us to properly hide controls without CSS hacks, etc)
- premium: false,
- // Custom settings from Plyr
- referrerPolicy: null // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
-
+ premium: false
},
// YouTube plugin
youtube: {
- noCookie: true,
- // Whether to use an alternative version of YouTube without cookies
rel: 0,
// No related vids
showinfo: 0,
// Hide info
iv_load_policy: 3,
// Hide annotations
- modestbranding: 1 // Hide logos as much as possible (they still show one in the corner when paused)
+ modestbranding: 1,
+ // Hide logos as much as possible (they still show one in the corner when paused)
+ // Custom settings from Plyr
+ customControls: true,
+ noCookie: false // Whether to use an alternative version of YouTube without cookies
}
};
@@ -24427,7 +24113,7 @@ typeof navigator === "object" && (function () {
return;
}
- _this.toggle();
+ _this.player.listeners.proxy(event, _this.toggle, 'fullscreen');
}); // Tap focus when in fullscreen
on.call(this, this.player.elements.container, 'keydown', function (event) {
@@ -24850,7 +24536,9 @@ typeof navigator === "object" && (function () {
} // Set property synchronously to respect the call order
- this.media.setAttribute('data-poster', poster); // Wait until ui is ready
+ this.media.setAttribute('data-poster', poster); // Show the poster
+
+ this.elements.poster.removeAttribute('hidden'); // Wait until ui is ready
return ready.call(this) // Load image
.then(function () {
@@ -25282,7 +24970,14 @@ typeof navigator === "object" && (function () {
ratio = _setPlayerSize.ratio; // Set Vimeo gutter
- setGutter(ratio, padding, isEnter); // If not using native browser fullscreen API, we need to check for resizes of viewport
+ setGutter(ratio, padding, isEnter); // Horrible hack for Safari 14 not repainting properly on entering fullscreen
+
+ if (isEnter) {
+ setTimeout(function () {
+ return repaint(elements.container);
+ }, 100);
+ } // If not using native browser fullscreen API, we need to check for resizes of viewport
+
if (!usingNative) {
if (isEnter) {
@@ -25473,9 +25168,17 @@ typeof navigator === "object" && (function () {
this.bind(elements.buttons.restart, 'click', player.restart, 'restart'); // Rewind
- this.bind(elements.buttons.rewind, 'click', player.rewind, 'rewind'); // Rewind
+ this.bind(elements.buttons.rewind, 'click', function () {
+ // Record seek time so we can prevent hiding controls for a few seconds after rewind
+ player.lastSeekTime = Date.now();
+ player.rewind();
+ }, 'rewind'); // Rewind
- this.bind(elements.buttons.fastForward, 'click', player.forward, 'fastForward'); // Mute toggle
+ this.bind(elements.buttons.fastForward, 'click', function () {
+ // Record seek time so we can prevent hiding controls for a few seconds after fast forward
+ player.lastSeekTime = Date.now();
+ player.forward();
+ }, 'fastForward'); // Mute toggle
this.bind(elements.buttons.mute, 'click', function () {
player.muted = !player.muted;
@@ -26183,35 +25886,32 @@ typeof navigator === "object" && (function () {
} // Inject the package
- var poster = player.poster;
-
- if (premium) {
- iframe.setAttribute('data-poster', poster);
+ if (premium || !config.customControls) {
+ iframe.setAttribute('data-poster', player.poster);
player.media = replaceElement(iframe, player.media);
} else {
var wrapper = createElement$1('div', {
class: player.config.classNames.embedContainer,
- 'data-poster': poster
+ 'data-poster': player.poster
});
wrapper.appendChild(iframe);
player.media = replaceElement(wrapper, player.media);
} // Get poster image
- fetch(format(player.config.urls.vimeo.api, id), 'json').then(function (response) {
- if (is$2.empty(response)) {
- return;
- } // Get the URL for thumbnail
-
-
- var url = new URL(response[0].thumbnail_large); // Get original image
+ if (!config.customControls) {
+ fetch(format(player.config.urls.vimeo.api, src)).then(function (response) {
+ if (is$2.empty(response) || !response.thumbnail_url) {
+ return;
+ } // Set and show poster
- url.pathname = "".concat(url.pathname.split('_')[0], ".jpg"); // Set and show poster
- ui.setPoster.call(player, url.href).catch(function () {});
- }); // Setup instance
+ ui.setPoster.call(player, response.thumbnail_url).catch(function () {});
+ });
+ } // Setup instance
// https://github.com/vimeo/player.js
+
player.embed = new window.Vimeo.Player(iframe, {
autopause: player.config.autopause,
muted: player.muted
@@ -26451,9 +26151,11 @@ typeof navigator === "object" && (function () {
triggerEvent.call(player, player.media, 'error');
}); // Rebuild UI
- setTimeout(function () {
- return ui.build.call(player);
- }, 0);
+ if (config.customControls) {
+ setTimeout(function () {
+ return ui.build.call(player);
+ }, 0);
+ }
}
};
@@ -26544,7 +26246,8 @@ typeof navigator === "object" && (function () {
},
// API ready
ready: function ready() {
- var player = this; // Ignore already setup (race condition)
+ var player = this;
+ var config = player.config.youtube; // Ignore already setup (race condition)
var currentId = player.media && player.media.getAttribute('id');
@@ -26561,53 +26264,53 @@ typeof navigator === "object" && (function () {
var videoId = parseId$1(source);
- var id = generateId(player.provider); // Get poster, if already set
-
- var poster = player.poster; // Replace media element
+ var id = generateId(player.provider); // Replace media element
var container = createElement$1('div', {
id: id,
- 'data-poster': poster
+ 'data-poster': config.customControls ? player.poster : undefined
});
- player.media = replaceElement(container, player.media); // Id to poster wrapper
-
- var posterSrc = function posterSrc(s) {
- return "https://i.ytimg.com/vi/".concat(videoId, "/").concat(s, "default.jpg");
- }; // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
-
-
- loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded
- .catch(function () {
- return loadImage(posterSrc('sd'), 121);
- }) // 480p padded 4:3
- .catch(function () {
- return loadImage(posterSrc('hq'));
- }) // 360p padded 4:3. Always exists
- .then(function (image) {
- return ui.setPoster.call(player, image.src);
- }).then(function (src) {
- // If the image is padded, use background-size "cover" instead (like youtube does too with their posters)
- if (!src.includes('maxres')) {
- player.elements.poster.style.backgroundSize = 'cover';
- }
- }).catch(function () {});
- var config = player.config.youtube; // Setup instance
+ player.media = replaceElement(container, player.media); // Only load the poster when using custom controls
+
+ if (config.customControls) {
+ var posterSrc = function posterSrc(s) {
+ return "https://i.ytimg.com/vi/".concat(videoId, "/").concat(s, "default.jpg");
+ }; // Check thumbnail images in order of quality, but reject fallback thumbnails (120px wide)
+
+
+ loadImage(posterSrc('maxres'), 121) // Higest quality and unpadded
+ .catch(function () {
+ return loadImage(posterSrc('sd'), 121);
+ }) // 480p padded 4:3
+ .catch(function () {
+ return loadImage(posterSrc('hq'));
+ }) // 360p padded 4:3. Always exists
+ .then(function (image) {
+ return ui.setPoster.call(player, image.src);
+ }).then(function (src) {
+ // If the image is padded, use background-size "cover" instead (like youtube does too with their posters)
+ if (!src.includes('maxres')) {
+ player.elements.poster.style.backgroundSize = 'cover';
+ }
+ }).catch(function () {});
+ } // Setup instance
// https://developers.google.com/youtube/iframe_api_reference
- player.embed = new window.YT.Player(id, {
+
+ player.embed = new window.YT.Player(player.media, {
videoId: videoId,
host: getHost$2(config),
playerVars: extend$1({}, {
- autoplay: player.config.autoplay ? 1 : 0,
// Autoplay
- hl: player.config.hl,
+ autoplay: player.config.autoplay ? 1 : 0,
// iframe interface language
- controls: player.supported.ui ? 0 : 1,
- // Only show controls if not fully supported
- disablekb: 1,
+ hl: player.config.hl,
+ // Only show controls if not fully supported or opted out
+ controls: player.supported.ui && config.customControls ? 0 : 1,
// Disable keyboard as we handle it
- playsinline: !player.config.fullscreen.iosNative ? 1 : 0,
+ disablekb: 1,
// Allow iOS inline playback
+ playsinline: !player.config.fullscreen.iosNative ? 1 : 0,
// Captions are flaky on YouTube
cc_load_policy: player.captions.active ? 1 : 0,
cc_lang_pref: player.config.captions.language,
@@ -26718,6 +26421,7 @@ typeof navigator === "object" && (function () {
var toggle = is$2.boolean(input) ? input : muted;
muted = toggle;
instance[toggle ? 'mute' : 'unMute']();
+ instance.setVolume(volume * 100);
triggerEvent.call(player, player.media, 'volumechange');
}
}); // Source
@@ -26740,7 +26444,7 @@ typeof navigator === "object" && (function () {
return player.config.speed.options.includes(s);
}); // Set the tabindex to avoid focus entering iframe
- if (player.supported.ui) {
+ if (player.supported.ui && config.customControls) {
player.media.setAttribute('tabindex', -1);
}
@@ -26767,9 +26471,11 @@ typeof navigator === "object" && (function () {
}
}, 200); // Rebuild UI
- setTimeout(function () {
- return ui.build.call(player);
- }, 50);
+ if (config.customControls) {
+ setTimeout(function () {
+ return ui.build.call(player);
+ }, 50);
+ }
},
onStateChange: function onStateChange(event) {
// Get the instance
@@ -26815,7 +26521,7 @@ typeof navigator === "object" && (function () {
case 1:
// Restore paused state (YouTube starts playing on seek if the video hasn't been played yet)
- if (!player.config.autoplay && player.media.paused && !player.embed.hasPlayed) {
+ if (config.customControls && !player.config.autoplay && player.media.paused && !player.embed.hasPlayed) {
player.media.pause();
} else {
assurePlaybackState$1.call(player, true);
@@ -26888,7 +26594,8 @@ typeof navigator === "object" && (function () {
wrap$4(this.media, this.elements.wrapper); // Poster image container
this.elements.poster = createElement$1('div', {
- class: this.config.classNames.poster
+ class: this.config.classNames.poster,
+ hidden: ''
});
this.elements.wrapper.appendChild(this.elements.poster);
}