@crystaldesign/diva-core 26.14.0-beta.29 → 26.14.0-beta.30

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.
@@ -1,4 +1,4 @@
1
- import { s as styleInject, u as useDivaCoreContext } from './index-05778c92.js';
1
+ import { s as styleInject, u as useDivaCoreContext } from './index-dc443f1a.js';
2
2
  import { useEffect, useCallback } from 'react';
3
3
  import { observer } from 'mobx-react-lite';
4
4
  import Button from '@mui/material/Button';
@@ -12,6 +12,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
12
12
  import { IconButton } from '@mui/material';
13
13
  import CloseIcon from '@mui/icons-material/Close';
14
14
  import { toJS } from 'mobx';
15
+ import '@babel/runtime/helpers/readOnlyError';
15
16
  import '@babel/runtime/helpers/classCallCheck';
16
17
  import '@babel/runtime/helpers/createClass';
17
18
  import '@babel/runtime/helpers/defineProperty';
@@ -1,4 +1,4 @@
1
- import { s as styleInject, u as useDivaCoreContext, g as getLogger } from './index-05778c92.js';
1
+ import { s as styleInject, u as useDivaCoreContext, g as getLogger } from './index-dc443f1a.js';
2
2
  import { forwardRef, useState, useRef, useEffect, useMemo } from 'react';
3
3
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
4
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
@@ -19,6 +19,7 @@ import { useTranslation as useTranslation$1 } from '@crystaldesign/diva-core';
19
19
  import { ContentBoxComponent } from '@crystaldesign/content-box';
20
20
  import { Alert as Alert$1, CircularProgress as CircularProgress$1 } from '@mui/material';
21
21
  import Snowfall from 'react-snowfall';
22
+ import '@babel/runtime/helpers/readOnlyError';
22
23
  import '@babel/runtime/helpers/classCallCheck';
23
24
  import '@babel/runtime/helpers/createClass';
24
25
  import '@elastic/apm-rum';
@@ -1,3 +1,4 @@
1
+ import '@babel/runtime/helpers/readOnlyError';
1
2
  import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
2
3
  import _createClass from '@babel/runtime/helpers/createClass';
3
4
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
@@ -44,7 +45,7 @@ import _typeof from '@babel/runtime/helpers/typeof';
44
45
  import { actions } from '@storybook/addon-actions';
45
46
 
