@shopgate/pwa-common 7.32.2-alpha.5 → 7.32.2-alpha.7
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.
|
@@ -39,7 +39,9 @@ export default function handleLink(payload, allowExternalLinks = false) {
|
|
|
39
39
|
pathname
|
|
40
40
|
} = new URL(link));
|
|
41
41
|
} catch (linkParseError) {
|
|
42
|
-
|
|
42
|
+
// The error is sent to Sentry. Query string and hash can contain tokens, so they are
|
|
43
|
+
// left out, and so is the error of the browser, which can contain the whole link.
|
|
44
|
+
logger.error(new Error(`Could not parse link ${link.split(/[?#]/)[0]}`));
|
|
43
45
|
}
|
|
44
46
|
} else {
|
|
45
47
|
// Remove the deeplink protocol from the link.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
2
|
import { PureComponent } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { toError } from '@shopgate/pwa-core/helpers/error';
|
|
4
5
|
import connector from "./connector";
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -35,9 +36,9 @@ let ErrorBoundary = /*#__PURE__*/function (_PureComponent) {
|
|
|
35
36
|
};
|
|
36
37
|
var _proto = ErrorBoundary.prototype;
|
|
37
38
|
_proto.componentDidCatch = function componentDidCatch(error, errorInfo) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
this.props.appError(toError(error, {
|
|
40
|
+
componentStack: errorInfo.componentStack
|
|
41
|
+
}));
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Portal/index.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Portal/index.jsx"],"names":[],"mappings":";AAQA;;GAEG;AACH;IACE;;;;MAIE;IAEF;;;MAGE;IAEF;;;OAGG;IACH,mBAFW,MAAM,EAUhB;IALC;;MAEC;IAED,kBAAsD;IAGxD;;;;OAIG;IACH,yBAHW,KAAK,QACL,MAAM,QAKhB;IAED;;;;OAIG;IACH,wBAAyB,OAHd,MAGmB,WAa5B;IAEF;;;;OAIG;IACH,sBAAuB,MAHZ,MAGgB,WA0CzB;IAEF;;;OAGG;IACH,UAFY,GAAG,CAiCd;CACF;kBAxJ8C,OAAO;sBAChC,YAAY"}
|
|
@@ -2,6 +2,7 @@ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
|
2
2
|
import React, { PureComponent, Suspense } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { logger } from '@shopgate/pwa-core/helpers';
|
|
5
|
+
import { toError } from '@shopgate/pwa-core/helpers/error';
|
|
5
6
|
import Loading from "../Loading";
|
|
6
7
|
import portalCollection from "../../helpers/portals/portalCollection";
|
|
7
8
|
import { componentsConfig } from "../../helpers/config";
|
|
@@ -104,7 +105,9 @@ let Portal = /*#__PURE__*/function (_PureComponent) {
|
|
|
104
105
|
this.setState({
|
|
105
106
|
hasError: true
|
|
106
107
|
});
|
|
107
|
-
logger.error(error,
|
|
108
|
+
logger.error(toError(error, {
|
|
109
|
+
componentStack: info.componentStack
|
|
110
|
+
}));
|
|
108
111
|
};
|
|
109
112
|
/**
|
|
110
113
|
* Renders the component.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-common",
|
|
3
|
-
"version": "7.32.2-alpha.
|
|
3
|
+
"version": "7.32.2-alpha.7",
|
|
4
4
|
"description": "Common library for the Shopgate Connect PWA.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"swiper": "12.2.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@shopgate/pwa-core": "7.32.2-alpha.
|
|
46
|
+
"@shopgate/pwa-core": "7.32.2-alpha.7",
|
|
47
47
|
"@types/lodash": "^4.17.25",
|
|
48
48
|
"@types/react-portal": "^3.0.9",
|
|
49
49
|
"lodash": "^4.18.1",
|
package/subscriptions/error.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { isAvailable } from '@shopgate/native-modules';
|
|
2
|
-
import { init, addBreadcrumb, setTags, captureException,
|
|
2
|
+
import { init, addBreadcrumb, setTags, captureException, captureEvent, withScope } from '@sentry/browser';
|
|
3
3
|
import { router } from '@virtuous/conductor';
|
|
4
4
|
import { EBIGAPI, emitter, errorManager, ETIMEOUT, ENETUNREACH, EUNKNOWN, EFAVORITE } from '@shopgate/pwa-core';
|
|
5
5
|
import { hasWebBridge } from '@shopgate/engage/core';
|
|
6
6
|
import { SOURCE_TRACKING, SOURCE_CONSOLE, Severity } from '@shopgate/pwa-core/constants/ErrorManager';
|
|
7
|
+
import { describeValue } from '@shopgate/pwa-core/helpers/error';
|
|
7
8
|
import { main$ } from "../streams/main";
|
|
8
9
|
import {
|
|
9
10
|
// eslint-disable-next-line import/no-named-default
|
|
@@ -13,10 +14,11 @@ import { transformGeneralPipelineError, getDisplayErrorMessage } from "./helpers
|
|
|
13
14
|
import { historyPop } from "../actions/router";
|
|
14
15
|
import showModal from "../actions/modal/showModal";
|
|
15
16
|
import { clientInformationDidUpdate$ } from "../streams/client";
|
|
16
|
-
import { appWillInit$, appWillStart
|
|
17
|
+
import { appWillInit$, appWillStart$ } from "../streams/app";
|
|
17
18
|
import { appError$, pipelineError$ } from "../streams/error";
|
|
18
19
|
import { getRouterStack } from "../selectors/router";
|
|
19
20
|
import { MODAL_PIPELINE_ERROR } from "../constants/ModalTypes";
|
|
21
|
+
import { APP_ERROR } from "../constants/ActionTypes";
|
|
20
22
|
import ToastProvider from "../providers/toast";
|
|
21
23
|
|
|
22
24
|
// Generic, translated fallback shown when a backend error carries no code we can map to a message.
|
|
@@ -272,21 +274,32 @@ export default subscribe => {
|
|
|
272
274
|
isReactNativeApp: isAvailable(),
|
|
273
275
|
merchantCode: appConfig.omniMerchantCode
|
|
274
276
|
});
|
|
275
|
-
emitter.addListener(
|
|
277
|
+
emitter.addListener(SOURCE_CONSOLE, args => {
|
|
278
|
+
const error = args.find(arg => arg instanceof Error);
|
|
279
|
+
const texts = args.filter(arg => arg !== error).map(describeValue);
|
|
280
|
+
if (!error) {
|
|
281
|
+
addBreadcrumb({
|
|
282
|
+
category: 'logger',
|
|
283
|
+
message: texts.join(' '),
|
|
284
|
+
level: 'error'
|
|
285
|
+
});
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
276
288
|
withScope(scope => {
|
|
277
|
-
|
|
289
|
+
scope.setLevel('error');
|
|
290
|
+
scope.setTag('source', SOURCE_CONSOLE);
|
|
291
|
+
if (texts.length > 0) {
|
|
292
|
+
scope.setExtra('details', texts);
|
|
293
|
+
}
|
|
294
|
+
if (error.source === SOURCE_TRACKING && error.context) {
|
|
278
295
|
scope.setExtra('trackerName', error.context);
|
|
279
296
|
}
|
|
297
|
+
if (error.componentStack) {
|
|
298
|
+
scope.setExtra('componentStack', error.componentStack);
|
|
299
|
+
}
|
|
280
300
|
captureException(error);
|
|
281
301
|
});
|
|
282
302
|
});
|
|
283
|
-
emitter.addListener(SOURCE_CONSOLE, args => {
|
|
284
|
-
withScope(scope => {
|
|
285
|
-
scope.setLevel('error');
|
|
286
|
-
scope.setExtra('error', args.map(arg => arg instanceof Error ? arg.message : String(arg)));
|
|
287
|
-
captureMessage('Console error');
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
303
|
});
|
|
291
304
|
subscribe(main$, ({
|
|
292
305
|
action
|
|
@@ -312,21 +325,16 @@ export default subscribe => {
|
|
|
312
325
|
});
|
|
313
326
|
});
|
|
314
327
|
|
|
315
|
-
// Add app start event for debugging
|
|
316
|
-
subscribe(appDidStart$, () => {
|
|
317
|
-
withScope(scope => {
|
|
318
|
-
scope.setLevel('debug');
|
|
319
|
-
captureMessage('App did start');
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
|
|
323
328
|
// Add some stack trace and log to sentry
|
|
324
329
|
subscribe(appError$, ({
|
|
325
330
|
action
|
|
326
331
|
}) => {
|
|
332
|
+
if (!(action.error instanceof Error)) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
327
335
|
withScope(scope => {
|
|
328
|
-
if (action.error.
|
|
329
|
-
scope.setExtra('
|
|
336
|
+
if (action.error.componentStack) {
|
|
337
|
+
scope.setExtra('componentStack', action.error.componentStack);
|
|
330
338
|
}
|
|
331
339
|
captureException(action.error);
|
|
332
340
|
});
|
|
@@ -342,6 +350,9 @@ export default subscribe => {
|
|
|
342
350
|
const {
|
|
343
351
|
code
|
|
344
352
|
} = error;
|
|
353
|
+
if (action.type === APP_ERROR && error instanceof Error) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
345
356
|
withScope(scope => {
|
|
346
357
|
scope.setTag('error', 'E_USER');
|
|
347
358
|
scope.setTag('errorCode', code);
|