mario-core 2.0.127-release → 2.0.128-release

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.
Files changed (34) hide show
  1. package/dist/Dashboard-Dn1Xl7SC.js +1 -0
  2. package/dist/Dashboard-DxrE_UdE.mjs +206 -0
  3. package/dist/EmailTemplateDetail-BxDmv_IB.mjs +443 -0
  4. package/dist/EmailTemplateDetail-c2h1KwyT.js +1 -0
  5. package/dist/EmailTemplateList-C6KbuCHO.mjs +170 -0
  6. package/dist/EmailTemplateList-Dk7gCfdy.js +1 -0
  7. package/dist/GalleryList-CG-GA7Go.mjs +329 -0
  8. package/dist/GalleryList-p6WP3Krc.js +1 -0
  9. package/dist/Login-BMRuV2H4.js +1 -0
  10. package/dist/Login-Ch1dKH9m.mjs +1700 -0
  11. package/dist/NotificationList-51yt2V-v.js +1 -0
  12. package/dist/NotificationList-bZsuTSkC.mjs +419 -0
  13. package/dist/SkillList-BQM2FIla.mjs +386 -0
  14. package/dist/SkillList-BxqOHumi.js +1 -0
  15. package/dist/TeacherSelector-CrH5Ji_R.mjs +30 -0
  16. package/dist/TeacherSelector-DYwwL8rL.js +1 -0
  17. package/dist/TheContent-B_P8fq4J.mjs +38 -0
  18. package/dist/TheContent-C5I2GeSi.js +1 -0
  19. package/dist/UserContainer-JB0zF0Be.js +5 -0
  20. package/dist/UserContainer-QmPiHlko.mjs +2698 -0
  21. package/dist/UserDetail-BuhWeZrj.mjs +913 -0
  22. package/dist/UserDetail-ClL8qEKG.js +1 -0
  23. package/dist/UserList-Crz4aLRP.mjs +1514 -0
  24. package/dist/UserList-DoZZeZzW.js +7 -0
  25. package/dist/constants-DF79sw6a.mjs +241 -0
  26. package/dist/constants-DSNqVx4Y.js +1 -0
  27. package/dist/index-CD8bO3wO.js +15 -0
  28. package/dist/index-CfBp3NrB.mjs +22670 -0
  29. package/dist/mailCategoryService-C9FSK6lv.js +1 -0
  30. package/dist/mailCategoryService-CRdM3FRx.mjs +11 -0
  31. package/dist/shared/gradeYear/ukYearCsv.d.ts +4 -0
  32. package/dist/userService-CDfW2VnH.js +1 -0
  33. package/dist/userService-CjQDQKT0.mjs +47 -0
  34. package/package.json +113 -113
