studiokit-scaffolding-js 4.12.0 → 4.12.1-alpha.1
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,11 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as Sentry from '@sentry/react';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
|
+
export interface ShowReportDialogButtonProps {
|
|
4
|
+
eventId: string;
|
|
5
|
+
className?: string;
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
9
|
-
render(): {} | null | undefined;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
7
|
+
export declare const ShowReportDialogButton: FunctionComponent<ShowReportDialogButtonProps>;
|
|
8
|
+
export declare const ErrorBoundary: FunctionComponent<Sentry.ErrorBoundaryProps>;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
13
10
|
};
|
|
14
|
-
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
15
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
14
|
if (k2 === undefined) k2 = k;
|
|
17
15
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -31,44 +29,73 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
31
29
|
__setModuleDefault(result, mod);
|
|
32
30
|
return result;
|
|
33
31
|
};
|
|
32
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
33
|
+
var t = {};
|
|
34
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
35
|
+
t[p] = s[p];
|
|
36
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
37
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
38
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
39
|
+
t[p[i]] = s[p[i]];
|
|
40
|
+
}
|
|
41
|
+
return t;
|
|
42
|
+
};
|
|
43
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
44
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45
|
+
};
|
|
34
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.ErrorBoundary = exports.ShowReportDialogButton = void 0;
|
|
48
|
+
var Button_1 = __importDefault(require("@material-ui/core/Button"));
|
|
49
|
+
var BugReport_1 = __importDefault(require("@material-ui/icons/BugReport"));
|
|
50
|
+
var Refresh_1 = __importDefault(require("@material-ui/icons/Refresh"));
|
|
35
51
|
var Sentry = __importStar(require("@sentry/react"));
|
|
36
52
|
var react_1 = __importStar(require("react"));
|
|
37
53
|
var react_bootstrap_1 = require("react-bootstrap");
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
var react_redux_1 = require("react-redux");
|
|
55
|
+
var user_1 = require("../utils/user");
|
|
56
|
+
var ShowReportDialogButton = function (_a) {
|
|
57
|
+
var className = _a.className, eventId = _a.eventId;
|
|
58
|
+
var userInfo = react_redux_1.useSelector(function (state) {
|
|
59
|
+
var _a;
|
|
60
|
+
return (_a = state.models.user) === null || _a === void 0 ? void 0 : _a.userInfo;
|
|
61
|
+
});
|
|
62
|
+
var showDialog = react_1.useCallback(function () {
|
|
63
|
+
var user = userInfo
|
|
64
|
+
? { name: user_1.displayName(userInfo) || undefined, email: userInfo.email || undefined }
|
|
65
|
+
: undefined;
|
|
66
|
+
Sentry.showReportDialog({
|
|
67
|
+
eventId: eventId,
|
|
68
|
+
user: user
|
|
50
69
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
}, [eventId, userInfo]);
|
|
71
|
+
return (react_1.default.createElement(Button_1.default, { className: className, "aria-label": "Send Crash Report", onClick: showDialog },
|
|
72
|
+
react_1.default.createElement(BugReport_1.default, null),
|
|
73
|
+
" Send Crash Report"));
|
|
74
|
+
};
|
|
75
|
+
exports.ShowReportDialogButton = ShowReportDialogButton;
|
|
76
|
+
var ErrorBoundary = function (_a) {
|
|
77
|
+
var children = _a.children, props = __rest(_a, ["children"]);
|
|
78
|
+
return (react_1.default.createElement(Sentry.ErrorBoundary
|
|
79
|
+
// set default props
|
|
80
|
+
, __assign({
|
|
81
|
+
// set default props
|
|
82
|
+
fallback: function (_a) {
|
|
83
|
+
var eventId = _a.eventId, resetError = _a.resetError;
|
|
84
|
+
return (react_1.default.createElement(react_bootstrap_1.Container, { className: "mt3" },
|
|
85
|
+
react_1.default.createElement(react_bootstrap_1.Row, null,
|
|
86
|
+
react_1.default.createElement(react_bootstrap_1.Col, { md: 8 },
|
|
87
|
+
react_1.default.createElement("h2", null, "Oops! Something went wrong while processing your request."),
|
|
88
|
+
react_1.default.createElement("p", { className: "mb2" }, "Please try reloading or refresh the page to try again."),
|
|
89
|
+
react_1.default.createElement("p", { className: "mb0" },
|
|
90
|
+
react_1.default.createElement(exports.ShowReportDialogButton, { className: "btn-primary", eventId: eventId }),
|
|
91
|
+
react_1.default.createElement(Button_1.default, { className: "ml2 btn-primary", "aria-label": "Reload", onClick: resetError },
|
|
92
|
+
react_1.default.createElement(Refresh_1.default, null),
|
|
93
|
+
" Reload")),
|
|
94
|
+
react_1.default.createElement("p", null,
|
|
95
|
+
"If the problem persists please contact us at",
|
|
96
|
+
' ',
|
|
97
|
+
react_1.default.createElement("a", { href: "mailto:tlt@purdue.edu" }, "tlt@purdue.edu"),
|
|
98
|
+
".")))));
|
|
99
|
+
} }, props), children));
|
|
100
|
+
};
|
|
101
|
+
exports.ErrorBoundary = ErrorBoundary;
|
|
@@ -83,7 +83,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
83
83
|
};
|
|
84
84
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
85
|
var react_1 = __importStar(require("react"));
|
|
86
|
-
var ErrorBoundary_1 =
|
|
86
|
+
var ErrorBoundary_1 = require("../ErrorBoundary");
|
|
87
87
|
var Loading_1 = __importDefault(require("../Loading"));
|
|
88
88
|
function asyncComponent(importComponent, showLoader) {
|
|
89
89
|
if (showLoader === void 0) { showLoader = true; }
|
|
@@ -127,7 +127,7 @@ function asyncComponent(importComponent, showLoader) {
|
|
|
127
127
|
if (!ImportedComponent) {
|
|
128
128
|
return showLoader ? react_1.default.createElement(Loading_1.default, null) : null;
|
|
129
129
|
}
|
|
130
|
-
return (react_1.default.createElement(ErrorBoundary_1.
|
|
130
|
+
return (react_1.default.createElement(ErrorBoundary_1.ErrorBoundary, null,
|
|
131
131
|
react_1.default.createElement(ImportedComponent, __assign({}, this.props))));
|
|
132
132
|
};
|
|
133
133
|
return AsyncComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "studiokit-scaffolding-js",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.1-alpha.1",
|
|
4
4
|
"description": "Common scaffolding for Studio apps at Purdue",
|
|
5
5
|
"repository": "https://gitlab.com/purdue-informatics/studiokit/studiokit-scaffolding-js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
]
|
|
86
86
|
},
|
|
87
87
|
"resolutions": {
|
|
88
|
-
"@sentry/browser": "^7.
|
|
88
|
+
"@sentry/browser": "^7.77.0",
|
|
89
89
|
"@types/react": "^17.0.0",
|
|
90
90
|
"@types/react-router": "^5.1.11",
|
|
91
91
|
"kind-of": "^6.0.3",
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"@material-ui/lab": "^4.0.0-alpha.57",
|
|
101
101
|
"@microsoft/applicationinsights-web": "^2.5.11",
|
|
102
102
|
"@redux-saga/types": "^1.1.0",
|
|
103
|
-
"@sentry/react": "^7.
|
|
104
|
-
"@sentry/tracing": "^7.
|
|
103
|
+
"@sentry/react": "^7.77.0",
|
|
104
|
+
"@sentry/tracing": "^7.77.0",
|
|
105
105
|
"@types/history": "^4.7.8",
|
|
106
106
|
"@types/lodash": "^4.14.168",
|
|
107
107
|
"@types/pluralize": "^0.0.29",
|