acsi-core 0.1.66 → 0.1.68
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/CoreSearch/index.d.ts +1 -0
- package/dist/index.css +3 -0
- package/dist/index.js +2178 -2065
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +2179 -2065
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createBrowserHistory } from 'history';
|
|
2
2
|
import { createAction, createReducer, configureStore } from '@reduxjs/toolkit';
|
|
3
|
-
import React, { useState,
|
|
4
|
-
import {
|
|
3
|
+
import React, { useState, useRef, useEffect, useCallback, Fragment } from 'react';
|
|
4
|
+
import { FormGroup, Input, Label, Modal, ModalHeader, ModalBody, ModalFooter, Tooltip, Row, Col, Button, Pagination, PaginationItem, PaginationLink } from 'reactstrap';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import moment from 'moment';
|
|
7
7
|
import Cookies from 'js-cookie';
|
|
@@ -10,11 +10,12 @@ import { Link } from 'react-router-dom';
|
|
|
10
10
|
import { useDispatch, useSelector } from 'react-redux';
|
|
11
11
|
import { useGoogleLogin } from '@react-oauth/google';
|
|
12
12
|
export { GoogleOAuthProvider } from '@react-oauth/google';
|
|
13
|
+
import ReactSelect, { components } from 'react-select';
|
|
14
|
+
import { toast } from 'react-toastify';
|
|
15
|
+
export { ToastContainer, toast } from 'react-toastify';
|
|
13
16
|
import { useGoogleLogout } from '@leecheuk/react-google-login';
|
|
14
17
|
import { Box, Typography } from '@mui/material';
|
|
15
|
-
export { ToastContainer, toast } from 'react-toastify';
|
|
16
18
|
import { Identify, identify, track, setUserId, reset as reset$1, init } from '@amplitude/analytics-browser';
|
|
17
|
-
import ReactSelect, { components } from 'react-select';
|
|
18
19
|
import { FaCaretDown } from 'react-icons/fa';
|
|
19
20
|
import CreatableSelect from 'react-select/creatable';
|
|
20
21
|
|
|
@@ -91,7 +92,7 @@ var COLORS = {
|
|
|
91
92
|
var ORGANIZATION_TENANT = "ORGANIZATION_TENANT";
|
|
92
93
|
var ORGANIZATION_TEAM = "ORGANIZATION_TEAM";
|
|
93
94
|
|
|
94
|
-
var styleGlobal = {"signup_wrap":"_1KLz9","box-signin":"_2Jo1o","signin_title":"_3egBO","signup_link":"_1DoIT","google_button":"_34hK_","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","box-right-body":"_JzdCr","box-right-footer":"_19aCA","pr-30":"_2HB5r"};
|
|
95
|
+
var styleGlobal = {"signup_wrap":"_1KLz9","box-signin":"_2Jo1o","signin_title":"_3egBO","signup_link":"_1DoIT","google_button":"_34hK_","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","box-right-body":"_JzdCr","box-right-footer":"_19aCA","pr-30":"_2HB5r","width-400":"_4ehXP"};
|
|
95
96
|
|
|
96
97
|
var api = axios.create({
|
|
97
98
|
baseURL: BASE_URL,
|
|
@@ -211,1333 +212,916 @@ var AmplitudeEvent;
|
|
|
211
212
|
AmplitudeEvent["USER_USAGE"] = "user_usage";
|
|
212
213
|
})(AmplitudeEvent || (AmplitudeEvent = {}));
|
|
213
214
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
setEmail = _ref.setEmail,
|
|
220
|
-
loginWithEmail = _ref.loginWithEmail,
|
|
221
|
-
code = _ref.code,
|
|
222
|
-
setCode = _ref.setCode,
|
|
223
|
-
isScreenCode = _ref.isScreenCode,
|
|
224
|
-
formatTime = _ref.formatTime,
|
|
225
|
-
loginWithEmailCode = _ref.loginWithEmailCode,
|
|
226
|
-
trackEvent = _ref.trackEvent;
|
|
227
|
-
var dispatch = useDispatch();
|
|
228
|
-
var googleLogin = useGoogleLogin({
|
|
229
|
-
onSuccess: function (tokenResponse) {
|
|
230
|
-
try {
|
|
231
|
-
return Promise.resolve(axios.get("https://www.googleapis.com/oauth2/v3/userinfo", {
|
|
232
|
-
headers: {
|
|
233
|
-
Authorization: "Bearer " + tokenResponse.access_token
|
|
234
|
-
}
|
|
235
|
-
})).then(function (userInfo) {
|
|
236
|
-
return function () {
|
|
237
|
-
if (userInfo && userInfo.data) {
|
|
238
|
-
var _userInfo$data = userInfo.data,
|
|
239
|
-
_email = _userInfo$data.email,
|
|
240
|
-
picture = _userInfo$data.picture,
|
|
241
|
-
family_name = _userInfo$data.family_name,
|
|
242
|
-
given_name = _userInfo$data.given_name,
|
|
243
|
-
name = _userInfo$data.name,
|
|
244
|
-
sub = _userInfo$data.sub;
|
|
245
|
-
var accessToken = tokenResponse.access_token;
|
|
246
|
-
var infoLogin = {
|
|
247
|
-
imageUrl: picture,
|
|
248
|
-
fullName: name,
|
|
249
|
-
firstName: family_name,
|
|
250
|
-
lastName: given_name,
|
|
251
|
-
email: _email,
|
|
252
|
-
token: accessToken,
|
|
253
|
-
googleId: sub,
|
|
254
|
-
role: role,
|
|
255
|
-
type: TypeLogin.Google
|
|
256
|
-
};
|
|
257
|
-
dispatch(setLoading(true));
|
|
258
|
-
return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
|
|
259
|
-
var _authResult$data;
|
|
260
|
-
if (((_authResult$data = authResult.data) === null || _authResult$data === void 0 ? void 0 : _authResult$data.id) == null) {
|
|
261
|
-
dispatch(setLoading(false));
|
|
262
|
-
alert("Please contact admin.");
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
localStorage.clear();
|
|
266
|
-
var tokenJWT = authResult.data.token;
|
|
267
|
-
trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
|
|
268
|
-
eventName: AmplitudeEvent.LOGIN,
|
|
269
|
-
eventProperties: {
|
|
270
|
-
email: _email,
|
|
271
|
-
login_method: 'google',
|
|
272
|
-
user_role: authResult.data.role,
|
|
273
|
-
success: true,
|
|
274
|
-
timestamp: new Date().toISOString()
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
if (role === "LandingPage") {
|
|
278
|
-
CookieService.setAuthCookie({
|
|
279
|
-
token: tokenJWT,
|
|
280
|
-
expiresAt: Date.now() + 24 * 60 * 60 * 1000
|
|
281
|
-
});
|
|
282
|
-
var getRedirectUrl = function getRedirectUrl(role) {
|
|
283
|
-
switch (role) {
|
|
284
|
-
case "Admin":
|
|
285
|
-
return ADMIN_ORIGIN;
|
|
286
|
-
case "Teacher":
|
|
287
|
-
return TEACHER_ORIGIN;
|
|
288
|
-
default:
|
|
289
|
-
return role + "." + REQUEST_ORIGIN;
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
var redirectUrl = getRedirectUrl(authResult.data.role);
|
|
293
|
-
window.location.href = redirectUrl + "/dashboard";
|
|
294
|
-
dispatch(setLoading(false));
|
|
295
|
-
}
|
|
296
|
-
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
297
|
-
onNavigate("/dashboard");
|
|
298
|
-
dispatch(setLoading(false));
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
}();
|
|
302
|
-
});
|
|
303
|
-
} catch (e) {
|
|
304
|
-
return Promise.reject(e);
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
onError: function onError(errorResponse) {
|
|
308
|
-
return console.log(errorResponse);
|
|
215
|
+
function _extends() {
|
|
216
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
217
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
218
|
+
var t = arguments[e];
|
|
219
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
309
220
|
}
|
|
310
|
-
|
|
311
|
-
|
|
221
|
+
return n;
|
|
222
|
+
}, _extends.apply(null, arguments);
|
|
223
|
+
}
|
|
224
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
225
|
+
if (null == r) return {};
|
|
226
|
+
var t = {};
|
|
227
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
228
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
229
|
+
t[n] = r[n];
|
|
230
|
+
}
|
|
231
|
+
return t;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
var styles = {"core-button":"_xvNBN","primary":"_U9Qyp","secondary":"_1VzMy","text":"_pZNuj","danger":"_2uYm1","light":"_wxH5S"};
|
|
235
|
+
|
|
236
|
+
var _excluded = ["type", "children", "onClick", "icon", "disabled", "htmlType"];
|
|
237
|
+
var CoreButton = function CoreButton(props) {
|
|
238
|
+
var _props$type = props.type,
|
|
239
|
+
type = _props$type === void 0 ? "primary" : _props$type,
|
|
240
|
+
children = props.children,
|
|
241
|
+
onClick = props.onClick,
|
|
242
|
+
icon = props.icon,
|
|
243
|
+
_props$disabled = props.disabled,
|
|
244
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
245
|
+
_props$htmlType = props.htmlType,
|
|
246
|
+
htmlType = _props$htmlType === void 0 ? "button" : _props$htmlType,
|
|
247
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
248
|
+
return React.createElement("button", Object.assign({
|
|
249
|
+
className: styles["core-button"] + " " + styles[type],
|
|
250
|
+
onClick: onClick,
|
|
251
|
+
disabled: disabled,
|
|
252
|
+
type: htmlType
|
|
253
|
+
}, rest), icon && icon, children);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
var styles$1 = {"core-input":"_1WdX2","outline":"_3X2RJ","no-outline":"_bVYtv","error":"_n7n3Q"};
|
|
257
|
+
|
|
258
|
+
var styles$2 = {"core-error":"_1Mmxr"};
|
|
259
|
+
|
|
260
|
+
var CoreError = function CoreError(props) {
|
|
261
|
+
var message = props.message;
|
|
262
|
+
return React.createElement("div", {
|
|
263
|
+
className: "" + styles$2["core-error"]
|
|
264
|
+
}, React.createElement("p", null, message));
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
var CoreInput = function CoreInput(props) {
|
|
268
|
+
var name = props.name,
|
|
269
|
+
value = props.value,
|
|
270
|
+
_onChange = props.onChange,
|
|
271
|
+
_props$type = props.type,
|
|
272
|
+
type = _props$type === void 0 ? "outline" : _props$type,
|
|
273
|
+
_props$disabled = props.disabled,
|
|
274
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
275
|
+
label = props.label,
|
|
276
|
+
width = props.width,
|
|
277
|
+
_props$placeholder = props.placeholder,
|
|
278
|
+
placeholder = _props$placeholder === void 0 ? "Type here" : _props$placeholder,
|
|
279
|
+
error = props.error,
|
|
280
|
+
_props$errorMessage = props.errorMessage,
|
|
281
|
+
errorMessage = _props$errorMessage === void 0 ? "" : _props$errorMessage,
|
|
282
|
+
fontSize = props.fontSize,
|
|
283
|
+
fontWeight = props.fontWeight,
|
|
284
|
+
_onKeyDown = props.onKeyDown,
|
|
285
|
+
ref = props.ref,
|
|
286
|
+
maxLength = props.maxLength,
|
|
287
|
+
className = props.className,
|
|
288
|
+
onKeyFocus = props.onKeyFocus;
|
|
289
|
+
return React.createElement("div", {
|
|
290
|
+
className: styles$1["core-input"] + " " + styles$1[type] + " " + (error ? styles$1["error"] : ""),
|
|
312
291
|
style: {
|
|
313
|
-
|
|
292
|
+
width: width != null ? width : "100%"
|
|
314
293
|
}
|
|
315
|
-
}, React.createElement(
|
|
316
|
-
sm: 12,
|
|
317
|
-
lg: role != "Admin" ? 7 : 12
|
|
318
|
-
}, React.createElement("div", {
|
|
319
|
-
className: "" + styleGlobal["box-signin-container"]
|
|
320
|
-
}, React.createElement("div", {
|
|
321
|
-
className: styleGlobal["box-signin-logo"] + " "
|
|
322
|
-
}, React.createElement(Link, {
|
|
323
|
-
to: "/",
|
|
324
|
-
className: "d-flex"
|
|
325
|
-
}, React.createElement("img", {
|
|
326
|
-
src: "/images/Logo.png",
|
|
327
|
-
alt: "",
|
|
328
|
-
height: 37,
|
|
329
|
-
width: 155,
|
|
330
|
-
className: "my-auto"
|
|
331
|
-
}))), React.createElement("div", {
|
|
332
|
-
className: styleGlobal["box-signin"] + " "
|
|
333
|
-
}, React.createElement("div", {
|
|
334
|
-
className: "" + styleGlobal["signin_title"]
|
|
335
|
-
}, React.createElement("span", null, "Welcome to Edusfere")), !hiddenSignup && React.createElement("div", {
|
|
336
|
-
className: "" + styleGlobal["signup_link"]
|
|
337
|
-
}, React.createElement("span", null, "Don't have an account?", " ", React.createElement(Link, {
|
|
338
|
-
to: "/",
|
|
294
|
+
}, label && React.createElement("label", null, label), React.createElement("input", Object.assign({
|
|
339
295
|
style: {
|
|
340
|
-
|
|
296
|
+
fontSize: fontSize,
|
|
297
|
+
fontWeight: fontWeight
|
|
341
298
|
},
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
onClick: function onClick() {
|
|
347
|
-
return googleLogin();
|
|
348
|
-
}
|
|
349
|
-
}, React.createElement("img", {
|
|
350
|
-
width: 24,
|
|
351
|
-
height: 24,
|
|
352
|
-
alt: "Google sign-in",
|
|
353
|
-
src: "/images/icons/Google__G__logo.png"
|
|
354
|
-
}), "Sign in with Google")), React.createElement("span", {
|
|
355
|
-
className: "" + styleGlobal["box-field"]
|
|
356
|
-
}, "OR"), isScreenCode ? React.createElement(React.Fragment, null, React.createElement("div", {
|
|
357
|
-
className: "" + styleGlobal["box-input"]
|
|
358
|
-
}, React.createElement("input", {
|
|
359
|
-
type: "text",
|
|
360
|
-
placeholder: "Code OTP",
|
|
361
|
-
value: code,
|
|
362
|
-
onChange: function onChange(event) {
|
|
363
|
-
setCode(event.target.value);
|
|
364
|
-
}
|
|
365
|
-
}), React.createElement("p", {
|
|
366
|
-
className: styleGlobal["box-text"]
|
|
367
|
-
}, "Your code will expire: ", React.createElement("span", null, formatTime()))), React.createElement("button", {
|
|
368
|
-
onClick: function onClick() {
|
|
369
|
-
return loginWithEmailCode(role);
|
|
299
|
+
name: name,
|
|
300
|
+
value: value,
|
|
301
|
+
onChange: function onChange(e) {
|
|
302
|
+
return _onChange(name, e.target.value);
|
|
370
303
|
},
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
alt: "Email sign-in",
|
|
376
|
-
src: "/images/icons/Login_icon.png"
|
|
377
|
-
}), "Login")) : React.createElement(React.Fragment, null, React.createElement("div", {
|
|
378
|
-
className: "" + styleGlobal["box-input"]
|
|
379
|
-
}, React.createElement("input", {
|
|
380
|
-
type: "email",
|
|
381
|
-
placeholder: "Email",
|
|
382
|
-
value: email,
|
|
383
|
-
onChange: function onChange(event) {
|
|
384
|
-
setEmail(event.target.value.trim());
|
|
385
|
-
}
|
|
386
|
-
})), React.createElement("button", {
|
|
387
|
-
onClick: function onClick() {
|
|
388
|
-
!!email && loginWithEmail(role);
|
|
304
|
+
disabled: disabled,
|
|
305
|
+
placeholder: placeholder,
|
|
306
|
+
onKeyDown: function onKeyDown(e) {
|
|
307
|
+
return _onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
|
|
389
308
|
},
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
width: 20,
|
|
393
|
-
height: 20,
|
|
394
|
-
alt: "Email sign-in",
|
|
395
|
-
src: "/images/icons/Login_icon.png"
|
|
396
|
-
}), "Sign in with Email"))), React.createElement("div", {
|
|
397
|
-
className: styleGlobal["box-signin-text"] + " "
|
|
398
|
-
}, React.createElement("span", {
|
|
399
|
-
style: {
|
|
400
|
-
fontSize: "13px",
|
|
401
|
-
color: "#A6A6AD"
|
|
402
|
-
}
|
|
403
|
-
}, "By signing in, you agree to our Terms & Privacy Policy")))), role != "Admin" && role != 'LandingPage' && React.createElement(Col, {
|
|
404
|
-
sm: 12,
|
|
405
|
-
lg: 5,
|
|
406
|
-
className: "d-none d-lg-block " + styleGlobal["pr-30"]
|
|
407
|
-
}, React.createElement("div", {
|
|
408
|
-
className: "" + styleGlobal["box-right"],
|
|
409
|
-
style: {
|
|
410
|
-
backgroundImage: "url('/images/bg_login.png')"
|
|
411
|
-
}
|
|
412
|
-
}, React.createElement("div", {
|
|
413
|
-
className: "" + styleGlobal["box-right-body"]
|
|
414
|
-
}, React.createElement("span", {
|
|
415
|
-
style: {
|
|
416
|
-
fontSize: "24px",
|
|
417
|
-
fontWeight: "700"
|
|
418
|
-
}
|
|
419
|
-
}, "As a teacher, your time and energy are too valuable to waste"), React.createElement("p", {
|
|
420
|
-
className: " fw-normal ",
|
|
421
|
-
style: {
|
|
422
|
-
marginTop: "12px",
|
|
423
|
-
marginBottom: "24px",
|
|
424
|
-
color: "#03191F"
|
|
425
|
-
}
|
|
426
|
-
}, "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) {
|
|
427
|
-
return React.createElement("li", {
|
|
428
|
-
key: it,
|
|
429
|
-
className: "mb-2 ",
|
|
430
|
-
style: {
|
|
431
|
-
color: "#212126"
|
|
432
|
-
}
|
|
433
|
-
}, item);
|
|
434
|
-
})), React.createElement("div", {
|
|
435
|
-
className: "" + styleGlobal["box-right-footer"]
|
|
436
|
-
}, React.createElement("img", {
|
|
437
|
-
className: "img-fluid",
|
|
438
|
-
alt: "",
|
|
439
|
-
src: "/images/image_login.png",
|
|
440
|
-
style: {
|
|
441
|
-
width: "15vw"
|
|
442
|
-
}
|
|
443
|
-
}), 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", {
|
|
444
|
-
className: "d-block"
|
|
445
|
-
}, "Thank you!"), React.createElement("img", {
|
|
446
|
-
style: {
|
|
447
|
-
marginTop: "-15px"
|
|
448
|
-
},
|
|
449
|
-
alt: "",
|
|
450
|
-
src: "/images/icons/Vector 22.png"
|
|
451
|
-
}))))))), role === "LandingPage" && React.createElement(Col, {
|
|
452
|
-
sm: 12,
|
|
453
|
-
lg: 5,
|
|
454
|
-
className: "d-none d-lg-block " + styleGlobal["pr-30"]
|
|
455
|
-
}, React.createElement("div", {
|
|
456
|
-
className: "" + styleGlobal["box-right"],
|
|
457
|
-
style: {
|
|
458
|
-
backgroundImage: "url('/images/bg_login.png')"
|
|
459
|
-
}
|
|
460
|
-
}, React.createElement("div", {
|
|
461
|
-
className: "" + styleGlobal["box-right-body"]
|
|
462
|
-
}, React.createElement("span", {
|
|
463
|
-
style: {
|
|
464
|
-
fontSize: "24px",
|
|
465
|
-
fontWeight: "700"
|
|
466
|
-
}
|
|
467
|
-
}, "Get ready to manage your realm!"), React.createElement("p", {
|
|
468
|
-
className: " fw-normal ",
|
|
469
|
-
style: {
|
|
470
|
-
marginTop: "12px",
|
|
471
|
-
marginBottom: "24px",
|
|
472
|
-
color: "#03191F"
|
|
473
|
-
}
|
|
474
|
-
}, "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) {
|
|
475
|
-
return React.createElement("li", {
|
|
476
|
-
key: it,
|
|
477
|
-
className: "mb-2 ",
|
|
478
|
-
style: {
|
|
479
|
-
color: "#212126"
|
|
480
|
-
}
|
|
481
|
-
}, item);
|
|
482
|
-
})), React.createElement("div", {
|
|
483
|
-
className: "" + styleGlobal["box-right-footer"]
|
|
484
|
-
}, React.createElement("img", {
|
|
485
|
-
className: "img-fluid",
|
|
486
|
-
alt: "",
|
|
487
|
-
src: "/images/image_login.png",
|
|
488
|
-
style: {
|
|
489
|
-
width: "15vw"
|
|
309
|
+
onFocus: function onFocus(e) {
|
|
310
|
+
return onKeyFocus === null || onKeyFocus === void 0 ? void 0 : onKeyFocus(name, e.target.value);
|
|
490
311
|
}
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
alt: "",
|
|
498
|
-
src: "/images/icons/Vector 22.png"
|
|
499
|
-
}))))))));
|
|
312
|
+
}, ref, {
|
|
313
|
+
maxLength: maxLength,
|
|
314
|
+
className: className
|
|
315
|
+
})), error && React.createElement(CoreError, {
|
|
316
|
+
message: errorMessage
|
|
317
|
+
}));
|
|
500
318
|
};
|
|
501
319
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
|
|
505
|
-
|
|
506
|
-
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
|
507
|
-
|
|
508
|
-
// Asynchronously call a function and send errors to recovery continuation
|
|
509
|
-
function _catch(body, recover) {
|
|
510
|
-
try {
|
|
511
|
-
var result = body();
|
|
512
|
-
} catch(e) {
|
|
513
|
-
return recover(e);
|
|
514
|
-
}
|
|
515
|
-
if (result && result.then) {
|
|
516
|
-
return result.then(void 0, recover);
|
|
517
|
-
}
|
|
518
|
-
return result;
|
|
519
|
-
}
|
|
320
|
+
var styles$3 = {"core-select":"_2sg12","label":"_1-XBo"};
|
|
520
321
|
|
|
521
|
-
var
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
322
|
+
var Option = function Option(props) {
|
|
323
|
+
return React.createElement("div", null, React.createElement(components.Option, Object.assign({}, props), React.createElement(CoreInput$1, {
|
|
324
|
+
checked: props.isSelected,
|
|
325
|
+
onChange: function onChange() {
|
|
326
|
+
return null;
|
|
327
|
+
},
|
|
328
|
+
name: "",
|
|
329
|
+
label: props.label
|
|
330
|
+
})));
|
|
526
331
|
};
|
|
527
|
-
var
|
|
528
|
-
var
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
332
|
+
var CoreSelect = function CoreSelect(props) {
|
|
333
|
+
var name = props.name,
|
|
334
|
+
options = props.options,
|
|
335
|
+
value = props.value,
|
|
336
|
+
onChange = props.onChange,
|
|
337
|
+
_props$disabled = props.disabled,
|
|
338
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
339
|
+
label = props.label,
|
|
340
|
+
width = props.width,
|
|
341
|
+
_props$placeholder = props.placeholder,
|
|
342
|
+
placeholder = _props$placeholder === void 0 ? "Select" : _props$placeholder,
|
|
343
|
+
error = props.error,
|
|
344
|
+
_props$errorMessage = props.errorMessage,
|
|
345
|
+
errorMessage = _props$errorMessage === void 0 ? "" : _props$errorMessage,
|
|
346
|
+
_props$type = props.type,
|
|
347
|
+
type = _props$type === void 0 ? "outline" : _props$type,
|
|
348
|
+
_props$isMulti = props.isMulti,
|
|
349
|
+
isMulti = _props$isMulti === void 0 ? false : _props$isMulti,
|
|
350
|
+
_props$closeMenuOnSel = props.closeMenuOnSelect,
|
|
351
|
+
closeMenuOnSelect = _props$closeMenuOnSel === void 0 ? true : _props$closeMenuOnSel,
|
|
352
|
+
_props$hideSelectedOp = props.hideSelectedOptions,
|
|
353
|
+
hideSelectedOptions = _props$hideSelectedOp === void 0 ? true : _props$hideSelectedOp;
|
|
354
|
+
var handleChange = function handleChange(e) {
|
|
355
|
+
var newValue = isMulti ? e.map(function (item) {
|
|
356
|
+
return item.value;
|
|
357
|
+
}) : e === null || e === void 0 ? void 0 : e.value;
|
|
358
|
+
onChange(name, newValue);
|
|
359
|
+
};
|
|
360
|
+
var controlStyle = function controlStyle(base, state) {
|
|
361
|
+
var styles = _extends({}, base, {
|
|
362
|
+
fontSize: "14px",
|
|
363
|
+
fontWeight: "400",
|
|
364
|
+
padding: "0 4px",
|
|
365
|
+
borderRadius: "8px",
|
|
366
|
+
backgroundColor: state.isDisabled ? COLORS.lightGrayBg : COLORS.white,
|
|
367
|
+
border: state.isFocused ? "2px solid " + (!error ? COLORS.brandBlue : COLORS.red) : "1px solid " + (!error ? COLORS.grayLines : COLORS.red),
|
|
368
|
+
height: isMulti ? undefined : "32px",
|
|
369
|
+
minHeight: 0,
|
|
370
|
+
boxShadow: "none"
|
|
371
|
+
});
|
|
372
|
+
switch (type) {
|
|
373
|
+
case "outline":
|
|
374
|
+
styles.overflow = "hidden";
|
|
375
|
+
styles[":hover"] = {
|
|
376
|
+
backgroundColor: COLORS.lightBlueHover
|
|
561
377
|
};
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
eventProperties: {
|
|
571
|
-
email: email,
|
|
572
|
-
login_method: 'email',
|
|
573
|
-
timestamp: new Date().toISOString()
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
onNavigate("/dashboard");
|
|
577
|
-
} else {
|
|
578
|
-
setIsScreenCode(true);
|
|
579
|
-
}
|
|
580
|
-
} else {
|
|
581
|
-
dispatch(setLoading(false));
|
|
582
|
-
alert("Please contact admin.");
|
|
583
|
-
}
|
|
584
|
-
});
|
|
585
|
-
}, function (e) {
|
|
586
|
-
console.log(e);
|
|
587
|
-
});
|
|
588
|
-
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
|
589
|
-
} catch (e) {
|
|
590
|
-
return Promise.reject(e);
|
|
378
|
+
break;
|
|
379
|
+
case "no-outline":
|
|
380
|
+
styles.border = "none";
|
|
381
|
+
styles.padding = 0;
|
|
382
|
+
styles["&>div"] = {
|
|
383
|
+
padding: 0
|
|
384
|
+
};
|
|
385
|
+
break;
|
|
591
386
|
}
|
|
387
|
+
return styles;
|
|
592
388
|
};
|
|
593
|
-
var
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
return Promise.resolve(apiCheckEmailCode({
|
|
601
|
-
email: email,
|
|
602
|
-
code: code,
|
|
603
|
-
role: role
|
|
604
|
-
})).then(function (res) {
|
|
605
|
-
var data = res.data;
|
|
606
|
-
if (data.status == 1) {
|
|
607
|
-
localStorage.clear();
|
|
608
|
-
var tokenJWT = data.data.token;
|
|
609
|
-
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
610
|
-
trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
|
|
611
|
-
eventName: AmplitudeEvent.LOGIN,
|
|
612
|
-
eventProperties: {
|
|
613
|
-
email: email,
|
|
614
|
-
login_method: 'email',
|
|
615
|
-
timestamp: new Date().toISOString()
|
|
616
|
-
}
|
|
617
|
-
});
|
|
618
|
-
onNavigate("/dashboard");
|
|
619
|
-
} else {
|
|
620
|
-
dispatch(setLoading(false));
|
|
621
|
-
alert("The code is not correct. Please check again.");
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
}, function (e) {
|
|
625
|
-
console.log(e);
|
|
626
|
-
});
|
|
627
|
-
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
|
628
|
-
} catch (e) {
|
|
629
|
-
return Promise.reject(e);
|
|
630
|
-
}
|
|
389
|
+
var inputStyles = function inputStyles(base) {
|
|
390
|
+
var styles = _extends({}, base, {
|
|
391
|
+
margin: "0",
|
|
392
|
+
padding: "0",
|
|
393
|
+
color: "inherit"
|
|
394
|
+
});
|
|
395
|
+
return styles;
|
|
631
396
|
};
|
|
632
|
-
var
|
|
633
|
-
var
|
|
634
|
-
|
|
635
|
-
|
|
397
|
+
var placeholderStyles = function placeholderStyles(base) {
|
|
398
|
+
var styles = _extends({}, base, {
|
|
399
|
+
color: COLORS.lightGray
|
|
400
|
+
});
|
|
401
|
+
return styles;
|
|
636
402
|
};
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
403
|
+
var dropdownIndicatorStyles = function dropdownIndicatorStyles(base) {
|
|
404
|
+
var styles = _extends({}, base, {
|
|
405
|
+
position: "relative",
|
|
406
|
+
top: "-4px",
|
|
407
|
+
padding: "8px 0"
|
|
408
|
+
});
|
|
409
|
+
return styles;
|
|
410
|
+
};
|
|
411
|
+
var valueContainerStyles = function valueContainerStyles(base) {
|
|
412
|
+
var styles = _extends({}, base, {
|
|
413
|
+
height: isMulti ? undefined : "32px",
|
|
414
|
+
position: "relative",
|
|
415
|
+
top: "-3px"
|
|
416
|
+
});
|
|
417
|
+
return styles;
|
|
418
|
+
};
|
|
419
|
+
var singleValueStyles = function singleValueStyles(base) {
|
|
420
|
+
var styles = _extends({}, base);
|
|
421
|
+
return styles;
|
|
422
|
+
};
|
|
423
|
+
var optionStyles = function optionStyles(base, state) {
|
|
424
|
+
var styles = _extends({}, base, {
|
|
425
|
+
padding: "8px",
|
|
426
|
+
borderRadius: "8px",
|
|
427
|
+
cursor: "pointer",
|
|
428
|
+
fontSize: "14px",
|
|
429
|
+
fontWeight: 400,
|
|
430
|
+
backgroundColor: state.isSelected ? COLORS.lightBlueHover : "transparent",
|
|
431
|
+
"&:hover": {
|
|
432
|
+
backgroundColor: COLORS.lightBlueHover
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
return styles;
|
|
436
|
+
};
|
|
437
|
+
var indicatorsContainerStyles = function indicatorsContainerStyles(base) {
|
|
438
|
+
var styles = _extends({}, base, {
|
|
439
|
+
display: type === "no-outline" ? "none" : "block"
|
|
440
|
+
});
|
|
441
|
+
return styles;
|
|
442
|
+
};
|
|
443
|
+
var multiValueStyles = function multiValueStyles(base) {
|
|
444
|
+
var styles = _extends({}, base, {
|
|
445
|
+
backgroundColor: COLORS.lightBlue,
|
|
446
|
+
borderRadius: "4px",
|
|
447
|
+
padding: "2px 8px",
|
|
448
|
+
display: "flex",
|
|
449
|
+
alignItems: "center",
|
|
450
|
+
fontSize: "13px",
|
|
451
|
+
color: COLORS.blackText
|
|
452
|
+
});
|
|
453
|
+
return styles;
|
|
454
|
+
};
|
|
455
|
+
var multiValueRemoveStyles = function multiValueRemoveStyles(base) {
|
|
456
|
+
var styles = _extends({}, base, {
|
|
457
|
+
color: COLORS.lightGray,
|
|
458
|
+
cursor: "pointer"
|
|
459
|
+
});
|
|
460
|
+
return styles;
|
|
461
|
+
};
|
|
462
|
+
var multiValueLabelStyles = function multiValueLabelStyles(base) {
|
|
463
|
+
var styles = _extends({}, base, {
|
|
464
|
+
color: COLORS.blackText,
|
|
465
|
+
fontWeight: "400",
|
|
466
|
+
fontSize: "13px",
|
|
467
|
+
padding: 0
|
|
468
|
+
});
|
|
469
|
+
return styles;
|
|
668
470
|
};
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
var Login = function Login(props) {
|
|
672
|
-
var onNavigate = props.onNavigate,
|
|
673
|
-
role = props.role,
|
|
674
|
-
hiddenSignup = props.hiddenSignup,
|
|
675
|
-
trackEvent = props.trackEvent;
|
|
676
|
-
var _useLogin = useLogin(onNavigate, trackEvent),
|
|
677
|
-
defaultInfo = _useLogin.defaultInfo,
|
|
678
|
-
email = _useLogin.email,
|
|
679
|
-
setEmail = _useLogin.setEmail,
|
|
680
|
-
loginWithEmail = _useLogin.loginWithEmail,
|
|
681
|
-
code = _useLogin.code,
|
|
682
|
-
setCode = _useLogin.setCode,
|
|
683
|
-
isScreenCode = _useLogin.isScreenCode,
|
|
684
|
-
formatTime = _useLogin.formatTime,
|
|
685
|
-
loginWithEmailCode = _useLogin.loginWithEmailCode;
|
|
686
471
|
return React.createElement("div", {
|
|
687
|
-
className:
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
472
|
+
className: "" + styles$3["core-select"],
|
|
473
|
+
style: {
|
|
474
|
+
width: width != null ? width : "100%"
|
|
475
|
+
}
|
|
476
|
+
}, label && React.createElement("span", {
|
|
477
|
+
className: styles$3["label"]
|
|
478
|
+
}, label), React.createElement(ReactSelect, {
|
|
479
|
+
name: name,
|
|
480
|
+
value: options.filter(function (i) {
|
|
481
|
+
return value && (isMulti ? value.includes(i.value) : i.value === value);
|
|
482
|
+
}),
|
|
483
|
+
onChange: handleChange,
|
|
484
|
+
placeholder: placeholder,
|
|
485
|
+
isDisabled: disabled,
|
|
486
|
+
isMulti: isMulti,
|
|
487
|
+
closeMenuOnSelect: closeMenuOnSelect,
|
|
488
|
+
hideSelectedOptions: hideSelectedOptions,
|
|
489
|
+
options: options,
|
|
490
|
+
components: isMulti ? {
|
|
491
|
+
Option: Option
|
|
492
|
+
} : undefined,
|
|
493
|
+
styles: {
|
|
494
|
+
control: controlStyle,
|
|
495
|
+
input: inputStyles,
|
|
496
|
+
placeholder: placeholderStyles,
|
|
497
|
+
dropdownIndicator: dropdownIndicatorStyles,
|
|
498
|
+
indicatorSeparator: function indicatorSeparator() {
|
|
499
|
+
return {
|
|
500
|
+
display: "none"
|
|
501
|
+
};
|
|
502
|
+
},
|
|
503
|
+
indicatorsContainer: indicatorsContainerStyles,
|
|
504
|
+
valueContainer: valueContainerStyles,
|
|
505
|
+
singleValue: singleValueStyles,
|
|
506
|
+
option: optionStyles,
|
|
507
|
+
multiValue: multiValueStyles,
|
|
508
|
+
multiValueRemove: multiValueRemoveStyles,
|
|
509
|
+
multiValueLabel: multiValueLabelStyles
|
|
510
|
+
}
|
|
511
|
+
}), error && React.createElement(CoreError, {
|
|
512
|
+
message: errorMessage
|
|
702
513
|
}));
|
|
703
514
|
};
|
|
704
515
|
|
|
705
|
-
|
|
706
|
-
function formatProdErrorMessage(code) {
|
|
707
|
-
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
// src/utils/actionTypes.ts
|
|
711
|
-
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
712
|
-
var ActionTypes = {
|
|
713
|
-
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
714
|
-
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
715
|
-
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
716
|
-
};
|
|
717
|
-
var actionTypes_default = ActionTypes;
|
|
718
|
-
|
|
719
|
-
// src/utils/isPlainObject.ts
|
|
720
|
-
function isPlainObject(obj) {
|
|
721
|
-
if (typeof obj !== "object" || obj === null)
|
|
722
|
-
return false;
|
|
723
|
-
let proto = obj;
|
|
724
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
725
|
-
proto = Object.getPrototypeOf(proto);
|
|
726
|
-
}
|
|
727
|
-
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
728
|
-
}
|
|
516
|
+
var styles$4 = {"core-checkbox":"_3HY4f"};
|
|
729
517
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
case "Promise":
|
|
756
|
-
case "WeakMap":
|
|
757
|
-
case "WeakSet":
|
|
758
|
-
case "Map":
|
|
759
|
-
case "Set":
|
|
760
|
-
return constructorName;
|
|
761
|
-
}
|
|
762
|
-
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
763
|
-
}
|
|
764
|
-
function ctorName(val) {
|
|
765
|
-
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
766
|
-
}
|
|
767
|
-
function isError(val) {
|
|
768
|
-
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
769
|
-
}
|
|
770
|
-
function isDate(val) {
|
|
771
|
-
if (val instanceof Date)
|
|
772
|
-
return true;
|
|
773
|
-
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
774
|
-
}
|
|
775
|
-
function kindOf(val) {
|
|
776
|
-
let typeOfVal = typeof val;
|
|
777
|
-
if (process.env.NODE_ENV !== "production") {
|
|
778
|
-
typeOfVal = miniKindOf(val);
|
|
779
|
-
}
|
|
780
|
-
return typeOfVal;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
// src/utils/warning.ts
|
|
784
|
-
function warning(message) {
|
|
785
|
-
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
786
|
-
console.error(message);
|
|
787
|
-
}
|
|
788
|
-
try {
|
|
789
|
-
throw new Error(message);
|
|
790
|
-
} catch (e) {
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
// src/combineReducers.ts
|
|
795
|
-
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
796
|
-
const reducerKeys = Object.keys(reducers);
|
|
797
|
-
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
798
|
-
if (reducerKeys.length === 0) {
|
|
799
|
-
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
800
|
-
}
|
|
801
|
-
if (!isPlainObject(inputState)) {
|
|
802
|
-
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
803
|
-
}
|
|
804
|
-
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
805
|
-
unexpectedKeys.forEach((key) => {
|
|
806
|
-
unexpectedKeyCache[key] = true;
|
|
807
|
-
});
|
|
808
|
-
if (action && action.type === actionTypes_default.REPLACE)
|
|
809
|
-
return;
|
|
810
|
-
if (unexpectedKeys.length > 0) {
|
|
811
|
-
return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
function assertReducerShape(reducers) {
|
|
815
|
-
Object.keys(reducers).forEach((key) => {
|
|
816
|
-
const reducer = reducers[key];
|
|
817
|
-
const initialState = reducer(void 0, {
|
|
818
|
-
type: actionTypes_default.INIT
|
|
819
|
-
});
|
|
820
|
-
if (typeof initialState === "undefined") {
|
|
821
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
822
|
-
}
|
|
823
|
-
if (typeof reducer(void 0, {
|
|
824
|
-
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
825
|
-
}) === "undefined") {
|
|
826
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
827
|
-
}
|
|
828
|
-
});
|
|
829
|
-
}
|
|
830
|
-
function combineReducers(reducers) {
|
|
831
|
-
const reducerKeys = Object.keys(reducers);
|
|
832
|
-
const finalReducers = {};
|
|
833
|
-
for (let i = 0; i < reducerKeys.length; i++) {
|
|
834
|
-
const key = reducerKeys[i];
|
|
835
|
-
if (process.env.NODE_ENV !== "production") {
|
|
836
|
-
if (typeof reducers[key] === "undefined") {
|
|
837
|
-
warning(`No reducer provided for key "${key}"`);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
if (typeof reducers[key] === "function") {
|
|
841
|
-
finalReducers[key] = reducers[key];
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
const finalReducerKeys = Object.keys(finalReducers);
|
|
845
|
-
let unexpectedKeyCache;
|
|
846
|
-
if (process.env.NODE_ENV !== "production") {
|
|
847
|
-
unexpectedKeyCache = {};
|
|
848
|
-
}
|
|
849
|
-
let shapeAssertionError;
|
|
850
|
-
try {
|
|
851
|
-
assertReducerShape(finalReducers);
|
|
852
|
-
} catch (e) {
|
|
853
|
-
shapeAssertionError = e;
|
|
854
|
-
}
|
|
855
|
-
return function combination(state = {}, action) {
|
|
856
|
-
if (shapeAssertionError) {
|
|
857
|
-
throw shapeAssertionError;
|
|
858
|
-
}
|
|
859
|
-
if (process.env.NODE_ENV !== "production") {
|
|
860
|
-
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
861
|
-
if (warningMessage) {
|
|
862
|
-
warning(warningMessage);
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
let hasChanged = false;
|
|
866
|
-
const nextState = {};
|
|
867
|
-
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
868
|
-
const key = finalReducerKeys[i];
|
|
869
|
-
const reducer = finalReducers[key];
|
|
870
|
-
const previousStateForKey = state[key];
|
|
871
|
-
const nextStateForKey = reducer(previousStateForKey, action);
|
|
872
|
-
if (typeof nextStateForKey === "undefined") {
|
|
873
|
-
const actionType = action && action.type;
|
|
874
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
875
|
-
}
|
|
876
|
-
nextState[key] = nextStateForKey;
|
|
877
|
-
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
878
|
-
}
|
|
879
|
-
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
880
|
-
return hasChanged ? nextState : state;
|
|
881
|
-
};
|
|
882
|
-
}
|
|
883
|
-
//# sourceMappingURL=redux.mjs.map
|
|
884
|
-
|
|
885
|
-
var initialState = {
|
|
886
|
-
isLoading: false,
|
|
887
|
-
isLoadingPage: false,
|
|
888
|
-
alert: {
|
|
889
|
-
type: "",
|
|
890
|
-
message: ""
|
|
891
|
-
},
|
|
892
|
-
user: null,
|
|
893
|
-
academy: null,
|
|
894
|
-
menuCollapse: false,
|
|
895
|
-
isRefetchSidebar: false
|
|
896
|
-
};
|
|
897
|
-
var commonReducer = createReducer(initialState, function (builder) {
|
|
898
|
-
builder.addCase(setLoading, function (state, action) {
|
|
899
|
-
state.isLoading = action.payload;
|
|
900
|
-
}).addCase(setLoadingPage, function (state, action) {
|
|
901
|
-
state.isLoadingPage = action.payload;
|
|
902
|
-
}).addCase(setAlert, function (state, action) {
|
|
903
|
-
state.alert = action.payload;
|
|
904
|
-
}).addCase(setUser, function (state, action) {
|
|
905
|
-
state.user = action.payload;
|
|
906
|
-
}).addCase(setLanguage, function (state, action) {
|
|
907
|
-
state.language = action.payload;
|
|
908
|
-
}).addCase(reset, function (_state, _action) {
|
|
909
|
-
return initialState;
|
|
910
|
-
}).addCase(setMenuCollapse, function (state, action) {
|
|
911
|
-
state.menuCollapse = action.payload;
|
|
912
|
-
}).addCase(setIsRefetchSidebar, function (state) {
|
|
913
|
-
state.isRefetchSidebar = !state.isRefetchSidebar;
|
|
914
|
-
}).addCase(setTenant, function (state, action) {
|
|
915
|
-
state.user.currentTenantId = action.payload;
|
|
916
|
-
}).addCase(setAddTenant, function (state, action) {
|
|
917
|
-
state.user.tenantInfo = action.payload;
|
|
918
|
-
}).addCase(setTeam, function (state, action) {
|
|
919
|
-
state.user.currentTeamId = action.payload;
|
|
920
|
-
});
|
|
921
|
-
});
|
|
922
|
-
|
|
923
|
-
var rootReducer = combineReducers({
|
|
924
|
-
common: commonReducer
|
|
925
|
-
});
|
|
926
|
-
|
|
927
|
-
var store = configureStore({
|
|
928
|
-
reducer: rootReducer,
|
|
929
|
-
middleware: function middleware(getDefaultMiddleware) {
|
|
930
|
-
return getDefaultMiddleware({
|
|
931
|
-
serializableCheck: false
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
});
|
|
935
|
-
|
|
936
|
-
var getAccessToken$1 = (function () {
|
|
937
|
-
try {
|
|
938
|
-
return localStorage.getItem(ACCESS_TOKEN);
|
|
939
|
-
} catch (err) {
|
|
940
|
-
return null;
|
|
941
|
-
}
|
|
942
|
-
});
|
|
943
|
-
|
|
944
|
-
var encodeParams$1 = (function (params) {
|
|
945
|
-
return Object.keys(params).filter(function (key) {
|
|
946
|
-
return params[key] || params[key] === 0 || params[key] === false;
|
|
947
|
-
}).map(function (key) {
|
|
948
|
-
if (Array.isArray(params[key])) {
|
|
949
|
-
return params[key].map(function (i) {
|
|
950
|
-
return encodeURIComponent(key) + "=" + encodeURIComponent(i);
|
|
951
|
-
}).join('&');
|
|
952
|
-
}
|
|
953
|
-
return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
|
|
954
|
-
}).join('&');
|
|
955
|
-
});
|
|
956
|
-
|
|
957
|
-
var api$1 = axios.create({
|
|
958
|
-
baseURL: BASE_URL,
|
|
959
|
-
timeout: 0,
|
|
960
|
-
headers: {
|
|
961
|
-
"Content-Type": "application/json"
|
|
962
|
-
},
|
|
963
|
-
paramsSerializer: function paramsSerializer(params) {
|
|
964
|
-
return encodeParams$1(params);
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
var apiUpload$1 = axios.create({
|
|
968
|
-
baseURL: BASE_URL,
|
|
969
|
-
timeout: 60000,
|
|
970
|
-
headers: {
|
|
971
|
-
"Content-Type": "multipart/form-data"
|
|
972
|
-
}
|
|
973
|
-
});
|
|
974
|
-
[api$1, apiUpload$1].forEach(function (i) {
|
|
975
|
-
return i.interceptors.request.use(function (config) {
|
|
976
|
-
var token = getAccessToken$1();
|
|
977
|
-
if (token) {
|
|
978
|
-
config.headers.Authorization = "Bearer " + token;
|
|
979
|
-
}
|
|
980
|
-
return config;
|
|
981
|
-
}, function (error) {
|
|
982
|
-
return Promise.reject(error);
|
|
983
|
-
});
|
|
984
|
-
});
|
|
985
|
-
[api$1, apiUpload$1].forEach(function (i) {
|
|
986
|
-
return i.interceptors.response.use(function (response) {
|
|
987
|
-
return response;
|
|
988
|
-
}, function (error) {
|
|
989
|
-
if (error.response.status === 401) {
|
|
990
|
-
window.location.href = "/login";
|
|
991
|
-
}
|
|
992
|
-
if (error.response.status == 403) {
|
|
993
|
-
var hostname = window.location.hostname;
|
|
994
|
-
var parts = hostname.split('.');
|
|
995
|
-
var domain = parts.slice(-2).join('.');
|
|
996
|
-
localStorage.removeItem(ACCESS_TOKEN);
|
|
997
|
-
localStorage.removeItem(ORGANIZATION_TENANT);
|
|
998
|
-
localStorage.removeItem(ORGANIZATION_TEAM);
|
|
999
|
-
Cookies.remove('auth', {
|
|
1000
|
-
path: '/',
|
|
1001
|
-
domain: "." + domain
|
|
1002
|
-
});
|
|
1003
|
-
localStorage.removeItem("USER_EMAIL");
|
|
1004
|
-
window.location.href = "/login";
|
|
1005
|
-
}
|
|
1006
|
-
return Promise.reject(error);
|
|
1007
|
-
});
|
|
1008
|
-
});
|
|
1009
|
-
|
|
1010
|
-
var AUTH_URL = BASE_URL + "/api/auth";
|
|
1011
|
-
var checkToken = function checkToken(token) {
|
|
1012
|
-
return api$1.post(AUTH_URL + "/checktoken", {
|
|
1013
|
-
token: token
|
|
1014
|
-
});
|
|
518
|
+
var CoreInput$1 = function CoreInput(props) {
|
|
519
|
+
var name = props.name,
|
|
520
|
+
checked = props.checked,
|
|
521
|
+
_onChange = props.onChange,
|
|
522
|
+
_props$disabled = props.disabled,
|
|
523
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
524
|
+
label = props.label;
|
|
525
|
+
return React.createElement("div", {
|
|
526
|
+
className: "" + styles$4["core-checkbox"]
|
|
527
|
+
}, React.createElement(FormGroup, {
|
|
528
|
+
check: true,
|
|
529
|
+
inline: true
|
|
530
|
+
}, React.createElement(Input, {
|
|
531
|
+
id: "core-checkbox-" + name,
|
|
532
|
+
type: "checkbox",
|
|
533
|
+
name: name,
|
|
534
|
+
checked: checked,
|
|
535
|
+
onChange: function onChange(e) {
|
|
536
|
+
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(name, e.target.checked);
|
|
537
|
+
},
|
|
538
|
+
disabled: disabled
|
|
539
|
+
}), React.createElement(Label, {
|
|
540
|
+
htmlFor: "core-checkbox-" + name,
|
|
541
|
+
check: true
|
|
542
|
+
}, label)));
|
|
1015
543
|
};
|
|
1016
544
|
|
|
1017
|
-
var
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
545
|
+
var styles$5 = {"core-radio":"_kvUpe","form-check":"_3ToPe"};
|
|
546
|
+
|
|
547
|
+
var CoreRadio = function CoreRadio(props) {
|
|
548
|
+
var name = props.name,
|
|
549
|
+
value = props.value,
|
|
550
|
+
options = props.options,
|
|
551
|
+
onChange = props.onChange,
|
|
552
|
+
_props$disabled = props.disabled,
|
|
553
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled;
|
|
554
|
+
return React.createElement("div", {
|
|
555
|
+
className: "" + styles$5["core-radio"]
|
|
556
|
+
}, React.createElement(FormGroup, {
|
|
557
|
+
check: true
|
|
558
|
+
}, options.map(function (i) {
|
|
559
|
+
return React.createElement("div", {
|
|
560
|
+
key: i.value
|
|
561
|
+
}, React.createElement(Input, {
|
|
562
|
+
id: "core-radio-" + i.value,
|
|
563
|
+
type: "radio",
|
|
564
|
+
checked: value === i.value,
|
|
565
|
+
onClick: function onClick() {
|
|
566
|
+
onChange(name, i.value);
|
|
567
|
+
},
|
|
568
|
+
onChange: function onChange() {
|
|
569
|
+
return;
|
|
570
|
+
},
|
|
571
|
+
disabled: disabled || i.disabled
|
|
572
|
+
}), React.createElement(Label, {
|
|
573
|
+
htmlFor: "core-radio-" + i.value
|
|
574
|
+
}, i.label));
|
|
575
|
+
})));
|
|
1026
576
|
};
|
|
1027
577
|
|
|
1028
|
-
var
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
578
|
+
var styles$6 = {"core-modal-header":"_2y5ln"};
|
|
579
|
+
|
|
580
|
+
var CoreModal = function CoreModal(props) {
|
|
581
|
+
var open = props.open,
|
|
582
|
+
onClose = props.onClose,
|
|
583
|
+
children = props.children,
|
|
584
|
+
title = props.title,
|
|
585
|
+
footer = props.footer,
|
|
586
|
+
handleSubmit = props.handleSubmit,
|
|
587
|
+
onSubmit = props.onSubmit,
|
|
588
|
+
_props$bodyPadding = props.bodyPadding,
|
|
589
|
+
bodyPadding = _props$bodyPadding === void 0 ? "24px" : _props$bodyPadding,
|
|
590
|
+
className = props.className;
|
|
591
|
+
return React.createElement(Modal, {
|
|
592
|
+
isOpen: open,
|
|
593
|
+
toggle: onClose,
|
|
594
|
+
centered: true,
|
|
595
|
+
modalClassName: className
|
|
596
|
+
}, React.createElement("form", {
|
|
597
|
+
onSubmit: onSubmit ? handleSubmit(onSubmit) : undefined,
|
|
598
|
+
className: "" + styles$6["core-modal-container"]
|
|
599
|
+
}, React.createElement(ModalHeader, {
|
|
600
|
+
toggle: onClose,
|
|
601
|
+
className: styles$6["core-modal-header"]
|
|
602
|
+
}, title), React.createElement(ModalBody, {
|
|
603
|
+
style: {
|
|
604
|
+
padding: bodyPadding
|
|
1036
605
|
}
|
|
1037
|
-
|
|
1038
|
-
} catch (err) {
|
|
1039
|
-
return "/images/avatar-default.png";
|
|
1040
|
-
}
|
|
606
|
+
}, children), footer && React.createElement(ModalFooter, null, footer)));
|
|
1041
607
|
};
|
|
1042
608
|
|
|
1043
|
-
var
|
|
609
|
+
var styles$7 = {"core-range":"_1dzD7"};
|
|
610
|
+
|
|
611
|
+
var CoreRange = function CoreRange(props) {
|
|
612
|
+
var name = props.name,
|
|
613
|
+
value = props.value,
|
|
614
|
+
_onChange = props.onChange,
|
|
615
|
+
label = props.label,
|
|
616
|
+
width = props.width,
|
|
617
|
+
min = props.min,
|
|
618
|
+
max = props.max,
|
|
619
|
+
step = props.step;
|
|
1044
620
|
return React.createElement("div", {
|
|
1045
|
-
className: "
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
621
|
+
className: "" + styles$7["core-range"],
|
|
622
|
+
style: {
|
|
623
|
+
width: width != null ? width : "100%"
|
|
624
|
+
}
|
|
625
|
+
}, label && React.createElement("label", null, label), React.createElement("input", {
|
|
626
|
+
type: "range",
|
|
627
|
+
name: name,
|
|
628
|
+
value: value,
|
|
629
|
+
onChange: function onChange(e) {
|
|
630
|
+
return _onChange(name, +e.target.value);
|
|
631
|
+
},
|
|
632
|
+
min: min,
|
|
633
|
+
max: max,
|
|
634
|
+
step: step
|
|
635
|
+
}));
|
|
1057
636
|
};
|
|
1058
637
|
|
|
1059
|
-
var
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
638
|
+
var styles$8 = {"editor":"_3TUh3","label":"_15n2K","optional":"_1fHZB","icon":"_38AfS","error":"_DaofN","no-border":"_2JOcF","small-height":"_1EXev"};
|
|
639
|
+
|
|
640
|
+
var Search = function Search(props) {
|
|
641
|
+
var _props$size = props.size,
|
|
642
|
+
size = _props$size === void 0 ? 16 : _props$size,
|
|
643
|
+
_props$color = props.color,
|
|
644
|
+
color = _props$color === void 0 ? "#A6A6AD" : _props$color;
|
|
645
|
+
return React.createElement("svg", {
|
|
646
|
+
width: size,
|
|
647
|
+
height: size,
|
|
648
|
+
viewBox: "0 0 16 16",
|
|
649
|
+
fill: "none",
|
|
650
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
651
|
+
}, React.createElement("path", {
|
|
652
|
+
fillRule: "evenodd",
|
|
653
|
+
clipRule: "evenodd",
|
|
654
|
+
d: "M9.40376 9.40352C9.63808 9.1692 10.018 9.1692 10.2523 9.40352L13.4243 12.5755C13.6586 12.8098 13.6586 13.1897 13.4243 13.424C13.19 13.6584 12.8101 13.6584 12.5758 13.424L9.40376 10.252C9.16945 10.0177 9.16945 9.63783 9.40376 9.40352Z",
|
|
655
|
+
fill: color
|
|
656
|
+
}), React.createElement("path", {
|
|
657
|
+
fillRule: "evenodd",
|
|
658
|
+
clipRule: "evenodd",
|
|
659
|
+
d: "M6.9999 3.5999C5.12213 3.5999 3.5999 5.12213 3.5999 6.9999C3.5999 8.87767 5.12213 10.3999 6.9999 10.3999C8.87767 10.3999 10.3999 8.87767 10.3999 6.9999C10.3999 5.12213 8.87767 3.5999 6.9999 3.5999ZM2.3999 6.9999C2.3999 4.45939 4.45939 2.3999 6.9999 2.3999C9.54041 2.3999 11.5999 4.45939 11.5999 6.9999C11.5999 9.54041 9.54041 11.5999 6.9999 11.5999C4.45939 11.5999 2.3999 9.54041 2.3999 6.9999Z",
|
|
660
|
+
fill: color
|
|
661
|
+
}));
|
|
1070
662
|
};
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
}
|
|
663
|
+
|
|
664
|
+
var Close = function Close(props) {
|
|
665
|
+
var _props$color = props.color,
|
|
666
|
+
color = _props$color === void 0 ? "#A6A6AD" : _props$color,
|
|
667
|
+
_props$size = props.size,
|
|
668
|
+
size = _props$size === void 0 ? 16 : _props$size;
|
|
669
|
+
return React.createElement("svg", {
|
|
670
|
+
width: size,
|
|
671
|
+
height: size,
|
|
672
|
+
viewBox: "0 0 16 16",
|
|
673
|
+
fill: "none",
|
|
674
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
675
|
+
}, React.createElement("g", {
|
|
676
|
+
clipPath: "url(#clip0_1060_48455)"
|
|
677
|
+
}, React.createElement("rect", {
|
|
678
|
+
x: "2.48438",
|
|
679
|
+
y: "3.61597",
|
|
680
|
+
width: "1.6",
|
|
681
|
+
height: "14",
|
|
682
|
+
rx: "0.8",
|
|
683
|
+
transform: "rotate(-45 2.48438 3.61597)",
|
|
684
|
+
fill: color
|
|
685
|
+
}), React.createElement("rect", {
|
|
686
|
+
x: "12.2427",
|
|
687
|
+
y: "2.34326",
|
|
688
|
+
width: "1.6",
|
|
689
|
+
height: "14",
|
|
690
|
+
rx: "0.8",
|
|
691
|
+
transform: "rotate(45 12.2427 2.34326)",
|
|
692
|
+
fill: color
|
|
693
|
+
})), React.createElement("defs", null, React.createElement("clipPath", {
|
|
694
|
+
id: "clip0_1060_48455"
|
|
695
|
+
}, React.createElement("rect", {
|
|
696
|
+
width: "16",
|
|
697
|
+
height: "16",
|
|
698
|
+
fill: "white"
|
|
699
|
+
}))));
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
var Info = function Info() {
|
|
703
|
+
return React.createElement("svg", {
|
|
704
|
+
width: "16",
|
|
705
|
+
height: "16",
|
|
706
|
+
viewBox: "0 0 12 12",
|
|
707
|
+
fill: "none",
|
|
708
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
709
|
+
}, React.createElement("path", {
|
|
710
|
+
fillRule: "evenodd",
|
|
711
|
+
clipRule: "evenodd",
|
|
712
|
+
d: "M6.0002 2.1002C3.84628 2.1002 2.1002 3.84628 2.1002 6.0002C2.1002 8.15411 3.84628 9.9002 6.0002 9.9002C8.15411 9.9002 9.9002 8.15411 9.9002 6.0002C9.9002 3.84628 8.15411 2.1002 6.0002 2.1002ZM1.2002 6.0002C1.2002 3.34923 3.34923 1.2002 6.0002 1.2002C8.65116 1.2002 10.8002 3.34923 10.8002 6.0002C10.8002 8.65116 8.65116 10.8002 6.0002 10.8002C3.34923 10.8002 1.2002 8.65116 1.2002 6.0002Z",
|
|
713
|
+
fill: "#A6A6AD"
|
|
714
|
+
}), React.createElement("path", {
|
|
715
|
+
fillRule: "evenodd",
|
|
716
|
+
clipRule: "evenodd",
|
|
717
|
+
d: "M5.9998 5.1001C6.24833 5.1001 6.4498 5.30157 6.4498 5.5501V8.2915C6.4498 8.54003 6.24833 8.7415 5.9998 8.7415C5.75128 8.7415 5.5498 8.54003 5.5498 8.2915V5.5501C5.5498 5.30157 5.75128 5.1001 5.9998 5.1001Z",
|
|
718
|
+
fill: "#A6A6AD"
|
|
719
|
+
}), React.createElement("path", {
|
|
720
|
+
d: "M5.9999 4.6502C5.6687 4.6502 5.3999 4.3808 5.3999 4.0502C5.3999 3.7196 5.6687 3.4502 5.9999 3.4502C6.3311 3.4502 6.5999 3.7196 6.5999 4.0502C6.5999 4.3808 6.3311 4.6502 5.9999 4.6502Z",
|
|
721
|
+
fill: "#A6A6AD"
|
|
722
|
+
}));
|
|
1084
723
|
};
|
|
1085
724
|
|
|
1086
|
-
var
|
|
1087
|
-
|
|
1088
|
-
var
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
725
|
+
var _excluded$1 = ["name", "value", "onChange", "placeholder", "error", "label", "isOptional", "tooltip", "noBorder", "smallHeight", "cols", "rows", "minHeight", "className", "onKeyDown", "onKeyFocus", "autoResize", "width", "onClick", "onBlur", "isDisabled"];
|
|
726
|
+
var CoreTextArea = function CoreTextArea(props) {
|
|
727
|
+
var _props$name = props.name,
|
|
728
|
+
name = _props$name === void 0 ? "" : _props$name,
|
|
729
|
+
value = props.value,
|
|
730
|
+
_onChange = props.onChange,
|
|
731
|
+
_props$placeholder = props.placeholder,
|
|
732
|
+
placeholder = _props$placeholder === void 0 ? "Type here..." : _props$placeholder,
|
|
733
|
+
_props$error = props.error,
|
|
734
|
+
error = _props$error === void 0 ? false : _props$error,
|
|
735
|
+
label = props.label,
|
|
736
|
+
_props$isOptional = props.isOptional,
|
|
737
|
+
isOptional = _props$isOptional === void 0 ? false : _props$isOptional,
|
|
738
|
+
tooltip = props.tooltip,
|
|
739
|
+
_props$noBorder = props.noBorder,
|
|
740
|
+
noBorder = _props$noBorder === void 0 ? false : _props$noBorder,
|
|
741
|
+
_props$smallHeight = props.smallHeight,
|
|
742
|
+
smallHeight = _props$smallHeight === void 0 ? false : _props$smallHeight,
|
|
743
|
+
cols = props.cols,
|
|
744
|
+
rows = props.rows,
|
|
745
|
+
minHeight = props.minHeight,
|
|
746
|
+
className = props.className,
|
|
747
|
+
_onKeyDown = props.onKeyDown,
|
|
748
|
+
onKeyFocus = props.onKeyFocus,
|
|
749
|
+
autoResize = props.autoResize,
|
|
750
|
+
width = props.width,
|
|
751
|
+
onClick = props.onClick,
|
|
752
|
+
onBlur = props.onBlur,
|
|
753
|
+
isDisabled = props.isDisabled,
|
|
754
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
755
|
+
var _useState = useState(false),
|
|
756
|
+
isOpenTooltip = _useState[0],
|
|
757
|
+
setIsOpenTooltip = _useState[1];
|
|
758
|
+
var toggleTooltip = function toggleTooltip() {
|
|
759
|
+
return setIsOpenTooltip(!isOpenTooltip);
|
|
1095
760
|
};
|
|
1096
|
-
var
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
var handleSignOut = function handleSignOut() {
|
|
1104
|
-
localStorage.clear();
|
|
1105
|
-
try {
|
|
1106
|
-
signOut();
|
|
1107
|
-
} catch (error) {
|
|
1108
|
-
console.log({
|
|
1109
|
-
error: error
|
|
761
|
+
var textareaRef = useRef(null);
|
|
762
|
+
useEffect(function () {
|
|
763
|
+
if (autoResize && textareaRef.current) {
|
|
764
|
+
var el = textareaRef.current;
|
|
765
|
+
requestAnimationFrame(function () {
|
|
766
|
+
el.style.height = "auto";
|
|
767
|
+
el.style.height = el.scrollHeight + "px";
|
|
1110
768
|
});
|
|
1111
769
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
loaded: loaded
|
|
1118
|
-
};
|
|
1119
|
-
};
|
|
1120
|
-
|
|
1121
|
-
var LayoutContext = function LayoutContext(_ref) {
|
|
1122
|
-
var children = _ref.children,
|
|
1123
|
-
onNavigate = _ref.onNavigate;
|
|
1124
|
-
var _useGoogleSignOut = useGoogleSignOut({
|
|
1125
|
-
onNavigate: onNavigate
|
|
1126
|
-
}),
|
|
1127
|
-
handleSignOut = _useGoogleSignOut.handleSignOut;
|
|
1128
|
-
var resetAuth = function resetAuth() {
|
|
1129
|
-
handleSignOut();
|
|
1130
|
-
};
|
|
1131
|
-
var loadInfo = function loadInfo() {
|
|
1132
|
-
try {
|
|
1133
|
-
var token = firstCheckToken();
|
|
1134
|
-
!token && resetAuth();
|
|
1135
|
-
return Promise.resolve();
|
|
1136
|
-
} catch (e) {
|
|
1137
|
-
return Promise.reject(e);
|
|
770
|
+
}, [value, autoResize]);
|
|
771
|
+
return React.createElement("div", {
|
|
772
|
+
className: styles$8["editor"] + " " + (error ? styles$8["error"] : "") + " " + (noBorder ? styles$8["no-border"] : "") + " " + (smallHeight ? styles$8["small-height"] : ""),
|
|
773
|
+
style: {
|
|
774
|
+
width: width != null ? width : "100%"
|
|
1138
775
|
}
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
}, React.createElement(ModalHeader, {
|
|
1162
|
-
toggle: toggle
|
|
1163
|
-
}, "Confirmation"), React.createElement(ModalBody, null, text), React.createElement(ModalFooter, null, React.createElement(Button, {
|
|
1164
|
-
color: "secondary",
|
|
1165
|
-
onClick: toggle
|
|
1166
|
-
}, cancelText), React.createElement(Button, {
|
|
1167
|
-
color: isDelete ? "danger" : "primary",
|
|
1168
|
-
onClick: onConfirm
|
|
1169
|
-
}, okText)));
|
|
1170
|
-
};
|
|
1171
|
-
|
|
1172
|
-
var CommonDialog = function CommonDialog(_ref) {
|
|
1173
|
-
var open = _ref.open,
|
|
1174
|
-
children = _ref.children,
|
|
1175
|
-
centered = _ref.centered,
|
|
1176
|
-
title = _ref.title,
|
|
1177
|
-
_ref$size = _ref.size,
|
|
1178
|
-
size = _ref$size === void 0 ? "xs" : _ref$size,
|
|
1179
|
-
_ref$isShowHeader = _ref.isShowHeader,
|
|
1180
|
-
isShowHeader = _ref$isShowHeader === void 0 ? true : _ref$isShowHeader,
|
|
1181
|
-
onClose = _ref.onClose,
|
|
1182
|
-
backdrop = _ref.backdrop;
|
|
1183
|
-
return React.createElement(Modal, {
|
|
1184
|
-
backdrop: backdrop,
|
|
1185
|
-
isOpen: open,
|
|
1186
|
-
toggle: onClose,
|
|
1187
|
-
centered: centered,
|
|
1188
|
-
size: size,
|
|
1189
|
-
zIndex: 1102
|
|
1190
|
-
}, isShowHeader ? React.createElement(ModalHeader, {
|
|
1191
|
-
toggle: onClose
|
|
1192
|
-
}, title) : React.createElement(Box, {
|
|
1193
|
-
className: "p-3"
|
|
1194
|
-
}, React.createElement(Typography, {
|
|
1195
|
-
className: "fs-5 text-center fw-bold"
|
|
1196
|
-
}, title)), children);
|
|
1197
|
-
};
|
|
1198
|
-
|
|
1199
|
-
var AuthenticationMessage;
|
|
1200
|
-
(function (AuthenticationMessage) {
|
|
1201
|
-
AuthenticationMessage["NotAllowedToRegister"] = "NotAllowedToRegister";
|
|
1202
|
-
AuthenticationMessage["InvalidGoogleToken"] = "InvalidGoogleToken";
|
|
1203
|
-
})(AuthenticationMessage || (AuthenticationMessage = {}));
|
|
1204
|
-
var Role;
|
|
1205
|
-
(function (Role) {
|
|
1206
|
-
Role["Student"] = "Student";
|
|
1207
|
-
Role["Teacher"] = "Teacher";
|
|
1208
|
-
Role["Admin"] = "Admin";
|
|
1209
|
-
})(Role || (Role = {}));
|
|
1210
|
-
|
|
1211
|
-
var CustomPagination = function CustomPagination(_ref) {
|
|
1212
|
-
var currentPage = _ref.currentPage,
|
|
1213
|
-
totalPage = _ref.totalPage,
|
|
1214
|
-
onChangePage = _ref.onChangePage;
|
|
1215
|
-
return React.createElement(Pagination, {
|
|
1216
|
-
className: "w-fit"
|
|
1217
|
-
}, React.createElement(PaginationItem, {
|
|
1218
|
-
disabled: currentPage <= 1
|
|
1219
|
-
}, React.createElement(PaginationLink, {
|
|
1220
|
-
onClick: function onClick(e) {
|
|
1221
|
-
e.preventDefault();
|
|
1222
|
-
onChangePage(currentPage - 1);
|
|
1223
|
-
},
|
|
1224
|
-
previous: true,
|
|
1225
|
-
href: "#"
|
|
1226
|
-
})), React.createElement(PaginationItem, {
|
|
1227
|
-
active: 1 === currentPage,
|
|
1228
|
-
key: 1
|
|
1229
|
-
}, React.createElement(PaginationLink, {
|
|
1230
|
-
onClick: function onClick(e) {
|
|
1231
|
-
e.preventDefault();
|
|
1232
|
-
onChangePage(1);
|
|
1233
|
-
},
|
|
1234
|
-
href: "#"
|
|
1235
|
-
}, 1)), totalPage > 2 && React.createElement(PaginationItem, {
|
|
1236
|
-
active: 2 === currentPage,
|
|
1237
|
-
key: 1
|
|
1238
|
-
}, React.createElement(PaginationLink, {
|
|
1239
|
-
onClick: function onClick(e) {
|
|
1240
|
-
e.preventDefault();
|
|
1241
|
-
onChangePage(2);
|
|
1242
|
-
},
|
|
1243
|
-
href: "#"
|
|
1244
|
-
}, 2)), currentPage > 4 && currentPage !== totalPage && totalPage !== 5 && React.createElement(PaginationItem, {
|
|
1245
|
-
disabled: true,
|
|
1246
|
-
key: "first"
|
|
1247
|
-
}, React.createElement(PaginationLink, {
|
|
1248
|
-
href: "#"
|
|
1249
|
-
}, "...")), (currentPage === 1 || currentPage === totalPage) && totalPage === 5 && React.createElement(PaginationItem, {
|
|
1250
|
-
key: 3
|
|
1251
|
-
}, React.createElement(PaginationLink, {
|
|
1252
|
-
onClick: function onClick(e) {
|
|
1253
|
-
e.preventDefault();
|
|
1254
|
-
onChangePage(3);
|
|
1255
|
-
},
|
|
1256
|
-
href: "#"
|
|
1257
|
-
}, "3")), [currentPage - 1, currentPage, currentPage + 1].filter(function (page) {
|
|
1258
|
-
return page > 2 && page < totalPage - 1;
|
|
1259
|
-
}).map(function (page) {
|
|
1260
|
-
return React.createElement(PaginationItem, {
|
|
1261
|
-
active: page === currentPage,
|
|
1262
|
-
key: page
|
|
1263
|
-
}, React.createElement(PaginationLink, {
|
|
1264
|
-
onClick: function onClick(e) {
|
|
1265
|
-
e.preventDefault();
|
|
1266
|
-
onChangePage(page);
|
|
1267
|
-
},
|
|
1268
|
-
href: "#"
|
|
1269
|
-
}, page));
|
|
1270
|
-
}), totalPage - currentPage > 4 && React.createElement(PaginationItem, {
|
|
1271
|
-
disabled: true,
|
|
1272
|
-
key: "last"
|
|
1273
|
-
}, React.createElement(PaginationLink, {
|
|
1274
|
-
href: "#"
|
|
1275
|
-
}, "...")), totalPage > 3 && React.createElement(PaginationItem, {
|
|
1276
|
-
active: totalPage - 1 === currentPage,
|
|
1277
|
-
key: totalPage - 1
|
|
1278
|
-
}, React.createElement(PaginationLink, {
|
|
1279
|
-
onClick: function onClick(e) {
|
|
1280
|
-
e.preventDefault();
|
|
1281
|
-
onChangePage(totalPage - 1);
|
|
776
|
+
}, label && React.createElement("span", {
|
|
777
|
+
className: styles$8["label"]
|
|
778
|
+
}, React.createElement("div", {
|
|
779
|
+
className: styles$8["label-content"]
|
|
780
|
+
}, label), isOptional && React.createElement("div", {
|
|
781
|
+
className: styles$8["optional"]
|
|
782
|
+
}, "(optional)"), tooltip && React.createElement("div", {
|
|
783
|
+
id: name,
|
|
784
|
+
className: styles$8["icon"]
|
|
785
|
+
}, React.createElement(Info, null), React.createElement(Tooltip, {
|
|
786
|
+
target: name,
|
|
787
|
+
isOpen: isOpenTooltip,
|
|
788
|
+
toggle: toggleTooltip
|
|
789
|
+
}, tooltip))), React.createElement("textarea", Object.assign({
|
|
790
|
+
ref: textareaRef,
|
|
791
|
+
placeholder: placeholder,
|
|
792
|
+
style: {
|
|
793
|
+
whiteSpace: "pre-wrap",
|
|
794
|
+
width: "100%",
|
|
795
|
+
minHeight: minHeight ? minHeight : "123px",
|
|
796
|
+
resize: "none",
|
|
797
|
+
overflow: "hidden"
|
|
1282
798
|
},
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
onClick: function onClick(e) {
|
|
1289
|
-
e.preventDefault();
|
|
1290
|
-
onChangePage(totalPage);
|
|
799
|
+
value: value,
|
|
800
|
+
cols: cols,
|
|
801
|
+
rows: rows,
|
|
802
|
+
onChange: function onChange(e) {
|
|
803
|
+
return _onChange(name, e.target.value);
|
|
1291
804
|
},
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
disabled: currentPage >= totalPage
|
|
1295
|
-
}, React.createElement(PaginationLink, {
|
|
1296
|
-
onClick: function onClick(e) {
|
|
1297
|
-
e.preventDefault();
|
|
1298
|
-
onChangePage(currentPage + 1);
|
|
805
|
+
onKeyDown: function onKeyDown(e) {
|
|
806
|
+
return _onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
|
|
1299
807
|
},
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
808
|
+
onFocus: function onFocus(e) {
|
|
809
|
+
return onKeyFocus === null || onKeyFocus === void 0 ? void 0 : onKeyFocus(name, e.target.value);
|
|
810
|
+
},
|
|
811
|
+
className: className,
|
|
812
|
+
onClick: onClick,
|
|
813
|
+
onBlur: onBlur,
|
|
814
|
+
disabled: isDisabled
|
|
815
|
+
}, rest)));
|
|
1303
816
|
};
|
|
1304
817
|
|
|
1305
|
-
|
|
1306
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
1307
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
1308
|
-
var t = arguments[e];
|
|
1309
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1310
|
-
}
|
|
1311
|
-
return n;
|
|
1312
|
-
}, _extends.apply(null, arguments);
|
|
1313
|
-
}
|
|
1314
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
1315
|
-
if (null == r) return {};
|
|
1316
|
-
var t = {};
|
|
1317
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
1318
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
1319
|
-
t[n] = r[n];
|
|
1320
|
-
}
|
|
1321
|
-
return t;
|
|
1322
|
-
}
|
|
818
|
+
var styles$9 = {"core-search":"_wyI1K","input":"_9XW-D","icon":"_2iDm7","clear":"_1nhXy"};
|
|
1323
819
|
|
|
1324
|
-
var
|
|
1325
|
-
var
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
var
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
if (newUserId) {
|
|
1356
|
-
var prefixedUserId = "edusfere:" + newUserId;
|
|
1357
|
-
setUserId(prefixedUserId);
|
|
1358
|
-
if (prevUserId !== newUserId && !hasTrackedInitialSession.current) {
|
|
1359
|
-
hasTrackedInitialSession.current = true;
|
|
1360
|
-
sessionStartTime.current = new Date();
|
|
1361
|
-
currentSessionStart.current = new Date();
|
|
1362
|
-
trackEvent({
|
|
1363
|
-
eventName: AmplitudeEvent.SESSION_START,
|
|
1364
|
-
eventProperties: {
|
|
1365
|
-
start_time: new Date().toISOString()
|
|
1366
|
-
}
|
|
1367
|
-
});
|
|
820
|
+
var CoreSearch = function CoreSearch(props) {
|
|
821
|
+
var _props$name = props.name,
|
|
822
|
+
name = _props$name === void 0 ? "" : _props$name,
|
|
823
|
+
value = props.value,
|
|
824
|
+
_onChange = props.onChange,
|
|
825
|
+
width = props.width,
|
|
826
|
+
onPressEnter = props.onPressEnter,
|
|
827
|
+
_props$placeholder = props.placeholder,
|
|
828
|
+
placeholder = _props$placeholder === void 0 ? "Search..." : _props$placeholder;
|
|
829
|
+
var handleClear = function handleClear() {
|
|
830
|
+
_onChange(name, "");
|
|
831
|
+
onPressEnter && onPressEnter("");
|
|
832
|
+
};
|
|
833
|
+
return React.createElement("div", {
|
|
834
|
+
className: styles$9["core-search"],
|
|
835
|
+
style: {
|
|
836
|
+
width: width != null ? width : "100%"
|
|
837
|
+
},
|
|
838
|
+
tabIndex: 1
|
|
839
|
+
}, React.createElement("div", {
|
|
840
|
+
className: styles$9["icon"]
|
|
841
|
+
}, React.createElement(Search, null)), React.createElement("input", {
|
|
842
|
+
className: styles$9["input"],
|
|
843
|
+
value: value,
|
|
844
|
+
onChange: function onChange(e) {
|
|
845
|
+
return _onChange(name, e.target.value);
|
|
846
|
+
},
|
|
847
|
+
placeholder: placeholder,
|
|
848
|
+
onKeyDown: function onKeyDown(e) {
|
|
849
|
+
if (e.key === "Enter") {
|
|
850
|
+
onPressEnter && onPressEnter(value);
|
|
1368
851
|
}
|
|
1369
852
|
}
|
|
1370
|
-
},
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
853
|
+
}), value.length ? React.createElement("div", {
|
|
854
|
+
className: styles$9["clear"],
|
|
855
|
+
onClick: handleClear
|
|
856
|
+
}, React.createElement(Close, null)) : null);
|
|
857
|
+
};
|
|
858
|
+
|
|
859
|
+
var styles$a = {"core-select-compact":"_3ql5D","label":"_3fPQC"};
|
|
860
|
+
|
|
861
|
+
var Option$1 = function Option(props) {
|
|
862
|
+
return React.createElement("div", null, React.createElement(components.Option, Object.assign({}, props), React.createElement(CoreInput$1, {
|
|
863
|
+
checked: props.isSelected,
|
|
864
|
+
onChange: function onChange() {
|
|
865
|
+
return null;
|
|
866
|
+
},
|
|
867
|
+
name: "",
|
|
868
|
+
label: props.label
|
|
869
|
+
})));
|
|
870
|
+
};
|
|
871
|
+
var CoreSelectCompact = function CoreSelectCompact(props) {
|
|
872
|
+
var _props$name = props.name,
|
|
873
|
+
name = _props$name === void 0 ? "" : _props$name,
|
|
874
|
+
options = props.options,
|
|
875
|
+
value = props.value,
|
|
876
|
+
onChange = props.onChange,
|
|
877
|
+
_props$disabled = props.disabled,
|
|
878
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
879
|
+
label = props.label,
|
|
880
|
+
width = props.width,
|
|
881
|
+
_props$placeholder = props.placeholder,
|
|
882
|
+
placeholder = _props$placeholder === void 0 ? "Select" : _props$placeholder,
|
|
883
|
+
_props$isMulti = props.isMulti,
|
|
884
|
+
isMulti = _props$isMulti === void 0 ? false : _props$isMulti,
|
|
885
|
+
_props$isShowDropdown = props.isShowDropdown,
|
|
886
|
+
isShowDropdown = _props$isShowDropdown === void 0 ? false : _props$isShowDropdown,
|
|
887
|
+
_props$error = props.error,
|
|
888
|
+
error = _props$error === void 0 ? false : _props$error,
|
|
889
|
+
_noOptionsMessage = props.noOptionsMessage;
|
|
890
|
+
var handleChange = function handleChange(value) {
|
|
891
|
+
var newValue = isMulti ? value === null || value === void 0 ? void 0 : value.map(function (item) {
|
|
892
|
+
return item.value;
|
|
893
|
+
}) : value === null || value === void 0 ? void 0 : value.value;
|
|
894
|
+
onChange(name, newValue);
|
|
895
|
+
};
|
|
896
|
+
var controlStyle = function controlStyle(base, state) {
|
|
897
|
+
var styles = _extends({}, base, {
|
|
898
|
+
fontSize: "14px",
|
|
899
|
+
fontWeight: "400",
|
|
900
|
+
padding: "0",
|
|
901
|
+
backgroundColor: state.isDisabled ? "transparent" : error ? COLORS.lightYellow : COLORS.white,
|
|
902
|
+
border: "none",
|
|
903
|
+
height: isMulti ? undefined : "26px",
|
|
904
|
+
minHeight: "26px",
|
|
905
|
+
boxShadow: "none",
|
|
906
|
+
cursor: "pointer",
|
|
907
|
+
"&:hover": {
|
|
908
|
+
backgroundColor: COLORS.lightBlueHover
|
|
909
|
+
},
|
|
910
|
+
"&>div": {
|
|
911
|
+
padding: "0 2px"
|
|
1402
912
|
}
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
var
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
913
|
+
});
|
|
914
|
+
return styles;
|
|
915
|
+
};
|
|
916
|
+
var inputStyles = function inputStyles(base) {
|
|
917
|
+
var styles = _extends({}, base, {
|
|
918
|
+
margin: "0",
|
|
919
|
+
padding: "0",
|
|
920
|
+
color: "inherit",
|
|
921
|
+
position: "relative",
|
|
922
|
+
top: "-2px"
|
|
923
|
+
});
|
|
924
|
+
return styles;
|
|
925
|
+
};
|
|
926
|
+
var placeholderStyles = function placeholderStyles(base) {
|
|
927
|
+
var styles = _extends({}, base, {
|
|
928
|
+
color: COLORS.lightGray
|
|
929
|
+
});
|
|
930
|
+
return styles;
|
|
931
|
+
};
|
|
932
|
+
var dropdownIndicatorStyles = function dropdownIndicatorStyles(base) {
|
|
933
|
+
var styles = _extends({}, base, {
|
|
934
|
+
position: "relative",
|
|
935
|
+
padding: "2px 0"
|
|
936
|
+
});
|
|
937
|
+
return styles;
|
|
938
|
+
};
|
|
939
|
+
var indicatorsContainerStyles = function indicatorsContainerStyles(base) {
|
|
940
|
+
var styles = _extends({}, base, {
|
|
941
|
+
display: isShowDropdown && !isMulti ? "block" : "none"
|
|
942
|
+
});
|
|
943
|
+
return styles;
|
|
944
|
+
};
|
|
945
|
+
var valueContainerStyles = function valueContainerStyles(base) {
|
|
946
|
+
var styles = _extends({}, base, {
|
|
947
|
+
height: isMulti ? undefined : "26px",
|
|
948
|
+
position: "relative"
|
|
949
|
+
});
|
|
950
|
+
return styles;
|
|
951
|
+
};
|
|
952
|
+
var singleValueStyles = function singleValueStyles(base) {
|
|
953
|
+
var styles = _extends({}, base);
|
|
954
|
+
return styles;
|
|
955
|
+
};
|
|
956
|
+
var optionStyles = function optionStyles(base, state) {
|
|
957
|
+
var styles = _extends({}, base, {
|
|
958
|
+
padding: "8px",
|
|
959
|
+
borderRadius: "8px",
|
|
960
|
+
cursor: "pointer",
|
|
961
|
+
fontSize: "14px",
|
|
962
|
+
fontWeight: 400,
|
|
963
|
+
color: COLORS.blackText,
|
|
964
|
+
backgroundColor: state.isSelected ? COLORS.lightBlueHover : "transparent",
|
|
965
|
+
"&:hover": {
|
|
966
|
+
backgroundColor: COLORS.lightBlueHover
|
|
1416
967
|
}
|
|
1417
968
|
});
|
|
1418
|
-
|
|
1419
|
-
useEffect(function () {
|
|
1420
|
-
var handleVisibilityChange = function handleVisibilityChange() {
|
|
1421
|
-
var isVisible = !document.hidden;
|
|
1422
|
-
setIsTabActive(isVisible);
|
|
1423
|
-
trackTabActivity(isVisible);
|
|
1424
|
-
};
|
|
1425
|
-
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
1426
|
-
return function () {
|
|
1427
|
-
return document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
1428
|
-
};
|
|
1429
|
-
}, [trackTabActivity]);
|
|
1430
|
-
useEffect(function () {
|
|
1431
|
-
var handleFocus = function handleFocus() {
|
|
1432
|
-
setIsTabActive(true);
|
|
1433
|
-
trackTabActivity(true);
|
|
1434
|
-
};
|
|
1435
|
-
var handleBlur = function handleBlur() {
|
|
1436
|
-
setIsTabActive(false);
|
|
1437
|
-
trackTabActivity(false);
|
|
1438
|
-
};
|
|
1439
|
-
window.addEventListener('focus', handleFocus);
|
|
1440
|
-
window.addEventListener('blur', handleBlur);
|
|
1441
|
-
return function () {
|
|
1442
|
-
window.removeEventListener('focus', handleFocus);
|
|
1443
|
-
window.removeEventListener('blur', handleBlur);
|
|
1444
|
-
};
|
|
1445
|
-
}, [trackTabActivity]);
|
|
1446
|
-
useEffect(function () {
|
|
1447
|
-
var handleBeforeUnload = function handleBeforeUnload() {
|
|
1448
|
-
trackPageUnload();
|
|
1449
|
-
};
|
|
1450
|
-
window.addEventListener('beforeunload', handleBeforeUnload);
|
|
1451
|
-
return function () {
|
|
1452
|
-
return window.removeEventListener('beforeunload', handleBeforeUnload);
|
|
1453
|
-
};
|
|
1454
|
-
}, [trackPageUnload]);
|
|
1455
|
-
return {
|
|
1456
|
-
setUserId: setUserId$1,
|
|
1457
|
-
setUserProperties: setUserProperties,
|
|
1458
|
-
trackEvent: trackEvent,
|
|
1459
|
-
reset: reset,
|
|
1460
|
-
userId: userId,
|
|
1461
|
-
isTabActive: isTabActive,
|
|
1462
|
-
sessionStartTime: sessionStartTime.current,
|
|
1463
|
-
currentSessionStart: currentSessionStart.current
|
|
969
|
+
return styles;
|
|
1464
970
|
};
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
971
|
+
var multiValueStyles = function multiValueStyles(base) {
|
|
972
|
+
var styles = _extends({}, base, {
|
|
973
|
+
backgroundColor: COLORS.lightBlue,
|
|
974
|
+
borderRadius: "4px",
|
|
975
|
+
padding: "0 4px",
|
|
976
|
+
display: "flex",
|
|
977
|
+
alignItems: "center",
|
|
978
|
+
fontSize: "13px",
|
|
979
|
+
color: COLORS.blackText
|
|
980
|
+
});
|
|
981
|
+
return styles;
|
|
982
|
+
};
|
|
983
|
+
var multiValueRemoveStyles = function multiValueRemoveStyles(base) {
|
|
984
|
+
var styles = _extends({}, base, {
|
|
985
|
+
color: COLORS.lightGray,
|
|
986
|
+
cursor: "pointer"
|
|
987
|
+
});
|
|
988
|
+
return styles;
|
|
989
|
+
};
|
|
990
|
+
var multiValueLabelStyles = function multiValueLabelStyles(base) {
|
|
991
|
+
var styles = _extends({}, base, {
|
|
992
|
+
color: COLORS.blackText,
|
|
993
|
+
fontWeight: "400",
|
|
994
|
+
fontSize: "13px",
|
|
995
|
+
padding: 0
|
|
996
|
+
});
|
|
997
|
+
return styles;
|
|
998
|
+
};
|
|
999
|
+
return React.createElement("div", {
|
|
1000
|
+
className: "" + styles$a["core-select-compact"],
|
|
1001
|
+
style: {
|
|
1002
|
+
width: width != null ? width : "100%"
|
|
1473
1003
|
}
|
|
1474
|
-
}
|
|
1004
|
+
}, label && React.createElement("div", {
|
|
1005
|
+
className: styles$a["label"]
|
|
1006
|
+
}, React.createElement("label", null, label), React.createElement(Info, null)), React.createElement(ReactSelect, {
|
|
1007
|
+
name: name,
|
|
1008
|
+
value: options.filter(function (i) {
|
|
1009
|
+
return value && (isMulti ? value.includes(i.value) : i.value === value);
|
|
1010
|
+
}),
|
|
1011
|
+
onChange: handleChange,
|
|
1012
|
+
placeholder: placeholder,
|
|
1013
|
+
isDisabled: disabled,
|
|
1014
|
+
isMulti: isMulti,
|
|
1015
|
+
closeMenuOnSelect: !isMulti,
|
|
1016
|
+
hideSelectedOptions: false,
|
|
1017
|
+
options: options,
|
|
1018
|
+
noOptionsMessage: function noOptionsMessage() {
|
|
1019
|
+
return _noOptionsMessage ? _noOptionsMessage : "No options";
|
|
1020
|
+
},
|
|
1021
|
+
components: isMulti ? {
|
|
1022
|
+
Option: Option$1
|
|
1023
|
+
} : undefined,
|
|
1024
|
+
styles: {
|
|
1025
|
+
control: controlStyle,
|
|
1026
|
+
input: inputStyles,
|
|
1027
|
+
placeholder: placeholderStyles,
|
|
1028
|
+
dropdownIndicator: dropdownIndicatorStyles,
|
|
1029
|
+
indicatorSeparator: function indicatorSeparator() {
|
|
1030
|
+
return {
|
|
1031
|
+
display: "none"
|
|
1032
|
+
};
|
|
1033
|
+
},
|
|
1034
|
+
indicatorsContainer: indicatorsContainerStyles,
|
|
1035
|
+
valueContainer: valueContainerStyles,
|
|
1036
|
+
singleValue: singleValueStyles,
|
|
1037
|
+
option: optionStyles,
|
|
1038
|
+
multiValue: multiValueStyles,
|
|
1039
|
+
multiValueRemove: multiValueRemoveStyles,
|
|
1040
|
+
multiValueLabel: multiValueLabelStyles
|
|
1041
|
+
}
|
|
1042
|
+
}));
|
|
1475
1043
|
};
|
|
1476
1044
|
|
|
1477
|
-
var styles = {"core-
|
|
1045
|
+
var styles$b = {"core-input-compact":"_1qmXW","label":"_1argp","icon":"_3DPRG"};
|
|
1478
1046
|
|
|
1479
|
-
var _excluded = ["
|
|
1480
|
-
var
|
|
1481
|
-
var _props$
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
icon = props.icon,
|
|
1047
|
+
var _excluded$2 = ["name", "value", "onChange", "disabled", "label", "width", "placeholder", "error", "tooltip", "onKeyDown"];
|
|
1048
|
+
var CoreInputCompact = function CoreInputCompact(props) {
|
|
1049
|
+
var _props$name = props.name,
|
|
1050
|
+
name = _props$name === void 0 ? "" : _props$name,
|
|
1051
|
+
value = props.value,
|
|
1052
|
+
_onChange = props.onChange,
|
|
1486
1053
|
_props$disabled = props.disabled,
|
|
1487
1054
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1055
|
+
label = props.label,
|
|
1056
|
+
width = props.width,
|
|
1057
|
+
_props$placeholder = props.placeholder,
|
|
1058
|
+
placeholder = _props$placeholder === void 0 ? "Type here" : _props$placeholder,
|
|
1059
|
+
error = props.error,
|
|
1060
|
+
tooltip = props.tooltip,
|
|
1061
|
+
_onKeyDown = props.onKeyDown,
|
|
1062
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
1063
|
+
var _useState = useState(false),
|
|
1064
|
+
isOpenTooltip = _useState[0],
|
|
1065
|
+
setIsOpenTooltip = _useState[1];
|
|
1066
|
+
var toggleTooltip = function toggleTooltip() {
|
|
1067
|
+
return setIsOpenTooltip(!isOpenTooltip);
|
|
1068
|
+
};
|
|
1069
|
+
return React.createElement("div", {
|
|
1070
|
+
className: "" + styles$b["core-input-compact"],
|
|
1071
|
+
style: {
|
|
1072
|
+
width: width != null ? width : "100%"
|
|
1073
|
+
}
|
|
1074
|
+
}, label && React.createElement("div", {
|
|
1075
|
+
className: styles$b["label"]
|
|
1076
|
+
}, React.createElement("label", null, label), tooltip ? React.createElement("div", {
|
|
1077
|
+
id: name,
|
|
1078
|
+
className: styles$b["icon"]
|
|
1079
|
+
}, React.createElement(Info, null)) : null), React.createElement("input", Object.assign({
|
|
1080
|
+
style: {
|
|
1081
|
+
backgroundColor: error ? COLORS.lightYellow : "transparent"
|
|
1082
|
+
},
|
|
1083
|
+
name: name,
|
|
1084
|
+
value: value,
|
|
1085
|
+
onChange: function onChange(e) {
|
|
1086
|
+
return _onChange(name, e.target.value);
|
|
1087
|
+
},
|
|
1494
1088
|
disabled: disabled,
|
|
1495
|
-
|
|
1496
|
-
|
|
1089
|
+
placeholder: placeholder,
|
|
1090
|
+
onKeyDown: function onKeyDown(e) {
|
|
1091
|
+
_onKeyDown && _onKeyDown(e);
|
|
1092
|
+
}
|
|
1093
|
+
}, rest)), tooltip && React.createElement(Tooltip, {
|
|
1094
|
+
target: name,
|
|
1095
|
+
isOpen: isOpenTooltip,
|
|
1096
|
+
toggle: toggleTooltip
|
|
1097
|
+
}, tooltip));
|
|
1497
1098
|
};
|
|
1498
1099
|
|
|
1499
|
-
var styles$
|
|
1500
|
-
|
|
1501
|
-
var styles$2 = {"core-error":"_1Mmxr"};
|
|
1502
|
-
|
|
1503
|
-
var CoreError = function CoreError(props) {
|
|
1504
|
-
var message = props.message;
|
|
1505
|
-
return React.createElement("div", {
|
|
1506
|
-
className: "" + styles$2["core-error"]
|
|
1507
|
-
}, React.createElement("p", null, message));
|
|
1508
|
-
};
|
|
1100
|
+
var styles$c = {"core-label-input":"_2YqZu","size-h1":"_23-uu","size-h2":"_16lQL"};
|
|
1509
1101
|
|
|
1510
|
-
var
|
|
1511
|
-
var name = props.name,
|
|
1102
|
+
var CoreTitleInput = function CoreTitleInput(props) {
|
|
1103
|
+
var _props$name = props.name,
|
|
1104
|
+
name = _props$name === void 0 ? "" : _props$name,
|
|
1512
1105
|
value = props.value,
|
|
1513
1106
|
_onChange = props.onChange,
|
|
1514
|
-
_props$type = props.type,
|
|
1515
|
-
type = _props$type === void 0 ? "outline" : _props$type,
|
|
1516
1107
|
_props$disabled = props.disabled,
|
|
1517
1108
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
1518
|
-
label = props.label,
|
|
1519
1109
|
width = props.width,
|
|
1520
1110
|
_props$placeholder = props.placeholder,
|
|
1521
1111
|
placeholder = _props$placeholder === void 0 ? "Type here" : _props$placeholder,
|
|
1522
1112
|
error = props.error,
|
|
1523
|
-
_props$
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
fontWeight = props.fontWeight,
|
|
1527
|
-
_onKeyDown = props.onKeyDown,
|
|
1528
|
-
ref = props.ref,
|
|
1529
|
-
maxLength = props.maxLength,
|
|
1530
|
-
className = props.className,
|
|
1531
|
-
onKeyFocus = props.onKeyFocus;
|
|
1113
|
+
_props$size = props.size,
|
|
1114
|
+
size = _props$size === void 0 ? "h1" : _props$size,
|
|
1115
|
+
maxLength = props.maxLength;
|
|
1532
1116
|
return React.createElement("div", {
|
|
1533
|
-
className:
|
|
1117
|
+
className: "" + styles$c["core-label-input"],
|
|
1534
1118
|
style: {
|
|
1535
1119
|
width: width != null ? width : "100%"
|
|
1536
1120
|
}
|
|
1537
|
-
},
|
|
1121
|
+
}, React.createElement("input", {
|
|
1122
|
+
className: "" + styles$c["size-" + size],
|
|
1538
1123
|
style: {
|
|
1539
|
-
|
|
1540
|
-
fontWeight: fontWeight
|
|
1124
|
+
backgroundColor: error ? COLORS.lightYellow : "transparent"
|
|
1541
1125
|
},
|
|
1542
1126
|
name: name,
|
|
1543
1127
|
value: value,
|
|
@@ -1546,879 +1130,1409 @@ var CoreInput = function CoreInput(props) {
|
|
|
1546
1130
|
},
|
|
1547
1131
|
disabled: disabled,
|
|
1548
1132
|
placeholder: placeholder,
|
|
1549
|
-
|
|
1550
|
-
return _onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
|
|
1551
|
-
},
|
|
1552
|
-
onFocus: function onFocus(e) {
|
|
1553
|
-
return onKeyFocus === null || onKeyFocus === void 0 ? void 0 : onKeyFocus(name, e.target.value);
|
|
1554
|
-
}
|
|
1555
|
-
}, ref, {
|
|
1556
|
-
maxLength: maxLength,
|
|
1557
|
-
className: className
|
|
1558
|
-
})), error && React.createElement(CoreError, {
|
|
1559
|
-
message: errorMessage
|
|
1133
|
+
maxLength: maxLength
|
|
1560
1134
|
}));
|
|
1561
1135
|
};
|
|
1562
1136
|
|
|
1563
|
-
var styles$
|
|
1137
|
+
var styles$d = {"core-tooltip":"_1Bmhs"};
|
|
1564
1138
|
|
|
1565
|
-
var
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
var
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
placeholder = _props$placeholder === void 0 ? "Select" : _props$placeholder,
|
|
1586
|
-
error = props.error,
|
|
1587
|
-
_props$errorMessage = props.errorMessage,
|
|
1588
|
-
errorMessage = _props$errorMessage === void 0 ? "" : _props$errorMessage,
|
|
1589
|
-
_props$type = props.type,
|
|
1590
|
-
type = _props$type === void 0 ? "outline" : _props$type,
|
|
1591
|
-
_props$isMulti = props.isMulti,
|
|
1592
|
-
isMulti = _props$isMulti === void 0 ? false : _props$isMulti,
|
|
1593
|
-
_props$closeMenuOnSel = props.closeMenuOnSelect,
|
|
1594
|
-
closeMenuOnSelect = _props$closeMenuOnSel === void 0 ? true : _props$closeMenuOnSel,
|
|
1595
|
-
_props$hideSelectedOp = props.hideSelectedOptions,
|
|
1596
|
-
hideSelectedOptions = _props$hideSelectedOp === void 0 ? true : _props$hideSelectedOp;
|
|
1597
|
-
var handleChange = function handleChange(e) {
|
|
1598
|
-
var newValue = isMulti ? e.map(function (item) {
|
|
1599
|
-
return item.value;
|
|
1600
|
-
}) : e === null || e === void 0 ? void 0 : e.value;
|
|
1601
|
-
onChange(name, newValue);
|
|
1602
|
-
};
|
|
1603
|
-
var controlStyle = function controlStyle(base, state) {
|
|
1604
|
-
var styles = _extends({}, base, {
|
|
1605
|
-
fontSize: "14px",
|
|
1606
|
-
fontWeight: "400",
|
|
1607
|
-
padding: "0 4px",
|
|
1608
|
-
borderRadius: "8px",
|
|
1609
|
-
backgroundColor: state.isDisabled ? COLORS.lightGrayBg : COLORS.white,
|
|
1610
|
-
border: state.isFocused ? "2px solid " + (!error ? COLORS.brandBlue : COLORS.red) : "1px solid " + (!error ? COLORS.grayLines : COLORS.red),
|
|
1611
|
-
height: isMulti ? undefined : "32px",
|
|
1612
|
-
minHeight: 0,
|
|
1613
|
-
boxShadow: "none"
|
|
1614
|
-
});
|
|
1615
|
-
switch (type) {
|
|
1616
|
-
case "outline":
|
|
1617
|
-
styles.overflow = "hidden";
|
|
1618
|
-
styles[":hover"] = {
|
|
1619
|
-
backgroundColor: COLORS.lightBlueHover
|
|
1620
|
-
};
|
|
1621
|
-
break;
|
|
1622
|
-
case "no-outline":
|
|
1623
|
-
styles.border = "none";
|
|
1624
|
-
styles.padding = 0;
|
|
1625
|
-
styles["&>div"] = {
|
|
1626
|
-
padding: 0
|
|
1627
|
-
};
|
|
1628
|
-
break;
|
|
1139
|
+
var CoreTooltip = function CoreTooltip(props) {
|
|
1140
|
+
var id = props.id,
|
|
1141
|
+
content = props.content,
|
|
1142
|
+
children = props.children,
|
|
1143
|
+
placement = props.placement,
|
|
1144
|
+
isDelay = props.isDelay,
|
|
1145
|
+
_props$timeDelay = props.timeDelay,
|
|
1146
|
+
timeDelay = _props$timeDelay === void 0 ? 1500 : _props$timeDelay,
|
|
1147
|
+
innerClassName = props.innerClassName;
|
|
1148
|
+
var timeoutRef = useRef(null);
|
|
1149
|
+
var _useState = useState(false),
|
|
1150
|
+
isOpenTooltip = _useState[0],
|
|
1151
|
+
setIsOpenTooltip = _useState[1];
|
|
1152
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
1153
|
+
if (isDelay) {
|
|
1154
|
+
timeoutRef.current = setTimeout(function () {
|
|
1155
|
+
setIsOpenTooltip(true);
|
|
1156
|
+
}, timeDelay);
|
|
1157
|
+
} else {
|
|
1158
|
+
setIsOpenTooltip(true);
|
|
1629
1159
|
}
|
|
1630
|
-
return styles;
|
|
1631
|
-
};
|
|
1632
|
-
var inputStyles = function inputStyles(base) {
|
|
1633
|
-
var styles = _extends({}, base, {
|
|
1634
|
-
margin: "0",
|
|
1635
|
-
padding: "0",
|
|
1636
|
-
color: "inherit"
|
|
1637
|
-
});
|
|
1638
|
-
return styles;
|
|
1639
|
-
};
|
|
1640
|
-
var placeholderStyles = function placeholderStyles(base) {
|
|
1641
|
-
var styles = _extends({}, base, {
|
|
1642
|
-
color: COLORS.lightGray
|
|
1643
|
-
});
|
|
1644
|
-
return styles;
|
|
1645
|
-
};
|
|
1646
|
-
var dropdownIndicatorStyles = function dropdownIndicatorStyles(base) {
|
|
1647
|
-
var styles = _extends({}, base, {
|
|
1648
|
-
position: "relative",
|
|
1649
|
-
top: "-4px",
|
|
1650
|
-
padding: "8px 0"
|
|
1651
|
-
});
|
|
1652
|
-
return styles;
|
|
1653
1160
|
};
|
|
1654
|
-
var
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
return styles;
|
|
1661
|
-
};
|
|
1662
|
-
var singleValueStyles = function singleValueStyles(base) {
|
|
1663
|
-
var styles = _extends({}, base);
|
|
1664
|
-
return styles;
|
|
1161
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
1162
|
+
if (timeoutRef.current) {
|
|
1163
|
+
clearTimeout(timeoutRef.current);
|
|
1164
|
+
timeoutRef.current = null;
|
|
1165
|
+
}
|
|
1166
|
+
setIsOpenTooltip(false);
|
|
1665
1167
|
};
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1168
|
+
return React.createElement("div", {
|
|
1169
|
+
id: id,
|
|
1170
|
+
className: styles$d["core-tooltip"],
|
|
1171
|
+
onMouseEnter: handleMouseEnter,
|
|
1172
|
+
onMouseLeave: handleMouseLeave
|
|
1173
|
+
}, React.createElement("div", {
|
|
1174
|
+
className: styles$d["icon"]
|
|
1175
|
+
}, children), content && React.createElement(Tooltip, {
|
|
1176
|
+
target: id,
|
|
1177
|
+
isOpen: isOpenTooltip,
|
|
1178
|
+
placement: placement,
|
|
1179
|
+
innerClassName: innerClassName
|
|
1180
|
+
}, content));
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1183
|
+
var BlockLogin = function BlockLogin(_ref) {
|
|
1184
|
+
var onNavigate = _ref.onNavigate,
|
|
1185
|
+
role = _ref.role,
|
|
1186
|
+
hiddenSignup = _ref.hiddenSignup,
|
|
1187
|
+
email = _ref.email,
|
|
1188
|
+
setEmail = _ref.setEmail,
|
|
1189
|
+
loginWithEmail = _ref.loginWithEmail,
|
|
1190
|
+
code = _ref.code,
|
|
1191
|
+
setCode = _ref.setCode,
|
|
1192
|
+
formatTime = _ref.formatTime,
|
|
1193
|
+
loginWithEmailCode = _ref.loginWithEmailCode,
|
|
1194
|
+
trackEvent = _ref.trackEvent;
|
|
1195
|
+
var dispatch = useDispatch();
|
|
1196
|
+
var _useState = useState(false),
|
|
1197
|
+
isOTPModalOpen = _useState[0],
|
|
1198
|
+
setIsOTPModalOpen = _useState[1];
|
|
1199
|
+
var _useState2 = useState(""),
|
|
1200
|
+
otpCode = _useState2[0],
|
|
1201
|
+
setOtpCode = _useState2[1];
|
|
1202
|
+
var _useState3 = useState(0),
|
|
1203
|
+
resendCooldown = _useState3[0],
|
|
1204
|
+
setResendCooldown = _useState3[1];
|
|
1205
|
+
var _useState4 = useState(null),
|
|
1206
|
+
resendTimer = _useState4[0],
|
|
1207
|
+
setResendTimer = _useState4[1];
|
|
1208
|
+
var googleLogin = useGoogleLogin({
|
|
1209
|
+
onSuccess: function (tokenResponse) {
|
|
1210
|
+
try {
|
|
1211
|
+
return Promise.resolve(axios.get("https://www.googleapis.com/oauth2/v3/userinfo", {
|
|
1212
|
+
headers: {
|
|
1213
|
+
Authorization: "Bearer " + tokenResponse.access_token
|
|
1214
|
+
}
|
|
1215
|
+
})).then(function (userInfo) {
|
|
1216
|
+
return function () {
|
|
1217
|
+
if (userInfo && userInfo.data) {
|
|
1218
|
+
var _userInfo$data = userInfo.data,
|
|
1219
|
+
_email = _userInfo$data.email,
|
|
1220
|
+
picture = _userInfo$data.picture,
|
|
1221
|
+
family_name = _userInfo$data.family_name,
|
|
1222
|
+
given_name = _userInfo$data.given_name,
|
|
1223
|
+
name = _userInfo$data.name,
|
|
1224
|
+
sub = _userInfo$data.sub;
|
|
1225
|
+
var accessToken = tokenResponse.access_token;
|
|
1226
|
+
var infoLogin = {
|
|
1227
|
+
imageUrl: picture,
|
|
1228
|
+
fullName: name,
|
|
1229
|
+
firstName: family_name,
|
|
1230
|
+
lastName: given_name,
|
|
1231
|
+
email: _email,
|
|
1232
|
+
token: accessToken,
|
|
1233
|
+
googleId: sub,
|
|
1234
|
+
role: role,
|
|
1235
|
+
type: TypeLogin.Google
|
|
1236
|
+
};
|
|
1237
|
+
dispatch(setLoading(true));
|
|
1238
|
+
return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
|
|
1239
|
+
var _authResult$data;
|
|
1240
|
+
if (((_authResult$data = authResult.data) === null || _authResult$data === void 0 ? void 0 : _authResult$data.id) == null) {
|
|
1241
|
+
dispatch(setLoading(false));
|
|
1242
|
+
alert("Please contact admin.");
|
|
1243
|
+
return;
|
|
1244
|
+
}
|
|
1245
|
+
localStorage.clear();
|
|
1246
|
+
var tokenJWT = authResult.data.token;
|
|
1247
|
+
trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
|
|
1248
|
+
eventName: AmplitudeEvent.LOGIN,
|
|
1249
|
+
eventProperties: {
|
|
1250
|
+
email: _email,
|
|
1251
|
+
login_method: 'google',
|
|
1252
|
+
user_role: authResult.data.role,
|
|
1253
|
+
success: true,
|
|
1254
|
+
timestamp: new Date().toISOString()
|
|
1255
|
+
}
|
|
1256
|
+
});
|
|
1257
|
+
if (role === "LandingPage") {
|
|
1258
|
+
CookieService.setAuthCookie({
|
|
1259
|
+
token: tokenJWT,
|
|
1260
|
+
expiresAt: Date.now() + 24 * 60 * 60 * 1000
|
|
1261
|
+
});
|
|
1262
|
+
var getRedirectUrl = function getRedirectUrl(role) {
|
|
1263
|
+
switch (role) {
|
|
1264
|
+
case "Admin":
|
|
1265
|
+
return ADMIN_ORIGIN;
|
|
1266
|
+
case "Teacher":
|
|
1267
|
+
return TEACHER_ORIGIN;
|
|
1268
|
+
default:
|
|
1269
|
+
return role + "." + REQUEST_ORIGIN;
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1272
|
+
var redirectUrl = getRedirectUrl(authResult.data.role);
|
|
1273
|
+
window.location.href = redirectUrl + "/dashboard";
|
|
1274
|
+
dispatch(setLoading(false));
|
|
1275
|
+
}
|
|
1276
|
+
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
1277
|
+
onNavigate("/dashboard");
|
|
1278
|
+
dispatch(setLoading(false));
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
}();
|
|
1282
|
+
});
|
|
1283
|
+
} catch (e) {
|
|
1284
|
+
return Promise.reject(e);
|
|
1676
1285
|
}
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1286
|
+
},
|
|
1287
|
+
onError: function onError(errorResponse) {
|
|
1288
|
+
return console.log(errorResponse);
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
React.useEffect(function () {
|
|
1292
|
+
return function () {
|
|
1293
|
+
if (resendTimer) {
|
|
1294
|
+
clearInterval(resendTimer);
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
}, [resendTimer]);
|
|
1298
|
+
var handleEmailLogin = function handleEmailLogin() {
|
|
1299
|
+
if (!email.trim()) {
|
|
1300
|
+
alert("Please enter your email");
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
loginWithEmail(role);
|
|
1304
|
+
setIsOTPModalOpen(true);
|
|
1679
1305
|
};
|
|
1680
|
-
var
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1306
|
+
var startResendCooldown = function startResendCooldown() {
|
|
1307
|
+
setResendCooldown(300);
|
|
1308
|
+
if (resendTimer) {
|
|
1309
|
+
clearInterval(resendTimer);
|
|
1310
|
+
}
|
|
1311
|
+
var timer = setInterval(function () {
|
|
1312
|
+
setResendCooldown(function (prev) {
|
|
1313
|
+
if (prev <= 1) {
|
|
1314
|
+
clearInterval(timer);
|
|
1315
|
+
return 0;
|
|
1316
|
+
}
|
|
1317
|
+
return prev - 1;
|
|
1318
|
+
});
|
|
1319
|
+
}, 1000);
|
|
1320
|
+
setResendTimer(timer);
|
|
1685
1321
|
};
|
|
1686
|
-
var
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
return styles;
|
|
1322
|
+
var handleResend = function handleResend() {
|
|
1323
|
+
if (resendCooldown > 0) {
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
if (!email.trim()) {
|
|
1327
|
+
alert("Please enter your email");
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
loginWithEmail(role);
|
|
1331
|
+
startResendCooldown();
|
|
1697
1332
|
};
|
|
1698
|
-
var
|
|
1699
|
-
var
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
});
|
|
1703
|
-
return styles;
|
|
1333
|
+
var formatResendTime = function formatResendTime(seconds) {
|
|
1334
|
+
var mins = Math.floor(seconds / 60);
|
|
1335
|
+
var secs = seconds % 60;
|
|
1336
|
+
return mins + ":" + secs.toString().padStart(2, '0');
|
|
1704
1337
|
};
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1338
|
+
React.useEffect(function () {
|
|
1339
|
+
return function () {
|
|
1340
|
+
if (resendTimer) {
|
|
1341
|
+
clearInterval(resendTimer);
|
|
1342
|
+
}
|
|
1343
|
+
};
|
|
1344
|
+
}, [resendTimer]);
|
|
1345
|
+
return React.createElement(React.Fragment, null, React.createElement(Row, {
|
|
1346
|
+
style: {
|
|
1347
|
+
height: "100%"
|
|
1348
|
+
}
|
|
1349
|
+
}, React.createElement(Col, {
|
|
1350
|
+
sm: 12,
|
|
1351
|
+
lg: role != "Admin" ? 7 : 12
|
|
1352
|
+
}, React.createElement("div", {
|
|
1353
|
+
className: "" + styleGlobal["box-signin-container"]
|
|
1354
|
+
}, React.createElement("div", {
|
|
1355
|
+
className: styleGlobal["box-signin-logo"] + " "
|
|
1356
|
+
}, React.createElement(Link, {
|
|
1357
|
+
to: "/",
|
|
1358
|
+
className: "d-flex"
|
|
1359
|
+
}, React.createElement("img", {
|
|
1360
|
+
src: "/images/Logo.png",
|
|
1361
|
+
alt: "",
|
|
1362
|
+
height: 37,
|
|
1363
|
+
width: 155,
|
|
1364
|
+
className: "my-auto"
|
|
1365
|
+
}))), React.createElement("div", {
|
|
1366
|
+
className: styleGlobal["box-signin"] + " "
|
|
1367
|
+
}, React.createElement("div", {
|
|
1368
|
+
className: "" + styleGlobal["signin_title"]
|
|
1369
|
+
}, React.createElement("span", null, "Welcome to Edusfere")), !hiddenSignup && React.createElement("div", {
|
|
1370
|
+
className: "" + styleGlobal["signup_link"]
|
|
1371
|
+
}, React.createElement("span", null, "Don't have an account?", " ", React.createElement(Link, {
|
|
1372
|
+
to: "/",
|
|
1373
|
+
style: {
|
|
1374
|
+
color: "#00A0DA"
|
|
1375
|
+
},
|
|
1376
|
+
className: "text-decoration-none"
|
|
1377
|
+
}, "Sign up"))), React.createElement("div", {
|
|
1378
|
+
className: "" + styleGlobal["google_button"]
|
|
1379
|
+
}, React.createElement("button", {
|
|
1380
|
+
onClick: function onClick() {
|
|
1381
|
+
return googleLogin();
|
|
1382
|
+
}
|
|
1383
|
+
}, React.createElement("img", {
|
|
1384
|
+
width: 24,
|
|
1385
|
+
height: 24,
|
|
1386
|
+
alt: "Google sign-in",
|
|
1387
|
+
src: "/images/icons/Google__G__logo.png"
|
|
1388
|
+
}), "Sign in with Google")), React.createElement("span", {
|
|
1389
|
+
className: "" + styleGlobal["box-field"]
|
|
1390
|
+
}, "OR"), React.createElement("div", {
|
|
1391
|
+
className: "" + styleGlobal["box-input"]
|
|
1392
|
+
}, React.createElement("input", {
|
|
1393
|
+
type: "email",
|
|
1394
|
+
placeholder: "Email",
|
|
1395
|
+
value: email,
|
|
1396
|
+
onChange: function onChange(event) {
|
|
1397
|
+
setEmail(event.target.value.trim());
|
|
1398
|
+
}
|
|
1399
|
+
})), React.createElement("button", {
|
|
1400
|
+
onClick: handleEmailLogin,
|
|
1401
|
+
className: "" + styleGlobal["box-button-email"],
|
|
1402
|
+
disabled: !email.trim()
|
|
1403
|
+
}, React.createElement("img", {
|
|
1404
|
+
width: 20,
|
|
1405
|
+
height: 20,
|
|
1406
|
+
alt: "Email sign-in",
|
|
1407
|
+
src: "/images/icons/Login_icon.png"
|
|
1408
|
+
}), "Sign in with Email")), React.createElement("div", {
|
|
1409
|
+
className: styleGlobal["box-signin-text"] + " "
|
|
1410
|
+
}, React.createElement("span", {
|
|
1411
|
+
style: {
|
|
1709
1412
|
fontSize: "13px",
|
|
1710
|
-
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
className: "" +
|
|
1413
|
+
color: "#A6A6AD"
|
|
1414
|
+
}
|
|
1415
|
+
}, "By signing in, you agree to our Terms & Privacy Policy")))), role != "Admin" && role != 'LandingPage' && React.createElement(Col, {
|
|
1416
|
+
sm: 12,
|
|
1417
|
+
lg: 5,
|
|
1418
|
+
className: "d-none d-lg-block " + styleGlobal["pr-30"]
|
|
1419
|
+
}, React.createElement("div", {
|
|
1420
|
+
className: "" + styleGlobal["box-right"],
|
|
1716
1421
|
style: {
|
|
1717
|
-
|
|
1422
|
+
backgroundImage: "url('/images/bg_login.png')"
|
|
1718
1423
|
}
|
|
1719
|
-
},
|
|
1720
|
-
className:
|
|
1721
|
-
},
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1424
|
+
}, React.createElement("div", {
|
|
1425
|
+
className: "" + styleGlobal["box-right-body"]
|
|
1426
|
+
}, React.createElement("span", {
|
|
1427
|
+
style: {
|
|
1428
|
+
fontSize: "24px",
|
|
1429
|
+
fontWeight: "700"
|
|
1430
|
+
}
|
|
1431
|
+
}, "As a teacher, your time and energy are too valuable to waste"), React.createElement("p", {
|
|
1432
|
+
className: " fw-normal ",
|
|
1433
|
+
style: {
|
|
1434
|
+
marginTop: "12px",
|
|
1435
|
+
marginBottom: "24px",
|
|
1436
|
+
color: "#03191F"
|
|
1437
|
+
}
|
|
1438
|
+
}, "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) {
|
|
1439
|
+
return React.createElement("li", {
|
|
1440
|
+
key: it,
|
|
1441
|
+
className: "mb-2 ",
|
|
1442
|
+
style: {
|
|
1443
|
+
color: "#212126"
|
|
1444
|
+
}
|
|
1445
|
+
}, item);
|
|
1446
|
+
})), React.createElement("div", {
|
|
1447
|
+
className: "" + styleGlobal["box-right-footer"]
|
|
1448
|
+
}, React.createElement("img", {
|
|
1449
|
+
className: "img-fluid",
|
|
1450
|
+
alt: "",
|
|
1451
|
+
src: "/images/image_login.png",
|
|
1452
|
+
style: {
|
|
1453
|
+
width: "15vw"
|
|
1454
|
+
}
|
|
1455
|
+
}), 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", {
|
|
1456
|
+
className: "d-block"
|
|
1457
|
+
}, "Thank you!"), React.createElement("img", {
|
|
1458
|
+
style: {
|
|
1459
|
+
marginTop: "-15px"
|
|
1460
|
+
},
|
|
1461
|
+
alt: "",
|
|
1462
|
+
src: "/images/icons/Vector 22.png"
|
|
1463
|
+
}))))))), role === "LandingPage" && React.createElement(Col, {
|
|
1464
|
+
sm: 12,
|
|
1465
|
+
lg: 5,
|
|
1466
|
+
className: "d-none d-lg-block " + styleGlobal["pr-30"]
|
|
1467
|
+
}, React.createElement("div", {
|
|
1468
|
+
className: "" + styleGlobal["box-right"],
|
|
1469
|
+
style: {
|
|
1470
|
+
backgroundImage: "url('/images/bg_login.png')"
|
|
1471
|
+
}
|
|
1472
|
+
}, React.createElement("div", {
|
|
1473
|
+
className: "" + styleGlobal["box-right-body"]
|
|
1474
|
+
}, React.createElement("span", {
|
|
1475
|
+
style: {
|
|
1476
|
+
fontSize: "24px",
|
|
1477
|
+
fontWeight: "700"
|
|
1478
|
+
}
|
|
1479
|
+
}, "Get ready to manage your realm!"), React.createElement("p", {
|
|
1480
|
+
className: " fw-normal ",
|
|
1481
|
+
style: {
|
|
1482
|
+
marginTop: "12px",
|
|
1483
|
+
marginBottom: "24px",
|
|
1484
|
+
color: "#03191F"
|
|
1485
|
+
}
|
|
1486
|
+
}, "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) {
|
|
1487
|
+
return React.createElement("li", {
|
|
1488
|
+
key: it,
|
|
1489
|
+
className: "mb-2 ",
|
|
1490
|
+
style: {
|
|
1491
|
+
color: "#212126"
|
|
1492
|
+
}
|
|
1493
|
+
}, item);
|
|
1494
|
+
})), React.createElement("div", {
|
|
1495
|
+
className: "" + styleGlobal["box-right-footer"]
|
|
1496
|
+
}, React.createElement("img", {
|
|
1497
|
+
className: "img-fluid",
|
|
1498
|
+
alt: "",
|
|
1499
|
+
src: "/images/image_login.png",
|
|
1500
|
+
style: {
|
|
1501
|
+
width: "15vw"
|
|
1502
|
+
}
|
|
1503
|
+
}), 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", {
|
|
1504
|
+
className: "d-block"
|
|
1505
|
+
}, "Thank you!"), React.createElement("img", {
|
|
1506
|
+
style: {
|
|
1507
|
+
marginTop: "-15px"
|
|
1508
|
+
},
|
|
1509
|
+
alt: "",
|
|
1510
|
+
src: "/images/icons/Vector 22.png"
|
|
1511
|
+
})))))))), React.createElement(CoreModal, {
|
|
1512
|
+
open: isOTPModalOpen,
|
|
1513
|
+
onClose: function onClose() {
|
|
1514
|
+
setIsOTPModalOpen(false);
|
|
1515
|
+
setResendCooldown(0);
|
|
1516
|
+
if (resendTimer) {
|
|
1517
|
+
clearInterval(resendTimer);
|
|
1518
|
+
}
|
|
1519
|
+
},
|
|
1520
|
+
title: "Enter OTP Code",
|
|
1521
|
+
footer: React.createElement(React.Fragment, null, React.createElement(CoreButton, {
|
|
1522
|
+
onClick: function onClick() {
|
|
1523
|
+
setIsOTPModalOpen(false);
|
|
1524
|
+
setResendCooldown(0);
|
|
1525
|
+
if (resendTimer) {
|
|
1526
|
+
clearInterval(resendTimer);
|
|
1527
|
+
}
|
|
1745
1528
|
},
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1529
|
+
type: "text"
|
|
1530
|
+
}, "Cancel"), React.createElement(CoreButton, {
|
|
1531
|
+
type: "primary",
|
|
1532
|
+
htmlType: "submit",
|
|
1533
|
+
onClick: function onClick() {
|
|
1534
|
+
if (!otpCode.trim()) {
|
|
1535
|
+
alert("Please enter the OTP code");
|
|
1536
|
+
return;
|
|
1537
|
+
}
|
|
1538
|
+
loginWithEmailCode(role);
|
|
1539
|
+
setIsOTPModalOpen(false);
|
|
1540
|
+
setResendCooldown(0);
|
|
1541
|
+
if (resendTimer) {
|
|
1542
|
+
clearInterval(resendTimer);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
}, "Login"))
|
|
1546
|
+
}, React.createElement("div", {
|
|
1547
|
+
className: "mx-auto",
|
|
1548
|
+
style: {
|
|
1549
|
+
maxWidth: 400,
|
|
1550
|
+
width: 400
|
|
1753
1551
|
}
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
})
|
|
1552
|
+
}, React.createElement("p", {
|
|
1553
|
+
className: "text-sm text-muted mb-2"
|
|
1554
|
+
}, "A one-time verification code has just been sent to your registered email. Please enter it below."), React.createElement("div", {
|
|
1555
|
+
className: "" + styleGlobal["box-input"]
|
|
1556
|
+
}, React.createElement(CoreInput, {
|
|
1557
|
+
name: "otpCode",
|
|
1558
|
+
value: code,
|
|
1559
|
+
onChange: function onChange(event) {
|
|
1560
|
+
setCode(event.target.value);
|
|
1561
|
+
setOtpCode(event.target.value);
|
|
1562
|
+
},
|
|
1563
|
+
placeholder: "Code OTP"
|
|
1564
|
+
}), React.createElement("p", {
|
|
1565
|
+
className: "mt-1 text-muted"
|
|
1566
|
+
}, "Your code will expire: ", React.createElement("span", {
|
|
1567
|
+
className: "text-danger"
|
|
1568
|
+
}, formatTime()))), React.createElement("p", {
|
|
1569
|
+
className: "mt-3 text-muted mb-0"
|
|
1570
|
+
}, "Didn't receive the code?", " ", resendCooldown > 0 ? React.createElement("span", {
|
|
1571
|
+
className: "text-muted"
|
|
1572
|
+
}, "Resend available in ", formatResendTime(resendCooldown)) : React.createElement("span", {
|
|
1573
|
+
className: "text-primary cursor-pointer",
|
|
1574
|
+
style: {
|
|
1575
|
+
cursor: "pointer"
|
|
1576
|
+
},
|
|
1577
|
+
onClick: handleResend
|
|
1578
|
+
}, "Click here to resend"), " ", "or check your spam inbox."))));
|
|
1757
1579
|
};
|
|
1758
1580
|
|
|
1759
|
-
|
|
1581
|
+
// A type of promise-like that resolves synchronously and supports only one observer
|
|
1760
1582
|
|
|
1761
|
-
|
|
1762
|
-
var name = props.name,
|
|
1763
|
-
checked = props.checked,
|
|
1764
|
-
_onChange = props.onChange,
|
|
1765
|
-
_props$disabled = props.disabled,
|
|
1766
|
-
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
1767
|
-
label = props.label;
|
|
1768
|
-
return React.createElement("div", {
|
|
1769
|
-
className: "" + styles$4["core-checkbox"]
|
|
1770
|
-
}, React.createElement(FormGroup, {
|
|
1771
|
-
check: true,
|
|
1772
|
-
inline: true
|
|
1773
|
-
}, React.createElement(Input, {
|
|
1774
|
-
id: "core-checkbox-" + name,
|
|
1775
|
-
type: "checkbox",
|
|
1776
|
-
name: name,
|
|
1777
|
-
checked: checked,
|
|
1778
|
-
onChange: function onChange(e) {
|
|
1779
|
-
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(name, e.target.checked);
|
|
1780
|
-
},
|
|
1781
|
-
disabled: disabled
|
|
1782
|
-
}), React.createElement(Label, {
|
|
1783
|
-
htmlFor: "core-checkbox-" + name,
|
|
1784
|
-
check: true
|
|
1785
|
-
}, label)));
|
|
1786
|
-
};
|
|
1583
|
+
const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
|
|
1787
1584
|
|
|
1788
|
-
|
|
1585
|
+
const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
|
|
1789
1586
|
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1587
|
+
// Asynchronously call a function and send errors to recovery continuation
|
|
1588
|
+
function _catch(body, recover) {
|
|
1589
|
+
try {
|
|
1590
|
+
var result = body();
|
|
1591
|
+
} catch(e) {
|
|
1592
|
+
return recover(e);
|
|
1593
|
+
}
|
|
1594
|
+
if (result && result.then) {
|
|
1595
|
+
return result.then(void 0, recover);
|
|
1596
|
+
}
|
|
1597
|
+
return result;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
var defaultInfo = {
|
|
1601
|
+
email: "",
|
|
1602
|
+
password: "",
|
|
1603
|
+
captcha: "",
|
|
1604
|
+
rememberMe: false
|
|
1605
|
+
};
|
|
1606
|
+
var minutes = 15;
|
|
1607
|
+
var useLogin = function useLogin(onNavigate, trackEvent) {
|
|
1608
|
+
var _useState = useState(false),
|
|
1609
|
+
openLogin = _useState[0],
|
|
1610
|
+
setOpenLogin = _useState[1];
|
|
1611
|
+
var _useState2 = useState(),
|
|
1612
|
+
infoUser = _useState2[0],
|
|
1613
|
+
setInfoUser = _useState2[1];
|
|
1614
|
+
var dispatch = useDispatch();
|
|
1615
|
+
var toggle = useCallback(function () {
|
|
1616
|
+
setOpenLogin(!openLogin);
|
|
1617
|
+
}, [openLogin]);
|
|
1618
|
+
var _useState3 = useState(""),
|
|
1619
|
+
email = _useState3[0],
|
|
1620
|
+
setEmail = _useState3[1];
|
|
1621
|
+
var _useState4 = useState(""),
|
|
1622
|
+
code = _useState4[0],
|
|
1623
|
+
setCode = _useState4[1];
|
|
1624
|
+
var _useState5 = useState(false),
|
|
1625
|
+
isScreenCode = _useState5[0],
|
|
1626
|
+
setIsScreenCode = _useState5[1];
|
|
1627
|
+
var _useState6 = useState(minutes * 60),
|
|
1628
|
+
timeLeft = _useState6[0],
|
|
1629
|
+
setTimeLeft = _useState6[1];
|
|
1630
|
+
var loginWithEmail = function loginWithEmail(role) {
|
|
1631
|
+
try {
|
|
1632
|
+
var _temp2 = function _temp2() {
|
|
1633
|
+
dispatch(setLoading(false));
|
|
1634
|
+
};
|
|
1635
|
+
dispatch(setLoading(true));
|
|
1636
|
+
var _temp = _catch(function () {
|
|
1637
|
+
var body = {
|
|
1638
|
+
email: email,
|
|
1639
|
+
role: role
|
|
1640
|
+
};
|
|
1641
|
+
return Promise.resolve(apiSendEmailCode(body)).then(function (res) {
|
|
1642
|
+
var data = res.data;
|
|
1643
|
+
if (data.status == 1) {
|
|
1644
|
+
if (data.data.token != null) {
|
|
1645
|
+
var tokenJWT = data.data.token;
|
|
1646
|
+
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
1647
|
+
trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
|
|
1648
|
+
eventName: AmplitudeEvent.LOGIN,
|
|
1649
|
+
eventProperties: {
|
|
1650
|
+
email: email,
|
|
1651
|
+
login_method: 'email',
|
|
1652
|
+
timestamp: new Date().toISOString()
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
onNavigate("/dashboard");
|
|
1656
|
+
} else {
|
|
1657
|
+
setIsScreenCode(true);
|
|
1658
|
+
}
|
|
1659
|
+
} else {
|
|
1660
|
+
dispatch(setLoading(false));
|
|
1661
|
+
alert("Please contact admin.");
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
}, function (e) {
|
|
1665
|
+
toast.error("An error occurred while sending the code. Please try again later.");
|
|
1666
|
+
console.log(e);
|
|
1667
|
+
});
|
|
1668
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
|
|
1669
|
+
} catch (e) {
|
|
1670
|
+
return Promise.reject(e);
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
var loginWithEmailCode = function loginWithEmailCode(role) {
|
|
1674
|
+
try {
|
|
1675
|
+
var _temp4 = function _temp4() {
|
|
1676
|
+
dispatch(setLoading(false));
|
|
1677
|
+
};
|
|
1678
|
+
dispatch(setLoading(true));
|
|
1679
|
+
var _temp3 = _catch(function () {
|
|
1680
|
+
return Promise.resolve(apiCheckEmailCode({
|
|
1681
|
+
email: email,
|
|
1682
|
+
code: code,
|
|
1683
|
+
role: role
|
|
1684
|
+
})).then(function (res) {
|
|
1685
|
+
var data = res.data;
|
|
1686
|
+
if (data.status == 1) {
|
|
1687
|
+
localStorage.clear();
|
|
1688
|
+
var tokenJWT = data.data.token;
|
|
1689
|
+
localStorage.setItem(ACCESS_TOKEN, tokenJWT);
|
|
1690
|
+
trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
|
|
1691
|
+
eventName: AmplitudeEvent.LOGIN,
|
|
1692
|
+
eventProperties: {
|
|
1693
|
+
email: email,
|
|
1694
|
+
login_method: 'email',
|
|
1695
|
+
timestamp: new Date().toISOString()
|
|
1696
|
+
}
|
|
1697
|
+
});
|
|
1698
|
+
onNavigate("/dashboard");
|
|
1699
|
+
} else {
|
|
1700
|
+
dispatch(setLoading(false));
|
|
1701
|
+
alert("The code is not correct. Please check again.");
|
|
1702
|
+
}
|
|
1703
|
+
});
|
|
1704
|
+
}, function (e) {
|
|
1705
|
+
console.log(e);
|
|
1706
|
+
});
|
|
1707
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
|
|
1708
|
+
} catch (e) {
|
|
1709
|
+
return Promise.reject(e);
|
|
1710
|
+
}
|
|
1711
|
+
};
|
|
1712
|
+
var formatTime = function formatTime() {
|
|
1713
|
+
var m = Math.floor(timeLeft / 60);
|
|
1714
|
+
var s = timeLeft % 60;
|
|
1715
|
+
return m.toString().padStart(2, '0') + ":" + s.toString().padStart(2, '0');
|
|
1716
|
+
};
|
|
1717
|
+
useEffect(function () {
|
|
1718
|
+
if (isScreenCode) {
|
|
1719
|
+
var timer = setInterval(function () {
|
|
1720
|
+
setTimeLeft(function (prev) {
|
|
1721
|
+
if (prev <= 1) {
|
|
1722
|
+
clearInterval(timer);
|
|
1723
|
+
return 0;
|
|
1724
|
+
}
|
|
1725
|
+
return prev - 1;
|
|
1726
|
+
});
|
|
1727
|
+
}, 1000);
|
|
1728
|
+
return function () {
|
|
1729
|
+
return clearInterval(timer);
|
|
1730
|
+
};
|
|
1731
|
+
}
|
|
1732
|
+
return;
|
|
1733
|
+
}, [isScreenCode]);
|
|
1734
|
+
return {
|
|
1735
|
+
defaultInfo: defaultInfo,
|
|
1736
|
+
openLogin: openLogin,
|
|
1737
|
+
toggle: toggle,
|
|
1738
|
+
email: email,
|
|
1739
|
+
setEmail: setEmail,
|
|
1740
|
+
loginWithEmail: loginWithEmail,
|
|
1741
|
+
infoUser: infoUser,
|
|
1742
|
+
setInfoUser: setInfoUser,
|
|
1743
|
+
code: code,
|
|
1744
|
+
setCode: setCode,
|
|
1745
|
+
isScreenCode: isScreenCode,
|
|
1746
|
+
formatTime: formatTime,
|
|
1747
|
+
loginWithEmailCode: loginWithEmailCode
|
|
1748
|
+
};
|
|
1749
|
+
};
|
|
1750
|
+
|
|
1751
|
+
var Login = function Login(props) {
|
|
1752
|
+
var onNavigate = props.onNavigate,
|
|
1753
|
+
role = props.role,
|
|
1754
|
+
hiddenSignup = props.hiddenSignup,
|
|
1755
|
+
trackEvent = props.trackEvent;
|
|
1756
|
+
var _useLogin = useLogin(onNavigate, trackEvent),
|
|
1757
|
+
defaultInfo = _useLogin.defaultInfo,
|
|
1758
|
+
email = _useLogin.email,
|
|
1759
|
+
setEmail = _useLogin.setEmail,
|
|
1760
|
+
loginWithEmail = _useLogin.loginWithEmail,
|
|
1761
|
+
code = _useLogin.code,
|
|
1762
|
+
setCode = _useLogin.setCode,
|
|
1763
|
+
isScreenCode = _useLogin.isScreenCode,
|
|
1764
|
+
formatTime = _useLogin.formatTime,
|
|
1765
|
+
loginWithEmailCode = _useLogin.loginWithEmailCode;
|
|
1797
1766
|
return React.createElement("div", {
|
|
1798
|
-
className: "" +
|
|
1799
|
-
}, React.createElement(
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
disabled: disabled || i.disabled
|
|
1815
|
-
}), React.createElement(Label, {
|
|
1816
|
-
htmlFor: "core-radio-" + i.value
|
|
1817
|
-
}, i.label));
|
|
1818
|
-
})));
|
|
1767
|
+
className: styleGlobal["signup_wrap"] + " container-fluid font-family-lato"
|
|
1768
|
+
}, React.createElement(BlockLogin, {
|
|
1769
|
+
defaultInfo: defaultInfo,
|
|
1770
|
+
email: email,
|
|
1771
|
+
hiddenSignup: hiddenSignup,
|
|
1772
|
+
setEmail: setEmail,
|
|
1773
|
+
loginWithEmail: loginWithEmail,
|
|
1774
|
+
code: code,
|
|
1775
|
+
setCode: setCode,
|
|
1776
|
+
formatTime: formatTime,
|
|
1777
|
+
isScreenCode: isScreenCode,
|
|
1778
|
+
onNavigate: onNavigate,
|
|
1779
|
+
loginWithEmailCode: loginWithEmailCode,
|
|
1780
|
+
role: role,
|
|
1781
|
+
trackEvent: trackEvent
|
|
1782
|
+
}));
|
|
1819
1783
|
};
|
|
1820
1784
|
|
|
1821
|
-
|
|
1785
|
+
// src/utils/formatProdErrorMessage.ts
|
|
1786
|
+
function formatProdErrorMessage(code) {
|
|
1787
|
+
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
1788
|
+
}
|
|
1822
1789
|
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
handleSubmit = props.handleSubmit,
|
|
1830
|
-
onSubmit = props.onSubmit,
|
|
1831
|
-
_props$bodyPadding = props.bodyPadding,
|
|
1832
|
-
bodyPadding = _props$bodyPadding === void 0 ? "24px" : _props$bodyPadding,
|
|
1833
|
-
className = props.className;
|
|
1834
|
-
return React.createElement(Modal, {
|
|
1835
|
-
isOpen: open,
|
|
1836
|
-
toggle: onClose,
|
|
1837
|
-
centered: true,
|
|
1838
|
-
modalClassName: className
|
|
1839
|
-
}, React.createElement("form", {
|
|
1840
|
-
onSubmit: onSubmit ? handleSubmit(onSubmit) : undefined,
|
|
1841
|
-
className: "" + styles$6["core-modal-container"]
|
|
1842
|
-
}, React.createElement(ModalHeader, {
|
|
1843
|
-
toggle: onClose,
|
|
1844
|
-
className: styles$6["core-modal-header"]
|
|
1845
|
-
}, title), React.createElement(ModalBody, {
|
|
1846
|
-
style: {
|
|
1847
|
-
padding: bodyPadding
|
|
1848
|
-
}
|
|
1849
|
-
}, children), footer && React.createElement(ModalFooter, null, footer)));
|
|
1790
|
+
// src/utils/actionTypes.ts
|
|
1791
|
+
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
1792
|
+
var ActionTypes = {
|
|
1793
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
1794
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
1795
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
1850
1796
|
};
|
|
1797
|
+
var actionTypes_default = ActionTypes;
|
|
1851
1798
|
|
|
1852
|
-
|
|
1799
|
+
// src/utils/isPlainObject.ts
|
|
1800
|
+
function isPlainObject(obj) {
|
|
1801
|
+
if (typeof obj !== "object" || obj === null)
|
|
1802
|
+
return false;
|
|
1803
|
+
let proto = obj;
|
|
1804
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
1805
|
+
proto = Object.getPrototypeOf(proto);
|
|
1806
|
+
}
|
|
1807
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
1808
|
+
}
|
|
1853
1809
|
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1810
|
+
// src/utils/kindOf.ts
|
|
1811
|
+
function miniKindOf(val) {
|
|
1812
|
+
if (val === void 0)
|
|
1813
|
+
return "undefined";
|
|
1814
|
+
if (val === null)
|
|
1815
|
+
return "null";
|
|
1816
|
+
const type = typeof val;
|
|
1817
|
+
switch (type) {
|
|
1818
|
+
case "boolean":
|
|
1819
|
+
case "string":
|
|
1820
|
+
case "number":
|
|
1821
|
+
case "symbol":
|
|
1822
|
+
case "function": {
|
|
1823
|
+
return type;
|
|
1867
1824
|
}
|
|
1868
|
-
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1825
|
+
}
|
|
1826
|
+
if (Array.isArray(val))
|
|
1827
|
+
return "array";
|
|
1828
|
+
if (isDate(val))
|
|
1829
|
+
return "date";
|
|
1830
|
+
if (isError(val))
|
|
1831
|
+
return "error";
|
|
1832
|
+
const constructorName = ctorName(val);
|
|
1833
|
+
switch (constructorName) {
|
|
1834
|
+
case "Symbol":
|
|
1835
|
+
case "Promise":
|
|
1836
|
+
case "WeakMap":
|
|
1837
|
+
case "WeakSet":
|
|
1838
|
+
case "Map":
|
|
1839
|
+
case "Set":
|
|
1840
|
+
return constructorName;
|
|
1841
|
+
}
|
|
1842
|
+
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
1843
|
+
}
|
|
1844
|
+
function ctorName(val) {
|
|
1845
|
+
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
1846
|
+
}
|
|
1847
|
+
function isError(val) {
|
|
1848
|
+
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
1849
|
+
}
|
|
1850
|
+
function isDate(val) {
|
|
1851
|
+
if (val instanceof Date)
|
|
1852
|
+
return true;
|
|
1853
|
+
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
1854
|
+
}
|
|
1855
|
+
function kindOf(val) {
|
|
1856
|
+
let typeOfVal = typeof val;
|
|
1857
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1858
|
+
typeOfVal = miniKindOf(val);
|
|
1859
|
+
}
|
|
1860
|
+
return typeOfVal;
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
// src/utils/warning.ts
|
|
1864
|
+
function warning(message) {
|
|
1865
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
1866
|
+
console.error(message);
|
|
1867
|
+
}
|
|
1868
|
+
try {
|
|
1869
|
+
throw new Error(message);
|
|
1870
|
+
} catch (e) {
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
// src/combineReducers.ts
|
|
1875
|
+
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
1876
|
+
const reducerKeys = Object.keys(reducers);
|
|
1877
|
+
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
1878
|
+
if (reducerKeys.length === 0) {
|
|
1879
|
+
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
1880
|
+
}
|
|
1881
|
+
if (!isPlainObject(inputState)) {
|
|
1882
|
+
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
1883
|
+
}
|
|
1884
|
+
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
1885
|
+
unexpectedKeys.forEach((key) => {
|
|
1886
|
+
unexpectedKeyCache[key] = true;
|
|
1887
|
+
});
|
|
1888
|
+
if (action && action.type === actionTypes_default.REPLACE)
|
|
1889
|
+
return;
|
|
1890
|
+
if (unexpectedKeys.length > 0) {
|
|
1891
|
+
return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
function assertReducerShape(reducers) {
|
|
1895
|
+
Object.keys(reducers).forEach((key) => {
|
|
1896
|
+
const reducer = reducers[key];
|
|
1897
|
+
const initialState = reducer(void 0, {
|
|
1898
|
+
type: actionTypes_default.INIT
|
|
1899
|
+
});
|
|
1900
|
+
if (typeof initialState === "undefined") {
|
|
1901
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
1902
|
+
}
|
|
1903
|
+
if (typeof reducer(void 0, {
|
|
1904
|
+
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
1905
|
+
}) === "undefined") {
|
|
1906
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
1907
|
+
}
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1910
|
+
function combineReducers(reducers) {
|
|
1911
|
+
const reducerKeys = Object.keys(reducers);
|
|
1912
|
+
const finalReducers = {};
|
|
1913
|
+
for (let i = 0; i < reducerKeys.length; i++) {
|
|
1914
|
+
const key = reducerKeys[i];
|
|
1915
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1916
|
+
if (typeof reducers[key] === "undefined") {
|
|
1917
|
+
warning(`No reducer provided for key "${key}"`);
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
if (typeof reducers[key] === "function") {
|
|
1921
|
+
finalReducers[key] = reducers[key];
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
const finalReducerKeys = Object.keys(finalReducers);
|
|
1925
|
+
let unexpectedKeyCache;
|
|
1926
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1927
|
+
unexpectedKeyCache = {};
|
|
1928
|
+
}
|
|
1929
|
+
let shapeAssertionError;
|
|
1930
|
+
try {
|
|
1931
|
+
assertReducerShape(finalReducers);
|
|
1932
|
+
} catch (e) {
|
|
1933
|
+
shapeAssertionError = e;
|
|
1934
|
+
}
|
|
1935
|
+
return function combination(state = {}, action) {
|
|
1936
|
+
if (shapeAssertionError) {
|
|
1937
|
+
throw shapeAssertionError;
|
|
1938
|
+
}
|
|
1939
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1940
|
+
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
1941
|
+
if (warningMessage) {
|
|
1942
|
+
warning(warningMessage);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
let hasChanged = false;
|
|
1946
|
+
const nextState = {};
|
|
1947
|
+
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
1948
|
+
const key = finalReducerKeys[i];
|
|
1949
|
+
const reducer = finalReducers[key];
|
|
1950
|
+
const previousStateForKey = state[key];
|
|
1951
|
+
const nextStateForKey = reducer(previousStateForKey, action);
|
|
1952
|
+
if (typeof nextStateForKey === "undefined") {
|
|
1953
|
+
const actionType = action && action.type;
|
|
1954
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
1955
|
+
}
|
|
1956
|
+
nextState[key] = nextStateForKey;
|
|
1957
|
+
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
1958
|
+
}
|
|
1959
|
+
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
1960
|
+
return hasChanged ? nextState : state;
|
|
1961
|
+
};
|
|
1962
|
+
}
|
|
1963
|
+
//# sourceMappingURL=redux.mjs.map
|
|
1964
|
+
|
|
1965
|
+
var initialState = {
|
|
1966
|
+
isLoading: false,
|
|
1967
|
+
isLoadingPage: false,
|
|
1968
|
+
alert: {
|
|
1969
|
+
type: "",
|
|
1970
|
+
message: ""
|
|
1971
|
+
},
|
|
1972
|
+
user: null,
|
|
1973
|
+
academy: null,
|
|
1974
|
+
menuCollapse: false,
|
|
1975
|
+
isRefetchSidebar: false
|
|
1879
1976
|
};
|
|
1977
|
+
var commonReducer = createReducer(initialState, function (builder) {
|
|
1978
|
+
builder.addCase(setLoading, function (state, action) {
|
|
1979
|
+
state.isLoading = action.payload;
|
|
1980
|
+
}).addCase(setLoadingPage, function (state, action) {
|
|
1981
|
+
state.isLoadingPage = action.payload;
|
|
1982
|
+
}).addCase(setAlert, function (state, action) {
|
|
1983
|
+
state.alert = action.payload;
|
|
1984
|
+
}).addCase(setUser, function (state, action) {
|
|
1985
|
+
state.user = action.payload;
|
|
1986
|
+
}).addCase(setLanguage, function (state, action) {
|
|
1987
|
+
state.language = action.payload;
|
|
1988
|
+
}).addCase(reset, function (_state, _action) {
|
|
1989
|
+
return initialState;
|
|
1990
|
+
}).addCase(setMenuCollapse, function (state, action) {
|
|
1991
|
+
state.menuCollapse = action.payload;
|
|
1992
|
+
}).addCase(setIsRefetchSidebar, function (state) {
|
|
1993
|
+
state.isRefetchSidebar = !state.isRefetchSidebar;
|
|
1994
|
+
}).addCase(setTenant, function (state, action) {
|
|
1995
|
+
state.user.currentTenantId = action.payload;
|
|
1996
|
+
}).addCase(setAddTenant, function (state, action) {
|
|
1997
|
+
state.user.tenantInfo = action.payload;
|
|
1998
|
+
}).addCase(setTeam, function (state, action) {
|
|
1999
|
+
state.user.currentTeamId = action.payload;
|
|
2000
|
+
});
|
|
2001
|
+
});
|
|
1880
2002
|
|
|
1881
|
-
var
|
|
2003
|
+
var rootReducer = combineReducers({
|
|
2004
|
+
common: commonReducer
|
|
2005
|
+
});
|
|
1882
2006
|
|
|
1883
|
-
var
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
viewBox: "0 0 16 16",
|
|
1892
|
-
fill: "none",
|
|
1893
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
1894
|
-
}, React.createElement("path", {
|
|
1895
|
-
fillRule: "evenodd",
|
|
1896
|
-
clipRule: "evenodd",
|
|
1897
|
-
d: "M9.40376 9.40352C9.63808 9.1692 10.018 9.1692 10.2523 9.40352L13.4243 12.5755C13.6586 12.8098 13.6586 13.1897 13.4243 13.424C13.19 13.6584 12.8101 13.6584 12.5758 13.424L9.40376 10.252C9.16945 10.0177 9.16945 9.63783 9.40376 9.40352Z",
|
|
1898
|
-
fill: color
|
|
1899
|
-
}), React.createElement("path", {
|
|
1900
|
-
fillRule: "evenodd",
|
|
1901
|
-
clipRule: "evenodd",
|
|
1902
|
-
d: "M6.9999 3.5999C5.12213 3.5999 3.5999 5.12213 3.5999 6.9999C3.5999 8.87767 5.12213 10.3999 6.9999 10.3999C8.87767 10.3999 10.3999 8.87767 10.3999 6.9999C10.3999 5.12213 8.87767 3.5999 6.9999 3.5999ZM2.3999 6.9999C2.3999 4.45939 4.45939 2.3999 6.9999 2.3999C9.54041 2.3999 11.5999 4.45939 11.5999 6.9999C11.5999 9.54041 9.54041 11.5999 6.9999 11.5999C4.45939 11.5999 2.3999 9.54041 2.3999 6.9999Z",
|
|
1903
|
-
fill: color
|
|
1904
|
-
}));
|
|
1905
|
-
};
|
|
2007
|
+
var store = configureStore({
|
|
2008
|
+
reducer: rootReducer,
|
|
2009
|
+
middleware: function middleware(getDefaultMiddleware) {
|
|
2010
|
+
return getDefaultMiddleware({
|
|
2011
|
+
serializableCheck: false
|
|
2012
|
+
});
|
|
2013
|
+
}
|
|
2014
|
+
});
|
|
1906
2015
|
|
|
1907
|
-
var
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
height: size,
|
|
1915
|
-
viewBox: "0 0 16 16",
|
|
1916
|
-
fill: "none",
|
|
1917
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
1918
|
-
}, React.createElement("g", {
|
|
1919
|
-
clipPath: "url(#clip0_1060_48455)"
|
|
1920
|
-
}, React.createElement("rect", {
|
|
1921
|
-
x: "2.48438",
|
|
1922
|
-
y: "3.61597",
|
|
1923
|
-
width: "1.6",
|
|
1924
|
-
height: "14",
|
|
1925
|
-
rx: "0.8",
|
|
1926
|
-
transform: "rotate(-45 2.48438 3.61597)",
|
|
1927
|
-
fill: color
|
|
1928
|
-
}), React.createElement("rect", {
|
|
1929
|
-
x: "12.2427",
|
|
1930
|
-
y: "2.34326",
|
|
1931
|
-
width: "1.6",
|
|
1932
|
-
height: "14",
|
|
1933
|
-
rx: "0.8",
|
|
1934
|
-
transform: "rotate(45 12.2427 2.34326)",
|
|
1935
|
-
fill: color
|
|
1936
|
-
})), React.createElement("defs", null, React.createElement("clipPath", {
|
|
1937
|
-
id: "clip0_1060_48455"
|
|
1938
|
-
}, React.createElement("rect", {
|
|
1939
|
-
width: "16",
|
|
1940
|
-
height: "16",
|
|
1941
|
-
fill: "white"
|
|
1942
|
-
}))));
|
|
1943
|
-
};
|
|
2016
|
+
var getAccessToken$1 = (function () {
|
|
2017
|
+
try {
|
|
2018
|
+
return localStorage.getItem(ACCESS_TOKEN);
|
|
2019
|
+
} catch (err) {
|
|
2020
|
+
return null;
|
|
2021
|
+
}
|
|
2022
|
+
});
|
|
1944
2023
|
|
|
1945
|
-
var
|
|
1946
|
-
return
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
}), React.createElement("path", {
|
|
1958
|
-
fillRule: "evenodd",
|
|
1959
|
-
clipRule: "evenodd",
|
|
1960
|
-
d: "M5.9998 5.1001C6.24833 5.1001 6.4498 5.30157 6.4498 5.5501V8.2915C6.4498 8.54003 6.24833 8.7415 5.9998 8.7415C5.75128 8.7415 5.5498 8.54003 5.5498 8.2915V5.5501C5.5498 5.30157 5.75128 5.1001 5.9998 5.1001Z",
|
|
1961
|
-
fill: "#A6A6AD"
|
|
1962
|
-
}), React.createElement("path", {
|
|
1963
|
-
d: "M5.9999 4.6502C5.6687 4.6502 5.3999 4.3808 5.3999 4.0502C5.3999 3.7196 5.6687 3.4502 5.9999 3.4502C6.3311 3.4502 6.5999 3.7196 6.5999 4.0502C6.5999 4.3808 6.3311 4.6502 5.9999 4.6502Z",
|
|
1964
|
-
fill: "#A6A6AD"
|
|
1965
|
-
}));
|
|
1966
|
-
};
|
|
2024
|
+
var encodeParams$1 = (function (params) {
|
|
2025
|
+
return Object.keys(params).filter(function (key) {
|
|
2026
|
+
return params[key] || params[key] === 0 || params[key] === false;
|
|
2027
|
+
}).map(function (key) {
|
|
2028
|
+
if (Array.isArray(params[key])) {
|
|
2029
|
+
return params[key].map(function (i) {
|
|
2030
|
+
return encodeURIComponent(key) + "=" + encodeURIComponent(i);
|
|
2031
|
+
}).join('&');
|
|
2032
|
+
}
|
|
2033
|
+
return encodeURIComponent(key) + "=" + encodeURIComponent(params[key]);
|
|
2034
|
+
}).join('&');
|
|
2035
|
+
});
|
|
1967
2036
|
|
|
1968
|
-
var
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
_onKeyDown = props.onKeyDown,
|
|
1991
|
-
onKeyFocus = props.onKeyFocus,
|
|
1992
|
-
autoResize = props.autoResize,
|
|
1993
|
-
width = props.width,
|
|
1994
|
-
onClick = props.onClick,
|
|
1995
|
-
onBlur = props.onBlur,
|
|
1996
|
-
isDisabled = props.isDisabled,
|
|
1997
|
-
rest = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
1998
|
-
var _useState = useState(false),
|
|
1999
|
-
isOpenTooltip = _useState[0],
|
|
2000
|
-
setIsOpenTooltip = _useState[1];
|
|
2001
|
-
var toggleTooltip = function toggleTooltip() {
|
|
2002
|
-
return setIsOpenTooltip(!isOpenTooltip);
|
|
2003
|
-
};
|
|
2004
|
-
var textareaRef = useRef(null);
|
|
2005
|
-
useEffect(function () {
|
|
2006
|
-
if (autoResize && textareaRef.current) {
|
|
2007
|
-
var el = textareaRef.current;
|
|
2008
|
-
requestAnimationFrame(function () {
|
|
2009
|
-
el.style.height = "auto";
|
|
2010
|
-
el.style.height = el.scrollHeight + "px";
|
|
2011
|
-
});
|
|
2037
|
+
var api$1 = axios.create({
|
|
2038
|
+
baseURL: BASE_URL,
|
|
2039
|
+
timeout: 0,
|
|
2040
|
+
headers: {
|
|
2041
|
+
"Content-Type": "application/json"
|
|
2042
|
+
},
|
|
2043
|
+
paramsSerializer: function paramsSerializer(params) {
|
|
2044
|
+
return encodeParams$1(params);
|
|
2045
|
+
}
|
|
2046
|
+
});
|
|
2047
|
+
var apiUpload$1 = axios.create({
|
|
2048
|
+
baseURL: BASE_URL,
|
|
2049
|
+
timeout: 60000,
|
|
2050
|
+
headers: {
|
|
2051
|
+
"Content-Type": "multipart/form-data"
|
|
2052
|
+
}
|
|
2053
|
+
});
|
|
2054
|
+
[api$1, apiUpload$1].forEach(function (i) {
|
|
2055
|
+
return i.interceptors.request.use(function (config) {
|
|
2056
|
+
var token = getAccessToken$1();
|
|
2057
|
+
if (token) {
|
|
2058
|
+
config.headers.Authorization = "Bearer " + token;
|
|
2012
2059
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2060
|
+
return config;
|
|
2061
|
+
}, function (error) {
|
|
2062
|
+
return Promise.reject(error);
|
|
2063
|
+
});
|
|
2064
|
+
});
|
|
2065
|
+
[api$1, apiUpload$1].forEach(function (i) {
|
|
2066
|
+
return i.interceptors.response.use(function (response) {
|
|
2067
|
+
return response;
|
|
2068
|
+
}, function (error) {
|
|
2069
|
+
if (error.response.status === 401) {
|
|
2070
|
+
window.location.href = "/login";
|
|
2018
2071
|
}
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
value: value,
|
|
2043
|
-
cols: cols,
|
|
2044
|
-
rows: rows,
|
|
2045
|
-
onChange: function onChange(e) {
|
|
2046
|
-
return _onChange(name, e.target.value);
|
|
2047
|
-
},
|
|
2048
|
-
onKeyDown: function onKeyDown(e) {
|
|
2049
|
-
return _onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
|
|
2050
|
-
},
|
|
2051
|
-
onFocus: function onFocus(e) {
|
|
2052
|
-
return onKeyFocus === null || onKeyFocus === void 0 ? void 0 : onKeyFocus(name, e.target.value);
|
|
2053
|
-
},
|
|
2054
|
-
className: className,
|
|
2055
|
-
onClick: onClick,
|
|
2056
|
-
onBlur: onBlur,
|
|
2057
|
-
disabled: isDisabled
|
|
2058
|
-
}, rest)));
|
|
2072
|
+
if (error.response.status == 403) {
|
|
2073
|
+
var hostname = window.location.hostname;
|
|
2074
|
+
var parts = hostname.split('.');
|
|
2075
|
+
var domain = parts.slice(-2).join('.');
|
|
2076
|
+
localStorage.removeItem(ACCESS_TOKEN);
|
|
2077
|
+
localStorage.removeItem(ORGANIZATION_TENANT);
|
|
2078
|
+
localStorage.removeItem(ORGANIZATION_TEAM);
|
|
2079
|
+
Cookies.remove('auth', {
|
|
2080
|
+
path: '/',
|
|
2081
|
+
domain: "." + domain
|
|
2082
|
+
});
|
|
2083
|
+
localStorage.removeItem("USER_EMAIL");
|
|
2084
|
+
window.location.href = "/login";
|
|
2085
|
+
}
|
|
2086
|
+
return Promise.reject(error);
|
|
2087
|
+
});
|
|
2088
|
+
});
|
|
2089
|
+
|
|
2090
|
+
var AUTH_URL = BASE_URL + "/api/auth";
|
|
2091
|
+
var checkToken = function checkToken(token) {
|
|
2092
|
+
return api$1.post(AUTH_URL + "/checktoken", {
|
|
2093
|
+
token: token
|
|
2094
|
+
});
|
|
2059
2095
|
};
|
|
2060
2096
|
|
|
2061
|
-
var
|
|
2097
|
+
var firstCheckToken = function firstCheckToken() {
|
|
2098
|
+
return Promise.resolve(_catch(function () {
|
|
2099
|
+
var token = getAccessToken$1();
|
|
2100
|
+
return token ? Promise.resolve(checkToken(token)).then(function (tokenStatus) {
|
|
2101
|
+
return tokenStatus.data ? true : false;
|
|
2102
|
+
}) : false;
|
|
2103
|
+
}, function () {
|
|
2104
|
+
return false;
|
|
2105
|
+
}));
|
|
2106
|
+
};
|
|
2062
2107
|
|
|
2063
|
-
var
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
onPressEnter = props.onPressEnter;
|
|
2070
|
-
var handleClear = function handleClear() {
|
|
2071
|
-
_onChange(name, "");
|
|
2072
|
-
onPressEnter && onPressEnter("");
|
|
2073
|
-
};
|
|
2074
|
-
return React.createElement("div", {
|
|
2075
|
-
className: styles$9["core-search"],
|
|
2076
|
-
style: {
|
|
2077
|
-
width: width != null ? width : "100%"
|
|
2078
|
-
},
|
|
2079
|
-
tabIndex: 1
|
|
2080
|
-
}, React.createElement("div", {
|
|
2081
|
-
className: styles$9["icon"]
|
|
2082
|
-
}, React.createElement(Search, null)), React.createElement("input", {
|
|
2083
|
-
className: styles$9["input"],
|
|
2084
|
-
value: value,
|
|
2085
|
-
onChange: function onChange(e) {
|
|
2086
|
-
return _onChange(name, e.target.value);
|
|
2087
|
-
},
|
|
2088
|
-
placeholder: "Search...",
|
|
2089
|
-
onKeyDown: function onKeyDown(e) {
|
|
2090
|
-
if (e.key === "Enter") {
|
|
2091
|
-
onPressEnter && onPressEnter(value);
|
|
2108
|
+
var getImageUrl = function getImageUrl(imageUrl) {
|
|
2109
|
+
try {
|
|
2110
|
+
if (!!imageUrl) {
|
|
2111
|
+
var imageTrimmed = imageUrl.trim();
|
|
2112
|
+
if (imageTrimmed.startsWith('http://') || imageTrimmed.startsWith('https://')) {
|
|
2113
|
+
return imageTrimmed;
|
|
2092
2114
|
}
|
|
2115
|
+
return BASE_URL + "/images/" + imageTrimmed;
|
|
2093
2116
|
}
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
}
|
|
2117
|
+
return "/images/avatar-default.png";
|
|
2118
|
+
} catch (err) {
|
|
2119
|
+
return "/images/avatar-default.png";
|
|
2120
|
+
}
|
|
2098
2121
|
};
|
|
2099
2122
|
|
|
2100
|
-
var
|
|
2123
|
+
var NotFound = function NotFound() {
|
|
2124
|
+
return React.createElement("div", {
|
|
2125
|
+
className: "not-found"
|
|
2126
|
+
}, React.createElement("div", {
|
|
2127
|
+
className: "clearfix"
|
|
2128
|
+
}, React.createElement("h1", {
|
|
2129
|
+
className: "float-left display-3 mr-4"
|
|
2130
|
+
}, "404"), React.createElement("div", {
|
|
2131
|
+
className: "float-left"
|
|
2132
|
+
}, React.createElement("h4", {
|
|
2133
|
+
className: "pt-3"
|
|
2134
|
+
}, "Oops! You are lost."), React.createElement("p", {
|
|
2135
|
+
className: "text-muted mb-2"
|
|
2136
|
+
}, "The page you are looking for was not found."), React.createElement("div", null))));
|
|
2137
|
+
};
|
|
2101
2138
|
|
|
2102
|
-
var
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2139
|
+
var loadingStyle = {
|
|
2140
|
+
minWidth: "100vw",
|
|
2141
|
+
minHeight: "100vh",
|
|
2142
|
+
position: "fixed",
|
|
2143
|
+
top: 0,
|
|
2144
|
+
left: 0,
|
|
2145
|
+
zIndex: 999999999,
|
|
2146
|
+
backgroundColor: "rgba(0, 0, 0, 0.4)",
|
|
2147
|
+
display: "flex",
|
|
2148
|
+
justifyContent: "center",
|
|
2149
|
+
alignItems: "center"
|
|
2111
2150
|
};
|
|
2112
|
-
var
|
|
2113
|
-
var
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
var
|
|
2132
|
-
|
|
2133
|
-
return item.value;
|
|
2134
|
-
}) : value === null || value === void 0 ? void 0 : value.value;
|
|
2135
|
-
onChange(name, newValue);
|
|
2136
|
-
};
|
|
2137
|
-
var controlStyle = function controlStyle(base, state) {
|
|
2138
|
-
var styles = _extends({}, base, {
|
|
2139
|
-
fontSize: "14px",
|
|
2140
|
-
fontWeight: "400",
|
|
2141
|
-
padding: "0",
|
|
2142
|
-
backgroundColor: state.isDisabled ? "transparent" : error ? COLORS.lightYellow : COLORS.white,
|
|
2143
|
-
border: "none",
|
|
2144
|
-
height: isMulti ? undefined : "26px",
|
|
2145
|
-
minHeight: "26px",
|
|
2146
|
-
boxShadow: "none",
|
|
2147
|
-
cursor: "pointer",
|
|
2148
|
-
"&:hover": {
|
|
2149
|
-
backgroundColor: COLORS.lightBlueHover
|
|
2150
|
-
},
|
|
2151
|
-
"&>div": {
|
|
2152
|
-
padding: "0 2px"
|
|
2153
|
-
}
|
|
2154
|
-
});
|
|
2155
|
-
return styles;
|
|
2156
|
-
};
|
|
2157
|
-
var inputStyles = function inputStyles(base) {
|
|
2158
|
-
var styles = _extends({}, base, {
|
|
2159
|
-
margin: "0",
|
|
2160
|
-
padding: "0",
|
|
2161
|
-
color: "inherit",
|
|
2162
|
-
position: "relative",
|
|
2163
|
-
top: "-2px"
|
|
2164
|
-
});
|
|
2165
|
-
return styles;
|
|
2166
|
-
};
|
|
2167
|
-
var placeholderStyles = function placeholderStyles(base) {
|
|
2168
|
-
var styles = _extends({}, base, {
|
|
2169
|
-
color: COLORS.lightGray
|
|
2170
|
-
});
|
|
2171
|
-
return styles;
|
|
2172
|
-
};
|
|
2173
|
-
var dropdownIndicatorStyles = function dropdownIndicatorStyles(base) {
|
|
2174
|
-
var styles = _extends({}, base, {
|
|
2175
|
-
position: "relative",
|
|
2176
|
-
padding: "2px 0"
|
|
2177
|
-
});
|
|
2178
|
-
return styles;
|
|
2179
|
-
};
|
|
2180
|
-
var indicatorsContainerStyles = function indicatorsContainerStyles(base) {
|
|
2181
|
-
var styles = _extends({}, base, {
|
|
2182
|
-
display: isShowDropdown && !isMulti ? "block" : "none"
|
|
2183
|
-
});
|
|
2184
|
-
return styles;
|
|
2185
|
-
};
|
|
2186
|
-
var valueContainerStyles = function valueContainerStyles(base) {
|
|
2187
|
-
var styles = _extends({}, base, {
|
|
2188
|
-
height: isMulti ? undefined : "26px",
|
|
2189
|
-
position: "relative"
|
|
2190
|
-
});
|
|
2191
|
-
return styles;
|
|
2192
|
-
};
|
|
2193
|
-
var singleValueStyles = function singleValueStyles(base) {
|
|
2194
|
-
var styles = _extends({}, base);
|
|
2195
|
-
return styles;
|
|
2196
|
-
};
|
|
2197
|
-
var optionStyles = function optionStyles(base, state) {
|
|
2198
|
-
var styles = _extends({}, base, {
|
|
2199
|
-
padding: "8px",
|
|
2200
|
-
borderRadius: "8px",
|
|
2201
|
-
cursor: "pointer",
|
|
2202
|
-
fontSize: "14px",
|
|
2203
|
-
fontWeight: 400,
|
|
2204
|
-
color: COLORS.blackText,
|
|
2205
|
-
backgroundColor: state.isSelected ? COLORS.lightBlueHover : "transparent",
|
|
2206
|
-
"&:hover": {
|
|
2207
|
-
backgroundColor: COLORS.lightBlueHover
|
|
2208
|
-
}
|
|
2209
|
-
});
|
|
2210
|
-
return styles;
|
|
2211
|
-
};
|
|
2212
|
-
var multiValueStyles = function multiValueStyles(base) {
|
|
2213
|
-
var styles = _extends({}, base, {
|
|
2214
|
-
backgroundColor: COLORS.lightBlue,
|
|
2215
|
-
borderRadius: "4px",
|
|
2216
|
-
padding: "0 4px",
|
|
2217
|
-
display: "flex",
|
|
2218
|
-
alignItems: "center",
|
|
2219
|
-
fontSize: "13px",
|
|
2220
|
-
color: COLORS.blackText
|
|
2221
|
-
});
|
|
2222
|
-
return styles;
|
|
2223
|
-
};
|
|
2224
|
-
var multiValueRemoveStyles = function multiValueRemoveStyles(base) {
|
|
2225
|
-
var styles = _extends({}, base, {
|
|
2226
|
-
color: COLORS.lightGray,
|
|
2227
|
-
cursor: "pointer"
|
|
2228
|
-
});
|
|
2229
|
-
return styles;
|
|
2151
|
+
var Loading = function Loading() {
|
|
2152
|
+
var isLoading = useSelector(function (state) {
|
|
2153
|
+
return state.common.isLoading;
|
|
2154
|
+
});
|
|
2155
|
+
localStorage.setItem("LAST_TIME_REQUETST", moment().utc().format("YYYY-MM-DD HH:mm:ss"));
|
|
2156
|
+
return isLoading ? React.createElement("div", {
|
|
2157
|
+
style: loadingStyle
|
|
2158
|
+
}, React.createElement("div", {
|
|
2159
|
+
className: "spinner-border text-secondary",
|
|
2160
|
+
role: "status"
|
|
2161
|
+
}, React.createElement("span", {
|
|
2162
|
+
className: "sr-only"
|
|
2163
|
+
}))) : null;
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2166
|
+
var useGoogleSignOut = function useGoogleSignOut(props) {
|
|
2167
|
+
var dispatch = useDispatch();
|
|
2168
|
+
var onLogoutSuccess = props.onLogoutSuccess,
|
|
2169
|
+
onFailure = props.onFailure;
|
|
2170
|
+
var handleLogoutSuccess = function handleLogoutSuccess() {
|
|
2171
|
+
onLogoutSuccess === null || onLogoutSuccess === void 0 ? void 0 : onLogoutSuccess();
|
|
2230
2172
|
};
|
|
2231
|
-
var
|
|
2232
|
-
|
|
2233
|
-
color: COLORS.blackText,
|
|
2234
|
-
fontWeight: "400",
|
|
2235
|
-
fontSize: "13px",
|
|
2236
|
-
padding: 0
|
|
2237
|
-
});
|
|
2238
|
-
return styles;
|
|
2173
|
+
var handleLogoutFailure = function handleLogoutFailure() {
|
|
2174
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure();
|
|
2239
2175
|
};
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
}
|
|
2245
|
-
}, label && React.createElement("div", {
|
|
2246
|
-
className: styles$a["label"]
|
|
2247
|
-
}, React.createElement("label", null, label), React.createElement(Info, null)), React.createElement(ReactSelect, {
|
|
2248
|
-
name: name,
|
|
2249
|
-
value: options.filter(function (i) {
|
|
2250
|
-
return value && (isMulti ? value.includes(i.value) : i.value === value);
|
|
2176
|
+
var _useGoogleLogout = useGoogleLogout({
|
|
2177
|
+
clientId: GOOGLE_CLIENT_ID,
|
|
2178
|
+
onLogoutSuccess: handleLogoutSuccess,
|
|
2179
|
+
onFailure: handleLogoutFailure
|
|
2251
2180
|
}),
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
components: isMulti ? {
|
|
2263
|
-
Option: Option$1
|
|
2264
|
-
} : undefined,
|
|
2265
|
-
styles: {
|
|
2266
|
-
control: controlStyle,
|
|
2267
|
-
input: inputStyles,
|
|
2268
|
-
placeholder: placeholderStyles,
|
|
2269
|
-
dropdownIndicator: dropdownIndicatorStyles,
|
|
2270
|
-
indicatorSeparator: function indicatorSeparator() {
|
|
2271
|
-
return {
|
|
2272
|
-
display: "none"
|
|
2273
|
-
};
|
|
2274
|
-
},
|
|
2275
|
-
indicatorsContainer: indicatorsContainerStyles,
|
|
2276
|
-
valueContainer: valueContainerStyles,
|
|
2277
|
-
singleValue: singleValueStyles,
|
|
2278
|
-
option: optionStyles,
|
|
2279
|
-
multiValue: multiValueStyles,
|
|
2280
|
-
multiValueRemove: multiValueRemoveStyles,
|
|
2281
|
-
multiValueLabel: multiValueLabelStyles
|
|
2181
|
+
signOut = _useGoogleLogout.signOut,
|
|
2182
|
+
loaded = _useGoogleLogout.loaded;
|
|
2183
|
+
var handleSignOut = function handleSignOut() {
|
|
2184
|
+
localStorage.clear();
|
|
2185
|
+
try {
|
|
2186
|
+
signOut();
|
|
2187
|
+
} catch (error) {
|
|
2188
|
+
console.log({
|
|
2189
|
+
error: error
|
|
2190
|
+
});
|
|
2282
2191
|
}
|
|
2283
|
-
|
|
2192
|
+
dispatch(reset());
|
|
2193
|
+
window.location.href = "/login";
|
|
2194
|
+
};
|
|
2195
|
+
return {
|
|
2196
|
+
handleSignOut: handleSignOut,
|
|
2197
|
+
loaded: loaded
|
|
2198
|
+
};
|
|
2284
2199
|
};
|
|
2285
2200
|
|
|
2286
|
-
var
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
var
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
2296
|
-
label = props.label,
|
|
2297
|
-
width = props.width,
|
|
2298
|
-
_props$placeholder = props.placeholder,
|
|
2299
|
-
placeholder = _props$placeholder === void 0 ? "Type here" : _props$placeholder,
|
|
2300
|
-
error = props.error,
|
|
2301
|
-
tooltip = props.tooltip,
|
|
2302
|
-
_onKeyDown = props.onKeyDown,
|
|
2303
|
-
rest = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
2304
|
-
var _useState = useState(false),
|
|
2305
|
-
isOpenTooltip = _useState[0],
|
|
2306
|
-
setIsOpenTooltip = _useState[1];
|
|
2307
|
-
var toggleTooltip = function toggleTooltip() {
|
|
2308
|
-
return setIsOpenTooltip(!isOpenTooltip);
|
|
2201
|
+
var LayoutContext = function LayoutContext(_ref) {
|
|
2202
|
+
var children = _ref.children,
|
|
2203
|
+
onNavigate = _ref.onNavigate;
|
|
2204
|
+
var _useGoogleSignOut = useGoogleSignOut({
|
|
2205
|
+
onNavigate: onNavigate
|
|
2206
|
+
}),
|
|
2207
|
+
handleSignOut = _useGoogleSignOut.handleSignOut;
|
|
2208
|
+
var resetAuth = function resetAuth() {
|
|
2209
|
+
handleSignOut();
|
|
2309
2210
|
};
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2211
|
+
var loadInfo = function loadInfo() {
|
|
2212
|
+
try {
|
|
2213
|
+
var token = firstCheckToken();
|
|
2214
|
+
!token && resetAuth();
|
|
2215
|
+
return Promise.resolve();
|
|
2216
|
+
} catch (e) {
|
|
2217
|
+
return Promise.reject(e);
|
|
2314
2218
|
}
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2219
|
+
};
|
|
2220
|
+
useEffect(function () {
|
|
2221
|
+
loadInfo();
|
|
2222
|
+
}, []);
|
|
2223
|
+
return React.createElement(Fragment, null, children);
|
|
2224
|
+
};
|
|
2225
|
+
|
|
2226
|
+
var ConfirmDialog = function ConfirmDialog(_ref) {
|
|
2227
|
+
var open = _ref.open,
|
|
2228
|
+
text = _ref.text,
|
|
2229
|
+
_ref$cancelText = _ref.cancelText,
|
|
2230
|
+
cancelText = _ref$cancelText === void 0 ? "No" : _ref$cancelText,
|
|
2231
|
+
_ref$okText = _ref.okText,
|
|
2232
|
+
okText = _ref$okText === void 0 ? "Yes" : _ref$okText,
|
|
2233
|
+
isDelete = _ref.isDelete,
|
|
2234
|
+
toggle = _ref.toggle,
|
|
2235
|
+
onClose = _ref.onClose,
|
|
2236
|
+
onConfirm = _ref.onConfirm;
|
|
2237
|
+
return React.createElement(Modal, {
|
|
2238
|
+
isOpen: open,
|
|
2239
|
+
toggle: !!onClose ? onClose : toggle,
|
|
2240
|
+
centered: true
|
|
2241
|
+
}, React.createElement(ModalHeader, {
|
|
2242
|
+
toggle: toggle
|
|
2243
|
+
}, "Confirmation"), React.createElement(ModalBody, null, text), React.createElement(ModalFooter, null, React.createElement(Button, {
|
|
2244
|
+
color: "secondary",
|
|
2245
|
+
onClick: toggle
|
|
2246
|
+
}, cancelText), React.createElement(Button, {
|
|
2247
|
+
color: isDelete ? "danger" : "primary",
|
|
2248
|
+
onClick: onConfirm
|
|
2249
|
+
}, okText)));
|
|
2250
|
+
};
|
|
2251
|
+
|
|
2252
|
+
var CommonDialog = function CommonDialog(_ref) {
|
|
2253
|
+
var open = _ref.open,
|
|
2254
|
+
children = _ref.children,
|
|
2255
|
+
centered = _ref.centered,
|
|
2256
|
+
title = _ref.title,
|
|
2257
|
+
_ref$size = _ref.size,
|
|
2258
|
+
size = _ref$size === void 0 ? "xs" : _ref$size,
|
|
2259
|
+
_ref$isShowHeader = _ref.isShowHeader,
|
|
2260
|
+
isShowHeader = _ref$isShowHeader === void 0 ? true : _ref$isShowHeader,
|
|
2261
|
+
onClose = _ref.onClose,
|
|
2262
|
+
backdrop = _ref.backdrop;
|
|
2263
|
+
return React.createElement(Modal, {
|
|
2264
|
+
backdrop: backdrop,
|
|
2265
|
+
isOpen: open,
|
|
2266
|
+
toggle: onClose,
|
|
2267
|
+
centered: centered,
|
|
2268
|
+
size: size,
|
|
2269
|
+
zIndex: 1102
|
|
2270
|
+
}, isShowHeader ? React.createElement(ModalHeader, {
|
|
2271
|
+
toggle: onClose
|
|
2272
|
+
}, title) : React.createElement(Box, {
|
|
2273
|
+
className: "p-3"
|
|
2274
|
+
}, React.createElement(Typography, {
|
|
2275
|
+
className: "fs-5 text-center fw-bold"
|
|
2276
|
+
}, title)), children);
|
|
2277
|
+
};
|
|
2278
|
+
|
|
2279
|
+
var AuthenticationMessage;
|
|
2280
|
+
(function (AuthenticationMessage) {
|
|
2281
|
+
AuthenticationMessage["NotAllowedToRegister"] = "NotAllowedToRegister";
|
|
2282
|
+
AuthenticationMessage["InvalidGoogleToken"] = "InvalidGoogleToken";
|
|
2283
|
+
})(AuthenticationMessage || (AuthenticationMessage = {}));
|
|
2284
|
+
var Role;
|
|
2285
|
+
(function (Role) {
|
|
2286
|
+
Role["Student"] = "Student";
|
|
2287
|
+
Role["Teacher"] = "Teacher";
|
|
2288
|
+
Role["Admin"] = "Admin";
|
|
2289
|
+
})(Role || (Role = {}));
|
|
2290
|
+
|
|
2291
|
+
var CustomPagination = function CustomPagination(_ref) {
|
|
2292
|
+
var currentPage = _ref.currentPage,
|
|
2293
|
+
totalPage = _ref.totalPage,
|
|
2294
|
+
onChangePage = _ref.onChangePage;
|
|
2295
|
+
return React.createElement(Pagination, {
|
|
2296
|
+
className: "w-fit"
|
|
2297
|
+
}, React.createElement(PaginationItem, {
|
|
2298
|
+
disabled: currentPage <= 1
|
|
2299
|
+
}, React.createElement(PaginationLink, {
|
|
2300
|
+
onClick: function onClick(e) {
|
|
2301
|
+
e.preventDefault();
|
|
2302
|
+
onChangePage(currentPage - 1);
|
|
2323
2303
|
},
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2304
|
+
previous: true,
|
|
2305
|
+
href: "#"
|
|
2306
|
+
})), React.createElement(PaginationItem, {
|
|
2307
|
+
active: 1 === currentPage,
|
|
2308
|
+
key: 1
|
|
2309
|
+
}, React.createElement(PaginationLink, {
|
|
2310
|
+
onClick: function onClick(e) {
|
|
2311
|
+
e.preventDefault();
|
|
2312
|
+
onChangePage(1);
|
|
2313
|
+
},
|
|
2314
|
+
href: "#"
|
|
2315
|
+
}, 1)), totalPage > 2 && React.createElement(PaginationItem, {
|
|
2316
|
+
active: 2 === currentPage,
|
|
2317
|
+
key: 1
|
|
2318
|
+
}, React.createElement(PaginationLink, {
|
|
2319
|
+
onClick: function onClick(e) {
|
|
2320
|
+
e.preventDefault();
|
|
2321
|
+
onChangePage(2);
|
|
2322
|
+
},
|
|
2323
|
+
href: "#"
|
|
2324
|
+
}, 2)), currentPage > 4 && currentPage !== totalPage && totalPage !== 5 && React.createElement(PaginationItem, {
|
|
2325
|
+
disabled: true,
|
|
2326
|
+
key: "first"
|
|
2327
|
+
}, React.createElement(PaginationLink, {
|
|
2328
|
+
href: "#"
|
|
2329
|
+
}, "...")), (currentPage === 1 || currentPage === totalPage) && totalPage === 5 && React.createElement(PaginationItem, {
|
|
2330
|
+
key: 3
|
|
2331
|
+
}, React.createElement(PaginationLink, {
|
|
2332
|
+
onClick: function onClick(e) {
|
|
2333
|
+
e.preventDefault();
|
|
2334
|
+
onChangePage(3);
|
|
2335
|
+
},
|
|
2336
|
+
href: "#"
|
|
2337
|
+
}, "3")), [currentPage - 1, currentPage, currentPage + 1].filter(function (page) {
|
|
2338
|
+
return page > 2 && page < totalPage - 1;
|
|
2339
|
+
}).map(function (page) {
|
|
2340
|
+
return React.createElement(PaginationItem, {
|
|
2341
|
+
active: page === currentPage,
|
|
2342
|
+
key: page
|
|
2343
|
+
}, React.createElement(PaginationLink, {
|
|
2344
|
+
onClick: function onClick(e) {
|
|
2345
|
+
e.preventDefault();
|
|
2346
|
+
onChangePage(page);
|
|
2347
|
+
},
|
|
2348
|
+
href: "#"
|
|
2349
|
+
}, page));
|
|
2350
|
+
}), totalPage - currentPage > 4 && React.createElement(PaginationItem, {
|
|
2351
|
+
disabled: true,
|
|
2352
|
+
key: "last"
|
|
2353
|
+
}, React.createElement(PaginationLink, {
|
|
2354
|
+
href: "#"
|
|
2355
|
+
}, "...")), totalPage > 3 && React.createElement(PaginationItem, {
|
|
2356
|
+
active: totalPage - 1 === currentPage,
|
|
2357
|
+
key: totalPage - 1
|
|
2358
|
+
}, React.createElement(PaginationLink, {
|
|
2359
|
+
onClick: function onClick(e) {
|
|
2360
|
+
e.preventDefault();
|
|
2361
|
+
onChangePage(totalPage - 1);
|
|
2328
2362
|
},
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
toggle: toggleTooltip
|
|
2338
|
-
}, tooltip));
|
|
2339
|
-
};
|
|
2340
|
-
|
|
2341
|
-
var styles$c = {"core-label-input":"_2YqZu","size-h1":"_23-uu","size-h2":"_16lQL"};
|
|
2342
|
-
|
|
2343
|
-
var CoreTitleInput = function CoreTitleInput(props) {
|
|
2344
|
-
var _props$name = props.name,
|
|
2345
|
-
name = _props$name === void 0 ? "" : _props$name,
|
|
2346
|
-
value = props.value,
|
|
2347
|
-
_onChange = props.onChange,
|
|
2348
|
-
_props$disabled = props.disabled,
|
|
2349
|
-
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
2350
|
-
width = props.width,
|
|
2351
|
-
_props$placeholder = props.placeholder,
|
|
2352
|
-
placeholder = _props$placeholder === void 0 ? "Type here" : _props$placeholder,
|
|
2353
|
-
error = props.error,
|
|
2354
|
-
_props$size = props.size,
|
|
2355
|
-
size = _props$size === void 0 ? "h1" : _props$size,
|
|
2356
|
-
maxLength = props.maxLength;
|
|
2357
|
-
return React.createElement("div", {
|
|
2358
|
-
className: "" + styles$c["core-label-input"],
|
|
2359
|
-
style: {
|
|
2360
|
-
width: width != null ? width : "100%"
|
|
2361
|
-
}
|
|
2362
|
-
}, React.createElement("input", {
|
|
2363
|
-
className: "" + styles$c["size-" + size],
|
|
2364
|
-
style: {
|
|
2365
|
-
backgroundColor: error ? COLORS.lightYellow : "transparent"
|
|
2363
|
+
href: "#"
|
|
2364
|
+
}, totalPage - 1)), totalPage > 1 && React.createElement(PaginationItem, {
|
|
2365
|
+
active: totalPage === currentPage,
|
|
2366
|
+
key: totalPage
|
|
2367
|
+
}, React.createElement(PaginationLink, {
|
|
2368
|
+
onClick: function onClick(e) {
|
|
2369
|
+
e.preventDefault();
|
|
2370
|
+
onChangePage(totalPage);
|
|
2366
2371
|
},
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2372
|
+
href: "#"
|
|
2373
|
+
}, totalPage)), React.createElement(PaginationItem, {
|
|
2374
|
+
disabled: currentPage >= totalPage
|
|
2375
|
+
}, React.createElement(PaginationLink, {
|
|
2376
|
+
onClick: function onClick(e) {
|
|
2377
|
+
e.preventDefault();
|
|
2378
|
+
onChangePage(currentPage + 1);
|
|
2371
2379
|
},
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
}));
|
|
2380
|
+
next: true,
|
|
2381
|
+
href: "#"
|
|
2382
|
+
})));
|
|
2376
2383
|
};
|
|
2377
2384
|
|
|
2378
|
-
var
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
var
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2385
|
+
var useAmplitude = function useAmplitude() {
|
|
2386
|
+
var _useState = useState(null),
|
|
2387
|
+
userId = _useState[0],
|
|
2388
|
+
setUserIdState = _useState[1];
|
|
2389
|
+
var _useState2 = useState(true),
|
|
2390
|
+
isTabActive = _useState2[0],
|
|
2391
|
+
setIsTabActive = _useState2[1];
|
|
2392
|
+
var sessionStartTime = useRef(null);
|
|
2393
|
+
var currentSessionStart = useRef(null);
|
|
2394
|
+
var savedUserProperties = useRef({});
|
|
2395
|
+
var hasTrackedInitialSession = useRef(false);
|
|
2396
|
+
var setUserProperties = useCallback(function (properties) {
|
|
2397
|
+
savedUserProperties.current = _extends({}, savedUserProperties.current, properties);
|
|
2398
|
+
var identify$1 = new Identify();
|
|
2399
|
+
Object.entries(properties).forEach(function (_ref) {
|
|
2400
|
+
var key = _ref[0],
|
|
2401
|
+
value = _ref[1];
|
|
2402
|
+
identify$1.set(key, value);
|
|
2403
|
+
});
|
|
2404
|
+
identify(identify$1);
|
|
2405
|
+
}, []);
|
|
2406
|
+
var trackEvent = useCallback(function (_ref2) {
|
|
2407
|
+
var eventName = _ref2.eventName,
|
|
2408
|
+
eventProperties = _ref2.eventProperties;
|
|
2409
|
+
track(eventName, _extends({}, savedUserProperties.current, eventProperties, {
|
|
2410
|
+
timestamp: new Date().toISOString()
|
|
2411
|
+
}));
|
|
2412
|
+
}, []);
|
|
2413
|
+
var setUserId$1 = useCallback(function (newUserId) {
|
|
2414
|
+
var prevUserId = userId;
|
|
2415
|
+
setUserIdState(newUserId);
|
|
2416
|
+
if (newUserId) {
|
|
2417
|
+
var prefixedUserId = "edusfere:" + newUserId;
|
|
2418
|
+
setUserId(prefixedUserId);
|
|
2419
|
+
if (prevUserId !== newUserId && !hasTrackedInitialSession.current) {
|
|
2420
|
+
hasTrackedInitialSession.current = true;
|
|
2421
|
+
sessionStartTime.current = new Date();
|
|
2422
|
+
currentSessionStart.current = new Date();
|
|
2423
|
+
trackEvent({
|
|
2424
|
+
eventName: AmplitudeEvent.SESSION_START,
|
|
2425
|
+
eventProperties: {
|
|
2426
|
+
start_time: new Date().toISOString()
|
|
2427
|
+
}
|
|
2428
|
+
});
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
}, [userId, trackEvent]);
|
|
2432
|
+
var reset = useCallback(function () {
|
|
2433
|
+
reset$1();
|
|
2434
|
+
setUserIdState(null);
|
|
2435
|
+
sessionStartTime.current = null;
|
|
2436
|
+
currentSessionStart.current = null;
|
|
2437
|
+
savedUserProperties.current = {};
|
|
2438
|
+
hasTrackedInitialSession.current = false;
|
|
2439
|
+
}, []);
|
|
2440
|
+
var trackTabActivity = useCallback(function (isActive) {
|
|
2441
|
+
if (!userId) return;
|
|
2442
|
+
var now = new Date();
|
|
2443
|
+
if (isActive) {
|
|
2444
|
+
currentSessionStart.current = now;
|
|
2445
|
+
trackEvent({
|
|
2446
|
+
eventName: AmplitudeEvent.SESSION_START,
|
|
2447
|
+
eventProperties: {
|
|
2448
|
+
start_time: now.toISOString()
|
|
2449
|
+
}
|
|
2450
|
+
});
|
|
2398
2451
|
} else {
|
|
2399
|
-
|
|
2452
|
+
if (currentSessionStart.current) {
|
|
2453
|
+
var sessionDuration = now.getTime() - currentSessionStart.current.getTime();
|
|
2454
|
+
trackEvent({
|
|
2455
|
+
eventName: AmplitudeEvent.SESSION_END,
|
|
2456
|
+
eventProperties: {
|
|
2457
|
+
session_duration_seconds: Math.round(sessionDuration / 1000),
|
|
2458
|
+
start_time: currentSessionStart.current.toISOString(),
|
|
2459
|
+
end_time: now.toISOString()
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2462
|
+
currentSessionStart.current = null;
|
|
2463
|
+
}
|
|
2400
2464
|
}
|
|
2465
|
+
}, [userId, trackEvent]);
|
|
2466
|
+
var trackPageUnload = useCallback(function () {
|
|
2467
|
+
if (!userId || !currentSessionStart.current) return;
|
|
2468
|
+
var now = new Date();
|
|
2469
|
+
var sessionDuration = now.getTime() - currentSessionStart.current.getTime();
|
|
2470
|
+
trackEvent({
|
|
2471
|
+
eventName: AmplitudeEvent.SESSION_END,
|
|
2472
|
+
eventProperties: {
|
|
2473
|
+
session_duration_seconds: Math.round(sessionDuration / 1000),
|
|
2474
|
+
start_time: currentSessionStart.current.toISOString(),
|
|
2475
|
+
end_time: now.toISOString(),
|
|
2476
|
+
end_reason: 'page_unload'
|
|
2477
|
+
}
|
|
2478
|
+
});
|
|
2479
|
+
}, [userId, trackEvent]);
|
|
2480
|
+
useEffect(function () {
|
|
2481
|
+
var handleVisibilityChange = function handleVisibilityChange() {
|
|
2482
|
+
var isVisible = !document.hidden;
|
|
2483
|
+
setIsTabActive(isVisible);
|
|
2484
|
+
trackTabActivity(isVisible);
|
|
2485
|
+
};
|
|
2486
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
2487
|
+
return function () {
|
|
2488
|
+
return document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
2489
|
+
};
|
|
2490
|
+
}, [trackTabActivity]);
|
|
2491
|
+
useEffect(function () {
|
|
2492
|
+
var handleFocus = function handleFocus() {
|
|
2493
|
+
setIsTabActive(true);
|
|
2494
|
+
trackTabActivity(true);
|
|
2495
|
+
};
|
|
2496
|
+
var handleBlur = function handleBlur() {
|
|
2497
|
+
setIsTabActive(false);
|
|
2498
|
+
trackTabActivity(false);
|
|
2499
|
+
};
|
|
2500
|
+
window.addEventListener('focus', handleFocus);
|
|
2501
|
+
window.addEventListener('blur', handleBlur);
|
|
2502
|
+
return function () {
|
|
2503
|
+
window.removeEventListener('focus', handleFocus);
|
|
2504
|
+
window.removeEventListener('blur', handleBlur);
|
|
2505
|
+
};
|
|
2506
|
+
}, [trackTabActivity]);
|
|
2507
|
+
useEffect(function () {
|
|
2508
|
+
var handleBeforeUnload = function handleBeforeUnload() {
|
|
2509
|
+
trackPageUnload();
|
|
2510
|
+
};
|
|
2511
|
+
window.addEventListener('beforeunload', handleBeforeUnload);
|
|
2512
|
+
return function () {
|
|
2513
|
+
return window.removeEventListener('beforeunload', handleBeforeUnload);
|
|
2514
|
+
};
|
|
2515
|
+
}, [trackPageUnload]);
|
|
2516
|
+
return {
|
|
2517
|
+
setUserId: setUserId$1,
|
|
2518
|
+
setUserProperties: setUserProperties,
|
|
2519
|
+
trackEvent: trackEvent,
|
|
2520
|
+
reset: reset,
|
|
2521
|
+
userId: userId,
|
|
2522
|
+
isTabActive: isTabActive,
|
|
2523
|
+
sessionStartTime: sessionStartTime.current,
|
|
2524
|
+
currentSessionStart: currentSessionStart.current
|
|
2401
2525
|
};
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2526
|
+
};
|
|
2527
|
+
|
|
2528
|
+
var initializeAmplitude = function initializeAmplitude(apiKey) {
|
|
2529
|
+
init(apiKey, {
|
|
2530
|
+
defaultTracking: {
|
|
2531
|
+
pageViews: true,
|
|
2532
|
+
sessions: true,
|
|
2533
|
+
formInteractions: true
|
|
2406
2534
|
}
|
|
2407
|
-
|
|
2408
|
-
};
|
|
2409
|
-
return React.createElement("div", {
|
|
2410
|
-
id: id,
|
|
2411
|
-
className: styles$d["core-tooltip"],
|
|
2412
|
-
onMouseEnter: handleMouseEnter,
|
|
2413
|
-
onMouseLeave: handleMouseLeave
|
|
2414
|
-
}, React.createElement("div", {
|
|
2415
|
-
className: styles$d["icon"]
|
|
2416
|
-
}, children), content && React.createElement(Tooltip, {
|
|
2417
|
-
target: id,
|
|
2418
|
-
isOpen: isOpenTooltip,
|
|
2419
|
-
placement: placement,
|
|
2420
|
-
innerClassName: innerClassName
|
|
2421
|
-
}, content));
|
|
2535
|
+
});
|
|
2422
2536
|
};
|
|
2423
2537
|
|
|
2424
2538
|
var getErrorMessage = function getErrorMessage(error, defaultErrorMessage) {
|