46
47
  (function() {
47
- const env = {"STAGE":"production","VERSION":"26.14.0-beta.29"};
48
+ const env = {"STAGE":"production","VERSION":"26.14.0-beta.30"};
48
49
  try {
49
50
  if (process) {
50
51
  process.env = Object.assign({}, process.env);
@@ -354,16 +355,26 @@ var ApplicationLogger = /*#__PURE__*/function () {
354
355
  }
355
356
  (_console3 = console).warn.apply(_console3, ["".concat(this.getPrefix('WARN')).concat(this.getApmTransationIdFormatted()).concat(message)].concat(optionalParams));
356
357
  }
358
+
359
+ /** Logs an error to the console, the host's onError event and APM; a plain string is wrapped in a DivaError. */
357
360
  }, {
358
361
  key: "error",
359
- value: function error(_error) {
362
+ value: function error(errorOrMessage) {
360
363
  var _error$custom, _getApmInstance;
361
364
  if (!this.isValidLogLevel(3)) return;
362
- console.error("".concat(this.getPrefix('ERROR', _error.name)).concat(this.getApmTransationIdFormatted()), _error, (_error$custom = _error.custom) !== null && _error$custom !== void 0 ? _error$custom : ' ');
363
- _onErrorEvent(_error.message, _error.name);
365
+ var error = typeof errorOrMessage === 'string' ? new DivaError(errorOrMessage) : errorOrMessage;
366
+ console.error("".concat(this.getPrefix('ERROR', error.name)).concat(this.getApmTransationIdFormatted()), error, (_error$custom = error.custom) !== null && _error$custom !== void 0 ? _error$custom : ' ');
367
+ _onErrorEvent(error.message, error.name);
364
368
 
365
369
  //for apm we spread the custom object directly on the error object, so that the are added to APM as custom attributes
366
- var forApm = _objectSpread$g(_objectSpread$g({}, _error), _error.custom);
370
+ //name, message, stack and cause of an Error are not enumerable, but APM drops an error without a message
371
+ //and keeps only primitive attributes, so the cause goes in as its message
372
+ var forApm = _objectSpread$g(_objectSpread$g(_objectSpread$g({}, error), error.custom), {}, {
373
+ name: error.name,
374
+ message: error.message,
375
+ stack: error.stack,
376
+ cause: error.cause instanceof Object && 'message' in error.cause ? error.cause.message : error.cause
377
+ });
367
378
  (_getApmInstance = getApmInstance()) === null || _getApmInstance === void 0 || _getApmInstance.captureError(forApm);
368
379
  }
369
380
  }, {
@@ -11265,7 +11276,7 @@ var DrawerMenu$1 = observer(DrawerMenu);
11265
11276
  function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11266
11277
  function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11267
11278
  var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
11268
- return import('./ModalsWrapper-27da6315.js');
11279
+ return import('./ModalsWrapper-f36b1249.js');
11269
11280
  });
11270
11281
  function Fullscreen(_ref) {
11271
11282
  var inAbsoluteFullscreen = _ref.inAbsoluteFullscreen;
@@ -11727,10 +11738,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
11727
11738
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11728
11739
  var LOG$2 = getLogger('Framework', 'Root');
11729
11740
  var LazyAuth = /*#__PURE__*/React.lazy(function () {
11730
- return import('./index-567626bf.js');
11741
+ return import('./index-6b15c31c.js');
11731
11742
  });
11732
11743
  var LazyModals = /*#__PURE__*/React.lazy(function () {
11733
- return import('./ModalsWrapper-27da6315.js');
11744
+ return import('./ModalsWrapper-f36b1249.js');
11734
11745
  });
11735
11746
  function ContentComponent() {
11736
11747
  var context = useDivaCoreContext();
@@ -1,7 +1,8 @@
1
- export { f as AnalyticsHandler, A as AuthorizationHandler, j as ClientArticleHandler, C as Content, k as DivaMockProvider, D as DrawerMenuComponent, H as HelpButton, O as ONE_DAY_UNIX, h as OrganizationHandler, P as ProductHandler, R as RequestStatus, S as SupportHandler, b as default, g as getLogger, d as getNativeArPlatform, c as getUserAgentInfo, i as i18n, e as isWebXrArSupported, o as openQuickLook, l as storyBookCoreMock, a as useDivaCore } from './index-05778c92.js';
1
+ export { f as AnalyticsHandler, A as AuthorizationHandler, j as ClientArticleHandler, C as Content, k as DivaMockProvider, D as DrawerMenuComponent, H as HelpButton, O as ONE_DAY_UNIX, h as OrganizationHandler, P as ProductHandler, R as RequestStatus, S as SupportHandler, b as default, g as getLogger, d as getNativeArPlatform, c as getUserAgentInfo, i as i18n, e as isWebXrArSupported, o as openQuickLook, l as storyBookCoreMock, a as useDivaCore } from './index-dc443f1a.js';
2
2
  export { DivaError, default as DivaUtils } from '@crystaldesign/diva-utils';
3
3
  export { Trans, useTranslation } from 'react-i18next';
4
4
  export * from '@crystaldesign/basket-model';
5
+ import '@babel/runtime/helpers/readOnlyError';
5
6
  import '@babel/runtime/helpers/classCallCheck';
6
7
  import '@babel/runtime/helpers/createClass';
7
8
  import '@babel/runtime/helpers/defineProperty';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ApplicationLogger.apmError.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplicationLogger.apmError.test.d.ts","sourceRoot":"","sources":["../../../../../src/tests/ApplicationLogger.apmError.test.ts"],"names":[],"mappings":""}
@@ -65,7 +65,8 @@ export declare class ApplicationLogger {
65
65
  debug(message: string, ...optionalParams: any[]): void;
66
66
  log(message: string, ...optionalParams: any[]): void;
67
67
  warn(message: string, ...optionalParams: any[]): void;
68
- error(error: DivaError): void;
68
+ /** Logs an error to the console, the host's onError event and APM; a plain string is wrapped in a DivaError. */
69
+ error(errorOrMessage: DivaError | string): void;
69
70
  isValidLogLevel(loglevel: number): boolean;
70
71
  private getPrefix;
71
72
  private getApmTransationIdFormatted;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/utils/ApplicationLogger/index.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAEhC,OAAkB,EAAE,WAAW,EAAE,WAAW,EAAU,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAqBnG,qBAAa,iBAAiB;IAI1B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,cAAc;IALxB,OAAO,CAAC,YAAY,CAAkC;gBAG5C,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,MAAM,EACjB,cAAc,GAAE,OAAe;IAEzC;;;;;;;;;OASG;IACH,gBAAgB,CAAC,EACf,KAAK,EACL,OAAO,EACP,MAAW,EACX,OAAO,EACP,WAAW,EACX,SAAS,GACV,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE;YAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;SAAE,CAAC;QAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;IAyBD;;;;OAIG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,S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