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