@dexteel/mesf-core 3.1.0 → 3.2.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.
- package/dist/account/login.d.ts +0 -6
- package/dist/account/logout.d.ts +0 -6
- package/dist/index.esm.js +62 -19
- package/package.json +3 -3
package/dist/account/login.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { LoginParams } from "./models/login.models";
|
|
4
3
|
export declare function Login({ authConfig }: LoginParams): JSX.Element;
|
|
5
|
-
export declare namespace Login {
|
|
6
|
-
var propTypes: {
|
|
7
|
-
setToken: PropTypes.Requireable<(...args: any[]) => any>;
|
|
8
|
-
};
|
|
9
|
-
}
|
package/dist/account/logout.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -29,7 +29,7 @@ import MomentUtils from '@date-io/moment';
|
|
|
29
29
|
import Select from '@material-ui/core/Select';
|
|
30
30
|
import MenuItem from '@material-ui/core/MenuItem';
|
|
31
31
|
import InputLabel from '@material-ui/core/InputLabel';
|
|
32
|
-
import { FormHelperText, TextField as TextField$1, CircularProgress as CircularProgress$1, Typography as Typography$1 } from '@material-ui/core';
|
|
32
|
+
import { FormHelperText, TextField as TextField$1, CircularProgress as CircularProgress$1, Typography as Typography$1, Snackbar as Snackbar$1 } from '@material-ui/core';
|
|
33
33
|
import FormControl from '@material-ui/core/FormControl';
|
|
34
34
|
import FormGroup from '@material-ui/core/FormGroup';
|
|
35
35
|
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
@@ -38,7 +38,7 @@ import FormHelperText$1 from '@material-ui/core/FormHelperText';
|
|
|
38
38
|
import stc from 'string-to-color';
|
|
39
39
|
import DeleteIcon from '@material-ui/icons/Delete';
|
|
40
40
|
import EditIcon from '@material-ui/icons/Edit';
|
|
41
|
-
import { Outlet, useNavigate, Link, useParams, Navigate, Routes, Route, BrowserRouter } from 'react-router-dom';
|
|
41
|
+
import { Outlet, useNavigate, useSearchParams, Link, useParams, Navigate, Routes, Route, BrowserRouter } from 'react-router-dom';
|
|
42
42
|
import PropTypes from 'prop-types';
|
|
43
43
|
import { ResponsiveBar } from '@nivo/bar';
|
|
44
44
|
import DatePicker from 'react-datepicker';
|
|
@@ -3820,6 +3820,7 @@ var Configuration$1 = /** @class */ (function () {
|
|
|
3820
3820
|
return Configuration;
|
|
3821
3821
|
}());
|
|
3822
3822
|
|
|
3823
|
+
var base$1 = document.getElementsByTagName('base')[0].getAttribute('href') || '/';
|
|
3823
3824
|
var MESApiService = /** @class */ (function () {
|
|
3824
3825
|
function MESApiService() {
|
|
3825
3826
|
this.config = new Configuration$1();
|
|
@@ -3982,6 +3983,9 @@ var MESApiService = /** @class */ (function () {
|
|
|
3982
3983
|
throw new FetchError(errorMsg.message, 404, "ERR_CONNECTION_REFUSED");
|
|
3983
3984
|
})
|
|
3984
3985
|
.then(function (response) {
|
|
3986
|
+
if (response.status === 401) {
|
|
3987
|
+
window.location.href = "".concat(base$1, "logout?message=Session%20expired&redirectTo=").concat(window.location.href);
|
|
3988
|
+
}
|
|
3985
3989
|
isError = { ok: response.ok, status: response.status, statusText: response.statusText };
|
|
3986
3990
|
return response.json();
|
|
3987
3991
|
})
|
|
@@ -4031,6 +4035,9 @@ var MESApiService = /** @class */ (function () {
|
|
|
4031
4035
|
throw new FetchError(errorMsg.message, 404, "ERR_CONNECTION_REFUSED");
|
|
4032
4036
|
})
|
|
4033
4037
|
.then(function (response) {
|
|
4038
|
+
if (response.status === 401) {
|
|
4039
|
+
window.location.href = "".concat(base$1, "logout?message=Session%20expired&redirectTo=").concat(window.location.href);
|
|
4040
|
+
}
|
|
4034
4041
|
isError = { ok: response.ok, status: response.status, statusText: response.statusText };
|
|
4035
4042
|
return response.json();
|
|
4036
4043
|
})
|
|
@@ -4083,6 +4090,9 @@ var MESApiService = /** @class */ (function () {
|
|
|
4083
4090
|
throw new FetchError(errorMsg.message, 404, "ERR_CONNECTION_REFUSED");
|
|
4084
4091
|
})
|
|
4085
4092
|
.then(function (response) {
|
|
4093
|
+
if (response.status === 401) {
|
|
4094
|
+
window.location.href = "".concat(base$1, "logout?message=Session%20expired&redirectTo=").concat(window.location.href);
|
|
4095
|
+
}
|
|
4086
4096
|
isError = { ok: response.ok, status: response.status, statusText: response.statusText };
|
|
4087
4097
|
return response.json();
|
|
4088
4098
|
})
|
|
@@ -4133,6 +4143,9 @@ var MESApiService = /** @class */ (function () {
|
|
|
4133
4143
|
throw new FetchError(errorMsg.message, 404, "ERR_CONNECTION_REFUSED");
|
|
4134
4144
|
})
|
|
4135
4145
|
.then(function (response) {
|
|
4146
|
+
if (response.status === 401) {
|
|
4147
|
+
window.location.href = "".concat(base$1, "logout?message=Session%20expired&redirectTo=").concat(window.location.href);
|
|
4148
|
+
}
|
|
4136
4149
|
isError = { ok: response.ok, status: response.status, statusText: response.statusText };
|
|
4137
4150
|
if (!isError.ok)
|
|
4138
4151
|
return response.json();
|
|
@@ -4199,6 +4212,9 @@ var MESApiService = /** @class */ (function () {
|
|
|
4199
4212
|
throw new FetchError(errorMsg.message, 404, "ERR_CONNECTION_REFUSED");
|
|
4200
4213
|
})
|
|
4201
4214
|
.then(function (response) {
|
|
4215
|
+
if (response.status === 401) {
|
|
4216
|
+
window.location.href = "".concat(base$1, "logout?message=Session%20expired&redirectTo=").concat(window.location.href);
|
|
4217
|
+
}
|
|
4202
4218
|
isError = { ok: response.ok, status: response.status, statusText: response.statusText };
|
|
4203
4219
|
if (!isError.ok)
|
|
4204
4220
|
return response.json();
|
|
@@ -5239,8 +5255,7 @@ var Authenticated = function (_a) {
|
|
|
5239
5255
|
};
|
|
5240
5256
|
var Unauthenticated = function (_a) {
|
|
5241
5257
|
var authConfig = _a.authConfig;
|
|
5242
|
-
return (React__default.createElement(
|
|
5243
|
-
React__default.createElement(Login, { authConfig: authConfig })));
|
|
5258
|
+
return (React__default.createElement(Login, { authConfig: authConfig }));
|
|
5244
5259
|
};
|
|
5245
5260
|
|
|
5246
5261
|
var LoginWithEmailAndPassword = function () {
|
|
@@ -5440,9 +5455,26 @@ var LoginAsGuest = function () {
|
|
|
5440
5455
|
|
|
5441
5456
|
function Login(_a) {
|
|
5442
5457
|
var authConfig = _a.authConfig;
|
|
5458
|
+
var params = useRef((new URL(document.location)).searchParams);
|
|
5459
|
+
var _b = useState(false), open = _b[0], setOpen = _b[1];
|
|
5460
|
+
var _c = useState(''), message = _c[0], setMessage = _c[1];
|
|
5443
5461
|
var useEmailAndPassword = get$1(authConfig, 'useEmailAndPassword', true);
|
|
5444
5462
|
var useAzureAD = get$1(authConfig, 'useAzureAD', false);
|
|
5445
5463
|
var guestIsEnabled = get$1(authConfig, 'guestIsEnabled', false);
|
|
5464
|
+
var handleClose = function () {
|
|
5465
|
+
setOpen(false);
|
|
5466
|
+
params.current["delete"]('message');
|
|
5467
|
+
var newUrl = window.location.origin
|
|
5468
|
+
+ window.location.pathname
|
|
5469
|
+
+ '?' + params.current.toString();
|
|
5470
|
+
window.history.replaceState({ path: newUrl }, '', newUrl);
|
|
5471
|
+
};
|
|
5472
|
+
useEffect(function () {
|
|
5473
|
+
if (params.current.has('message')) {
|
|
5474
|
+
setMessage(params.current.get('message'));
|
|
5475
|
+
setOpen(true);
|
|
5476
|
+
}
|
|
5477
|
+
}, [params.toString()]);
|
|
5446
5478
|
return (React__default.createElement(React__default.Fragment, null,
|
|
5447
5479
|
React__default.createElement("header", null,
|
|
5448
5480
|
React__default.createElement(Navbar, { variant: "dark", expand: "lg", className: "mes-primary-color mes-menu-top" },
|
|
@@ -5455,20 +5487,19 @@ function Login(_a) {
|
|
|
5455
5487
|
React__default.createElement("div", { className: "card-body m-3" },
|
|
5456
5488
|
useEmailAndPassword && React__default.createElement(LoginWithEmailAndPassword, null),
|
|
5457
5489
|
useAzureAD && React__default.createElement(LoginWithAzureAD, { config: authConfig.AzureConfig }),
|
|
5458
|
-
guestIsEnabled && React__default.createElement(LoginAsGuest, null))))))
|
|
5459
|
-
}
|
|
5460
|
-
|
|
5461
|
-
setToken: PropTypes.func
|
|
5462
|
-
};
|
|
5490
|
+
guestIsEnabled && React__default.createElement(LoginAsGuest, null)))))),
|
|
5491
|
+
React__default.createElement(Snackbar$1, { open: open, autoHideDuration: 6000, onClose: handleClose, message: message })));
|
|
5492
|
+
}
|
|
5463
5493
|
|
|
5464
5494
|
function Logout() {
|
|
5465
5495
|
var _this = this;
|
|
5466
5496
|
var clearToken = useContext(AuthContext).clearToken;
|
|
5467
5497
|
var navigate = useNavigate();
|
|
5498
|
+
var _a = useSearchParams(), params = _a[0]; _a[1];
|
|
5468
5499
|
var logout = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
5469
5500
|
return __generator(this, function (_a) {
|
|
5470
5501
|
clearToken();
|
|
5471
|
-
navigate("
|
|
5502
|
+
navigate("/?".concat(params.toString()));
|
|
5472
5503
|
return [2 /*return*/];
|
|
5473
5504
|
});
|
|
5474
5505
|
}); };
|
|
@@ -5477,10 +5508,7 @@ function Logout() {
|
|
|
5477
5508
|
}, []);
|
|
5478
5509
|
return (React__default.createElement(React__default.Fragment, null,
|
|
5479
5510
|
React__default.createElement("div", null, "logging out!!!")));
|
|
5480
|
-
}
|
|
5481
|
-
Logout.propTypes = {
|
|
5482
|
-
clearEvent: PropTypes.func
|
|
5483
|
-
};
|
|
5511
|
+
}
|
|
5484
5512
|
|
|
5485
5513
|
var RouterContext = React__default.createContext(function () { return React__default.createElement(React__default.Fragment, null); });
|
|
5486
5514
|
var ConfigurationContext = React__default.createContext([
|
|
@@ -5611,16 +5639,31 @@ var MESFMainRouter = function () {
|
|
|
5611
5639
|
var MESFMainContainer = function () { return (React__default.createElement("div", { id: "mainSection", className: "container-fluid container-fluid-main" },
|
|
5612
5640
|
React__default.createElement(MESFMainRouter, null))); };
|
|
5613
5641
|
|
|
5614
|
-
var Navigation = function () {
|
|
5615
|
-
|
|
5642
|
+
var Navigation = function () {
|
|
5643
|
+
var _a = useSearchParams(), params = _a[0]; _a[1];
|
|
5644
|
+
var mounted = useRef(true);
|
|
5645
|
+
useEffect(function () {
|
|
5646
|
+
mounted.current = true;
|
|
5647
|
+
if (params.has('redirectTo')) {
|
|
5648
|
+
setTimeout(function () {
|
|
5649
|
+
if (mounted.current) {
|
|
5650
|
+
window.location.href = decodeURI(params.get('redirectTo'));
|
|
5651
|
+
}
|
|
5652
|
+
}, 100);
|
|
5653
|
+
}
|
|
5654
|
+
return function () {
|
|
5655
|
+
mounted.current = false;
|
|
5656
|
+
};
|
|
5657
|
+
}, [params.toString()]);
|
|
5658
|
+
return (React__default.createElement("div", { className: "wrapper" },
|
|
5616
5659
|
React__default.createElement(Header, null),
|
|
5617
|
-
React__default.createElement(MESFMainContainer, null)))
|
|
5660
|
+
React__default.createElement(MESFMainContainer, null)));
|
|
5661
|
+
};
|
|
5618
5662
|
|
|
5619
5663
|
var css = "body {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n background-color: #fafbfc !important;\n}\n.container-fluid-main{\n padding-right: 0px !important; \n padding-left: 0px !important;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n monospace;\n}\n\n.mes-primary-color {\n background-color: #479dc4 !important;\n}\n.mes-button-primary{\n background-color: #479dc4 !important;\n border-color: #479dc4 !important;\n}\n\n.mes-selectable-datagrid .MuiDataGrid-row{\n cursor: pointer;\n}\n\n.mes-menu-top .navbar-brand{\n color: #FFFF !important;\n}\n.mes-menu-top .nav-link {\n color: #FFFF !important;\n}\n.mes-menu-top .navbar-toggler {\n color: #FFFF !important;\n}\n.mes-menu-top .navbar-text {\n color: #FFFF !important;\n}\n.mes-footer-login{\n position: absolute;\n bottom: 0;\n width: 100%;\n height: 10em;\n line-height: 60px;\n text-align:center;\n}\n.mes-filter-datepicker{\n padding: unset !important;\n border-top-left-radius: 0 !important;\n border-bottom-left-radius: 0 !important;\n padding-top: 0.375rem !important;\n padding-bottom: 0.375rem !important;\n padding-left: 0.75rem !important;\n cursor: pointer !important;\n max-width: 120px;\n}\n.mes-filter-datetimepicker{\n max-width: 97px;\n}\n.mes-not-rounded{\n border-radius: unset !important;\n}\n\n.mes-numeric{\n text-align: right;\n}\n.mes-drag-over{\n border: 3px dotted #666;\n background-color: #479dc4 !important;\n}\n.mes-drag-start{\n border: 3px solid #666;\n}\n\n.mes-selectable{\n cursor: pointer !important;\n}\n\n.mes-custom-select{\n width: auto !important;\n padding: 0.375rem 0 0.375rem 0 !important;\n background: unset !important;\n font-family: inherit !important;\n}\n.mes-custom-select .MuiSelect-select{\n padding-left: 14px;\n}\n\n.mes-custom-select::before{\n border-bottom: unset !important;\n}\n.mes-custom-select::after{\n border-bottom: unset !important;\n}\n.mes-no-border{\n border: unset;\n}\n.mes-no-border:focus-visible {\n outline: unset;\n}\n.mes-div-submenu{\n border-right: 1px solid #cfdbe2; \n}\n.mes-submenu a{\n width: 100% !important;\n /* color: rgba(0, 0, 0, 0.87); */\n color: #479dc4\n}\n.mes-submenu .Mui-selected{\n border-right: 3px solid #479dc4; \n}\n.mes-menu-group{\n font-size: 20px;\n line-height: 1.1;\n color: #929292; \n font-weight: normal; \n}\n\n/********************MUI DATAGRID*****************************/\n.Mui-selected{\n font-weight: bolder !important;\n opacity: 1 !important;\n}\n\n.mes-upload-control{\n\n}\n.mes-upload-control .file-box{\n /* border : 1px solid black; */\n height : 100px;\n position: relative; \n}\n.mes-upload-control .file-detail{\n position: absolute;\n left: 0px;\n top: 0px; \n z-index: 1;\n height: 100%;\n width: 100%;\n}\n\n.mes-upload-control input[type=file]{\n left: 0px;\n top: 0px;\n opacity: 0;\n z-index: 10000;\n height: 100%;\n cursor: pointer;\n}\n.mes-upload-control table{\n width: 100%;\n}\n.mes-upload-control td{\n font-size: 0.8rem !important;\n max-width:0;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;\n}\n\n\n.input-group-text{\n background-color: #ced2cc !important;\n /* border: 1px solid #ced4da !important; */\n /* color: #000000 !important; */\n}\n\n\n\n\n.content-wrapper {\n padding: 15px;\n width: 100%;\n border-top: 1px solid rgba(0, 0, 0, 0.15);\n margin-top: -1px;\n}\n.content-wrapper > .unwrap {\n margin: -15px;\n}\n@media only screen and (min-width: 768px) {\n .content-wrapper > .unwrap {\n margin: -20px;\n }\n}\n.content-wrapper > h3,\n.content-wrapper > .content-heading {\n font-size: 24px;\n line-height: 1.1;\n color: #929292;\n margin: -15px;\n margin-bottom: 20px;\n padding: 15px;\n font-weight: normal;\n background-color: #fafbfc;\n border-bottom: 1px solid #cfdbe2;\n}\n.content-wrapper > h3 > small,\n.content-wrapper > .content-heading > small {\n display: block;\n font-size: 12px;\n color: #909fa7;\n}\n.content-wrapper > button,\n.content-wrapper > .btn {\n margin: 10px 10px 0 0;\n}\n.content-wrapper .container,\n.content-wrapper .container-fluid {\n padding-left: 0;\n padding-right: 0;\n}\n@media only screen and (min-width: 768px) {\n .content-wrapper {\n padding: 20px;\n }\n .content-wrapper > h3,\n .content-wrapper > .content-heading {\n margin: -20px;\n margin-bottom: 5px;\n padding: 15px;\n }\n .content-wrapper > button,\n .content-wrapper > .btn {\n margin: 0;\n }\n}\n\n @media print {\n .sidebar,\n .topnavbar,\n .offsidebar,\n .btn {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n .wrapper,\n .wrapper > section,\n .content-wrapper {\n margin: 0 !important;\n /* remove margin used for sidebar and expand the content */\n padding: 0 !important;\n width: 100% !important;\n }\n .content-wrapper {\n overflow: hidden !important;\n }\n }\n ";
|
|
5620
5664
|
n(css,{});
|
|
5621
5665
|
|
|
5622
|
-
var
|
|
5623
|
-
var base = ((_a = document.getElementsByTagName('base')[0].getAttribute('href')) === null || _a === void 0 ? void 0 : _a.replace(/\/$/, "")) || '/';
|
|
5666
|
+
var base = document.getElementsByTagName('base')[0].getAttribute('href') || '/';
|
|
5624
5667
|
function MESFMain(props) {
|
|
5625
5668
|
return (React__default.createElement(AuthProvider, { authConfig: props.authentication },
|
|
5626
5669
|
React__default.createElement(RouterContext.Provider, { value: props.routes },
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexteel/mesf-core",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"author": "Lucas Rueda",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"prepublish": "rimraf -rf ./dist && npm run build",
|
|
9
9
|
"build": "rimraf -rf ./dist && rollup -c",
|
|
10
|
-
"watch": "rollup -wc",
|
|
11
|
-
"start": "rollup -wc"
|
|
10
|
+
"watch": "cross-env rollup -wc",
|
|
11
|
+
"start": "cross-env rollup -wc"
|
|
12
12
|
},
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"devDependencies": {
|