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