tenjin-ui-kit 0.3.72-dev → 0.3.72
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.
|
@@ -15,7 +15,6 @@ var _button = _interopRequireDefault(require("../../button"));
|
|
|
15
15
|
var _modal = _interopRequireDefault(require("../../modal"));
|
|
16
16
|
var _text = _interopRequireDefault(require("../../text"));
|
|
17
17
|
var _UserAvatar = _interopRequireDefault(require("./UserAvatar"));
|
|
18
|
-
var _TranslateOutlined = _interopRequireDefault(require("@mui/icons-material/TranslateOutlined"));
|
|
19
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
21
20
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
@@ -60,15 +59,7 @@ const ProjectTopbar = _ref => {
|
|
|
60
59
|
_ref$announcement = _ref.announcement,
|
|
61
60
|
announcement = _ref$announcement === void 0 ? null : _ref$announcement,
|
|
62
61
|
_ref$isChatEnabled = _ref.isChatEnabled,
|
|
63
|
-
isChatEnabled = _ref$isChatEnabled === void 0 ? false : _ref$isChatEnabled
|
|
64
|
-
localeChangeCallBack = _ref.localeChangeCallBack,
|
|
65
|
-
localeList = _ref.localeList,
|
|
66
|
-
selectedLocale = _ref.selectedLocale,
|
|
67
|
-
administrationLabel = _ref.administrationLabel,
|
|
68
|
-
aboutLabel = _ref.aboutLabel,
|
|
69
|
-
logoutConfirmLabel = _ref.logoutConfirmLabel,
|
|
70
|
-
cancelLabel = _ref.cancelLabel,
|
|
71
|
-
logoutLabel = _ref.logoutLabel;
|
|
62
|
+
isChatEnabled = _ref$isChatEnabled === void 0 ? false : _ref$isChatEnabled;
|
|
72
63
|
const theme = (0, _system.useTheme)();
|
|
73
64
|
const _useState = (0, _react.useState)(null),
|
|
74
65
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -78,44 +69,6 @@ const ProjectTopbar = _ref => {
|
|
|
78
69
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
79
70
|
openMenuIndex = _useState4[0],
|
|
80
71
|
setOpenMenuIndex = _useState4[1];
|
|
81
|
-
const defaultLocaleList = [{
|
|
82
|
-
label: "English",
|
|
83
|
-
value: "en"
|
|
84
|
-
}, {
|
|
85
|
-
label: "Spanish",
|
|
86
|
-
value: "es"
|
|
87
|
-
}];
|
|
88
|
-
const getLocale = () => {
|
|
89
|
-
const lang = selectedLocale || getFromLocalStorage("lang") || getFromCookie("lang") || "en";
|
|
90
|
-
console.log("inside getLocale checklang ==", lang);
|
|
91
|
-
return lang;
|
|
92
|
-
};
|
|
93
|
-
function getFromLocalStorage(key) {
|
|
94
|
-
console.log("inside getFromLocalStorage checklang ==");
|
|
95
|
-
return localStorage.getItem(key);
|
|
96
|
-
}
|
|
97
|
-
function getFromCookie(name) {
|
|
98
|
-
console.log("inside getFromCookie checklang ==");
|
|
99
|
-
const cookies = document.cookie.split("; ");
|
|
100
|
-
for (let cookie of cookies) {
|
|
101
|
-
const _cookie$split = cookie.split("="),
|
|
102
|
-
_cookie$split2 = _slicedToArray(_cookie$split, 2),
|
|
103
|
-
key = _cookie$split2[0],
|
|
104
|
-
value = _cookie$split2[1];
|
|
105
|
-
if (key === name) {
|
|
106
|
-
return decodeURIComponent(value);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
const _useState5 = (0, _react.useState)(getLocale),
|
|
112
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
113
|
-
lang = _useState6[0],
|
|
114
|
-
setLang = _useState6[1];
|
|
115
|
-
const _useState7 = (0, _react.useState)(() => localeList || defaultLocaleList),
|
|
116
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
117
|
-
localeOpts = _useState8[0],
|
|
118
|
-
setLocaleOpts = _useState8[1];
|
|
119
72
|
const updatedActions = (0, _react.useMemo)(() => {
|
|
120
73
|
const base = [...actions];
|
|
121
74
|
// if (isChatEnabled) {
|
|
@@ -157,10 +110,10 @@ const ProjectTopbar = _ref => {
|
|
|
157
110
|
};
|
|
158
111
|
|
|
159
112
|
// Logout related code starts
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
open =
|
|
163
|
-
setOpen =
|
|
113
|
+
const _useState5 = (0, _react.useState)(false),
|
|
114
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
115
|
+
open = _useState6[0],
|
|
116
|
+
setOpen = _useState6[1];
|
|
164
117
|
const handleOpen = () => setOpen(true);
|
|
165
118
|
const handleClose = () => setOpen(false);
|
|
166
119
|
const logout = () => {
|
|
@@ -274,27 +227,7 @@ const ProjectTopbar = _ref => {
|
|
|
274
227
|
sx: {
|
|
275
228
|
marginLeft: "5px"
|
|
276
229
|
}
|
|
277
|
-
}, item.subtitle)), item.divider && index !== action.dropdown.length - 1 && /*#__PURE__*/_react.default.createElement(_material.Divider, null)), item.divider && index === action.dropdown.length - 1 && /*#__PURE__*/_react.default.createElement(_material.Divider, null))))))))),
|
|
278
|
-
className: "Right",
|
|
279
|
-
sx: {
|
|
280
|
-
justifySelf: "right"
|
|
281
|
-
},
|
|
282
|
-
display: "flex",
|
|
283
|
-
alignItems: "center"
|
|
284
|
-
}, " ", /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TranslateOutlined.default, {
|
|
285
|
-
color: "primary"
|
|
286
|
-
}), /*#__PURE__*/_react.default.createElement(_material.Select, {
|
|
287
|
-
value: lang,
|
|
288
|
-
label: "Language",
|
|
289
|
-
onChange: e => {
|
|
290
|
-
setLang(e.target.value);
|
|
291
|
-
localeChangeCallBack(e.target.value);
|
|
292
|
-
},
|
|
293
|
-
variant: "standard"
|
|
294
|
-
}, localeOpts.map(opt => /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
295
|
-
key: opt.value,
|
|
296
|
-
value: opt.value
|
|
297
|
-
}, opt.label))))), /*#__PURE__*/_react.default.createElement(_system.Box, {
|
|
230
|
+
}, item.subtitle)), item.divider && index !== action.dropdown.length - 1 && /*#__PURE__*/_react.default.createElement(_material.Divider, null)), item.divider && index === action.dropdown.length - 1 && /*#__PURE__*/_react.default.createElement(_material.Divider, null))))))))), /*#__PURE__*/_react.default.createElement(_system.Box, {
|
|
298
231
|
className: "Right",
|
|
299
232
|
sx: {
|
|
300
233
|
justifySelf: "right",
|
|
@@ -337,7 +270,7 @@ const ProjectTopbar = _ref => {
|
|
|
337
270
|
style: {
|
|
338
271
|
fontWeight: "600"
|
|
339
272
|
}
|
|
340
|
-
},
|
|
273
|
+
}, "Administration")), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
341
274
|
variant: "text",
|
|
342
275
|
startIcon: /*#__PURE__*/_react.default.createElement(_fi.FiInfo, {
|
|
343
276
|
size: "1rem"
|
|
@@ -350,7 +283,7 @@ const ProjectTopbar = _ref => {
|
|
|
350
283
|
style: {
|
|
351
284
|
fontWeight: "600"
|
|
352
285
|
}
|
|
353
|
-
},
|
|
286
|
+
}, "About")), /*#__PURE__*/_react.default.createElement(_system.Box, {
|
|
354
287
|
sx: {
|
|
355
288
|
marginLeft: theme.spacing(1)
|
|
356
289
|
}
|
|
@@ -365,7 +298,7 @@ const ProjectTopbar = _ref => {
|
|
|
365
298
|
handleClose: handleClose,
|
|
366
299
|
onClose: handleClose,
|
|
367
300
|
width: "sm"
|
|
368
|
-
}, /*#__PURE__*/_react.default.createElement(_text.default, null,
|
|
301
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, "Are you sure you want to log out?"), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
369
302
|
container: true,
|
|
370
303
|
direction: "row",
|
|
371
304
|
justifyContent: "flex-end",
|
|
@@ -379,10 +312,10 @@ const ProjectTopbar = _ref => {
|
|
|
379
312
|
}, /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
380
313
|
variant: "outlined",
|
|
381
314
|
onClick: handleClose
|
|
382
|
-
}, /*#__PURE__*/_react.default.createElement(_text.default, null,
|
|
315
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, "Cancel")), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
383
316
|
color: "error",
|
|
384
317
|
onClick: logout
|
|
385
|
-
}, /*#__PURE__*/_react.default.createElement(_text.default, null,
|
|
318
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, "Log out"))))));
|
|
386
319
|
};
|
|
387
320
|
ProjectTopbar.propTypes = {};
|
|
388
321
|
var _default = exports.default = ProjectTopbar;
|
|
@@ -20,8 +20,7 @@ function Pagination(_ref) {
|
|
|
20
20
|
setPage = _ref.setPage,
|
|
21
21
|
rowsPerPage = _ref.rowsPerPage,
|
|
22
22
|
setRowsPerPage = _ref.setRowsPerPage,
|
|
23
|
-
totalPage = _ref.totalPage
|
|
24
|
-
ofLabel = _ref.ofLabel;
|
|
23
|
+
totalPage = _ref.totalPage;
|
|
25
24
|
const _React$useState = React.useState(false),
|
|
26
25
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
27
26
|
negativeState = _React$useState2[0],
|
|
@@ -68,7 +67,7 @@ function Pagination(_ref) {
|
|
|
68
67
|
backgroundColor: "transparent",
|
|
69
68
|
margin: "0 8px"
|
|
70
69
|
}
|
|
71
|
-
}), " ",
|
|
70
|
+
}), " ", "of ", Math.ceil(totalPage / rowsPerPage));
|
|
72
71
|
}
|
|
73
72
|
}));
|
|
74
73
|
}
|
package/http/index.js
CHANGED
|
@@ -125,7 +125,7 @@ const parseAxiosError = error => {
|
|
|
125
125
|
parsedError = _objectSpread(_objectSpread({}, parsedError), {}, {
|
|
126
126
|
status: error.response.status,
|
|
127
127
|
statusText: error.response.statusText,
|
|
128
|
-
message: error.response.status === 503 ? (_error$response$data$ = error.response.data.message) !== null && _error$response$data$ !== void 0 ? _error$response$data$ : "A network error occurred. Please try again" : error.response.status === 401 ? "Authentication Failed" : error.response.data ? error.response.data.message
|
|
128
|
+
message: error.response.status === 503 ? (_error$response$data$ = error.response.data.message) !== null && _error$response$data$ !== void 0 ? _error$response$data$ : "A network error occurred. Please try again" : error.response.status === 401 ? "Authentication Failed" : error.response.data ? error.response.data.message || error.response.data.detail || "An unexpected error occurred while processing your request. Please try again. If problem persists, please contact Tenjin support" : "An unexpected error occurred while processing your request. Please try again. If problem persists, please contact Tenjin support"
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
return parsedError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tenjin-ui-kit",
|
|
3
|
-
"version": "0.3.72
|
|
3
|
+
"version": "0.3.72",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://gitlab.com/yethi/react/tenjin-ui-kit.git"
|
|
6
6
|
},
|
|
@@ -89,7 +89,6 @@
|
|
|
89
89
|
"@babel/preset-react": "^7.18.6",
|
|
90
90
|
"@emotion/react": "^11.10.5",
|
|
91
91
|
"@emotion/styled": "^11.10.5",
|
|
92
|
-
"@mui/lab": "5.0.0-alpha.116",
|
|
93
92
|
"@mui/material": "^5.11.3",
|
|
94
93
|
"@storybook/addon-actions": "^6.5.15",
|
|
95
94
|
"@storybook/addon-essentials": "^6.5.15",
|
|
@@ -101,10 +100,8 @@
|
|
|
101
100
|
"@storybook/preset-create-react-app": "^4.1.2",
|
|
102
101
|
"@storybook/react": "^6.5.15",
|
|
103
102
|
"@storybook/testing-library": "^0.0.13",
|
|
104
|
-
"ajv": "^8.20.0",
|
|
105
103
|
"babel-plugin-named-exports-order": "^0.0.2",
|
|
106
104
|
"cross-env": "^7.0.3",
|
|
107
|
-
"postcss": "^8.5.15",
|
|
108
105
|
"prop-types": "^15.8.1",
|
|
109
106
|
"react": "^18.2.0",
|
|
110
107
|
"react-dom": "^18.2.0",
|