mario-education 2.4.302-layout → 2.4.304-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.
- package/dist/components/layouts/hooks/useHeaderSideBar.d.ts +1 -1
- package/dist/components/layouts/hooks/useLanguages.d.ts +10 -0
- package/dist/containers/ConductSurvey/components/diaglog/hooks/useInterventionDialog.d.ts +1 -1
- package/dist/index.js +279 -385
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +280 -386
- package/dist/index.modern.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -15649,7 +15649,6 @@ var QuestionDetail = function QuestionDetail() {
|
|
|
15649
15649
|
},
|
|
15650
15650
|
apiKey: tinyMCEKey,
|
|
15651
15651
|
value: questionDetail.text,
|
|
15652
|
-
initialValue: questionDetail.text,
|
|
15653
15652
|
init: _extends({}, marioCore.editorConfig.question, {
|
|
15654
15653
|
paste_preprocess: function paste_preprocess(_plugin, args) {
|
|
15655
15654
|
args.content = args.content.replace(/<\/?(?!b\b|p\b)[^>]+>/g, "");
|
|
@@ -50048,92 +50047,83 @@ var CustomTabComponent = function CustomTabComponent(_ref) {
|
|
|
50048
50047
|
|
|
50049
50048
|
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"};
|
|
50050
50049
|
|
|
50051
|
-
|
|
50052
|
-
|
|
50053
|
-
|
|
50054
|
-
|
|
50055
|
-
|
|
50056
|
-
|
|
50057
|
-
|
|
50058
|
-
|
|
50059
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
|
|
50050
|
+
function warn() {
|
|
50051
|
+
if (console && console.warn) {
|
|
50052
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50053
|
+
args[_key] = arguments[_key];
|
|
50054
|
+
}
|
|
50055
|
+
if (typeof args[0] === 'string') args[0] = `react-i18next:: ${args[0]}`;
|
|
50056
|
+
console.warn(...args);
|
|
50057
|
+
}
|
|
50060
50058
|
}
|
|
50061
|
-
|
|
50062
|
-
|
|
50063
|
-
|
|
50064
|
-
|
|
50065
|
-
|
|
50066
|
-
var toPrimitive_1 = createCommonjsModule(function (module) {
|
|
50067
|
-
var _typeof = _typeof_1$1["default"];
|
|
50068
|
-
function toPrimitive(t, r) {
|
|
50069
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
50070
|
-
var e = t[Symbol.toPrimitive];
|
|
50071
|
-
if (void 0 !== e) {
|
|
50072
|
-
var i = e.call(t, r || "default");
|
|
50073
|
-
if ("object" != _typeof(i)) return i;
|
|
50074
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
50059
|
+
const alreadyWarned = {};
|
|
50060
|
+
function warnOnce() {
|
|
50061
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
50062
|
+
args[_key2] = arguments[_key2];
|
|
50075
50063
|
}
|
|
50076
|
-
|
|
50064
|
+
if (typeof args[0] === 'string' && alreadyWarned[args[0]]) return;
|
|
50065
|
+
if (typeof args[0] === 'string') alreadyWarned[args[0]] = new Date();
|
|
50066
|
+
warn(...args);
|
|
50077
50067
|
}
|
|
50078
|
-
|
|
50079
|
-
|
|
50080
|
-
|
|
50081
|
-
|
|
50082
|
-
|
|
50083
|
-
|
|
50084
|
-
|
|
50085
|
-
|
|
50086
|
-
|
|
50087
|
-
|
|
50088
|
-
|
|
50068
|
+
const loadedClb = (i18n, cb) => () => {
|
|
50069
|
+
if (i18n.isInitialized) {
|
|
50070
|
+
cb();
|
|
50071
|
+
} else {
|
|
50072
|
+
const initialized = () => {
|
|
50073
|
+
setTimeout(() => {
|
|
50074
|
+
i18n.off('initialized', initialized);
|
|
50075
|
+
}, 0);
|
|
50076
|
+
cb();
|
|
50077
|
+
};
|
|
50078
|
+
i18n.on('initialized', initialized);
|
|
50079
|
+
}
|
|
50080
|
+
};
|
|
50081
|
+
function loadNamespaces(i18n, ns, cb) {
|
|
50082
|
+
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
50089
50083
|
}
|
|
50090
|
-
|
|
50091
|
-
|
|
50092
|
-
|
|
50093
|
-
|
|
50094
|
-
|
|
50095
|
-
|
|
50096
|
-
function _defineProperty(e, r, t) {
|
|
50097
|
-
return (r = toPropertyKey_1(r)) in e ? Object.defineProperty(e, r, {
|
|
50098
|
-
value: t,
|
|
50099
|
-
enumerable: !0,
|
|
50100
|
-
configurable: !0,
|
|
50101
|
-
writable: !0
|
|
50102
|
-
}) : e[r] = t, e;
|
|
50084
|
+
function loadLanguages(i18n, lng, ns, cb) {
|
|
50085
|
+
if (typeof ns === 'string') ns = [ns];
|
|
50086
|
+
ns.forEach(n => {
|
|
50087
|
+
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
50088
|
+
});
|
|
50089
|
+
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
50103
50090
|
}
|
|
50104
|
-
|
|
50105
|
-
}
|
|
50106
|
-
|
|
50107
|
-
|
|
50108
|
-
|
|
50109
|
-
|
|
50110
|
-
|
|
50111
|
-
|
|
50091
|
+
function oldI18nextHasLoadedNamespace(ns, i18n) {
|
|
50092
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
50093
|
+
const lng = i18n.languages[0];
|
|
50094
|
+
const fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
|
|
50095
|
+
const lastLng = i18n.languages[i18n.languages.length - 1];
|
|
50096
|
+
if (lng.toLowerCase() === 'cimode') return true;
|
|
50097
|
+
const loadNotPending = (l, n) => {
|
|
50098
|
+
const loadState = i18n.services.backendConnector.state[`${l}|${n}`];
|
|
50099
|
+
return loadState === -1 || loadState === 2;
|
|
50100
|
+
};
|
|
50101
|
+
if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
|
|
50102
|
+
if (i18n.hasResourceBundle(lng, ns)) return true;
|
|
50103
|
+
if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
|
|
50104
|
+
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
50105
|
+
return false;
|
|
50112
50106
|
}
|
|
50113
|
-
|
|
50114
|
-
}
|
|
50115
|
-
|
|
50116
|
-
|
|
50117
|
-
|
|
50118
|
-
var createClass = createCommonjsModule(function (module) {
|
|
50119
|
-
function _defineProperties(e, r) {
|
|
50120
|
-
for (var t = 0; t < r.length; t++) {
|
|
50121
|
-
var o = r[t];
|
|
50122
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey_1(o.key), o);
|
|
50107
|
+
function hasLoadedNamespace(ns, i18n) {
|
|
50108
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
50109
|
+
if (!i18n.languages || !i18n.languages.length) {
|
|
50110
|
+
warnOnce('i18n.languages were undefined or empty', i18n.languages);
|
|
50111
|
+
return true;
|
|
50123
50112
|
}
|
|
50113
|
+
const isNewerI18next = i18n.options.ignoreJSONStructure !== undefined;
|
|
50114
|
+
if (!isNewerI18next) {
|
|
50115
|
+
return oldI18nextHasLoadedNamespace(ns, i18n, options);
|
|
50116
|
+
}
|
|
50117
|
+
return i18n.hasLoadedNamespace(ns, {
|
|
50118
|
+
lng: options.lng,
|
|
50119
|
+
precheck: (i18nInstance, loadNotPending) => {
|
|
50120
|
+
if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
|
|
50121
|
+
}
|
|
50122
|
+
});
|
|
50124
50123
|
}
|
|
50125
|
-
function _createClass(e, r, t) {
|
|
50126
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
50127
|
-
writable: !1
|
|
50128
|
-
}), e;
|
|
50129
|
-
}
|
|
50130
|
-
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50131
|
-
});
|
|
50132
|
-
|
|
50133
|
-
var _createClass$1 = unwrapExports(createClass);
|
|
50134
50124
|
|
|
50135
|
-
|
|
50136
|
-
|
|
50125
|
+
const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
50126
|
+
const htmlEntities = {
|
|
50137
50127
|
'&': '&',
|
|
50138
50128
|
'&': '&',
|
|
50139
50129
|
'<': '<',
|
|
@@ -50155,16 +50145,10 @@ var htmlEntities = {
|
|
|
50155
50145
|
'/': '/',
|
|
50156
50146
|
'/': '/'
|
|
50157
50147
|
};
|
|
50148
|
+
const unescapeHtmlEntity = m => htmlEntities[m];
|
|
50149
|
+
const unescape = text => text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
50158
50150
|
|
|
50159
|
-
|
|
50160
|
-
return htmlEntities[m];
|
|
50161
|
-
};
|
|
50162
|
-
|
|
50163
|
-
var unescape = function unescape(text) {
|
|
50164
|
-
return text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
50165
|
-
};
|
|
50166
|
-
|
|
50167
|
-
var defaultOptions = {
|
|
50151
|
+
let defaultOptions = {
|
|
50168
50152
|
bindI18n: 'languageChanged',
|
|
50169
50153
|
bindI18nStore: '',
|
|
50170
50154
|
transEmptyNodeValue: '',
|
|
@@ -50172,317 +50156,139 @@ var defaultOptions = {
|
|
|
50172
50156
|
transWrapTextNodes: '',
|
|
50173
50157
|
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'],
|
|
50174
50158
|
useSuspense: true,
|
|
50175
|
-
unescape
|
|
50159
|
+
unescape
|
|
50176
50160
|
};
|
|
50177
|
-
var i18nInstance;
|
|
50178
|
-
var I18nContext = React.createContext();
|
|
50179
50161
|
function getDefaults() {
|
|
50180
50162
|
return defaultOptions;
|
|
50181
50163
|
}
|
|
50182
|
-
var ReportNamespaces = function () {
|
|
50183
|
-
function ReportNamespaces() {
|
|
50184
|
-
_classCallCheck$1(this, ReportNamespaces);
|
|
50185
50164
|
|
|
50186
|
-
|
|
50187
|
-
}
|
|
50188
|
-
|
|
50189
|
-
_createClass$1(ReportNamespaces, [{
|
|
50190
|
-
key: "addUsedNamespaces",
|
|
50191
|
-
value: function addUsedNamespaces(namespaces) {
|
|
50192
|
-
var _this = this;
|
|
50193
|
-
|
|
50194
|
-
namespaces.forEach(function (ns) {
|
|
50195
|
-
if (!_this.usedNamespaces[ns]) _this.usedNamespaces[ns] = true;
|
|
50196
|
-
});
|
|
50197
|
-
}
|
|
50198
|
-
}, {
|
|
50199
|
-
key: "getUsedNamespaces",
|
|
50200
|
-
value: function getUsedNamespaces() {
|
|
50201
|
-
return Object.keys(this.usedNamespaces);
|
|
50202
|
-
}
|
|
50203
|
-
}]);
|
|
50204
|
-
|
|
50205
|
-
return ReportNamespaces;
|
|
50206
|
-
}();
|
|
50165
|
+
let i18nInstance;
|
|
50207
50166
|
function getI18n() {
|
|
50208
50167
|
return i18nInstance;
|
|
50209
50168
|
}
|
|
50210
50169
|
|
|
50211
|
-
|
|
50212
|
-
|
|
50213
|
-
|
|
50214
|
-
|
|
50215
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50216
|
-
args[_key] = arguments[_key];
|
|
50217
|
-
}
|
|
50218
|
-
|
|
50219
|
-
if (typeof args[0] === 'string') args[0] = "react-i18next:: ".concat(args[0]);
|
|
50220
|
-
|
|
50221
|
-
(_console = console).warn.apply(_console, args);
|
|
50222
|
-
}
|
|
50223
|
-
}
|
|
50224
|
-
var alreadyWarned = {};
|
|
50225
|
-
function warnOnce() {
|
|
50226
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
50227
|
-
args[_key2] = arguments[_key2];
|
|
50228
|
-
}
|
|
50229
|
-
|
|
50230
|
-
if (typeof args[0] === 'string' && alreadyWarned[args[0]]) return;
|
|
50231
|
-
if (typeof args[0] === 'string') alreadyWarned[args[0]] = new Date();
|
|
50232
|
-
warn.apply(void 0, args);
|
|
50233
|
-
}
|
|
50234
|
-
function loadNamespaces(i18n, ns, cb) {
|
|
50235
|
-
i18n.loadNamespaces(ns, function () {
|
|
50236
|
-
if (i18n.isInitialized) {
|
|
50237
|
-
cb();
|
|
50238
|
-
} else {
|
|
50239
|
-
var initialized = function initialized() {
|
|
50240
|
-
setTimeout(function () {
|
|
50241
|
-
i18n.off('initialized', initialized);
|
|
50242
|
-
}, 0);
|
|
50243
|
-
cb();
|
|
50244
|
-
};
|
|
50245
|
-
|
|
50246
|
-
i18n.on('initialized', initialized);
|
|
50247
|
-
}
|
|
50248
|
-
});
|
|
50249
|
-
}
|
|
50250
|
-
|
|
50251
|
-
function oldI18nextHasLoadedNamespace(ns, i18n) {
|
|
50252
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
50253
|
-
var lng = i18n.languages[0];
|
|
50254
|
-
var fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
|
|
50255
|
-
var lastLng = i18n.languages[i18n.languages.length - 1];
|
|
50256
|
-
if (lng.toLowerCase() === 'cimode') return true;
|
|
50257
|
-
|
|
50258
|
-
var loadNotPending = function loadNotPending(l, n) {
|
|
50259
|
-
var loadState = i18n.services.backendConnector.state["".concat(l, "|").concat(n)];
|
|
50260
|
-
return loadState === -1 || loadState === 2;
|
|
50261
|
-
};
|
|
50262
|
-
|
|
50263
|
-
if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns)) return false;
|
|
50264
|
-
if (i18n.hasResourceBundle(lng, ns)) return true;
|
|
50265
|
-
if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages) return true;
|
|
50266
|
-
if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns))) return true;
|
|
50267
|
-
return false;
|
|
50268
|
-
}
|
|
50269
|
-
|
|
50270
|
-
function hasLoadedNamespace(ns, i18n) {
|
|
50271
|
-
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
50272
|
-
|
|
50273
|
-
if (!i18n.languages || !i18n.languages.length) {
|
|
50274
|
-
warnOnce('i18n.languages were undefined or empty', i18n.languages);
|
|
50275
|
-
return true;
|
|
50276
|
-
}
|
|
50277
|
-
|
|
50278
|
-
var isNewerI18next = i18n.options.ignoreJSONStructure !== undefined;
|
|
50279
|
-
|
|
50280
|
-
if (!isNewerI18next) {
|
|
50281
|
-
return oldI18nextHasLoadedNamespace(ns, i18n, options);
|
|
50170
|
+
const I18nContext = React.createContext();
|
|
50171
|
+
class ReportNamespaces {
|
|
50172
|
+
constructor() {
|
|
50173
|
+
this.usedNamespaces = {};
|
|
50282
50174
|
}
|
|
50283
|
-
|
|
50284
|
-
|
|
50285
|
-
|
|
50286
|
-
|
|
50287
|
-
}
|
|
50288
|
-
});
|
|
50289
|
-
}
|
|
50290
|
-
|
|
50291
|
-
var arrayWithHoles = createCommonjsModule(function (module) {
|
|
50292
|
-
function _arrayWithHoles(r) {
|
|
50293
|
-
if (Array.isArray(r)) return r;
|
|
50294
|
-
}
|
|
50295
|
-
module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50296
|
-
});
|
|
50297
|
-
|
|
50298
|
-
unwrapExports(arrayWithHoles);
|
|
50299
|
-
|
|
50300
|
-
var iterableToArrayLimit = createCommonjsModule(function (module) {
|
|
50301
|
-
function _iterableToArrayLimit(r, l) {
|
|
50302
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
50303
|
-
if (null != t) {
|
|
50304
|
-
var e,
|
|
50305
|
-
n,
|
|
50306
|
-
i,
|
|
50307
|
-
u,
|
|
50308
|
-
a = [],
|
|
50309
|
-
f = !0,
|
|
50310
|
-
o = !1;
|
|
50311
|
-
try {
|
|
50312
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
50313
|
-
if (Object(t) !== t) return;
|
|
50314
|
-
f = !1;
|
|
50315
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
50316
|
-
} catch (r) {
|
|
50317
|
-
o = !0, n = r;
|
|
50318
|
-
} finally {
|
|
50319
|
-
try {
|
|
50320
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
50321
|
-
} finally {
|
|
50322
|
-
if (o) throw n;
|
|
50323
|
-
}
|
|
50324
|
-
}
|
|
50325
|
-
return a;
|
|
50175
|
+
addUsedNamespaces(namespaces) {
|
|
50176
|
+
namespaces.forEach(ns => {
|
|
50177
|
+
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
|
|
50178
|
+
});
|
|
50326
50179
|
}
|
|
50327
|
-
|
|
50328
|
-
|
|
50329
|
-
});
|
|
50330
|
-
|
|
50331
|
-
unwrapExports(iterableToArrayLimit);
|
|
50332
|
-
|
|
50333
|
-
var arrayLikeToArray = createCommonjsModule(function (module) {
|
|
50334
|
-
function _arrayLikeToArray(r, a) {
|
|
50335
|
-
(null == a || a > r.length) && (a = r.length);
|
|
50336
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
50337
|
-
return n;
|
|
50338
|
-
}
|
|
50339
|
-
module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50340
|
-
});
|
|
50341
|
-
|
|
50342
|
-
unwrapExports(arrayLikeToArray);
|
|
50343
|
-
|
|
50344
|
-
var unsupportedIterableToArray = createCommonjsModule(function (module) {
|
|
50345
|
-
function _unsupportedIterableToArray(r, a) {
|
|
50346
|
-
if (r) {
|
|
50347
|
-
if ("string" == typeof r) return arrayLikeToArray(r, a);
|
|
50348
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
50349
|
-
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;
|
|
50180
|
+
getUsedNamespaces() {
|
|
50181
|
+
return Object.keys(this.usedNamespaces);
|
|
50350
50182
|
}
|
|
50351
50183
|
}
|
|
50352
|
-
module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50353
|
-
});
|
|
50354
|
-
|
|
50355
|
-
unwrapExports(unsupportedIterableToArray);
|
|
50356
|
-
|
|
50357
|
-
var nonIterableRest = createCommonjsModule(function (module) {
|
|
50358
|
-
function _nonIterableRest() {
|
|
50359
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
50360
|
-
}
|
|
50361
|
-
module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50362
|
-
});
|
|
50363
|
-
|
|
50364
|
-
unwrapExports(nonIterableRest);
|
|
50365
|
-
|
|
50366
|
-
var slicedToArray = createCommonjsModule(function (module) {
|
|
50367
|
-
function _slicedToArray(r, e) {
|
|
50368
|
-
return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest();
|
|
50369
|
-
}
|
|
50370
|
-
module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
50371
|
-
});
|
|
50372
|
-
|
|
50373
|
-
var _slicedToArray = unwrapExports(slicedToArray);
|
|
50374
|
-
|
|
50375
|
-
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; }
|
|
50376
|
-
|
|
50377
|
-
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; }
|
|
50378
50184
|
|
|
50379
|
-
|
|
50380
|
-
|
|
50381
|
-
React.useEffect(
|
|
50185
|
+
const usePrevious = (value, ignore) => {
|
|
50186
|
+
const ref = React.useRef();
|
|
50187
|
+
React.useEffect(() => {
|
|
50382
50188
|
ref.current = ignore ? ref.current : value;
|
|
50383
50189
|
}, [value, ignore]);
|
|
50384
50190
|
return ref.current;
|
|
50385
50191
|
};
|
|
50386
|
-
|
|
50192
|
+
function alwaysNewT(i18n, language, namespace, keyPrefix) {
|
|
50193
|
+
return i18n.getFixedT(language, namespace, keyPrefix);
|
|
50194
|
+
}
|
|
50195
|
+
function useMemoizedT(i18n, language, namespace, keyPrefix) {
|
|
50196
|
+
return React.useCallback(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
|
|
50197
|
+
}
|
|
50387
50198
|
function useTranslation(ns) {
|
|
50388
|
-
|
|
50389
|
-
|
|
50390
|
-
|
|
50391
|
-
|
|
50392
|
-
|
|
50393
|
-
|
|
50394
|
-
|
|
50395
|
-
|
|
50199
|
+
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
50200
|
+
const {
|
|
50201
|
+
i18n: i18nFromProps
|
|
50202
|
+
} = props;
|
|
50203
|
+
const {
|
|
50204
|
+
i18n: i18nFromContext,
|
|
50205
|
+
defaultNS: defaultNSFromContext
|
|
50206
|
+
} = React.useContext(I18nContext) || {};
|
|
50207
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
50396
50208
|
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
50397
|
-
|
|
50398
50209
|
if (!i18n) {
|
|
50399
50210
|
warnOnce('You will need to pass in an i18next instance by using initReactI18next');
|
|
50400
|
-
|
|
50401
|
-
|
|
50211
|
+
const notReadyT = (k, optsOrDefaultValue) => {
|
|
50212
|
+
if (typeof optsOrDefaultValue === 'string') return optsOrDefaultValue;
|
|
50213
|
+
if (optsOrDefaultValue && typeof optsOrDefaultValue === 'object' && typeof optsOrDefaultValue.defaultValue === 'string') return optsOrDefaultValue.defaultValue;
|
|
50402
50214
|
return Array.isArray(k) ? k[k.length - 1] : k;
|
|
50403
50215
|
};
|
|
50404
|
-
|
|
50405
|
-
var retNotReady = [notReadyT, {}, false];
|
|
50216
|
+
const retNotReady = [notReadyT, {}, false];
|
|
50406
50217
|
retNotReady.t = notReadyT;
|
|
50407
50218
|
retNotReady.i18n = {};
|
|
50408
50219
|
retNotReady.ready = false;
|
|
50409
50220
|
return retNotReady;
|
|
50410
50221
|
}
|
|
50411
|
-
|
|
50412
50222
|
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.');
|
|
50413
|
-
|
|
50414
|
-
|
|
50415
|
-
|
|
50416
|
-
|
|
50417
|
-
|
|
50418
|
-
|
|
50223
|
+
const i18nOptions = {
|
|
50224
|
+
...getDefaults(),
|
|
50225
|
+
...i18n.options.react,
|
|
50226
|
+
...props
|
|
50227
|
+
};
|
|
50228
|
+
const {
|
|
50229
|
+
useSuspense,
|
|
50230
|
+
keyPrefix
|
|
50231
|
+
} = i18nOptions;
|
|
50232
|
+
let namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
|
|
50419
50233
|
namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
|
|
50420
50234
|
if (i18n.reportNamespaces.addUsedNamespaces) i18n.reportNamespaces.addUsedNamespaces(namespaces);
|
|
50421
|
-
|
|
50422
|
-
|
|
50423
|
-
|
|
50424
|
-
|
|
50425
|
-
|
|
50426
|
-
|
|
50427
|
-
}
|
|
50428
|
-
|
|
50429
|
-
|
|
50430
|
-
|
|
50431
|
-
|
|
50432
|
-
|
|
50433
|
-
|
|
50434
|
-
|
|
50435
|
-
var previousJoinedNS = usePrevious(joinedNS);
|
|
50436
|
-
var isMounted = React.useRef(true);
|
|
50437
|
-
React.useEffect(function () {
|
|
50438
|
-
var bindI18n = i18nOptions.bindI18n,
|
|
50439
|
-
bindI18nStore = i18nOptions.bindI18nStore;
|
|
50235
|
+
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
50236
|
+
const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
|
|
50237
|
+
const getT = () => memoGetT;
|
|
50238
|
+
const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
|
|
50239
|
+
const [t, setT] = React.useState(getT);
|
|
50240
|
+
let joinedNS = namespaces.join();
|
|
50241
|
+
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
50242
|
+
const previousJoinedNS = usePrevious(joinedNS);
|
|
50243
|
+
const isMounted = React.useRef(true);
|
|
50244
|
+
React.useEffect(() => {
|
|
50245
|
+
const {
|
|
50246
|
+
bindI18n,
|
|
50247
|
+
bindI18nStore
|
|
50248
|
+
} = i18nOptions;
|
|
50440
50249
|
isMounted.current = true;
|
|
50441
|
-
|
|
50442
50250
|
if (!ready && !useSuspense) {
|
|
50443
|
-
|
|
50444
|
-
|
|
50445
|
-
|
|
50251
|
+
if (props.lng) {
|
|
50252
|
+
loadLanguages(i18n, props.lng, namespaces, () => {
|
|
50253
|
+
if (isMounted.current) setT(getNewT);
|
|
50254
|
+
});
|
|
50255
|
+
} else {
|
|
50256
|
+
loadNamespaces(i18n, namespaces, () => {
|
|
50257
|
+
if (isMounted.current) setT(getNewT);
|
|
50258
|
+
});
|
|
50259
|
+
}
|
|
50446
50260
|
}
|
|
50447
|
-
|
|
50448
50261
|
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
|
|
50449
|
-
setT(
|
|
50262
|
+
setT(getNewT);
|
|
50450
50263
|
}
|
|
50451
|
-
|
|
50452
50264
|
function boundReset() {
|
|
50453
|
-
if (isMounted.current) setT(
|
|
50265
|
+
if (isMounted.current) setT(getNewT);
|
|
50454
50266
|
}
|
|
50455
|
-
|
|
50456
50267
|
if (bindI18n && i18n) i18n.on(bindI18n, boundReset);
|
|
50457
50268
|
if (bindI18nStore && i18n) i18n.store.on(bindI18nStore, boundReset);
|
|
50458
|
-
return
|
|
50269
|
+
return () => {
|
|
50459
50270
|
isMounted.current = false;
|
|
50460
|
-
if (bindI18n && i18n) bindI18n.split(' ').forEach(
|
|
50461
|
-
|
|
50462
|
-
});
|
|
50463
|
-
if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(function (e) {
|
|
50464
|
-
return i18n.store.off(e, boundReset);
|
|
50465
|
-
});
|
|
50271
|
+
if (bindI18n && i18n) bindI18n.split(' ').forEach(e => i18n.off(e, boundReset));
|
|
50272
|
+
if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
|
|
50466
50273
|
};
|
|
50467
50274
|
}, [i18n, joinedNS]);
|
|
50468
|
-
|
|
50469
|
-
|
|
50470
|
-
if (isMounted.current && !isInitial.current) {
|
|
50275
|
+
React.useEffect(() => {
|
|
50276
|
+
if (isMounted.current && ready) {
|
|
50471
50277
|
setT(getT);
|
|
50472
50278
|
}
|
|
50473
|
-
|
|
50474
|
-
|
|
50475
|
-
}, [i18n, keyPrefix]);
|
|
50476
|
-
var ret = [t, i18n, ready];
|
|
50279
|
+
}, [i18n, keyPrefix, ready]);
|
|
50280
|
+
const ret = [t, i18n, ready];
|
|
50477
50281
|
ret.t = t;
|
|
50478
50282
|
ret.i18n = i18n;
|
|
50479
50283
|
ret.ready = ready;
|
|
50480
50284
|
if (ready) return ret;
|
|
50481
50285
|
if (!ready && !useSuspense) return ret;
|
|
50482
|
-
throw new Promise(
|
|
50483
|
-
|
|
50484
|
-
resolve();
|
|
50485
|
-
}
|
|
50286
|
+
throw new Promise(resolve => {
|
|
50287
|
+
if (props.lng) {
|
|
50288
|
+
loadLanguages(i18n, props.lng, namespaces, () => resolve());
|
|
50289
|
+
} else {
|
|
50290
|
+
loadNamespaces(i18n, namespaces, () => resolve());
|
|
50291
|
+
}
|
|
50486
50292
|
});
|
|
50487
50293
|
}
|
|
50488
50294
|
|
|
@@ -66674,7 +66480,7 @@ module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
|
66674
66480
|
|
|
66675
66481
|
unwrapExports(_extends_1$1);
|
|
66676
66482
|
|
|
66677
|
-
var arrayLikeToArray
|
|
66483
|
+
var arrayLikeToArray = createCommonjsModule(function (module) {
|
|
66678
66484
|
function _arrayLikeToArray(arr, len) {
|
|
66679
66485
|
if (len == null || len > arr.length) len = arr.length;
|
|
66680
66486
|
|
|
@@ -66689,11 +66495,11 @@ module.exports = _arrayLikeToArray;
|
|
|
66689
66495
|
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
66690
66496
|
});
|
|
66691
66497
|
|
|
66692
|
-
unwrapExports(arrayLikeToArray
|
|
66498
|
+
unwrapExports(arrayLikeToArray);
|
|
66693
66499
|
|
|
66694
66500
|
var arrayWithoutHoles = createCommonjsModule(function (module) {
|
|
66695
66501
|
function _arrayWithoutHoles(arr) {
|
|
66696
|
-
if (Array.isArray(arr)) return arrayLikeToArray
|
|
66502
|
+
if (Array.isArray(arr)) return arrayLikeToArray(arr);
|
|
66697
66503
|
}
|
|
66698
66504
|
|
|
66699
66505
|
module.exports = _arrayWithoutHoles;
|
|
@@ -66713,21 +66519,21 @@ module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
|
66713
66519
|
|
|
66714
66520
|
unwrapExports(iterableToArray);
|
|
66715
66521
|
|
|
66716
|
-
var unsupportedIterableToArray
|
|
66522
|
+
var unsupportedIterableToArray = createCommonjsModule(function (module) {
|
|
66717
66523
|
function _unsupportedIterableToArray(o, minLen) {
|
|
66718
66524
|
if (!o) return;
|
|
66719
|
-
if (typeof o === "string") return arrayLikeToArray
|
|
66525
|
+
if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
|
66720
66526
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
66721
66527
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
66722
66528
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
66723
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray
|
|
66529
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
|
|
66724
66530
|
}
|
|
66725
66531
|
|
|
66726
66532
|
module.exports = _unsupportedIterableToArray;
|
|
66727
66533
|
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
66728
66534
|
});
|
|
66729
66535
|
|
|
66730
|
-
unwrapExports(unsupportedIterableToArray
|
|
66536
|
+
unwrapExports(unsupportedIterableToArray);
|
|
66731
66537
|
|
|
66732
66538
|
var nonIterableSpread = createCommonjsModule(function (module) {
|
|
66733
66539
|
function _nonIterableSpread() {
|
|
@@ -66742,7 +66548,7 @@ unwrapExports(nonIterableSpread);
|
|
|
66742
66548
|
|
|
66743
66549
|
var toConsumableArray = createCommonjsModule(function (module) {
|
|
66744
66550
|
function _toConsumableArray(arr) {
|
|
66745
|
-
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray
|
|
66551
|
+
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
|
|
66746
66552
|
}
|
|
66747
66553
|
|
|
66748
66554
|
module.exports = _toConsumableArray;
|
|
@@ -69317,6 +69123,109 @@ var handleUserRole = function handleUserRole(userRoles) {
|
|
|
69317
69123
|
return userRoles;
|
|
69318
69124
|
};
|
|
69319
69125
|
|
|
69126
|
+
var apiGetLanguage = function apiGetLanguage() {
|
|
69127
|
+
return marioCore.api.get(marioCore.BASE_URL + "/api/language");
|
|
69128
|
+
};
|
|
69129
|
+
|
|
69130
|
+
var apiUpdateLanguage = function apiUpdateLanguage(lang) {
|
|
69131
|
+
return marioCore.api.put(marioCore.BASE_URL + "/api/language?lang=" + lang);
|
|
69132
|
+
};
|
|
69133
|
+
|
|
69134
|
+
var LANGUAGE_SYSTEM = "LANGUAGE_SYSTEM";
|
|
69135
|
+
|
|
69136
|
+
var useLanguages = function useLanguages() {
|
|
69137
|
+
var dispatch = reactRedux.useDispatch();
|
|
69138
|
+
|
|
69139
|
+
var _useTranslation = marioCore.useTranslation(),
|
|
69140
|
+
i18n = _useTranslation.i18n;
|
|
69141
|
+
|
|
69142
|
+
var language = reactRedux.useSelector(function (state) {
|
|
69143
|
+
return state.common.language;
|
|
69144
|
+
});
|
|
69145
|
+
var defaultLanguage = marioCore.getCookieValue(LANGUAGE_SYSTEM) != '' ? marioCore.getCookieValue(LANGUAGE_SYSTEM) : language;
|
|
69146
|
+
|
|
69147
|
+
var _useState = React.useState([]),
|
|
69148
|
+
languageList = _useState[0],
|
|
69149
|
+
setLanguageList = _useState[1];
|
|
69150
|
+
|
|
69151
|
+
var _useState2 = React.useState(false),
|
|
69152
|
+
dropdownOpen = _useState2[0],
|
|
69153
|
+
setDropdownOpen = _useState2[1];
|
|
69154
|
+
|
|
69155
|
+
var _useState3 = React.useState(defaultLanguage),
|
|
69156
|
+
currentLang = _useState3[0],
|
|
69157
|
+
setCurrentLang = _useState3[1];
|
|
69158
|
+
|
|
69159
|
+
var toggle = function toggle() {
|
|
69160
|
+
return setDropdownOpen(function (prevState) {
|
|
69161
|
+
return !prevState;
|
|
69162
|
+
});
|
|
69163
|
+
};
|
|
69164
|
+
|
|
69165
|
+
var changeLanguageApp = function changeLanguageApp(lang) {
|
|
69166
|
+
try {
|
|
69167
|
+
var _temp3 = function _temp3() {
|
|
69168
|
+
dispatch(marioCore.setLoading(false));
|
|
69169
|
+
};
|
|
69170
|
+
|
|
69171
|
+
dispatch(marioCore.setLoading(true));
|
|
69172
|
+
|
|
69173
|
+
var _temp4 = _catch(function () {
|
|
69174
|
+
return Promise.resolve(apiUpdateLanguage(lang)).then(function () {
|
|
69175
|
+
i18n.changeLanguage(lang);
|
|
69176
|
+
setCurrentLang(lang);
|
|
69177
|
+
dispatch(marioCore.setLanguage(lang));
|
|
69178
|
+
});
|
|
69179
|
+
}, function (err) {
|
|
69180
|
+
var _err$response, _err$response$data;
|
|
69181
|
+
|
|
69182
|
+
dispatch(marioCore.setAlert({
|
|
69183
|
+
type: "danger",
|
|
69184
|
+
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
|
|
69185
|
+
}));
|
|
69186
|
+
});
|
|
69187
|
+
|
|
69188
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
|
|
69189
|
+
} catch (e) {
|
|
69190
|
+
return Promise.reject(e);
|
|
69191
|
+
}
|
|
69192
|
+
};
|
|
69193
|
+
|
|
69194
|
+
var getListLanguage = function getListLanguage() {
|
|
69195
|
+
try {
|
|
69196
|
+
var _temp6 = _catch(function () {
|
|
69197
|
+
return Promise.resolve(apiGetLanguage()).then(function (res) {
|
|
69198
|
+
setLanguageList(res.data);
|
|
69199
|
+
});
|
|
69200
|
+
}, function (err) {
|
|
69201
|
+
var _err$response2, _err$response2$data;
|
|
69202
|
+
|
|
69203
|
+
dispatch(marioCore.setAlert({
|
|
69204
|
+
type: "danger",
|
|
69205
|
+
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
|
|
69206
|
+
}));
|
|
69207
|
+
});
|
|
69208
|
+
|
|
69209
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
|
69210
|
+
} catch (e) {
|
|
69211
|
+
return Promise.reject(e);
|
|
69212
|
+
}
|
|
69213
|
+
};
|
|
69214
|
+
|
|
69215
|
+
React.useEffect(function () {
|
|
69216
|
+
changeLanguageApp(defaultLanguage);
|
|
69217
|
+
getListLanguage();
|
|
69218
|
+
}, []);
|
|
69219
|
+
return {
|
|
69220
|
+
languageList: languageList,
|
|
69221
|
+
toggle: toggle,
|
|
69222
|
+
dropdownOpen: dropdownOpen,
|
|
69223
|
+
currentLang: currentLang,
|
|
69224
|
+
changeLanguageApp: changeLanguageApp,
|
|
69225
|
+
setCurrentLang: setCurrentLang
|
|
69226
|
+
};
|
|
69227
|
+
};
|
|
69228
|
+
|
|
69320
69229
|
var useStyles$g = core$1.makeStyles({
|
|
69321
69230
|
dropdown: {
|
|
69322
69231
|
zIndex: "1410 !important",
|
|
@@ -69343,22 +69252,18 @@ var useStyles$g = core$1.makeStyles({
|
|
|
69343
69252
|
});
|
|
69344
69253
|
|
|
69345
69254
|
var LanguageDropdown = function LanguageDropdown() {
|
|
69346
|
-
var defaultLanguage = !!localStorage.getItem("language") ? localStorage.getItem("language") : navigator.language || marioCore.DEFAULT_LANGUAGE_CODE;
|
|
69347
|
-
|
|
69348
|
-
var _useTranslation = marioCore.useTranslation(),
|
|
69349
|
-
i18n = _useTranslation.i18n;
|
|
69350
|
-
|
|
69351
|
-
var dispatch = reactRedux.useDispatch();
|
|
69352
69255
|
var classes = useStyles$g();
|
|
69353
69256
|
|
|
69354
69257
|
var _useState = React.useState(null),
|
|
69355
69258
|
anchorLang = _useState[0],
|
|
69356
69259
|
setAnchorLang = _useState[1];
|
|
69357
69260
|
|
|
69358
|
-
var
|
|
69359
|
-
|
|
69360
|
-
|
|
69261
|
+
var _useLanguages = useLanguages(),
|
|
69262
|
+
languageList = _useLanguages.languageList,
|
|
69263
|
+
currentLang = _useLanguages.currentLang,
|
|
69264
|
+
changeLanguageApp = _useLanguages.changeLanguageApp;
|
|
69361
69265
|
|
|
69266
|
+
console.log("admin language");
|
|
69362
69267
|
var openChooseLanguage = Boolean(anchorLang);
|
|
69363
69268
|
|
|
69364
69269
|
var handleLangClose = function handleLangClose() {
|
|
@@ -69369,27 +69274,16 @@ var LanguageDropdown = function LanguageDropdown() {
|
|
|
69369
69274
|
setAnchorLang(event.currentTarget);
|
|
69370
69275
|
};
|
|
69371
69276
|
|
|
69372
|
-
var changeLanguageApp = function changeLanguageApp(lang) {
|
|
69373
|
-
if (!marioCore.SUPPORTED_LANGUAGES_CODE.includes(lang)) lang = marioCore.DEFAULT_LANGUAGE_CODE;
|
|
69374
|
-
i18n.changeLanguage(lang);
|
|
69375
|
-
localStorage.setItem("language", lang);
|
|
69376
|
-
setCurrentLang(lang);
|
|
69377
|
-
dispatch(marioCore.setLanguage(lang));
|
|
69378
|
-
};
|
|
69379
|
-
|
|
69380
69277
|
var currentLanguage = React.useMemo(function () {
|
|
69381
|
-
var current =
|
|
69278
|
+
var current = languageList.find(function (i) {
|
|
69382
69279
|
return i.code === currentLang;
|
|
69383
69280
|
});
|
|
69384
69281
|
if (!current) return null;
|
|
69385
69282
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement("img", {
|
|
69386
69283
|
className: "mr-2 " + classes.icon_lang,
|
|
69387
|
-
src: "" + marioCore.getStaticFileUrl(
|
|
69388
|
-
}), current.
|
|
69389
|
-
}, [currentLang]);
|
|
69390
|
-
React.useEffect(function () {
|
|
69391
|
-
changeLanguageApp(currentLang);
|
|
69392
|
-
}, [currentLang]);
|
|
69284
|
+
src: "" + marioCore.getStaticFileUrl("/images/language-icon.png")
|
|
69285
|
+
}), current.name);
|
|
69286
|
+
}, [currentLang, languageList]);
|
|
69393
69287
|
return React__default.createElement(React__default.Fragment, null, React__default.createElement(core$1.IconButton, {
|
|
69394
69288
|
onClick: handleLangMenu,
|
|
69395
69289
|
color: "inherit"
|
|
@@ -69413,18 +69307,18 @@ var LanguageDropdown = function LanguageDropdown() {
|
|
|
69413
69307
|
open: openChooseLanguage,
|
|
69414
69308
|
onClose: handleLangClose,
|
|
69415
69309
|
onClick: handleLangClose
|
|
69416
|
-
},
|
|
69310
|
+
}, !!languageList && languageList.length > 0 && languageList.map(function (lang) {
|
|
69417
69311
|
return React__default.createElement(core$1.MenuItem, {
|
|
69418
|
-
key:
|
|
69312
|
+
key: lang.code,
|
|
69419
69313
|
onClick: function onClick() {
|
|
69420
|
-
return
|
|
69314
|
+
return changeLanguageApp(lang.code);
|
|
69421
69315
|
},
|
|
69422
|
-
selected: currentLang ==
|
|
69316
|
+
selected: currentLang == lang.code,
|
|
69423
69317
|
className: classes.fontMedium
|
|
69424
69318
|
}, React__default.createElement("img", {
|
|
69425
69319
|
className: classes.icon_lang,
|
|
69426
|
-
src: marioCore.getStaticFileUrl(
|
|
69427
|
-
}),
|
|
69320
|
+
src: marioCore.getStaticFileUrl(lang.logo)
|
|
69321
|
+
}), lang.name);
|
|
69428
69322
|
})));
|
|
69429
69323
|
};
|
|
69430
69324
|
|