acsi-core 0.9.30 → 0.9.31
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/CoreSelect/index.d.ts +2 -1
- package/dist/components/MarkdownLatexRender/MarkdownLatexRender.d.ts +7 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/containers/Login/configs/constants.d.ts +0 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +219 -1150
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +208 -1133
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/timeSpanToLocalMoment.d.ts +3 -0
- package/package.json +2 -2
- package/dist/components/MSALRedirectHandler/index.d.ts +0 -14
- package/dist/components/UpdateNotifier.d.ts +0 -3
- package/dist/configs/api.d.ts +0 -3
- package/dist/configs/api_removed.d.ts +0 -3
- package/dist/utils/configLoader.d.ts +0 -2
- package/dist/utils/hooks/useServiceWorker.d.ts +0 -1
- package/dist/utils/msalInstance.d.ts +0 -38
package/dist/index.modern.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { createBrowserHistory } from 'history';
|
|
1
2
|
import { createAction, createReducer, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import React, { useState, useRef, useEffect,
|
|
3
|
+
import React, { useState, useRef, useEffect, useCallback, Fragment } from 'react';
|
|
3
4
|
import { useGoogleLogin } from '@react-oauth/google';
|
|
4
5
|
export { GoogleOAuthProvider } from '@react-oauth/google';
|
|
5
6
|
import axios from 'axios';
|
|
@@ -14,10 +15,10 @@ import rehypeKatex from 'rehype-katex';
|
|
|
14
15
|
import remarkRehype from 'remark-rehype';
|
|
15
16
|
import rehypeRaw from 'rehype-raw';
|
|
16
17
|
import 'katex/dist/katex.min.css';
|
|
17
|
-
import { LogLevel, PublicClientApplication } from '@azure/msal-browser';
|
|
18
18
|
import Cookies from 'js-cookie';
|
|
19
19
|
export { default as Cookies } from 'js-cookie';
|
|
20
20
|
import moment from 'moment';
|
|
21
|
+
import { LogLevel, PublicClientApplication } from '@azure/msal-browser';
|
|
21
22
|
import { toast } from 'react-toastify';
|
|
22
23
|
export { ToastContainer, toast } from 'react-toastify';
|
|
23
24
|
import { useGoogleLogout } from '@leecheuk/react-google-login';
|
|
@@ -27,592 +28,6 @@ import { init as init$1, replayIntegration } from '@sentry/react';
|
|
|
27
28
|
import { FaCaretDown } from 'react-icons/fa';
|
|
28
29
|
import CreatableSelect from 'react-select/creatable';
|
|
29
30
|
|
|
30
|
-
function _extends() {
|
|
31
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
32
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
33
|
-
var t = arguments[e];
|
|
34
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
35
|
-
}
|
|
36
|
-
return n;
|
|
37
|
-
}, _extends.apply(null, arguments);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function isAbsolute(pathname) {
|
|
41
|
-
return pathname.charAt(0) === '/';
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// About 1.5x faster than the two-arg version of Array#splice()
|
|
45
|
-
function spliceOne(list, index) {
|
|
46
|
-
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
|
|
47
|
-
list[i] = list[k];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
list.pop();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// This implementation is based heavily on node's url.parse
|
|
54
|
-
function resolvePathname(to, from) {
|
|
55
|
-
if (from === undefined) from = '';
|
|
56
|
-
|
|
57
|
-
var toParts = (to && to.split('/')) || [];
|
|
58
|
-
var fromParts = (from && from.split('/')) || [];
|
|
59
|
-
|
|
60
|
-
var isToAbs = to && isAbsolute(to);
|
|
61
|
-
var isFromAbs = from && isAbsolute(from);
|
|
62
|
-
var mustEndAbs = isToAbs || isFromAbs;
|
|
63
|
-
|
|
64
|
-
if (to && isAbsolute(to)) {
|
|
65
|
-
// to is absolute
|
|
66
|
-
fromParts = toParts;
|
|
67
|
-
} else if (toParts.length) {
|
|
68
|
-
// to is relative, drop the filename
|
|
69
|
-
fromParts.pop();
|
|
70
|
-
fromParts = fromParts.concat(toParts);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (!fromParts.length) return '/';
|
|
74
|
-
|
|
75
|
-
var hasTrailingSlash;
|
|
76
|
-
if (fromParts.length) {
|
|
77
|
-
var last = fromParts[fromParts.length - 1];
|
|
78
|
-
hasTrailingSlash = last === '.' || last === '..' || last === '';
|
|
79
|
-
} else {
|
|
80
|
-
hasTrailingSlash = false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
var up = 0;
|
|
84
|
-
for (var i = fromParts.length; i >= 0; i--) {
|
|
85
|
-
var part = fromParts[i];
|
|
86
|
-
|
|
87
|
-
if (part === '.') {
|
|
88
|
-
spliceOne(fromParts, i);
|
|
89
|
-
} else if (part === '..') {
|
|
90
|
-
spliceOne(fromParts, i);
|
|
91
|
-
up++;
|
|
92
|
-
} else if (up) {
|
|
93
|
-
spliceOne(fromParts, i);
|
|
94
|
-
up--;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (!mustEndAbs) for (; up--; up) fromParts.unshift('..');
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
mustEndAbs &&
|
|
102
|
-
fromParts[0] !== '' &&
|
|
103
|
-
(!fromParts[0] || !isAbsolute(fromParts[0]))
|
|
104
|
-
)
|
|
105
|
-
fromParts.unshift('');
|
|
106
|
-
|
|
107
|
-
var result = fromParts.join('/');
|
|
108
|
-
|
|
109
|
-
if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
|
|
110
|
-
|
|
111
|
-
return result;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
var isProduction = process.env.NODE_ENV === 'production';
|
|
115
|
-
function warning(condition, message) {
|
|
116
|
-
if (!isProduction) {
|
|
117
|
-
if (condition) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
var text = "Warning: " + message;
|
|
122
|
-
|
|
123
|
-
if (typeof console !== 'undefined') {
|
|
124
|
-
console.warn(text);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
try {
|
|
128
|
-
throw Error(text);
|
|
129
|
-
} catch (x) {}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
var isProduction$1 = process.env.NODE_ENV === 'production';
|
|
134
|
-
var prefix = 'Invariant failed';
|
|
135
|
-
function invariant(condition, message) {
|
|
136
|
-
if (condition) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
if (isProduction$1) {
|
|
140
|
-
throw new Error(prefix);
|
|
141
|
-
}
|
|
142
|
-
var provided = typeof message === 'function' ? message() : message;
|
|
143
|
-
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
144
|
-
throw new Error(value);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function addLeadingSlash(path) {
|
|
148
|
-
return path.charAt(0) === '/' ? path : '/' + path;
|
|
149
|
-
}
|
|
150
|
-
function hasBasename(path, prefix) {
|
|
151
|
-
return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
|
|
152
|
-
}
|
|
153
|
-
function stripBasename(path, prefix) {
|
|
154
|
-
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
|
|
155
|
-
}
|
|
156
|
-
function stripTrailingSlash(path) {
|
|
157
|
-
return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
|
|
158
|
-
}
|
|
159
|
-
function parsePath(path) {
|
|
160
|
-
var pathname = path || '/';
|
|
161
|
-
var search = '';
|
|
162
|
-
var hash = '';
|
|
163
|
-
var hashIndex = pathname.indexOf('#');
|
|
164
|
-
|
|
165
|
-
if (hashIndex !== -1) {
|
|
166
|
-
hash = pathname.substr(hashIndex);
|
|
167
|
-
pathname = pathname.substr(0, hashIndex);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
var searchIndex = pathname.indexOf('?');
|
|
171
|
-
|
|
172
|
-
if (searchIndex !== -1) {
|
|
173
|
-
search = pathname.substr(searchIndex);
|
|
174
|
-
pathname = pathname.substr(0, searchIndex);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return {
|
|
178
|
-
pathname: pathname,
|
|
179
|
-
search: search === '?' ? '' : search,
|
|
180
|
-
hash: hash === '#' ? '' : hash
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
function createPath(location) {
|
|
184
|
-
var pathname = location.pathname,
|
|
185
|
-
search = location.search,
|
|
186
|
-
hash = location.hash;
|
|
187
|
-
var path = pathname || '/';
|
|
188
|
-
if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
|
|
189
|
-
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
|
|
190
|
-
return path;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function createLocation(path, state, key, currentLocation) {
|
|
194
|
-
var location;
|
|
195
|
-
|
|
196
|
-
if (typeof path === 'string') {
|
|
197
|
-
// Two-arg form: push(path, state)
|
|
198
|
-
location = parsePath(path);
|
|
199
|
-
location.state = state;
|
|
200
|
-
} else {
|
|
201
|
-
// One-arg form: push(location)
|
|
202
|
-
location = _extends({}, path);
|
|
203
|
-
if (location.pathname === undefined) location.pathname = '';
|
|
204
|
-
|
|
205
|
-
if (location.search) {
|
|
206
|
-
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
|
|
207
|
-
} else {
|
|
208
|
-
location.search = '';
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (location.hash) {
|
|
212
|
-
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
|
|
213
|
-
} else {
|
|
214
|
-
location.hash = '';
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (state !== undefined && location.state === undefined) location.state = state;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
try {
|
|
221
|
-
location.pathname = decodeURI(location.pathname);
|
|
222
|
-
} catch (e) {
|
|
223
|
-
if (e instanceof URIError) {
|
|
224
|
-
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
|
|
225
|
-
} else {
|
|
226
|
-
throw e;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (key) location.key = key;
|
|
231
|
-
|
|
232
|
-
if (currentLocation) {
|
|
233
|
-
// Resolve incomplete/relative pathname relative to current location.
|
|
234
|
-
if (!location.pathname) {
|
|
235
|
-
location.pathname = currentLocation.pathname;
|
|
236
|
-
} else if (location.pathname.charAt(0) !== '/') {
|
|
237
|
-
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
|
|
238
|
-
}
|
|
239
|
-
} else {
|
|
240
|
-
// When there is no prior location and pathname is empty, set it to /
|
|
241
|
-
if (!location.pathname) {
|
|
242
|
-
location.pathname = '/';
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return location;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function createTransitionManager() {
|
|
250
|
-
var prompt = null;
|
|
251
|
-
|
|
252
|
-
function setPrompt(nextPrompt) {
|
|
253
|
-
process.env.NODE_ENV !== "production" ? warning(prompt == null, 'A history supports only one prompt at a time') : void 0;
|
|
254
|
-
prompt = nextPrompt;
|
|
255
|
-
return function () {
|
|
256
|
-
if (prompt === nextPrompt) prompt = null;
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
function confirmTransitionTo(location, action, getUserConfirmation, callback) {
|
|
261
|
-
// TODO: If another transition starts while we're still confirming
|
|
262
|
-
// the previous one, we may end up in a weird state. Figure out the
|
|
263
|
-
// best way to handle this.
|
|
264
|
-
if (prompt != null) {
|
|
265
|
-
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
|
|
266
|
-
|
|
267
|
-
if (typeof result === 'string') {
|
|
268
|
-
if (typeof getUserConfirmation === 'function') {
|
|
269
|
-
getUserConfirmation(result, callback);
|
|
270
|
-
} else {
|
|
271
|
-
process.env.NODE_ENV !== "production" ? warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : void 0;
|
|
272
|
-
callback(true);
|
|
273
|
-
}
|
|
274
|
-
} else {
|
|
275
|
-
// Return false from a transition hook to cancel the transition.
|
|
276
|
-
callback(result !== false);
|
|
277
|
-
}
|
|
278
|
-
} else {
|
|
279
|
-
callback(true);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
var listeners = [];
|
|
284
|
-
|
|
285
|
-
function appendListener(fn) {
|
|
286
|
-
var isActive = true;
|
|
287
|
-
|
|
288
|
-
function listener() {
|
|
289
|
-
if (isActive) fn.apply(void 0, arguments);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
listeners.push(listener);
|
|
293
|
-
return function () {
|
|
294
|
-
isActive = false;
|
|
295
|
-
listeners = listeners.filter(function (item) {
|
|
296
|
-
return item !== listener;
|
|
297
|
-
});
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
function notifyListeners() {
|
|
302
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
303
|
-
args[_key] = arguments[_key];
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
listeners.forEach(function (listener) {
|
|
307
|
-
return listener.apply(void 0, args);
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return {
|
|
312
|
-
setPrompt: setPrompt,
|
|
313
|
-
confirmTransitionTo: confirmTransitionTo,
|
|
314
|
-
appendListener: appendListener,
|
|
315
|
-
notifyListeners: notifyListeners
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
320
|
-
function getConfirmation(message, callback) {
|
|
321
|
-
callback(window.confirm(message)); // eslint-disable-line no-alert
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
|
|
325
|
-
*
|
|
326
|
-
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
|
|
327
|
-
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
|
|
328
|
-
* changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
|
|
329
|
-
*/
|
|
330
|
-
|
|
331
|
-
function supportsHistory() {
|
|
332
|
-
var ua = window.navigator.userAgent;
|
|
333
|
-
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
|
|
334
|
-
return window.history && 'pushState' in window.history;
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Returns true if browser fires popstate on hash change.
|
|
338
|
-
* IE10 and IE11 do not.
|
|
339
|
-
*/
|
|
340
|
-
|
|
341
|
-
function supportsPopStateOnHashChange() {
|
|
342
|
-
return window.navigator.userAgent.indexOf('Trident') === -1;
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Returns true if a given popstate event is an extraneous WebKit event.
|
|
346
|
-
* Accounts for the fact that Chrome on iOS fires real popstate events
|
|
347
|
-
* containing undefined state when pressing the back button.
|
|
348
|
-
*/
|
|
349
|
-
|
|
350
|
-
function isExtraneousPopstateEvent(event) {
|
|
351
|
-
return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
var PopStateEvent = 'popstate';
|
|
355
|
-
var HashChangeEvent = 'hashchange';
|
|
356
|
-
|
|
357
|
-
function getHistoryState() {
|
|
358
|
-
try {
|
|
359
|
-
return window.history.state || {};
|
|
360
|
-
} catch (e) {
|
|
361
|
-
// IE 11 sometimes throws when accessing window.history.state
|
|
362
|
-
// See https://github.com/ReactTraining/history/pull/289
|
|
363
|
-
return {};
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Creates a history object that uses the HTML5 history API including
|
|
368
|
-
* pushState, replaceState, and the popstate event.
|
|
369
|
-
*/
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
function createBrowserHistory(props) {
|
|
373
|
-
if (props === void 0) {
|
|
374
|
-
props = {};
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
!canUseDOM ? process.env.NODE_ENV !== "production" ? invariant(false, 'Browser history needs a DOM') : invariant(false) : void 0;
|
|
378
|
-
var globalHistory = window.history;
|
|
379
|
-
var canUseHistory = supportsHistory();
|
|
380
|
-
var needsHashChangeListener = !supportsPopStateOnHashChange();
|
|
381
|
-
var _props = props,
|
|
382
|
-
_props$forceRefresh = _props.forceRefresh,
|
|
383
|
-
forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
|
|
384
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
|
385
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
|
386
|
-
_props$keyLength = _props.keyLength,
|
|
387
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
388
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
|
|
389
|
-
|
|
390
|
-
function getDOMLocation(historyState) {
|
|
391
|
-
var _ref = historyState || {},
|
|
392
|
-
key = _ref.key,
|
|
393
|
-
state = _ref.state;
|
|
394
|
-
|
|
395
|
-
var _window$location = window.location,
|
|
396
|
-
pathname = _window$location.pathname,
|
|
397
|
-
search = _window$location.search,
|
|
398
|
-
hash = _window$location.hash;
|
|
399
|
-
var path = pathname + search + hash;
|
|
400
|
-
process.env.NODE_ENV !== "production" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : void 0;
|
|
401
|
-
if (basename) path = stripBasename(path, basename);
|
|
402
|
-
return createLocation(path, state, key);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function createKey() {
|
|
406
|
-
return Math.random().toString(36).substr(2, keyLength);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
var transitionManager = createTransitionManager();
|
|
410
|
-
|
|
411
|
-
function setState(nextState) {
|
|
412
|
-
_extends(history, nextState);
|
|
413
|
-
|
|
414
|
-
history.length = globalHistory.length;
|
|
415
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
function handlePopState(event) {
|
|
419
|
-
// Ignore extraneous popstate events in WebKit.
|
|
420
|
-
if (isExtraneousPopstateEvent(event)) return;
|
|
421
|
-
handlePop(getDOMLocation(event.state));
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
function handleHashChange() {
|
|
425
|
-
handlePop(getDOMLocation(getHistoryState()));
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
var forceNextPop = false;
|
|
429
|
-
|
|
430
|
-
function handlePop(location) {
|
|
431
|
-
if (forceNextPop) {
|
|
432
|
-
forceNextPop = false;
|
|
433
|
-
setState();
|
|
434
|
-
} else {
|
|
435
|
-
var action = 'POP';
|
|
436
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
437
|
-
if (ok) {
|
|
438
|
-
setState({
|
|
439
|
-
action: action,
|
|
440
|
-
location: location
|
|
441
|
-
});
|
|
442
|
-
} else {
|
|
443
|
-
revertPop(location);
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
function revertPop(fromLocation) {
|
|
450
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
|
451
|
-
// keeping a list of keys we've seen in sessionStorage.
|
|
452
|
-
// Instead, we just default to 0 for keys we don't know.
|
|
453
|
-
|
|
454
|
-
var toIndex = allKeys.indexOf(toLocation.key);
|
|
455
|
-
if (toIndex === -1) toIndex = 0;
|
|
456
|
-
var fromIndex = allKeys.indexOf(fromLocation.key);
|
|
457
|
-
if (fromIndex === -1) fromIndex = 0;
|
|
458
|
-
var delta = toIndex - fromIndex;
|
|
459
|
-
|
|
460
|
-
if (delta) {
|
|
461
|
-
forceNextPop = true;
|
|
462
|
-
go(delta);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
var initialLocation = getDOMLocation(getHistoryState());
|
|
467
|
-
var allKeys = [initialLocation.key]; // Public interface
|
|
468
|
-
|
|
469
|
-
function createHref(location) {
|
|
470
|
-
return basename + createPath(location);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
function push(path, state) {
|
|
474
|
-
process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
|
|
475
|
-
var action = 'PUSH';
|
|
476
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
477
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
478
|
-
if (!ok) return;
|
|
479
|
-
var href = createHref(location);
|
|
480
|
-
var key = location.key,
|
|
481
|
-
state = location.state;
|
|
482
|
-
|
|
483
|
-
if (canUseHistory) {
|
|
484
|
-
globalHistory.pushState({
|
|
485
|
-
key: key,
|
|
486
|
-
state: state
|
|
487
|
-
}, null, href);
|
|
488
|
-
|
|
489
|
-
if (forceRefresh) {
|
|
490
|
-
window.location.href = href;
|
|
491
|
-
} else {
|
|
492
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
493
|
-
var nextKeys = allKeys.slice(0, prevIndex + 1);
|
|
494
|
-
nextKeys.push(location.key);
|
|
495
|
-
allKeys = nextKeys;
|
|
496
|
-
setState({
|
|
497
|
-
action: action,
|
|
498
|
-
location: location
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
} else {
|
|
502
|
-
process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : void 0;
|
|
503
|
-
window.location.href = href;
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
function replace(path, state) {
|
|
509
|
-
process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
|
|
510
|
-
var action = 'REPLACE';
|
|
511
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
512
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
513
|
-
if (!ok) return;
|
|
514
|
-
var href = createHref(location);
|
|
515
|
-
var key = location.key,
|
|
516
|
-
state = location.state;
|
|
517
|
-
|
|
518
|
-
if (canUseHistory) {
|
|
519
|
-
globalHistory.replaceState({
|
|
520
|
-
key: key,
|
|
521
|
-
state: state
|
|
522
|
-
}, null, href);
|
|
523
|
-
|
|
524
|
-
if (forceRefresh) {
|
|
525
|
-
window.location.replace(href);
|
|
526
|
-
} else {
|
|
527
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
528
|
-
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
|
|
529
|
-
setState({
|
|
530
|
-
action: action,
|
|
531
|
-
location: location
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
} else {
|
|
535
|
-
process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : void 0;
|
|
536
|
-
window.location.replace(href);
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
function go(n) {
|
|
542
|
-
globalHistory.go(n);
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
function goBack() {
|
|
546
|
-
go(-1);
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
function goForward() {
|
|
550
|
-
go(1);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
var listenerCount = 0;
|
|
554
|
-
|
|
555
|
-
function checkDOMListeners(delta) {
|
|
556
|
-
listenerCount += delta;
|
|
557
|
-
|
|
558
|
-
if (listenerCount === 1 && delta === 1) {
|
|
559
|
-
window.addEventListener(PopStateEvent, handlePopState);
|
|
560
|
-
if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
|
|
561
|
-
} else if (listenerCount === 0) {
|
|
562
|
-
window.removeEventListener(PopStateEvent, handlePopState);
|
|
563
|
-
if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
var isBlocked = false;
|
|
568
|
-
|
|
569
|
-
function block(prompt) {
|
|
570
|
-
if (prompt === void 0) {
|
|
571
|
-
prompt = false;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
var unblock = transitionManager.setPrompt(prompt);
|
|
575
|
-
|
|
576
|
-
if (!isBlocked) {
|
|
577
|
-
checkDOMListeners(1);
|
|
578
|
-
isBlocked = true;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
return function () {
|
|
582
|
-
if (isBlocked) {
|
|
583
|
-
isBlocked = false;
|
|
584
|
-
checkDOMListeners(-1);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
return unblock();
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
function listen(listener) {
|
|
592
|
-
var unlisten = transitionManager.appendListener(listener);
|
|
593
|
-
checkDOMListeners(1);
|
|
594
|
-
return function () {
|
|
595
|
-
checkDOMListeners(-1);
|
|
596
|
-
unlisten();
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
var history = {
|
|
601
|
-
length: globalHistory.length,
|
|
602
|
-
action: 'POP',
|
|
603
|
-
location: initialLocation,
|
|
604
|
-
createHref: createHref,
|
|
605
|
-
push: push,
|
|
606
|
-
replace: replace,
|
|
607
|
-
go: go,
|
|
608
|
-
goBack: goBack,
|
|
609
|
-
goForward: goForward,
|
|
610
|
-
block: block,
|
|
611
|
-
listen: listen
|
|
612
|
-
};
|
|
613
|
-
return history;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
31
|
var setLoading = createAction("common/setLoading");
|
|
617
32
|
var setLoadingPage = createAction("common/setLoadingPage");
|
|
618
33
|
var setAlert = createAction("common/setAlert");
|
|
@@ -671,25 +86,6 @@ var ORGANIZATION_TEAM = "ORGANIZATION_TEAM";
|
|
|
671
86
|
|
|
672
87
|
var styleGlobal = {"signup_wrap":"_1KLz9","box-signin":"_2Jo1o","signin_title":"_3egBO","signup_link":"_1DoIT","google_button":"_34hK_","microsoft_button":"_19ESb","box-field":"_2e9xO","box-input":"_3zXRp","box-text":"_8NJga","box-button-email":"_21FPk","box-signin-container":"_1QERu","box-signin-text":"_2-znH","box-signin-logo":"_1aB2m","box-right":"_3qndF","image-slideshow":"_1aM7m","active":"_Vx1zf","box-right-body":"_JzdCr","box-right-footer":"_19aCA","pr-30":"_2HB5r","width-400":"_4ehXP"};
|
|
673
88
|
|
|
674
|
-
// A type of promise-like that resolves synchronously and supports only one observer
|
|
675
|
-
|
|
676
|
-
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
|
|
677
|
-
|
|
678
|
-
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
|
679
|
-
|
|
680
|
-
// Asynchronously call a function and send errors to recovery continuation
|
|
681
|
-
function _catch(body, recover) {
|
|
682
|
-
try {
|
|
683
|
-
var result = body();
|
|
684
|
-
} catch(e) {
|
|
685
|
-
return recover(e);
|
|
686
|
-
}
|
|
687
|
-
if (result && result.then) {
|
|
688
|
-
return result.then(void 0, recover);
|
|
689
|
-
}
|
|
690
|
-
return result;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
89
|
function _arrayLikeToArray(r, a) {
|
|
694
90
|
(null == a || a > r.length) && (a = r.length);
|
|
695
91
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -712,14 +108,14 @@ function _createForOfIteratorHelperLoose(r, e) {
|
|
|
712
108
|
}
|
|
713
109
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
714
110
|
}
|
|
715
|
-
function _extends
|
|
716
|
-
return _extends
|
|
111
|
+
function _extends() {
|
|
112
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
717
113
|
for (var e = 1; e < arguments.length; e++) {
|
|
718
114
|
var t = arguments[e];
|
|
719
115
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
720
116
|
}
|
|
721
117
|
return n;
|
|
722
|
-
}, _extends
|
|
118
|
+
}, _extends.apply(null, arguments);
|
|
723
119
|
}
|
|
724
120
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
725
121
|
if (null == r) return {};
|
|
@@ -738,6 +134,25 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
738
134
|
}
|
|
739
135
|
}
|
|
740
136
|
|
|
137
|
+
// A type of promise-like that resolves synchronously and supports only one observer
|
|
138
|
+
|
|
139
|
+
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
|
|
140
|
+
|
|
141
|
+
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
|
142
|
+
|
|
143
|
+
// Asynchronously call a function and send errors to recovery continuation
|
|
144
|
+
function _catch(body, recover) {
|
|
145
|
+
try {
|
|
146
|
+
var result = body();
|
|
147
|
+
} catch(e) {
|
|
148
|
+
return recover(e);
|
|
149
|
+
}
|
|
150
|
+
if (result && result.then) {
|
|
151
|
+
return result.then(void 0, recover);
|
|
152
|
+
}
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
|
|
741
156
|
var styles = {"core-button":"_xvNBN","primary":"_U9Qyp","secondary":"_1VzMy","text":"_pZNuj","danger":"_2uYm1","light":"_wxH5S"};
|
|
742
157
|
|
|
743
158
|
var _excluded = ["type", "children", "onClick", "icon", "disabled", "htmlType"];
|
|
@@ -827,14 +242,28 @@ var CoreInput = function CoreInput(props) {
|
|
|
827
242
|
var styles$3 = {"core-select":"_2sg12","label":"_1-XBo"};
|
|
828
243
|
|
|
829
244
|
var Option = function Option(props) {
|
|
830
|
-
return React.createElement("div", null, React.createElement(components.Option, Object.assign({}, props
|
|
245
|
+
return React.createElement("div", null, React.createElement(components.Option, Object.assign({}, props, {
|
|
246
|
+
onClick: function onClick(e) {
|
|
247
|
+
var _props$innerProps;
|
|
248
|
+
if (props !== null && props !== void 0 && props.action) {
|
|
249
|
+
e.preventDefault();
|
|
250
|
+
e.stopPropagation();
|
|
251
|
+
props === null || props === void 0 ? void 0 : props.action();
|
|
252
|
+
console.log("`Action executed");
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if ((_props$innerProps = props.innerProps) !== null && _props$innerProps !== void 0 && _props$innerProps.onClick) {
|
|
256
|
+
props.innerProps.onClick(e);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}), props.isMulti ? React.createElement(CoreInput$1, {
|
|
831
260
|
checked: props.isSelected,
|
|
832
261
|
onChange: function onChange() {
|
|
833
262
|
return null;
|
|
834
263
|
},
|
|
835
264
|
name: "",
|
|
836
265
|
label: props.label
|
|
837
|
-
})));
|
|
266
|
+
}) : props.children));
|
|
838
267
|
};
|
|
839
268
|
var CoreSelect = function CoreSelect(props) {
|
|
840
269
|
var name = props.name,
|
|
@@ -865,7 +294,7 @@ var CoreSelect = function CoreSelect(props) {
|
|
|
865
294
|
onChange(name, newValue);
|
|
866
295
|
};
|
|
867
296
|
var controlStyle = function controlStyle(base, state) {
|
|
868
|
-
var styles = _extends
|
|
297
|
+
var styles = _extends({}, base, {
|
|
869
298
|
fontSize: "14px",
|
|
870
299
|
fontWeight: "400",
|
|
871
300
|
padding: "0 4px",
|
|
@@ -894,7 +323,7 @@ var CoreSelect = function CoreSelect(props) {
|
|
|
894
323
|
return styles;
|
|
895
324
|
};
|
|
896
325
|
var inputStyles = function inputStyles(base) {
|
|
897
|
-
var styles = _extends
|
|
326
|
+
var styles = _extends({}, base, {
|
|
898
327
|
margin: "0",
|
|
899
328
|
padding: "0",
|
|
900
329
|
color: "inherit"
|
|
@@ -902,13 +331,13 @@ var CoreSelect = function CoreSelect(props) {
|
|
|
902
331
|
return styles;
|
|
903
332
|
};
|
|
904
333
|
var placeholderStyles = function placeholderStyles(base) {
|
|
905
|
-
var styles = _extends
|
|
334
|
+
var styles = _extends({}, base, {
|
|
906
335
|
color: COLORS.lightGray
|
|
907
336
|
});
|
|
908
337
|
return styles;
|
|
909
338
|
};
|
|
910
339
|
var dropdownIndicatorStyles = function dropdownIndicatorStyles(base) {
|
|
911
|
-
var styles = _extends
|
|
340
|
+
var styles = _extends({}, base, {
|
|
912
341
|
position: "relative",
|
|
913
342
|
top: "-4px",
|
|
914
343
|
padding: "8px 0"
|
|
@@ -916,7 +345,7 @@ var CoreSelect = function CoreSelect(props) {
|
|
|
916
345
|
return styles;
|
|
917
346
|
};
|
|
918
347
|
var valueContainerStyles = function valueContainerStyles(base) {
|
|
919
|
-
var styles = _extends
|
|
348
|
+
var styles = _extends({}, base, {
|
|
920
349
|
height: isMulti ? undefined : "32px",
|
|
921
350
|
position: "relative",
|
|
922
351
|
top: "-3px"
|
|
@@ -924,11 +353,11 @@ var CoreSelect = function CoreSelect(props) {
|
|
|
924
353
|
return styles;
|
|
925
354
|
};
|
|
926
355
|
var singleValueStyles = function singleValueStyles(base) {
|
|
927
|
-
var styles = _extends
|
|
356
|
+
var styles = _extends({}, base);
|
|
928
357
|
return styles;
|
|
929
358
|
};
|
|
930
359
|
var optionStyles = function optionStyles(base, state) {
|
|
931
|
-
var styles = _extends
|
|
360
|
+
var styles = _extends({}, base, {
|
|
932
361
|
padding: "8px",
|
|
933
362
|
borderRadius: "8px",
|
|
934
363
|
cursor: "pointer",
|
|
@@ -942,13 +371,13 @@ var CoreSelect = function CoreSelect(props) {
|
|
|
942
371
|
return styles;
|
|
943
372
|
};
|
|
944
373
|
var indicatorsContainerStyles = function indicatorsContainerStyles(base) {
|
|
945
|
-
var styles = _extends
|
|
374
|
+
var styles = _extends({}, base, {
|
|
946
375
|
display: type === "no-outline" ? "none" : "block"
|
|
947
376
|
});
|
|
948
377
|
return styles;
|
|
949
378
|
};
|
|
950
379
|
var multiValueStyles = function multiValueStyles(base) {
|
|
951
|
-
var styles = _extends
|
|
380
|
+
var styles = _extends({}, base, {
|
|
952
381
|
backgroundColor: COLORS.lightBlue,
|
|
953
382
|
borderRadius: "4px",
|
|
954
383
|
padding: "2px 8px",
|
|
@@ -960,14 +389,14 @@ var CoreSelect = function CoreSelect(props) {
|
|
|
960
389
|
return styles;
|
|
961
390
|
};
|
|
962
391
|
var multiValueRemoveStyles = function multiValueRemoveStyles(base) {
|
|
963
|
-
var styles = _extends
|
|
392
|
+
var styles = _extends({}, base, {
|
|
964
393
|
color: COLORS.lightGray,
|
|
965
394
|
cursor: "pointer"
|
|
966
395
|
});
|
|
967
396
|
return styles;
|
|
968
397
|
};
|
|
969
398
|
var multiValueLabelStyles = function multiValueLabelStyles(base) {
|
|
970
|
-
var styles = _extends
|
|
399
|
+
var styles = _extends({}, base, {
|
|
971
400
|
color: COLORS.blackText,
|
|
972
401
|
fontWeight: "400",
|
|
973
402
|
fontSize: "13px",
|
|
@@ -994,9 +423,9 @@ var CoreSelect = function CoreSelect(props) {
|
|
|
994
423
|
closeMenuOnSelect: closeMenuOnSelect,
|
|
995
424
|
hideSelectedOptions: hideSelectedOptions,
|
|
996
425
|
options: options,
|
|
997
|
-
components:
|
|
426
|
+
components: {
|
|
998
427
|
Option: Option
|
|
999
|
-
}
|
|
428
|
+
},
|
|
1000
429
|
styles: {
|
|
1001
430
|
control: controlStyle,
|
|
1002
431
|
input: inputStyles,
|
|
@@ -1406,7 +835,7 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
|
|
|
1406
835
|
onChange(name, newValue);
|
|
1407
836
|
};
|
|
1408
837
|
var controlStyle = function controlStyle(base, state) {
|
|
1409
|
-
var styles = _extends
|
|
838
|
+
var styles = _extends({}, base, {
|
|
1410
839
|
fontSize: "14px",
|
|
1411
840
|
fontWeight: "400",
|
|
1412
841
|
backgroundColor: state.isDisabled ? "transparent" : error ? COLORS.lightYellow : COLORS.white,
|
|
@@ -1427,7 +856,7 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
|
|
|
1427
856
|
return styles;
|
|
1428
857
|
};
|
|
1429
858
|
var inputStyles = function inputStyles(base) {
|
|
1430
|
-
var styles = _extends
|
|
859
|
+
var styles = _extends({}, base, {
|
|
1431
860
|
margin: "0",
|
|
1432
861
|
padding: "0",
|
|
1433
862
|
color: "inherit",
|
|
@@ -1437,37 +866,37 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
|
|
|
1437
866
|
return styles;
|
|
1438
867
|
};
|
|
1439
868
|
var placeholderStyles = function placeholderStyles(base) {
|
|
1440
|
-
var styles = _extends
|
|
869
|
+
var styles = _extends({}, base, {
|
|
1441
870
|
color: COLORS.lightGray
|
|
1442
871
|
});
|
|
1443
872
|
return styles;
|
|
1444
873
|
};
|
|
1445
874
|
var dropdownIndicatorStyles = function dropdownIndicatorStyles(base) {
|
|
1446
|
-
var styles = _extends
|
|
875
|
+
var styles = _extends({}, base, {
|
|
1447
876
|
position: "relative",
|
|
1448
877
|
padding: "2px 0"
|
|
1449
878
|
});
|
|
1450
879
|
return styles;
|
|
1451
880
|
};
|
|
1452
881
|
var indicatorsContainerStyles = function indicatorsContainerStyles(base) {
|
|
1453
|
-
var styles = _extends
|
|
882
|
+
var styles = _extends({}, base, {
|
|
1454
883
|
display: isShowDropdown && !isMulti ? "block" : "none"
|
|
1455
884
|
});
|
|
1456
885
|
return styles;
|
|
1457
886
|
};
|
|
1458
887
|
var valueContainerStyles = function valueContainerStyles(base) {
|
|
1459
|
-
var styles = _extends
|
|
888
|
+
var styles = _extends({}, base, {
|
|
1460
889
|
height: isMulti ? undefined : "26px",
|
|
1461
890
|
position: "relative"
|
|
1462
891
|
});
|
|
1463
892
|
return styles;
|
|
1464
893
|
};
|
|
1465
894
|
var singleValueStyles = function singleValueStyles(base) {
|
|
1466
|
-
var styles = _extends
|
|
895
|
+
var styles = _extends({}, base);
|
|
1467
896
|
return styles;
|
|
1468
897
|
};
|
|
1469
898
|
var optionStyles = function optionStyles(base, state) {
|
|
1470
|
-
var styles = _extends
|
|
899
|
+
var styles = _extends({}, base, {
|
|
1471
900
|
padding: "8px",
|
|
1472
901
|
borderRadius: "8px",
|
|
1473
902
|
cursor: "pointer",
|
|
@@ -1482,7 +911,7 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
|
|
|
1482
911
|
return styles;
|
|
1483
912
|
};
|
|
1484
913
|
var multiValueStyles = function multiValueStyles(base) {
|
|
1485
|
-
var styles = _extends
|
|
914
|
+
var styles = _extends({}, base, {
|
|
1486
915
|
backgroundColor: COLORS.lightBlue,
|
|
1487
916
|
borderRadius: "4px",
|
|
1488
917
|
padding: "0 4px",
|
|
@@ -1494,14 +923,14 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
|
|
|
1494
923
|
return styles;
|
|
1495
924
|
};
|
|
1496
925
|
var multiValueRemoveStyles = function multiValueRemoveStyles(base) {
|
|
1497
|
-
var styles = _extends
|
|
926
|
+
var styles = _extends({}, base, {
|
|
1498
927
|
color: COLORS.lightGray,
|
|
1499
928
|
cursor: "pointer"
|
|
1500
929
|
});
|
|
1501
930
|
return styles;
|
|
1502
931
|
};
|
|
1503
932
|
var multiValueLabelStyles = function multiValueLabelStyles(base) {
|
|
1504
|
-
var styles = _extends
|
|
933
|
+
var styles = _extends({}, base, {
|
|
1505
934
|
color: COLORS.blackText,
|
|
1506
935
|
fontWeight: "400",
|
|
1507
936
|
fontSize: "13px",
|
|
@@ -2169,280 +1598,6 @@ function formatContent(content) {
|
|
|
2169
1598
|
return result.join("\n");
|
|
2170
1599
|
}
|
|
2171
1600
|
|
|
2172
|
-
var AuthenticationMessage;
|
|
2173
|
-
(function (AuthenticationMessage) {
|
|
2174
|
-
AuthenticationMessage["NotAllowedToRegister"] = "NotAllowedToRegister";
|
|
2175
|
-
AuthenticationMessage["InvalidGoogleToken"] = "InvalidGoogleToken";
|
|
2176
|
-
})(AuthenticationMessage || (AuthenticationMessage = {}));
|
|
2177
|
-
var Role;
|
|
2178
|
-
(function (Role) {
|
|
2179
|
-
Role["Student"] = "Student";
|
|
2180
|
-
Role["Teacher"] = "Teacher";
|
|
2181
|
-
Role["Admin"] = "Admin";
|
|
2182
|
-
})(Role || (Role = {}));
|
|
2183
|
-
var msalConfig = function msalConfig(clientId, redirectUri) {
|
|
2184
|
-
return {
|
|
2185
|
-
auth: {
|
|
2186
|
-
clientId: clientId,
|
|
2187
|
-
authority: "https://login.microsoftonline.com/common",
|
|
2188
|
-
redirectUri: redirectUri,
|
|
2189
|
-
navigateToLoginRequestUrl: false
|
|
2190
|
-
},
|
|
2191
|
-
cache: {
|
|
2192
|
-
cacheLocation: "localStorage",
|
|
2193
|
-
storeAuthStateInCookie: false
|
|
2194
|
-
},
|
|
2195
|
-
system: {
|
|
2196
|
-
loggerOptions: {
|
|
2197
|
-
loggerCallback: function loggerCallback(level, message, containsPii) {
|
|
2198
|
-
if (containsPii) {
|
|
2199
|
-
return;
|
|
2200
|
-
}
|
|
2201
|
-
var prefix = '[MSAL]';
|
|
2202
|
-
switch (level) {
|
|
2203
|
-
case LogLevel.Error:
|
|
2204
|
-
console.error(prefix + " " + message);
|
|
2205
|
-
return;
|
|
2206
|
-
case LogLevel.Info:
|
|
2207
|
-
console.info(prefix + " " + message);
|
|
2208
|
-
return;
|
|
2209
|
-
case LogLevel.Verbose:
|
|
2210
|
-
console.debug(prefix + " " + message);
|
|
2211
|
-
return;
|
|
2212
|
-
case LogLevel.Warning:
|
|
2213
|
-
console.warn(prefix + " " + message);
|
|
2214
|
-
return;
|
|
2215
|
-
default:
|
|
2216
|
-
return;
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
};
|
|
2222
|
-
};
|
|
2223
|
-
|
|
2224
|
-
var msalInstance = null;
|
|
2225
|
-
var isInitializing = false;
|
|
2226
|
-
var initPromise = null;
|
|
2227
|
-
var getMSALInstance = function getMSALInstance(clientId, redirectUri) {
|
|
2228
|
-
var finalClientId = clientId || MICROSOFT_CLIENT_ID;
|
|
2229
|
-
var finalRedirectUri = redirectUri || MICROSOFT_URL_DIRECT || window.location.origin;
|
|
2230
|
-
if (!finalClientId) {
|
|
2231
|
-
return null;
|
|
2232
|
-
}
|
|
2233
|
-
if (!msalInstance) {
|
|
2234
|
-
msalInstance = new PublicClientApplication(msalConfig(finalClientId, finalRedirectUri));
|
|
2235
|
-
} else {
|
|
2236
|
-
var _existingConfig$auth, _existingConfig$auth2;
|
|
2237
|
-
var existingConfig = msalInstance.config;
|
|
2238
|
-
if ((existingConfig === null || existingConfig === void 0 ? void 0 : (_existingConfig$auth = existingConfig.auth) === null || _existingConfig$auth === void 0 ? void 0 : _existingConfig$auth.clientId) !== finalClientId || (existingConfig === null || existingConfig === void 0 ? void 0 : (_existingConfig$auth2 = existingConfig.auth) === null || _existingConfig$auth2 === void 0 ? void 0 : _existingConfig$auth2.redirectUri) !== finalRedirectUri) {
|
|
2239
|
-
msalInstance = new PublicClientApplication(msalConfig(finalClientId, finalRedirectUri));
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2242
|
-
return msalInstance;
|
|
2243
|
-
};
|
|
2244
|
-
var initializeMSAL = function initializeMSAL(clientId, redirectUri) {
|
|
2245
|
-
try {
|
|
2246
|
-
var instance = getMSALInstance(clientId, redirectUri);
|
|
2247
|
-
if (!instance) {
|
|
2248
|
-
return Promise.resolve(null);
|
|
2249
|
-
}
|
|
2250
|
-
if (isInitializing && initPromise) {
|
|
2251
|
-
return Promise.resolve(initPromise.then(function () {
|
|
2252
|
-
return instance;
|
|
2253
|
-
}));
|
|
2254
|
-
}
|
|
2255
|
-
if (isInitializing) {
|
|
2256
|
-
return Promise.resolve(instance);
|
|
2257
|
-
}
|
|
2258
|
-
isInitializing = true;
|
|
2259
|
-
initPromise = instance.initialize().then(function () {
|
|
2260
|
-
isInitializing = false;
|
|
2261
|
-
return instance;
|
|
2262
|
-
})["catch"](function (error) {
|
|
2263
|
-
isInitializing = false;
|
|
2264
|
-
throw error;
|
|
2265
|
-
});
|
|
2266
|
-
return Promise.resolve(initPromise);
|
|
2267
|
-
} catch (e) {
|
|
2268
|
-
return Promise.reject(e);
|
|
2269
|
-
}
|
|
2270
|
-
};
|
|
2271
|
-
var handleMSALRedirect = function handleMSALRedirect(clientId, redirectUri) {
|
|
2272
|
-
try {
|
|
2273
|
-
if (!window.location.hash) {
|
|
2274
|
-
return Promise.resolve(null);
|
|
2275
|
-
}
|
|
2276
|
-
var hashParams = new URLSearchParams(window.location.hash.substring(1));
|
|
2277
|
-
var hasAccessToken = hashParams.has('access_token');
|
|
2278
|
-
var hasIdToken = hashParams.has('id_token');
|
|
2279
|
-
var hasError = hashParams.has('error');
|
|
2280
|
-
var hasCode = hashParams.has('code');
|
|
2281
|
-
var hasMSALParams = hasAccessToken || hasIdToken || hasError || hasCode;
|
|
2282
|
-
if (!hasMSALParams) {
|
|
2283
|
-
return Promise.resolve(null);
|
|
2284
|
-
}
|
|
2285
|
-
return Promise.resolve(_catch(function () {
|
|
2286
|
-
return Promise.resolve(initializeMSAL(clientId, redirectUri)).then(function (instance) {
|
|
2287
|
-
return instance ? Promise.resolve(instance.handleRedirectPromise()).then(function (response) {
|
|
2288
|
-
var _exit = false;
|
|
2289
|
-
var _temp = function () {
|
|
2290
|
-
if (response) {
|
|
2291
|
-
_exit = true;
|
|
2292
|
-
return response;
|
|
2293
|
-
} else {
|
|
2294
|
-
return function () {
|
|
2295
|
-
if (hashParams.has('code')) {
|
|
2296
|
-
return _catch(function () {
|
|
2297
|
-
var clientInfo = hashParams.get('client_info');
|
|
2298
|
-
return function () {
|
|
2299
|
-
if (clientInfo) {
|
|
2300
|
-
var decodedClientInfo = JSON.parse(atob(clientInfo));
|
|
2301
|
-
var allAccounts = instance.getAllAccounts();
|
|
2302
|
-
var matchingAccount = allAccounts.find(function (acc) {
|
|
2303
|
-
return acc.homeAccountId === decodedClientInfo.uid || acc.username === decodedClientInfo.preferred_username || acc.username === decodedClientInfo.email;
|
|
2304
|
-
});
|
|
2305
|
-
if (!matchingAccount && allAccounts.length > 0) {
|
|
2306
|
-
matchingAccount = allAccounts[0];
|
|
2307
|
-
}
|
|
2308
|
-
return function () {
|
|
2309
|
-
if (matchingAccount) {
|
|
2310
|
-
return _catch(function () {
|
|
2311
|
-
return Promise.resolve(instance.acquireTokenSilent({
|
|
2312
|
-
scopes: ["openid", "profile", "User.Read"],
|
|
2313
|
-
account: matchingAccount
|
|
2314
|
-
})).then(function (silentResult) {
|
|
2315
|
-
if (silentResult) {
|
|
2316
|
-
_exit = true;
|
|
2317
|
-
return silentResult;
|
|
2318
|
-
}
|
|
2319
|
-
});
|
|
2320
|
-
}, function () {});
|
|
2321
|
-
} else {
|
|
2322
|
-
var accountInfo = {
|
|
2323
|
-
homeAccountId: decodedClientInfo.uid || decodedClientInfo.sub,
|
|
2324
|
-
environment: 'login.microsoftonline.com',
|
|
2325
|
-
tenantId: decodedClientInfo.tid,
|
|
2326
|
-
username: decodedClientInfo.preferred_username || decodedClientInfo.email,
|
|
2327
|
-
name: decodedClientInfo.name,
|
|
2328
|
-
localAccountId: decodedClientInfo.oid || decodedClientInfo.sub
|
|
2329
|
-
};
|
|
2330
|
-
var _account$accessToken$ = {
|
|
2331
|
-
account: accountInfo,
|
|
2332
|
-
accessToken: '',
|
|
2333
|
-
idToken: '',
|
|
2334
|
-
scopes: ["openid", "profile", "User.Read"],
|
|
2335
|
-
expiresOn: null,
|
|
2336
|
-
tenantId: decodedClientInfo.tid,
|
|
2337
|
-
uniqueId: decodedClientInfo.oid || decodedClientInfo.sub,
|
|
2338
|
-
tokenType: 'Bearer'
|
|
2339
|
-
};
|
|
2340
|
-
_exit = true;
|
|
2341
|
-
return _account$accessToken$;
|
|
2342
|
-
}
|
|
2343
|
-
}();
|
|
2344
|
-
}
|
|
2345
|
-
}();
|
|
2346
|
-
}, function () {});
|
|
2347
|
-
}
|
|
2348
|
-
}();
|
|
2349
|
-
}
|
|
2350
|
-
}();
|
|
2351
|
-
return _temp && _temp.then ? _temp.then(function (_result6) {
|
|
2352
|
-
return _exit ? _result6 : response;
|
|
2353
|
-
}) : _exit ? _temp : response;
|
|
2354
|
-
}) : null;
|
|
2355
|
-
});
|
|
2356
|
-
}, function (error) {
|
|
2357
|
-
console.error('[MSAL] Error during redirect processing:', error);
|
|
2358
|
-
return null;
|
|
2359
|
-
}));
|
|
2360
|
-
} catch (e) {
|
|
2361
|
-
return Promise.reject(e);
|
|
2362
|
-
}
|
|
2363
|
-
};
|
|
2364
|
-
var isMSALRedirect = function isMSALRedirect() {
|
|
2365
|
-
if (!window.location.hash) {
|
|
2366
|
-
return false;
|
|
2367
|
-
}
|
|
2368
|
-
var hashParams = new URLSearchParams(window.location.hash.substring(1));
|
|
2369
|
-
return hashParams.has('access_token') || hashParams.has('id_token') || hashParams.has('error') || hashParams.has('code');
|
|
2370
|
-
};
|
|
2371
|
-
var getAllAccounts = function getAllAccounts() {
|
|
2372
|
-
var instance = getMSALInstance();
|
|
2373
|
-
if (!instance) {
|
|
2374
|
-
return [];
|
|
2375
|
-
}
|
|
2376
|
-
return instance.getAllAccounts();
|
|
2377
|
-
};
|
|
2378
|
-
var getActiveAccount = function getActiveAccount() {
|
|
2379
|
-
var instance = getMSALInstance();
|
|
2380
|
-
if (!instance) {
|
|
2381
|
-
return null;
|
|
2382
|
-
}
|
|
2383
|
-
return instance.getActiveAccount();
|
|
2384
|
-
};
|
|
2385
|
-
|
|
2386
|
-
var MSALRedirectHandler = function MSALRedirectHandler() {
|
|
2387
|
-
useLayoutEffect(function () {
|
|
2388
|
-
var handleRedirect = function handleRedirect() {
|
|
2389
|
-
try {
|
|
2390
|
-
var alreadyProcessed = localStorage.getItem('MSAL_LOGIN_PENDING');
|
|
2391
|
-
if (alreadyProcessed === 'true') {
|
|
2392
|
-
return Promise.resolve();
|
|
2393
|
-
}
|
|
2394
|
-
if (!isMSALRedirect()) {
|
|
2395
|
-
return Promise.resolve();
|
|
2396
|
-
}
|
|
2397
|
-
var _temp = _catch(function () {
|
|
2398
|
-
return Promise.resolve(handleMSALRedirect()).then(function (response) {
|
|
2399
|
-
if (response && response.account) {
|
|
2400
|
-
if (window.history.replaceState) {
|
|
2401
|
-
window.history.replaceState(null, '', window.location.pathname + window.location.search);
|
|
2402
|
-
}
|
|
2403
|
-
localStorage.setItem('MSAL_ACCOUNT', JSON.stringify(response.account));
|
|
2404
|
-
localStorage.setItem('MSAL_ACCESS_TOKEN', response.accessToken || '');
|
|
2405
|
-
localStorage.setItem('MSAL_LOGIN_PENDING', 'true');
|
|
2406
|
-
window.dispatchEvent(new CustomEvent('msal-login-success', {
|
|
2407
|
-
detail: {
|
|
2408
|
-
account: response.account,
|
|
2409
|
-
accessToken: response.accessToken,
|
|
2410
|
-
idToken: response.idToken
|
|
2411
|
-
}
|
|
2412
|
-
}));
|
|
2413
|
-
if (window.location.pathname.includes('/login')) {
|
|
2414
|
-
window.location.reload();
|
|
2415
|
-
} else {
|
|
2416
|
-
window.location.href = '/dashboard';
|
|
2417
|
-
}
|
|
2418
|
-
} else {
|
|
2419
|
-
var hashParams = new URLSearchParams(window.location.hash.substring(1));
|
|
2420
|
-
var error = hashParams.get('error');
|
|
2421
|
-
var errorDescription = hashParams.get('error_description');
|
|
2422
|
-
if (error) {
|
|
2423
|
-
console.error('[MSAL] Authentication error:', error, errorDescription);
|
|
2424
|
-
}
|
|
2425
|
-
if (window.history.replaceState) {
|
|
2426
|
-
window.history.replaceState(null, '', window.location.pathname + window.location.search);
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
});
|
|
2430
|
-
}, function (error) {
|
|
2431
|
-
console.error('[MSAL] Redirect handling error:', error);
|
|
2432
|
-
if (window.history.replaceState) {
|
|
2433
|
-
window.history.replaceState(null, '', window.location.pathname + window.location.search);
|
|
2434
|
-
}
|
|
2435
|
-
});
|
|
2436
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
2437
|
-
} catch (e) {
|
|
2438
|
-
return Promise.reject(e);
|
|
2439
|
-
}
|
|
2440
|
-
};
|
|
2441
|
-
handleRedirect();
|
|
2442
|
-
}, []);
|
|
2443
|
-
return null;
|
|
2444
|
-
};
|
|
2445
|
-
|
|
2446
1601
|
var CookieService = /*#__PURE__*/function () {
|
|
2447
1602
|
function CookieService() {}
|
|
2448
1603
|
CookieService.setAuthCookie = function setAuthCookie(data) {
|
|
@@ -2596,6 +1751,56 @@ var TypeLogin;
|
|
|
2596
1751
|
TypeLogin[TypeLogin["Microsoft"] = 3] = "Microsoft";
|
|
2597
1752
|
})(TypeLogin || (TypeLogin = {}));
|
|
2598
1753
|
|
|
1754
|
+
var AuthenticationMessage;
|
|
1755
|
+
(function (AuthenticationMessage) {
|
|
1756
|
+
AuthenticationMessage["NotAllowedToRegister"] = "NotAllowedToRegister";
|
|
1757
|
+
AuthenticationMessage["InvalidGoogleToken"] = "InvalidGoogleToken";
|
|
1758
|
+
})(AuthenticationMessage || (AuthenticationMessage = {}));
|
|
1759
|
+
var Role;
|
|
1760
|
+
(function (Role) {
|
|
1761
|
+
Role["Student"] = "Student";
|
|
1762
|
+
Role["Teacher"] = "Teacher";
|
|
1763
|
+
Role["Admin"] = "Admin";
|
|
1764
|
+
})(Role || (Role = {}));
|
|
1765
|
+
var msalConfig = function msalConfig(clientId, redirectUri) {
|
|
1766
|
+
return {
|
|
1767
|
+
auth: {
|
|
1768
|
+
clientId: clientId,
|
|
1769
|
+
authority: "https://login.microsoftonline.com/common",
|
|
1770
|
+
redirectUri: redirectUri
|
|
1771
|
+
},
|
|
1772
|
+
cache: {
|
|
1773
|
+
cacheLocation: "sessionStorage",
|
|
1774
|
+
storeAuthStateInCookie: false
|
|
1775
|
+
},
|
|
1776
|
+
system: {
|
|
1777
|
+
loggerOptions: {
|
|
1778
|
+
loggerCallback: function loggerCallback(level, message, containsPii) {
|
|
1779
|
+
if (containsPii) {
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
switch (level) {
|
|
1783
|
+
case LogLevel.Error:
|
|
1784
|
+
console.error(message);
|
|
1785
|
+
return;
|
|
1786
|
+
case LogLevel.Info:
|
|
1787
|
+
console.info(message);
|
|
1788
|
+
return;
|
|
1789
|
+
case LogLevel.Verbose:
|
|
1790
|
+
console.debug(message);
|
|
1791
|
+
return;
|
|
1792
|
+
case LogLevel.Warning:
|
|
1793
|
+
console.warn(message);
|
|
1794
|
+
return;
|
|
1795
|
+
default:
|
|
1796
|
+
return;
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
};
|
|
1802
|
+
};
|
|
1803
|
+
|
|
2599
1804
|
var BlockLogin = function BlockLogin(_ref) {
|
|
2600
1805
|
var onNavigate = _ref.onNavigate,
|
|
2601
1806
|
role = _ref.role,
|
|
@@ -2642,171 +1847,11 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
2642
1847
|
return Promise.reject(e);
|
|
2643
1848
|
}
|
|
2644
1849
|
};
|
|
2645
|
-
var isProcessingLogin = React.useRef(false);
|
|
2646
|
-
var processMSALLogin = function processMSALLogin(account, accessToken) {
|
|
2647
|
-
try {
|
|
2648
|
-
var _exit = false;
|
|
2649
|
-
if (isProcessingLogin.current) {
|
|
2650
|
-
return Promise.resolve();
|
|
2651
|
-
}
|
|
2652
|
-
isProcessingLogin.current = true;
|
|
2653
|
-
return Promise.resolve(_catch(function () {
|
|
2654
|
-
function _temp3(_result) {
|
|
2655
|
-
var _authResult$data;
|
|
2656
|
-
if (_exit) return _result;
|
|
2657
|
-
if (!authResult || !authResult.data || ((_authResult$data = authResult.data) === null || _authResult$data === void 0 ? void 0 : _authResult$data.id) == null) {
|
|
2658
|
-
dispatch(setLoading(false));
|
|
2659
|
-
isProcessingLogin.current = false;
|
|
2660
|
-
alert("Please contact admin.");
|
|
2661
|
-
return;
|
|
2662
|
-
}
|
|
2663
|
-
var msalCacheKeys = Object.keys(localStorage).filter(function (key) {
|
|
2664
|
-
return key.startsWith('msal.');
|
|
2665
|
-
});
|
|
2666
|
-
var msalCache = {};
|
|
2667
|
-
msalCacheKeys.forEach(function (key) {
|
|
2668
|
-
msalCache[key] = localStorage.getItem(key) || '';
|
|
2669
|
-
});
|
|
2670
|
-
localStorage.clear();
|
|
2671
|
-
Object.keys(msalCache).forEach(function (key) {
|
|
2672
|
-
localStorage.setItem(key, msalCache[key]);
|
|
2673
|
-
});
|
|
2674
|
-
var tokenJWT = authResult.data.token;
|
|
2675
|
-
isProcessingLogin.current = false;
|
|
2676
|
-
trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
|
|
2677
|
-
eventName: AmplitudeEvent.LOGIN,
|
|
2678
|
-
eventProperties: {
|
|
2679
|
-
email: (account === null || account === void 0 ? void 0 : account.username) || email,
|
|
2680
|
-
login_method: 'microsoft',
|
|
2681
|
-
user_role: authResult.data.role,
|
|
2682
|
-
success: true,
|
|
2683
|
-
timestamp: new Date().toISOString()
|
|
2684
|
-
}
|
|
2685
|
-
});
|
|
2686
|
-
if (role === "LandingPage") {
|
|
2687
|
-
CookieService.setAuthCookie({
|
|
2688
|
-
token: tokenJWT,
|
|
2689
|
-
expiresAt: Date.now() + 24 * 60 * 60 * 1000
|
|
2690
|
-
});
|
|
2691
|
-
var getRedirectUrl = function getRedirectUrl(role) {
|
|
2692
|
-
switch (role) {
|
|
2693
|
-
case "Admin":
|
|
2694
|
-
return ADMIN_ORIGIN;
|
|
2695
|
-
case "Teacher":
|
|
2696
|
-
return TEACHER_ORIGIN;
|
|
2697
|
-
default:
|
|
2698
|
-
return role + "." + REQUEST_ORIGIN;
|
|
2699
|
-
}
|
|
2700
|
-
};
|
|
2701
|
-
var redirectUrl = getRedirectUrl(authResult.data.role);
|
|
2702
|
-
window.location.href = redirectUrl + "/dashboard";
|
|
2703
|
-
dispatch(setLoading(false));
|
|
2704
|
-
} else {
|
|
2705
|
-
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
2706
|
-
onNavigate("/dashboard");
|
|
2707
|
-
dispatch(setLoading(false));
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
dispatch(setLoading(true));
|
|
2711
|
-
var fullName = (account === null || account === void 0 ? void 0 : account.name) || "";
|
|
2712
|
-
var infoLogin = {
|
|
2713
|
-
firstName: fullName.split(' ').slice(0, -1).join(' '),
|
|
2714
|
-
lastName: fullName.split(' ').slice(-1).join(' '),
|
|
2715
|
-
fullName: fullName,
|
|
2716
|
-
imageUrl: "",
|
|
2717
|
-
email: (account === null || account === void 0 ? void 0 : account.username) || "",
|
|
2718
|
-
token: accessToken || "",
|
|
2719
|
-
googleId: (account === null || account === void 0 ? void 0 : account.homeAccountId) || "",
|
|
2720
|
-
role: role,
|
|
2721
|
-
type: TypeLogin.Microsoft
|
|
2722
|
-
};
|
|
2723
|
-
var authResult;
|
|
2724
|
-
var _temp2 = _catch(function () {
|
|
2725
|
-
return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (_apiLoginGoogle) {
|
|
2726
|
-
authResult = _apiLoginGoogle;
|
|
2727
|
-
});
|
|
2728
|
-
}, function () {
|
|
2729
|
-
dispatch(setLoading(false));
|
|
2730
|
-
isProcessingLogin.current = false;
|
|
2731
|
-
_exit = true;
|
|
2732
|
-
});
|
|
2733
|
-
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
2734
|
-
}, function () {
|
|
2735
|
-
isProcessingLogin.current = false;
|
|
2736
|
-
dispatch(setLoading(false));
|
|
2737
|
-
alert("An error occurred while processing your login. Please try again.");
|
|
2738
|
-
}));
|
|
2739
|
-
} catch (e) {
|
|
2740
|
-
return Promise.reject(e);
|
|
2741
|
-
}
|
|
2742
|
-
};
|
|
2743
1850
|
useEffect(function () {
|
|
2744
1851
|
if (role === "Teacher" || role === "LandingPage") {
|
|
2745
1852
|
handleGetImage();
|
|
2746
1853
|
}
|
|
2747
1854
|
}, []);
|
|
2748
|
-
useEffect(function () {
|
|
2749
|
-
var handleMSALLoginSuccess = function handleMSALLoginSuccess(event) {
|
|
2750
|
-
try {
|
|
2751
|
-
var _event$detail = event.detail,
|
|
2752
|
-
account = _event$detail.account,
|
|
2753
|
-
_accessToken = _event$detail.accessToken;
|
|
2754
|
-
var _temp4 = function () {
|
|
2755
|
-
if (account && _accessToken) {
|
|
2756
|
-
localStorage.removeItem('MSAL_LOGIN_PENDING');
|
|
2757
|
-
localStorage.removeItem('MSAL_ACCOUNT');
|
|
2758
|
-
localStorage.removeItem('MSAL_ACCESS_TOKEN');
|
|
2759
|
-
sessionStorage.removeItem('MSAL_LOGIN_PENDING');
|
|
2760
|
-
sessionStorage.removeItem('MSAL_ACCOUNT');
|
|
2761
|
-
sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
|
|
2762
|
-
return Promise.resolve(processMSALLogin(account, _accessToken)).then(function () {});
|
|
2763
|
-
}
|
|
2764
|
-
}();
|
|
2765
|
-
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
|
|
2766
|
-
} catch (e) {
|
|
2767
|
-
return Promise.reject(e);
|
|
2768
|
-
}
|
|
2769
|
-
};
|
|
2770
|
-
window.addEventListener('msal-login-success', handleMSALLoginSuccess);
|
|
2771
|
-
var pendingLogin = localStorage.getItem('MSAL_LOGIN_PENDING');
|
|
2772
|
-
var accountStr = localStorage.getItem('MSAL_ACCOUNT');
|
|
2773
|
-
var accessToken = localStorage.getItem('MSAL_ACCESS_TOKEN');
|
|
2774
|
-
if (!pendingLogin || pendingLogin !== 'true') {
|
|
2775
|
-
pendingLogin = sessionStorage.getItem('MSAL_LOGIN_PENDING');
|
|
2776
|
-
accountStr = sessionStorage.getItem('MSAL_ACCOUNT');
|
|
2777
|
-
accessToken = sessionStorage.getItem('MSAL_ACCESS_TOKEN');
|
|
2778
|
-
if (pendingLogin === 'true' && accountStr && accessToken) {
|
|
2779
|
-
localStorage.setItem('MSAL_ACCOUNT', accountStr);
|
|
2780
|
-
localStorage.setItem('MSAL_ACCESS_TOKEN', accessToken);
|
|
2781
|
-
localStorage.setItem('MSAL_LOGIN_PENDING', pendingLogin);
|
|
2782
|
-
}
|
|
2783
|
-
}
|
|
2784
|
-
if (pendingLogin === 'true') {
|
|
2785
|
-
if (accountStr && accessToken) {
|
|
2786
|
-
try {
|
|
2787
|
-
var account = JSON.parse(accountStr);
|
|
2788
|
-
localStorage.removeItem('MSAL_LOGIN_PENDING');
|
|
2789
|
-
localStorage.removeItem('MSAL_ACCOUNT');
|
|
2790
|
-
localStorage.removeItem('MSAL_ACCESS_TOKEN');
|
|
2791
|
-
sessionStorage.removeItem('MSAL_LOGIN_PENDING');
|
|
2792
|
-
sessionStorage.removeItem('MSAL_ACCOUNT');
|
|
2793
|
-
sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
|
|
2794
|
-
processMSALLogin(account, accessToken);
|
|
2795
|
-
} catch (error) {
|
|
2796
|
-
console.error('[MSAL] Error parsing stored account:', error);
|
|
2797
|
-
localStorage.removeItem('MSAL_LOGIN_PENDING');
|
|
2798
|
-
localStorage.removeItem('MSAL_ACCOUNT');
|
|
2799
|
-
localStorage.removeItem('MSAL_ACCESS_TOKEN');
|
|
2800
|
-
sessionStorage.removeItem('MSAL_LOGIN_PENDING');
|
|
2801
|
-
sessionStorage.removeItem('MSAL_ACCOUNT');
|
|
2802
|
-
sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
}
|
|
2806
|
-
return function () {
|
|
2807
|
-
window.removeEventListener('msal-login-success', handleMSALLoginSuccess);
|
|
2808
|
-
};
|
|
2809
|
-
}, []);
|
|
2810
1855
|
var googleLogin = useGoogleLogin({
|
|
2811
1856
|
onSuccess: function (tokenResponse) {
|
|
2812
1857
|
try {
|
|
@@ -2838,8 +1883,8 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
2838
1883
|
};
|
|
2839
1884
|
dispatch(setLoading(true));
|
|
2840
1885
|
return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
|
|
2841
|
-
var _authResult$
|
|
2842
|
-
if (((_authResult$
|
|
1886
|
+
var _authResult$data;
|
|
1887
|
+
if (((_authResult$data = authResult.data) === null || _authResult$data === void 0 ? void 0 : _authResult$data.id) == null) {
|
|
2843
1888
|
dispatch(setLoading(false));
|
|
2844
1889
|
alert("Please contact admin.");
|
|
2845
1890
|
return;
|
|
@@ -2892,64 +1937,84 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
2892
1937
|
});
|
|
2893
1938
|
var fnLoginMicrosoft = function fnLoginMicrosoft() {
|
|
2894
1939
|
try {
|
|
1940
|
+
var msalInstance = new PublicClientApplication(msalConfig(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT));
|
|
1941
|
+
if (!msalInstance) {
|
|
1942
|
+
console.error("MSAL instance not initialized");
|
|
1943
|
+
return Promise.resolve();
|
|
1944
|
+
}
|
|
2895
1945
|
return Promise.resolve(_catch(function () {
|
|
2896
|
-
|
|
2897
|
-
if (!msalInstance) {
|
|
2898
|
-
alert("Microsoft login is not configured. Please contact admin.");
|
|
2899
|
-
return;
|
|
2900
|
-
}
|
|
2901
|
-
return Promise.resolve(initializeMSAL(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT)).then(function (initializedInstance) {
|
|
2902
|
-
var _exit2 = false;
|
|
2903
|
-
function _temp6(_result5) {
|
|
2904
|
-
return _exit2 ? _result5 : Promise.resolve(initializedInstance.loginRedirect(loginRequest)).then(function () {});
|
|
2905
|
-
}
|
|
2906
|
-
if (!initializedInstance) {
|
|
2907
|
-
alert("Failed to initialize Microsoft login. Please try again.");
|
|
2908
|
-
return;
|
|
2909
|
-
}
|
|
1946
|
+
return Promise.resolve(msalInstance.initialize()).then(function () {
|
|
2910
1947
|
var loginRequest = {
|
|
2911
|
-
scopes: ["openid", "profile", "
|
|
2912
|
-
prompt: "select_account"
|
|
1948
|
+
scopes: ["openid", "profile", "email"]
|
|
2913
1949
|
};
|
|
2914
|
-
var
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
1950
|
+
var silentRequest = _extends({}, loginRequest, {
|
|
1951
|
+
prompt: "select_account"
|
|
1952
|
+
});
|
|
1953
|
+
return Promise.resolve(msalInstance.loginPopup(silentRequest)).then(function (response) {
|
|
1954
|
+
return function () {
|
|
1955
|
+
if (response && response.account) {
|
|
1956
|
+
var account = response.account;
|
|
1957
|
+
var fullName = (account === null || account === void 0 ? void 0 : account.name) || "";
|
|
1958
|
+
var infoLogin = {
|
|
1959
|
+
firstName: fullName.split(' ').slice(0, -1).join(' '),
|
|
1960
|
+
lastName: fullName.split(' ').slice(-1).join(' '),
|
|
1961
|
+
fullName: fullName,
|
|
1962
|
+
imageUrl: "",
|
|
1963
|
+
email: (account === null || account === void 0 ? void 0 : account.username) || "",
|
|
1964
|
+
token: (response === null || response === void 0 ? void 0 : response.accessToken) || "",
|
|
1965
|
+
googleId: (account === null || account === void 0 ? void 0 : account.homeAccountId) || "",
|
|
1966
|
+
role: role,
|
|
1967
|
+
type: TypeLogin.Microsoft
|
|
1968
|
+
};
|
|
1969
|
+
dispatch(setLoading(true));
|
|
1970
|
+
return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
|
|
1971
|
+
var _authResult$data2;
|
|
1972
|
+
if (((_authResult$data2 = authResult.data) === null || _authResult$data2 === void 0 ? void 0 : _authResult$data2.id) == null) {
|
|
1973
|
+
dispatch(setLoading(false));
|
|
1974
|
+
alert("Please contact admin.");
|
|
1975
|
+
return;
|
|
1976
|
+
}
|
|
1977
|
+
localStorage.clear();
|
|
1978
|
+
var tokenJWT = authResult.data.token;
|
|
1979
|
+
trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
|
|
1980
|
+
eventName: AmplitudeEvent.LOGIN,
|
|
1981
|
+
eventProperties: {
|
|
1982
|
+
email: email,
|
|
1983
|
+
login_method: 'google',
|
|
1984
|
+
user_role: authResult.data.role,
|
|
1985
|
+
success: true,
|
|
1986
|
+
timestamp: new Date().toISOString()
|
|
2929
1987
|
}
|
|
2930
|
-
})
|
|
2931
|
-
|
|
2932
|
-
|
|
1988
|
+
});
|
|
1989
|
+
if (role === "LandingPage") {
|
|
1990
|
+
CookieService.setAuthCookie({
|
|
1991
|
+
token: tokenJWT,
|
|
1992
|
+
expiresAt: Date.now() + 24 * 60 * 60 * 1000
|
|
1993
|
+
});
|
|
1994
|
+
var getRedirectUrl = function getRedirectUrl(role) {
|
|
1995
|
+
switch (role) {
|
|
1996
|
+
case "Admin":
|
|
1997
|
+
return ADMIN_ORIGIN;
|
|
1998
|
+
case "Teacher":
|
|
1999
|
+
return TEACHER_ORIGIN;
|
|
2000
|
+
default:
|
|
2001
|
+
return role + "." + REQUEST_ORIGIN;
|
|
2002
|
+
}
|
|
2003
|
+
};
|
|
2004
|
+
var redirectUrl = getRedirectUrl(authResult.data.role);
|
|
2005
|
+
window.location.href = redirectUrl + "/dashboard";
|
|
2006
|
+
dispatch(setLoading(false));
|
|
2007
|
+
}
|
|
2008
|
+
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
2009
|
+
onNavigate("/dashboard");
|
|
2010
|
+
dispatch(setLoading(false));
|
|
2011
|
+
});
|
|
2933
2012
|
}
|
|
2934
|
-
});
|
|
2935
|
-
}
|
|
2936
|
-
return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
|
|
2013
|
+
}();
|
|
2014
|
+
});
|
|
2937
2015
|
});
|
|
2938
2016
|
}, function (error) {
|
|
2939
|
-
|
|
2940
|
-
var errorObj = error;
|
|
2941
|
-
if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'popup_window_error' || errorObj !== null && errorObj !== void 0 && (_errorObj$message = errorObj.message) !== null && _errorObj$message !== void 0 && _errorObj$message.includes('popup')) {
|
|
2942
|
-
alert("Popup was blocked. Please allow popups for this site and try again.");
|
|
2943
|
-
return;
|
|
2944
|
-
}
|
|
2945
|
-
if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'interaction_in_progress') {
|
|
2946
|
-
return;
|
|
2947
|
-
}
|
|
2948
|
-
if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'invalid_request' || errorObj !== null && errorObj !== void 0 && (_errorObj$message2 = errorObj.message) !== null && _errorObj$message2 !== void 0 && _errorObj$message2.includes('redirect_uri')) {
|
|
2949
|
-
alert("Configuration error: Redirect URI mismatch. Please contact admin.");
|
|
2950
|
-
return;
|
|
2951
|
-
}
|
|
2952
|
-
alert("An error occurred during Microsoft login: " + ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.message) || (errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) || 'Unknown error') + ". Please try again.");
|
|
2017
|
+
console.error("Microsoft login error:", error);
|
|
2953
2018
|
}));
|
|
2954
2019
|
} catch (e) {
|
|
2955
2020
|
return Promise.reject(e);
|
|
@@ -3563,7 +2628,7 @@ function kindOf(val) {
|
|
|
3563
2628
|
}
|
|
3564
2629
|
|
|
3565
2630
|
// src/utils/warning.ts
|
|
3566
|
-
function warning
|
|
2631
|
+
function warning(message) {
|
|
3567
2632
|
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
3568
2633
|
console.error(message);
|
|
3569
2634
|
}
|
|
@@ -3616,7 +2681,7 @@ function combineReducers(reducers) {
|
|
|
3616
2681
|
const key = reducerKeys[i];
|
|
3617
2682
|
if (process.env.NODE_ENV !== "production") {
|
|
3618
2683
|
if (typeof reducers[key] === "undefined") {
|
|
3619
|
-
warning
|
|
2684
|
+
warning(`No reducer provided for key "${key}"`);
|
|
3620
2685
|
}
|
|
3621
2686
|
}
|
|
3622
2687
|
if (typeof reducers[key] === "function") {
|
|
@@ -3641,7 +2706,7 @@ function combineReducers(reducers) {
|
|
|
3641
2706
|
if (process.env.NODE_ENV !== "production") {
|
|
3642
2707
|
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
3643
2708
|
if (warningMessage) {
|
|
3644
|
-
warning
|
|
2709
|
+
warning(warningMessage);
|
|
3645
2710
|
}
|
|
3646
2711
|
}
|
|
3647
2712
|
let hasChanged = false;
|
|
@@ -4010,7 +3075,7 @@ var useAmplitude = function useAmplitude() {
|
|
|
4010
3075
|
var savedUserProperties = useRef({});
|
|
4011
3076
|
var hasTrackedInitialSession = useRef(false);
|
|
4012
3077
|
var setUserProperties = useCallback(function (properties) {
|
|
4013
|
-
savedUserProperties.current = _extends
|
|
3078
|
+
savedUserProperties.current = _extends({}, savedUserProperties.current, properties);
|
|
4014
3079
|
var identify$1 = new Identify();
|
|
4015
3080
|
Object.entries(properties).forEach(function (_ref) {
|
|
4016
3081
|
var key = _ref[0],
|
|
@@ -4022,7 +3087,7 @@ var useAmplitude = function useAmplitude() {
|
|
|
4022
3087
|
var trackEvent = useCallback(function (_ref2) {
|
|
4023
3088
|
var eventName = _ref2.eventName,
|
|
4024
3089
|
eventProperties = _ref2.eventProperties;
|
|
4025
|
-
track(eventName, _extends
|
|
3090
|
+
track(eventName, _extends({}, savedUserProperties.current, eventProperties, {
|
|
4026
3091
|
timestamp: new Date().toISOString()
|
|
4027
3092
|
}));
|
|
4028
3093
|
}, []);
|
|
@@ -4209,7 +3274,7 @@ var getErrorMessage = function getErrorMessage(error, defaultErrorMessage) {
|
|
|
4209
3274
|
|
|
4210
3275
|
var customStyles = {
|
|
4211
3276
|
control: function control(baseStyles, state) {
|
|
4212
|
-
return _extends
|
|
3277
|
+
return _extends({}, baseStyles, {
|
|
4213
3278
|
fontSize: "14px",
|
|
4214
3279
|
fontWeight: 700,
|
|
4215
3280
|
color: styleGlobal.darker,
|
|
@@ -4224,21 +3289,21 @@ var customStyles = {
|
|
|
4224
3289
|
});
|
|
4225
3290
|
},
|
|
4226
3291
|
input: function input(baseStyles, _) {
|
|
4227
|
-
return _extends
|
|
3292
|
+
return _extends({}, baseStyles, {
|
|
4228
3293
|
fontSize: "14px",
|
|
4229
3294
|
fontWeight: 700,
|
|
4230
3295
|
color: styleGlobal.darker
|
|
4231
3296
|
});
|
|
4232
3297
|
},
|
|
4233
3298
|
singleValue: function singleValue(baseStyles) {
|
|
4234
|
-
return _extends
|
|
3299
|
+
return _extends({}, baseStyles, {
|
|
4235
3300
|
fontSize: "14px",
|
|
4236
3301
|
fontWeight: 700,
|
|
4237
3302
|
color: styleGlobal.darker
|
|
4238
3303
|
});
|
|
4239
3304
|
},
|
|
4240
3305
|
option: function option(baseStyles, state) {
|
|
4241
|
-
return _extends
|
|
3306
|
+
return _extends({}, baseStyles, {
|
|
4242
3307
|
backgroundColor: state.isSelected ? styleGlobal.dark : state.isFocused ? styleGlobal.light : 'white',
|
|
4243
3308
|
"&:active": {
|
|
4244
3309
|
backgroundColor: state.isSelected ? styleGlobal.dark : state.isFocused ? styleGlobal.less_dark : baseStyles.backgroundColor
|
|
@@ -4406,7 +3471,17 @@ var utcToLocalTime = (function (time, FORMAT) {
|
|
|
4406
3471
|
}
|
|
4407
3472
|
});
|
|
4408
3473
|
|
|
3474
|
+
var timeSpanToLocalMoment = (function (time) {
|
|
3475
|
+
if (!time) return null;
|
|
3476
|
+
var times = time.split(":");
|
|
3477
|
+
if (times.length !== 3) return null;
|
|
3478
|
+
var totalSeconds = +times[0] * 60 * 60 + +times[1] * 60 + +times[2];
|
|
3479
|
+
var startOfDay = moment.utc().startOf("day");
|
|
3480
|
+
var dateTime = startOfDay.add(totalSeconds, "seconds");
|
|
3481
|
+
return dateTime.local();
|
|
3482
|
+
});
|
|
3483
|
+
|
|
4409
3484
|
var historyCore = createBrowserHistory();
|
|
4410
3485
|
|
|
4411
|
-
export { ACCESS_TOKEN, AmplitudeEvent, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreInputCompact, CoreModal, CoreRadio, CoreRange, CoreSearch, CoreSelect, CoreSelectCompact, CoreTextArea, CoreTitleInput, CoreTooltip, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_TIME_MIN_VALUE, LayoutContext, Loading, Login,
|
|
3486
|
+
export { ACCESS_TOKEN, AmplitudeEvent, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreInputCompact, CoreModal, CoreRadio, CoreRange, CoreSearch, CoreSelect, CoreSelectCompact, CoreTextArea, CoreTitleInput, CoreTooltip, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_TIME_MIN_VALUE, LayoutContext, Loading, Login, MarkdownRenderer as MarkdownLatexRender, NotFound, OPENSALT_BASE_URL, ORGANIZATION_TEAM, ORGANIZATION_TENANT, Role, api, apiUpload, firstCheckToken, getAccessToken, getErrorMessage, getImageUrl, historyCore, initSentry, initializeAmplitude, setAddTenant, setAlert, setIsRefetchSidebar, setLoading, setLoadingPage, setMenuCollapse, setTeam, setTenant, setUser, store, timeSpanToLocalMoment, useAmplitude, useGoogleSignOut, utcToLocalTime };
|
|
4412
3487
|
//# sourceMappingURL=index.modern.js.map
|