mario-education 2.4.302-layout → 2.4.303-layout

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,4 +1,4 @@
1
- import { api, BASE_URL, useTranslation as useTranslation$1, setAlert, CustomSelector, LinkEditButton, DeleteButtonIcon, EmptyDataAlert, CommonModal, RequiredLabel, ErrorHandler, useFilters, setLoading, setClassList, setModal, QuitPrompt, AddButton, CustomPagination, setConferenceRubricList, SearchBoxContainer, getTextFromHTML, DEFAULT_LANGUAGE_CODE, generateRandomString, SuggestionCategorySelector, CreatableSelector, setSuggestionList, setStrategyList, UploadFileButton, systemStudentBadge, setBadgeList, getFileUrl, setGoalExampleList, setSubjectList, setLearningSupportCategoryList, apiUpload, utcToLocalTime, setBandScoreList, EditButtonIcon, DATE_FORMAT, setSchoolBlankDayList, SearchBox, CustomTab, SkillList, QUESTION_TYPES, EMOTIONS, QUESTION_TYPES_OPTIONS, setQuestionList, QuestionCategorySelector, setQuestionByCategory, setSelectQuestion, setResetQuestionList, setMoveItemQuestion, setEditItemQuesion, DEFAULT_FILTER as DEFAULT_FILTER$2, setReflectionList, setReflectionResultList, DATE_RESULT, StarRatingSelector, QuestionTypeSelector, CategorySelector as CategorySelector$1, editorConfig, DetailActionButtons, setAssessmentList, FULL_DATE_RESULT, setFeedbackList, TINY_MCE_API_KEY, setTutorialScreenList, setQuestionCateList, setAssignmentList, setSessionTemplateList, setSessionTemplateGeneralClassList, setCustomAlertList, systemCertificateUpload, setCertificateList, getStaticFileUrl, ACCESS_TOKEN, reset, NOTIFICATION_ALERT_KEY, setUser, setSandboxMode, LANGUAGES, SUPPORTED_LANGUAGES_CODE, setLanguage, showMenuBar, showFontSize, NOTIFICATION_CHANNEL, setEnableIEP, setConversationOneToOne, setEnableSurvey, canAccessRoute, initAmplitude, firstCheckToken, getInfo, Loading as Loading$1, Dashboard as Dashboard$1, TheContent, LICENSE_AGGRID } from 'mario-core';
1
+ import { api, BASE_URL, useTranslation as useTranslation$1, setAlert, CustomSelector, LinkEditButton, DeleteButtonIcon, EmptyDataAlert, CommonModal, RequiredLabel, ErrorHandler, useFilters, setLoading, setClassList, setModal, QuitPrompt, AddButton, CustomPagination, setConferenceRubricList, SearchBoxContainer, getTextFromHTML, DEFAULT_LANGUAGE_CODE, generateRandomString, SuggestionCategorySelector, CreatableSelector, setSuggestionList, setStrategyList, UploadFileButton, systemStudentBadge, setBadgeList, getFileUrl, setGoalExampleList, setSubjectList, setLearningSupportCategoryList, apiUpload, utcToLocalTime, setBandScoreList, EditButtonIcon, DATE_FORMAT, setSchoolBlankDayList, SearchBox, CustomTab, SkillList, QUESTION_TYPES, EMOTIONS, QUESTION_TYPES_OPTIONS, setQuestionList, QuestionCategorySelector, setQuestionByCategory, setSelectQuestion, setResetQuestionList, setMoveItemQuestion, setEditItemQuesion, DEFAULT_FILTER as DEFAULT_FILTER$2, setReflectionList, setReflectionResultList, DATE_RESULT, StarRatingSelector, QuestionTypeSelector, CategorySelector as CategorySelector$1, editorConfig, DetailActionButtons, setAssessmentList, FULL_DATE_RESULT, setFeedbackList, TINY_MCE_API_KEY, setTutorialScreenList, setQuestionCateList, setAssignmentList, setSessionTemplateList, setSessionTemplateGeneralClassList, setCustomAlertList, systemCertificateUpload, setCertificateList, getStaticFileUrl, ACCESS_TOKEN, reset, NOTIFICATION_ALERT_KEY, setUser, setSandboxMode, getCookieValue, setLanguage, showMenuBar, showFontSize, NOTIFICATION_CHANNEL, setEnableIEP, setConversationOneToOne, setEnableSurvey, canAccessRoute, initAmplitude, firstCheckToken, getInfo, Loading as Loading$1, Dashboard as Dashboard$1, TheContent, LICENSE_AGGRID } from 'mario-core';
2
2
  import { LicenseManager } from '@ag-grid-enterprise/core';
3
3
  import * as React from 'react';
4
4
  import React__default, { useState, useRef, useCallback, useEffect, forwardRef, useMemo, Fragment as Fragment$1, memo, useLayoutEffect, useContext, createContext, createElement, Component } from 'react';