@@ -0,0 +1,1700 @@
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { memo as Ye, useState as N, useCallback as T, Fragment as ve, useEffect as Z } from "react";
3
+ import { Input as ie, Modal as Ke, ModalBody as Je, ModalFooter as fs, Button as ws, Form as Ss, FormGroup as me, Row as be, Col as ee } from "reactstrap";
4
+ import { Link as Ze, useLocation as ys, useNavigate as xe } from "react-router-dom";
5
+ import { u as Ns, s as t, M as Qe, E as oe, a as Xe, A as vs, g as Ie, b as g, f as Is, c as P, d as M, e as bs, r as Ts, h as ge, i as es, B as ks, j as ye, k as Cs, l as Ls, m as Es, I as Pe, N as Ps, n as xs, o as Rs, p as _s, q as $s, t as As, v as Ms, w as Fe, x as Gs, y as Os, z as Le, C as Ve, D as Us, F as Bs, G as zs, H as Fs, J as Vs } from "./index-CfBp3NrB.mjs";
6
+ import { useDispatch as Te, useSelector as Ee } from "react-redux";
7
+ import { Formik as ke } from "formik";
8
+ import * as V from "yup";
9
+ import { useGoogleReCaptcha as Re, GoogleReCaptcha as Hs, GoogleReCaptchaProvider as Ds } from "react-google-recaptcha-v3";
10
+ import { GoogleOAuthProvider as qs, useGoogleLogin as Ws } from "@react-oauth/google";
11
+ import { L as Ne, T as ss } from "./types-BvnbDeJF.mjs";
12
+ import { G as He } from "./constants-DF79sw6a.mjs";
13
+ import "papaparse";
14
+ import { LogLevel as Se, PublicClientApplication as js } from "@azure/msal-browser";
15
+ import * as de from "@amplitude/analytics-browser";
16
+ const Ys = {
17
+ backgroundColor: "#f7f9fc",
18
+ borderRadius: "4px",
19
+ marginBottom: "5px",
20
+ position: "relative"
21
+ }, Ks = {
22
+ backgroundColor: "#ffffff",
23
+ paddingRight: "50px",
24
+ color: "#333333",
25
+ caretColor: "#333333"
26
+ }, Js = {
27
+ fontSize: "20px",
28
+ position: "absolute",
29
+ right: "10px",
30
+ color: "#316CD9"
31
+ }, Zs = (s) => s.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (o, i) => i.toUpperCase()), he = ({
32
+ isShowPassword: s,
33
+ togglePasswordVisible: o,
34
+ onChange: i,
35
+ placeholder: d
36
+ }) => /* @__PURE__ */ r("div", { className: "d-flex align-items-center w-100", style: Ys, children: [
37
+ /* @__PURE__ */ e(
38
+ ie,
39
+ {
40
+ className: "border password-input",
41
+ style: Ks,
42
+ type: s ? "text" : "password",
43
+ name: "password",
44
+ onChange: i,
45
+ placeholder: d || "Password",
46
+ autocomplete: d ? Zs(d) : "password",
47
+ required: !0
48
+ }
49
+ ),
50
+ /* @__PURE__ */ e(
51
+ "i",
52
+ {
53
+ className: `far ${s ? "fa-eye-slash" : "fa-eye"} mx-2 cursor-pointer`,
54
+ style: Js,
55
+ onClick: () => o(),
56
+ title: s ? "Hide" : "Show"
57
+ }
58
+ )
59
+ ] }), Qs = ({ open: s, onConfirm: o, onClose: i, clickHandler: d }) => {
60
+ const { getLabel: m, system: u } = Ns(), [p, v] = N(He[0].value);
61
+ return /* @__PURE__ */ r(
62
+ Ke,
63
+ {
64
+ isOpen: s,
65
+ className: `${t["teacher-code"]}`,
66
+ style: { zIndex: 1201 },
67
+ centered: !0,
68
+ autoFocus: !1,
69
+ returnFocusAfterClose: !1,
70
+ children: [
71
+ /* @__PURE__ */ r("div", { className: `${t["header-teacher-code"]}`, children: [
72
+ /* @__PURE__ */ e("div", { style: { padding: "16px 24px", margin: 0, fontWeight: 500, fontSize: "1.25rem" }, children: u === "UK" ? "Select Year" : "Select Grade" }),
73
+ /* @__PURE__ */ e("div", { hidden: !i, children: /* @__PURE__ */ e(Qe, { onClick: () => i?.(), className: `${t["close-icon"]}`, size: 24, style: { color: "rgba(0, 0, 0, 0.54)" } }) })
74
+ ] }),
75
+ /* @__PURE__ */ r(Je, { style: { padding: "20px 24px" }, children: [
76
+ /* @__PURE__ */ e("p", { className: `${t["teacher-code-label"]}`, style: { margin: 0, marginBottom: "16px", color: "rgba(0, 0, 0, 0.6)" }, children: u === "UK" ? "You are logging in as a student, please select your year" : "You are logging in as a student, please select your grade" }),
77
+ /* @__PURE__ */ r("div", { className: "form-floating", style: { marginTop: "16px", marginBottom: "8px" }, children: [
78
+ /* @__PURE__ */ e(
79
+ ie,
80
+ {
81
+ type: "select",
82
+ id: "floatingSelectGrade",
83
+ value: p,
84
+ onChange: (w) => v(w.target.value),
85
+ children: He.map((w) => /* @__PURE__ */ e("option", { value: w.value, children: m(w.value) || w.label }, w.value))
86
+ }
87
+ ),
88
+ /* @__PURE__ */ e("label", { htmlFor: "floatingSelectGrade", children: u === "UK" ? "Select year" : "Select grade" })
89
+ ] })
90
+ ] }),
91
+ /* @__PURE__ */ e(fs, { style: { borderTop: "none", padding: "8px 24px" }, children: /* @__PURE__ */ e(ws, { disabled: !p, style: { borderRadius: 20, background: "#316cd9", border: "none", opacity: p ? 1 : 0.65 }, color: "primary", onClick: () => o(p, d), children: "Confirm" }) })
92
+ ]
93
+ }
94
+ );
95
+ };
96
+ function Xs(s, o) {
97
+ return JSON.stringify(s) === JSON.stringify(o);
98
+ }
99
+ const ea = Ye(Qs, Xs), sa = V.object({
100
+ email: V.string().email("Email is invalid").required("Email is required"),
101
+ password: V.string().required("Password is required"),
102
+ rememberMe: V.boolean()
103
+ }), aa = ({ onSuccess: s, onError: o }) => {
104
+ const i = Ws({
105
+ onSuccess: async (d) => {
106
+ try {
107
+ const m = await fetch("https://www.googleapis.com/oauth2/v3/userinfo", {
108
+ headers: { Authorization: `Bearer ${d.access_token}` }
109
+ }).then((p) => p.json()), u = {
110
+ accessToken: d.access_token,
111
+ googleId: m.sub,
112
+ profileObj: {
113
+ email: m.email,
114
+ familyName: m.family_name,
115
+ givenName: m.given_name,
116
+ imageUrl: m.picture,
117
+ name: m.name
118
+ }
119
+ };
120
+ s(u);
121
+ } catch (m) {
122
+ o(m);
123
+ }
124
+ },
125
+ onError: (d) => o(d)
126
+ });
127
+ return /* @__PURE__ */ r("div", { className: t["btn-login-with-sso"], onClick: () => i(), children: [
128
+ /* @__PURE__ */ r("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 48 48", width: "24px", height: "24px", style: { marginRight: "8px" }, children: [
129
+ /* @__PURE__ */ e("path", { fill: "#EA4335", d: "M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z" }),
130
+ /* @__PURE__ */ e("path", { fill: "#4285F4", d: "M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z" }),
131
+ /* @__PURE__ */ e("path", { fill: "#FBBC05", d: "M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z" }),
132
+ /* @__PURE__ */ e("path", { fill: "#34A853", d: "M24 48c6.48 0 12.38-2.12 16.66-5.73l-7.73-6c-2.15 1.45-4.92 2.3-8.93 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z" }),
133
+ /* @__PURE__ */ e("path", { fill: "none", d: "M0 0h48v48H0z" })
134
+ ] }),
135
+ /* @__PURE__ */ e("p", { children: "GOOGLE" })
136
+ ] });
137
+ }, ta = ({
138
+ defaultInfo: s,
139
+ userLogin: o,
140
+ school: i,
141
+ isShowPassword: d,
142
+ setIsShowPassword: m,
143
+ fnIsCheckLogin: u,
144
+ // isLoginGoogle,
145
+ // submitLogin,
146
+ // infoUser,
147
+ googleClientId: p,
148
+ fnLoginSSO: v,
149
+ extensionEmail: w,
150
+ onLoginWidthClever: k,
151
+ openModalSelectGrade: x,
152
+ handleRegisterUser: S,
153
+ onToggleModelGrade: R
154
+ }) => {
155
+ const I = () => m(!d), j = Te(), { executeRecaptcha: G } = Re(), C = T(async () => {
156
+ if (!G) {
157
+ console.log("execute recaptcha undefined");
158
+ return;
159
+ }
160
+ return await G("login");
161
+ }, [G]), A = async (L) => {
162
+ try {
163
+ await vs(L);
164
+ } catch (E) {
165
+ console.error(E);
166
+ }
167
+ }, Y = async (L) => {
168
+ if (L?.accessToken) {
169
+ let {
170
+ email: E,
171
+ familyName: K,
172
+ givenName: b,
173
+ imageUrl: _,
174
+ name: O
175
+ // fullName
176
+ } = L.profileObj, D = L.accessToken, se = L.googleId;
177
+ const ae = window.location.hostname.split(".marioforme.com")?.[0], Q = E.split("@")?.[1], Ce = w?.split(",")?.map((H) => H.trim())?.filter((H) => H).some((H) => Q.includes(H));
178
+ if (!Q.includes(ae) && !Ce) {
179
+ alert(
180
+ "The email address you used does not match the login information in the database. Please check that you are using your school assigned email address to log into MARIO for Me. If you have further trouble please notify your school site administrator"
181
+ ), await A([`${Q} is incorrect`]);
182
+ return;
183
+ }
184
+ const ue = {
185
+ firstName: b,
186
+ lastName: K,
187
+ imageUrl: _,
188
+ fullName: O,
189
+ email: E,
190
+ accessToken: D,
191
+ googleId: se
192
+ };
193
+ j(Xe(ue)), u(
194
+ ss.Google,
195
+ ue,
196
+ D,
197
+ C
198
+ );
199
+ }
200
+ };
201
+ return /* @__PURE__ */ r(ve, { children: [
202
+ /* @__PURE__ */ e(
203
+ ke,
204
+ {
205
+ initialValues: s,
206
+ validationSchema: sa,
207
+ onSubmit: async (L) => {
208
+ try {
209
+ const E = await C();
210
+ if (!E) return;
211
+ L.captcha = E, L.loginType = Ne.Default, o(L);
212
+ } catch (E) {
213
+ console.error(E);
214
+ }
215
+ },
216
+ children: (L) => {
217
+ const {
218
+ handleBlur: E,
219
+ handleSubmit: K,
220
+ values: b,
221
+ touched: _,
222
+ errors: O,
223
+ setFieldValue: D
224
+ } = L, se = _.email && O.email, le = _.password && O.password;
225
+ return /* @__PURE__ */ e("div", { className: `${t["box-login"]} w-100`, children: /* @__PURE__ */ e(
226
+ Ss,
227
+ {
228
+ className: `${t["block-login"]}`,
229
+ onSubmit: K,
230
+ children: /* @__PURE__ */ r("div", { className: `${t["block-form"]}`, children: [
231
+ /* @__PURE__ */ r("div", { className: "d-flex align-items-center mb-4", children: [
232
+ /* @__PURE__ */ e(
233
+ "img",
234
+ {
235
+ hidden: !i?.schoolLogo,
236
+ src: i?.schoolLogo,
237
+ className: `${t["school-icon"]} mr-3`
238
+ }
239
+ ),
240
+ /* @__PURE__ */ e(
241
+ "p",
242
+ {
243
+ className: `${t["school-name"]} mb-0`,
244
+ children: i.schoolName
245
+ }
246
+ )
247
+ ] }),
248
+ /* @__PURE__ */ e("p", { className: `${t["title-login"]}`, children: "Welcome Back!" }),
249
+ /* @__PURE__ */ e(
250
+ "p",
251
+ {
252
+ className: `${t["login-description"]} mb-5`,
253
+ children: "Please enter your MARIO Education account details"
254
+ }
255
+ ),
256
+ /* @__PURE__ */ r(
257
+ me,
258
+ {
259
+ className: `${t["form-user-name"]}`,
260
+ children: [
261
+ /* @__PURE__ */ e(
262
+ ie,
263
+ {
264
+ type: "text",
265
+ name: "email",
266
+ placeholder: "Email",
267
+ value: b.email,
268
+ onChange: (ae) => D(
269
+ "email",
270
+ ae.target?.value?.trim() || ""
271
+ ),
272
+ autocomplete: "email",
273
+ onBlur: E("email"),
274
+ required: !0
275
+ }
276
+ ),
277
+ se && /* @__PURE__ */ e(
278
+ oe,
279
+ {
280
+ text: O.email
281
+ }
282
+ )
283
+ ]
284
+ }
285
+ ),
286
+ /* @__PURE__ */ r(me, { children: [
287
+ /* @__PURE__ */ e(
288
+ he,
289
+ {
290
+ isShowPassword: d,
291
+ togglePasswordVisible: I,
292
+ onChange: (ae) => D(
293
+ "password",
294
+ ae.target?.value?.trim() || ""
295
+ )
296
+ }
297
+ ),
298
+ le && /* @__PURE__ */ e(
299
+ oe,
300
+ {
301
+ text: O.password
302
+ }
303
+ )
304
+ ] }),
305
+ /* @__PURE__ */ e(me, {}),
306
+ /* @__PURE__ */ r("div", { className: "d-flex justify-content-between", children: [
307
+ /* @__PURE__ */ r("div", { className: "d-flex align-items-center", style: { gap: "8px" }, children: [
308
+ /* @__PURE__ */ e(
309
+ "input",
310
+ {
311
+ type: "checkbox",
312
+ checked: !b.isSessionUserBrowser,
313
+ className: `${t["checkbox-keep-login"]}`,
314
+ onChange: () => D(
315
+ "isSessionUserBrowser",
316
+ !b.isSessionUserBrowser
317
+ )
318
+ }
319
+ ),
320
+ /* @__PURE__ */ e(
321
+ "p",
322
+ {
323
+ className: `${t["label-keep-login"]} mb-0 ml-2`,
324
+ children: "Keep me logged in"
325
+ }
326
+ )
327
+ ] }),
328
+ /* @__PURE__ */ e(
329
+ Ze,
330
+ {
331
+ to: "/forgot-password",
332
+ className: `${t["link-to-login"]}`,
333
+ children: "Forgot password?"
334
+ }
335
+ )
336
+ ] }),
337
+ /* @__PURE__ */ e(
338
+ "button",
339
+ {
340
+ className: `${t["btn-login"]} mt-5`,
341
+ type: "submit",
342
+ children: "LOG IN"
343
+ }
344
+ ),
345
+ /* @__PURE__ */ e(
346
+ "p",
347
+ {
348
+ className: `${t["option-text"]} my-3 text-center`,
349
+ children: "OR"
350
+ }
351
+ ),
352
+ /* @__PURE__ */ r(be, { className: "mb-4", children: [
353
+ /* @__PURE__ */ e(
354
+ ee,
355
+ {
356
+ lg: 6,
357
+ md: 6,
358
+ xs: 12,
359
+ className: "pr-md-3",
360
+ children: !!p && /* @__PURE__ */ e(
361
+ qs,
362
+ {
363
+ clientId: p,
364
+ children: /* @__PURE__ */ e(
365
+ aa,
366
+ {
367
+ onSuccess: Y,
368
+ onError: () => console.log("Google login failed")
369
+ }
370
+ )
371
+ }
372
+ )
373
+ }
374
+ ),
375
+ i.schoolId && /* @__PURE__ */ e(
376
+ ee,
377
+ {
378
+ lg: 6,
379
+ md: 6,
380
+ xs: 12,
381
+ className: `${t["btn-login-sso"]} pl-md-2`,
382
+ hidden: !i?.schoolId,
383
+ children: /* @__PURE__ */ r(
384
+ "div",
385
+ {
386
+ className: t["btn-login-with-sso"],
387
+ onClick: () => v(C),
388
+ children: [
389
+ /* @__PURE__ */ e("img", { src: "images/microsoft-logo.png" }),
390
+ /* @__PURE__ */ e("p", { children: "MICROSOFT" })
391
+ ]
392
+ }
393
+ )
394
+ }
395
+ )
396
+ ] }),
397
+ /* @__PURE__ */ e(
398
+ "div",
399
+ {
400
+ className: `${t["btn-login-sso"]}`,
401
+ children: /* @__PURE__ */ r(
402
+ "div",
403
+ {
404
+ className: t["btn-login-with-sso"],
405
+ onClick: () => window.open(
406
+ "https://launchpad.classlink.com/login"
407
+ ),
408
+ children: [
409
+ /* @__PURE__ */ e("img", { src: "images/class-link-icon.png" }),
410
+ /* @__PURE__ */ e("p", { children: "SIGN IN WITH CLASSLINK" })
411
+ ]
412
+ }
413
+ )
414
+ }
415
+ ),
416
+ /* @__PURE__ */ e(
417
+ "div",
418
+ {
419
+ className: `${t["btn-login-sso"]} mt-4`,
420
+ children: /* @__PURE__ */ r(
421
+ "div",
422
+ {
423
+ className: t["btn-login-with-sso"],
424
+ onClick: () => k(),
425
+ children: [
426
+ /* @__PURE__ */ e("img", { src: "images/clever-icon.png" }),
427
+ /* @__PURE__ */ e("p", { children: "SIGN IN WITH CLEVER" })
428
+ ]
429
+ }
430
+ )
431
+ }
432
+ )
433
+ ] })
434
+ }
435
+ ) });
436
+ }
437
+ }
438
+ ),
439
+ /* @__PURE__ */ e(ea, { open: x, onConfirm: S, clickHandler: C, onClose: R })
440
+ ] });
441
+ }, oa = {
442
+ email: "",
443
+ captcha: ""
444
+ }, ra = "/", De = "/login", na = "Log in", as = () => {
445
+ const s = new URLSearchParams(ys().search), o = s.get("token"), i = s.get("key") ?? "", d = Te(), m = xe(), [u, p] = N(!1), v = T(() => {
446
+ p(!u);
447
+ }, [u]), [w, k] = N(!1), [x, S] = N(!1), [R, I] = N({
448
+ token: "",
449
+ password: "",
450
+ reEnterPassword: "",
451
+ email: "",
452
+ userId: ""
453
+ }), [j, G] = N(!0), { executeRecaptcha: C } = Re();
454
+ Z(() => {
455
+ document.title = na, Ie() && m(ra);
456
+ }, []);
457
+ const A = T(async (b) => {
458
+ d(g(!0));
459
+ try {
460
+ await Is(b), m(De), d(
461
+ P({
462
+ type: "success",
463
+ message: "A mail to reset password was sent"
464
+ })
465
+ );
466
+ } catch (_) {
467
+ d(
468
+ P({
469
+ type: "danger",
470
+ message: _.response?.data?.title || _.message || "Error occured"
471
+ })
472
+ ), localStorage.removeItem(M), sessionStorage.removeItem(M);
473
+ }
474
+ d(g(!1));
475
+ }, []), Y = T(
476
+ async (b, _) => {
477
+ d(g(!0));
478
+ try {
479
+ const O = await bs(b, _);
480
+ O.data ? I({
481
+ ...R,
482
+ token: b,
483
+ email: O.data
484
+ }) : G(!1);
485
+ } catch {
486
+ G(!1);
487
+ }
488
+ d(g(!1));
489
+ },
490
+ []
491
+ ), L = T(async (b) => {
492
+ d(g(!0));
493
+ try {
494
+ await Ts({ ...b, key: i }), m(De), d(
495
+ P({
496
+ type: "success",
497
+ message: "Reset password sucessfully"
498
+ })
499
+ );
500
+ } catch (_) {
501
+ d(
502
+ P({
503
+ type: "danger",
504
+ message: _.response?.data?.title || _.message || "Error occured"
505
+ })
506
+ ), localStorage.removeItem(M), sessionStorage.removeItem(M);
507
+ }
508
+ d(g(!1));
509
+ }, []), E = T(async () => {
510
+ if (!C) {
511
+ console.log("execute recaptcha undefined");
512
+ return;
513
+ }
514
+ return await C("forgetPass");
515
+ }, [C]), K = T(() => {
516
+ }, []);
517
+ return Z(() => {
518
+ o && i && Y(o, i);
519
+ }, [o, i]), {
520
+ defaultInfo: oa,
521
+ forgotPasswordRequest: A,
522
+ checkResetTokenRequest: Y,
523
+ validLink: j,
524
+ resetPasswordRequest: L,
525
+ openLogin: u,
526
+ toggle: v,
527
+ isShowNewPassword: w,
528
+ setIsShowNewPassword: k,
529
+ isShowReTypePassword: x,
530
+ setIsShowReTypePassword: S,
531
+ clickHandler: E,
532
+ handleVerify: K,
533
+ initialValues: R
534
+ };
535
+ }, ia = {
536
+ email: "",
537
+ captcha: ""
538
+ }, la = V.object({
539
+ email: V.string().email("Email is invalid").required("Email is required")
540
+ }), ca = ({ school: s }) => {
541
+ const {
542
+ forgotPasswordRequest: o,
543
+ clickHandler: i,
544
+ handleVerify: d
545
+ } = as();
546
+ return /* @__PURE__ */ e(
547
+ ke,
548
+ {
549
+ initialValues: ia,
550
+ enableReinitialize: !0,
551
+ validationSchema: la,
552
+ onSubmit: async (m) => {
553
+ const u = await i();
554
+ u && (m.captcha = u, o(m));
555
+ },
556
+ children: (m) => {
557
+ const {
558
+ handleChange: u,
559
+ handleSubmit: p,
560
+ values: v,
561
+ touched: w,
562
+ errors: k
563
+ } = m;
564
+ return /* @__PURE__ */ e("div", { className: `${t["box-login"]}`, children: /* @__PURE__ */ e("div", { className: `${t["block-login"]}`, children: /* @__PURE__ */ r("div", { className: `${t["block-form"]}`, children: [
565
+ /* @__PURE__ */ r("div", { className: "d-flex align-items-center mb-4", children: [
566
+ /* @__PURE__ */ e(
567
+ "img",
568
+ {
569
+ src: s.schoolLogo,
570
+ className: `${t["school-icon"]} mr-3`
571
+ }
572
+ ),
573
+ /* @__PURE__ */ e(
574
+ "p",
575
+ {
576
+ className: `${t["school-name"]} mb-0`,
577
+ children: s.schoolName
578
+ }
579
+ )
580
+ ] }),
581
+ /* @__PURE__ */ e("p", { className: `${t["title-login"]} `, children: "Forgot password" }),
582
+ /* @__PURE__ */ e(
583
+ "p",
584
+ {
585
+ className: `${t["recover-account"]} mb-5`,
586
+ children: "Enter email to recover your account"
587
+ }
588
+ ),
589
+ /* @__PURE__ */ r("div", { className: "w-100", children: [
590
+ /* @__PURE__ */ e(
591
+ ie,
592
+ {
593
+ type: "text",
594
+ name: "email",
595
+ id: "email",
596
+ placeholder: "Input email",
597
+ onChange: u,
598
+ value: v.email
599
+ }
600
+ ),
601
+ w.email && k.email && /* @__PURE__ */ e(oe, { text: k.email })
602
+ ] }),
603
+ /* @__PURE__ */ e(
604
+ Ze,
605
+ {
606
+ to: "/login",
607
+ className: `${t["link-to-login"]} mt-2`,
608
+ children: "Return to login"
609
+ }
610
+ ),
611
+ /* @__PURE__ */ e(
612
+ Hs,
613
+ {
614
+ action: "forgetPass",
615
+ onVerify: d
616
+ }
617
+ ),
618
+ /* @__PURE__ */ e(ee, { className: "p-0", children: /* @__PURE__ */ e(
619
+ "button",
620
+ {
621
+ className: `${t["btn-login"]} mt-5`,
622
+ onClick: () => p(),
623
+ children: "Continue"
624
+ }
625
+ ) })
626
+ ] }) }) });
627
+ }
628
+ }
629
+ );
630
+ }, da = V.object({
631
+ password: V.string().required("New password is required"),
632
+ reEnterPassword: V.string().required("Please re-enter new password").test("matching", "Passwords do not match", function() {
633
+ return this.parent.password === this.parent.reEnterPassword;
634
+ })
635
+ }), ma = () => {
636
+ const {
637
+ validLink: s,
638
+ resetPasswordRequest: o,
639
+ isShowNewPassword: i,
640
+ setIsShowNewPassword: d,
641
+ isShowReTypePassword: m,
642
+ setIsShowReTypePassword: u,
643
+ initialValues: p
644
+ } = as();
645
+ return /* @__PURE__ */ e(
646
+ ke,
647
+ {
648
+ initialValues: p,
649
+ enableReinitialize: !0,
650
+ validationSchema: da,
651
+ onSubmit: (v) => {
652
+ o(v);
653
+ },
654
+ children: (v) => {
655
+ const { setFieldValue: w, handleSubmit: k, touched: x, errors: S, values: R } = v;
656
+ return /* @__PURE__ */ e(be, { className: `${t["box-login"]}`, children: /* @__PURE__ */ e(ee, { className: "p-0", children: /* @__PURE__ */ e("div", { className: `${t["block-login"]}`, children: /* @__PURE__ */ r("div", { className: `${t["block-form"]}`, children: [
657
+ /* @__PURE__ */ e(
658
+ "img",
659
+ {
660
+ src: `${ge(
661
+ "/images/horizontal-logo-blue.svg"
662
+ )}`,
663
+ className: `${t["img-login-rectangle"]}`
664
+ }
665
+ ),
666
+ /* @__PURE__ */ e("p", { className: `${t["title-login"]}`, children: "Reset Password" }),
667
+ /* @__PURE__ */ e("div", { className: "w-100", children: s ? /* @__PURE__ */ r(ve, { children: [
668
+ /* @__PURE__ */ e(
669
+ me,
670
+ {
671
+ className: `${t["form-user-name"]}`,
672
+ children: /* @__PURE__ */ e(
673
+ ie,
674
+ {
675
+ disabled: !0,
676
+ type: "text",
677
+ name: "email",
678
+ placeholder: "Email",
679
+ value: R.email,
680
+ autocomplete: "email",
681
+ required: !0,
682
+ className: `${t.input}`
683
+ }
684
+ )
685
+ }
686
+ ),
687
+ /* @__PURE__ */ r(
688
+ "div",
689
+ {
690
+ className: `${t["form-user-name"]}`,
691
+ children: [
692
+ /* @__PURE__ */ e(
693
+ he,
694
+ {
695
+ isShowPassword: i,
696
+ togglePasswordVisible: () => d(
697
+ !i
698
+ ),
699
+ onChange: (I) => w(
700
+ "password",
701
+ I.target.value
702
+ )
703
+ }
704
+ ),
705
+ x.password && S.password && /* @__PURE__ */ e(
706
+ oe,
707
+ {
708
+ text: S.password
709
+ }
710
+ )
711
+ ]
712
+ }
713
+ ),
714
+ /* @__PURE__ */ r(
715
+ "div",
716
+ {
717
+ className: `${t["form-user-name"]}`,
718
+ children: [
719
+ /* @__PURE__ */ e(
720
+ he,
721
+ {
722
+ placeholder: "Confirm Password",
723
+ isShowPassword: m,
724
+ togglePasswordVisible: () => u(
725
+ !m
726
+ ),
727
+ onChange: (I) => w(
728
+ "reEnterPassword",
729
+ I.target.value
730
+ )
731
+ }
732
+ ),
733
+ x.reEnterPassword && S.reEnterPassword && /* @__PURE__ */ e(
734
+ oe,
735
+ {
736
+ text: S.reEnterPassword
737
+ }
738
+ )
739
+ ]
740
+ }
741
+ )
742
+ ] }) : /* @__PURE__ */ r(ve, { children: [
743
+ /* @__PURE__ */ e(
744
+ "p",
745
+ {
746
+ className: `${t["recover-account"]} mb-5`,
747
+ children: "Invalid reset password link"
748
+ }
749
+ ),
750
+ /* @__PURE__ */ e("p", { className: "w-100", children: "It may have been accessed before or expired or you have just tried to reset another account's password" })
751
+ ] }) }),
752
+ s && /* @__PURE__ */ e(ee, { className: "p-0", children: /* @__PURE__ */ e(
753
+ "button",
754
+ {
755
+ className: `${t["btn-login"]} ${t["btn-rounder"]} mt-4`,
756
+ onClick: () => k(),
757
+ children: "SET A NEW PASSWORD"
758
+ }
759
+ ) })
760
+ ] }) }) }) });
761
+ }
762
+ }
763
+ );
764
+ }, ts = `${ks}/api/school`, ga = () => es.get(`${ts}/settings`), ha = () => es.get(`${ts}/info`), ua = {
765
+ auth: {
766
+ clientId: ye ? "a27f8ac9-e039-4bbd-a9e1-3096e52a77bb" : "90c6897c-f17b-475e-a7a8-9a19651e0060",
767
+ authority: "https://login.microsoftonline.com/common",
768
+ redirectUri: "https://sso.marioforme.com/microsoft-login.html"
769
+ },
770
+ cache: {
771
+ cacheLocation: "sessionStorage",
772
+ // This configures where your cache will be stored
773
+ storeAuthStateInCookie: !1
774
+ // Set this to "true" if you are having issues on IE11 or Edge
775
+ },
776
+ system: {
777
+ loggerOptions: {
778
+ loggerCallback: (s, o, i) => {
779
+ if (!i)
780
+ switch (s) {
781
+ case Se.Error:
782
+ console.error(o);
783
+ return;
784
+ case Se.Info:
785
+ console.info(o);
786
+ return;
787
+ case Se.Verbose:
788
+ console.debug(o);
789
+ return;
790
+ case Se.Warning:
791
+ console.warn(o);
792
+ return;
793
+ default:
794
+ return;
795
+ }
796
+ }
797
+ }
798
+ }
799
+ }, pa = {
800
+ email: "",
801
+ password: "",
802
+ captcha: "",
803
+ rememberMe: !1,
804
+ isSessionUserBrowser: !!sessionStorage.getItem(Pe)
805
+ }, fa = "/home", qe = "/home", wa = "/admin/home", Sa = "/parent", ya = "/admin/schools", Na = "/list-student", va = "Log in", Ia = () => {
806
+ const s = Te(), o = xe(), [i, d] = N(!1), m = Ee(
807
+ (a) => a.common.isLoginGoogle
808
+ ), [u, p] = N(""), [v, w] = N(""), [k, x] = N(""), [S, R] = N(!1), I = Ee((a) => a.common.inforUserGoogle), j = Ee((a) => a.common.environment), G = new URLSearchParams(location.search), C = G.get("type") === "classlink", A = G.get("token"), Y = G.get("isAdminUser"), [
809
+ L
810
+ /*, setOpenModelAssign*/
811
+ ] = N(!1), [E, K] = N({
812
+ schoolName: "",
813
+ schoolLogo: "",
814
+ schoolId: 0
815
+ }), [b, _] = N(null), O = T(() => {
816
+ d(!i);
817
+ }, [i]), [D, se] = N(!1), [le, ae] = N(!1), [Q, Ce] = N({
818
+ firstName: "",
819
+ lastName: "",
820
+ fullName: "",
821
+ imageUrl: "",
822
+ email: "",
823
+ accessToken: "",
824
+ googleId: ""
825
+ });
826
+ Z(() => {
827
+ document.title = va;
828
+ const a = Cs("auth-token");
829
+ if (a) {
830
+ const l = window.location.hostname;
831
+ if (localStorage.setItem(M, a), document.cookie = `auth-token=;domain=${l.includes("localhost") ? l : ".marioforme.com"}; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`, document.cookie = "redirect-uri=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/", Y)
832
+ return o("/admin/home");
833
+ Me(a);
834
+ return;
835
+ }
836
+ Ie() && o("/"), cs();
837
+ }, [Y, Me, o]);
838
+ const ue = () => {
839
+ localStorage.removeItem(M), sessionStorage.removeItem(M), localStorage.removeItem("USER_EMAIL");
840
+ };
841
+ Z(() => {
842
+ C && A != "" && rs();
843
+ }, []);
844
+ const H = () => {
845
+ ae(!le);
846
+ }, os = () => {
847
+ if (ye) {
848
+ const a = "https://clever.com/oauth/instant-login?client_id=44f4bbf55cd873d3f7e5&district_id=6620cba31f1ddde7bd689dc5";
849
+ window.location.href = a;
850
+ } else {
851
+ const a = `https://clever.com/oauth/authorize?response_type=code&redirect_uri=${encodeURIComponent("https://classlink.marioforme.com/api/clever/clever-login")}&client_id=c3da6c669d239c70d48e`;
852
+ window.location.href = a;
853
+ }
854
+ }, rs = async () => {
855
+ s(g(!0));
856
+ try {
857
+ const n = await Ls({
858
+ tokenClassLink: A
859
+ }), { email: l, token: f } = n.data;
860
+ await te({
861
+ email: l,
862
+ rememberMe: !1,
863
+ password: "default",
864
+ accessToken: f
865
+ });
866
+ } catch (a) {
867
+ s(
868
+ P({
869
+ type: "danger",
870
+ message: a.response?.data?.title || a.message
871
+ })
872
+ );
873
+ }
874
+ s(g(!1));
875
+ }, _e = window.location.host.includes("-district"), ns = T(async () => {
876
+ s(g(!0));
877
+ try {
878
+ const a = await ha(), n = a.data.schoolLogo ?? "";
879
+ a.data && K({
880
+ schoolName: a.data.schoolName,
881
+ schoolLogo: n ? Es(n) : ge("/images/logo_header_blue.png"),
882
+ schoolId: a.data.schoolId
883
+ });
884
+ } catch (a) {
885
+ s(
886
+ P({
887
+ type: "danger",
888
+ message: a.response?.data?.title || a.message
889
+ })
890
+ );
891
+ }
892
+ s(g(!1));
893
+ }, []), [is, pe] = N(!1), [re, $e] = N(null), ce = T((a, n, l, f, c, q, B, W, J, $) => {
894
+ const z = $?.isSessionUserBrowser ?? !1;
895
+ z ? (sessionStorage.setItem(M, a), sessionStorage.setItem(
896
+ Pe,
897
+ String(z)
898
+ )) : (sessionStorage.removeItem(Pe), localStorage.setItem(M, a)), localStorage.removeItem(Ps), sessionStorage.removeItem("ACTIVE_ROLE"), s(
899
+ xs({
900
+ id: n,
901
+ firstName: l,
902
+ lastName: f,
903
+ roles: c,
904
+ email: q,
905
+ profileImageFileName: B
906
+ })
907
+ );
908
+ let y = localStorage.getItem("ROLES") || "";
909
+ if (!y) {
910
+ if (c.includes("Admin"))
911
+ y = "Admin";
912
+ else {
913
+ const U = ((n ? localStorage.getItem(`PREFERRED_ROLE_${n}`) : null) || "").split(",").map((we) => we.trim()).filter(Boolean);
914
+ U.length > 0 && U.every((we) => c.includes(we)) ? U.length > 1 ? y = U.every(
915
+ (ze) => ze === "Teacher" || ze === "Assistant"
916
+ ) ? "Teacher,Assistant" : U[0] : y = U[0] : c.includes("Teacher") ? y = c.includes("Assistant") ? "Teacher,Assistant" : "Teacher" : c.includes("Assistant") ? y = "Assistant" : c.includes("Counselor") ? y = "Counselor" : c.includes("SecondaryTeacher") ? y = "SecondaryTeacher" : c.includes("EduTeacher") ? y = "EduTeacher" : c.includes("Student") ? y = "Student" : c.includes("Parent") ? y = "Parent" : c.length > 0 && (y = c[0]);
917
+ }
918
+ y && (localStorage.setItem("ROLES", y), sessionStorage.setItem("ACTIVE_ROLE", y));
919
+ }
920
+ if ($?.email && !c.includes("Admin")) {
921
+ de.init(
922
+ ye ? _s : Rs,
923
+ $.email,
924
+ {
925
+ defaultTracking: !1
926
+ }
927
+ );
928
+ const X = window.location.hostname, U = new de.Identify();
929
+ U.set("domain", X), de.identify(U), de.track("general: session start", {
930
+ user_id: $.email,
931
+ domain: X,
932
+ roles: c?.toString()
933
+ }), localStorage.setItem("USER_EMAIL", $.email), W && de.track("general: first login", {
934
+ user_id: $.email,
935
+ domain: X,
936
+ roles: c?.toString()
937
+ });
938
+ }
939
+ const us = (String($?.preferredAppType || "").split(",").map((X) => X.trim().toUpperCase()).filter(Boolean)[0] || "") === "HS" ? "HS" : "MS";
940
+ $s() || localStorage.setItem("ACTIVE_TIER", us);
941
+ const ne = (X) => {
942
+ const U = Us(X, J);
943
+ window.location.pathname.startsWith("/es") ? J === "es" ? o(U) : window.location.href = U : J === "es" ? window.location.href = U : o(U);
944
+ }, F = y.split(",")[0] || "";
945
+ _e ? ne(ya) : c.includes("Admin") || F === "Admin" ? ne(wa) : F === "Teacher" || F === "Assistant" || F === "Counselor" || F === "SecondaryTeacher" || !F && (c.includes("Teacher") || c.includes("Assistant") || c.includes("Counselor") || c.includes("SecondaryTeacher")) ? ne(fa) : F === "Student" || !F && c.includes("Student") ? ne(qe) : F === "Parent" || !F && c.includes("Parent") ? ne(Sa) : (F === "EduTeacher" || !F && c.includes("EduTeacher")) && ne(Na), s(g(!1));
946
+ }, [s, o, _e]), fe = T((a, n, l) => S && a?.includes("Student") && (n === "es" || l === "ES") ? (s(
947
+ P({
948
+ type: "danger",
949
+ message: "Unable to sign in with SSO. Please contact your admin or teacher."
950
+ })
951
+ ), localStorage.removeItem(M), sessionStorage.removeItem(M), s(g(!1)), !0) : !1, [S, s]), Ae = T((a) => S && a && As.includes(a.trim()) ? (s(
952
+ P({
953
+ type: "danger",
954
+ message: "Unable to sign in with SSO. Please contact your admin or teacher."
955
+ })
956
+ ), s(g(!1)), !0) : !1, [S, s]);
957
+ async function Me(a) {
958
+ s(g(!0));
959
+ try {
960
+ const n = await Ms();
961
+ let {
962
+ id: l,
963
+ firstName: f,
964
+ lastName: c,
965
+ roles: q,
966
+ email: B,
967
+ profileImageFileName: W,
968
+ isLoginFirst: J,
969
+ schoolLevel: $,
970
+ appType: z,
971
+ preferredAppType: y,
972
+ needsAppTypeChoice: Be
973
+ } = n.data;
974
+ if (Be) {
975
+ $e({ email: B }), pe(!0), s(g(!1));
976
+ return;
977
+ }
978
+ $ || (z === "ES" || z === "ES, MS" && y === "ES") && ($ = "es"), ce(
979
+ a,
980
+ l,
981
+ f,
982
+ c,
983
+ q,
984
+ B,
985
+ W,
986
+ J,
987
+ $,
988
+ { email: B, ...n.data }
989
+ );
990
+ } catch (n) {
991
+ s(
992
+ P({
993
+ type: "danger",
994
+ message: n.response?.data?.title || n.message || "Login failed"
995
+ })
996
+ ), s(g(!1));
997
+ }
998
+ }
999
+ const ls = T(async (a) => {
1000
+ if (pe(!1), !re) return;
1001
+ s(g(!0));
1002
+ const n = a === "es" ? "ES" : a === "ms" ? "MS" : "ES, MS";
1003
+ try {
1004
+ const l = await Fe({
1005
+ ...re,
1006
+ email: re?.email?.trim(),
1007
+ password: re?.password?.trim(),
1008
+ preferredAppType: n
1009
+ });
1010
+ let {
1011
+ token: f,
1012
+ id: c,
1013
+ firstName: q,
1014
+ lastName: B,
1015
+ roles: W,
1016
+ email: J,
1017
+ profileImageFileName: $,
1018
+ isLoginFirst: z,
1019
+ schoolLevel: y
1020
+ } = l.data;
1021
+ if (!y && a === "es" && (y = "es"), fe(W, y, l.data.appType)) return;
1022
+ ce(
1023
+ f,
1024
+ c,
1025
+ q,
1026
+ B,
1027
+ W,
1028
+ J,
1029
+ $,
1030
+ z,
1031
+ y,
1032
+ { ...re, ...l.data }
1033
+ );
1034
+ } catch (l) {
1035
+ s(
1036
+ P({
1037
+ type: "danger",
1038
+ message: l.response?.data?.title || l.message || "Login failed"
1039
+ })
1040
+ ), s(g(!1));
1041
+ }
1042
+ }, [re, ce, fe, s]), te = T(async (a) => {
1043
+ s(g(!0));
1044
+ try {
1045
+ const n = await Fe({
1046
+ ...a,
1047
+ email: a?.email?.trim(),
1048
+ password: a?.password?.trim()
1049
+ });
1050
+ let {
1051
+ token: l,
1052
+ id: f,
1053
+ firstName: c,
1054
+ lastName: q,
1055
+ roles: B,
1056
+ email: W,
1057
+ profileImageFileName: J,
1058
+ isLoginFirst: $,
1059
+ schoolLevel: z
1060
+ } = n.data;
1061
+ if (n.data.needsAppTypeChoice) {
1062
+ $e(a), pe(!0), s(g(!1));
1063
+ return;
1064
+ }
1065
+ if (z || (n.data.appType === "ES" || n.data.appType === "ES, MS" && n.data.preferredAppType === "ES") && (z = "es"), fe(B, z, n.data.appType)) return;
1066
+ ce(
1067
+ l,
1068
+ f,
1069
+ c,
1070
+ q,
1071
+ B,
1072
+ W,
1073
+ J,
1074
+ $,
1075
+ z,
1076
+ { ...a, ...n.data }
1077
+ );
1078
+ } catch (n) {
1079
+ s(
1080
+ P({
1081
+ type: "danger",
1082
+ message: n.response?.data?.title || n.message || "Login failed"
1083
+ })
1084
+ ), localStorage.removeItem(M), sessionStorage.removeItem(M), s(g(!1));
1085
+ }
1086
+ }, [ce, fe, s]), cs = async () => {
1087
+ try {
1088
+ const a = await Gs();
1089
+ p(a.data.googleClientId), w(a.data.googleCaptchaId), x(a.data.extensionEmail), R(a.data.isRestrictedLogin);
1090
+ } catch (a) {
1091
+ s(
1092
+ P({
1093
+ type: "danger",
1094
+ message: a.response?.data?.title || a.message || "Login failed"
1095
+ })
1096
+ );
1097
+ }
1098
+ }, Ge = T(
1099
+ async (a, n, l, f) => {
1100
+ s(g(!0));
1101
+ try {
1102
+ if ((await Os(a, n)).data) {
1103
+ const B = {
1104
+ email: n.email,
1105
+ isLoginGoogle: !0,
1106
+ rememberMe: !1,
1107
+ password: "default",
1108
+ accessToken: l,
1109
+ captcha: "",
1110
+ loginType: Ne.Google
1111
+ };
1112
+ if (f != null) {
1113
+ const W = await f();
1114
+ B.captcha = W;
1115
+ }
1116
+ await te(B), s(Le(!1));
1117
+ } else
1118
+ Ce({ ...n, token: l }), H();
1119
+ } catch (c) {
1120
+ s(
1121
+ P({
1122
+ type: "danger",
1123
+ message: c.response?.data?.title || c.message || "Login failed"
1124
+ })
1125
+ );
1126
+ }
1127
+ s(g(!1));
1128
+ },
1129
+ [te, s, H]
1130
+ ), ds = T(async (a, n) => {
1131
+ s(g(!0));
1132
+ try {
1133
+ if (Ae(a)) return;
1134
+ if ((await Ve({ ...Q, gradeLevel: a }))?.data) {
1135
+ const f = {
1136
+ email: Q.email,
1137
+ isLoginGoogle: !0,
1138
+ rememberMe: !1,
1139
+ password: "default",
1140
+ accessToken: Q.accessToken,
1141
+ captcha: "",
1142
+ loginType: Ne.Google
1143
+ };
1144
+ if (n != null) {
1145
+ const c = await n();
1146
+ f.captcha = c;
1147
+ }
1148
+ await te(f), H();
1149
+ }
1150
+ } catch (l) {
1151
+ s(
1152
+ P({
1153
+ type: "danger",
1154
+ message: l.response?.data?.title || l.message || "Login failed"
1155
+ })
1156
+ );
1157
+ }
1158
+ s(g(!1));
1159
+ }, [Ae, Q, te, H, s]), ms = async (a, n) => {
1160
+ s(g(!0));
1161
+ try {
1162
+ const l = {
1163
+ firstName: I.firstName,
1164
+ lastName: I.lastName,
1165
+ imageUrl: I.imageUrl,
1166
+ fullName: I.fullName,
1167
+ email: I.email,
1168
+ accessToken: I.accessToken,
1169
+ teacherId: a
1170
+ };
1171
+ if ((await Ve(l)).data) {
1172
+ const c = await n(), q = {
1173
+ email: I.email,
1174
+ captcha: c,
1175
+ isLoginGoogle: !0,
1176
+ rememberMe: !1,
1177
+ password: "default",
1178
+ accessToken: I.accessToken,
1179
+ loginType: Ne.Google
1180
+ };
1181
+ s(Le(!1)), await te(q), o(qe);
1182
+ }
1183
+ } catch (l) {
1184
+ s(
1185
+ P({
1186
+ type: "danger",
1187
+ message: l.response?.data?.title || l.message || "Login failed"
1188
+ })
1189
+ );
1190
+ }
1191
+ s(Le(!1)), s(g(!1));
1192
+ }, gs = async () => {
1193
+ try {
1194
+ const a = await ga();
1195
+ s(Bs(a.data.isSandboxMode)), zs(!!a.data.isCombineMsHs);
1196
+ } catch (a) {
1197
+ console.error(a);
1198
+ }
1199
+ }, Oe = async (a) => {
1200
+ b.handleRedirectPromise().then(async (n) => {
1201
+ if (E?.schoolId)
1202
+ if (n) {
1203
+ let l = n.account;
1204
+ await Ue(l, a);
1205
+ } else {
1206
+ const l = b.getAllAccounts();
1207
+ if (l.length === 0) {
1208
+ const f = j === "PreProduction" ? "https://mario1.marioforme.com" : ye ? "https://brightsoft.marioforme.com" : "https://sso.marioforme.com";
1209
+ window.location.href = (window.location.hostname === "localhost" ? window.location.origin : f) + `/microsoft-login.html?redirect-uri=${window.location.origin}&schoolId=${E.schoolId}`;
1210
+ } else {
1211
+ let f = l[0];
1212
+ await Ue(f, a);
1213
+ }
1214
+ }
1215
+ }).catch((n) => {
1216
+ console.error(n);
1217
+ });
1218
+ }, Ue = async (a, n) => {
1219
+ let l = a.name, f = {
1220
+ firstName: l.split(" ").slice(0, -1).join(" "),
1221
+ lastName: l.split(" ").slice(-1).join(" "),
1222
+ fullName: l,
1223
+ imageUrl: "",
1224
+ email: a.username,
1225
+ accessToken: a.idTokenClaims.aio,
1226
+ googleId: a.tenantId
1227
+ };
1228
+ s(Xe(f)), await Ge(
1229
+ ss.MicrosoftSSO,
1230
+ f,
1231
+ a.idTokenClaims.aio,
1232
+ n
1233
+ );
1234
+ }, hs = async () => {
1235
+ const a = new js(ua);
1236
+ await a.initialize(), _(a);
1237
+ };
1238
+ return Z(() => {
1239
+ let a = window.location.href;
1240
+ b && a.includes("code") && a.includes("client_info") && Oe();
1241
+ }, [JSON.stringify(b)]), Z(() => {
1242
+ gs(), hs(), ns();
1243
+ }, []), {
1244
+ defaultInfo: pa,
1245
+ userLogin: te,
1246
+ openLogin: i,
1247
+ toggle: O,
1248
+ isShowPassword: D,
1249
+ setIsShowPassword: se,
1250
+ fnIsCheckLogin: Ge,
1251
+ isLoginGoogle: m,
1252
+ infoUser: I,
1253
+ submitLogin: ms,
1254
+ googleClientId: u,
1255
+ googleRecaptchaId: v,
1256
+ handleCancelModelAssign: ue,
1257
+ openModelAssign: L,
1258
+ // handleAssignTeacherByCode,
1259
+ fnLoginSSO: Oe,
1260
+ school: E,
1261
+ extensionEmail: k,
1262
+ handleLoginWidthClever: os,
1263
+ openModalSelectGrade: le,
1264
+ handleRegisterUser: ds,
1265
+ handleToggleModelGrade: H,
1266
+ openModalSelectTier: is,
1267
+ handleSelectTier: ls,
1268
+ setOpenModalSelectTier: pe
1269
+ };
1270
+ }, We = "/", ba = "/login", je = "Log in", Ta = () => {
1271
+ const s = Te(), o = xe(), i = location.search, m = new URLSearchParams(i).get("userId"), [u, p] = N(!1), [v, w] = N(
1272
+ !1
1273
+ ), [k, x] = N({
1274
+ password: "",
1275
+ reEnterPassword: "",
1276
+ email: "",
1277
+ userId: m ?? "",
1278
+ token: ""
1279
+ }), { executeRecaptcha: S } = Re(), R = T(async (C) => {
1280
+ s(g(!0));
1281
+ try {
1282
+ const A = await Fs(C);
1283
+ x({ ...k, email: A.data });
1284
+ } catch (A) {
1285
+ s(
1286
+ P({
1287
+ type: "danger",
1288
+ message: A.message
1289
+ })
1290
+ );
1291
+ }
1292
+ s(g(!1));
1293
+ }, []), I = T(async (C) => {
1294
+ s(g(!0));
1295
+ try {
1296
+ await Vs(C), o(ba), s(
1297
+ P({
1298
+ type: "success",
1299
+ message: "Create password sucessfully"
1300
+ })
1301
+ );
1302
+ } catch (A) {
1303
+ s(
1304
+ P({
1305
+ type: "danger",
1306
+ message: A.response?.data?.title || A.message || "Error occured"
1307
+ })
1308
+ ), localStorage.removeItem(M), sessionStorage.removeItem(M);
1309
+ }
1310
+ s(g(!1));
1311
+ }, []), j = T(async () => {
1312
+ if (!S) {
1313
+ console.log("execute recaptcha undefined");
1314
+ return;
1315
+ }
1316
+ return await S("forgetPass");
1317
+ }, [S]), G = T(() => {
1318
+ }, []);
1319
+ return Z(() => {
1320
+ document.title = je, Ie() && o(We), m && R(m);
1321
+ }, [m]), Z(() => {
1322
+ document.title = je, Ie() && o(We);
1323
+ }, []), {
1324
+ createPasswordRequest: I,
1325
+ isShowNewPassword: u,
1326
+ setIsShowNewPassword: p,
1327
+ isShowReTypePassword: v,
1328
+ setIsShowReTypePassword: w,
1329
+ clickHandler: j,
1330
+ handleVerify: G,
1331
+ initialValues: k
1332
+ };
1333
+ }, ka = V.object({
1334
+ password: V.string().required("Password is required"),
1335
+ reEnterPassword: V.string().required("Please re-enter Password").test("matching", "Passwords do not match", function() {
1336
+ return this.parent.password === this.parent.reEnterPassword;
1337
+ })
1338
+ }), Ca = () => {
1339
+ const {
1340
+ createPasswordRequest: s,
1341
+ isShowNewPassword: o,
1342
+ setIsShowNewPassword: i,
1343
+ isShowReTypePassword: d,
1344
+ setIsShowReTypePassword: m,
1345
+ initialValues: u
1346
+ } = Ta();
1347
+ return /* @__PURE__ */ e(
1348
+ ke,
1349
+ {
1350
+ initialValues: u,
1351
+ enableReinitialize: !0,
1352
+ validationSchema: ka,
1353
+ onSubmit: (p) => {
1354
+ s(p);
1355
+ },
1356
+ children: (p) => {
1357
+ const {
1358
+ setFieldValue: v,
1359
+ handleSubmit: w,
1360
+ touched: k,
1361
+ errors: x,
1362
+ values: S
1363
+ } = p;
1364
+ return /* @__PURE__ */ e(be, { className: `${t["box-login"]}`, children: /* @__PURE__ */ r(ee, { className: "p-0", children: [
1365
+ /* @__PURE__ */ e(
1366
+ "div",
1367
+ {
1368
+ hidden: !S.email,
1369
+ className: `${t["block-login"]}`,
1370
+ children: /* @__PURE__ */ r("div", { className: `${t["block-form"]}`, children: [
1371
+ /* @__PURE__ */ e(
1372
+ "img",
1373
+ {
1374
+ src: `${ge(
1375
+ "/images/horizontal-logo-blue.svg"
1376
+ )}`,
1377
+ className: `${t["img-login-rectangle"]}`
1378
+ }
1379
+ ),
1380
+ /* @__PURE__ */ e("p", { className: `${t["title-login"]}`, children: "Create Your Password" }),
1381
+ /* @__PURE__ */ e("div", { className: "w-100", children: /* @__PURE__ */ r(ve, { children: [
1382
+ /* @__PURE__ */ e(
1383
+ me,
1384
+ {
1385
+ className: `${t["form-user-name"]}`,
1386
+ children: /* @__PURE__ */ e(
1387
+ ie,
1388
+ {
1389
+ disabled: !0,
1390
+ type: "text",
1391
+ name: "email",
1392
+ placeholder: "Email",
1393
+ value: S.email,
1394
+ autocomplete: "email",
1395
+ required: !0,
1396
+ className: `${t.input}`
1397
+ }
1398
+ )
1399
+ }
1400
+ ),
1401
+ /* @__PURE__ */ r(
1402
+ "div",
1403
+ {
1404
+ className: `${t["form-user-name"]}`,
1405
+ children: [
1406
+ /* @__PURE__ */ e(
1407
+ he,
1408
+ {
1409
+ isShowPassword: o,
1410
+ togglePasswordVisible: () => i(
1411
+ !o
1412
+ ),
1413
+ onChange: (R) => v(
1414
+ "password",
1415
+ R.target.value
1416
+ )
1417
+ }
1418
+ ),
1419
+ k.password && x.password && /* @__PURE__ */ e(
1420
+ oe,
1421
+ {
1422
+ text: x.password
1423
+ }
1424
+ )
1425
+ ]
1426
+ }
1427
+ ),
1428
+ /* @__PURE__ */ r(
1429
+ "div",
1430
+ {
1431
+ className: `${t["form-user-name"]}`,
1432
+ children: [
1433
+ /* @__PURE__ */ e(
1434
+ he,
1435
+ {
1436
+ placeholder: "Confirm Password",
1437
+ isShowPassword: d,
1438
+ togglePasswordVisible: () => m(
1439
+ !d
1440
+ ),
1441
+ onChange: (R) => v(
1442
+ "reEnterPassword",
1443
+ R.target.value
1444
+ )
1445
+ }
1446
+ ),
1447
+ k.reEnterPassword && x.reEnterPassword && /* @__PURE__ */ e(
1448
+ oe,
1449
+ {
1450
+ text: x.reEnterPassword
1451
+ }
1452
+ )
1453
+ ]
1454
+ }
1455
+ )
1456
+ ] }) }),
1457
+ /* @__PURE__ */ e(
1458
+ "button",
1459
+ {
1460
+ className: `${t["btn-login"]} ${t["btn-rounder"]} mt-4`,
1461
+ onClick: () => w(),
1462
+ children: "CREATE YOUR PASSWORD"
1463
+ }
1464
+ )
1465
+ ] })
1466
+ }
1467
+ ),
1468
+ /* @__PURE__ */ e(
1469
+ "div",
1470
+ {
1471
+ hidden: !!S.email,
1472
+ className: `${t["block-login"]}`,
1473
+ children: /* @__PURE__ */ r("div", { className: `${t["block-form"]}`, children: [
1474
+ /* @__PURE__ */ e(
1475
+ "img",
1476
+ {
1477
+ src: `${ge(
1478
+ "/images/horizontal-logo-blue.svg"
1479
+ )}`,
1480
+ className: `${t["img-login-rectangle"]}`
1481
+ }
1482
+ ),
1483
+ /* @__PURE__ */ e("p", { className: `${t["title-login"]}`, children: "You cannot regenerate the password" })
1484
+ ] })
1485
+ }
1486
+ )
1487
+ ] }) });
1488
+ }
1489
+ }
1490
+ );
1491
+ }, La = "_modalContent_1pxxz_1", Ea = "_closeButton_1pxxz_6", Pa = "_modalBody_1pxxz_17", xa = "_iconWrapper_1pxxz_22", Ra = "_title_1pxxz_38", _a = "_subtitle_1pxxz_45", $a = "_tierCard_1pxxz_51", Aa = "_es_1pxxz_60", Ma = "_tierTitle_1pxxz_71", Ga = "_tierDesc_1pxxz_76", Oa = "_arrow_1pxxz_81", Ua = "_ms_1pxxz_85", Ba = "_both_1pxxz_110", za = "_cardLeft_1pxxz_134", Fa = "_cardText_1pxxz_138", h = {
1492
+ modalContent: La,
1493
+ closeButton: Ea,
1494
+ modalBody: Pa,
1495
+ iconWrapper: xa,
1496
+ title: Ra,
1497
+ subtitle: _a,
1498
+ tierCard: $a,
1499
+ es: Aa,
1500
+ tierTitle: Ma,
1501
+ tierDesc: Ga,
1502
+ arrow: Oa,
1503
+ ms: Ua,
1504
+ both: Ba,
1505
+ cardLeft: za,
1506
+ cardText: Fa
1507
+ }, Va = ({ open: s, onSelectTier: o, onClose: i }) => /* @__PURE__ */ r(
1508
+ Ke,
1509
+ {
1510
+ isOpen: s,
1511
+ style: { zIndex: 1201, maxWidth: 450 },
1512
+ centered: !0,
1513
+ autoFocus: !1,
1514
+ returnFocusAfterClose: !1,
1515
+ contentClassName: h.modalContent,
1516
+ children: [
1517
+ /* @__PURE__ */ e("div", { className: h.closeButton, children: i && /* @__PURE__ */ e(Qe, { onClick: () => i(), size: 24 }) }),
1518
+ /* @__PURE__ */ r(Je, { className: h.modalBody, children: [
1519
+ /* @__PURE__ */ e("div", { className: h.iconWrapper, children: /* @__PURE__ */ e("svg", { fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" }) }) }),
1520
+ /* @__PURE__ */ e("h4", { className: h.title, children: "Select Grade Level" }),
1521
+ /* @__PURE__ */ e("p", { className: h.subtitle, children: "Select the grade levels you support" }),
1522
+ /* @__PURE__ */ r(
1523
+ "div",
1524
+ {
1525
+ onClick: () => o("es"),
1526
+ className: `${h.tierCard} ${h.es}`,
1527
+ children: [
1528
+ /* @__PURE__ */ r("div", { className: h.cardLeft, children: [
1529
+ /* @__PURE__ */ e("svg", { fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" }) }),
1530
+ /* @__PURE__ */ r("div", { className: h.cardText, children: [
1531
+ /* @__PURE__ */ e("div", { className: h.tierTitle, children: "Elementary / Primary" }),
1532
+ /* @__PURE__ */ e("div", { className: h.tierDesc, children: "Grades 2-5 / Years 3-6" })
1533
+ ] })
1534
+ ] }),
1535
+ /* @__PURE__ */ e("div", { className: h.arrow, children: ">" })
1536
+ ]
1537
+ }
1538
+ ),
1539
+ /* @__PURE__ */ r(
1540
+ "div",
1541
+ {
1542
+ onClick: () => o("ms"),
1543
+ className: `${h.tierCard} ${h.ms}`,
1544
+ children: [
1545
+ /* @__PURE__ */ r("div", { className: h.cardLeft, children: [
1546
+ /* @__PURE__ */ e("svg", { fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z" }) }),
1547
+ /* @__PURE__ */ r("div", { className: h.cardText, children: [
1548
+ /* @__PURE__ */ e("div", { className: h.tierTitle, children: "Middle & High / Secondary" }),
1549
+ /* @__PURE__ */ e("div", { className: h.tierDesc, children: "Grades 6-12 / Years 7-13" })
1550
+ ] })
1551
+ ] }),
1552
+ /* @__PURE__ */ e("div", { className: h.arrow, children: ">" })
1553
+ ]
1554
+ }
1555
+ ),
1556
+ /* @__PURE__ */ r(
1557
+ "div",
1558
+ {
1559
+ onClick: () => o("both"),
1560
+ className: `${h.tierCard} ${h.both}`,
1561
+ children: [
1562
+ /* @__PURE__ */ r("div", { className: h.cardLeft, children: [
1563
+ /* @__PURE__ */ e("svg", { fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M17 14v6m-3-3h6M6 10h2a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v2a2 2 0 002 2zm10 0h2a2 2 0 002-2V6a2 2 0 00-2-2h-2a2 2 0 00-2 2v2a2 2 0 002 2zM6 20h2a2 2 0 002-2v-2a2 2 0 00-2-2H6a2 2 0 00-2 2v2a2 2 0 002 2z" }) }),
1564
+ /* @__PURE__ */ r("div", { className: h.cardText, children: [
1565
+ /* @__PURE__ */ e("div", { className: h.tierTitle, children: "Both Tiers" }),
1566
+ /* @__PURE__ */ e("div", { className: h.tierDesc, children: "Access all grade levels" })
1567
+ ] })
1568
+ ] }),
1569
+ /* @__PURE__ */ e("div", { className: h.arrow, children: ">" })
1570
+ ]
1571
+ }
1572
+ )
1573
+ ] })
1574
+ ]
1575
+ }
1576
+ ), Ha = Ye(Va), Da = "Log in", qa = "Forgot password", Wa = "Reset password", it = (s) => {
1577
+ const {
1578
+ isLogin: o,
1579
+ isForgotPassword: i,
1580
+ isResetPassword: d,
1581
+ isCreatePassword: m
1582
+ // isLoginTwoFactor
1583
+ } = s, {
1584
+ defaultInfo: u,
1585
+ userLogin: p,
1586
+ googleRecaptchaId: v,
1587
+ handleCancelModelAssign: w,
1588
+ school: k,
1589
+ openModelAssign: x,
1590
+ setIsShowPassword: S,
1591
+ fnIsCheckLogin: R,
1592
+ isLoginGoogle: I,
1593
+ submitLogin: j,
1594
+ infoUser: G,
1595
+ googleClientId: C,
1596
+ isShowPassword: A,
1597
+ fnLoginSSO: Y,
1598
+ extensionEmail: L,
1599
+ handleLoginWidthClever: E,
1600
+ openModalSelectGrade: K,
1601
+ handleRegisterUser: b,
1602
+ handleToggleModelGrade: _,
1603
+ openModalSelectTier: O,
1604
+ handleSelectTier: D,
1605
+ setOpenModalSelectTier: se
1606
+ } = Ia();
1607
+ return Z(() => {
1608
+ o && (document.title = Da), i && (document.title = qa), d && (document.title = Wa);
1609
+ }, [o, i, d]), /* @__PURE__ */ r("div", { className: `${t.login} container-fluid font-family-lato`, children: [
1610
+ /* @__PURE__ */ r(be, { className: "h-100", children: [
1611
+ /* @__PURE__ */ r(
1612
+ ee,
1613
+ {
1614
+ lg: 8,
1615
+ md: 12,
1616
+ xs: 12,
1617
+ className: "d-flex justify-content-center h-100 align-items-center p-3 flex-column",
1618
+ children: [
1619
+ !!v && /* @__PURE__ */ r(
1620
+ Ds,
1621
+ {
1622
+ useRecaptchaNet: !0,
1623
+ reCaptchaKey: v,
1624
+ scriptProps: {
1625
+ async: !0,
1626
+ defer: !0,
1627
+ appendTo: "body"
1628
+ },
1629
+ children: [
1630
+ o && /* @__PURE__ */ e(
1631
+ ta,
1632
+ {
1633
+ userLogin: p,
1634
+ defaultInfo: u,
1635
+ onCancelModelAssign: w,
1636
+ openModelAssign: x,
1637
+ school: k,
1638
+ fnIsCheckLogin: R,
1639
+ googleClientId: C,
1640
+ infoUser: G,
1641
+ isLoginGoogle: I,
1642
+ isShowPassword: A,
1643
+ setIsShowPassword: S,
1644
+ submitLogin: j,
1645
+ fnLoginSSO: Y,
1646
+ extensionEmail: L,
1647
+ onLoginWidthClever: E,
1648
+ openModalSelectGrade: K,
1649
+ handleRegisterUser: b,
1650
+ onToggleModelGrade: _
1651
+ }
1652
+ ),
1653
+ i && /* @__PURE__ */ e(ca, { school: k })
1654
+ ]
1655
+ }
1656
+ ),
1657
+ d && /* @__PURE__ */ e(ma, {}),
1658
+ m && /* @__PURE__ */ e(Ca, {}),
1659
+ /* @__PURE__ */ e(
1660
+ "a",
1661
+ {
1662
+ href: "/privacy-policy/",
1663
+ target: "blank",
1664
+ className: `${t["privacy-policy"]}`,
1665
+ children: "Privacy Policy"
1666
+ }
1667
+ )
1668
+ ]
1669
+ }
1670
+ ),
1671
+ /* @__PURE__ */ e(
1672
+ ee,
1673
+ {
1674
+ className: "p-3 mh-100 d-flex justify-content-end",
1675
+ lg: 4,
1676
+ md: 12,
1677
+ xs: 12,
1678
+ children: /* @__PURE__ */ e(
1679
+ "img",
1680
+ {
1681
+ src: `${ge(window.innerWidth > 992 ? "/images/img-login.png" : "/images/img-login-tablet.png")}`,
1682
+ className: `${t["img-login"]}`
1683
+ }
1684
+ )
1685
+ }
1686
+ )
1687
+ ] }),
1688
+ /* @__PURE__ */ e(
1689
+ Ha,
1690
+ {
1691
+ open: O,
1692
+ onSelectTier: D,
1693
+ onClose: () => se(!1)
1694
+ }
1695
+ )
1696
+ ] });
1697
+ };
1698
+ export {
1699
+ it as default
1700
+ };