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