@pelcro/react-pelcro-js 3.19.0-beta.8 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -2,17 +2,6 @@ import * as React from 'react';
2
2
  import React__default, { useContext, useState, useRef, useEffect, useReducer, useLayoutEffect, Component, memo, createElement, Fragment, useMemo, forwardRef, createContext, useCallback, isValidElement, cloneElement } from 'react';
3
3
  import ReactDOM, { render as render$1 } from 'react-dom';
4
4
  import PropTypes from 'prop-types';
5
- import os from 'os';
6
- import http from 'http';
7
- import https from 'https';
8
- import url from 'url';
9
- import util$1 from 'util';
10
- import domain from 'domain';
11
- import path from 'path';
12
- import fs from 'fs';
13
- import stream from 'stream';
14
- import timers from 'timers';
15
- import events from 'events';
16
5
 
17
6
  function _typeof$3(obj) {
18
7
  "@babel/helpers - typeof";
@@ -1941,7 +1930,7 @@ function transformOptions(options) {
1941
1930
  return options;
1942
1931
  }
1943
1932
 
1944
- function noop$3() {}
1933
+ function noop$1() {}
1945
1934
 
1946
1935
  var I18n = function (_EventEmitter) {
1947
1936
  _inherits$1(I18n, _EventEmitter);
@@ -2005,7 +1994,7 @@ var I18n = function (_EventEmitter) {
2005
1994
 
2006
1995
  this.options = _objectSpread$7({}, get(), this.options, transformOptions(options));
2007
1996
  this.format = this.options.interpolation.format;
2008
- if (!callback) callback = noop$3;
1997
+ if (!callback) callback = noop$1;
2009
1998
 
2010
1999
  function createClassOnDemand(ClassOrObject) {
2011
2000
  if (!ClassOrObject) return null;
@@ -2126,7 +2115,7 @@ var I18n = function (_EventEmitter) {
2126
2115
  value: function loadResources(language) {
2127
2116
  var _this3 = this;
2128
2117
 
2129
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$3;
2118
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
2130
2119
  var usedCallback = callback;
2131
2120
  var usedLng = typeof language === 'string' ? language : this.language;
2132
2121
  if (typeof language === 'function') usedCallback = language;
@@ -2171,7 +2160,7 @@ var I18n = function (_EventEmitter) {
2171
2160
  var deferred = defer();
2172
2161
  if (!lngs) lngs = this.languages;
2173
2162
  if (!ns) ns = this.options.ns;
2174
- if (!callback) callback = noop$3;
2163
+ if (!callback) callback = noop$1;
2175
2164
  this.services.backendConnector.reload(lngs, ns, function (err) {
2176
2165
  deferred.resolve();
2177
2166
  callback(err);
@@ -2426,7 +2415,7 @@ var I18n = function (_EventEmitter) {
2426
2415
  var _this8 = this;
2427
2416
 
2428
2417
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2429
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$3;
2418
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
2430
2419
 
2431
2420
  var mergedOptions = _objectSpread$7({}, this.options, options, {
2432
2421
  isClone: true
@@ -3449,7 +3438,7 @@ var youAreSafe$3 = "You're safe - PCI compliant 128 SSL by";
3449
3438
  var cancel$3 = "Cancel your subscription online at anytime.";
3450
3439
  var giftSent$3 = "Subscription gift has been sent to";
3451
3440
  var successfully$3 = "successfully";
3452
- var entitlement$3 = "Some of the content on this page is available with one or more of our plans. <1> Subscribe </1> now to get full page access.";
3441
+ var entitlement$3 = "Some of the content on this page is available with one or more of our plans. <1>Subscribe</1> now to get full page access.";
3453
3442
  var recaptcha$3 = "This site is protected by reCAPTCHA and the Google <1>Privacy Policy</1> and <3>Terms of Service</3> apply.";
3454
3443
  var invalidInvoice$3 = "Invalid invoice ID, please contact support";
3455
3444
  var invalidSubscription$2 = "Invalid subscription ID, please contact support";
@@ -4390,7 +4379,7 @@ var youAreSafe$2 = "Vous êtes en sécurité - PCI conforme 128 SSL par";
4390
4379
  var cancel$2 = "Annuler votre abonnement en ligne à tout moment.";
4391
4380
  var giftSent$2 = "Le cadeau d’abonnement a été envoyé à";
4392
4381
  var successfully$2 = "avec succès.";
4393
- var entitlement$2 = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1> Abonnez-vous </1> à l'un de nos plans disponibles pour accéder à plus de contenu";
4382
+ var entitlement$2 = "Une partie du contenu de cette page est disponible sous un ou plusieurs de nos plans. <1>Abonnez-vous</1> à l'un de nos plans disponibles pour accéder à plus de contenu";
4394
4383
  var recaptcha$2 = "Ce site est protégé par reCAPTCHA - les <1>règles de confidentialité</1> Google ainsi que les <3>conditions d'utilisation</3> s'appliquent.";
4395
4384
  var invalidInvoice$2 = "Identifiant de facture non valide, veuillez contacter l'assistance";
4396
4385
  var invalidSubscription$1 = "ID d'abonnement invalide, veuillez contacter l'assistance";
@@ -5217,7 +5206,7 @@ var youAreSafe$1 = "PCI 준수 128비트 SSL 인증서로 보호됩니다. 제
5217
5206
  var cancel$1 = "유료 멤버십은 언제든 온라인으로 취소가 가능합니다.";
5218
5207
  var giftSent$1 = "유료 멤버십 선물이 ";
5219
5208
  var successfully$1 = "님께 성공적으로 전송되었습니다.";
5220
- var entitlement$1 = "이 페이지의 일부 콘텐츠는 하나 이상의 요금제 가입 시 이용이 가능합니다. 전체 페이지에 액세스하려면 지금 <1> 멤버십에 가입 </1>하세요.";
5209
+ var entitlement$1 = "이 페이지의 일부 콘텐츠는 하나 이상의 요금제 가입 시 이용이 가능합니다. 전체 페이지에 액세스하려면 지금 <1>멤버십에 가입</1>하세요.";
5221
5210
  var recaptcha$1 = "이 사이트는 reCAPTCHA로 보호되며, Google <1>개인정보 보호정책</1> 및 <3>서비스 약관</3>이 적용됩니다.";
5222
5211
  var invalidInvoice$1 = "유효하지 않은 인보이스 ID입니다. 지원팀에 문의하십시오.";
5223
5212
  var invalidSubscription = "잘못된 구독 ID입니다. 지원팀에 문의하세요.";
@@ -6148,7 +6137,7 @@ var youAreSafe = "Estás seguro - PCI compliance 128 SSL por";
6148
6137
  var cancel = "Cancela tu suscripción en línea en cualquier momento.";
6149
6138
  var giftSent = "La suscripción de regalo se ha enviado a";
6150
6139
  var successfully = "exitosamente";
6151
- var entitlement = "Algunos de los contenidos de está página están disponibles con uno o más de nuestros planes. <1> Suscríbete </1> ahora para obtener acceso completo.";
6140
+ var entitlement = "Algunos de los contenidos de está página están disponibles con uno o más de nuestros planes. <1>Suscríbete</1> ahora para obtener acceso completo.";
6152
6141
  var recaptcha = "Este sitio está protegido por reCAPTCHA, aplica la <1>Política de Privacidad</1> y los <3>Términos de Servicio</3> de Google.";
6153
6142
  var invalidInvoice = "Número de comprobante de pago inválido, por favor contacta a soporte.";
6154
6143
  var zeroTotalInvoice = "No puedes ver un comprobante de pago de $0";
@@ -8886,18 +8875,25 @@ function userMustVerifyEmail() {
8886
8875
  const isUserEmailVerified = (_window$Pelcro$user$r9 = (_window$Pelcro$user$r10 = window.Pelcro.user.read()) === null || _window$Pelcro$user$r10 === void 0 ? void 0 : _window$Pelcro$user$r10.email_confirm) !== null && _window$Pelcro$user$r9 !== void 0 ? _window$Pelcro$user$r9 : false;
8887
8876
  return window.Pelcro.user.isAuthenticated() && isEmailVerificationEnabled && !isUserEmailVerified;
8888
8877
  }
8889
-
8890
- // export function notifyBugsnag(message = 'Error') {
8891
- // Bugsnag.notify(message, (event) => {
8892
- // event.addMetadata("MetaData", {
8893
- // site: window.Pelcro?.site?.read(),
8894
- // user: window.Pelcro?.user?.read(),
8895
- // uiVersion: window.Pelcro?.uiSettings?.uiVersion,
8896
- // environment: window.Pelcro?.environment
8897
- // });
8898
- // event.app.version = window.Pelcro?.uiSettings?.uiVersion
8899
- // });
8900
- // }
8878
+ function notifyBugsnag(callback, startOptions) {
8879
+ if (!window.Bugsnag && !document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]')) {
8880
+ //load bugsnag CDN
8881
+ window.Pelcro.helpers.loadSDK("https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js", "bugsnag-cdn");
8882
+ document.querySelector('script[src="https://d2wy8f7a9ursnm.cloudfront.net/v7/bugsnag.min.js"]').addEventListener("load", () => {
8883
+ var _window$Pelcro$enviro, _window$Pelcro3, _window$Pelcro3$envir, _window$Pelcro4, _window$Pelcro4$envir;
8884
+ Bugsnag.start({
8885
+ apiKey: (_window$Pelcro$enviro = (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$envir = _window$Pelcro3.environment) === null || _window$Pelcro3$envir === void 0 ? void 0 : _window$Pelcro3$envir.bugsnagKey) !== null && _window$Pelcro$enviro !== void 0 ? _window$Pelcro$enviro : "e8f6852b322540e8c25386048b99ab01",
8886
+ autoDetectErrors: false,
8887
+ releaseStage: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$envir = _window$Pelcro4.environment) === null || _window$Pelcro4$envir === void 0 ? void 0 : _window$Pelcro4$envir.bugsnagReleaseStage,
8888
+ redactedKeys: ["security_key", "password", "password_confirmation", "auth_token", "token"],
8889
+ ...startOptions
8890
+ });
8891
+ callback();
8892
+ });
8893
+ return;
8894
+ }
8895
+ callback();
8896
+ }
8901
8897
 
8902
8898
  const resources = {
8903
8899
  en: {
@@ -10931,10 +10927,8 @@ const loadPaymentSDKs = () => {
10931
10927
  const {
10932
10928
  whenUserReady
10933
10929
  } = usePelcro.getStore();
10934
- const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
10935
- const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
10936
10930
  whenUserReady(() => {
10937
- if (!window.Stripe && !supportsVantiv && !supportsTap) {
10931
+ if (!window.Stripe) {
10938
10932
  pure_1(window.Pelcro.environment.stripe);
10939
10933
  }
10940
10934
  });
@@ -10947,19 +10941,21 @@ const loadPaymentSDKs = () => {
10947
10941
  }
10948
10942
 
10949
10943
  // Load Vantiv SDKs
10944
+ const supportsVantiv = Boolean(window.Pelcro.site.read().vantiv_gateway_settings);
10950
10945
  if (supportsVantiv) {
10951
10946
  if (!window.jQuery) {
10952
10947
  window.Pelcro.helpers.loadSDK("https://code.jquery.com/jquery-3.6.0.slim.min.js", "vantiv-jquery-sdk");
10953
10948
  }
10954
10949
  if (!window.EprotectIframeClient) {
10955
10950
  const PRELIVE_URL = "https://request.eprotect.vantivprelive.com/eProtect/js/eProtect-iframe-client.min.js";
10956
- const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client4.min.js";
10951
+ const PRODUCTION_URL = "https://request.eprotect.vantivcnp.com/eProtect/js/eProtect-iframe-client3.min.js";
10957
10952
  const scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? PRODUCTION_URL : PRELIVE_URL;
10958
10953
  window.Pelcro.helpers.loadSDK(scriptUrlToUse, "vantiv-eprotect-sdk");
10959
10954
  }
10960
10955
  }
10961
10956
 
10962
10957
  // Load Tap SDKs
10958
+ const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
10963
10959
  if (supportsTap) {
10964
10960
  window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
10965
10961
  window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
@@ -11133,9 +11129,7 @@ const initSubscriptionFromURL = () => {
11133
11129
  whenSiteReady(() => {
11134
11130
  var _selectedProduct$plan;
11135
11131
  const productsList = window.Pelcro.product.list();
11136
- if (!(productsList !== null && productsList !== void 0 && productsList.length)) {
11137
- return;
11138
- }
11132
+ if (!(productsList !== null && productsList !== void 0 && productsList.length)) return;
11139
11133
  const [productId, planId, isGiftParam] = [window.Pelcro.helpers.getURLParameter("product_id"), window.Pelcro.helpers.getURLParameter("plan_id"), window.Pelcro.helpers.getURLParameter("is_gift")];
11140
11134
  const isGift = (isGiftParam === null || isGiftParam === void 0 ? void 0 : isGiftParam.toLowerCase()) === "true";
11141
11135
  const selectedProduct = productsList.find(product => product.id === Number(productId));
@@ -13879,3539 +13873,43 @@ function Radio(_ref) {
13879
13873
  }, children));
13880
13874
  }
13881
13875
 
13882
- var stackframe = createCommonjsModule(function (module, exports) {
13883
- (function(root, factory) {
13884
- // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
13885
-
13886
- /* istanbul ignore next */
13887
- {
13888
- module.exports = factory();
13889
- }
13890
- }(commonjsGlobal, function() {
13891
- function _isNumber(n) {
13892
- return !isNaN(parseFloat(n)) && isFinite(n);
13893
- }
13894
-
13895
- function _capitalize(str) {
13896
- return str.charAt(0).toUpperCase() + str.substring(1);
13897
- }
13898
-
13899
- function _getter(p) {
13900
- return function() {
13901
- return this[p];
13902
- };
13903
- }
13904
-
13905
- var booleanProps = ['isConstructor', 'isEval', 'isNative', 'isToplevel'];
13906
- var numericProps = ['columnNumber', 'lineNumber'];
13907
- var stringProps = ['fileName', 'functionName', 'source'];
13908
- var arrayProps = ['args'];
13909
- var objectProps = ['evalOrigin'];
13910
-
13911
- var props = booleanProps.concat(numericProps, stringProps, arrayProps, objectProps);
13912
-
13913
- function StackFrame(obj) {
13914
- if (!obj) return;
13915
- for (var i = 0; i < props.length; i++) {
13916
- if (obj[props[i]] !== undefined) {
13917
- this['set' + _capitalize(props[i])](obj[props[i]]);
13918
- }
13919
- }
13920
- }
13921
-
13922
- StackFrame.prototype = {
13923
- getArgs: function() {
13924
- return this.args;
13925
- },
13926
- setArgs: function(v) {
13927
- if (Object.prototype.toString.call(v) !== '[object Array]') {
13928
- throw new TypeError('Args must be an Array');
13929
- }
13930
- this.args = v;
13931
- },
13932
-
13933
- getEvalOrigin: function() {
13934
- return this.evalOrigin;
13935
- },
13936
- setEvalOrigin: function(v) {
13937
- if (v instanceof StackFrame) {
13938
- this.evalOrigin = v;
13939
- } else if (v instanceof Object) {
13940
- this.evalOrigin = new StackFrame(v);
13941
- } else {
13942
- throw new TypeError('Eval Origin must be an Object or StackFrame');
13943
- }
13944
- },
13945
-
13946
- toString: function() {
13947
- var fileName = this.getFileName() || '';
13948
- var lineNumber = this.getLineNumber() || '';
13949
- var columnNumber = this.getColumnNumber() || '';
13950
- var functionName = this.getFunctionName() || '';
13951
- if (this.getIsEval()) {
13952
- if (fileName) {
13953
- return '[eval] (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';
13954
- }
13955
- return '[eval]:' + lineNumber + ':' + columnNumber;
13956
- }
13957
- if (functionName) {
13958
- return functionName + ' (' + fileName + ':' + lineNumber + ':' + columnNumber + ')';
13959
- }
13960
- return fileName + ':' + lineNumber + ':' + columnNumber;
13961
- }
13962
- };
13963
-
13964
- StackFrame.fromString = function StackFrame$$fromString(str) {
13965
- var argsStartIndex = str.indexOf('(');
13966
- var argsEndIndex = str.lastIndexOf(')');
13967
-
13968
- var functionName = str.substring(0, argsStartIndex);
13969
- var args = str.substring(argsStartIndex + 1, argsEndIndex).split(',');
13970
- var locationString = str.substring(argsEndIndex + 1);
13971
-
13972
- if (locationString.indexOf('@') === 0) {
13973
- var parts = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(locationString, '');
13974
- var fileName = parts[1];
13975
- var lineNumber = parts[2];
13976
- var columnNumber = parts[3];
13977
- }
13978
-
13979
- return new StackFrame({
13980
- functionName: functionName,
13981
- args: args || undefined,
13982
- fileName: fileName,
13983
- lineNumber: lineNumber || undefined,
13984
- columnNumber: columnNumber || undefined
13985
- });
13986
- };
13987
-
13988
- for (var i = 0; i < booleanProps.length; i++) {
13989
- StackFrame.prototype['get' + _capitalize(booleanProps[i])] = _getter(booleanProps[i]);
13990
- StackFrame.prototype['set' + _capitalize(booleanProps[i])] = (function(p) {
13991
- return function(v) {
13992
- this[p] = Boolean(v);
13993
- };
13994
- })(booleanProps[i]);
13995
- }
13996
-
13997
- for (var j = 0; j < numericProps.length; j++) {
13998
- StackFrame.prototype['get' + _capitalize(numericProps[j])] = _getter(numericProps[j]);
13999
- StackFrame.prototype['set' + _capitalize(numericProps[j])] = (function(p) {
14000
- return function(v) {
14001
- if (!_isNumber(v)) {
14002
- throw new TypeError(p + ' must be a Number');
14003
- }
14004
- this[p] = Number(v);
14005
- };
14006
- })(numericProps[j]);
14007
- }
14008
-
14009
- for (var k = 0; k < stringProps.length; k++) {
14010
- StackFrame.prototype['get' + _capitalize(stringProps[k])] = _getter(stringProps[k]);
14011
- StackFrame.prototype['set' + _capitalize(stringProps[k])] = (function(p) {
14012
- return function(v) {
14013
- this[p] = String(v);
14014
- };
14015
- })(stringProps[k]);
14016
- }
14017
-
14018
- return StackFrame;
14019
- }));
14020
- });
14021
-
14022
- var errorStackParser = createCommonjsModule(function (module, exports) {
14023
- (function(root, factory) {
14024
- // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
14025
-
14026
- /* istanbul ignore next */
14027
- {
14028
- module.exports = factory(stackframe);
14029
- }
14030
- }(commonjsGlobal, function ErrorStackParser(StackFrame) {
14031
-
14032
- var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
14033
- var CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
14034
- var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
14035
-
14036
- return {
14037
- /**
14038
- * Given an Error object, extract the most information from it.
14039
- *
14040
- * @param {Error} error object
14041
- * @return {Array} of StackFrames
14042
- */
14043
- parse: function ErrorStackParser$$parse(error) {
14044
- if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {
14045
- return this.parseOpera(error);
14046
- } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
14047
- return this.parseV8OrIE(error);
14048
- } else if (error.stack) {
14049
- return this.parseFFOrSafari(error);
14050
- } else {
14051
- throw new Error('Cannot parse given Error object');
14052
- }
14053
- },
14054
-
14055
- // Separate line and column numbers from a string of the form: (URI:Line:Column)
14056
- extractLocation: function ErrorStackParser$$extractLocation(urlLike) {
14057
- // Fail-fast but return locations like "(native)"
14058
- if (urlLike.indexOf(':') === -1) {
14059
- return [urlLike];
14060
- }
14061
-
14062
- var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
14063
- var parts = regExp.exec(urlLike.replace(/[()]/g, ''));
14064
- return [parts[1], parts[2] || undefined, parts[3] || undefined];
14065
- },
14066
-
14067
- parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) {
14068
- var filtered = error.stack.split('\n').filter(function(line) {
14069
- return !!line.match(CHROME_IE_STACK_REGEXP);
14070
- }, this);
14071
-
14072
- return filtered.map(function(line) {
14073
- if (line.indexOf('(eval ') > -1) {
14074
- // Throw away eval information until we implement stacktrace.js/stackframe#8
14075
- line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(,.*$)/g, '');
14076
- }
14077
- var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').replace(/^.*?\s+/, '');
14078
-
14079
- // capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in
14080
- // case it has spaces in it, as the string is split on \s+ later on
14081
- var location = sanitizedLine.match(/ (\(.+\)$)/);
14082
-
14083
- // remove the parenthesized location from the line, if it was matched
14084
- sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
14085
-
14086
- // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine
14087
- // because this line doesn't have function name
14088
- var locationParts = this.extractLocation(location ? location[1] : sanitizedLine);
14089
- var functionName = location && sanitizedLine || undefined;
14090
- var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
14091
-
14092
- return new StackFrame({
14093
- functionName: functionName,
14094
- fileName: fileName,
14095
- lineNumber: locationParts[1],
14096
- columnNumber: locationParts[2],
14097
- source: line
14098
- });
14099
- }, this);
14100
- },
14101
-
14102
- parseFFOrSafari: function ErrorStackParser$$parseFFOrSafari(error) {
14103
- var filtered = error.stack.split('\n').filter(function(line) {
14104
- return !line.match(SAFARI_NATIVE_CODE_REGEXP);
14105
- }, this);
14106
-
14107
- return filtered.map(function(line) {
14108
- // Throw away eval information until we implement stacktrace.js/stackframe#8
14109
- if (line.indexOf(' > eval') > -1) {
14110
- line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
14111
- }
14112
-
14113
- if (line.indexOf('@') === -1 && line.indexOf(':') === -1) {
14114
- // Safari eval frames only have function names and nothing else
14115
- return new StackFrame({
14116
- functionName: line
14117
- });
14118
- } else {
14119
- var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
14120
- var matches = line.match(functionNameRegex);
14121
- var functionName = matches && matches[1] ? matches[1] : undefined;
14122
- var locationParts = this.extractLocation(line.replace(functionNameRegex, ''));
14123
-
14124
- return new StackFrame({
14125
- functionName: functionName,
14126
- fileName: locationParts[0],
14127
- lineNumber: locationParts[1],
14128
- columnNumber: locationParts[2],
14129
- source: line
14130
- });
14131
- }
14132
- }, this);
14133
- },
14134
-
14135
- parseOpera: function ErrorStackParser$$parseOpera(e) {
14136
- if (!e.stacktrace || (e.message.indexOf('\n') > -1 &&
14137
- e.message.split('\n').length > e.stacktrace.split('\n').length)) {
14138
- return this.parseOpera9(e);
14139
- } else if (!e.stack) {
14140
- return this.parseOpera10(e);
14141
- } else {
14142
- return this.parseOpera11(e);
14143
- }
14144
- },
14145
-
14146
- parseOpera9: function ErrorStackParser$$parseOpera9(e) {
14147
- var lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
14148
- var lines = e.message.split('\n');
14149
- var result = [];
14150
-
14151
- for (var i = 2, len = lines.length; i < len; i += 2) {
14152
- var match = lineRE.exec(lines[i]);
14153
- if (match) {
14154
- result.push(new StackFrame({
14155
- fileName: match[2],
14156
- lineNumber: match[1],
14157
- source: lines[i]
14158
- }));
14159
- }
14160
- }
14161
-
14162
- return result;
14163
- },
14164
-
14165
- parseOpera10: function ErrorStackParser$$parseOpera10(e) {
14166
- var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
14167
- var lines = e.stacktrace.split('\n');
14168
- var result = [];
14169
-
14170
- for (var i = 0, len = lines.length; i < len; i += 2) {
14171
- var match = lineRE.exec(lines[i]);
14172
- if (match) {
14173
- result.push(
14174
- new StackFrame({
14175
- functionName: match[3] || undefined,
14176
- fileName: match[2],
14177
- lineNumber: match[1],
14178
- source: lines[i]
14179
- })
14180
- );
14181
- }
14182
- }
14183
-
14184
- return result;
14185
- },
14186
-
14187
- // Opera 10.65+ Error.stack very similar to FF/Safari
14188
- parseOpera11: function ErrorStackParser$$parseOpera11(error) {
14189
- var filtered = error.stack.split('\n').filter(function(line) {
14190
- return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
14191
- }, this);
14192
-
14193
- return filtered.map(function(line) {
14194
- var tokens = line.split('@');
14195
- var locationParts = this.extractLocation(tokens.pop());
14196
- var functionCall = (tokens.shift() || '');
14197
- var functionName = functionCall
14198
- .replace(/<anonymous function(: (\w+))?>/, '$2')
14199
- .replace(/\([^)]*\)/g, '') || undefined;
14200
- var argsRaw;
14201
- if (functionCall.match(/\(([^)]*)\)/)) {
14202
- argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, '$1');
14203
- }
14204
- var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ?
14205
- undefined : argsRaw.split(',');
14206
-
14207
- return new StackFrame({
14208
- functionName: functionName,
14209
- args: args,
14210
- fileName: locationParts[0],
14211
- lineNumber: locationParts[1],
14212
- columnNumber: locationParts[2],
14213
- source: line
14214
- });
14215
- }, this);
14216
- }
14217
- };
14218
- }));
14219
- });
14220
-
14221
- /**
14222
- * Expose `isError`.
14223
- */
14224
-
14225
- var iserror = isError;
14226
-
14227
13876
  /**
14228
- * Test whether `value` is error object.
14229
13877
  *
14230
- * @param {*} value
14231
- * @returns {boolean}
14232
13878
  */
14233
-
14234
- function isError(value) {
14235
- switch (Object.prototype.toString.call(value)) {
14236
- case '[object Error]': return true;
14237
- case '[object Exception]': return true;
14238
- case '[object DOMException]': return true;
14239
- default: return value instanceof Error;
14240
- }
14241
- }
14242
-
14243
- var stackGenerator = createCommonjsModule(function (module, exports) {
14244
- (function(root, factory) {
14245
- // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, Rhino, and browsers.
14246
-
14247
- /* istanbul ignore next */
14248
- {
14249
- module.exports = factory(stackframe);
14250
- }
14251
- }(commonjsGlobal, function(StackFrame) {
14252
- return {
14253
- backtrace: function StackGenerator$$backtrace(opts) {
14254
- var stack = [];
14255
- var maxStackSize = 10;
14256
-
14257
- if (typeof opts === 'object' && typeof opts.maxStackSize === 'number') {
14258
- maxStackSize = opts.maxStackSize;
14259
- }
14260
-
14261
- var curr = arguments.callee;
14262
- while (curr && stack.length < maxStackSize && curr['arguments']) {
14263
- // Allow V8 optimizations
14264
- var args = new Array(curr['arguments'].length);
14265
- for (var i = 0; i < args.length; ++i) {
14266
- args[i] = curr['arguments'][i];
14267
- }
14268
- if (/function(?:\s+([\w$]+))+\s*\(/.test(curr.toString())) {
14269
- stack.push(new StackFrame({functionName: RegExp.$1 || undefined, args: args}));
14270
- } else {
14271
- stack.push(new StackFrame({args: args}));
14272
- }
14273
-
14274
- try {
14275
- curr = curr.caller;
14276
- } catch (e) {
14277
- break;
14278
- }
14279
- }
14280
- return stack;
14281
- }
14282
- };
14283
- }));
14284
- });
14285
-
14286
- // Returns a wrapper function that returns a wrapped callback
14287
- // The wrapper function should do some stuff, and return a
14288
- // presumably different callback function.
14289
- // This makes sure that own properties are retained, so that
14290
- // decorations and such are not lost along the way.
14291
- var wrappy_1 = wrappy;
14292
- function wrappy (fn, cb) {
14293
- if (fn && cb) return wrappy(fn)(cb)
14294
-
14295
- if (typeof fn !== 'function')
14296
- throw new TypeError('need wrapper function')
14297
-
14298
- Object.keys(fn).forEach(function (k) {
14299
- wrapper[k] = fn[k];
14300
- });
14301
-
14302
- return wrapper
14303
-
14304
- function wrapper() {
14305
- var args = new Array(arguments.length);
14306
- for (var i = 0; i < args.length; i++) {
14307
- args[i] = arguments[i];
14308
- }
14309
- var ret = fn.apply(this, args);
14310
- var cb = args[args.length-1];
14311
- if (typeof ret === 'function' && ret !== cb) {
14312
- Object.keys(cb).forEach(function (k) {
14313
- ret[k] = cb[k];
14314
- });
14315
- }
14316
- return ret
14317
- }
14318
- }
14319
-
14320
- var once_1 = wrappy_1(once$1);
14321
- var strict = wrappy_1(onceStrict);
14322
-
14323
- once$1.proto = once$1(function () {
14324
- Object.defineProperty(Function.prototype, 'once', {
14325
- value: function () {
14326
- return once$1(this)
14327
- },
14328
- configurable: true
14329
- });
14330
-
14331
- Object.defineProperty(Function.prototype, 'onceStrict', {
14332
- value: function () {
14333
- return onceStrict(this)
13879
+ function SelectModalWithHook(props) {
13880
+ React__default.useEffect(() => {
13881
+ var _props$onDisplay;
13882
+ (_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
13883
+ }, []);
13884
+ const {
13885
+ isGift,
13886
+ plan,
13887
+ product,
13888
+ isRenewingGift,
13889
+ switchView,
13890
+ resetView,
13891
+ view,
13892
+ set
13893
+ } = usePelcro();
13894
+ const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
13895
+ const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
13896
+ return /*#__PURE__*/React__default.createElement(SelectModalWithTrans, {
13897
+ isGift: isGift,
13898
+ disableGifting: isRenewingGift,
13899
+ plan: plan,
13900
+ product: product,
13901
+ onClose: () => {
13902
+ var _props$onClose;
13903
+ (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
13904
+ resetView();
14334
13905
  },
14335
- configurable: true
14336
- });
14337
- });
14338
-
14339
- function once$1 (fn) {
14340
- var f = function () {
14341
- if (f.called) return f.value
14342
- f.called = true;
14343
- return f.value = fn.apply(this, arguments)
14344
- };
14345
- f.called = false;
14346
- return f
14347
- }
14348
-
14349
- function onceStrict (fn) {
14350
- var f = function () {
14351
- if (f.called)
14352
- throw new Error(f.onceError)
14353
- f.called = true;
14354
- return f.value = fn.apply(this, arguments)
14355
- };
14356
- var name = fn.name || 'Function wrapped with `once`';
14357
- f.onceError = name + " shouldn't be called more than once";
14358
- f.called = false;
14359
- return f
14360
- }
14361
- once_1.strict = strict;
14362
-
14363
- var noop$2 = function() {};
14364
-
14365
- var isRequest$1 = function(stream) {
14366
- return stream.setHeader && typeof stream.abort === 'function';
14367
- };
14368
-
14369
- var isChildProcess = function(stream) {
14370
- return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3
14371
- };
14372
-
14373
- var eos = function(stream, opts, callback) {
14374
- if (typeof opts === 'function') return eos(stream, null, opts);
14375
- if (!opts) opts = {};
14376
-
14377
- callback = once_1(callback || noop$2);
14378
-
14379
- var ws = stream._writableState;
14380
- var rs = stream._readableState;
14381
- var readable = opts.readable || (opts.readable !== false && stream.readable);
14382
- var writable = opts.writable || (opts.writable !== false && stream.writable);
14383
- var cancelled = false;
14384
-
14385
- var onlegacyfinish = function() {
14386
- if (!stream.writable) onfinish();
14387
- };
14388
-
14389
- var onfinish = function() {
14390
- writable = false;
14391
- if (!readable) callback.call(stream);
14392
- };
14393
-
14394
- var onend = function() {
14395
- readable = false;
14396
- if (!writable) callback.call(stream);
14397
- };
14398
-
14399
- var onexit = function(exitCode) {
14400
- callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
14401
- };
14402
-
14403
- var onerror = function(err) {
14404
- callback.call(stream, err);
14405
- };
14406
-
14407
- var onclose = function() {
14408
- process.nextTick(onclosenexttick);
14409
- };
14410
-
14411
- var onclosenexttick = function() {
14412
- if (cancelled) return;
14413
- if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close'));
14414
- if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close'));
14415
- };
14416
-
14417
- var onrequest = function() {
14418
- stream.req.on('finish', onfinish);
14419
- };
14420
-
14421
- if (isRequest$1(stream)) {
14422
- stream.on('complete', onfinish);
14423
- stream.on('abort', onclose);
14424
- if (stream.req) onrequest();
14425
- else stream.on('request', onrequest);
14426
- } else if (writable && !ws) { // legacy streams
14427
- stream.on('end', onlegacyfinish);
14428
- stream.on('close', onlegacyfinish);
14429
- }
14430
-
14431
- if (isChildProcess(stream)) stream.on('exit', onexit);
14432
-
14433
- stream.on('end', onend);
14434
- stream.on('finish', onfinish);
14435
- if (opts.error !== false) stream.on('error', onerror);
14436
- stream.on('close', onclose);
14437
-
14438
- return function() {
14439
- cancelled = true;
14440
- stream.removeListener('complete', onfinish);
14441
- stream.removeListener('abort', onclose);
14442
- stream.removeListener('request', onrequest);
14443
- if (stream.req) stream.req.removeListener('finish', onfinish);
14444
- stream.removeListener('end', onlegacyfinish);
14445
- stream.removeListener('close', onlegacyfinish);
14446
- stream.removeListener('finish', onfinish);
14447
- stream.removeListener('exit', onexit);
14448
- stream.removeListener('end', onend);
14449
- stream.removeListener('error', onerror);
14450
- stream.removeListener('close', onclose);
14451
- };
14452
- };
14453
-
14454
- var endOfStream = eos;
14455
-
14456
- // we only need fs to get the ReadStream and WriteStream prototypes
14457
-
14458
- var noop$1 = function () {};
14459
- var ancient = /^v?\.0/.test(process.version);
14460
-
14461
- var isFn = function (fn) {
14462
- return typeof fn === 'function'
14463
- };
14464
-
14465
- var isFS = function (stream) {
14466
- if (!ancient) return false // newer node version do not need to care about fs is a special way
14467
- if (!fs) return false // browser
14468
- return (stream instanceof (fs.ReadStream || noop$1) || stream instanceof (fs.WriteStream || noop$1)) && isFn(stream.close)
14469
- };
14470
-
14471
- var isRequest = function (stream) {
14472
- return stream.setHeader && isFn(stream.abort)
14473
- };
14474
-
14475
- var destroyer = function (stream, reading, writing, callback) {
14476
- callback = once_1(callback);
14477
-
14478
- var closed = false;
14479
- stream.on('close', function () {
14480
- closed = true;
14481
- });
14482
-
14483
- endOfStream(stream, {readable: reading, writable: writing}, function (err) {
14484
- if (err) return callback(err)
14485
- closed = true;
14486
- callback();
14487
- });
14488
-
14489
- var destroyed = false;
14490
- return function (err) {
14491
- if (closed) return
14492
- if (destroyed) return
14493
- destroyed = true;
14494
-
14495
- if (isFS(stream)) return stream.close(noop$1) // use close for fs streams to avoid fd leaks
14496
- if (isRequest(stream)) return stream.abort() // request.destroy just do .end - .abort is what we want
14497
-
14498
- if (isFn(stream.destroy)) return stream.destroy()
14499
-
14500
- callback(err || new Error('stream was destroyed'));
14501
- }
14502
- };
14503
-
14504
- var call = function (fn) {
14505
- fn();
14506
- };
14507
-
14508
- var pipe = function (from, to) {
14509
- return from.pipe(to)
14510
- };
14511
-
14512
- var pump = function () {
14513
- var streams = Array.prototype.slice.call(arguments);
14514
- var callback = isFn(streams[streams.length - 1] || noop$1) && streams.pop() || noop$1;
14515
-
14516
- if (Array.isArray(streams[0])) streams = streams[0];
14517
- if (streams.length < 2) throw new Error('pump requires two streams per minimum')
14518
-
14519
- var error;
14520
- var destroys = streams.map(function (stream, i) {
14521
- var reading = i < streams.length - 1;
14522
- var writing = i > 0;
14523
- return destroyer(stream, reading, writing, function (err) {
14524
- if (!error) error = err;
14525
- if (err) destroys.forEach(call);
14526
- if (reading) return
14527
- destroys.forEach(call);
14528
- callback(error);
14529
- })
14530
- });
14531
-
14532
- return streams.reduce(pipe)
14533
- };
14534
-
14535
- var pump_1 = pump;
14536
-
14537
- var byline = createCommonjsModule(function (module) {
14538
- // Copyright (C) 2011-2015 John Hewson
14539
- //
14540
- // Permission is hereby granted, free of charge, to any person obtaining a copy
14541
- // of this software and associated documentation files (the "Software"), to
14542
- // deal in the Software without restriction, including without limitation the
14543
- // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14544
- // sell copies of the Software, and to permit persons to whom the Software is
14545
- // furnished to do so, subject to the following conditions:
14546
- //
14547
- // The above copyright notice and this permission notice shall be included in
14548
- // all copies or substantial portions of the Software.
14549
- //
14550
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14551
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14552
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14553
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14554
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
14555
- // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
14556
- // IN THE SOFTWARE.
14557
-
14558
-
14559
-
14560
- // convinience API
14561
- module.exports = function(readStream, options) {
14562
- return module.exports.createStream(readStream, options);
14563
- };
14564
-
14565
- // basic API
14566
- module.exports.createStream = function(readStream, options) {
14567
- if (readStream) {
14568
- return createLineStream(readStream, options);
14569
- } else {
14570
- return new LineStream(options);
14571
- }
14572
- };
14573
-
14574
- // deprecated API
14575
- module.exports.createLineStream = function(readStream) {
14576
- console.log('WARNING: byline#createLineStream is deprecated and will be removed soon');
14577
- return createLineStream(readStream);
14578
- };
14579
-
14580
- function createLineStream(readStream, options) {
14581
- if (!readStream) {
14582
- throw new Error('expected readStream');
14583
- }
14584
- if (!readStream.readable) {
14585
- throw new Error('readStream must be readable');
14586
- }
14587
- var ls = new LineStream(options);
14588
- readStream.pipe(ls);
14589
- return ls;
14590
- }
14591
-
14592
- //
14593
- // using the new node v0.10 "streams2" API
14594
- //
14595
-
14596
- module.exports.LineStream = LineStream;
14597
-
14598
- function LineStream(options) {
14599
- stream.Transform.call(this, options);
14600
- options = options || {};
14601
-
14602
- // use objectMode to stop the output from being buffered
14603
- // which re-concatanates the lines, just without newlines.
14604
- this._readableState.objectMode = true;
14605
- this._lineBuffer = [];
14606
- this._keepEmptyLines = options.keepEmptyLines || false;
14607
- this._lastChunkEndedWithCR = false;
14608
-
14609
- // take the source's encoding if we don't have one
14610
- var self = this;
14611
- this.on('pipe', function(src) {
14612
- if (!self.encoding) {
14613
- // but we can't do this for old-style streams
14614
- if (src instanceof stream.Readable) {
14615
- self.encoding = src._readableState.encoding;
14616
- }
14617
- }
14618
- });
14619
- }
14620
- util$1.inherits(LineStream, stream.Transform);
14621
-
14622
- LineStream.prototype._transform = function(chunk, encoding, done) {
14623
- // decode binary chunks as UTF-8
14624
- encoding = encoding || 'utf8';
14625
-
14626
- if (Buffer.isBuffer(chunk)) {
14627
- if (encoding == 'buffer') {
14628
- chunk = chunk.toString(); // utf8
14629
- encoding = 'utf8';
14630
- }
14631
- else {
14632
- chunk = chunk.toString(encoding);
14633
- }
14634
- }
14635
- this._chunkEncoding = encoding;
14636
-
14637
- // see: http://www.unicode.org/reports/tr18/#Line_Boundaries
14638
- var lines = chunk.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g);
14639
-
14640
- // don't split CRLF which spans chunks
14641
- if (this._lastChunkEndedWithCR && chunk[0] == '\n') {
14642
- lines.shift();
14643
- }
14644
-
14645
- if (this._lineBuffer.length > 0) {
14646
- this._lineBuffer[this._lineBuffer.length - 1] += lines[0];
14647
- lines.shift();
14648
- }
14649
-
14650
- this._lastChunkEndedWithCR = chunk[chunk.length - 1] == '\r';
14651
- this._lineBuffer = this._lineBuffer.concat(lines);
14652
- this._pushBuffer(encoding, 1, done);
14653
- };
14654
-
14655
- LineStream.prototype._pushBuffer = function(encoding, keep, done) {
14656
- // always buffer the last (possibly partial) line
14657
- while (this._lineBuffer.length > keep) {
14658
- var line = this._lineBuffer.shift();
14659
- // skip empty lines
14660
- if (this._keepEmptyLines || line.length > 0 ) {
14661
- if (!this.push(this._reencode(line, encoding))) {
14662
- // when the high-water mark is reached, defer pushes until the next tick
14663
- var self = this;
14664
- timers.setImmediate(function() {
14665
- self._pushBuffer(encoding, keep, done);
14666
- });
14667
- return;
14668
- }
14669
- }
14670
- }
14671
- done();
14672
- };
14673
-
14674
- LineStream.prototype._flush = function(done) {
14675
- this._pushBuffer(this._chunkEncoding, 0, done);
14676
- };
14677
-
14678
- // see Readable::push
14679
- LineStream.prototype._reencode = function(line, chunkEncoding) {
14680
- if (this.encoding && this.encoding != chunkEncoding) {
14681
- return new Buffer(line, chunkEncoding).toString(this.encoding);
14682
- }
14683
- else if (this.encoding) {
14684
- // this should be the most common case, i.e. we're using an encoded source stream
14685
- return line;
14686
- }
14687
- else {
14688
- return new Buffer(line, chunkEncoding);
14689
- }
14690
- };
14691
- });
14692
- byline.createStream;
14693
- byline.createLineStream;
14694
- byline.LineStream;
14695
-
14696
- var bugsnag = createCommonjsModule(function (module, exports) {
14697
- (function(f){{module.exports=f();}})(function(){var Breadcrumb = /*#__PURE__*/function () {
14698
- function Breadcrumb(message, metadata, type, timestamp) {
14699
- if (timestamp === void 0) {
14700
- timestamp = new Date();
14701
- }
14702
-
14703
- this.type = type;
14704
- this.message = message;
14705
- this.metadata = metadata;
14706
- this.timestamp = timestamp;
14707
- }
14708
-
14709
- var _proto = Breadcrumb.prototype;
14710
-
14711
- _proto.toJSON = function toJSON() {
14712
- return {
14713
- type: this.type,
14714
- name: this.message,
14715
- timestamp: this.timestamp,
14716
- metaData: this.metadata
14717
- };
14718
- };
14719
-
14720
- return Breadcrumb;
14721
- }();
14722
-
14723
- var _$Breadcrumb_1 = Breadcrumb;
14724
-
14725
- var _$breadcrumbTypes_6 = ['navigation', 'request', 'process', 'log', 'user', 'state', 'error', 'manual'];
14726
-
14727
- // Array#reduce
14728
- var _$reduce_16 = function (arr, fn, accum) {
14729
- var val = accum;
14730
-
14731
- for (var i = 0, len = arr.length; i < len; i++) {
14732
- val = fn(val, arr[i], i, arr);
14733
- }
14734
-
14735
- return val;
14736
- };
14737
-
14738
-
14739
- var _$filter_11 = function (arr, fn) {
14740
- return _$reduce_16(arr, function (accum, item, i, arr) {
14741
- return !fn(item, i, arr) ? accum : accum.concat(item);
14742
- }, []);
14743
- };
14744
-
14745
-
14746
- var _$includes_12 = function (arr, x) {
14747
- return _$reduce_16(arr, function (accum, item, i, arr) {
14748
- return accum === true || item === x;
14749
- }, false);
14750
- };
14751
-
14752
- // Array#isArray
14753
- var _$isArray_13 = function (obj) {
14754
- return Object.prototype.toString.call(obj) === '[object Array]';
14755
- };
14756
-
14757
- /* eslint-disable-next-line no-prototype-builtins */
14758
- var _hasDontEnumBug = !{
14759
- toString: null
14760
- }.propertyIsEnumerable('toString');
14761
-
14762
- var _dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor']; // Object#keys
14763
-
14764
- var _$keys_14 = function (obj) {
14765
- // stripped down version of
14766
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/Keys
14767
- var result = [];
14768
- var prop;
14769
-
14770
- for (prop in obj) {
14771
- if (Object.prototype.hasOwnProperty.call(obj, prop)) result.push(prop);
14772
- }
14773
-
14774
- if (!_hasDontEnumBug) return result;
14775
-
14776
- for (var i = 0, len = _dontEnums.length; i < len; i++) {
14777
- if (Object.prototype.hasOwnProperty.call(obj, _dontEnums[i])) result.push(_dontEnums[i]);
14778
- }
14779
-
14780
- return result;
14781
- };
14782
-
14783
- var _$intRange_25 = function (min, max) {
14784
- if (min === void 0) {
14785
- min = 1;
14786
- }
14787
-
14788
- if (max === void 0) {
14789
- max = Infinity;
14790
- }
14791
-
14792
- return function (value) {
14793
- return typeof value === 'number' && parseInt('' + value, 10) === value && value >= min && value <= max;
14794
- };
14795
- };
14796
-
14797
- var _$listOfFunctions_26 = function (value) {
14798
- return typeof value === 'function' || _$isArray_13(value) && _$filter_11(value, function (f) {
14799
- return typeof f === 'function';
14800
- }).length === value.length;
14801
- };
14802
-
14803
- var _$stringWithLength_27 = function (value) {
14804
- return typeof value === 'string' && !!value.length;
14805
- };
14806
-
14807
- var _$config_3 = {};
14808
-
14809
- var defaultErrorTypes = function () {
14810
- return {
14811
- unhandledExceptions: true,
14812
- unhandledRejections: true
14813
- };
14814
- };
14815
-
14816
- _$config_3.schema = {
14817
- apiKey: {
14818
- defaultValue: function () {
14819
- return null;
14820
- },
14821
- message: 'is required',
14822
- validate: _$stringWithLength_27
14823
- },
14824
- appVersion: {
14825
- defaultValue: function () {
14826
- return undefined;
14827
- },
14828
- message: 'should be a string',
14829
- validate: function (value) {
14830
- return value === undefined || _$stringWithLength_27(value);
14831
- }
14832
- },
14833
- appType: {
14834
- defaultValue: function () {
14835
- return undefined;
14836
- },
14837
- message: 'should be a string',
14838
- validate: function (value) {
14839
- return value === undefined || _$stringWithLength_27(value);
14840
- }
14841
- },
14842
- autoDetectErrors: {
14843
- defaultValue: function () {
14844
- return true;
14845
- },
14846
- message: 'should be true|false',
14847
- validate: function (value) {
14848
- return value === true || value === false;
14849
- }
14850
- },
14851
- enabledErrorTypes: {
14852
- defaultValue: function () {
14853
- return defaultErrorTypes();
14854
- },
14855
- message: 'should be an object containing the flags { unhandledExceptions:true|false, unhandledRejections:true|false }',
14856
- allowPartialObject: true,
14857
- validate: function (value) {
14858
- // ensure we have an object
14859
- if (typeof value !== 'object' || !value) return false;
14860
- var providedKeys = _$keys_14(value);
14861
- var defaultKeys = _$keys_14(defaultErrorTypes()); // ensure it only has a subset of the allowed keys
14862
-
14863
- if (_$filter_11(providedKeys, function (k) {
14864
- return _$includes_12(defaultKeys, k);
14865
- }).length < providedKeys.length) return false; // ensure all of the values are boolean
14866
-
14867
- if (_$filter_11(_$keys_14(value), function (k) {
14868
- return typeof value[k] !== 'boolean';
14869
- }).length > 0) return false;
14870
- return true;
14871
- }
14872
- },
14873
- onError: {
14874
- defaultValue: function () {
14875
- return [];
14876
- },
14877
- message: 'should be a function or array of functions',
14878
- validate: _$listOfFunctions_26
14879
- },
14880
- onSession: {
14881
- defaultValue: function () {
14882
- return [];
14883
- },
14884
- message: 'should be a function or array of functions',
14885
- validate: _$listOfFunctions_26
14886
- },
14887
- onBreadcrumb: {
14888
- defaultValue: function () {
14889
- return [];
14890
- },
14891
- message: 'should be a function or array of functions',
14892
- validate: _$listOfFunctions_26
14893
- },
14894
- endpoints: {
14895
- defaultValue: function () {
14896
- return {
14897
- notify: 'https://notify.bugsnag.com',
14898
- sessions: 'https://sessions.bugsnag.com'
14899
- };
14900
- },
14901
- message: 'should be an object containing endpoint URLs { notify, sessions }',
14902
- validate: function (val) {
14903
- return (// first, ensure it's an object
14904
- val && typeof val === 'object' && // notify and sessions must always be set
14905
- _$stringWithLength_27(val.notify) && _$stringWithLength_27(val.sessions) && // ensure no keys other than notify/session are set on endpoints object
14906
- _$filter_11(_$keys_14(val), function (k) {
14907
- return !_$includes_12(['notify', 'sessions'], k);
14908
- }).length === 0
14909
- );
14910
- }
14911
- },
14912
- autoTrackSessions: {
14913
- defaultValue: function (val) {
14914
- return true;
14915
- },
14916
- message: 'should be true|false',
14917
- validate: function (val) {
14918
- return val === true || val === false;
14919
- }
14920
- },
14921
- enabledReleaseStages: {
14922
- defaultValue: function () {
14923
- return null;
14924
- },
14925
- message: 'should be an array of strings',
14926
- validate: function (value) {
14927
- return value === null || _$isArray_13(value) && _$filter_11(value, function (f) {
14928
- return typeof f === 'string';
14929
- }).length === value.length;
14930
- }
14931
- },
14932
- releaseStage: {
14933
- defaultValue: function () {
14934
- return 'production';
14935
- },
14936
- message: 'should be a string',
14937
- validate: function (value) {
14938
- return typeof value === 'string' && value.length;
14939
- }
14940
- },
14941
- maxBreadcrumbs: {
14942
- defaultValue: function () {
14943
- return 25;
14944
- },
14945
- message: 'should be a number ≤100',
14946
- validate: function (value) {
14947
- return _$intRange_25(0, 100)(value);
14948
- }
14949
- },
14950
- enabledBreadcrumbTypes: {
14951
- defaultValue: function () {
14952
- return _$breadcrumbTypes_6;
14953
- },
14954
- message: "should be null or a list of available breadcrumb types (" + _$breadcrumbTypes_6.join(',') + ")",
14955
- validate: function (value) {
14956
- return value === null || _$isArray_13(value) && _$reduce_16(value, function (accum, maybeType) {
14957
- if (accum === false) return accum;
14958
- return _$includes_12(_$breadcrumbTypes_6, maybeType);
14959
- }, true);
14960
- }
14961
- },
14962
- context: {
14963
- defaultValue: function () {
14964
- return undefined;
14965
- },
14966
- message: 'should be a string',
14967
- validate: function (value) {
14968
- return value === undefined || typeof value === 'string';
14969
- }
14970
- },
14971
- user: {
14972
- defaultValue: function () {
14973
- return {};
14974
- },
14975
- message: 'should be an object with { id, email, name } properties',
14976
- validate: function (value) {
14977
- return value === null || value && _$reduce_16(_$keys_14(value), function (accum, key) {
14978
- return accum && _$includes_12(['id', 'email', 'name'], key);
14979
- }, true);
14980
- }
14981
- },
14982
- metadata: {
14983
- defaultValue: function () {
14984
- return {};
14985
- },
14986
- message: 'should be an object',
14987
- validate: function (value) {
14988
- return typeof value === 'object' && value !== null;
14989
- }
14990
- },
14991
- logger: {
14992
- defaultValue: function () {
14993
- return undefined;
14994
- },
14995
- message: 'should be null or an object with methods { debug, info, warn, error }',
14996
- validate: function (value) {
14997
- return !value || value && _$reduce_16(['debug', 'info', 'warn', 'error'], function (accum, method) {
14998
- return accum && typeof value[method] === 'function';
14999
- }, true);
15000
- }
15001
- },
15002
- redactedKeys: {
15003
- defaultValue: function () {
15004
- return ['password'];
15005
- },
15006
- message: 'should be an array of strings|regexes',
15007
- validate: function (value) {
15008
- return _$isArray_13(value) && value.length === _$filter_11(value, function (s) {
15009
- return typeof s === 'string' || s && typeof s.test === 'function';
15010
- }).length;
15011
- }
15012
- },
15013
- plugins: {
15014
- defaultValue: function () {
15015
- return [];
15016
- },
15017
- message: 'should be an array of plugin objects',
15018
- validate: function (value) {
15019
- return _$isArray_13(value) && value.length === _$filter_11(value, function (p) {
15020
- return p && typeof p === 'object' && typeof p.load === 'function';
15021
- }).length;
15022
- }
15023
- },
15024
- featureFlags: {
15025
- defaultValue: function () {
15026
- return [];
15027
- },
15028
- message: 'should be an array of objects that have a "name" property',
15029
- validate: function (value) {
15030
- return _$isArray_13(value) && value.length === _$filter_11(value, function (feature) {
15031
- return feature && typeof feature === 'object' && typeof feature.name === 'string';
15032
- }).length;
15033
- }
15034
- }
15035
- };
15036
-
15037
- var _$errorStackParser_9 = errorStackParser;
15038
-
15039
- // extends helper from babel
15040
- // https://github.com/babel/babel/blob/916429b516e6466fd06588ee820e40e025d7f3a3/packages/babel-helpers/src/helpers.js#L377-L393
15041
- var _$assign_10 = function (target) {
15042
- for (var i = 1; i < arguments.length; i++) {
15043
- var source = arguments[i];
15044
-
15045
- for (var key in source) {
15046
- if (Object.prototype.hasOwnProperty.call(source, key)) {
15047
- target[key] = source[key];
15048
- }
15049
- }
15050
- }
15051
-
15052
- return target;
15053
- };
15054
-
15055
-
15056
- var _$map_15 = function (arr, fn) {
15057
- return _$reduce_16(arr, function (accum, item, i, arr) {
15058
- return accum.concat(fn(item, i, arr));
15059
- }, []);
15060
- };
15061
-
15062
- var _$safeJsonStringify_31 = function (data, replacer, space, opts) {
15063
- var redactedKeys = opts && opts.redactedKeys ? opts.redactedKeys : [];
15064
- var redactedPaths = opts && opts.redactedPaths ? opts.redactedPaths : [];
15065
- return JSON.stringify(prepareObjForSerialization(data, redactedKeys, redactedPaths), replacer, space);
15066
- };
15067
-
15068
- var MAX_DEPTH = 20;
15069
- var MAX_EDGES = 25000;
15070
- var MIN_PRESERVED_DEPTH = 8;
15071
- var REPLACEMENT_NODE = '...';
15072
-
15073
- function isError(o) {
15074
- return o instanceof Error || /^\[object (Error|(Dom)?Exception)\]$/.test(Object.prototype.toString.call(o));
15075
- }
15076
-
15077
- function throwsMessage(err) {
15078
- return '[Throws: ' + (err ? err.message : '?') + ']';
15079
- }
15080
-
15081
- function find(haystack, needle) {
15082
- for (var i = 0, len = haystack.length; i < len; i++) {
15083
- if (haystack[i] === needle) return true;
15084
- }
15085
-
15086
- return false;
15087
- } // returns true if the string `path` starts with any of the provided `paths`
15088
-
15089
-
15090
- function isDescendent(paths, path) {
15091
- for (var i = 0, len = paths.length; i < len; i++) {
15092
- if (path.indexOf(paths[i]) === 0) return true;
15093
- }
15094
-
15095
- return false;
15096
- }
15097
-
15098
- function shouldRedact(patterns, key) {
15099
- for (var i = 0, len = patterns.length; i < len; i++) {
15100
- if (typeof patterns[i] === 'string' && patterns[i].toLowerCase() === key.toLowerCase()) return true;
15101
- if (patterns[i] && typeof patterns[i].test === 'function' && patterns[i].test(key)) return true;
15102
- }
15103
-
15104
- return false;
15105
- }
15106
-
15107
- function __isArray_31(obj) {
15108
- return Object.prototype.toString.call(obj) === '[object Array]';
15109
- }
15110
-
15111
- function safelyGetProp(obj, prop) {
15112
- try {
15113
- return obj[prop];
15114
- } catch (err) {
15115
- return throwsMessage(err);
15116
- }
15117
- }
15118
-
15119
- function prepareObjForSerialization(obj, redactedKeys, redactedPaths) {
15120
- var seen = []; // store references to objects we have seen before
15121
-
15122
- var edges = 0;
15123
-
15124
- function visit(obj, path) {
15125
- function edgesExceeded() {
15126
- return path.length > MIN_PRESERVED_DEPTH && edges > MAX_EDGES;
15127
- }
15128
-
15129
- edges++;
15130
- if (path.length > MAX_DEPTH) return REPLACEMENT_NODE;
15131
- if (edgesExceeded()) return REPLACEMENT_NODE;
15132
- if (obj === null || typeof obj !== 'object') return obj;
15133
- if (find(seen, obj)) return '[Circular]';
15134
- seen.push(obj);
15135
-
15136
- if (typeof obj.toJSON === 'function') {
15137
- try {
15138
- // we're not going to count this as an edge because it
15139
- // replaces the value of the currently visited object
15140
- edges--;
15141
- var fResult = visit(obj.toJSON(), path);
15142
- seen.pop();
15143
- return fResult;
15144
- } catch (err) {
15145
- return throwsMessage(err);
15146
- }
15147
- }
15148
-
15149
- var er = isError(obj);
15150
-
15151
- if (er) {
15152
- edges--;
15153
- var eResult = visit({
15154
- name: obj.name,
15155
- message: obj.message
15156
- }, path);
15157
- seen.pop();
15158
- return eResult;
15159
- }
15160
-
15161
- if (__isArray_31(obj)) {
15162
- var aResult = [];
15163
-
15164
- for (var i = 0, len = obj.length; i < len; i++) {
15165
- if (edgesExceeded()) {
15166
- aResult.push(REPLACEMENT_NODE);
15167
- break;
15168
- }
15169
-
15170
- aResult.push(visit(obj[i], path.concat('[]')));
15171
- }
15172
-
15173
- seen.pop();
15174
- return aResult;
15175
- }
15176
-
15177
- var result = {};
15178
-
15179
- try {
15180
- for (var prop in obj) {
15181
- if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue;
15182
-
15183
- if (isDescendent(redactedPaths, path.join('.')) && shouldRedact(redactedKeys, prop)) {
15184
- result[prop] = '[REDACTED]';
15185
- continue;
15186
- }
15187
-
15188
- if (edgesExceeded()) {
15189
- result[prop] = REPLACEMENT_NODE;
15190
- break;
15191
- }
15192
-
15193
- result[prop] = visit(safelyGetProp(obj, prop), path.concat(prop));
15194
- }
15195
- } catch (e) {}
15196
-
15197
- seen.pop();
15198
- return result;
15199
- }
15200
-
15201
- return visit(obj, []);
15202
- }
15203
-
15204
- function add(existingFeatures, existingFeatureKeys, name, variant) {
15205
- if (typeof name !== 'string') {
15206
- return;
15207
- }
15208
-
15209
- if (variant === undefined) {
15210
- variant = null;
15211
- } else if (variant !== null && typeof variant !== 'string') {
15212
- variant = _$safeJsonStringify_31(variant);
15213
- }
15214
-
15215
- var existingIndex = existingFeatureKeys[name];
15216
-
15217
- if (typeof existingIndex === 'number') {
15218
- existingFeatures[existingIndex] = {
15219
- name: name,
15220
- variant: variant
15221
- };
15222
- return;
15223
- }
15224
-
15225
- existingFeatures.push({
15226
- name: name,
15227
- variant: variant
15228
- });
15229
- existingFeatureKeys[name] = existingFeatures.length - 1;
15230
- }
15231
-
15232
- function merge(existingFeatures, newFeatures, existingFeatureKeys) {
15233
- if (!_$isArray_13(newFeatures)) {
15234
- return;
15235
- }
15236
-
15237
- for (var i = 0; i < newFeatures.length; ++i) {
15238
- var feature = newFeatures[i];
15239
-
15240
- if (feature === null || typeof feature !== 'object') {
15241
- continue;
15242
- } // 'add' will handle if 'name' doesn't exist & 'variant' is optional
15243
-
15244
-
15245
- add(existingFeatures, existingFeatureKeys, feature.name, feature.variant);
15246
- }
15247
-
15248
- return existingFeatures;
15249
- } // convert feature flags from a map of 'name -> variant' into the format required
15250
- // by the Bugsnag Event API:
15251
- // [{ featureFlag: 'name', variant: 'variant' }, { featureFlag: 'name 2' }]
15252
-
15253
-
15254
- function toEventApi(featureFlags) {
15255
- return _$map_15(_$filter_11(featureFlags, Boolean), function (_ref) {
15256
- var name = _ref.name,
15257
- variant = _ref.variant;
15258
- var flag = {
15259
- featureFlag: name
15260
- }; // don't add a 'variant' property unless there's actually a value
15261
-
15262
- if (typeof variant === 'string') {
15263
- flag.variant = variant;
15264
- }
15265
-
15266
- return flag;
15267
- });
15268
- }
15269
-
15270
- function clear(features, featuresIndex, name) {
15271
- var existingIndex = featuresIndex[name];
15272
-
15273
- if (typeof existingIndex === 'number') {
15274
- features[existingIndex] = null;
15275
- delete featuresIndex[name];
15276
- }
15277
- }
15278
-
15279
- var _$featureFlagDelegate_17 = {
15280
- add: add,
15281
- clear: clear,
15282
- merge: merge,
15283
- toEventApi: toEventApi
15284
- };
15285
-
15286
- // Given `err` which may be an error, does it have a stack property which is a string?
15287
- var _$hasStack_18 = function (err) {
15288
- return !!err && (!!err.stack || !!err.stacktrace || !!err['opera#sourceloc']) && typeof (err.stack || err.stacktrace || err['opera#sourceloc']) === 'string' && err.stack !== err.name + ": " + err.message;
15289
- };
15290
-
15291
- var _$iserror_19 = iserror;
15292
-
15293
- var __add_21 = function (state, section, keyOrObj, maybeVal) {
15294
- var _updates;
15295
-
15296
- if (!section) return;
15297
- var updates; // addMetadata("section", null) -> clears section
15298
-
15299
- if (keyOrObj === null) return __clear_21(state, section); // normalise the two supported input types into object form
15300
-
15301
- if (typeof keyOrObj === 'object') updates = keyOrObj;
15302
- if (typeof keyOrObj === 'string') updates = (_updates = {}, _updates[keyOrObj] = maybeVal, _updates); // exit if we don't have an updates object at this point
15303
-
15304
- if (!updates) return; // ensure a section with this name exists
15305
-
15306
- if (!state[section]) state[section] = {}; // merge the updates with the existing section
15307
-
15308
- state[section] = _$assign_10({}, state[section], updates);
15309
- };
15310
-
15311
- var get = function (state, section, key) {
15312
- if (typeof section !== 'string') return undefined;
15313
-
15314
- if (!key) {
15315
- return state[section];
15316
- }
15317
-
15318
- if (state[section]) {
15319
- return state[section][key];
15320
- }
15321
-
15322
- return undefined;
15323
- };
15324
-
15325
- var __clear_21 = function (state, section, key) {
15326
- if (typeof section !== 'string') return; // clear an entire section
15327
-
15328
- if (!key) {
15329
- delete state[section];
15330
- return;
15331
- } // clear a single value from a section
15332
-
15333
-
15334
- if (state[section]) {
15335
- delete state[section][key];
15336
- }
15337
- };
15338
-
15339
- var _$metadataDelegate_21 = {
15340
- add: __add_21,
15341
- get: get,
15342
- clear: __clear_21
15343
- };
15344
-
15345
- var StackGenerator = stackGenerator;
15346
-
15347
- var Event = /*#__PURE__*/function () {
15348
- function Event(errorClass, errorMessage, stacktrace, handledState, originalError) {
15349
- if (stacktrace === void 0) {
15350
- stacktrace = [];
15351
- }
15352
-
15353
- if (handledState === void 0) {
15354
- handledState = defaultHandledState();
15355
- }
15356
-
15357
- this.apiKey = undefined;
15358
- this.context = undefined;
15359
- this.groupingHash = undefined;
15360
- this.originalError = originalError;
15361
- this._handledState = handledState;
15362
- this.severity = this._handledState.severity;
15363
- this.unhandled = this._handledState.unhandled;
15364
- this.app = {};
15365
- this.device = {};
15366
- this.request = {};
15367
- this.breadcrumbs = [];
15368
- this.threads = [];
15369
- this._metadata = {};
15370
- this._features = [];
15371
- this._featuresIndex = {};
15372
- this._user = {};
15373
- this._session = undefined;
15374
- this.errors = [createBugsnagError(errorClass, errorMessage, Event.__type, stacktrace)]; // Flags.
15375
- // Note these are not initialised unless they are used
15376
- // to save unnecessary bytes in the browser bundle
15377
-
15378
- /* this.attemptImmediateDelivery, default: true */
15379
- }
15380
-
15381
- var _proto = Event.prototype;
15382
-
15383
- _proto.addMetadata = function addMetadata(section, keyOrObj, maybeVal) {
15384
- return _$metadataDelegate_21.add(this._metadata, section, keyOrObj, maybeVal);
15385
- };
15386
-
15387
- _proto.getMetadata = function getMetadata(section, key) {
15388
- return _$metadataDelegate_21.get(this._metadata, section, key);
15389
- };
15390
-
15391
- _proto.clearMetadata = function clearMetadata(section, key) {
15392
- return _$metadataDelegate_21.clear(this._metadata, section, key);
15393
- };
15394
-
15395
- _proto.addFeatureFlag = function addFeatureFlag(name, variant) {
15396
- if (variant === void 0) {
15397
- variant = null;
15398
- }
15399
-
15400
- _$featureFlagDelegate_17.add(this._features, this._featuresIndex, name, variant);
15401
- };
15402
-
15403
- _proto.addFeatureFlags = function addFeatureFlags(featureFlags) {
15404
- _$featureFlagDelegate_17.merge(this._features, featureFlags, this._featuresIndex);
15405
- };
15406
-
15407
- _proto.getFeatureFlags = function getFeatureFlags() {
15408
- return _$featureFlagDelegate_17.toEventApi(this._features);
15409
- };
15410
-
15411
- _proto.clearFeatureFlag = function clearFeatureFlag(name) {
15412
- _$featureFlagDelegate_17.clear(this._features, this._featuresIndex, name);
15413
- };
15414
-
15415
- _proto.clearFeatureFlags = function clearFeatureFlags() {
15416
- this._features = [];
15417
- this._featuresIndex = {};
15418
- };
15419
-
15420
- _proto.getUser = function getUser() {
15421
- return this._user;
15422
- };
15423
-
15424
- _proto.setUser = function setUser(id, email, name) {
15425
- this._user = {
15426
- id: id,
15427
- email: email,
15428
- name: name
15429
- };
15430
- };
15431
-
15432
- _proto.toJSON = function toJSON() {
15433
- return {
15434
- payloadVersion: '4',
15435
- exceptions: _$map_15(this.errors, function (er) {
15436
- return _$assign_10({}, er, {
15437
- message: er.errorMessage
15438
- });
15439
- }),
15440
- severity: this.severity,
15441
- unhandled: this._handledState.unhandled,
15442
- severityReason: this._handledState.severityReason,
15443
- app: this.app,
15444
- device: this.device,
15445
- request: this.request,
15446
- breadcrumbs: this.breadcrumbs,
15447
- context: this.context,
15448
- groupingHash: this.groupingHash,
15449
- metaData: this._metadata,
15450
- user: this._user,
15451
- session: this._session,
15452
- featureFlags: this.getFeatureFlags()
15453
- };
15454
- };
15455
-
15456
- return Event;
15457
- }(); // takes a stacktrace.js style stackframe (https://github.com/stacktracejs/stackframe)
15458
- // and returns a Bugsnag compatible stackframe (https://docs.bugsnag.com/api/error-reporting/#json-payload)
15459
-
15460
-
15461
- var formatStackframe = function (frame) {
15462
- var f = {
15463
- file: frame.fileName,
15464
- method: normaliseFunctionName(frame.functionName),
15465
- lineNumber: frame.lineNumber,
15466
- columnNumber: frame.columnNumber,
15467
- code: undefined,
15468
- inProject: undefined
15469
- }; // Some instances result in no file:
15470
- // - calling notify() from chrome's terminal results in no file/method.
15471
- // - non-error exception thrown from global code in FF
15472
- // This adds one.
15473
-
15474
- if (f.lineNumber > -1 && !f.file && !f.method) {
15475
- f.file = 'global code';
15476
- }
15477
-
15478
- return f;
15479
- };
15480
-
15481
- var normaliseFunctionName = function (name) {
15482
- return /^global code$/i.test(name) ? 'global code' : name;
15483
- };
15484
-
15485
- var defaultHandledState = function () {
15486
- return {
15487
- unhandled: false,
15488
- severity: 'warning',
15489
- severityReason: {
15490
- type: 'handledException'
15491
- }
15492
- };
15493
- };
15494
-
15495
- var ensureString = function (str) {
15496
- return typeof str === 'string' ? str : '';
15497
- };
15498
-
15499
- function createBugsnagError(errorClass, errorMessage, type, stacktrace) {
15500
- return {
15501
- errorClass: ensureString(errorClass),
15502
- errorMessage: ensureString(errorMessage),
15503
- type: type,
15504
- stacktrace: _$reduce_16(stacktrace, function (accum, frame) {
15505
- var f = formatStackframe(frame); // don't include a stackframe if none of its properties are defined
15506
-
15507
- try {
15508
- if (JSON.stringify(f) === '{}') return accum;
15509
- return accum.concat(f);
15510
- } catch (e) {
15511
- return accum;
15512
- }
15513
- }, [])
15514
- };
15515
- }
15516
-
15517
- function getCauseStack(error) {
15518
- if (error.cause) {
15519
- return [error].concat(getCauseStack(error.cause));
15520
- } else {
15521
- return [error];
15522
- }
15523
- } // Helpers
15524
-
15525
-
15526
- Event.getStacktrace = function (error, errorFramesToSkip, backtraceFramesToSkip) {
15527
- if (_$hasStack_18(error)) return _$errorStackParser_9.parse(error).slice(errorFramesToSkip); // error wasn't provided or didn't have a stacktrace so try to walk the callstack
15528
-
15529
- try {
15530
- return _$filter_11(StackGenerator.backtrace(), function (frame) {
15531
- return (frame.functionName || '').indexOf('StackGenerator$$') === -1;
15532
- }).slice(1 + backtraceFramesToSkip);
15533
- } catch (e) {
15534
- return [];
15535
- }
15536
- };
15537
-
15538
- Event.create = function (maybeError, tolerateNonErrors, handledState, component, errorFramesToSkip, logger) {
15539
- if (errorFramesToSkip === void 0) {
15540
- errorFramesToSkip = 0;
15541
- }
15542
-
15543
- var _normaliseError = normaliseError(maybeError, tolerateNonErrors, component, logger),
15544
- error = _normaliseError[0],
15545
- internalFrames = _normaliseError[1];
15546
-
15547
- var event;
15548
-
15549
- try {
15550
- var stacktrace = Event.getStacktrace(error, // if an error was created/throw in the normaliseError() function, we need to
15551
- // tell the getStacktrace() function to skip the number of frames we know will
15552
- // be from our own functions. This is added to the number of frames deep we
15553
- // were told about
15554
- internalFrames > 0 ? 1 + internalFrames + errorFramesToSkip : 0, // if there's no stacktrace, the callstack may be walked to generated one.
15555
- // this is how many frames should be removed because they come from our library
15556
- 1 + errorFramesToSkip);
15557
- event = new Event(error.name, error.message, stacktrace, handledState, maybeError);
15558
- } catch (e) {
15559
- event = new Event(error.name, error.message, [], handledState, maybeError);
15560
- }
15561
-
15562
- if (error.name === 'InvalidError') {
15563
- event.addMetadata("" + component, 'non-error parameter', makeSerialisable(maybeError));
15564
- }
15565
-
15566
- if (error.cause) {
15567
- var _event$errors;
15568
-
15569
- var causes = getCauseStack(error).slice(1);
15570
- var normalisedCauses = _$map_15(causes, function (cause) {
15571
- // Only get stacktrace for error causes that are a valid JS Error and already have a stack
15572
- var stacktrace = _$iserror_19(cause) && _$hasStack_18(cause) ? _$errorStackParser_9.parse(cause) : [];
15573
-
15574
- var _normaliseError2 = normaliseError(cause, true, 'error cause'),
15575
- error = _normaliseError2[0];
15576
-
15577
- if (error.name === 'InvalidError') event.addMetadata('error cause', makeSerialisable(cause));
15578
- return createBugsnagError(error.name, error.message, Event.__type, stacktrace);
15579
- });
15580
-
15581
- (_event$errors = event.errors).push.apply(_event$errors, normalisedCauses);
15582
- }
15583
-
15584
- return event;
15585
- };
15586
-
15587
- var makeSerialisable = function (err) {
15588
- if (err === null) return 'null';
15589
- if (err === undefined) return 'undefined';
15590
- return err;
15591
- };
15592
-
15593
- var normaliseError = function (maybeError, tolerateNonErrors, component, logger) {
15594
- var error;
15595
- var internalFrames = 0;
15596
-
15597
- var createAndLogInputError = function (reason) {
15598
- var verb = component === 'error cause' ? 'was' : 'received';
15599
- if (logger) logger.warn(component + " " + verb + " a non-error: \"" + reason + "\"");
15600
- var err = new Error(component + " " + verb + " a non-error. See \"" + component + "\" tab for more detail.");
15601
- err.name = 'InvalidError';
15602
- return err;
15603
- }; // In some cases:
15604
- //
15605
- // - the promise rejection handler (both in the browser and node)
15606
- // - the node uncaughtException handler
15607
- //
15608
- // We are really limited in what we can do to get a stacktrace. So we use the
15609
- // tolerateNonErrors option to ensure that the resulting error communicates as
15610
- // such.
15611
-
15612
-
15613
- if (!tolerateNonErrors) {
15614
- if (_$iserror_19(maybeError)) {
15615
- error = maybeError;
15616
- } else {
15617
- error = createAndLogInputError(typeof maybeError);
15618
- internalFrames += 2;
15619
- }
15620
- } else {
15621
- switch (typeof maybeError) {
15622
- case 'string':
15623
- case 'number':
15624
- case 'boolean':
15625
- error = new Error(String(maybeError));
15626
- internalFrames += 1;
15627
- break;
15628
-
15629
- case 'function':
15630
- error = createAndLogInputError('function');
15631
- internalFrames += 2;
15632
- break;
15633
-
15634
- case 'object':
15635
- if (maybeError !== null && _$iserror_19(maybeError)) {
15636
- error = maybeError;
15637
- } else if (maybeError !== null && hasNecessaryFields(maybeError)) {
15638
- error = new Error(maybeError.message || maybeError.errorMessage);
15639
- error.name = maybeError.name || maybeError.errorClass;
15640
- internalFrames += 1;
15641
- } else {
15642
- error = createAndLogInputError(maybeError === null ? 'null' : 'unsupported object');
15643
- internalFrames += 2;
15644
- }
15645
-
15646
- break;
15647
-
15648
- default:
15649
- error = createAndLogInputError('nothing');
15650
- internalFrames += 2;
15651
- }
15652
- }
15653
-
15654
- if (!_$hasStack_18(error)) {
15655
- // in IE10/11 a new Error() doesn't have a stacktrace until you throw it, so try that here
15656
- try {
15657
- throw error;
15658
- } catch (e) {
15659
- if (_$hasStack_18(e)) {
15660
- error = e; // if the error only got a stacktrace after we threw it here, we know it
15661
- // will only have one extra internal frame from this function, regardless
15662
- // of whether it went through createAndLogInputError() or not
15663
-
15664
- internalFrames = 1;
15665
- }
15666
- }
15667
- }
15668
-
15669
- return [error, internalFrames];
15670
- }; // default value for stacktrace.type
15671
-
15672
-
15673
- Event.__type = 'browserjs';
15674
-
15675
- var hasNecessaryFields = function (error) {
15676
- return (typeof error.name === 'string' || typeof error.errorClass === 'string') && (typeof error.message === 'string' || typeof error.errorMessage === 'string');
15677
- };
15678
-
15679
- var _$Event_4 = Event;
15680
-
15681
- // This is a heavily modified/simplified version of
15682
- // https://github.com/othiym23/async-some
15683
- // with the logic flipped so that it is akin to the
15684
- // synchronous "every" method instead of "some".
15685
- // run the asynchronous test function (fn) over each item in the array (arr)
15686
- // in series until:
15687
- // - fn(item, cb) => calls cb(null, false)
15688
- // - or the end of the array is reached
15689
- // the callback (cb) will be passed (null, false) if any of the items in arr
15690
- // caused fn to call back with false, otherwise it will be passed (null, true)
15691
- var _$asyncEvery_5 = function (arr, fn, cb) {
15692
- var index = 0;
15693
-
15694
- var next = function () {
15695
- if (index >= arr.length) return cb(null, true);
15696
- fn(arr[index], function (err, result) {
15697
- if (err) return cb(err);
15698
- if (result === false) return cb(null, false);
15699
- index++;
15700
- next();
15701
- });
15702
- };
15703
-
15704
- next();
15705
- };
15706
-
15707
- var _$callbackRunner_7 = function (callbacks, event, onCallbackError, cb) {
15708
- // This function is how we support different kinds of callback:
15709
- // - synchronous - return value
15710
- // - node-style async with callback - cb(err, value)
15711
- // - promise/thenable - resolve(value)
15712
- // It normalises each of these into the lowest common denominator – a node-style callback
15713
- var runMaybeAsyncCallback = function (fn, cb) {
15714
- if (typeof fn !== 'function') return cb(null);
15715
-
15716
- try {
15717
- // if function appears sync…
15718
- if (fn.length !== 2) {
15719
- var ret = fn(event); // check if it returned a "thenable" (promise)
15720
-
15721
- if (ret && typeof ret.then === 'function') {
15722
- return ret.then( // resolve
15723
- function (val) {
15724
- return setTimeout(function () {
15725
- return cb(null, val);
15726
- });
15727
- }, // reject
15728
- function (err) {
15729
- setTimeout(function () {
15730
- onCallbackError(err);
15731
- return cb(null, true);
15732
- });
15733
- });
15734
- }
15735
-
15736
- return cb(null, ret);
15737
- } // if function is async…
15738
-
15739
-
15740
- fn(event, function (err, result) {
15741
- if (err) {
15742
- onCallbackError(err);
15743
- return cb(null);
15744
- }
15745
-
15746
- cb(null, result);
15747
- });
15748
- } catch (e) {
15749
- onCallbackError(e);
15750
- cb(null);
15751
- }
15752
- };
15753
-
15754
- _$asyncEvery_5(callbacks, runMaybeAsyncCallback, cb);
15755
- };
15756
-
15757
- var _$syncCallbackRunner_24 = function (callbacks, callbackArg, callbackType, logger) {
15758
- var ignore = false;
15759
- var cbs = callbacks.slice();
15760
-
15761
- while (!ignore) {
15762
- if (!cbs.length) break;
15763
-
15764
- try {
15765
- ignore = cbs.pop()(callbackArg) === false;
15766
- } catch (e) {
15767
- logger.error("Error occurred in " + callbackType + " callback, continuing anyway\u2026");
15768
- logger.error(e);
15769
- }
15770
- }
15771
-
15772
- return ignore;
15773
- };
15774
-
15775
- var _$pad_30 = function pad(num, size) {
15776
- var s = '000000000' + num;
15777
- return s.substr(s.length - size);
15778
- };
15779
-
15780
- var os$1 = os,
15781
- padding = 2,
15782
- pid = _$pad_30(process.pid.toString(36), padding),
15783
- hostname = os$1.hostname(),
15784
- length = hostname.length,
15785
- hostId = _$pad_30(hostname.split('').reduce(function (prev, char) {
15786
- return +prev + char.charCodeAt(0);
15787
- }, +length + 36).toString(36), padding);
15788
-
15789
- var _$fingerprint_29 = function fingerprint() {
15790
- return pid + hostId;
15791
- };
15792
-
15793
- var c = 0,
15794
- blockSize = 4,
15795
- base = 36,
15796
- discreteValues = Math.pow(base, blockSize);
15797
-
15798
- function randomBlock() {
15799
- return _$pad_30((Math.random() * discreteValues << 0).toString(base), blockSize);
15800
- }
15801
-
15802
- function safeCounter() {
15803
- c = c < discreteValues ? c : 0;
15804
- c++; // this is not subliminal
15805
-
15806
- return c - 1;
15807
- }
15808
-
15809
- function cuid() {
15810
- // Starting with a lowercase letter makes
15811
- // it HTML element ID friendly.
15812
- var letter = 'c',
15813
- // hard-coded allows for sequential access
15814
- // timestamp
15815
- // warning: this exposes the exact date and time
15816
- // that the uid was created.
15817
- timestamp = new Date().getTime().toString(base),
15818
- // Prevent same-machine collisions.
15819
- counter = _$pad_30(safeCounter().toString(base), blockSize),
15820
- // A few chars to generate distinct ids for different
15821
- // clients (so different computers are far less
15822
- // likely to generate the same id)
15823
- print = _$fingerprint_29(),
15824
- // Grab some more chars from Math.random()
15825
- random = randomBlock() + randomBlock();
15826
- return letter + timestamp + counter + print + random;
15827
- }
15828
-
15829
- cuid.fingerprint = _$fingerprint_29;
15830
- var _$cuid_28 = cuid;
15831
-
15832
- var Session = /*#__PURE__*/function () {
15833
- function Session() {
15834
- this.id = _$cuid_28();
15835
- this.startedAt = new Date();
15836
- this._handled = 0;
15837
- this._unhandled = 0;
15838
- this._user = {};
15839
- this.app = {};
15840
- this.device = {};
15841
- }
15842
-
15843
- var _proto = Session.prototype;
15844
-
15845
- _proto.getUser = function getUser() {
15846
- return this._user;
15847
- };
15848
-
15849
- _proto.setUser = function setUser(id, email, name) {
15850
- this._user = {
15851
- id: id,
15852
- email: email,
15853
- name: name
15854
- };
15855
- };
15856
-
15857
- _proto.toJSON = function toJSON() {
15858
- return {
15859
- id: this.id,
15860
- startedAt: this.startedAt,
15861
- events: {
15862
- handled: this._handled,
15863
- unhandled: this._unhandled
15864
- }
15865
- };
15866
- };
15867
-
15868
- _proto._track = function _track(event) {
15869
- this[event._handledState.unhandled ? '_unhandled' : '_handled'] += 1;
15870
- };
15871
-
15872
- return Session;
15873
- }();
15874
-
15875
- var _$Session_32 = Session;
15876
-
15877
- var __add_2 = _$featureFlagDelegate_17.add,
15878
- __clear_2 = _$featureFlagDelegate_17.clear,
15879
- __merge_2 = _$featureFlagDelegate_17.merge;
15880
-
15881
- var noop = function () {};
15882
-
15883
- var Client = /*#__PURE__*/function () {
15884
- function Client(configuration, schema, internalPlugins, notifier) {
15885
- var _this = this;
15886
-
15887
- if (schema === void 0) {
15888
- schema = _$config_3.schema;
15889
- }
15890
-
15891
- if (internalPlugins === void 0) {
15892
- internalPlugins = [];
15893
- }
15894
-
15895
- // notifier id
15896
- this._notifier = notifier; // intialise opts and config
15897
-
15898
- this._config = {};
15899
- this._schema = schema; // i/o
15900
-
15901
- this._delivery = {
15902
- sendSession: noop,
15903
- sendEvent: noop
15904
- };
15905
- this._logger = {
15906
- debug: noop,
15907
- info: noop,
15908
- warn: noop,
15909
- error: noop
15910
- }; // plugins
15911
-
15912
- this._plugins = {}; // state
15913
-
15914
- this._breadcrumbs = [];
15915
- this._session = null;
15916
- this._metadata = {};
15917
- this._featuresIndex = {};
15918
- this._features = [];
15919
- this._context = undefined;
15920
- this._user = {}; // callbacks:
15921
- // e: onError
15922
- // s: onSession
15923
- // sp: onSessionPayload
15924
- // b: onBreadcrumb
15925
- // (note these names are minified by hand because object
15926
- // properties are not safe to minify automatically)
15927
-
15928
- this._cbs = {
15929
- e: [],
15930
- s: [],
15931
- sp: [],
15932
- b: []
15933
- }; // expose internal constructors
15934
-
15935
- this.Client = Client;
15936
- this.Event = _$Event_4;
15937
- this.Breadcrumb = _$Breadcrumb_1;
15938
- this.Session = _$Session_32;
15939
- this._config = this._configure(configuration, internalPlugins);
15940
- _$map_15(internalPlugins.concat(this._config.plugins), function (pl) {
15941
- if (pl) _this._loadPlugin(pl);
15942
- }); // when notify() is called we need to know how many frames are from our own source
15943
- // this inital value is 1 not 0 because we wrap notify() to ensure it is always
15944
- // bound to have the client as its `this` value – see below.
15945
-
15946
- this._depth = 1;
15947
- var self = this;
15948
- var notify = this.notify;
15949
-
15950
- this.notify = function () {
15951
- return notify.apply(self, arguments);
15952
- };
15953
- }
15954
-
15955
- var _proto = Client.prototype;
15956
-
15957
- _proto.addMetadata = function addMetadata(section, keyOrObj, maybeVal) {
15958
- return _$metadataDelegate_21.add(this._metadata, section, keyOrObj, maybeVal);
15959
- };
15960
-
15961
- _proto.getMetadata = function getMetadata(section, key) {
15962
- return _$metadataDelegate_21.get(this._metadata, section, key);
15963
- };
15964
-
15965
- _proto.clearMetadata = function clearMetadata(section, key) {
15966
- return _$metadataDelegate_21.clear(this._metadata, section, key);
15967
- };
15968
-
15969
- _proto.addFeatureFlag = function addFeatureFlag(name, variant) {
15970
- if (variant === void 0) {
15971
- variant = null;
15972
- }
15973
-
15974
- __add_2(this._features, this._featuresIndex, name, variant);
15975
- };
15976
-
15977
- _proto.addFeatureFlags = function addFeatureFlags(featureFlags) {
15978
- __merge_2(this._features, featureFlags, this._featuresIndex);
15979
- };
15980
-
15981
- _proto.clearFeatureFlag = function clearFeatureFlag(name) {
15982
- __clear_2(this._features, this._featuresIndex, name);
15983
- };
15984
-
15985
- _proto.clearFeatureFlags = function clearFeatureFlags() {
15986
- this._features = [];
15987
- this._featuresIndex = {};
15988
- };
15989
-
15990
- _proto.getContext = function getContext() {
15991
- return this._context;
15992
- };
15993
-
15994
- _proto.setContext = function setContext(c) {
15995
- this._context = c;
15996
- };
15997
-
15998
- _proto._configure = function _configure(opts, internalPlugins) {
15999
- var schema = _$reduce_16(internalPlugins, function (schema, plugin) {
16000
- if (plugin && plugin.configSchema) return _$assign_10({}, schema, plugin.configSchema);
16001
- return schema;
16002
- }, this._schema); // accumulate configuration and error messages
16003
-
16004
- var _reduce = _$reduce_16(_$keys_14(schema), function (accum, key) {
16005
- var defaultValue = schema[key].defaultValue(opts[key]);
16006
-
16007
- if (opts[key] !== undefined) {
16008
- var valid = schema[key].validate(opts[key]);
16009
-
16010
- if (!valid) {
16011
- accum.errors[key] = schema[key].message;
16012
- accum.config[key] = defaultValue;
16013
- } else {
16014
- if (schema[key].allowPartialObject) {
16015
- accum.config[key] = _$assign_10(defaultValue, opts[key]);
16016
- } else {
16017
- accum.config[key] = opts[key];
16018
- }
16019
- }
16020
- } else {
16021
- accum.config[key] = defaultValue;
16022
- }
16023
-
16024
- return accum;
16025
- }, {
16026
- errors: {},
16027
- config: {}
16028
- }),
16029
- errors = _reduce.errors,
16030
- config = _reduce.config;
16031
-
16032
- if (schema.apiKey) {
16033
- // missing api key is the only fatal error
16034
- if (!config.apiKey) throw new Error('No Bugsnag API Key set'); // warn about an apikey that is not of the expected format
16035
-
16036
- if (!/^[0-9a-f]{32}$/i.test(config.apiKey)) errors.apiKey = 'should be a string of 32 hexadecimal characters';
16037
- } // update and elevate some options
16038
-
16039
-
16040
- this._metadata = _$assign_10({}, config.metadata);
16041
- __merge_2(this._features, config.featureFlags, this._featuresIndex);
16042
- this._user = _$assign_10({}, config.user);
16043
- this._context = config.context;
16044
- if (config.logger) this._logger = config.logger; // add callbacks
16045
-
16046
- if (config.onError) this._cbs.e = this._cbs.e.concat(config.onError);
16047
- if (config.onBreadcrumb) this._cbs.b = this._cbs.b.concat(config.onBreadcrumb);
16048
- if (config.onSession) this._cbs.s = this._cbs.s.concat(config.onSession); // finally warn about any invalid config where we fell back to the default
16049
-
16050
- if (_$keys_14(errors).length) {
16051
- this._logger.warn(generateConfigErrorMessage(errors, opts));
16052
- }
16053
-
16054
- return config;
16055
- };
16056
-
16057
- _proto.getUser = function getUser() {
16058
- return this._user;
16059
- };
16060
-
16061
- _proto.setUser = function setUser(id, email, name) {
16062
- this._user = {
16063
- id: id,
16064
- email: email,
16065
- name: name
16066
- };
16067
- };
16068
-
16069
- _proto._loadPlugin = function _loadPlugin(plugin) {
16070
- var result = plugin.load(this); // JS objects are not the safest way to store arbitrarily keyed values,
16071
- // so bookend the key with some characters that prevent tampering with
16072
- // stuff like __proto__ etc. (only store the result if the plugin had a
16073
- // name)
16074
-
16075
- if (plugin.name) this._plugins["~" + plugin.name + "~"] = result;
16076
- return this;
16077
- };
16078
-
16079
- _proto.getPlugin = function getPlugin(name) {
16080
- return this._plugins["~" + name + "~"];
16081
- };
16082
-
16083
- _proto._setDelivery = function _setDelivery(d) {
16084
- this._delivery = d(this);
16085
- };
16086
-
16087
- _proto.startSession = function startSession() {
16088
- var session = new _$Session_32();
16089
- session.app.releaseStage = this._config.releaseStage;
16090
- session.app.version = this._config.appVersion;
16091
- session.app.type = this._config.appType;
16092
- session._user = _$assign_10({}, this._user); // run onSession callbacks
16093
-
16094
- var ignore = _$syncCallbackRunner_24(this._cbs.s, session, 'onSession', this._logger);
16095
-
16096
- if (ignore) {
16097
- this._logger.debug('Session not started due to onSession callback');
16098
-
16099
- return this;
16100
- }
16101
-
16102
- return this._sessionDelegate.startSession(this, session);
16103
- };
16104
-
16105
- _proto.addOnError = function addOnError(fn, front) {
16106
- if (front === void 0) {
16107
- front = false;
16108
- }
16109
-
16110
- this._cbs.e[front ? 'unshift' : 'push'](fn);
16111
- };
16112
-
16113
- _proto.removeOnError = function removeOnError(fn) {
16114
- this._cbs.e = _$filter_11(this._cbs.e, function (f) {
16115
- return f !== fn;
16116
- });
16117
- };
16118
-
16119
- _proto._addOnSessionPayload = function _addOnSessionPayload(fn) {
16120
- this._cbs.sp.push(fn);
16121
- };
16122
-
16123
- _proto.addOnSession = function addOnSession(fn) {
16124
- this._cbs.s.push(fn);
16125
- };
16126
-
16127
- _proto.removeOnSession = function removeOnSession(fn) {
16128
- this._cbs.s = _$filter_11(this._cbs.s, function (f) {
16129
- return f !== fn;
16130
- });
16131
- };
16132
-
16133
- _proto.addOnBreadcrumb = function addOnBreadcrumb(fn, front) {
16134
- if (front === void 0) {
16135
- front = false;
16136
- }
16137
-
16138
- this._cbs.b[front ? 'unshift' : 'push'](fn);
16139
- };
16140
-
16141
- _proto.removeOnBreadcrumb = function removeOnBreadcrumb(fn) {
16142
- this._cbs.b = _$filter_11(this._cbs.b, function (f) {
16143
- return f !== fn;
16144
- });
16145
- };
16146
-
16147
- _proto.pauseSession = function pauseSession() {
16148
- return this._sessionDelegate.pauseSession(this);
16149
- };
16150
-
16151
- _proto.resumeSession = function resumeSession() {
16152
- return this._sessionDelegate.resumeSession(this);
16153
- };
16154
-
16155
- _proto.leaveBreadcrumb = function leaveBreadcrumb(message, metadata, type) {
16156
- // coerce bad values so that the defaults get set
16157
- message = typeof message === 'string' ? message : '';
16158
- type = typeof type === 'string' && _$includes_12(_$breadcrumbTypes_6, type) ? type : 'manual';
16159
- metadata = typeof metadata === 'object' && metadata !== null ? metadata : {}; // if no message, discard
16160
-
16161
- if (!message) return;
16162
- var crumb = new _$Breadcrumb_1(message, metadata, type); // run onBreadcrumb callbacks
16163
-
16164
- var ignore = _$syncCallbackRunner_24(this._cbs.b, crumb, 'onBreadcrumb', this._logger);
16165
-
16166
- if (ignore) {
16167
- this._logger.debug('Breadcrumb not attached due to onBreadcrumb callback');
16168
-
16169
- return;
16170
- } // push the valid crumb onto the queue and maintain the length
16171
-
16172
-
16173
- this._breadcrumbs.push(crumb);
16174
-
16175
- if (this._breadcrumbs.length > this._config.maxBreadcrumbs) {
16176
- this._breadcrumbs = this._breadcrumbs.slice(this._breadcrumbs.length - this._config.maxBreadcrumbs);
16177
- }
16178
- };
16179
-
16180
- _proto._isBreadcrumbTypeEnabled = function _isBreadcrumbTypeEnabled(type) {
16181
- var types = this._config.enabledBreadcrumbTypes;
16182
- return types === null || _$includes_12(types, type);
16183
- };
16184
-
16185
- _proto.notify = function notify(maybeError, onError, postReportCallback) {
16186
- if (postReportCallback === void 0) {
16187
- postReportCallback = noop;
16188
- }
16189
-
16190
- var event = _$Event_4.create(maybeError, true, undefined, 'notify()', this._depth + 1, this._logger);
16191
-
16192
- this._notify(event, onError, postReportCallback);
16193
- };
16194
-
16195
- _proto._notify = function _notify(event, onError, postReportCallback) {
16196
- var _this2 = this;
16197
-
16198
- if (postReportCallback === void 0) {
16199
- postReportCallback = noop;
16200
- }
16201
-
16202
- event.app = _$assign_10({}, event.app, {
16203
- releaseStage: this._config.releaseStage,
16204
- version: this._config.appVersion,
16205
- type: this._config.appType
16206
- });
16207
- event.context = event.context || this._context;
16208
- event._metadata = _$assign_10({}, event._metadata, this._metadata);
16209
- event._user = _$assign_10({}, event._user, this._user);
16210
- event.breadcrumbs = this._breadcrumbs.slice();
16211
- __merge_2(event._features, this._features, event._featuresIndex); // exit early if events should not be sent on the current releaseStage
16212
-
16213
- if (this._config.enabledReleaseStages !== null && !_$includes_12(this._config.enabledReleaseStages, this._config.releaseStage)) {
16214
- this._logger.warn('Event not sent due to releaseStage/enabledReleaseStages configuration');
16215
-
16216
- return postReportCallback(null, event);
16217
- }
16218
-
16219
- var originalSeverity = event.severity;
16220
-
16221
- var onCallbackError = function (err) {
16222
- // errors in callbacks are tolerated but we want to log them out
16223
- _this2._logger.error('Error occurred in onError callback, continuing anyway…');
16224
-
16225
- _this2._logger.error(err);
16226
- };
16227
-
16228
- var callbacks = [].concat(this._cbs.e).concat(onError);
16229
- _$callbackRunner_7(callbacks, event, onCallbackError, function (err, shouldSend) {
16230
- if (err) onCallbackError(err);
16231
-
16232
- if (!shouldSend) {
16233
- _this2._logger.debug('Event not sent due to onError callback');
16234
-
16235
- return postReportCallback(null, event);
16236
- }
16237
-
16238
- if (_this2._isBreadcrumbTypeEnabled('error')) {
16239
- // only leave a crumb for the error if actually got sent
16240
- Client.prototype.leaveBreadcrumb.call(_this2, event.errors[0].errorClass, {
16241
- errorClass: event.errors[0].errorClass,
16242
- errorMessage: event.errors[0].errorMessage,
16243
- severity: event.severity
16244
- }, 'error');
16245
- }
16246
-
16247
- if (originalSeverity !== event.severity) {
16248
- event._handledState.severityReason = {
16249
- type: 'userCallbackSetSeverity'
16250
- };
16251
- }
16252
-
16253
- if (event.unhandled !== event._handledState.unhandled) {
16254
- event._handledState.severityReason.unhandledOverridden = true;
16255
- event._handledState.unhandled = event.unhandled;
16256
- }
16257
-
16258
- if (_this2._session) {
16259
- _this2._session._track(event);
16260
-
16261
- event._session = _this2._session;
16262
- }
16263
-
16264
- _this2._delivery.sendEvent({
16265
- apiKey: event.apiKey || _this2._config.apiKey,
16266
- notifier: _this2._notifier,
16267
- events: [event]
16268
- }, function (err) {
16269
- return postReportCallback(err, event);
16270
- });
16271
- });
16272
- };
16273
-
16274
- return Client;
16275
- }();
16276
-
16277
- var generateConfigErrorMessage = function (errors, rawInput) {
16278
- var er = new Error("Invalid configuration\n" + _$map_15(_$keys_14(errors), function (key) {
16279
- return " - " + key + " " + errors[key] + ", got " + stringify(rawInput[key]);
16280
- }).join('\n\n'));
16281
- return er;
16282
- };
16283
-
16284
- var stringify = function (val) {
16285
- switch (typeof val) {
16286
- case 'string':
16287
- case 'number':
16288
- case 'object':
16289
- return JSON.stringify(val);
16290
-
16291
- default:
16292
- return String(val);
16293
- }
16294
- };
16295
-
16296
- var _$Client_2 = Client;
16297
-
16298
- var _$jsonPayload_20 = {};
16299
-
16300
- var EVENT_REDACTION_PATHS = ['events.[].metaData', 'events.[].breadcrumbs.[].metaData', 'events.[].request'];
16301
-
16302
- _$jsonPayload_20.event = function (event, redactedKeys) {
16303
- var payload = _$safeJsonStringify_31(event, null, null, {
16304
- redactedPaths: EVENT_REDACTION_PATHS,
16305
- redactedKeys: redactedKeys
16306
- });
16307
-
16308
- if (payload.length > 10e5) {
16309
- event.events[0]._metadata = {
16310
- notifier: "WARNING!\nSerialized payload was " + payload.length / 10e5 + "MB (limit = 1MB)\nmetadata was removed"
16311
- };
16312
- payload = _$safeJsonStringify_31(event, null, null, {
16313
- redactedPaths: EVENT_REDACTION_PATHS,
16314
- redactedKeys: redactedKeys
16315
- });
16316
- }
16317
-
16318
- return payload;
16319
- };
16320
-
16321
- _$jsonPayload_20.session = function (session, redactedKeys) {
16322
- var payload = _$safeJsonStringify_31(session, null, null);
16323
- return payload;
16324
- };
16325
-
16326
- var http$1 = http;
16327
-
16328
- var https$1 = https; // eslint-disable-next-line node/no-deprecated-api
16329
-
16330
-
16331
- var ___require_34 = url,
16332
- parse = ___require_34.parse;
16333
-
16334
- var _$request_34 = function (_ref, cb) {
16335
- var url = _ref.url,
16336
- headers = _ref.headers,
16337
- body = _ref.body,
16338
- agent = _ref.agent;
16339
- var didError = false;
16340
-
16341
- var onError = function (err) {
16342
- if (didError) return;
16343
- didError = true;
16344
- cb(err);
16345
- };
16346
-
16347
- var parsedUrl = parse(url);
16348
- var secure = parsedUrl.protocol === 'https:';
16349
- var transport = secure ? https$1 : http$1;
16350
- var req = transport.request({
16351
- method: 'POST',
16352
- hostname: parsedUrl.hostname,
16353
- port: parsedUrl.port,
16354
- path: parsedUrl.path,
16355
- headers: headers,
16356
- agent: agent
16357
- });
16358
- req.on('error', onError);
16359
- req.on('response', function (res) {
16360
- bufferResponse(res, function (err, body) {
16361
- if (err) return onError(err);
16362
-
16363
- if (res.statusCode < 200 || res.statusCode >= 300) {
16364
- return onError(new Error("Bad statusCode from API: " + res.statusCode + "\n" + body));
16365
- }
16366
-
16367
- cb(null, body);
16368
- });
16369
- });
16370
- req.write(body);
16371
- req.end();
16372
- };
16373
-
16374
- var bufferResponse = function (stream, cb) {
16375
- var data = '';
16376
- stream.on('error', cb);
16377
- stream.setEncoding('utf8');
16378
- stream.on('data', function (d) {
16379
- data += d;
16380
- });
16381
- stream.on('end', function () {
16382
- return cb(null, data);
16383
- });
16384
- };
16385
-
16386
- var _$delivery_33 = function (client) {
16387
- return {
16388
- sendEvent: function (event, cb) {
16389
- if (cb === void 0) {
16390
- cb = function () {};
16391
- }
16392
-
16393
- var body = _$jsonPayload_20.event(event, client._config.redactedKeys);
16394
-
16395
- var _cb = function (err) {
16396
- if (err) client._logger.error("Event failed to send\u2026\n" + (err && err.stack ? err.stack : err), err);
16397
-
16398
- if (body.length > 10e5) {
16399
- client._logger.warn("Event oversized (" + (body.length / 10e5).toFixed(2) + " MB)");
16400
- }
16401
-
16402
- cb(err);
16403
- };
16404
-
16405
- try {
16406
- _$request_34({
16407
- url: client._config.endpoints.notify,
16408
- headers: {
16409
- 'Content-Type': 'application/json',
16410
- 'Bugsnag-Api-Key': event.apiKey || client._config.apiKey,
16411
- 'Bugsnag-Payload-Version': '4',
16412
- 'Bugsnag-Sent-At': new Date().toISOString()
16413
- },
16414
- body: body,
16415
- agent: client._config.agent
16416
- }, function (err, body) {
16417
- return _cb(err);
16418
- });
16419
- } catch (e) {
16420
- _cb(e);
16421
- }
16422
- },
16423
- sendSession: function (session, cb) {
16424
- if (cb === void 0) {
16425
- cb = function () {};
16426
- }
16427
-
16428
- var _cb = function (err) {
16429
- if (err) client._logger.error("Session failed to send\u2026\n" + (err && err.stack ? err.stack : err), err);
16430
- cb(err);
16431
- };
16432
-
16433
- try {
16434
- _$request_34({
16435
- url: client._config.endpoints.sessions,
16436
- headers: {
16437
- 'Content-Type': 'application/json',
16438
- 'Bugsnag-Api-Key': client._config.apiKey,
16439
- 'Bugsnag-Payload-Version': '1',
16440
- 'Bugsnag-Sent-At': new Date().toISOString()
16441
- },
16442
- body: _$jsonPayload_20.session(session, client._config.redactedKeys),
16443
- agent: client._config.agent
16444
- }, function (err) {
16445
- return _cb(err);
16446
- });
16447
- } catch (e) {
16448
- _cb(e);
16449
- }
16450
- }
16451
- };
16452
- };
16453
-
16454
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
16455
-
16456
- var schema = _$config_3.schema;
16457
-
16458
- var __os_35 = os;
16459
-
16460
- var _require2 = util$1,
16461
- inspect = _require2.inspect;
16462
-
16463
- var _$config_35 = {
16464
- appType: _extends({}, schema.appType, {
16465
- defaultValue: function () {
16466
- return 'node';
16467
- }
16468
- }),
16469
- projectRoot: {
16470
- defaultValue: function () {
16471
- return process.cwd();
16472
- },
16473
- validate: function (value) {
16474
- return value === null || _$stringWithLength_27(value);
16475
- },
16476
- message: 'should be string'
16477
- },
16478
- hostname: {
16479
- defaultValue: function () {
16480
- return __os_35.hostname();
16481
- },
16482
- message: 'should be a string',
16483
- validate: function (value) {
16484
- return value === null || _$stringWithLength_27(value);
16485
- }
16486
- },
16487
- logger: _extends({}, schema.logger, {
16488
- defaultValue: function () {
16489
- return getPrefixedConsole();
16490
- }
16491
- }),
16492
- releaseStage: _extends({}, schema.releaseStage, {
16493
- defaultValue: function () {
16494
- return process.env.NODE_ENV || 'production';
16495
- }
16496
- }),
16497
- agent: {
16498
- defaultValue: function () {
16499
- return undefined;
16500
- },
16501
- message: 'should be an HTTP(s) agent',
16502
- validate: function (value) {
16503
- return value === undefined || isAgent(value);
16504
- }
16505
- },
16506
- onUncaughtException: {
16507
- defaultValue: function () {
16508
- return function (err, event, logger) {
16509
- logger.error("Uncaught exception" + getContext(event) + ", the process will now terminate\u2026\n" + printError(err));
16510
- process.exit(1);
16511
- };
16512
- },
16513
- message: 'should be a function',
16514
- validate: function (value) {
16515
- return typeof value === 'function';
16516
- }
16517
- },
16518
- onUnhandledRejection: {
16519
- defaultValue: function () {
16520
- return function (err, event, logger) {
16521
- logger.error("Unhandled rejection" + getContext(event) + "\u2026\n" + printError(err));
16522
- };
16523
- },
16524
- message: 'should be a function',
16525
- validate: function (value) {
16526
- return typeof value === 'function';
16527
- }
16528
- }
16529
- };
16530
-
16531
- var printError = function (err) {
16532
- return err && err.stack ? err.stack : inspect(err);
16533
- };
16534
-
16535
- var getPrefixedConsole = function () {
16536
- return ['debug', 'info', 'warn', 'error'].reduce(function (accum, method) {
16537
- var consoleMethod = console[method] || console.log;
16538
- accum[method] = consoleMethod.bind(console, '[bugsnag]');
16539
- return accum;
16540
- }, {});
16541
- };
16542
-
16543
- var getContext = function (event) {
16544
- return event.request && Object.keys(event.request).length ? " at " + event.request.httpMethod + " " + (event.request.path || event.request.url) : '';
16545
- };
16546
-
16547
- var isAgent = function (value) {
16548
- return typeof value === 'object' && value !== null || typeof value === 'boolean';
16549
- };
16550
-
16551
- var appStart = new Date();
16552
-
16553
- var reset = function () {
16554
- appStart = new Date();
16555
- };
16556
-
16557
- var _$app_37 = {
16558
- name: 'appDuration',
16559
- load: function (client) {
16560
- client.addOnError(function (event) {
16561
- var now = new Date();
16562
- event.app.duration = now - appStart;
16563
- }, true);
16564
- return {
16565
- reset: reset
16566
- };
16567
- }
16568
- };
16569
-
16570
- var _$nodeFallbackStack_22 = {};
16571
- // The utilities in this file are used to save the stackframes from a known execution context
16572
- // to use when a subsequent error has no stack frames. This happens with a lot of
16573
- // node's builtin async callbacks when they return from the native layer with no context
16574
- // for example:
16575
- //
16576
- // fs.readFile('does not exist', (err) => {
16577
- // /* node 8 */
16578
- // err.stack = "ENOENT: no such file or directory, open 'nope'"
16579
- // /* node 4,6 */
16580
- // err.stack = "Error: ENOENT: no such file or directory, open 'nope'\n at Error (native)"
16581
- // })
16582
- // Gets the stack string for the current execution context
16583
- _$nodeFallbackStack_22.getStack = function () {
16584
- // slice(3) removes the first line + this function's frame + the caller's frame,
16585
- // so the stack begins with the caller of this function
16586
- return new Error().stack.split('\n').slice(3).join('\n');
16587
- }; // Given an Error and a fallbackStack from getStack(), use the fallbackStack
16588
- // if error.stack has no genuine stackframes (according to the example above)
16589
-
16590
-
16591
- _$nodeFallbackStack_22.maybeUseFallbackStack = function (err, fallbackStack) {
16592
- var lines = err.stack.split('\n');
16593
-
16594
- if (lines.length === 1 || lines.length === 2 && /at Error \(native\)/.test(lines[1])) {
16595
- err.stack = lines[0] + "\n" + fallbackStack;
16596
- }
16597
-
16598
- return err;
16599
- };
16600
-
16601
- var _$contextualize_38 = {};
16602
- /* eslint node/no-deprecated-api: [error, {ignoreModuleItems: ["domain"]}] */
16603
- var domain$1 = domain;
16604
-
16605
- var getStack = _$nodeFallbackStack_22.getStack,
16606
- maybeUseFallbackStack = _$nodeFallbackStack_22.maybeUseFallbackStack;
16607
-
16608
- _$contextualize_38 = {
16609
- name: 'contextualize',
16610
- load: function (client) {
16611
- var contextualize = function (fn, onError) {
16612
- // capture a stacktrace in case a resulting error has nothing
16613
- var fallbackStack = getStack();
16614
- var dom = domain$1.create();
16615
- dom.on('error', function (err) {
16616
- // check if the stacktrace has no context, if so, if so append the frames we created earlier
16617
- if (err.stack) maybeUseFallbackStack(err, fallbackStack);
16618
- var event = client.Event.create(err, true, {
16619
- severity: 'error',
16620
- unhandled: true,
16621
- severityReason: {
16622
- type: 'unhandledException'
16623
- }
16624
- }, 'contextualize()', 1);
16625
-
16626
- client._notify(event, onError, function (e, event) {
16627
- if (e) client._logger.error('Failed to send event to Bugsnag');
16628
-
16629
- client._config.onUncaughtException(err, event, client._logger);
16630
- });
16631
- });
16632
- process.nextTick(function () {
16633
- return dom.run(fn);
16634
- });
16635
- };
16636
-
16637
- return contextualize;
16638
- }
16639
- }; // add a default export for ESM modules without interop
16640
-
16641
- _$contextualize_38["default"] = _$contextualize_38;
16642
-
16643
- var _$intercept_39 = {};
16644
- var __getStack_39 = _$nodeFallbackStack_22.getStack,
16645
- __maybeUseFallbackStack_39 = _$nodeFallbackStack_22.maybeUseFallbackStack;
16646
-
16647
- _$intercept_39 = {
16648
- name: 'intercept',
16649
- load: function (client) {
16650
- var intercept = function (onError, cb) {
16651
- if (onError === void 0) {
16652
- onError = function () {};
16653
- }
16654
-
16655
- if (typeof cb !== 'function') {
16656
- cb = onError;
16657
-
16658
- onError = function () {};
16659
- } // capture a stacktrace in case a resulting error has nothing
16660
-
16661
-
16662
- var fallbackStack = __getStack_39();
16663
- return function (err) {
16664
- if (err) {
16665
- // check if the stacktrace has no context, if so, if so append the frames we created earlier
16666
- if (err.stack) __maybeUseFallbackStack_39(err, fallbackStack);
16667
- var event = client.Event.create(err, true, {
16668
- severity: 'warning',
16669
- unhandled: false,
16670
- severityReason: {
16671
- type: 'callbackErrorIntercept'
16672
- }
16673
- }, 'intercept()', 1);
16674
-
16675
- client._notify(event, onError);
16676
-
16677
- return;
16678
- }
16679
-
16680
- for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
16681
- data[_key - 1] = arguments[_key];
16682
- }
16683
-
16684
- cb.apply(void 0, data); // eslint-disable-line
16685
- };
16686
- };
16687
-
16688
- return intercept;
16689
- }
16690
- }; // add a default export for ESM modules without interop
16691
-
16692
- _$intercept_39["default"] = _$intercept_39;
16693
-
16694
- function ___extends_40() { ___extends_40 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ___extends_40.apply(this, arguments); }
16695
-
16696
- var __os_40 = os;
16697
- /*
16698
- * Automatically detects Node server details ('device' in the API)
16699
- */
16700
-
16701
-
16702
- var _$device_40 = {
16703
- load: function (client) {
16704
- var device = {
16705
- osName: __os_40.platform() + " (" + __os_40.arch() + ")",
16706
- osVersion: __os_40.release(),
16707
- totalMemory: __os_40.totalmem(),
16708
- hostname: client._config.hostname,
16709
- runtimeVersions: {
16710
- node: process.versions.node
16711
- }
16712
- };
16713
-
16714
- client._addOnSessionPayload(function (sp) {
16715
- sp.device = ___extends_40({}, sp.device, device);
16716
- }); // add time just as the event is sent
16717
-
16718
-
16719
- client.addOnError(function (event) {
16720
- event.device = ___extends_40({}, event.device, device, {
16721
- freeMemory: __os_40.freemem(),
16722
- time: new Date()
16723
- });
16724
- }, true);
16725
- }
16726
- };
16727
-
16728
- var ___require_23 = path,
16729
- join = ___require_23.join,
16730
- resolve = ___require_23.resolve; // normalise a path to a directory, adding a trailing slash if it doesn't already
16731
- // have one and resolve it to make it absolute (e.g. get rid of any ".."s)
16732
-
16733
-
16734
- var _$pathNormalizer_23 = function (p) {
16735
- return join(resolve(p), '/');
16736
- };
16737
-
16738
- var _$inProject_41 = {
16739
- load: function (client) {
16740
- return client.addOnError(function (event) {
16741
- if (!client._config.projectRoot) return;
16742
- var projectRoot = _$pathNormalizer_23(client._config.projectRoot);
16743
- var allFrames = event.errors.reduce(function (accum, er) {
16744
- return accum.concat(er.stacktrace);
16745
- }, []);
16746
- allFrames.map(function (stackframe) {
16747
- stackframe.inProject = typeof stackframe.file === 'string' && stackframe.file.indexOf(projectRoot) === 0 && !/\/node_modules\//.test(stackframe.file);
16748
- });
16749
- });
16750
- }
16751
- };
16752
-
16753
- function ___extends_42() { ___extends_42 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ___extends_42.apply(this, arguments); }
16754
-
16755
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
16756
-
16757
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
16758
-
16759
- var SURROUNDING_LINES = 3;
16760
- var MAX_LINE_LENGTH = 200;
16761
-
16762
- var ___require_42 = fs,
16763
- createReadStream = ___require_42.createReadStream;
16764
-
16765
- var ___require2_42 = stream,
16766
- Writable = ___require2_42.Writable;
16767
-
16768
- var pump = pump_1;
16769
-
16770
- var byline$1 = byline;
16771
-
16772
- var path$1 = path;
16773
-
16774
- var _$surroundingCode_42 = {
16775
- load: function (client) {
16776
- if (!client._config.sendCode) return;
16777
-
16778
- var loadSurroundingCode = function (stackframe, cache) {
16779
- return new Promise(function (resolve, reject) {
16780
- try {
16781
- if (!stackframe.lineNumber || !stackframe.file) return resolve(stackframe);
16782
- var file = path$1.resolve(client._config.projectRoot, stackframe.file);
16783
- var cacheKey = file + "@" + stackframe.lineNumber;
16784
-
16785
- if (cacheKey in cache) {
16786
- stackframe.code = cache[cacheKey];
16787
- return resolve(stackframe);
16788
- }
16789
-
16790
- getSurroundingCode(file, stackframe.lineNumber, function (err, code) {
16791
- if (err) return resolve(stackframe);
16792
- stackframe.code = cache[cacheKey] = code;
16793
- return resolve(stackframe);
16794
- });
16795
- } catch (e) {
16796
- return resolve(stackframe);
16797
- }
16798
- });
16799
- };
16800
-
16801
- client.addOnError(function (event) {
16802
- return new Promise(function (resolve, reject) {
16803
- var cache = Object.create(null);
16804
- var allFrames = event.errors.reduce(function (accum, er) {
16805
- return accum.concat(er.stacktrace);
16806
- }, []);
16807
- pMapSeries(allFrames.map(function (stackframe) {
16808
- return function () {
16809
- return loadSurroundingCode(stackframe, cache);
16810
- };
16811
- })).then(resolve)["catch"](reject);
16812
- });
16813
- });
16814
- },
16815
- configSchema: {
16816
- sendCode: {
16817
- defaultValue: function () {
16818
- return true;
16819
- },
16820
- validate: function (value) {
16821
- return value === true || value === false;
16822
- },
16823
- message: 'should be true or false'
16824
- }
16825
- }
16826
- };
16827
-
16828
- var getSurroundingCode = function (file, lineNumber, cb) {
16829
- var start = lineNumber - SURROUNDING_LINES;
16830
- var end = lineNumber + SURROUNDING_LINES;
16831
- var reader = createReadStream(file, {
16832
- encoding: 'utf8'
16833
- });
16834
- var splitter = new byline$1.LineStream({
16835
- keepEmptyLines: true
16836
- });
16837
- var slicer = new CodeRange({
16838
- start: start,
16839
- end: end
16840
- }); // if the slicer has enough lines already, no need to keep reading from the file
16841
-
16842
- slicer.on('done', function () {
16843
- return reader.destroy();
16844
- });
16845
- pump(reader, splitter, slicer, function (err) {
16846
- // reader.destroy() causes a "premature close" error which we can tolerate
16847
- if (err && err.message !== 'premature close') return cb(err);
16848
- cb(null, slicer.getCode());
16849
- });
16850
- }; // This writable stream takes { start, end } options specifying the
16851
- // range of lines that should be extracted from a file. Pipe a readable
16852
- // stream to it that provides source lines as each chunk. If the range
16853
- // is satisfied before the end of the readable stream, it will emit the
16854
- // 'done' event. Once a 'done' or 'finish' event has been seen, call getCode()
16855
- // to get the range in the following format:
16856
- // {
16857
- // '10': 'function getSquare (cb) {',
16858
- // '11': ' rectangles.find({',
16859
- // '12': ' length: 12',
16860
- // '13': ' width: 12',
16861
- // '14': ' }, err => cb)',
16862
- // '15': '}'
16863
- // }
16864
-
16865
-
16866
- var CodeRange = /*#__PURE__*/function (_Writable) {
16867
- _inheritsLoose(CodeRange, _Writable);
16868
-
16869
- function CodeRange(opts) {
16870
- var _this;
16871
-
16872
- _this = _Writable.call(this, ___extends_42({}, opts, {
16873
- decodeStrings: false
16874
- })) || this;
16875
- _this._start = opts.start;
16876
- _this._end = opts.end;
16877
- _this._n = 0;
16878
- _this._code = {};
16879
- return _this;
16880
- }
16881
-
16882
- var _proto = CodeRange.prototype;
16883
-
16884
- _proto._write = function _write(chunk, enc, cb) {
16885
- this._n++;
16886
- if (this._n < this._start) return cb(null);
16887
-
16888
- if (this._n <= this._end) {
16889
- this._code[String(this._n)] = chunk.length <= MAX_LINE_LENGTH ? chunk : chunk.substr(0, MAX_LINE_LENGTH);
16890
- return cb(null);
16891
- }
16892
-
16893
- this.emit('done');
16894
- return cb(null);
16895
- };
16896
-
16897
- _proto.getCode = function getCode() {
16898
- return this._code;
16899
- };
16900
-
16901
- return CodeRange;
16902
- }(Writable);
16903
-
16904
- var pMapSeries = function (ps) {
16905
- return new Promise(function (resolve, reject) {
16906
- var res = [];
16907
- ps.reduce(function (accum, p) {
16908
- return accum.then(function (r) {
16909
- res.push(r);
16910
- return p();
16911
- });
16912
- }, Promise.resolve()).then(function (r) {
16913
- res.push(r);
16914
- }).then(function () {
16915
- resolve(res.slice(1));
16916
- });
16917
- });
16918
- };
16919
-
16920
- var _handler;
16921
-
16922
- var _$uncaughtException_43 = {
16923
- load: function (client) {
16924
- if (!client._config.autoDetectErrors) return;
16925
- if (!client._config.enabledErrorTypes.unhandledExceptions) return;
16926
-
16927
- _handler = function (err) {
16928
- var event = client.Event.create(err, false, {
16929
- severity: 'error',
16930
- unhandled: true,
16931
- severityReason: {
16932
- type: 'unhandledException'
16933
- }
16934
- }, 'uncaughtException handler', 1);
16935
-
16936
- client._notify(event, function () {}, function (e, event) {
16937
- if (e) client._logger.error('Failed to send event to Bugsnag');
16938
-
16939
- client._config.onUncaughtException(err, event, client._logger);
16940
- });
16941
- };
16942
-
16943
- process.on('uncaughtException', _handler);
16944
- },
16945
- destroy: function () {
16946
- process.removeListener('uncaughtException', _handler);
16947
- }
16948
- };
16949
-
16950
- var ___handler_44;
16951
-
16952
- var _$unhandledRejection_44 = {
16953
- load: function (client) {
16954
- if (!client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections) return;
16955
-
16956
- ___handler_44 = function (err) {
16957
- var event = client.Event.create(err, false, {
16958
- severity: 'error',
16959
- unhandled: true,
16960
- severityReason: {
16961
- type: 'unhandledPromiseRejection'
16962
- }
16963
- }, 'unhandledRejection handler', 1);
16964
- return new Promise(function (resolve) {
16965
- client._notify(event, function () {}, function (e, event) {
16966
- if (e) client._logger.error('Failed to send event to Bugsnag');
16967
-
16968
- client._config.onUnhandledRejection(err, event, client._logger);
16969
-
16970
- resolve();
16971
- });
16972
- });
16973
- }; // Prepend the listener if we can (Node 6+)
16974
-
16975
-
16976
- if (process.prependListener) {
16977
- process.prependListener('unhandledRejection', ___handler_44);
16978
- } else {
16979
- process.on('unhandledRejection', ___handler_44);
16980
- }
16981
- },
16982
- destroy: function () {
16983
- process.removeListener('unhandledRejection', ___handler_44);
16984
- }
16985
- };
16986
-
16987
- var _$cloneClient_8 = {};
16988
-
16989
- var onCloneCallbacks = [];
16990
-
16991
- _$cloneClient_8 = function (client) {
16992
- var clone = new client.Client({}, {}, [], client._notifier);
16993
- clone._config = client._config; // changes to these properties should not be reflected in the original client,
16994
- // so ensure they are are (shallow) cloned
16995
-
16996
- clone._breadcrumbs = client._breadcrumbs.slice();
16997
- clone._metadata = _$assign_10({}, client._metadata);
16998
- clone._features = [].concat(client._features);
16999
- clone._featuresIndex = _$assign_10({}, client._featuresIndex);
17000
- clone._user = _$assign_10({}, client._user);
17001
- clone._context = client._context;
17002
- clone._cbs = {
17003
- e: client._cbs.e.slice(),
17004
- s: client._cbs.s.slice(),
17005
- sp: client._cbs.sp.slice(),
17006
- b: client._cbs.b.slice()
17007
- };
17008
- clone._logger = client._logger;
17009
- clone._delivery = client._delivery;
17010
- clone._sessionDelegate = client._sessionDelegate;
17011
- onCloneCallbacks.forEach(function (callback) {
17012
- callback(clone);
17013
- });
17014
- return clone;
17015
- };
17016
-
17017
- _$cloneClient_8.registerCallback = function (callback) {
17018
- onCloneCallbacks.push(callback);
17019
- };
17020
-
17021
- /**
17022
- * Expose `Backoff`.
17023
- */
17024
- var _$Backoff_45 = Backoff;
17025
- /**
17026
- * Initialize backoff timer with `opts`.
17027
- *
17028
- * - `min` initial timeout in milliseconds [100]
17029
- * - `max` max timeout [10000]
17030
- * - `jitter` [0]
17031
- * - `factor` [2]
17032
- *
17033
- * @param {Object} opts
17034
- * @api public
17035
- */
17036
-
17037
- function Backoff(opts) {
17038
- opts = opts || {};
17039
- this.ms = opts.min || 100;
17040
- this.max = opts.max || 10000;
17041
- this.factor = opts.factor || 2;
17042
- this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
17043
- this.attempts = 0;
17044
- }
17045
- /**
17046
- * Return the backoff duration.
17047
- *
17048
- * @return {Number}
17049
- * @api public
17050
- */
17051
-
17052
-
17053
- Backoff.prototype.duration = function () {
17054
- var ms = this.ms * Math.pow(this.factor, this.attempts++);
17055
-
17056
- if (this.jitter) {
17057
- var rand = Math.random();
17058
- var deviation = Math.floor(rand * this.jitter * ms);
17059
- ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
17060
- }
17061
-
17062
- return Math.min(ms, this.max) | 0;
17063
- };
17064
- /**
17065
- * Reset the number of attempts.
17066
- *
17067
- * @api public
17068
- */
17069
-
17070
-
17071
- Backoff.prototype.reset = function () {
17072
- this.attempts = 0;
17073
- };
17074
-
17075
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
17076
-
17077
- function ___inheritsLoose_47(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; ___setPrototypeOf_47(subClass, superClass); }
17078
-
17079
- function ___setPrototypeOf_47(o, p) { ___setPrototypeOf_47 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ___setPrototypeOf_47(o, p); }
17080
-
17081
- var DEFAULT_SUMMARY_INTERVAL = 10 * 1000;
17082
-
17083
- var Emitter = events.EventEmitter;
17084
-
17085
- var _$tracker_47 = /*#__PURE__*/function (_Emitter) {
17086
- ___inheritsLoose_47(SessionTracker, _Emitter);
17087
-
17088
- function SessionTracker(intervalLength) {
17089
- var _this;
17090
-
17091
- _this = _Emitter.call(this) || this;
17092
- _this._sessions = new Map();
17093
- _this._interval = null;
17094
- _this._intervalLength = intervalLength || DEFAULT_SUMMARY_INTERVAL;
17095
- _this._summarize = _this._summarize.bind(_assertThisInitialized(_this));
17096
- return _this;
17097
- }
17098
-
17099
- var _proto = SessionTracker.prototype;
17100
-
17101
- _proto.start = function start() {
17102
- if (!this._interval) {
17103
- this._interval = setInterval(this._summarize, this._intervalLength).unref();
17104
- }
17105
- };
17106
-
17107
- _proto.stop = function stop() {
17108
- clearInterval(this._interval);
17109
- this._interval = null;
17110
- };
17111
-
17112
- _proto.track = function track(session) {
17113
- var key = dateToMsKey(session.startedAt);
17114
-
17115
- var cur = this._sessions.get(key);
17116
-
17117
- this._sessions.set(key, typeof cur === 'undefined' ? 1 : cur + 1);
17118
-
17119
- return session;
17120
- };
17121
-
17122
- _proto._summarize = function _summarize() {
17123
- var _this2 = this;
17124
-
17125
- var summary = [];
17126
-
17127
- this._sessions.forEach(function (val, key) {
17128
- summary.push({
17129
- startedAt: key,
17130
- sessionsStarted: val
17131
- });
17132
-
17133
- _this2._sessions["delete"](key);
17134
- });
17135
-
17136
- if (!summary.length) return;
17137
- this.emit('summary', summary);
17138
- };
17139
-
17140
- return SessionTracker;
17141
- }(Emitter);
17142
-
17143
- var dateToMsKey = function (d) {
17144
- var dk = new Date(d);
17145
- dk.setSeconds(0);
17146
- dk.setMilliseconds(0);
17147
- return dk.toISOString();
17148
- };
17149
-
17150
- var _$session_46 = {
17151
- load: function (client) {
17152
- var sessionTracker = new _$tracker_47(client._config.sessionSummaryInterval);
17153
- sessionTracker.on('summary', sendSessionSummary(client));
17154
- sessionTracker.start();
17155
- client._sessionDelegate = {
17156
- startSession: function (client, session) {
17157
- var sessionClient = _$cloneClient_8(client);
17158
- sessionClient._session = session;
17159
- sessionClient._pausedSession = null;
17160
- sessionTracker.track(sessionClient._session);
17161
- return sessionClient;
17162
- },
17163
- pauseSession: function (client) {
17164
- client._pausedSession = client._session;
17165
- client._session = null;
17166
- },
17167
- resumeSession: function (client) {
17168
- // Do nothing if there's already an active session
17169
- if (client._session) {
17170
- return client;
17171
- } // If we have a paused session then make it the active session
17172
-
17173
-
17174
- if (client._pausedSession) {
17175
- client._session = client._pausedSession;
17176
- client._pausedSession = null;
17177
- return client;
17178
- } // Otherwise start a new session
17179
-
17180
-
17181
- return client.startSession();
17182
- }
17183
- };
17184
- },
17185
- configSchema: {
17186
- sessionSummaryInterval: {
17187
- defaultValue: function () {
17188
- return undefined;
17189
- },
17190
- validate: function (value) {
17191
- return value === undefined || _$intRange_25()(value);
17192
- },
17193
- message: 'should be a positive integer'
17194
- }
17195
- }
17196
- };
17197
-
17198
- var sendSessionSummary = function (client) {
17199
- return function (sessionCounts) {
17200
- // exit early if the current releaseStage is not enabled
17201
- if (client._config.enabledReleaseStages !== null && !client._config.enabledReleaseStages.includes(client._config.releaseStage)) {
17202
- client._logger.warn('Session not sent due to releaseStage/enabledReleaseStages configuration');
17203
-
17204
- return;
17205
- }
17206
-
17207
- if (!sessionCounts.length) return;
17208
- var backoff = new _$Backoff_45({
17209
- min: 1000,
17210
- max: 10000
17211
- });
17212
- var maxAttempts = 10;
17213
- req(handleRes);
17214
-
17215
- function handleRes(err) {
17216
- if (!err) {
17217
- var sessionCount = sessionCounts.reduce(function (accum, s) {
17218
- return accum + s.sessionsStarted;
17219
- }, 0);
17220
- return client._logger.debug(sessionCount + " session(s) reported");
17221
- }
17222
-
17223
- if (backoff.attempts === 10) {
17224
- client._logger.error('Session delivery failed, max retries exceeded', err);
17225
-
17226
- return;
17227
- }
17228
-
17229
- client._logger.debug('Session delivery failed, retry #' + (backoff.attempts + 1) + '/' + maxAttempts, err);
17230
-
17231
- setTimeout(function () {
17232
- return req(handleRes);
17233
- }, backoff.duration());
17234
- }
17235
-
17236
- function req(cb) {
17237
- var payload = {
17238
- notifier: client._notifier,
17239
- device: {},
17240
- app: {
17241
- releaseStage: client._config.releaseStage,
17242
- version: client._config.appVersion,
17243
- type: client._config.appType
17244
- },
17245
- sessionCounts: sessionCounts
17246
- };
17247
- var ignore = _$syncCallbackRunner_24(client._cbs.sp, payload, 'onSessionPayload', client._logger);
17248
-
17249
- if (ignore) {
17250
- client._logger.debug('Session not sent due to onSessionPayload callback');
17251
-
17252
- return cb(null);
17253
- }
17254
-
17255
- client._delivery.sendSession(payload, cb);
17256
- }
17257
- };
17258
- };
17259
-
17260
- var _$pathNormaliser_48 = {
17261
- load: function (client) {
17262
- client.addOnError(function (event) {
17263
- var allFrames = event.errors.reduce(function (accum, er) {
17264
- return accum.concat(er.stacktrace);
17265
- }, []);
17266
- allFrames.forEach(function (stackframe) {
17267
- if (typeof stackframe.file !== 'string') {
17268
- return;
17269
- }
17270
-
17271
- stackframe.file = stackframe.file.replace(/\\/g, '/');
17272
- });
17273
- });
17274
- }
17275
- };
17276
-
17277
- var _$stripProjectRoot_49 = {
17278
- load: function (client) {
17279
- return client.addOnError(function (event) {
17280
- if (!client._config.projectRoot) return;
17281
- var projectRoot = _$pathNormalizer_23(client._config.projectRoot);
17282
- var allFrames = event.errors.reduce(function (accum, er) {
17283
- return accum.concat(er.stacktrace);
17284
- }, []);
17285
- allFrames.map(function (stackframe) {
17286
- if (typeof stackframe.file === 'string' && stackframe.file.indexOf(projectRoot) === 0) {
17287
- stackframe.file = stackframe.file.replace(projectRoot, '');
17288
- }
17289
- });
17290
- });
17291
- }
17292
- };
17293
-
17294
- var _$notifier_36 = {};
17295
- function ___extends_36() { ___extends_36 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return ___extends_36.apply(this, arguments); }
17296
-
17297
- var name = 'Bugsnag Node';
17298
- var version = '7.18.0';
17299
- var url$1 = 'https://github.com/bugsnag/bugsnag-js';
17300
-
17301
- _$Event_4.__type = 'nodejs';
17302
-
17303
-
17304
- var __schema_36 = ___extends_36({}, _$config_3.schema, _$config_35); // remove enabledBreadcrumbTypes from the config schema
17305
-
17306
-
17307
- delete __schema_36.enabledBreadcrumbTypes;
17308
-
17309
- var internalPlugins = [_$app_37, _$surroundingCode_42, _$inProject_41, _$stripProjectRoot_49, _$session_46, _$device_40, _$uncaughtException_43, _$unhandledRejection_44, _$intercept_39, _$contextualize_38, _$pathNormaliser_48];
17310
- var Bugsnag = {
17311
- _client: null,
17312
- createClient: function (opts) {
17313
- // handle very simple use case where user supplies just the api key as a string
17314
- if (typeof opts === 'string') opts = {
17315
- apiKey: opts
17316
- };
17317
- if (!opts) opts = {};
17318
- var bugsnag = new _$Client_2(opts, __schema_36, internalPlugins, {
17319
- name: name,
17320
- version: version,
17321
- url: url$1
17322
- });
17323
-
17324
- bugsnag._setDelivery(_$delivery_33);
17325
-
17326
- bugsnag._logger.debug('Loaded!');
17327
-
17328
- bugsnag.leaveBreadcrumb = function () {
17329
- bugsnag._logger.warn('Breadcrumbs are not supported in Node.js yet');
17330
- };
17331
-
17332
- bugsnag._config.enabledBreadcrumbTypes = [];
17333
- return bugsnag;
17334
- },
17335
- start: function (opts) {
17336
- if (Bugsnag._client) {
17337
- Bugsnag._client._logger.warn('Bugsnag.start() was called more than once. Ignoring.');
17338
-
17339
- return Bugsnag._client;
17340
- }
17341
-
17342
- Bugsnag._client = Bugsnag.createClient(opts);
17343
- return Bugsnag._client;
17344
- },
17345
- isStarted: function () {
17346
- return Bugsnag._client != null;
17347
- }
17348
- };
17349
- Object.keys(_$Client_2.prototype).forEach(function (m) {
17350
- if (/^_/.test(m)) return;
17351
-
17352
- Bugsnag[m] = function () {
17353
- if (!Bugsnag._client) return console.error("Bugsnag." + m + "() was called before Bugsnag.start()");
17354
- Bugsnag._client._depth += 1;
17355
-
17356
- var ret = Bugsnag._client[m].apply(Bugsnag._client, arguments);
17357
-
17358
- Bugsnag._client._depth -= 1;
17359
- return ret;
17360
- };
17361
- });
17362
- _$notifier_36 = Bugsnag;
17363
- _$notifier_36.Client = _$Client_2;
17364
- _$notifier_36.Event = _$Event_4;
17365
- _$notifier_36.Session = _$Session_32;
17366
- _$notifier_36.Breadcrumb = _$Breadcrumb_1; // Export a "default" property for compatibility with ESM imports
17367
-
17368
- _$notifier_36["default"] = Bugsnag;
17369
-
17370
- return _$notifier_36;
17371
-
17372
- });
17373
-
17374
- });
17375
-
17376
- var notifier = bugsnag;
17377
-
17378
- /**
17379
- *
17380
- */
17381
- function SelectModalWithHook(props) {
17382
- React__default.useEffect(() => {
17383
- var _props$onDisplay;
17384
- (_props$onDisplay = props.onDisplay) === null || _props$onDisplay === void 0 ? void 0 : _props$onDisplay.call(props);
17385
- }, []);
17386
- const {
17387
- isGift,
17388
- plan,
17389
- product,
17390
- isRenewingGift,
17391
- switchView,
17392
- resetView,
17393
- view,
17394
- set
17395
- } = usePelcro();
17396
- const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
17397
- const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
17398
- return /*#__PURE__*/React__default.createElement(SelectModalWithTrans, {
17399
- isGift: isGift,
17400
- disableGifting: isRenewingGift,
17401
- plan: plan,
17402
- product: product,
17403
- onClose: () => {
17404
- var _props$onClose;
17405
- (_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props);
17406
- resetView();
17407
- },
17408
- setProductAndPlan: (product, plan, isGift) => set({
17409
- product,
17410
- plan,
17411
- isGift
17412
- }),
17413
- setView: switchView,
17414
- matchingEntitlements: view === "_plan-select-entitlements" ? entitlements : null
13906
+ setProductAndPlan: (product, plan, isGift) => set({
13907
+ product,
13908
+ plan,
13909
+ isGift
13910
+ }),
13911
+ setView: switchView,
13912
+ matchingEntitlements: view === "_plan-select-entitlements" ? entitlements : null
17415
13913
  });
17416
13914
  }
17417
13915
  SelectModalWithHook.viewId = "plan-select";
@@ -17419,7 +13917,6 @@ class SelectModal extends Component {
17419
13917
  constructor(props) {
17420
13918
  super(props);
17421
13919
  _defineProperty$3(this, "componentDidMount", () => {
17422
- var _window$Pelcro2, _window$Pelcro2$site, _window$Pelcro3, _window$Pelcro3$user, _window$Pelcro4, _window$Pelcro4$uiSet, _window$Pelcro5, _window$Pelcro6, _window$Pelcro6$uiSet;
17423
13920
  if (this.props.product) {
17424
13921
  const {
17425
13922
  product
@@ -17451,19 +13948,20 @@ class SelectModal extends Component {
17451
13948
  this.props.setView('register');
17452
13949
  }
17453
13950
  document.addEventListener("keydown", this.handleSubmit);
17454
- notifier.notify("SelectModalMounted", event => {
17455
- var _window$Pelcro, _window$Pelcro$site;
17456
- event.addMetadata("MetaData", {
17457
- site: JSON.stringify((_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : _window$Pelcro$site.read())
13951
+ if (!document.querySelector("#pelcro-selection-view") || !document.querySelector(".pelcro-select-product-wrapper")) {
13952
+ notifyBugsnag(() => {
13953
+ Bugsnag.notify("SelectModal - No data viewed", event => {
13954
+ var _window$Pelcro, _window$Pelcro$site, _window$Pelcro2, _window$Pelcro2$user, _window$Pelcro3, _window$Pelcro3$uiSet, _window$Pelcro4;
13955
+ event.addMetadata("MetaData", {
13956
+ site: (_window$Pelcro = window.Pelcro) === null || _window$Pelcro === void 0 ? void 0 : (_window$Pelcro$site = _window$Pelcro.site) === null || _window$Pelcro$site === void 0 ? void 0 : _window$Pelcro$site.read(),
13957
+ user: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$user = _window$Pelcro2.user) === null || _window$Pelcro2$user === void 0 ? void 0 : _window$Pelcro2$user.read(),
13958
+ uiVersion: (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$uiSet = _window$Pelcro3.uiSettings) === null || _window$Pelcro3$uiSet === void 0 ? void 0 : _window$Pelcro3$uiSet.uiVersion,
13959
+ environment: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : _window$Pelcro4.environment
13960
+ });
13961
+ });
17458
13962
  });
17459
- });
17460
- console.log({
17461
- site: (_window$Pelcro2 = window.Pelcro) === null || _window$Pelcro2 === void 0 ? void 0 : (_window$Pelcro2$site = _window$Pelcro2.site) === null || _window$Pelcro2$site === void 0 ? void 0 : _window$Pelcro2$site.read(),
17462
- user: (_window$Pelcro3 = window.Pelcro) === null || _window$Pelcro3 === void 0 ? void 0 : (_window$Pelcro3$user = _window$Pelcro3.user) === null || _window$Pelcro3$user === void 0 ? void 0 : _window$Pelcro3$user.read(),
17463
- uiVersion: (_window$Pelcro4 = window.Pelcro) === null || _window$Pelcro4 === void 0 ? void 0 : (_window$Pelcro4$uiSet = _window$Pelcro4.uiSettings) === null || _window$Pelcro4$uiSet === void 0 ? void 0 : _window$Pelcro4$uiSet.uiVersion,
17464
- environment: (_window$Pelcro5 = window.Pelcro) === null || _window$Pelcro5 === void 0 ? void 0 : _window$Pelcro5.environment,
17465
- uiVersionApp: (_window$Pelcro6 = window.Pelcro) === null || _window$Pelcro6 === void 0 ? void 0 : (_window$Pelcro6$uiSet = _window$Pelcro6.uiSettings) === null || _window$Pelcro6$uiSet === void 0 ? void 0 : _window$Pelcro6$uiSet.uiVersion
17466
- });
13963
+ console.log("bugsnag Triggered");
13964
+ }
17467
13965
  });
17468
13966
  _defineProperty$3(this, "componentWillUnmount", () => {
17469
13967
  document.removeEventListener("keydown", this.handleSubmit);