@bigbinary/neeto-commons-frontend 2.0.135 → 2.1.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/react-utils.js CHANGED
@@ -13,6 +13,8 @@ import { getFromLocalStorage } from '@bigbinary/neeto-commons-frontend/utils';
13
13
  import { useQuery, useQueryClient, useMutation } from 'react-query';
14
14
  import { Helmet } from 'react-helmet';
15
15
 
16
+ var IGNORABLE_ERRORS_REGEX = /(window\.requestAnimationFrame|ResizeObserver|ChunkLoadError|window\.webkit\.messageHandlers|Request aborted|Network Error)/;
17
+
16
18
  var _path, _path2, _path3, _path4, _path5, _path6;
17
19
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
18
20
  var SvgFallbackComponent = function SvgFallbackComponent(props) {
@@ -94,7 +96,15 @@ var FallbackComponent = function FallbackComponent() {
94
96
  }
95
97
  }))));
96
98
  };
97
- var ignorableErrorsRegex = /(window\.requestAnimationFrame|ResizeObserver|ChunkLoadError|window\.webkit\.messageHandlers|Request aborted|Network Error)/;
99
+
100
+ var attachContext = function attachContext(notice, context) {
101
+ if (notice.context) Object.assign(notice.context, context);else notice.context = context;
102
+ };
103
+ var getSessionReplayUrl = function getSessionReplayUrl() {
104
+ var storage = sessionStorage.getItem("neeto-replay-widget--session");
105
+ var currentTimestamp = new Date().getTime();
106
+ return storage ? "".concat(JSON.parse(storage).url, "?goto=").concat(currentTimestamp) : "";
107
+ };
98
108
 
99
109
  /** @type {import("neetocommons/react-utils").HoneybadgerErrorBoundary} */
100
110
  var HoneybadgerErrorBoundary = function HoneybadgerErrorBoundary(_ref) {
@@ -104,10 +114,17 @@ var HoneybadgerErrorBoundary = function HoneybadgerErrorBoundary(_ref) {
104
114
  _ref$filterErrors = _ref.filterErrors,
105
115
  filterErrors = _ref$filterErrors === void 0 ? undefined : _ref$filterErrors;
106
116
  Honeybadger.beforeNotify(function (notice) {
107
- if (notice && (ignorableErrorsRegex.test(notice.message) || notice.stack.includes("chrome-extension://"))) {
108
- return false;
109
- }
110
- return filterErrors === null || filterErrors === void 0 ? void 0 : filterErrors(notice);
117
+ var _globalProps$user;
118
+ if (!notice) return false;
119
+ var isIgnorable = IGNORABLE_ERRORS_REGEX.test(notice.message) || notice.stack.includes("chrome-extension://") || (filterErrors === null || filterErrors === void 0 ? void 0 : filterErrors(notice)) === false;
120
+ if (isIgnorable) return false;
121
+ var context = {};
122
+ var user = (_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email;
123
+ if (user) context.user = user;
124
+ var sessionReplay = getSessionReplayUrl();
125
+ if (sessionReplay) context.sessionReplay = sessionReplay;
126
+ attachContext(notice, context);
127
+ return true;
111
128
  });
112
129
  var honeybadger = Honeybadger.configure({
113
130
  apiKey: globalProps.honeybadgerApiKey,