dce-reactkit 2.0.7 → 2.0.8
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.
|
@@ -13,7 +13,8 @@ declare type Props = {
|
|
|
13
13
|
* Show a fatal error message
|
|
14
14
|
* @author Gabe Abrams
|
|
15
15
|
* @param error the error to show
|
|
16
|
+
* @param [errorTitle] title of the error box
|
|
16
17
|
*/
|
|
17
|
-
export declare const showFatalError: (error: any) => void;
|
|
18
|
+
export declare const showFatalError: (error: any, errorTitle?: string) => void;
|
|
18
19
|
declare const AppWrapper: (props: Props) => React.ReactElement;
|
|
19
20
|
export default AppWrapper;
|
|
@@ -37,13 +37,16 @@ var ErrorWithCode_1 = __importDefault(require("../errors/ErrorWithCode"));
|
|
|
37
37
|
// Stored copies of setters
|
|
38
38
|
var setFatalErrorMessage;
|
|
39
39
|
var setFatalErrorCode;
|
|
40
|
+
var setFatalErrorTitle;
|
|
40
41
|
/**
|
|
41
42
|
* Show a fatal error message
|
|
42
43
|
* @author Gabe Abrams
|
|
43
44
|
* @param error the error to show
|
|
45
|
+
* @param [errorTitle] title of the error box
|
|
44
46
|
*/
|
|
45
|
-
var showFatalError = function (error) {
|
|
47
|
+
var showFatalError = function (error, errorTitle) {
|
|
46
48
|
var _a, _b;
|
|
49
|
+
if (errorTitle === void 0) { errorTitle = 'An Error Occurred'; }
|
|
47
50
|
// Determine message and code
|
|
48
51
|
var message = (typeof error === 'string'
|
|
49
52
|
? error.trim()
|
|
@@ -58,6 +61,7 @@ var showFatalError = function (error) {
|
|
|
58
61
|
// Use setters
|
|
59
62
|
setFatalErrorMessage(message);
|
|
60
63
|
setFatalErrorCode(code);
|
|
64
|
+
setFatalErrorTitle(errorTitle);
|
|
61
65
|
};
|
|
62
66
|
exports.showFatalError = showFatalError;
|
|
63
67
|
/*------------------------------------------------------------------------*/
|
|
@@ -75,8 +79,10 @@ var AppWrapper = function (props) {
|
|
|
75
79
|
setFatalErrorMessage = setFatalErrorMessageInner;
|
|
76
80
|
var _c = (0, react_1.useState)(null), fatalErrorCode = _c[0], setFatalErrorCodeInner = _c[1];
|
|
77
81
|
setFatalErrorCode = setFatalErrorCodeInner;
|
|
82
|
+
var _d = (0, react_1.useState)(null), fatalErrorTitle = _d[0], setFatalErrorTitleInner = _d[1];
|
|
83
|
+
setFatalErrorTitle = setFatalErrorCodeInner;
|
|
78
84
|
// Session expired
|
|
79
|
-
var
|
|
85
|
+
var _e = (0, react_1.useState)(false), sessionHasExpired = _e[0], setSessionHasExpired = _e[1];
|
|
80
86
|
/*------------------------------------------------------------------------*/
|
|
81
87
|
/* Lifecycle Functions */
|
|
82
88
|
/*------------------------------------------------------------------------*/
|
|
@@ -114,7 +120,7 @@ var AppWrapper = function (props) {
|
|
|
114
120
|
: '#fff'),
|
|
115
121
|
} }, { children: (0, jsx_runtime_1.jsx)(ErrorBox_1.default, { title: (sessionHasExpired
|
|
116
122
|
? 'Session Expired'
|
|
117
|
-
:
|
|
123
|
+
: fatalErrorTitle), error: error }) })));
|
|
118
124
|
}
|
|
119
125
|
// Show the app itself
|
|
120
126
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppWrapper.js","sourceRoot":"","sources":["../../src/components/AppWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AAEH,eAAe;AACf,+BAAmD;AAEnD,2BAA2B;AAC3B,wDAAkC;AAElC,iBAAiB;AACjB,sEAAyE;AAEzE,sBAAsB;AACtB,iFAA2D;AAE3D,uBAAuB;AACvB,0EAAoD;AAepD,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,2BAA2B;AAC3B,IAAI,oBAA+C,CAAC;AACpD,IAAI,iBAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"AppWrapper.js","sourceRoot":"","sources":["../../src/components/AppWrapper.tsx"],"names":[],"mappings":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cAAc,CACf;YACD,CAAC,CAAC,IAAI,uBAAa,CACjB,qBAAqB,EACrB,2BAAiB,CAAC,cAAc,CACjC,CACJ,CAAC;QAEF,qBAAqB;QACrB,OAAO,CACL,yCACE,KAAK,EAAE;gBACL,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,OAAO;gBACd,SAAS,EAAE,OAAO;gBAClB,UAAU,EAAE,OAAO;gBACnB,eAAe,EAAE,CACf,IAAI;oBACF,CAAC,CAAC,MAAM;oBACR,CAAC,CAAC,MAAM,CACX;aACF,gBAED,uBAAC,kBAAQ,IACP,KAAK,EAAE,CACL,iBAAiB;oBACf,CAAC,CAAC,iBAAiB;oBACnB,CAAC,CAAC,eAAe,CACpB,EACD,KAAK,EAAE,KAAK,GACZ,IACE,CACP,CAAC;KACH;IAED,sBAAsB;IACtB,OAAO,CACL,2DACG,QAAQ,GACR,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAE5E,mBAAmB;AACnB,kBAAe,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -39,13 +39,18 @@ type Props = {
|
|
|
39
39
|
// Stored copies of setters
|
|
40
40
|
let setFatalErrorMessage: (message: string) => void;
|
|
41
41
|
let setFatalErrorCode: (code: string) => void;
|
|
42
|
+
let setFatalErrorTitle: (title: string) => void;
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* Show a fatal error message
|
|
45
46
|
* @author Gabe Abrams
|
|
46
47
|
* @param error the error to show
|
|
48
|
+
* @param [errorTitle] title of the error box
|
|
47
49
|
*/
|
|
48
|
-
export const showFatalError = (
|
|
50
|
+
export const showFatalError = (
|
|
51
|
+
error: any,
|
|
52
|
+
errorTitle: string = 'An Error Occurred',
|
|
53
|
+
) => {
|
|
49
54
|
// Determine message and code
|
|
50
55
|
const message: string = (
|
|
51
56
|
typeof error === 'string'
|
|
@@ -66,6 +71,7 @@ export const showFatalError = (error: any) => {
|
|
|
66
71
|
// Use setters
|
|
67
72
|
setFatalErrorMessage(message);
|
|
68
73
|
setFatalErrorCode(code);
|
|
74
|
+
setFatalErrorTitle(errorTitle);
|
|
69
75
|
};
|
|
70
76
|
|
|
71
77
|
/*------------------------------------------------------------------------*/
|
|
@@ -92,6 +98,8 @@ const AppWrapper = (props: Props): React.ReactElement => {
|
|
|
92
98
|
setFatalErrorMessage = setFatalErrorMessageInner;
|
|
93
99
|
const [fatalErrorCode, setFatalErrorCodeInner] = useState(null);
|
|
94
100
|
setFatalErrorCode = setFatalErrorCodeInner;
|
|
101
|
+
const [fatalErrorTitle, setFatalErrorTitleInner] = useState(null);
|
|
102
|
+
setFatalErrorTitle = setFatalErrorCodeInner;
|
|
95
103
|
|
|
96
104
|
// Session expired
|
|
97
105
|
const [sessionHasExpired, setSessionHasExpired] = useState(false);
|
|
@@ -157,7 +165,7 @@ const AppWrapper = (props: Props): React.ReactElement => {
|
|
|
157
165
|
title={(
|
|
158
166
|
sessionHasExpired
|
|
159
167
|
? 'Session Expired'
|
|
160
|
-
:
|
|
168
|
+
: fatalErrorTitle
|
|
161
169
|
)}
|
|
162
170
|
error={error}
|
|
163
171
|
/>
|