@@ -50046,92 +50046,83 @@ var CustomTabComponent = function CustomTabComponent(_ref) {
50046
50046
 
50047
50047
  var style$2 = {"font-large":"_356Xx","table-border":"_3rVdM","Close":"_2Vs6W","Active":"_fISYg","row_name":"_2-4H1","bg-red":"_1G8nL","bg-green":"_ATqes","bg-yellow":"_U2Fov","row-status":"_2mAty","table-class-type":"_2KRfC","box-form-input":"_3bgU2","box-content":"_4h5aW","confirm_btn_title":"_3vU-q","content":"_2eddN","btn-favorite-text":"_3bpqI","description-template-left":"_3BhUP","name-template-left":"_2CA9Q","data-grid-content":"_697ao","select-right":"_1J-bu","content-confirm-model":"_2pqFa","input-title":"_1Dfbh","total-card-title":"_2-hXf","title-filter":"_36snY","form-input-title":"_1FINV","list-favorite":"_3EcML","title":"_2sFa5","title-block":"_18vbq","box-additional-title":"_NUXao","dialog-title":"_1oyCk","title-chart":"_2Yhd1","btn-send-survey":"_1xze5","btn-cancel":"_1bqU6","chip-email-default":"_2xKhD","chip-email-checked":"_ouqj6","title-content":"_2O3Tp","create-btn":"_3Cux8","general-chart-title":"_2Lxtl","action-wrapper":"_rEUU_","action-item":"_2n3hL","survey-detail":"_3vJ-g","header-survey-detail":"_Ri4lG","content-header":"_M7dFA","survey-title":"_2APad","responses-distribution":"_1I0XZ","description":"_1hw5e","list-check-question":"_1Ejsc","select-question":"_2t6cX","question":"_2cNmh","ratings-of-questions":"_3225G","show-result":"_3KDFH","chart-result-for-question":"_N5fxX","parameter":"_1NNB0","percent":"_-Fj2n","chart":"_1Qyn4","legend":"_1tBch","avr":"_2TsdE","legend-item":"_3YpJk","name":"_2W9F-","action":"_Ldh2m","header-conduct":"_1npo6","student-detail":"_1pKV2","student-name":"_1GBNs","survey-name":"_2qlBy","conduct-body":"_1dxHK","response-question":"_3IlYT","title-model":"_1UBEA","total-cards":"_38gNv","card":"_C2FoT","response-body":"_3XFlg","student":"_2fuBW","date":"_QH_aS","answer":"_3Rool","none-answer":"_l65o6","font-small":"_1mTdj","option-select":"_32CPv","icon-add-header":"_2tltH","sup-require":"_3IAjJ","span-title":"_2vOMh","checked-favorite":"_JL458","flag":"_1jRbU","filter-desktop":"_1ByZl","h-75":"_2bC49","filter-mobile":"_39EFp","d-flex":"_3ILHs","flex-between":"_1Dy7M","pointer":"_1G7Oj","ml-10":"_3pvOS","mt-20":"_3QSsx","select-type":"_1zeZ3","all-student-survey":"_2rp1M","box-input-csv":"_HGXSI","icon":"_2jqP8","model-confirm-publish":"_1DLAE","box-email-content":"_3aA8I","input-mail-content":"_3HfSn","list-chip-email":"_2mJew","box-chip-email":"_2fwdD","table-desktop":"_3_y0a","table-container":"_DFKYF","data-grid":"_3EcnW","MuiDataGrid-columnSeparator":"_3P0hc","table-mobile":"_1iMfJ","block-list-survey":"_EuZ8_","box-filter":"_3utMA","block-total":"_qlUFF","list-card-right":"_Epdgt","filter-select":"_20eFs","box-filter-left":"_MtBqD","filter-item":"_1WJAo","box-filter-right":"_2VDGv","search-input-icon":"_1FexU","inputInput":"_2JzR2","external-item":"_2iP6U","action-view":"_6y3DH","time-Date":"_17nC2","time-Hours-Minute":"_1vEXB","table-row":"_1jd05","arrow-icon":"_3Urdb","table-cell":"_qPEQy","btn-function":"_2xh2d","btn-action-text":"_2KfG4","avatar_user":"_2mUU4","innerHtml":"_2fgAa","btn-open":"_fLtnC","date-schedule":"_1amhM","pending":"_38Q73","replied":"_2mi_L","actionneeded":"_3qg29","actionneed":"_3XKeC","noscheduled":"_salNB","scheduled":"_3vFP4","completed":"_FoXPx","notstartyet":"_3bhI6","flex-item":"_36RRe","mr-10":"_2A5LB","session":"_33gcZ","schedule-now":"_2BiiZ","block-filter":"_3qVjM","block-filter-right":"_1C7WS","create-survey-container":"_2_bhv","box-create-survey":"_1h2_-","box-list-favorite":"_2Np-n","check-box-btn":"_2KGDK","stepper":"_AHiUZ","step-label":"_6O2vy","dialog-select-template":"_Vb5G5","icon-btn":"_1aD3k","icon-remove":"_rxvBN","title-btn":"_3BDjW","title-box-model":"_3V3hO","box-content-select":"_1p5SM","title-content-select":"_1wY14","description-content-select":"_3AYvl","box-function":"_1yo2i","cancel_btn":"_2q0h5","confirm_btn":"_1wniK","confirm_btn_icon":"_3rnyp","remove_btn":"_3WkIH","remove_btn_title":"_14_xL","remove_btn_icon":"_3VptO","mid_btn":"_Psdg4","box-function-flex":"_2K1MV","box-collapse":"_2-Sse","box-collapse-top":"_miLBv","box-collapse-right":"_2xNTI","collapse-chip":"_13im8","collapse-left-title":"_aft4S","box-collapse-content-item":"_26SCl","block-review-detail":"_1d4Lf","block-content-review":"_12S3I","block-template-review":"_36gKq","block-template-left":"_lw5Ox","additional-box":"_3_5ab","header-item":"_1Q3h9","header-title":"_1WGNT","space-content":"_36P3O","table-title":"_1FCFx","table-status":"_L_uPM","box-header-select":"_1k-yH","header-select-name":"_32KLh","header-select-icon":"_28PLI","header-select-detail":"_ZI06k","list-question-select":"_2EaBh","new-survey":"_SLI97","box-survey":"_dVgqi","avt-user":"_2oBnh","infor":"_3HNaN","content-text":"_SIfgw","time":"_1Sje8","card-item-mobile":"_UEtvP","card-item-left":"_1IKvD","item-name":"_2vyTL","item-detail":"_1bzAB","item-date":"_vw-CP","item-date-content":"_3tsha","table-status-mobile":"_2yS_O","button-mobile":"_1WcRD","box-detail":"_2Mctt","btn-duplicate":"_3Gz-M","box-input":"_3VFOh","item-answer":"_1zSJi","box-favorite":"_2o2b0","overview-survey":"_2sVJR","chart-view-dashboard":"_1doPS","block-chart-wrapper":"_1lkE3","block-chart-title":"_9mzcE","block-chart-top":"_QLUQO","chart-left":"_2c6UE","chart-right":"_1Pmw_","block-header-chart":"_14hBc","column-chart-percent":"_1Ml_a","chart-background":"_2AO5K","custom-marker":"_21lNI","item-legend":"_3BpNG","mark-custom":"_tnwFd","label-legend-custom":"_2juK0","mark-legend":"_13l-r","label-chart":"_3KJlm","listItem":"_1sU--","item":"_397kU","item-checkbox":"_33URL","check-box":"_X-D1i","pie-chart":"_2-TOd","box-chart-title":"_Gijux","box-chart":"_3G2tI","legend-pie-custom":"_sm5jY","color-box":"_3LqNl","generate-flag":"_24iDw","flag-item":"_V8630","count":"_39_gg","red":"_1Qdq3","yellow":"_1ukSp","green":"_Aj1d4","select-filter-top":"_3vD8W","filter-box":"_2WhAK","accordion":"_QOqG1","expanded-summary":"_oa9O2","expanded-title":"_1gxS6","expanded-detail":"_1Uklu","oveview-style":"_DU0s_","item-container":"_17V8B","note-external":"_1Mvjg","icon-back-page":"_3ckSJ","dot":"_1vzYS","table-wrapper":"_z0mjD","pagination":"_kn_xp","dot-response":"_2Nrxx","dot-not-response":"_6GUzQ","middle":"_2gw2z","table-dropdown":"_13mck","table-header":"_nxpHH","tbody-table":"_34MIA"};
50048
50048
 
50049
- var _typeof_1$1 = createCommonjsModule(function (module) {
50050
- function _typeof(o) {
50051
- "@babel/helpers - typeof";
50052
-
50053
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
50054
- return typeof o;
50055
- } : function (o) {
50056
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
50057
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
50049
+ function warn() {
50050
+ if (console && console.warn) {
50051
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
50052
+ args[_key] = arguments[_key];
50053
+ }
50054
+ if (typeof args[0] === 'string') args[0] = `react-i18next:: ${args[0]}`;
50055
+ console.warn(...args);
50056
+ }
50058
50057
  }
50059
- module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
50060
- });
50061
-
50062
- unwrapExports(_typeof_1$1);
50063
-
50064
- var toPrimitive_1 = createCommonjsModule(function (module) {
50065
- var _typeof = _typeof_1$1["default"];
50066
- function toPrimitive(t, r) {
50067
- if ("object" != _typeof(t) || !t) return t;
50068
- var e = t[Symbol.toPrimitive];
50069
- if (void 0 !== e) {
50070
- var i = e.call(t, r || "default");
50071
- if ("object" != _typeof(i)) return i;
50072
- throw new TypeError("@@toPrimitive must return a primitive value.");
50058
+ const alreadyWarned = {};
50059
+ function warnOnce() {
50060
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
50061
+ args[_key2] = arguments[_key2];
50073
50062
  }
50074
- return ("string" === r ? String : Number)(t);
50063
+ if (typeof args[0] === 'string' && alreadyWarned[args[0]]) return;
50064
+ if (typeof args[0] === 'string') alreadyWarned[args[0]] = new Date();
50065
+ warn(...args);
50075
50066
  }
50076
- module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
50077
- });
50078
-
50079
- unwrapExports(toPrimitive_1);
50080
-
50081
- var toPropertyKey_1 = createCommonjsModule(function (module) {
50082
- var _typeof = _typeof_1$1["default"];
50083
-
50084
- function toPropertyKey(t) {
50085
- var i = toPrimitive_1(t, "string");
50086
- return "symbol" == _typeof(i) ? i : i + "";
50067
+ const loadedClb = (i18n, cb) => () => {
50068
+ if (i18n.isInitialized) {
50069
+ cb();
50070
+ } else {
50071
+ const initialized = () => {
50072
+ setTimeout(() => {
50073
+ i18n.off('initialized', initialized);
50074
+ }, 0);
50075
+ cb();
50076
+ };
50077
+ i18n.on('initialized', initialized);
50078
+ }
50079
+ };
50080
+ function loadNamespaces(i18n, ns, cb) {
50081
+ i18n.loadNamespaces(ns, loadedClb(i18n, cb));
50087
50082
  }
50088
- module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
50089
- });
50090
-
50091
- unwrapExports(toPropertyKey_1);
50092
-
50093
- var defineProperty$1 = createCommonjsModule(function (module) {
50094
- function _defineProperty(e, r, t) {
50095
- return (r = toPropertyKey_1(r)) in e ? Object.defineProperty(e, r, {
50096
- value: t,
50097
- enumerable: !0,
50098
- configurable: !0,
50099
- writable: !0
50100
- }) : e[r] = t, e;
50083
+ function loadLanguages(i18n, lng, ns, cb) {
50084
+ if (typeof ns === 'string') ns = [ns];
50085
+ ns.forEach(n => {
50086
+ if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
50087
+ });
50088
+ i18n.loadLanguages(lng, loadedClb(i18n, cb));
50101
50089
  }
50102
- module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
50103
- });
50104
-
50105
- var _defineProperty$2 = unwrapExports(defineProperty$1);
50106
-
50107
- var classCallCheck = createCommonjsModule(function (module) {
50108
- function _classCallCheck(a, n) {
50109
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
50090
+ function oldI18nextHasLoadedNamespace(ns, i18n) {
50091
+ let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
50092
+ const lng = i18n.languages[0];
50093
+ const fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
50094
+ const lastLng = i18n.languages[i18n.languages.length - 1];
50095
+ if (lng.toLowerCase() === 'cimode') return true;
50096
+ const loadNotPending = (l, n) => {
50097
+ const loadState = i18n.services.backendConnector.state[`${l}|${n}`];
50098
+ return loadState === -1 || loadState === 2;
50099
+ };
50100
+ if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
50101
+ if (i18n.hasResourceBundle(lng, ns)) return true;
50102
+ if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
50103
+ if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
50104
+ return false;
50110
50105
  }
50111
- module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
50112
- });
50113
-
50114
- var _classCallCheck$1 = unwrapExports(classCallCheck);
50115
-
50116
- var createClass = createCommonjsModule(function (module) {
50117
- function _defineProperties(e, r) {
50118
- for (var t = 0; t < r.length; t++) {
50119
- var o = r[t];
50120
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey_1(o.key), o);
50106
+ function hasLoadedNamespace(ns, i18n) {
50107
+ let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
50108
+ if (!i18n.languages || !i18n.languages.length) {
50109
+ warnOnce('i18n.languages were undefined or empty', i18n.languages);
50110
+ return true;
50121
50111
  }
50112
+ const isNewerI18next = i18n.options.ignoreJSONStructure !== undefined;
50113
+ if (!isNewerI18next) {
50114
+ return oldI18nextHasLoadedNamespace(ns, i18n, options);
50115
+ }
50116
+ return i18n.hasLoadedNamespace(ns, {
50117
+ lng: options.lng,
50118
+ precheck: (i18nInstance, loadNotPending) => {
50119
+ if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
50120
+ }
50121
+ });
50122
50122
  }
50123
- function _createClass(e, r, t) {
50124
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
50125
- writable: !1
50126
- }), e;
50127
- }
50128
- module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
50129
- });
50130
-
50131
- var _createClass$1 = unwrapExports(createClass);
50132
50123
 
50133
- var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
50134
- var htmlEntities = {
50124
+ const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
50125
+ const htmlEntities = {
50135
50126
  '&amp;': '&',
50136
50127
  '&#38;': '&',
50137
50128
  '&lt;': '<',
@@ -50153,16 +50144,10 @@ var htmlEntities = {
50153
50144
  '&#x2F;': '/',
50154
50145
  '&#47;': '/'
50155
50146
  };
50147
+ const unescapeHtmlEntity = m => htmlEntities[m];
50148
+ const unescape = text => text.replace(matchHtmlEntity, unescapeHtmlEntity);
50156
50149
 
50157
- var unescapeHtmlEntity = function unescapeHtmlEntity(m) {
50158
- return htmlEntities[m];
50159
- };
50160
-
50161
- var unescape = function unescape(text) {
50162
- return text.replace(matchHtmlEntity, unescapeHtmlEntity);
50163
- };
50164
-
50165
- var defaultOptions = {
50150
+ let defaultOptions = {
50166
50151
  bindI18n: 'languageChanged',
50167
50152
  bindI18nStore: '',
50168
50153
  transEmptyNodeValue: '',
@@ -50170,317 +50155,139 @@ var defaultOptions = {
50170
50155
  transWrapTextNodes: '',
50171
50156
  transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
50172
50157
  useSuspense: true,
50173
- unescape: unescape
50158
+ unescape
50174
50159
  };
50175
- var i18nInstance;
50176
- var I18nContext = createContext();
50177
50160
  function getDefaults() {
50178
50161
  return defaultOptions;
50179
50162
  }
50180
- var ReportNamespaces = function () {
50181
- function ReportNamespaces() {
50182
- _classCallCheck$1(this, ReportNamespaces);
50183
50163
 
50184
- this.usedNamespaces = {};
50185
- }
50186
-
50187
- _createClass$1(ReportNamespaces, [{
50188
- key: "addUsedNamespaces",
50189
- value: function addUsedNamespaces(namespaces) {
50190
- var _this = this;
50191
-
50192
- namespaces.forEach(function (ns) {
50193
- if (!_this.usedNamespaces[ns]) _this.usedNamespaces[ns] = true;
50194
- });
50195
- }
50196
- }, {
50197
- key: "getUsedNamespaces",
50198
- value: function getUsedNamespaces() {
50199
- return Object.keys(this.usedNamespaces);
50200
- }
50201
- }]);
50202
-
50203
- return ReportNamespaces;
50204
- }();
50164
+ let i18nInstance;
50205
50165
  function getI18n() {
50206
50166
  return i18nInstance;
50207
50167
  }
50208
50168
 
50209
- function warn() {
50210
- if (console && console.warn) {
50211
- var _console;
50212
-
50213
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
50214
- args[_key] = arguments[_key];
50215
- }
50216
-
50217
- if (typeof args[0] === 'string') args[0] = "react-i18next:: ".concat(args[0]);
50218
-
50219
- (_console = console).warn.apply(_console, args);
50220
- }
50221
- }
50222
- var alreadyWarned = {};
50223
- function warnOnce() {
50224
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
50225
- args[_key2] = arguments[_key2];
50226
- }
50227
-
50228
- if (typeof args[0] === 'string' && alreadyWarned[args[0]]) return;
50229
- if (typeof args[0] === 'string') alreadyWarned[args[0]] = new Date();
50230
- warn.apply(void 0, args);
50231
- }
50232
- function loadNamespaces(i18n, ns, cb) {
50233
- i18n.loadNamespaces(ns, function () {
50234
- if (i18n.isInitialized) {
50235
- cb();
50236
- } else {
50237
- var initialized = function initialized() {
50238
- setTimeout(function () {
50239
- i18n.off('initialized', initialized);
50240
- }, 0);
50241
- cb();
50242
- };
50243
-
50244
- i18n.on('initialized', initialized);
50245
- }
50246
- });
50247
- }
50248
-
50249
- function oldI18nextHasLoadedNamespace(ns, i18n) {
50250
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
50251
- var lng = i18n.languages[0];
50252
- var fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
50253
- var lastLng = i18n.languages[i18n.languages.length - 1];
50254
- if (lng.toLowerCase() === 'cimode') return true;
50255
-
50256
- var loadNotPending = function loadNotPending(l, n) {
50257
- var loadState = i18n.services.backendConnector.state["".concat(l, "|").concat(n)];
50258
- return loadState === -1 || loadState === 2;
50259
- };
50260
-
50261
- if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
50262
- if (i18n.hasResourceBundle(lng, ns)) return true;
50263
- if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
50264
- if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
50265
- return false;
50266
- }
50267
-
50268
- function hasLoadedNamespace(ns, i18n) {
50269
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
50270
-
50271
- if (!i18n.languages || !i18n.languages.length) {
50272
- warnOnce('i18n.languages were undefined or empty', i18n.languages);
50273
- return true;
50274
- }
50275
-
50276
- var isNewerI18next = i18n.options.ignoreJSONStructure !== undefined;
50277
-
50278
- if (!isNewerI18next) {
50279
- return oldI18nextHasLoadedNamespace(ns, i18n, options);
50169
+ const I18nContext = createContext();
50170
+ class ReportNamespaces {
50171
+ constructor() {
50172
+ this.usedNamespaces = {};
50280
50173
  }
50281
-
50282
- return i18n.hasLoadedNamespace(ns, {
50283
- precheck: function precheck(i18nInstance, loadNotPending) {
50284
- if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
50285
- }
50286
- });
50287
- }
50288
-
50289
- var arrayWithHoles = createCommonjsModule(function (module) {
50290
- function _arrayWithHoles(r) {
50291
- if (Array.isArray(r)) return r;
50292
- }
50293
- module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
50294
- });
50295
-
50296
- unwrapExports(arrayWithHoles);
50297
-
50298
- var iterableToArrayLimit = createCommonjsModule(function (module) {
50299
- function _iterableToArrayLimit(r, l) {
50300
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
50301
- if (null != t) {
50302
- var e,
50303
- n,
50304
- i,
50305
- u,
50306
- a = [],
50307
- f = !0,
50308
- o = !1;
50309
- try {
50310
- if (i = (t = t.call(r)).next, 0 === l) {
50311
- if (Object(t) !== t) return;
50312
- f = !1;
50313
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
50314
- } catch (r) {
50315
- o = !0, n = r;
50316
- } finally {
50317
- try {
50318
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
50319
- } finally {
50320
- if (o) throw n;
50321
- }
50322
- }
50323
- return a;
50174
+ addUsedNamespaces(namespaces) {
50175
+ namespaces.forEach(ns => {
50176
+ if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
50177
+ });
50324
50178
  }
50325
- }
50326
- module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports;
50327
- });
50328
-
50329
- unwrapExports(iterableToArrayLimit);
50330
-
50331
- var arrayLikeToArray = createCommonjsModule(function (module) {
50332
- function _arrayLikeToArray(r, a) {
50333
- (null == a || a > r.length) && (a = r.length);
50334
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
50335
- return n;
50336
- }
50337
- module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
50338
- });
50339
-
50340
- unwrapExports(arrayLikeToArray);
50341
-
50342
- var unsupportedIterableToArray = createCommonjsModule(function (module) {
50343
- function _unsupportedIterableToArray(r, a) {
50344
- if (r) {
50345
- if ("string" == typeof r) return arrayLikeToArray(r, a);
50346
- var t = {}.toString.call(r).slice(8, -1);
50347
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0;
50179
+ getUsedNamespaces() {
50180
+ return Object.keys(this.usedNamespaces);
50348
50181
  }
50349
50182
  }
50350
- module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
50351
- });
50352
-
50353
- unwrapExports(unsupportedIterableToArray);
50354
-
50355
- var nonIterableRest = createCommonjsModule(function (module) {
50356
- function _nonIterableRest() {
50357
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
50358
- }
50359
- module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
50360
- });
50361
-
50362
- unwrapExports(nonIterableRest);
50363
-
50364
- var slicedToArray = createCommonjsModule(function (module) {
50365
- function _slicedToArray(r, e) {
50366
- return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest();
50367
- }
50368
- module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
50369
- });
50370
-
50371
- var _slicedToArray = unwrapExports(slicedToArray);
50372
-
50373
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
50374
-
50375
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$2(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
50376
50183
 
50377
- var usePrevious = function usePrevious(value, ignore) {
50378
- var ref = useRef();
50379
- useEffect(function () {
50184
+ const usePrevious = (value, ignore) => {
50185
+ const ref = useRef();
50186
+ useEffect(() => {
50380
50187
  ref.current = ignore ? ref.current : value;
50381
50188
  }, [value, ignore]);
50382
50189
  return ref.current;
50383
50190
  };
50384
-
50191
+ function alwaysNewT(i18n, language, namespace, keyPrefix) {
50192
+ return i18n.getFixedT(language, namespace, keyPrefix);
50193
+ }
50194
+ function useMemoizedT(i18n, language, namespace, keyPrefix) {
50195
+ return useCallback(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
50196
+ }
50385
50197
  function useTranslation(ns) {
50386
- var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
50387
- var i18nFromProps = props.i18n;
50388
-
50389
- var _ref = useContext(I18nContext) || {},
50390
- i18nFromContext = _ref.i18n,
50391
- defaultNSFromContext = _ref.defaultNS;
50392
-
50393
- var i18n = i18nFromProps || i18nFromContext || getI18n();
50198
+ let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
50199
+ const {
50200
+ i18n: i18nFromProps
50201
+ } = props;
50202
+ const {
50203
+ i18n: i18nFromContext,
50204
+ defaultNS: defaultNSFromContext
50205
+ } = useContext(I18nContext) || {};
50206
+ const i18n = i18nFromProps || i18nFromContext || getI18n();
50394
50207
  if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
50395
-
50396
50208
  if (!i18n) {
50397
50209
  warnOnce('You will need to pass in an i18next instance by using initReactI18next');
50398
-
50399
- var notReadyT = function notReadyT(k) {
50210
+ const notReadyT = (k, optsOrDefaultValue) => {
50211
+ if (typeof optsOrDefaultValue === 'string') return optsOrDefaultValue;
50212
+ if (optsOrDefaultValue && typeof optsOrDefaultValue === 'object' && typeof optsOrDefaultValue.defaultValue === 'string') return optsOrDefaultValue.defaultValue;
50400
50213
  return Array.isArray(k) ? k[k.length - 1] : k;
50401
50214
  };
50402
-
50403
- var retNotReady = [notReadyT, {}, false];
50215
+ const retNotReady = [notReadyT, {}, false];
50404
50216
  retNotReady.t = notReadyT;
50405
50217
  retNotReady.i18n = {};
50406
50218
  retNotReady.ready = false;
50407
50219
  return retNotReady;
50408
50220
  }
50409
-
50410
50221
  if (i18n.options.react && i18n.options.react.wait !== undefined) warnOnce('It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.');
50411
-
50412
- var i18nOptions = _objectSpread(_objectSpread(_objectSpread({}, getDefaults()), i18n.options.react), props);
50413
-
50414
- var useSuspense = i18nOptions.useSuspense,
50415
- keyPrefix = i18nOptions.keyPrefix;
50416
- var namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
50222
+ const i18nOptions = {
50223
+ ...getDefaults(),
50224
+ ...i18n.options.react,
50225
+ ...props
50226
+ };
50227
+ const {
50228
+ useSuspense,
50229
+ keyPrefix
50230
+ } = i18nOptions;
50231
+ let namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
50417
50232
  namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
50418
50233
  if (i18n.reportNamespaces.addUsedNamespaces) i18n.reportNamespaces.addUsedNamespaces(namespaces);
50419
- var ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(function (n) {
50420
- return hasLoadedNamespace(n, i18n, i18nOptions);
50421
- });
50422
-
50423
- function getT() {
50424
- return i18n.getFixedT(null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
50425
- }
50426
-
50427
- var _useState = useState(getT),
50428
- _useState2 = _slicedToArray(_useState, 2),
50429
- t = _useState2[0],
50430
- setT = _useState2[1];
50431
-
50432
- var joinedNS = namespaces.join();
50433
- var previousJoinedNS = usePrevious(joinedNS);
50434
- var isMounted = useRef(true);
50435
- useEffect(function () {
50436
- var bindI18n = i18nOptions.bindI18n,
50437
- bindI18nStore = i18nOptions.bindI18nStore;
50234
+ const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => hasLoadedNamespace(n, i18n, i18nOptions));
50235
+ const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
50236
+ const getT = () => memoGetT;
50237
+ const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
50238
+ const [t, setT] = useState(getT);
50239
+ let joinedNS = namespaces.join();
50240
+ if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
50241
+ const previousJoinedNS = usePrevious(joinedNS);
50242
+ const isMounted = useRef(true);
50243
+ useEffect(() => {
50244
+ const {
50245
+ bindI18n,
50246
+ bindI18nStore
50247
+ } = i18nOptions;
50438
50248
  isMounted.current = true;
50439
-
50440
50249
  if (!ready && !useSuspense) {
50441
- loadNamespaces(i18n, namespaces, function () {
50442
- if (isMounted.current) setT(getT);
50443
- });
50250
+ if (props.lng) {
50251
+ loadLanguages(i18n, props.lng, namespaces, () => {
50252
+ if (isMounted.current) setT(getNewT);
50253
+ });
50254
+ } else {
50255
+ loadNamespaces(i18n, namespaces, () => {
50256
+ if (isMounted.current) setT(getNewT);
50257
+ });
50258
+ }
50444
50259
  }
50445
-
50446
50260
  if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
50447
- setT(getT);
50261
+ setT(getNewT);
50448
50262
  }
50449
-
50450
50263
  function boundReset() {
50451
- if (isMounted.current) setT(getT);
50264
+ if (isMounted.current) setT(getNewT);
50452
50265
  }
50453
-
50454
50266
  if (bindI18n && i18n) i18n.on(bindI18n, boundReset);
50455
50267
  if (bindI18nStore && i18n) i18n.store.on(bindI18nStore, boundReset);
50456
- return function () {
50268
+ return () => {
50457
50269
  isMounted.current = false;
50458
- if (bindI18n && i18n) bindI18n.split(' ').forEach(function (e) {
50459
- return i18n.off(e, boundReset);
50460
- });
50461
- if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(function (e) {
50462
- return i18n.store.off(e, boundReset);
50463
- });
50270
+ if (bindI18n && i18n) bindI18n.split(' ').forEach(e => i18n.off(e, boundReset));
50271
+ if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
50464
50272
  };
50465
50273
  }, [i18n, joinedNS]);
50466
- var isInitial = useRef(true);
50467
- useEffect(function () {
50468
- if (isMounted.current && !isInitial.current) {
50274
+ useEffect(() => {
50275
+ if (isMounted.current && ready) {
50469
50276
  setT(getT);
50470
50277
  }
50471
-
50472
- isInitial.current = false;
50473
- }, [i18n, keyPrefix]);
50474
- var ret = [t, i18n, ready];
50278
+ }, [i18n, keyPrefix, ready]);
50279
+ const ret = [t, i18n, ready];
50475
50280
  ret.t = t;
50476
50281
  ret.i18n = i18n;
50477
50282
  ret.ready = ready;
50478
50283
  if (ready) return ret;
50479
50284
  if (!ready && !useSuspense) return ret;
50480
- throw new Promise(function (resolve) {
50481
- loadNamespaces(i18n, namespaces, function () {
50482
- resolve();
50483
- });
50285
+ throw new Promise(resolve => {
50286
+ if (props.lng) {
50287
+ loadLanguages(i18n, props.lng, namespaces, () => resolve());
50288
+ } else {
50289
+ loadNamespaces(i18n, namespaces, () => resolve());
50290
+ }
50484
50291
  });
50485
50292
  }
50486
50293
 
@@ -66672,7 +66479,7 @@ module.exports["default"] = module.exports, module.exports.__esModule = true;
66672
66479
 
66673
66480
  unwrapExports(_extends_1$1);
66674
66481
 
66675
- var arrayLikeToArray$1 = createCommonjsModule(function (module) {
66482
+ var arrayLikeToArray = createCommonjsModule(function (module) {
66676
66483
  function _arrayLikeToArray(arr, len) {
66677
66484
  if (len == null || len > arr.length) len = arr.length;
66678
66485
 
@@ -66687,11 +66494,11 @@ module.exports = _arrayLikeToArray;
66687
66494
  module.exports["default"] = module.exports, module.exports.__esModule = true;
66688
66495
  });
66689
66496
 
66690
- unwrapExports(arrayLikeToArray$1);
66497
+ unwrapExports(arrayLikeToArray);
66691
66498
 
66692
66499
  var arrayWithoutHoles = createCommonjsModule(function (module) {
66693
66500
  function _arrayWithoutHoles(arr) {
66694
- if (Array.isArray(arr)) return arrayLikeToArray$1(arr);
66501
+ if (Array.isArray(arr)) return arrayLikeToArray(arr);
66695
66502
  }
66696
66503
 
66697
66504
  module.exports = _arrayWithoutHoles;
@@ -66711,21 +66518,21 @@ module.exports["default"] = module.exports, module.exports.__esModule = true;
66711
66518
 
66712
66519
  unwrapExports(iterableToArray);
66713
66520
 
66714
- var unsupportedIterableToArray$1 = createCommonjsModule(function (module) {
66521
+ var unsupportedIterableToArray = createCommonjsModule(function (module) {
66715
66522
  function _unsupportedIterableToArray(o, minLen) {
66716
66523
  if (!o) return;
66717
- if (typeof o === "string") return arrayLikeToArray$1(o, minLen);
66524
+ if (typeof o === "string") return arrayLikeToArray(o, minLen);
66718
66525
  var n = Object.prototype.toString.call(o).slice(8, -1);
66719
66526
  if (n === "Object" && o.constructor) n = o.constructor.name;
66720
66527
  if (n === "Map" || n === "Set") return Array.from(o);
66721
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray$1(o, minLen);
66528
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
66722
66529
  }
66723
66530
 
66724
66531
  module.exports = _unsupportedIterableToArray;
66725
66532
  module.exports["default"] = module.exports, module.exports.__esModule = true;
66726
66533
  });
66727
66534
 
66728
- unwrapExports(unsupportedIterableToArray$1);
66535
+ unwrapExports(unsupportedIterableToArray);
66729
66536
 
66730
66537
  var nonIterableSpread = createCommonjsModule(function (module) {
66731
66538
  function _nonIterableSpread() {
@@ -66740,7 +66547,7 @@ unwrapExports(nonIterableSpread);
66740
66547
 
66741
66548
  var toConsumableArray = createCommonjsModule(function (module) {
66742
66549
  function _toConsumableArray(arr) {
66743
- return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray$1(arr) || nonIterableSpread();
66550
+ return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
66744
66551
  }
66745
66552
 
66746
66553
  module.exports = _toConsumableArray;
@@ -69315,6 +69122,109 @@ var handleUserRole = function handleUserRole(userRoles) {
69315
69122
  return userRoles;
69316
69123
  };
69317
69124
 
69125
+ var apiGetLanguage = function apiGetLanguage() {
69126
+ return api.get(BASE_URL + "/api/language");
69127
+ };
69128
+
69129
+ var apiUpdateLanguage = function apiUpdateLanguage(lang) {
69130
+ return api.put(BASE_URL + "/api/language?lang=" + lang);
69131
+ };
69132
+
69133
+ var LANGUAGE_SYSTEM = "LANGUAGE_SYSTEM";
69134
+
69135
+ var useLanguages = function useLanguages() {
69136
+ var dispatch = useDispatch();
69137
+
69138
+ var _useTranslation = useTranslation$1(),
69139
+ i18n = _useTranslation.i18n;
69140
+
69141
+ var language = useSelector(function (state) {
69142
+ return state.common.language;
69143
+ });
69144
+ var defaultLanguage = getCookieValue(LANGUAGE_SYSTEM) != '' ? getCookieValue(LANGUAGE_SYSTEM) : language;
69145
+
69146
+ var _useState = useState([]),
69147
+ languageList = _useState[0],
69148
+ setLanguageList = _useState[1];
69149
+
69150
+ var _useState2 = useState(false),
69151
+ dropdownOpen = _useState2[0],
69152
+ setDropdownOpen = _useState2[1];
69153
+
69154
+ var _useState3 = useState(defaultLanguage),
69155
+ currentLang = _useState3[0],
69156
+ setCurrentLang = _useState3[1];
69157
+
69158
+ var toggle = function toggle() {
69159
+ return setDropdownOpen(function (prevState) {
69160
+ return !prevState;
69161
+ });
69162
+ };
69163
+
69164
+ var changeLanguageApp = function changeLanguageApp(lang) {
69165
+ try {
69166
+ var _temp3 = function _temp3() {
69167
+ dispatch(setLoading(false));
69168
+ };
69169
+
69170
+ dispatch(setLoading(true));
69171
+
69172
+ var _temp4 = _catch(function () {
69173
+ return Promise.resolve(apiUpdateLanguage(lang)).then(function () {
69174
+ i18n.changeLanguage(lang);
69175
+ setCurrentLang(lang);
69176
+ dispatch(setLanguage(lang));
69177
+ });
69178
+ }, function (err) {
69179
+ var _err$response, _err$response$data;
69180
+
69181
+ dispatch(setAlert({
69182
+ type: "danger",
69183
+ message: ((_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.title) || err.message
69184
+ }));
69185
+ });
69186
+
69187
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
69188
+ } catch (e) {
69189
+ return Promise.reject(e);
69190
+ }
69191
+ };
69192
+
69193
+ var getListLanguage = function getListLanguage() {
69194
+ try {
69195
+ var _temp6 = _catch(function () {
69196
+ return Promise.resolve(apiGetLanguage()).then(function (res) {
69197
+ setLanguageList(res.data);
69198
+ });
69199
+ }, function (err) {
69200
+ var _err$response2, _err$response2$data;
69201
+
69202
+ dispatch(setAlert({
69203
+ type: "danger",
69204
+ message: ((_err$response2 = err.response) === null || _err$response2 === void 0 ? void 0 : (_err$response2$data = _err$response2.data) === null || _err$response2$data === void 0 ? void 0 : _err$response2$data.title) || err.message
69205
+ }));
69206
+ });
69207
+
69208
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
69209
+ } catch (e) {
69210
+ return Promise.reject(e);
69211
+ }
69212
+ };
69213
+
69214
+ useEffect(function () {
69215
+ changeLanguageApp(defaultLanguage);
69216
+ getListLanguage();
69217
+ }, []);
69218
+ return {
69219
+ languageList: languageList,
69220
+ toggle: toggle,
69221
+ dropdownOpen: dropdownOpen,
69222
+ currentLang: currentLang,
69223
+ changeLanguageApp: changeLanguageApp,
69224
+ setCurrentLang: setCurrentLang
69225
+ };
69226
+ };
69227
+
69318
69228
  var useStyles$g = makeStyles({
69319
69229
  dropdown: {
69320
69230
  zIndex: "1410 !important",
@@ -69341,22 +69251,18 @@ var useStyles$g = makeStyles({
69341
69251
  });
69342
69252
 
69343
69253
  var LanguageDropdown = function LanguageDropdown() {
69344
- var defaultLanguage = !!localStorage.getItem("language") ? localStorage.getItem("language") : navigator.language || DEFAULT_LANGUAGE_CODE;
69345
-
69346
- var _useTranslation = useTranslation$1(),
69347
- i18n = _useTranslation.i18n;
69348
-
69349
- var dispatch = useDispatch();
69350
69254
  var classes = useStyles$g();
69351
69255
 
69352
69256
  var _useState = useState(null),
69353
69257
  anchorLang = _useState[0],
69354
69258
  setAnchorLang = _useState[1];
69355
69259
 
69356
- var _useState2 = useState(defaultLanguage),
69357
- currentLang = _useState2[0],
69358
- setCurrentLang = _useState2[1];
69260
+ var _useLanguages = useLanguages(),
69261
+ languageList = _useLanguages.languageList,
69262
+ currentLang = _useLanguages.currentLang,
69263
+ changeLanguageApp = _useLanguages.changeLanguageApp;
69359
69264
 
69265
+ console.log("admin language");
69360
69266
  var openChooseLanguage = Boolean(anchorLang);
69361
69267
 
69362
69268
  var handleLangClose = function handleLangClose() {
@@ -69367,27 +69273,16 @@ var LanguageDropdown = function LanguageDropdown() {
69367
69273
  setAnchorLang(event.currentTarget);
69368
69274
  };
69369
69275
 
69370
- var changeLanguageApp = function changeLanguageApp(lang) {
69371
- if (!SUPPORTED_LANGUAGES_CODE.includes(lang)) lang = DEFAULT_LANGUAGE_CODE;
69372
- i18n.changeLanguage(lang);
69373
- localStorage.setItem("language", lang);
69374
- setCurrentLang(lang);
69375
- dispatch(setLanguage(lang));
69376
- };
69377
-
69378
69276
  var currentLanguage = useMemo(function () {
69379
- var current = LANGUAGES.find(function (i) {
69277
+ var current = languageList.find(function (i) {
69380
69278
  return i.code === currentLang;
69381
69279
  });
69382
69280
  if (!current) return null;
69383
69281
  return React__default.createElement(React__default.Fragment, null, React__default.createElement("img", {
69384
69282
  className: "mr-2 " + classes.icon_lang,
69385
- src: "" + getStaticFileUrl(current.image)
69386
- }), current.shortName);
69387
- }, [currentLang]);
69388
- useEffect(function () {
69389
- changeLanguageApp(currentLang);
69390
- }, [currentLang]);
69283
+ src: "" + getStaticFileUrl("/images/language-icon.png")
69284
+ }), current.name);
69285
+ }, [currentLang, languageList]);
69391
69286
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(IconButton, {
69392
69287
  onClick: handleLangMenu,
69393
69288
  color: "inherit"
@@ -69411,18 +69306,18 @@ var LanguageDropdown = function LanguageDropdown() {
69411
69306
  open: openChooseLanguage,
69412
69307
  onClose: handleLangClose,
69413
69308
  onClick: handleLangClose
69414
- }, LANGUAGES.map(function (i) {
69309
+ }, !!languageList && languageList.length > 0 && languageList.map(function (lang) {
69415
69310
  return React__default.createElement(MenuItem, {
69416
- key: i.code,
69311
+ key: lang.code,
69417
69312
  onClick: function onClick() {
69418
- return setCurrentLang(i.code);
69313
+ return changeLanguageApp(lang.code);
69419
69314
  },
69420
- selected: currentLang == i.code,
69315
+ selected: currentLang == lang.code,
69421
69316
  className: classes.fontMedium
69422
69317
  }, React__default.createElement("img", {
69423
69318
  className: classes.icon_lang,
69424
- src: getStaticFileUrl(i.image)
69425
- }), i.name);
69319
+ src: getStaticFileUrl(lang.logo)
69320
+ }), lang.name);
69426
69321
  })));
69427
69322
  };
69428
69323