acsi-core 0.1.0 → 0.1.2
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/.DS_Store +0 -0
- package/dist/components/CoreButton/index.d.ts +10 -0
- package/dist/components/CoreCheckbox/index.d.ts +10 -0
- package/dist/components/CoreError/index.d.ts +6 -0
- package/dist/components/CoreInput/index.d.ts +13 -0
- package/dist/components/CoreModal/index.d.ts +9 -0
- package/dist/components/CoreRadio/index.d.ts +14 -0
- package/dist/components/CoreSelect/index.d.ts +18 -0
- package/dist/components/Dialogs/CommonDialog.d.ts +3 -0
- package/dist/components/Paginations/CustomPagination.d.ts +8 -0
- package/dist/components/Selects/CustomAsyncSelect.d.ts +3 -0
- package/dist/components/Selects/CustomCreatable.d.ts +3 -0
- package/dist/components/Selects/CustomSelect.d.ts +3 -0
- package/dist/components/Selects/CustomSelectOption.d.ts +3 -0
- package/dist/components/Selects/partials/index.d.ts +4 -0
- package/dist/components/Selects/theme/styles.d.ts +6 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/configs/constants.d.ts +11 -0
- package/dist/containers/Login/configs/constants.d.ts +9 -0
- package/dist/containers/Login/configs/default.d.ts +1 -0
- package/dist/containers/Login/views/block/BlockLogin.d.ts +1 -5
- package/dist/icons8-google-96~UAyNiMJa.svg +1 -0
- package/dist/index.css +247 -34
- package/dist/index.d.ts +12 -2
- package/dist/index.js +848 -745
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +823 -748
- package/dist/index.modern.js.map +1 -1
- package/dist/layouts/LayoutContext.d.ts +1 -0
- package/dist/layouts/TheLanguageDropdown.d.ts +3 -0
- package/dist/redux/commons/action.d.ts +2 -0
- package/dist/services/accountService.d.ts +5 -0
- package/dist/utils/constants.d.ts +18 -5
- package/dist/utils/getErrorMessage.d.ts +1 -0
- package/dist/utils/hooks/index.d.ts +3 -0
- package/dist/utils/hooks/useGoogleSignOut.d.ts +10 -0
- package/dist/utils/hooks/useLanguage.d.ts +12 -0
- package/dist/utils/hooks/useLogin.d.ts +7 -0
- package/dist/utils/icons.d.ts +3 -0
- package/dist/utils/types/login.d.ts +33 -0
- package/dist/utils/types.d.ts +1 -0
- package/package.json +12 -4
package/dist/index.modern.js
CHANGED
|
@@ -1,610 +1,38 @@
|
|
|
1
|
+
import { createBrowserHistory } from 'history';
|
|
1
2
|
import { createAction, createReducer, configureStore } from '@reduxjs/toolkit';
|
|
2
|
-
import React, {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { Formik } from 'formik';
|
|
6
|
-
import { object, string, boolean } from 'yup';
|
|
7
|
-
import GoogleLogin from '@leecheuk/react-google-login';
|
|
3
|
+
import React, { useState, useCallback, useEffect, Fragment } from 'react';
|
|
4
|
+
import { Row, Col, Form, Modal, ModalHeader, ModalBody, ModalFooter, Button, Pagination, PaginationItem, PaginationLink, FormGroup, Input, Label } from 'reactstrap';
|
|
5
|
+
import GoogleLogin, { useGoogleLogout } from '@leecheuk/react-google-login';
|
|
8
6
|
import axios from 'axios';
|
|
9
7
|
import moment from 'moment';
|
|
10
|
-
import {
|
|
8
|
+
import { Link } from 'react-router-dom';
|
|
11
9
|
import { gapi } from 'gapi-script';
|
|
12
10
|
import { useSelector, useDispatch } from 'react-redux';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
19
|
-
}
|
|
20
|
-
return n;
|
|
21
|
-
}, _extends.apply(null, arguments);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function isAbsolute(pathname) {
|
|
25
|
-
return pathname.charAt(0) === '/';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// About 1.5x faster than the two-arg version of Array#splice()
|
|
29
|
-
function spliceOne(list, index) {
|
|
30
|
-
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
|
|
31
|
-
list[i] = list[k];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
list.pop();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// This implementation is based heavily on node's url.parse
|
|
38
|
-
function resolvePathname(to, from) {
|
|
39
|
-
if (from === undefined) from = '';
|
|
40
|
-
|
|
41
|
-
var toParts = (to && to.split('/')) || [];
|
|
42
|
-
var fromParts = (from && from.split('/')) || [];
|
|
43
|
-
|
|
44
|
-
var isToAbs = to && isAbsolute(to);
|
|
45
|
-
var isFromAbs = from && isAbsolute(from);
|
|
46
|
-
var mustEndAbs = isToAbs || isFromAbs;
|
|
47
|
-
|
|
48
|
-
if (to && isAbsolute(to)) {
|
|
49
|
-
// to is absolute
|
|
50
|
-
fromParts = toParts;
|
|
51
|
-
} else if (toParts.length) {
|
|
52
|
-
// to is relative, drop the filename
|
|
53
|
-
fromParts.pop();
|
|
54
|
-
fromParts = fromParts.concat(toParts);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (!fromParts.length) return '/';
|
|
58
|
-
|
|
59
|
-
var hasTrailingSlash;
|
|
60
|
-
if (fromParts.length) {
|
|
61
|
-
var last = fromParts[fromParts.length - 1];
|
|
62
|
-
hasTrailingSlash = last === '.' || last === '..' || last === '';
|
|
63
|
-
} else {
|
|
64
|
-
hasTrailingSlash = false;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
var up = 0;
|
|
68
|
-
for (var i = fromParts.length; i >= 0; i--) {
|
|
69
|
-
var part = fromParts[i];
|
|
70
|
-
|
|
71
|
-
if (part === '.') {
|
|
72
|
-
spliceOne(fromParts, i);
|
|
73
|
-
} else if (part === '..') {
|
|
74
|
-
spliceOne(fromParts, i);
|
|
75
|
-
up++;
|
|
76
|
-
} else if (up) {
|
|
77
|
-
spliceOne(fromParts, i);
|
|
78
|
-
up--;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (!mustEndAbs) for (; up--; up) fromParts.unshift('..');
|
|
83
|
-
|
|
84
|
-
if (
|
|
85
|
-
mustEndAbs &&
|
|
86
|
-
fromParts[0] !== '' &&
|
|
87
|
-
(!fromParts[0] || !isAbsolute(fromParts[0]))
|
|
88
|
-
)
|
|
89
|
-
fromParts.unshift('');
|
|
90
|
-
|
|
91
|
-
var result = fromParts.join('/');
|
|
92
|
-
|
|
93
|
-
if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
|
|
94
|
-
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
var isProduction = process.env.NODE_ENV === 'production';
|
|
99
|
-
function warning(condition, message) {
|
|
100
|
-
if (!isProduction) {
|
|
101
|
-
if (condition) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
var text = "Warning: " + message;
|
|
106
|
-
|
|
107
|
-
if (typeof console !== 'undefined') {
|
|
108
|
-
console.warn(text);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
throw Error(text);
|
|
113
|
-
} catch (x) {}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
var isProduction$1 = process.env.NODE_ENV === 'production';
|
|
118
|
-
var prefix = 'Invariant failed';
|
|
119
|
-
function invariant(condition, message) {
|
|
120
|
-
if (condition) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (isProduction$1) {
|
|
124
|
-
throw new Error(prefix);
|
|
125
|
-
}
|
|
126
|
-
var provided = typeof message === 'function' ? message() : message;
|
|
127
|
-
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
128
|
-
throw new Error(value);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function addLeadingSlash(path) {
|
|
132
|
-
return path.charAt(0) === '/' ? path : '/' + path;
|
|
133
|
-
}
|
|
134
|
-
function hasBasename(path, prefix) {
|
|
135
|
-
return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
|
|
136
|
-
}
|
|
137
|
-
function stripBasename(path, prefix) {
|
|
138
|
-
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
|
|
139
|
-
}
|
|
140
|
-
function stripTrailingSlash(path) {
|
|
141
|
-
return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
|
|
142
|
-
}
|
|
143
|
-
function parsePath(path) {
|
|
144
|
-
var pathname = path || '/';
|
|
145
|
-
var search = '';
|
|
146
|
-
var hash = '';
|
|
147
|
-
var hashIndex = pathname.indexOf('#');
|
|
148
|
-
|
|
149
|
-
if (hashIndex !== -1) {
|
|
150
|
-
hash = pathname.substr(hashIndex);
|
|
151
|
-
pathname = pathname.substr(0, hashIndex);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
var searchIndex = pathname.indexOf('?');
|
|
155
|
-
|
|
156
|
-
if (searchIndex !== -1) {
|
|
157
|
-
search = pathname.substr(searchIndex);
|
|
158
|
-
pathname = pathname.substr(0, searchIndex);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return {
|
|
162
|
-
pathname: pathname,
|
|
163
|
-
search: search === '?' ? '' : search,
|
|
164
|
-
hash: hash === '#' ? '' : hash
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function createPath(location) {
|
|
168
|
-
var pathname = location.pathname,
|
|
169
|
-
search = location.search,
|
|
170
|
-
hash = location.hash;
|
|
171
|
-
var path = pathname || '/';
|
|
172
|
-
if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
|
|
173
|
-
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
|
|
174
|
-
return path;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function createLocation(path, state, key, currentLocation) {
|
|
178
|
-
var location;
|
|
179
|
-
|
|
180
|
-
if (typeof path === 'string') {
|
|
181
|
-
// Two-arg form: push(path, state)
|
|
182
|
-
location = parsePath(path);
|
|
183
|
-
location.state = state;
|
|
184
|
-
} else {
|
|
185
|
-
// One-arg form: push(location)
|
|
186
|
-
location = _extends({}, path);
|
|
187
|
-
if (location.pathname === undefined) location.pathname = '';
|
|
188
|
-
|
|
189
|
-
if (location.search) {
|
|
190
|
-
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
|
|
191
|
-
} else {
|
|
192
|
-
location.search = '';
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (location.hash) {
|
|
196
|
-
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
|
|
197
|
-
} else {
|
|
198
|
-
location.hash = '';
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (state !== undefined && location.state === undefined) location.state = state;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
location.pathname = decodeURI(location.pathname);
|
|
206
|
-
} catch (e) {
|
|
207
|
-
if (e instanceof URIError) {
|
|
208
|
-
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
|
|
209
|
-
} else {
|
|
210
|
-
throw e;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (key) location.key = key;
|
|
215
|
-
|
|
216
|
-
if (currentLocation) {
|
|
217
|
-
// Resolve incomplete/relative pathname relative to current location.
|
|
218
|
-
if (!location.pathname) {
|
|
219
|
-
location.pathname = currentLocation.pathname;
|
|
220
|
-
} else if (location.pathname.charAt(0) !== '/') {
|
|
221
|
-
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
|
|
222
|
-
}
|
|
223
|
-
} else {
|
|
224
|
-
// When there is no prior location and pathname is empty, set it to /
|
|
225
|
-
if (!location.pathname) {
|
|
226
|
-
location.pathname = '/';
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
return location;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function createTransitionManager() {
|
|
234
|
-
var prompt = null;
|
|
235
|
-
|
|
236
|
-
function setPrompt(nextPrompt) {
|
|
237
|
-
process.env.NODE_ENV !== "production" ? warning(prompt == null, 'A history supports only one prompt at a time') : void 0;
|
|
238
|
-
prompt = nextPrompt;
|
|
239
|
-
return function () {
|
|
240
|
-
if (prompt === nextPrompt) prompt = null;
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function confirmTransitionTo(location, action, getUserConfirmation, callback) {
|
|
245
|
-
// TODO: If another transition starts while we're still confirming
|
|
246
|
-
// the previous one, we may end up in a weird state. Figure out the
|
|
247
|
-
// best way to handle this.
|
|
248
|
-
if (prompt != null) {
|
|
249
|
-
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
|
|
250
|
-
|
|
251
|
-
if (typeof result === 'string') {
|
|
252
|
-
if (typeof getUserConfirmation === 'function') {
|
|
253
|
-
getUserConfirmation(result, callback);
|
|
254
|
-
} else {
|
|
255
|
-
process.env.NODE_ENV !== "production" ? warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : void 0;
|
|
256
|
-
callback(true);
|
|
257
|
-
}
|
|
258
|
-
} else {
|
|
259
|
-
// Return false from a transition hook to cancel the transition.
|
|
260
|
-
callback(result !== false);
|
|
261
|
-
}
|
|
262
|
-
} else {
|
|
263
|
-
callback(true);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
var listeners = [];
|
|
268
|
-
|
|
269
|
-
function appendListener(fn) {
|
|
270
|
-
var isActive = true;
|
|
271
|
-
|
|
272
|
-
function listener() {
|
|
273
|
-
if (isActive) fn.apply(void 0, arguments);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
listeners.push(listener);
|
|
277
|
-
return function () {
|
|
278
|
-
isActive = false;
|
|
279
|
-
listeners = listeners.filter(function (item) {
|
|
280
|
-
return item !== listener;
|
|
281
|
-
});
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function notifyListeners() {
|
|
286
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
287
|
-
args[_key] = arguments[_key];
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
listeners.forEach(function (listener) {
|
|
291
|
-
return listener.apply(void 0, args);
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return {
|
|
296
|
-
setPrompt: setPrompt,
|
|
297
|
-
confirmTransitionTo: confirmTransitionTo,
|
|
298
|
-
appendListener: appendListener,
|
|
299
|
-
notifyListeners: notifyListeners
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
304
|
-
function getConfirmation(message, callback) {
|
|
305
|
-
callback(window.confirm(message)); // eslint-disable-line no-alert
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
|
|
309
|
-
*
|
|
310
|
-
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
|
|
311
|
-
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
|
|
312
|
-
* changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
|
|
313
|
-
*/
|
|
314
|
-
|
|
315
|
-
function supportsHistory() {
|
|
316
|
-
var ua = window.navigator.userAgent;
|
|
317
|
-
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;
|
|
318
|
-
return window.history && 'pushState' in window.history;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Returns true if browser fires popstate on hash change.
|
|
322
|
-
* IE10 and IE11 do not.
|
|
323
|
-
*/
|
|
324
|
-
|
|
325
|
-
function supportsPopStateOnHashChange() {
|
|
326
|
-
return window.navigator.userAgent.indexOf('Trident') === -1;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Returns true if a given popstate event is an extraneous WebKit event.
|
|
330
|
-
* Accounts for the fact that Chrome on iOS fires real popstate events
|
|
331
|
-
* containing undefined state when pressing the back button.
|
|
332
|
-
*/
|
|
333
|
-
|
|
334
|
-
function isExtraneousPopstateEvent(event) {
|
|
335
|
-
return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
var PopStateEvent = 'popstate';
|
|
339
|
-
var HashChangeEvent = 'hashchange';
|
|
340
|
-
|
|
341
|
-
function getHistoryState() {
|
|
342
|
-
try {
|
|
343
|
-
return window.history.state || {};
|
|
344
|
-
} catch (e) {
|
|
345
|
-
// IE 11 sometimes throws when accessing window.history.state
|
|
346
|
-
// See https://github.com/ReactTraining/history/pull/289
|
|
347
|
-
return {};
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Creates a history object that uses the HTML5 history API including
|
|
352
|
-
* pushState, replaceState, and the popstate event.
|
|
353
|
-
*/
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
function createBrowserHistory(props) {
|
|
357
|
-
if (props === void 0) {
|
|
358
|
-
props = {};
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
!canUseDOM ? process.env.NODE_ENV !== "production" ? invariant(false, 'Browser history needs a DOM') : invariant(false) : void 0;
|
|
362
|
-
var globalHistory = window.history;
|
|
363
|
-
var canUseHistory = supportsHistory();
|
|
364
|
-
var needsHashChangeListener = !supportsPopStateOnHashChange();
|
|
365
|
-
var _props = props,
|
|
366
|
-
_props$forceRefresh = _props.forceRefresh,
|
|
367
|
-
forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
|
|
368
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
|
369
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
|
370
|
-
_props$keyLength = _props.keyLength,
|
|
371
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
372
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
|
|
373
|
-
|
|
374
|
-
function getDOMLocation(historyState) {
|
|
375
|
-
var _ref = historyState || {},
|
|
376
|
-
key = _ref.key,
|
|
377
|
-
state = _ref.state;
|
|
378
|
-
|
|
379
|
-
var _window$location = window.location,
|
|
380
|
-
pathname = _window$location.pathname,
|
|
381
|
-
search = _window$location.search,
|
|
382
|
-
hash = _window$location.hash;
|
|
383
|
-
var path = pathname + search + hash;
|
|
384
|
-
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;
|
|
385
|
-
if (basename) path = stripBasename(path, basename);
|
|
386
|
-
return createLocation(path, state, key);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
function createKey() {
|
|
390
|
-
return Math.random().toString(36).substr(2, keyLength);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
var transitionManager = createTransitionManager();
|
|
394
|
-
|
|
395
|
-
function setState(nextState) {
|
|
396
|
-
_extends(history, nextState);
|
|
397
|
-
|
|
398
|
-
history.length = globalHistory.length;
|
|
399
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
function handlePopState(event) {
|
|
403
|
-
// Ignore extraneous popstate events in WebKit.
|
|
404
|
-
if (isExtraneousPopstateEvent(event)) return;
|
|
405
|
-
handlePop(getDOMLocation(event.state));
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
function handleHashChange() {
|
|
409
|
-
handlePop(getDOMLocation(getHistoryState()));
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
var forceNextPop = false;
|
|
413
|
-
|
|
414
|
-
function handlePop(location) {
|
|
415
|
-
if (forceNextPop) {
|
|
416
|
-
forceNextPop = false;
|
|
417
|
-
setState();
|
|
418
|
-
} else {
|
|
419
|
-
var action = 'POP';
|
|
420
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
421
|
-
if (ok) {
|
|
422
|
-
setState({
|
|
423
|
-
action: action,
|
|
424
|
-
location: location
|
|
425
|
-
});
|
|
426
|
-
} else {
|
|
427
|
-
revertPop(location);
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
function revertPop(fromLocation) {
|
|
434
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
|
435
|
-
// keeping a list of keys we've seen in sessionStorage.
|
|
436
|
-
// Instead, we just default to 0 for keys we don't know.
|
|
437
|
-
|
|
438
|
-
var toIndex = allKeys.indexOf(toLocation.key);
|
|
439
|
-
if (toIndex === -1) toIndex = 0;
|
|
440
|
-
var fromIndex = allKeys.indexOf(fromLocation.key);
|
|
441
|
-
if (fromIndex === -1) fromIndex = 0;
|
|
442
|
-
var delta = toIndex - fromIndex;
|
|
443
|
-
|
|
444
|
-
if (delta) {
|
|
445
|
-
forceNextPop = true;
|
|
446
|
-
go(delta);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
var initialLocation = getDOMLocation(getHistoryState());
|
|
451
|
-
var allKeys = [initialLocation.key]; // Public interface
|
|
452
|
-
|
|
453
|
-
function createHref(location) {
|
|
454
|
-
return basename + createPath(location);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
function push(path, state) {
|
|
458
|
-
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;
|
|
459
|
-
var action = 'PUSH';
|
|
460
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
461
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
462
|
-
if (!ok) return;
|
|
463
|
-
var href = createHref(location);
|
|
464
|
-
var key = location.key,
|
|
465
|
-
state = location.state;
|
|
466
|
-
|
|
467
|
-
if (canUseHistory) {
|
|
468
|
-
globalHistory.pushState({
|
|
469
|
-
key: key,
|
|
470
|
-
state: state
|
|
471
|
-
}, null, href);
|
|
472
|
-
|
|
473
|
-
if (forceRefresh) {
|
|
474
|
-
window.location.href = href;
|
|
475
|
-
} else {
|
|
476
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
477
|
-
var nextKeys = allKeys.slice(0, prevIndex + 1);
|
|
478
|
-
nextKeys.push(location.key);
|
|
479
|
-
allKeys = nextKeys;
|
|
480
|
-
setState({
|
|
481
|
-
action: action,
|
|
482
|
-
location: location
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
} else {
|
|
486
|
-
process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : void 0;
|
|
487
|
-
window.location.href = href;
|
|
488
|
-
}
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
function replace(path, state) {
|
|
493
|
-
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;
|
|
494
|
-
var action = 'REPLACE';
|
|
495
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
496
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
497
|
-
if (!ok) return;
|
|
498
|
-
var href = createHref(location);
|
|
499
|
-
var key = location.key,
|
|
500
|
-
state = location.state;
|
|
501
|
-
|
|
502
|
-
if (canUseHistory) {
|
|
503
|
-
globalHistory.replaceState({
|
|
504
|
-
key: key,
|
|
505
|
-
state: state
|
|
506
|
-
}, null, href);
|
|
507
|
-
|
|
508
|
-
if (forceRefresh) {
|
|
509
|
-
window.location.replace(href);
|
|
510
|
-
} else {
|
|
511
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
512
|
-
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
|
|
513
|
-
setState({
|
|
514
|
-
action: action,
|
|
515
|
-
location: location
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
} else {
|
|
519
|
-
process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : void 0;
|
|
520
|
-
window.location.replace(href);
|
|
521
|
-
}
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
function go(n) {
|
|
526
|
-
globalHistory.go(n);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
function goBack() {
|
|
530
|
-
go(-1);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
function goForward() {
|
|
534
|
-
go(1);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
var listenerCount = 0;
|
|
538
|
-
|
|
539
|
-
function checkDOMListeners(delta) {
|
|
540
|
-
listenerCount += delta;
|
|
541
|
-
|
|
542
|
-
if (listenerCount === 1 && delta === 1) {
|
|
543
|
-
window.addEventListener(PopStateEvent, handlePopState);
|
|
544
|
-
if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
|
|
545
|
-
} else if (listenerCount === 0) {
|
|
546
|
-
window.removeEventListener(PopStateEvent, handlePopState);
|
|
547
|
-
if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
var isBlocked = false;
|
|
552
|
-
|
|
553
|
-
function block(prompt) {
|
|
554
|
-
if (prompt === void 0) {
|
|
555
|
-
prompt = false;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
var unblock = transitionManager.setPrompt(prompt);
|
|
559
|
-
|
|
560
|
-
if (!isBlocked) {
|
|
561
|
-
checkDOMListeners(1);
|
|
562
|
-
isBlocked = true;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
return function () {
|
|
566
|
-
if (isBlocked) {
|
|
567
|
-
isBlocked = false;
|
|
568
|
-
checkDOMListeners(-1);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
return unblock();
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
function listen(listener) {
|
|
576
|
-
var unlisten = transitionManager.appendListener(listener);
|
|
577
|
-
checkDOMListeners(1);
|
|
578
|
-
return function () {
|
|
579
|
-
checkDOMListeners(-1);
|
|
580
|
-
unlisten();
|
|
581
|
-
};
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
var history = {
|
|
585
|
-
length: globalHistory.length,
|
|
586
|
-
action: 'POP',
|
|
587
|
-
location: initialLocation,
|
|
588
|
-
createHref: createHref,
|
|
589
|
-
push: push,
|
|
590
|
-
replace: replace,
|
|
591
|
-
go: go,
|
|
592
|
-
goBack: goBack,
|
|
593
|
-
goForward: goForward,
|
|
594
|
-
block: block,
|
|
595
|
-
listen: listen
|
|
596
|
-
};
|
|
597
|
-
return history;
|
|
598
|
-
}
|
|
11
|
+
import { Box, Typography } from '@mui/material';
|
|
12
|
+
export { ToastContainer, toast } from 'react-toastify';
|
|
13
|
+
import Select, { components } from 'react-select';
|
|
14
|
+
import { FaCaretDown } from 'react-icons/fa';
|
|
15
|
+
import CreatableSelect from 'react-select/creatable';
|
|
599
16
|
|
|
600
17
|
var setLoading = createAction("common/setLoading");
|
|
601
18
|
var setAlert = createAction("common/setAlert");
|
|
602
19
|
var setUser = createAction("common/setUser");
|
|
603
|
-
|
|
604
|
-
var
|
|
605
|
-
|
|
20
|
+
var setLanguage = createAction("common/setLanguage");
|
|
21
|
+
var reset = createAction("common/reset");
|
|
22
|
+
|
|
23
|
+
var GOOGLE_RECAPTCHA_KEY = process.env.REACT_APP_GOOGLE_RECAPTCHA_KEY || "";
|
|
24
|
+
var GOOGLE_CLIENT_ID = process.env.REACT_APP_GOOGLE_CLIENT_ID || "";
|
|
25
|
+
var GOOGLE_RECAPTCHA_ID = process.env.REACT_APP_GOOGLE_RECAPTCHA_ID || "";
|
|
26
|
+
var GOOGLE_RECAPTCHA_SECRET = process.env.REACT_APP_GOOGLE_RECAPTCHA_SECRET || "";
|
|
27
|
+
var BASE_URL = process.env.REACT_APP_BASE_URL || "";
|
|
28
|
+
var SUPER_ADMIN_BASE_URL = process.env.REACT_APP_SUPER_ADMIN_BASE_URL || "";
|
|
29
|
+
var PUSHER_CONFIG = {
|
|
30
|
+
cluster: process.env.REACT_APP_PUSHER_CONFIG_CLUSTER || "",
|
|
31
|
+
key: process.env.REACT_APP_PUSHER_CONFIG_KEY || ""
|
|
32
|
+
};
|
|
606
33
|
var ACCESS_TOKEN = "ACCESS_TOKEN";
|
|
607
|
-
var
|
|
34
|
+
var ACADEMY_DOMAIN = "ACADEMY_DOMAIN";
|
|
35
|
+
var DefaultErrorMessage = "an_unexpected_error_has_occurred";
|
|
608
36
|
var getAccessToken = function getAccessToken() {
|
|
609
37
|
try {
|
|
610
38
|
return localStorage.getItem(ACCESS_TOKEN);
|
|
@@ -625,26 +53,7 @@ var encodeParams = function encodeParams(params) {
|
|
|
625
53
|
}).join('&');
|
|
626
54
|
};
|
|
627
55
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
|
|
631
|
-
|
|
632
|
-
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
|
633
|
-
|
|
634
|
-
// Asynchronously call a function and send errors to recovery continuation
|
|
635
|
-
function _catch(body, recover) {
|
|
636
|
-
try {
|
|
637
|
-
var result = body();
|
|
638
|
-
} catch(e) {
|
|
639
|
-
return recover(e);
|
|
640
|
-
}
|
|
641
|
-
if (result && result.then) {
|
|
642
|
-
return result.then(void 0, recover);
|
|
643
|
-
}
|
|
644
|
-
return result;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
var styles = {"signup_wrap":"_18HOc","back_btn":"_397BX","sign_card":"_2ZRO9","card-header":"_ii7EY","card-body-item":"_LLdCT"};
|
|
56
|
+
var styleGlobal = {"signup_wrap":"_1KLz9","box-signin":"_2Jo1o","signin_title":"_3egBO","signup_link":"_1DoIT","google_button":"_34hK_","box-field":"_2e9xO","box-input":"_3zXRp","box-button-email":"_21FPk","box-signin-container":"_1QERu","box-signin-text":"_2-znH","box-signin-logo":"_1aB2m","box-right":"_3qndF","box-right-body":"_JzdCr","box-right-footer":"_19aCA"};
|
|
648
57
|
|
|
649
58
|
var api = axios.create({
|
|
650
59
|
baseURL: BASE_URL,
|
|
@@ -679,9 +88,6 @@ var apiUpload = axios.create({
|
|
|
679
88
|
return i.interceptors.response.use(function (response) {
|
|
680
89
|
return response;
|
|
681
90
|
}, function (error) {
|
|
682
|
-
console.log({
|
|
683
|
-
error: error
|
|
684
|
-
});
|
|
685
91
|
if (error.response.status === 401) {
|
|
686
92
|
window.location.href = "/login";
|
|
687
93
|
}
|
|
@@ -695,38 +101,16 @@ var apiUpload = axios.create({
|
|
|
695
101
|
});
|
|
696
102
|
|
|
697
103
|
var apiLoginGoogle = function apiLoginGoogle(body) {
|
|
698
|
-
return api.post(BASE_URL + "/api/
|
|
104
|
+
return api.post(BASE_URL + "/api/Auth/login", body);
|
|
699
105
|
};
|
|
700
106
|
|
|
701
|
-
var
|
|
702
|
-
|
|
703
|
-
password: string().required("Password is required"),
|
|
704
|
-
rememberMe: boolean()
|
|
705
|
-
});
|
|
107
|
+
var itemLogin = ['Seamless lesson planning', 'Flexibility and customization', 'Data protection and security', 'Standards alignment', 'AI smart assist'];
|
|
108
|
+
|
|
706
109
|
var BlockLogin = function BlockLogin(_ref) {
|
|
707
|
-
var
|
|
708
|
-
|
|
709
|
-
var _useGoogleReCaptcha = useGoogleReCaptcha(),
|
|
710
|
-
executeRecaptcha = _useGoogleReCaptcha.executeRecaptcha;
|
|
711
|
-
var history = useHistory();
|
|
712
|
-
var clickHandler = useCallback(function () {
|
|
713
|
-
try {
|
|
714
|
-
if (!executeRecaptcha) {
|
|
715
|
-
console.log("execute recaptcha undefined");
|
|
716
|
-
return Promise.resolve();
|
|
717
|
-
}
|
|
718
|
-
return Promise.resolve(executeRecaptcha("login"));
|
|
719
|
-
} catch (e) {
|
|
720
|
-
return Promise.reject(e);
|
|
721
|
-
}
|
|
722
|
-
}, [executeRecaptcha]);
|
|
723
|
-
var handleVerify = useCallback(function () {}, []);
|
|
110
|
+
var onNavigate = _ref.onNavigate,
|
|
111
|
+
role = _ref.role;
|
|
724
112
|
var onSuccessGoogle = function onSuccessGoogle(res) {
|
|
725
113
|
try {
|
|
726
|
-
console.log("success");
|
|
727
|
-
console.log({
|
|
728
|
-
res: res
|
|
729
|
-
});
|
|
730
114
|
var _temp = function () {
|
|
731
115
|
if (!!(res !== null && res !== void 0 && res.accessToken)) {
|
|
732
116
|
var _res$profileObj = res.profileObj,
|
|
@@ -735,7 +119,7 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
735
119
|
familyName = _res$profileObj.familyName,
|
|
736
120
|
givenName = _res$profileObj.givenName,
|
|
737
121
|
name = _res$profileObj.name;
|
|
738
|
-
var accessToken = res.
|
|
122
|
+
var accessToken = res.tokenObj.id_token;
|
|
739
123
|
var googleId = res.googleId;
|
|
740
124
|
var infoLogin = {
|
|
741
125
|
imageUrl: imageUrl,
|
|
@@ -745,13 +129,12 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
745
129
|
email: email,
|
|
746
130
|
token: accessToken,
|
|
747
131
|
googleId: googleId,
|
|
748
|
-
role:
|
|
132
|
+
role: role
|
|
749
133
|
};
|
|
750
134
|
return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (res1) {
|
|
751
135
|
var tokenJWT = res1.data.token;
|
|
752
|
-
localStorage.setItem("USER_INFORMATION", JSON.stringify(infoLogin));
|
|
753
136
|
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
754
|
-
|
|
137
|
+
onNavigate("/dashboard");
|
|
755
138
|
});
|
|
756
139
|
}
|
|
757
140
|
}();
|
|
@@ -763,61 +146,127 @@ var BlockLogin = function BlockLogin(_ref) {
|
|
|
763
146
|
var onFailureGoogle = function onFailureGoogle() {
|
|
764
147
|
onNavigate("/login");
|
|
765
148
|
};
|
|
766
|
-
return React.createElement(
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
149
|
+
return React.createElement(Row, {
|
|
150
|
+
style: {
|
|
151
|
+
height: "100%"
|
|
152
|
+
}
|
|
153
|
+
}, React.createElement(Col, {
|
|
154
|
+
sm: 12,
|
|
155
|
+
lg: 7
|
|
156
|
+
}, React.createElement("div", {
|
|
157
|
+
className: "" + styleGlobal["box-signin-container"]
|
|
158
|
+
}, React.createElement("div", {
|
|
159
|
+
className: styleGlobal["box-signin-logo"] + " "
|
|
160
|
+
}, React.createElement(Link, {
|
|
161
|
+
to: "/",
|
|
162
|
+
className: "d-flex"
|
|
163
|
+
}, React.createElement("img", {
|
|
164
|
+
src: "/images/Logo.png",
|
|
165
|
+
alt: "",
|
|
166
|
+
height: 37,
|
|
167
|
+
width: 155,
|
|
168
|
+
className: "my-auto"
|
|
169
|
+
}))), React.createElement("div", {
|
|
170
|
+
className: styleGlobal["box-signin"] + " "
|
|
171
|
+
}, React.createElement("div", {
|
|
172
|
+
className: "" + styleGlobal["signin_title"]
|
|
173
|
+
}, React.createElement("span", null, "Welcome to Edusfere")), React.createElement("div", {
|
|
174
|
+
className: "" + styleGlobal["signup_link"]
|
|
175
|
+
}, React.createElement("span", null, "Don't have an account?", " ", React.createElement(Link, {
|
|
176
|
+
to: "/",
|
|
177
|
+
style: {
|
|
178
|
+
color: "#00A0DA"
|
|
179
|
+
},
|
|
180
|
+
className: "text-decoration-none"
|
|
181
|
+
}, "Sign up"))), React.createElement(GoogleLogin, {
|
|
182
|
+
clientId: GOOGLE_CLIENT_ID,
|
|
183
|
+
render: function render(renderProps) {
|
|
184
|
+
return React.createElement("div", {
|
|
185
|
+
className: "" + styleGlobal["google_button"]
|
|
186
|
+
}, React.createElement("button", {
|
|
187
|
+
onClick: renderProps.onClick,
|
|
188
|
+
disabled: renderProps.disabled
|
|
189
|
+
}, React.createElement("img", {
|
|
190
|
+
width: 24,
|
|
191
|
+
height: 24,
|
|
192
|
+
alt: "Google sign-in",
|
|
193
|
+
src: "/images/icons/Google__G__logo.png"
|
|
194
|
+
}), "Sign in with Google"));
|
|
195
|
+
},
|
|
196
|
+
onSuccess: onSuccessGoogle,
|
|
197
|
+
onFailure: onFailureGoogle,
|
|
198
|
+
cookiePolicy: "single_host_origin"
|
|
199
|
+
}), React.createElement("span", {
|
|
200
|
+
className: "" + styleGlobal["box-field"]
|
|
201
|
+
}, "OR"), React.createElement(Form, null, React.createElement("div", {
|
|
202
|
+
className: "" + styleGlobal["box-input"]
|
|
203
|
+
}, React.createElement("input", {
|
|
204
|
+
type: "email",
|
|
205
|
+
placeholder: "Email"
|
|
206
|
+
})), React.createElement("button", {
|
|
207
|
+
type: "submit",
|
|
208
|
+
className: "" + styleGlobal["box-button-email"]
|
|
209
|
+
}, React.createElement("img", {
|
|
210
|
+
width: 20,
|
|
211
|
+
height: 20,
|
|
212
|
+
alt: "Email sign-in",
|
|
213
|
+
src: "/images/icons/Login_icon.png"
|
|
214
|
+
}), "Sign in with Email"))), React.createElement("div", {
|
|
215
|
+
className: styleGlobal["box-signin-text"] + " "
|
|
216
|
+
}, React.createElement("span", {
|
|
217
|
+
style: {
|
|
218
|
+
fontSize: "13px",
|
|
219
|
+
color: "#A6A6AD"
|
|
220
|
+
}
|
|
221
|
+
}, "By signing in, you agree to our Terms & Privacy Policy")))), React.createElement(Col, {
|
|
222
|
+
sm: 12,
|
|
223
|
+
lg: 5,
|
|
224
|
+
className: "d-none d-lg-block"
|
|
225
|
+
}, React.createElement("div", {
|
|
226
|
+
className: "" + styleGlobal["box-right"],
|
|
227
|
+
style: {
|
|
228
|
+
backgroundImage: "url('/images/bg_login.png')"
|
|
229
|
+
}
|
|
230
|
+
}, React.createElement("div", {
|
|
231
|
+
className: "" + styleGlobal["box-right-body"]
|
|
232
|
+
}, React.createElement("span", {
|
|
233
|
+
style: {
|
|
234
|
+
fontSize: "24px",
|
|
235
|
+
fontWeight: "700"
|
|
236
|
+
}
|
|
237
|
+
}, "As a teacher, your time and energy are too valuable to waste"), React.createElement("p", {
|
|
238
|
+
className: " fw-normal ",
|
|
239
|
+
style: {
|
|
240
|
+
marginTop: "12px",
|
|
241
|
+
marginBottom: "24px",
|
|
242
|
+
color: "#03191F"
|
|
243
|
+
}
|
|
244
|
+
}, "So we\u2019re building a curriculum hub and and workspace that puts everything you need to plan and prep within reach."), React.createElement("ul", null, itemLogin.map(function (item, it) {
|
|
245
|
+
return React.createElement("li", {
|
|
246
|
+
key: it,
|
|
247
|
+
className: "mb-2 ",
|
|
248
|
+
style: {
|
|
249
|
+
color: "#212126"
|
|
783
250
|
}
|
|
251
|
+
}, item);
|
|
252
|
+
})), React.createElement("div", {
|
|
253
|
+
className: "" + styleGlobal["box-right-footer"]
|
|
254
|
+
}, React.createElement("img", {
|
|
255
|
+
className: "img-fluid",
|
|
256
|
+
alt: "",
|
|
257
|
+
src: "/images/image_login.png",
|
|
258
|
+
style: {
|
|
259
|
+
width: "15vw"
|
|
784
260
|
}
|
|
785
|
-
},
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
onSubmit: handleSubmit
|
|
795
|
-
}, React.createElement(FormGroup, null, React.createElement(GoogleReCaptcha, {
|
|
796
|
-
action: "login",
|
|
797
|
-
onVerify: handleVerify
|
|
798
|
-
})), React.createElement(GoogleLogin, {
|
|
799
|
-
clientId: GOOGLE_CLIENT_ID,
|
|
800
|
-
render: function render(renderProps) {
|
|
801
|
-
return React.createElement("div", {
|
|
802
|
-
className: "d-flex justify-content-center mt-5"
|
|
803
|
-
}, React.createElement("button", {
|
|
804
|
-
onClick: renderProps.onClick,
|
|
805
|
-
disabled: renderProps.disabled,
|
|
806
|
-
className: "d-flex py-3 text-black align-items-center px-3 justify-content-center"
|
|
807
|
-
}, React.createElement("img", {
|
|
808
|
-
width: 30,
|
|
809
|
-
alt: "Google sign-in",
|
|
810
|
-
src: "/images/icons/icons8-google-96.svg"
|
|
811
|
-
}), React.createElement("h6", {
|
|
812
|
-
className: "mb-0 ms-3 fw-bold"
|
|
813
|
-
}, "sign in with Google")));
|
|
814
|
-
},
|
|
815
|
-
onSuccess: onSuccessGoogle,
|
|
816
|
-
onFailure: onFailureGoogle,
|
|
817
|
-
cookiePolicy: "single_host_origin",
|
|
818
|
-
className: "" + styles["btn-login-google"]
|
|
819
|
-
}))));
|
|
820
|
-
}));
|
|
261
|
+
}), React.createElement("div", null, React.createElement("p", null, "As one of our earliest users,", React.createElement("br", null), "you are a vital part of this process"), React.createElement("div", null, React.createElement("span", {
|
|
262
|
+
className: "d-block"
|
|
263
|
+
}, "Thank you!"), React.createElement("img", {
|
|
264
|
+
style: {
|
|
265
|
+
marginTop: "-15px"
|
|
266
|
+
},
|
|
267
|
+
alt: "",
|
|
268
|
+
src: "/images/icons/Vector 22.png"
|
|
269
|
+
}))))))));
|
|
821
270
|
};
|
|
822
271
|
|
|
823
272
|
var defaultInfo = {
|
|
@@ -826,7 +275,6 @@ var defaultInfo = {
|
|
|
826
275
|
captcha: "",
|
|
827
276
|
rememberMe: false
|
|
828
277
|
};
|
|
829
|
-
var TITLE = "Log in";
|
|
830
278
|
var useLogin = function useLogin() {
|
|
831
279
|
var _useState = useState(false),
|
|
832
280
|
openLogin = _useState[0],
|
|
@@ -840,9 +288,6 @@ var useLogin = function useLogin() {
|
|
|
840
288
|
var _useState3 = useState(false),
|
|
841
289
|
isShowPassword = _useState3[0],
|
|
842
290
|
setIsShowPassword = _useState3[1];
|
|
843
|
-
useEffect(function () {
|
|
844
|
-
document.title = TITLE;
|
|
845
|
-
}, []);
|
|
846
291
|
useEffect(function () {
|
|
847
292
|
var start = function start() {
|
|
848
293
|
gapi.client.init({
|
|
@@ -864,31 +309,17 @@ var useLogin = function useLogin() {
|
|
|
864
309
|
};
|
|
865
310
|
|
|
866
311
|
var Login = function Login(props) {
|
|
867
|
-
var onNavigate = props.onNavigate
|
|
312
|
+
var onNavigate = props.onNavigate,
|
|
313
|
+
role = props.role;
|
|
868
314
|
var _useLogin = useLogin(),
|
|
869
315
|
defaultInfo = _useLogin.defaultInfo;
|
|
870
316
|
return React.createElement("div", {
|
|
871
|
-
className:
|
|
872
|
-
}, React.createElement("button", {
|
|
873
|
-
className: styles["back_btn"],
|
|
874
|
-
onClick: function onClick() {
|
|
875
|
-
onNavigate("/");
|
|
876
|
-
}
|
|
877
|
-
}, React.createElement("img", {
|
|
878
|
-
src: "/images/icons/white-left-arrow.svg",
|
|
879
|
-
alt: ""
|
|
880
|
-
}), " back"), React.createElement(GoogleReCaptchaProvider, {
|
|
881
|
-
useRecaptchaNet: true,
|
|
882
|
-
reCaptchaKey: GOOGLE_RECAPTCHA_ID,
|
|
883
|
-
scriptProps: {
|
|
884
|
-
async: true,
|
|
885
|
-
defer: true,
|
|
886
|
-
appendTo: "body"
|
|
887
|
-
}
|
|
317
|
+
className: styleGlobal["signup_wrap"] + " container-fluid font-family-lato"
|
|
888
318
|
}, React.createElement(BlockLogin, {
|
|
889
319
|
defaultInfo: defaultInfo,
|
|
890
|
-
onNavigate: onNavigate
|
|
891
|
-
|
|
320
|
+
onNavigate: onNavigate,
|
|
321
|
+
role: role
|
|
322
|
+
}));
|
|
892
323
|
};
|
|
893
324
|
|
|
894
325
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -986,7 +417,7 @@ function kindOf(val) {
|
|
|
986
417
|
}
|
|
987
418
|
|
|
988
419
|
// src/utils/warning.ts
|
|
989
|
-
function warning
|
|
420
|
+
function warning(message) {
|
|
990
421
|
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
991
422
|
console.error(message);
|
|
992
423
|
}
|
|
@@ -1039,7 +470,7 @@ function combineReducers(reducers) {
|
|
|
1039
470
|
const key = reducerKeys[i];
|
|
1040
471
|
if (process.env.NODE_ENV !== "production") {
|
|
1041
472
|
if (typeof reducers[key] === "undefined") {
|
|
1042
|
-
warning
|
|
473
|
+
warning(`No reducer provided for key "${key}"`);
|
|
1043
474
|
}
|
|
1044
475
|
}
|
|
1045
476
|
if (typeof reducers[key] === "function") {
|
|
@@ -1064,7 +495,7 @@ function combineReducers(reducers) {
|
|
|
1064
495
|
if (process.env.NODE_ENV !== "production") {
|
|
1065
496
|
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
1066
497
|
if (warningMessage) {
|
|
1067
|
-
warning
|
|
498
|
+
warning(warningMessage);
|
|
1068
499
|
}
|
|
1069
500
|
}
|
|
1070
501
|
let hasChanged = false;
|
|
@@ -1093,7 +524,8 @@ var initialState = {
|
|
|
1093
524
|
type: "",
|
|
1094
525
|
message: ""
|
|
1095
526
|
},
|
|
1096
|
-
user: null
|
|
527
|
+
user: null,
|
|
528
|
+
academy: null
|
|
1097
529
|
};
|
|
1098
530
|
var commonReducer = createReducer(initialState, function (builder) {
|
|
1099
531
|
builder.addCase(setLoading, function (state, action) {
|
|
@@ -1102,6 +534,10 @@ var commonReducer = createReducer(initialState, function (builder) {
|
|
|
1102
534
|
state.alert = action.payload;
|
|
1103
535
|
}).addCase(setUser, function (state, action) {
|
|
1104
536
|
state.user = action.payload;
|
|
537
|
+
}).addCase(setLanguage, function (state, action) {
|
|
538
|
+
state.language = action.payload;
|
|
539
|
+
}).addCase(reset, function (_state, _action) {
|
|
540
|
+
return initialState;
|
|
1105
541
|
});
|
|
1106
542
|
});
|
|
1107
543
|
|
|
@@ -1118,11 +554,7 @@ var store = configureStore({
|
|
|
1118
554
|
}
|
|
1119
555
|
});
|
|
1120
556
|
|
|
1121
|
-
var TITLE$1 = "Not found";
|
|
1122
557
|
var NotFound = function NotFound() {
|
|
1123
|
-
useEffect(function () {
|
|
1124
|
-
document.title = TITLE$1;
|
|
1125
|
-
});
|
|
1126
558
|
return React.createElement("div", {
|
|
1127
559
|
className: "not-found"
|
|
1128
560
|
}, React.createElement("div", {
|
|
@@ -1165,6 +597,25 @@ var Loading = function Loading() {
|
|
|
1165
597
|
}))) : null;
|
|
1166
598
|
};
|
|
1167
599
|
|
|
600
|
+
// A type of promise-like that resolves synchronously and supports only one observer
|
|
601
|
+
|
|
602
|
+
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
|
|
603
|
+
|
|
604
|
+
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
|
605
|
+
|
|
606
|
+
// Asynchronously call a function and send errors to recovery continuation
|
|
607
|
+
function _catch(body, recover) {
|
|
608
|
+
try {
|
|
609
|
+
var result = body();
|
|
610
|
+
} catch(e) {
|
|
611
|
+
return recover(e);
|
|
612
|
+
}
|
|
613
|
+
if (result && result.then) {
|
|
614
|
+
return result.then(void 0, recover);
|
|
615
|
+
}
|
|
616
|
+
return result;
|
|
617
|
+
}
|
|
618
|
+
|
|
1168
619
|
var encodeParams$1 = (function (params) {
|
|
1169
620
|
return Object.keys(params).filter(function (key) {
|
|
1170
621
|
return params[key] || params[key] === 0 || params[key] === false;
|
|
@@ -1230,18 +681,68 @@ var apiUpload$1 = axios.create({
|
|
|
1230
681
|
});
|
|
1231
682
|
});
|
|
1232
683
|
|
|
1233
|
-
var ACCOUNT_URL = BASE_URL + "/api/account";
|
|
1234
684
|
var getInfo = function getInfo() {
|
|
1235
|
-
return api$1.get(
|
|
685
|
+
return api$1.get(BASE_URL + "/api/Auth/info");
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
var useGoogleSignOut = function useGoogleSignOut(props) {
|
|
689
|
+
var dispatch = useDispatch();
|
|
690
|
+
var onLogoutSuccess = props.onLogoutSuccess,
|
|
691
|
+
onFailure = props.onFailure;
|
|
692
|
+
var handleLogoutSuccess = function handleLogoutSuccess() {
|
|
693
|
+
onLogoutSuccess === null || onLogoutSuccess === void 0 ? void 0 : onLogoutSuccess();
|
|
694
|
+
};
|
|
695
|
+
var handleLogoutFailure = function handleLogoutFailure() {
|
|
696
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure();
|
|
697
|
+
};
|
|
698
|
+
var _useGoogleLogout = useGoogleLogout({
|
|
699
|
+
clientId: GOOGLE_CLIENT_ID,
|
|
700
|
+
onLogoutSuccess: handleLogoutSuccess,
|
|
701
|
+
onFailure: handleLogoutFailure
|
|
702
|
+
}),
|
|
703
|
+
signOut = _useGoogleLogout.signOut,
|
|
704
|
+
loaded = _useGoogleLogout.loaded;
|
|
705
|
+
var handleSignOut = function handleSignOut(isRemoveDomainStorage) {
|
|
706
|
+
if (isRemoveDomainStorage === void 0) {
|
|
707
|
+
isRemoveDomainStorage = false;
|
|
708
|
+
}
|
|
709
|
+
localStorage.removeItem("USER_INFORMATION");
|
|
710
|
+
localStorage.removeItem(ACCESS_TOKEN);
|
|
711
|
+
if (isRemoveDomainStorage) {
|
|
712
|
+
localStorage.removeItem(ACADEMY_DOMAIN);
|
|
713
|
+
}
|
|
714
|
+
try {
|
|
715
|
+
signOut();
|
|
716
|
+
} catch (error) {
|
|
717
|
+
console.log({
|
|
718
|
+
error: error
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
dispatch(reset());
|
|
722
|
+
window.location.href = "/login";
|
|
723
|
+
};
|
|
724
|
+
return {
|
|
725
|
+
handleSignOut: handleSignOut,
|
|
726
|
+
loaded: loaded
|
|
727
|
+
};
|
|
1236
728
|
};
|
|
1237
729
|
|
|
1238
730
|
var LayoutContext = function LayoutContext(_ref) {
|
|
1239
731
|
var children = _ref.children,
|
|
732
|
+
role = _ref.role,
|
|
1240
733
|
onNavigate = _ref.onNavigate;
|
|
734
|
+
var _useGoogleSignOut = useGoogleSignOut({
|
|
735
|
+
onNavigate: onNavigate
|
|
736
|
+
}),
|
|
737
|
+
handleSignOut = _useGoogleSignOut.handleSignOut;
|
|
1241
738
|
var dispatch = useDispatch();
|
|
739
|
+
var user = useSelector(function (state) {
|
|
740
|
+
var _state$common;
|
|
741
|
+
return state === null || state === void 0 ? void 0 : (_state$common = state.common) === null || _state$common === void 0 ? void 0 : _state$common.user;
|
|
742
|
+
});
|
|
743
|
+
var roles = (user === null || user === void 0 ? void 0 : user.roles) || [];
|
|
1242
744
|
var resetAuth = function resetAuth() {
|
|
1243
|
-
|
|
1244
|
-
onNavigate("/login");
|
|
745
|
+
handleSignOut();
|
|
1245
746
|
};
|
|
1246
747
|
var loadInfo = function loadInfo() {
|
|
1247
748
|
try {
|
|
@@ -1265,10 +766,17 @@ var LayoutContext = function LayoutContext(_ref) {
|
|
|
1265
766
|
return Promise.reject(e);
|
|
1266
767
|
}
|
|
1267
768
|
};
|
|
1268
|
-
|
|
769
|
+
var checkRoleUser = useCallback(function () {
|
|
770
|
+
if (!user) return;
|
|
771
|
+
if (!roles.includes(role) && !!user.academyDomain) {
|
|
772
|
+
alert(user.email + " not allow to register " + role);
|
|
773
|
+
resetAuth();
|
|
774
|
+
}
|
|
775
|
+
}, [role, JSON.stringify(user)]);
|
|
1269
776
|
useEffect(function () {
|
|
1270
|
-
loadInfo();
|
|
1271
|
-
|
|
777
|
+
!user && loadInfo();
|
|
778
|
+
!!user && checkRoleUser();
|
|
779
|
+
}, [JSON.stringify(user)]);
|
|
1272
780
|
return React.createElement(Fragment, null, children);
|
|
1273
781
|
};
|
|
1274
782
|
|
|
@@ -1302,17 +810,584 @@ var CommonDialog = function CommonDialog(_ref) {
|
|
|
1302
810
|
children = _ref.children,
|
|
1303
811
|
centered = _ref.centered,
|
|
1304
812
|
title = _ref.title,
|
|
1305
|
-
|
|
813
|
+
_ref$size = _ref.size,
|
|
814
|
+
size = _ref$size === void 0 ? "xs" : _ref$size,
|
|
815
|
+
_ref$isShowHeader = _ref.isShowHeader,
|
|
816
|
+
isShowHeader = _ref$isShowHeader === void 0 ? true : _ref$isShowHeader,
|
|
817
|
+
onClose = _ref.onClose,
|
|
818
|
+
backdrop = _ref.backdrop;
|
|
1306
819
|
return React.createElement(Modal, {
|
|
820
|
+
backdrop: backdrop,
|
|
1307
821
|
isOpen: open,
|
|
1308
822
|
toggle: onClose,
|
|
1309
|
-
centered: centered
|
|
1310
|
-
|
|
823
|
+
centered: centered,
|
|
824
|
+
size: size,
|
|
825
|
+
zIndex: 1102
|
|
826
|
+
}, isShowHeader ? React.createElement(ModalHeader, {
|
|
1311
827
|
toggle: onClose
|
|
1312
|
-
}, title),
|
|
828
|
+
}, title) : React.createElement(Box, {
|
|
829
|
+
className: "p-3"
|
|
830
|
+
}, React.createElement(Typography, {
|
|
831
|
+
className: "fs-5 text-center fw-bold"
|
|
832
|
+
}, title)), children);
|
|
833
|
+
};
|
|
834
|
+
|
|
835
|
+
var AuthenticationMessage;
|
|
836
|
+
(function (AuthenticationMessage) {
|
|
837
|
+
AuthenticationMessage["NotAllowedToRegister"] = "NotAllowedToRegister";
|
|
838
|
+
AuthenticationMessage["InvalidGoogleToken"] = "InvalidGoogleToken";
|
|
839
|
+
})(AuthenticationMessage || (AuthenticationMessage = {}));
|
|
840
|
+
var Role;
|
|
841
|
+
(function (Role) {
|
|
842
|
+
Role["Student"] = "Student";
|
|
843
|
+
Role["Teacher"] = "Teacher";
|
|
844
|
+
Role["Admin"] = "Admin";
|
|
845
|
+
})(Role || (Role = {}));
|
|
846
|
+
|
|
847
|
+
var CustomPagination = function CustomPagination(_ref) {
|
|
848
|
+
var currentPage = _ref.currentPage,
|
|
849
|
+
totalPage = _ref.totalPage,
|
|
850
|
+
onChangePage = _ref.onChangePage;
|
|
851
|
+
return React.createElement(Pagination, {
|
|
852
|
+
className: "w-fit"
|
|
853
|
+
}, React.createElement(PaginationItem, {
|
|
854
|
+
disabled: currentPage <= 1
|
|
855
|
+
}, React.createElement(PaginationLink, {
|
|
856
|
+
onClick: function onClick(e) {
|
|
857
|
+
e.preventDefault();
|
|
858
|
+
onChangePage(currentPage - 1);
|
|
859
|
+
},
|
|
860
|
+
previous: true,
|
|
861
|
+
href: "#"
|
|
862
|
+
})), React.createElement(PaginationItem, {
|
|
863
|
+
active: 1 === currentPage,
|
|
864
|
+
key: 1
|
|
865
|
+
}, React.createElement(PaginationLink, {
|
|
866
|
+
onClick: function onClick(e) {
|
|
867
|
+
e.preventDefault();
|
|
868
|
+
onChangePage(1);
|
|
869
|
+
},
|
|
870
|
+
href: "#"
|
|
871
|
+
}, 1)), totalPage > 2 && React.createElement(PaginationItem, {
|
|
872
|
+
active: 2 === currentPage,
|
|
873
|
+
key: 1
|
|
874
|
+
}, React.createElement(PaginationLink, {
|
|
875
|
+
onClick: function onClick(e) {
|
|
876
|
+
e.preventDefault();
|
|
877
|
+
onChangePage(2);
|
|
878
|
+
},
|
|
879
|
+
href: "#"
|
|
880
|
+
}, 2)), currentPage > 4 && currentPage !== totalPage && totalPage !== 5 && React.createElement(PaginationItem, {
|
|
881
|
+
disabled: true,
|
|
882
|
+
key: "first"
|
|
883
|
+
}, React.createElement(PaginationLink, {
|
|
884
|
+
href: "#"
|
|
885
|
+
}, "...")), (currentPage === 1 || currentPage === totalPage) && totalPage === 5 && React.createElement(PaginationItem, {
|
|
886
|
+
key: 3
|
|
887
|
+
}, React.createElement(PaginationLink, {
|
|
888
|
+
onClick: function onClick(e) {
|
|
889
|
+
e.preventDefault();
|
|
890
|
+
onChangePage(3);
|
|
891
|
+
},
|
|
892
|
+
href: "#"
|
|
893
|
+
}, "3")), [currentPage - 1, currentPage, currentPage + 1].filter(function (page) {
|
|
894
|
+
return page > 2 && page < totalPage - 1;
|
|
895
|
+
}).map(function (page) {
|
|
896
|
+
return React.createElement(PaginationItem, {
|
|
897
|
+
active: page === currentPage,
|
|
898
|
+
key: page
|
|
899
|
+
}, React.createElement(PaginationLink, {
|
|
900
|
+
onClick: function onClick(e) {
|
|
901
|
+
e.preventDefault();
|
|
902
|
+
onChangePage(page);
|
|
903
|
+
},
|
|
904
|
+
href: "#"
|
|
905
|
+
}, page));
|
|
906
|
+
}), totalPage - currentPage > 4 && React.createElement(PaginationItem, {
|
|
907
|
+
disabled: true,
|
|
908
|
+
key: "last"
|
|
909
|
+
}, React.createElement(PaginationLink, {
|
|
910
|
+
href: "#"
|
|
911
|
+
}, "...")), totalPage > 3 && React.createElement(PaginationItem, {
|
|
912
|
+
active: totalPage - 1 === currentPage,
|
|
913
|
+
key: totalPage - 1
|
|
914
|
+
}, React.createElement(PaginationLink, {
|
|
915
|
+
onClick: function onClick(e) {
|
|
916
|
+
e.preventDefault();
|
|
917
|
+
onChangePage(totalPage - 1);
|
|
918
|
+
},
|
|
919
|
+
href: "#"
|
|
920
|
+
}, totalPage - 1)), totalPage > 1 && React.createElement(PaginationItem, {
|
|
921
|
+
active: totalPage === currentPage,
|
|
922
|
+
key: totalPage
|
|
923
|
+
}, React.createElement(PaginationLink, {
|
|
924
|
+
onClick: function onClick(e) {
|
|
925
|
+
e.preventDefault();
|
|
926
|
+
onChangePage(totalPage);
|
|
927
|
+
},
|
|
928
|
+
href: "#"
|
|
929
|
+
}, totalPage)), React.createElement(PaginationItem, {
|
|
930
|
+
disabled: currentPage >= totalPage
|
|
931
|
+
}, React.createElement(PaginationLink, {
|
|
932
|
+
onClick: function onClick(e) {
|
|
933
|
+
e.preventDefault();
|
|
934
|
+
onChangePage(currentPage + 1);
|
|
935
|
+
},
|
|
936
|
+
next: true,
|
|
937
|
+
href: "#"
|
|
938
|
+
})));
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
var styles = {"core-button":"_xvNBN","primary":"_U9Qyp","secondary":"_1VzMy","text":"_pZNuj"};
|
|
942
|
+
|
|
943
|
+
var CoreButton = function CoreButton(props) {
|
|
944
|
+
var _props$type = props.type,
|
|
945
|
+
type = _props$type === void 0 ? "primary" : _props$type,
|
|
946
|
+
children = props.children,
|
|
947
|
+
onClick = props.onClick,
|
|
948
|
+
icon = props.icon,
|
|
949
|
+
_props$disabled = props.disabled,
|
|
950
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled;
|
|
951
|
+
return React.createElement("button", {
|
|
952
|
+
className: styles["core-button"] + " " + styles[type],
|
|
953
|
+
onClick: onClick,
|
|
954
|
+
disabled: disabled
|
|
955
|
+
}, icon && icon, children);
|
|
956
|
+
};
|
|
957
|
+
|
|
958
|
+
var styles$1 = {"core-input":"_1WdX2","error":"_n7n3Q"};
|
|
959
|
+
|
|
960
|
+
var CoreInput = function CoreInput(props) {
|
|
961
|
+
var name = props.name,
|
|
962
|
+
value = props.value,
|
|
963
|
+
_onChange = props.onChange,
|
|
964
|
+
_props$disabled = props.disabled,
|
|
965
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
966
|
+
label = props.label,
|
|
967
|
+
width = props.width,
|
|
968
|
+
_props$placeholder = props.placeholder,
|
|
969
|
+
placeholder = _props$placeholder === void 0 ? "" : _props$placeholder,
|
|
970
|
+
error = props.error;
|
|
971
|
+
return React.createElement("div", {
|
|
972
|
+
className: styles$1["core-input"] + " " + (error ? styles$1["error"] : ""),
|
|
973
|
+
style: {
|
|
974
|
+
width: width != null ? width : "100%"
|
|
975
|
+
}
|
|
976
|
+
}, label && React.createElement("label", null, label), React.createElement("input", {
|
|
977
|
+
name: name,
|
|
978
|
+
value: value,
|
|
979
|
+
onChange: function onChange(e) {
|
|
980
|
+
return _onChange(name, e.target.value);
|
|
981
|
+
},
|
|
982
|
+
disabled: disabled,
|
|
983
|
+
placeholder: placeholder
|
|
984
|
+
}));
|
|
985
|
+
};
|
|
986
|
+
|
|
987
|
+
function _extends() {
|
|
988
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
989
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
990
|
+
var t = arguments[e];
|
|
991
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
992
|
+
}
|
|
993
|
+
return n;
|
|
994
|
+
}, _extends.apply(null, arguments);
|
|
995
|
+
}
|
|
996
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
997
|
+
if (null == r) return {};
|
|
998
|
+
var t = {};
|
|
999
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
1000
|
+
if (e.includes(n)) continue;
|
|
1001
|
+
t[n] = r[n];
|
|
1002
|
+
}
|
|
1003
|
+
return t;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
var styles$2 = {"core-select":"_2sg12"};
|
|
1007
|
+
|
|
1008
|
+
var CoreSelect = function CoreSelect(props) {
|
|
1009
|
+
var _options$find;
|
|
1010
|
+
var name = props.name,
|
|
1011
|
+
options = props.options,
|
|
1012
|
+
value = props.value,
|
|
1013
|
+
_onChange = props.onChange,
|
|
1014
|
+
_props$disabled = props.disabled,
|
|
1015
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
1016
|
+
label = props.label,
|
|
1017
|
+
width = props.width,
|
|
1018
|
+
_props$placeholder = props.placeholder,
|
|
1019
|
+
placeholder = _props$placeholder === void 0 ? "" : _props$placeholder,
|
|
1020
|
+
error = props.error;
|
|
1021
|
+
return React.createElement("div", {
|
|
1022
|
+
className: "" + styles$2["core-select"],
|
|
1023
|
+
style: {
|
|
1024
|
+
width: width != null ? width : "100%"
|
|
1025
|
+
}
|
|
1026
|
+
}, label && React.createElement("label", null, label), React.createElement(Select, {
|
|
1027
|
+
name: name,
|
|
1028
|
+
value: (_options$find = options.find(function (i) {
|
|
1029
|
+
return i.value === value;
|
|
1030
|
+
})) != null ? _options$find : null,
|
|
1031
|
+
onChange: function onChange(e) {
|
|
1032
|
+
return _onChange(name, e === null || e === void 0 ? void 0 : e.value);
|
|
1033
|
+
},
|
|
1034
|
+
placeholder: placeholder,
|
|
1035
|
+
isDisabled: disabled,
|
|
1036
|
+
options: options,
|
|
1037
|
+
styles: {
|
|
1038
|
+
control: function control(base, state) {
|
|
1039
|
+
return _extends({}, base, {
|
|
1040
|
+
borderRadius: "8px",
|
|
1041
|
+
border: state.isFocused ? "2px solid " + (!error ? "#00AFDA" : "#CE3636") : "1px solid " + (!error ? "#E6E6EB" : "#CE3636"),
|
|
1042
|
+
height: "32px",
|
|
1043
|
+
minHeight: 0,
|
|
1044
|
+
fontSize: "14px",
|
|
1045
|
+
fontWeight: "400",
|
|
1046
|
+
padding: "0 4px",
|
|
1047
|
+
backgroundColor: state.isDisabled ? "#F5F9FA)" : "#FFF",
|
|
1048
|
+
boxShadow: "none",
|
|
1049
|
+
"&:hover": {
|
|
1050
|
+
backgroundColor: "#F5F9FA"
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
},
|
|
1054
|
+
input: function input(base) {
|
|
1055
|
+
return _extends({}, base, {
|
|
1056
|
+
margin: "0",
|
|
1057
|
+
padding: "0",
|
|
1058
|
+
color: "inherit"
|
|
1059
|
+
});
|
|
1060
|
+
},
|
|
1061
|
+
placeholder: function placeholder(base) {
|
|
1062
|
+
return _extends({}, base, {
|
|
1063
|
+
color: "#A6A6AD",
|
|
1064
|
+
position: "relative",
|
|
1065
|
+
top: "-4px"
|
|
1066
|
+
});
|
|
1067
|
+
},
|
|
1068
|
+
dropdownIndicator: function dropdownIndicator(base) {
|
|
1069
|
+
return _extends({}, base, {
|
|
1070
|
+
position: "relative",
|
|
1071
|
+
top: "-4px"
|
|
1072
|
+
});
|
|
1073
|
+
},
|
|
1074
|
+
indicatorSeparator: function indicatorSeparator() {
|
|
1075
|
+
return {
|
|
1076
|
+
display: "none"
|
|
1077
|
+
};
|
|
1078
|
+
},
|
|
1079
|
+
valueContainer: function valueContainer(base) {
|
|
1080
|
+
return _extends({}, base, {
|
|
1081
|
+
height: "32px"
|
|
1082
|
+
});
|
|
1083
|
+
},
|
|
1084
|
+
singleValue: function singleValue(base) {
|
|
1085
|
+
return _extends({}, base, {
|
|
1086
|
+
position: "relative",
|
|
1087
|
+
top: "-4px"
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
}));
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
var styles$3 = {"core-checkbox":"_3HY4f"};
|
|
1095
|
+
|
|
1096
|
+
var CoreInput$1 = function CoreInput(props) {
|
|
1097
|
+
var name = props.name,
|
|
1098
|
+
checked = props.checked,
|
|
1099
|
+
_onChange = props.onChange,
|
|
1100
|
+
_props$disabled = props.disabled,
|
|
1101
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
1102
|
+
label = props.label;
|
|
1103
|
+
return React.createElement("div", {
|
|
1104
|
+
className: "" + styles$3["core-checkbox"]
|
|
1105
|
+
}, React.createElement(FormGroup, {
|
|
1106
|
+
check: true,
|
|
1107
|
+
inline: true
|
|
1108
|
+
}, React.createElement(Input, {
|
|
1109
|
+
id: "core-checkbox-" + name,
|
|
1110
|
+
type: "checkbox",
|
|
1111
|
+
name: name,
|
|
1112
|
+
checked: checked,
|
|
1113
|
+
onChange: function onChange(e) {
|
|
1114
|
+
return _onChange(name, e.target.checked);
|
|
1115
|
+
},
|
|
1116
|
+
disabled: disabled
|
|
1117
|
+
}), React.createElement(Label, {
|
|
1118
|
+
htmlFor: "core-checkbox-" + name,
|
|
1119
|
+
check: true
|
|
1120
|
+
}, label)));
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
var styles$4 = {"core-radio":"_kvUpe","form-check":"_3ToPe"};
|
|
1124
|
+
|
|
1125
|
+
var CoreRadio = function CoreRadio(props) {
|
|
1126
|
+
var name = props.name,
|
|
1127
|
+
value = props.value,
|
|
1128
|
+
options = props.options,
|
|
1129
|
+
onChange = props.onChange,
|
|
1130
|
+
_props$disabled = props.disabled,
|
|
1131
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled;
|
|
1132
|
+
return React.createElement("div", {
|
|
1133
|
+
className: "" + styles$4["core-radio"]
|
|
1134
|
+
}, React.createElement(FormGroup, {
|
|
1135
|
+
check: true
|
|
1136
|
+
}, options.map(function (i) {
|
|
1137
|
+
return React.createElement("div", {
|
|
1138
|
+
key: i.value
|
|
1139
|
+
}, React.createElement(Input, {
|
|
1140
|
+
id: "core-radio-" + i.value,
|
|
1141
|
+
type: "radio",
|
|
1142
|
+
checked: value === i.value,
|
|
1143
|
+
onClick: function onClick() {
|
|
1144
|
+
onChange(name, i.value);
|
|
1145
|
+
},
|
|
1146
|
+
onChange: function onChange() {
|
|
1147
|
+
return;
|
|
1148
|
+
},
|
|
1149
|
+
disabled: disabled
|
|
1150
|
+
}), React.createElement(Label, {
|
|
1151
|
+
htmlFor: "core-radio-" + i.value
|
|
1152
|
+
}, i.label));
|
|
1153
|
+
})));
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
var styles$5 = {"core-error":"_1Mmxr"};
|
|
1157
|
+
|
|
1158
|
+
var icons = {
|
|
1159
|
+
ErrorRedIcon: "/images/icons/error_red.svg"
|
|
1160
|
+
};
|
|
1161
|
+
|
|
1162
|
+
var CoreError = function CoreError(props) {
|
|
1163
|
+
var message = props.message;
|
|
1164
|
+
return React.createElement("div", {
|
|
1165
|
+
className: "" + styles$5["core-error"]
|
|
1166
|
+
}, React.createElement("img", {
|
|
1167
|
+
src: icons.ErrorRedIcon,
|
|
1168
|
+
alt: "error-icon"
|
|
1169
|
+
}), React.createElement("p", null, message));
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
var styles$6 = {"core-modal-header":"_2y5ln"};
|
|
1173
|
+
|
|
1174
|
+
var CoreModal = function CoreModal(props) {
|
|
1175
|
+
var open = props.open,
|
|
1176
|
+
onClose = props.onClose,
|
|
1177
|
+
children = props.children,
|
|
1178
|
+
title = props.title;
|
|
1179
|
+
return React.createElement(Modal, {
|
|
1180
|
+
isOpen: open,
|
|
1181
|
+
toggle: onClose,
|
|
1182
|
+
centered: true,
|
|
1183
|
+
className: styles$6["core-modal"]
|
|
1184
|
+
}, React.createElement(ModalHeader, {
|
|
1185
|
+
toggle: onClose,
|
|
1186
|
+
className: styles$6["core-modal-header"]
|
|
1187
|
+
}, title), React.createElement(ModalBody, null, children));
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
var getErrorMessage = function getErrorMessage(error, defaultErrorMessage) {
|
|
1191
|
+
var _error$response, _error$response$data, _error$response2, _error$response3, _error$response3$data;
|
|
1192
|
+
var errorMessage = error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.title;
|
|
1193
|
+
if ((error === null || error === void 0 ? void 0 : (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) === 500) return defaultErrorMessage || DefaultErrorMessage;
|
|
1194
|
+
if (typeof errorMessage === "string") return decodeURIComponent(errorMessage);
|
|
1195
|
+
errorMessage = (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : (_error$response3$data = _error$response3.data) === null || _error$response3$data === void 0 ? void 0 : _error$response3$data.message);
|
|
1196
|
+
if (typeof errorMessage === "string") return errorMessage;
|
|
1197
|
+
return defaultErrorMessage || DefaultErrorMessage;
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1200
|
+
var customStyles = {
|
|
1201
|
+
control: function control(baseStyles, state) {
|
|
1202
|
+
return _extends({}, baseStyles, {
|
|
1203
|
+
fontSize: "14px",
|
|
1204
|
+
fontWeight: 700,
|
|
1205
|
+
color: styleGlobal.darker,
|
|
1206
|
+
borderColor: state.isFocused || state.hasValue ? styleGlobal.dark : styleGlobal.less_dark,
|
|
1207
|
+
boxShadow: state.isFocused ? "0 0 0 1px " + styleGlobal.dark + "4D" : baseStyles.boxShadow,
|
|
1208
|
+
"&:active": {
|
|
1209
|
+
borderColor: state.isFocused || state.hasValue ? styleGlobal.dark : styleGlobal.less_dark
|
|
1210
|
+
},
|
|
1211
|
+
"&:hover": {
|
|
1212
|
+
borderColor: state.isFocused || state.hasValue ? styleGlobal.dark : styleGlobal.less_dark
|
|
1213
|
+
}
|
|
1214
|
+
});
|
|
1215
|
+
},
|
|
1216
|
+
input: function input(baseStyles, _) {
|
|
1217
|
+
return _extends({}, baseStyles, {
|
|
1218
|
+
fontSize: "14px",
|
|
1219
|
+
fontWeight: 700,
|
|
1220
|
+
color: styleGlobal.darker
|
|
1221
|
+
});
|
|
1222
|
+
},
|
|
1223
|
+
singleValue: function singleValue(baseStyles) {
|
|
1224
|
+
return _extends({}, baseStyles, {
|
|
1225
|
+
fontSize: "14px",
|
|
1226
|
+
fontWeight: 700,
|
|
1227
|
+
color: styleGlobal.darker
|
|
1228
|
+
});
|
|
1229
|
+
},
|
|
1230
|
+
option: function option(baseStyles, state) {
|
|
1231
|
+
return _extends({}, baseStyles, {
|
|
1232
|
+
backgroundColor: state.isSelected ? styleGlobal.dark : state.isFocused ? styleGlobal.light : 'white',
|
|
1233
|
+
"&:active": {
|
|
1234
|
+
backgroundColor: state.isSelected ? styleGlobal.dark : state.isFocused ? styleGlobal.less_dark : baseStyles.backgroundColor
|
|
1235
|
+
}
|
|
1236
|
+
});
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
var DropdownIndicator = function DropdownIndicator(props) {
|
|
1241
|
+
return React.createElement(components.DropdownIndicator, Object.assign({}, props), React.createElement(FaCaretDown, {
|
|
1242
|
+
size: 20,
|
|
1243
|
+
color: styleGlobal.darker
|
|
1244
|
+
}));
|
|
1245
|
+
};
|
|
1246
|
+
var CustomOption = function CustomOption(props) {
|
|
1247
|
+
return React.createElement(components.Option, Object.assign({}, props), React.createElement("div", {
|
|
1248
|
+
style: {
|
|
1249
|
+
fontSize: "14px",
|
|
1250
|
+
fontWeight: 500
|
|
1251
|
+
}
|
|
1252
|
+
}, props.data.label));
|
|
1253
|
+
};
|
|
1254
|
+
|
|
1255
|
+
var _excluded = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
|
|
1256
|
+
var CustomSelect = function CustomSelect(_ref) {
|
|
1257
|
+
var isDefault = _ref.isDefault,
|
|
1258
|
+
options = _ref.options,
|
|
1259
|
+
isDisabled = _ref.isDisabled,
|
|
1260
|
+
scrollBottom = _ref.scrollBottom,
|
|
1261
|
+
value = _ref.value,
|
|
1262
|
+
isMulti = _ref.isMulti,
|
|
1263
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1264
|
+
var initialValues = Array.isArray(value) ? options.filter(function (i) {
|
|
1265
|
+
return value.includes(i.value);
|
|
1266
|
+
}) : isMulti ? options === null || options === void 0 ? void 0 : options.filter(function (i) {
|
|
1267
|
+
return i.value == value;
|
|
1268
|
+
}) : options === null || options === void 0 ? void 0 : options.find(function (i) {
|
|
1269
|
+
return i.value == value;
|
|
1270
|
+
});
|
|
1271
|
+
return React.createElement(Select, Object.assign({
|
|
1272
|
+
isDisabled: isDisabled,
|
|
1273
|
+
options: options,
|
|
1274
|
+
value: !isDefault ? initialValues != null ? initialValues : null : undefined,
|
|
1275
|
+
defaultValue: isDefault ? initialValues : undefined,
|
|
1276
|
+
menuPlacement: scrollBottom ? "top" : "auto",
|
|
1277
|
+
isMulti: isMulti,
|
|
1278
|
+
components: {
|
|
1279
|
+
IndicatorSeparator: function IndicatorSeparator() {
|
|
1280
|
+
return null;
|
|
1281
|
+
},
|
|
1282
|
+
DropdownIndicator: DropdownIndicator,
|
|
1283
|
+
Option: CustomOption
|
|
1284
|
+
},
|
|
1285
|
+
styles: customStyles,
|
|
1286
|
+
placeholder: "Select..."
|
|
1287
|
+
}, rest));
|
|
1288
|
+
};
|
|
1289
|
+
|
|
1290
|
+
var _excluded$1 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
|
|
1291
|
+
var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
|
|
1292
|
+
var isDefault = _ref.isDefault,
|
|
1293
|
+
options = _ref.options,
|
|
1294
|
+
isDisabled = _ref.isDisabled,
|
|
1295
|
+
scrollBottom = _ref.scrollBottom,
|
|
1296
|
+
value = _ref.value,
|
|
1297
|
+
isMulti = _ref.isMulti,
|
|
1298
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
1299
|
+
var initialValues = Array.isArray(value) ? options.filter(function (i) {
|
|
1300
|
+
return value.includes(i.value);
|
|
1301
|
+
}) : isMulti ? options.filter(function (i) {
|
|
1302
|
+
return i.value == value;
|
|
1303
|
+
}) : options.find(function (i) {
|
|
1304
|
+
return i.value == value;
|
|
1305
|
+
});
|
|
1306
|
+
return React.createElement(Select, Object.assign({
|
|
1307
|
+
isDisabled: isDisabled,
|
|
1308
|
+
options: options,
|
|
1309
|
+
value: !isDefault ? initialValues : undefined,
|
|
1310
|
+
defaultValue: isDefault ? initialValues : undefined,
|
|
1311
|
+
menuPlacement: scrollBottom ? "top" : "auto",
|
|
1312
|
+
isMulti: isMulti,
|
|
1313
|
+
components: {
|
|
1314
|
+
IndicatorSeparator: function IndicatorSeparator() {
|
|
1315
|
+
return null;
|
|
1316
|
+
},
|
|
1317
|
+
DropdownIndicator: DropdownIndicator,
|
|
1318
|
+
Option: CustomOption
|
|
1319
|
+
},
|
|
1320
|
+
styles: customStyles,
|
|
1321
|
+
placeholder: "Select..."
|
|
1322
|
+
}, rest));
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
var _excluded$2 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
|
|
1326
|
+
var CustomCreatable = function CustomCreatable(_ref) {
|
|
1327
|
+
var options = _ref.options,
|
|
1328
|
+
isDisabled = _ref.isDisabled,
|
|
1329
|
+
scrollBottom = _ref.scrollBottom,
|
|
1330
|
+
value = _ref.value,
|
|
1331
|
+
isMulti = _ref.isMulti,
|
|
1332
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
1333
|
+
var initialValues = Array.isArray(value) ? options.filter(function (i) {
|
|
1334
|
+
return value.includes(i.value);
|
|
1335
|
+
}) : isMulti ? options.filter(function (i) {
|
|
1336
|
+
return i.value == value;
|
|
1337
|
+
}) : options.find(function (i) {
|
|
1338
|
+
return i.value == value;
|
|
1339
|
+
});
|
|
1340
|
+
return React.createElement(CreatableSelect, Object.assign({
|
|
1341
|
+
isClearable: true,
|
|
1342
|
+
isDisabled: isDisabled,
|
|
1343
|
+
options: options,
|
|
1344
|
+
value: initialValues,
|
|
1345
|
+
menuPlacement: scrollBottom ? "top" : "auto",
|
|
1346
|
+
isMulti: isMulti,
|
|
1347
|
+
components: {
|
|
1348
|
+
IndicatorSeparator: function IndicatorSeparator() {
|
|
1349
|
+
return null;
|
|
1350
|
+
},
|
|
1351
|
+
DropdownIndicator: DropdownIndicator,
|
|
1352
|
+
Option: CustomOption
|
|
1353
|
+
},
|
|
1354
|
+
styles: customStyles,
|
|
1355
|
+
placeholder: "Select..."
|
|
1356
|
+
}, rest));
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1359
|
+
var _excluded$3 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
|
|
1360
|
+
var CustomSelectOption = function CustomSelectOption(_ref) {
|
|
1361
|
+
var defaultValue = _ref.defaultValue,
|
|
1362
|
+
options = _ref.options,
|
|
1363
|
+
isDisabled = _ref.isDisabled,
|
|
1364
|
+
scrollBottom = _ref.scrollBottom,
|
|
1365
|
+
value = _ref.value,
|
|
1366
|
+
isMulti = _ref.isMulti,
|
|
1367
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
1368
|
+
var initialValues = defaultValue !== null && typeof defaultValue !== "undefined" ? options.find(function (option) {
|
|
1369
|
+
return option.value === defaultValue;
|
|
1370
|
+
}) || null : null;
|
|
1371
|
+
return React.createElement(Select, Object.assign({
|
|
1372
|
+
isDisabled: isDisabled,
|
|
1373
|
+
options: options,
|
|
1374
|
+
value: value,
|
|
1375
|
+
defaultValue: initialValues,
|
|
1376
|
+
menuPlacement: scrollBottom ? "top" : "auto",
|
|
1377
|
+
isMulti: isMulti,
|
|
1378
|
+
components: {
|
|
1379
|
+
IndicatorSeparator: function IndicatorSeparator() {
|
|
1380
|
+
return null;
|
|
1381
|
+
},
|
|
1382
|
+
DropdownIndicator: DropdownIndicator,
|
|
1383
|
+
Option: CustomOption
|
|
1384
|
+
},
|
|
1385
|
+
styles: customStyles,
|
|
1386
|
+
placeholder: "Select..."
|
|
1387
|
+
}, rest));
|
|
1313
1388
|
};
|
|
1314
1389
|
|
|
1315
1390
|
var historyCore = createBrowserHistory();
|
|
1316
1391
|
|
|
1317
|
-
export { ACCESS_TOKEN, BASE_URL, CommonDialog, ConfirmDialog, LayoutContext, Loading, Login, NotFound, api$1 as api, historyCore, setAlert, setLoading, setUser, store };
|
|
1392
|
+
export { ACCESS_TOKEN, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreModal, CoreRadio, CoreSelect, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, LayoutContext, Loading, Login, NotFound, Role, api$1 as api, apiUpload$1 as apiUpload, getErrorMessage, historyCore, setAlert, setLoading, setUser, store, useGoogleSignOut };
|
|
1318
1393
|
//# sourceMappingURL=index.modern.js.map
|