mario-core 1.2.22-es-prod → 1.2.23-es-prod
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/index.d.ts +2 -1
- package/dist/index.js +56 -22
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +56 -23
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -110,4 +110,5 @@ import useFilters from "./hooks/useFilters";
|
|
|
110
110
|
import getStaticFileUrl from "./utils/getStaticFileUrl";
|
|
111
111
|
import { setLanguage } from "./redux/commons/action";
|
|
112
112
|
import NotificationLogoutModal from "./components/Modals/NotificationLogoutModal";
|
|
113
|
-
|
|
113
|
+
import getAccessToken from "./utils/getAccessToken";
|
|
114
|
+
export { Login, Dashboard, TheLayout, TheContent, NotFound, EmailTemplateList, EmailTemplateDetail, FaqList, SkillList, UserContainer, UserDetail, Loading, NotificationModal, CommonHeader, CommonModal, AddButton, DeleteButtonIcon, EditButtonIcon, LinkEditButton, ToggleButton, EmptyDataAlert, CreatableSelector, CustomPagination, SearchBox, FileInput, QuitPrompt, QuestionTypeSelector, QuestionCategorySelector, SuggestionCategorySelector, ErrorHandler, DetailActionButtons, RequiredLabel, StarRatingSelector, ReactNotification, NotificationList, CustomSelector, UploadFileButton, SearchBoxContainer, CustomTab, CommonAlert, GalleryList, MediaList, useGalleryList, AcademicClassSelector, SchoolList, store, showMenuBar, showFontSize, setLoading, setModal, setAlert, setClassList, setConferenceRubricList, setSuggestionList, setStrategyList, setSubjectList, setLearningSupportCategoryList, setQuestionList, setUserList, setStudentList, setBadgeList, setGoalExampleList, setSemesterList, setFeedbackList, setAssessmentList, setQuestionByCategory, setSelectQuestion, setMoveItemQuestion, setReflectionList, setReflectionResultList, setEditItemQuesion, setResetQuestionList, setMailCategory, setUser, setAssignmentList, setAssistantList, setSessionTemplateList, setTutorialScreenList, setSessionTemplateGeneralClassList, setCustomAlertList, setCertificateList, setUnreadNotification, closeTab, addTab, editTab, clearTab, changeNote, changeTags, answerQuestion, setSessionPlayer, setStartTime, setTurnOffPassWhenChangeMode, reset, setImproveMyClass, setSchoolBlankDayList, setEnableIEP, setEnableSurvey, setConversationOneToOne, i18n, useTranslation, I18nextProvider, api, apiUpload, uploadFile, systemStudentBadge, systemCertificateUpload, BASE_URL, DEFAULT_FILTER, LICENSE_AGGRID, TINY_MCE_API_KEY, QUESTION_TYPES, QUESTION_TYPES_OPTIONS, ANSWER_EDITOR_HEIGHT, CHAT_CHANNEL, NOTIFICATION_CHANNEL, DATE_RESULT, DATE_FORMAT, FULL_DATE_RESULT, ACCESS_TOKEN, GOOGLE_RECAPTCHA_KEY, EMOTIONS, TAB_COLORS, Filter, Conversation, Message, ConversationMember, NavbarTab, editorConfig, generateRandomString, isInViewport, debounce, firstCheckToken, canAccessRoute, getFileUrl, getTextFromHTML, utcToLocalTime, getInfo, getLanguage, Images, setQuestionCateList, setMyStudent, setDataPlayer, answerQuestionDataPlayer, setCurrentStudentUserId, setCurrentStudentId, setCurrentStudentName, setFilterWidget, setBandScoreList, setStudentIdSelectedByTeacher, useFilters, ScrollToTop, isLocalhost, getStaticFileUrl, setLanguage, DEFAULT_LANGUAGE_CODE, LANGUAGES, SUPPORTED_LANGUAGES_CODE, IS_USER_SESSION_BROWSER, TheLanguageDropdown, NOTIFICATION_ALERT_KEY, NotificationLogoutModal, getAccessToken };
|
package/dist/index.js
CHANGED
|
@@ -32206,7 +32206,12 @@ var generateRandomString = (function () {
|
|
|
32206
32206
|
return (Math.random() + 1).toString(36).substring(7);
|
|
32207
32207
|
});
|
|
32208
32208
|
|
|
32209
|
+
var IDLE_MINUTES_WARNING = 13;
|
|
32210
|
+
var AUTO_LOGOUT_MINUTES = 15;
|
|
32211
|
+
|
|
32209
32212
|
var NotificationLogoutModal = function NotificationLogoutModal() {
|
|
32213
|
+
var history = reactRouterDom.useHistory();
|
|
32214
|
+
|
|
32210
32215
|
var _useState = React.useState(false),
|
|
32211
32216
|
isOpen = _useState[0],
|
|
32212
32217
|
setIsOpen = _useState[1];
|
|
@@ -32218,37 +32223,65 @@ var NotificationLogoutModal = function NotificationLogoutModal() {
|
|
|
32218
32223
|
objTime = _useState2[0],
|
|
32219
32224
|
setObjTime = _useState2[1];
|
|
32220
32225
|
|
|
32226
|
+
var getLastActivity = function getLastActivity() {
|
|
32227
|
+
try {
|
|
32228
|
+
var _localStorage$getItem, _localStorage, _localStorage$getItem2;
|
|
32229
|
+
|
|
32230
|
+
return (_localStorage$getItem = (_localStorage = localStorage) === null || _localStorage === void 0 ? void 0 : (_localStorage$getItem2 = _localStorage.getItem) === null || _localStorage$getItem2 === void 0 ? void 0 : _localStorage$getItem2.call(_localStorage, "LAST_ACTIVITY_TIME")) != null ? _localStorage$getItem : null;
|
|
32231
|
+
} catch (_unused) {
|
|
32232
|
+
return null;
|
|
32233
|
+
}
|
|
32234
|
+
};
|
|
32235
|
+
|
|
32236
|
+
var doLogout = function doLogout() {
|
|
32237
|
+
localStorage.removeItem(ACCESS_TOKEN);
|
|
32238
|
+
sessionStorage.removeItem(ACCESS_TOKEN);
|
|
32239
|
+
localStorage.removeItem("ROLES");
|
|
32240
|
+
localStorage.removeItem("LAST_ACTIVITY_TIME");
|
|
32241
|
+
setIsOpen(false);
|
|
32242
|
+
history.replace("/login");
|
|
32243
|
+
};
|
|
32244
|
+
|
|
32221
32245
|
var checkOpenModalLogout = function checkOpenModalLogout() {
|
|
32222
|
-
var
|
|
32223
|
-
|
|
32246
|
+
var accessToken = getAccessToken();
|
|
32247
|
+
if (!accessToken) return;
|
|
32248
|
+
var lastActivity = getLastActivity();
|
|
32249
|
+
|
|
32250
|
+
if (!lastActivity) {
|
|
32251
|
+
var _localStorage2, _localStorage2$setIte;
|
|
32252
|
+
|
|
32253
|
+
(_localStorage2 = localStorage) === null || _localStorage2 === void 0 ? void 0 : (_localStorage2$setIte = _localStorage2.setItem) === null || _localStorage2$setIte === void 0 ? void 0 : _localStorage2$setIte.call(_localStorage2, "LAST_ACTIVITY_TIME", new Date().toISOString());
|
|
32254
|
+
return;
|
|
32255
|
+
}
|
|
32256
|
+
|
|
32257
|
+
var timeMoment = moment(lastActivity, "YYYY-MM-DD HH:mm");
|
|
32224
32258
|
var currentTime = moment(moment().utc().format("YYYY-MM-DD HH:mm"));
|
|
32225
32259
|
var minutes = currentTime.diff(timeMoment, "minutes");
|
|
32226
|
-
var timeLogout = utcToLocalTime(currentTime.add(16 - minutes, 'minutes').format("YYYY-MM-DD HH:mm"), "HH:mm");
|
|
32227
32260
|
|
|
32228
|
-
if (minutes
|
|
32229
|
-
|
|
32261
|
+
if (minutes >= AUTO_LOGOUT_MINUTES) {
|
|
32262
|
+
doLogout();
|
|
32263
|
+
return;
|
|
32264
|
+
}
|
|
32265
|
+
|
|
32266
|
+
var timeLogout = utcToLocalTime(currentTime.add(AUTO_LOGOUT_MINUTES - minutes, 'minutes').format("YYYY-MM-DD HH:mm"), "HH:mm");
|
|
32267
|
+
|
|
32268
|
+
if (minutes >= IDLE_MINUTES_WARNING) {
|
|
32269
|
+
setObjTime({
|
|
32230
32270
|
minutes: minutes,
|
|
32231
32271
|
timeLogout: timeLogout
|
|
32232
|
-
};
|
|
32233
|
-
|
|
32234
|
-
onToggle();
|
|
32272
|
+
});
|
|
32273
|
+
setIsOpen(true);
|
|
32235
32274
|
}
|
|
32236
32275
|
};
|
|
32237
32276
|
|
|
32238
32277
|
React.useEffect(function () {
|
|
32239
|
-
var
|
|
32240
|
-
|
|
32241
|
-
|
|
32242
|
-
|
|
32243
|
-
|
|
32244
|
-
|
|
32245
|
-
|
|
32246
|
-
return clearInterval(interval);
|
|
32247
|
-
};
|
|
32248
|
-
}
|
|
32249
|
-
|
|
32250
|
-
return;
|
|
32251
|
-
}, [location.href]);
|
|
32278
|
+
var interval = setInterval(function () {
|
|
32279
|
+
checkOpenModalLogout();
|
|
32280
|
+
}, 60 * 1000);
|
|
32281
|
+
return function () {
|
|
32282
|
+
return clearInterval(interval);
|
|
32283
|
+
};
|
|
32284
|
+
}, []);
|
|
32252
32285
|
|
|
32253
32286
|
var onToggle = function onToggle() {
|
|
32254
32287
|
setIsOpen(!isOpen);
|
|
@@ -32260,7 +32293,7 @@ var NotificationLogoutModal = function NotificationLogoutModal() {
|
|
|
32260
32293
|
size: "xs"
|
|
32261
32294
|
}, React__default.createElement(reactstrap.ModalHeader, {
|
|
32262
32295
|
toggle: onToggle
|
|
32263
|
-
}, "Notification Logout"), React__default.createElement(reactstrap.ModalBody, null, "Are you still here? You have had no action for " + (objTime === null || objTime === void 0 ? void 0 : objTime.minutes) + " mins. \n Your account could be log out after " + (
|
|
32296
|
+
}, "Notification Logout"), React__default.createElement(reactstrap.ModalBody, null, "Are you still here? You have had no action for " + (objTime === null || objTime === void 0 ? void 0 : objTime.minutes) + " mins. \n Your account could be log out after " + (AUTO_LOGOUT_MINUTES - (objTime === null || objTime === void 0 ? void 0 : objTime.minutes)) + " mins at " + (objTime === null || objTime === void 0 ? void 0 : objTime.timeLogout) + " if you don't action."), React__default.createElement(reactstrap.ModalFooter, {
|
|
32264
32297
|
className: "text-right"
|
|
32265
32298
|
}, React__default.createElement(reactstrap.Button, {
|
|
32266
32299
|
color: "primary",
|
|
@@ -32719,6 +32752,7 @@ exports.editTab = editTab;
|
|
|
32719
32752
|
exports.editorConfig = editorConfig;
|
|
32720
32753
|
exports.firstCheckToken = firstCheckToken;
|
|
32721
32754
|
exports.generateRandomString = generateRandomString;
|
|
32755
|
+
exports.getAccessToken = getAccessToken;
|
|
32722
32756
|
exports.getFileUrl = getFileUrl;
|
|
32723
32757
|
exports.getInfo = getInfo;
|
|
32724
32758
|
exports.getLanguage = getLanguage;
|