@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-commons-frontend",
3
- "version": "2.0.135",
3
+ "version": "2.1.0",
4
4
  "description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
5
5
  "repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",
@@ -19,21 +19,21 @@ var reactHelmet = require('react-helmet');
19
19
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
20
 
21
21
  function _interopNamespace(e) {
22
- if (e && e.__esModule) return e;
23
- var n = Object.create(null);
24
- if (e) {
25
- Object.keys(e).forEach(function (k) {
26
- if (k !== 'default') {
27
- var d = Object.getOwnPropertyDescriptor(e, k);
28
- Object.defineProperty(n, k, d.get ? d : {
29
- enumerable: true,
30
- get: function () { return e[k]; }
31
- });
32
- }
22
+ if (e && e.__esModule) return e;
23
+ var n = Object.create(null);
24
+ if (e) {
25
+ Object.keys(e).forEach(function (k) {
26
+ if (k !== 'default') {
27
+ var d = Object.getOwnPropertyDescriptor(e, k);
28
+ Object.defineProperty(n, k, d.get ? d : {
29
+ enumerable: true,
30
+ get: function () { return e[k]; }
33
31
  });
34
- }
35
- n["default"] = e;
36
- return Object.freeze(n);
32
+ }
33
+ });
34
+ }
35
+ n["default"] = e;
36
+ return Object.freeze(n);
37
37
  }
38
38
 
39
39
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
@@ -41,6 +41,8 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
41
41
  var ErrorPage__default = /*#__PURE__*/_interopDefaultLegacy(ErrorPage);
42
42
  var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
43
43
 
44
+ var IGNORABLE_ERRORS_REGEX = /(window\.requestAnimationFrame|ResizeObserver|ChunkLoadError|window\.webkit\.messageHandlers|Request aborted|Network Error)/;
45
+
44
46
  var _path, _path2, _path3, _path4, _path5, _path6;
45
47
  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); }
46
48
  var SvgFallbackComponent = function SvgFallbackComponent(props) {
@@ -122,7 +124,15 @@ var FallbackComponent = function FallbackComponent() {
122
124
  }
123
125
  }))));
124
126
  };
125
- var ignorableErrorsRegex = /(window\.requestAnimationFrame|ResizeObserver|ChunkLoadError|window\.webkit\.messageHandlers|Request aborted|Network Error)/;
127
+
128
+ var attachContext = function attachContext(notice, context) {
129
+ if (notice.context) Object.assign(notice.context, context);else notice.context = context;
130
+ };
131
+ var getSessionReplayUrl = function getSessionReplayUrl() {
132
+ var storage = sessionStorage.getItem("neeto-replay-widget--session");
133
+ var currentTimestamp = new Date().getTime();
134
+ return storage ? "".concat(JSON.parse(storage).url, "?goto=").concat(currentTimestamp) : "";
135
+ };
126
136
 
127
137
  /** @type {import("neetocommons/react-utils").HoneybadgerErrorBoundary} */
128
138
  var HoneybadgerErrorBoundary = function HoneybadgerErrorBoundary(_ref) {
@@ -132,10 +142,17 @@ var HoneybadgerErrorBoundary = function HoneybadgerErrorBoundary(_ref) {
132
142
  _ref$filterErrors = _ref.filterErrors,
133
143
  filterErrors = _ref$filterErrors === void 0 ? undefined : _ref$filterErrors;
134
144
  react.Honeybadger.beforeNotify(function (notice) {
135
- if (notice && (ignorableErrorsRegex.test(notice.message) || notice.stack.includes("chrome-extension://"))) {
136
- return false;
137
- }
138
- return filterErrors === null || filterErrors === void 0 ? void 0 : filterErrors(notice);
145
+ var _globalProps$user;
146
+ if (!notice) return false;
147
+ var isIgnorable = IGNORABLE_ERRORS_REGEX.test(notice.message) || notice.stack.includes("chrome-extension://") || (filterErrors === null || filterErrors === void 0 ? void 0 : filterErrors(notice)) === false;
148
+ if (isIgnorable) return false;
149
+ var context = {};
150
+ var user = (_globalProps$user = globalProps.user) === null || _globalProps$user === void 0 ? void 0 : _globalProps$user.email;
151
+ if (user) context.user = user;
152
+ var sessionReplay = getSessionReplayUrl();
153
+ if (sessionReplay) context.sessionReplay = sessionReplay;
154
+ attachContext(notice, context);
155
+ return true;
139
156
  });
140
157
  var honeybadger = react.Honeybadger.configure({
141
158
  apiKey: globalProps.honeybadgerApiKey,