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,170 @@
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
+ import { Row as f, Col as c, Table as L } from "reactstrap";
3
+ import { O as D, b as g, P as I, Q as A, c as y, R, S as w, T as x, U as P, V as k, W as M, X as j } from "./index-CfBp3NrB.mjs";
4
+ import { format as S } from "date-fns";
5
+ import { useCallback as T, useEffect as N } from "react";
6
+ import { useSelector as _, useDispatch as U } from "react-redux";
7
+ import { useNavigate as z } from "react-router-dom";
8
+ import { g as B, a as F, r as $ } from "./mailCategoryService-CRdM3FRx.mjs";
9
+ import { useTranslation as E } from "react-i18next";
10
+ const O = "/admin/email-template", Q = "/admin/create-email-template", V = "Email template list", W = () => {
11
+ const n = z(), { t: o } = E(), u = _(
12
+ (s) => s.emailTemplate.emailTemplateList
13
+ ), d = _(
14
+ (s) => s.emailTemplate.totalItems
15
+ ), r = _(
16
+ (s) => s.mailCategory.mailCategoryList
17
+ ), { filters: i, changeFilters: h } = D(), t = U(), p = T(async () => {
18
+ t(g(!0));
19
+ try {
20
+ const s = await B(i), { items: m, totalItems: C } = s.data;
21
+ if (t(
22
+ I({ emailTemplateList: m, totalItems: C })
23
+ ), r && r.length == 0) {
24
+ const v = await F();
25
+ t(A(v.data.items));
26
+ }
27
+ } catch (s) {
28
+ t(
29
+ y({
30
+ type: "danger",
31
+ message: s.response?.data?.title || s.message
32
+ })
33
+ );
34
+ }
35
+ t(g(!1));
36
+ }, [t, i]), a = T(
37
+ (s) => {
38
+ t(g(!0));
39
+ try {
40
+ t(
41
+ R({
42
+ isOpen: !0,
43
+ type: "warning",
44
+ message: o("do_you_want_to_remove_this_email_template"),
45
+ onConfirm: async () => {
46
+ await $(s), t(
47
+ y({
48
+ type: "success",
49
+ message: "Remove template successfully"
50
+ })
51
+ ), h({ currentPage: 1 });
52
+ }
53
+ })
54
+ );
55
+ } catch (m) {
56
+ t(
57
+ y({
58
+ type: "danger",
59
+ message: m.response?.data?.title || m.message
60
+ })
61
+ );
62
+ }
63
+ t(g(!1));
64
+ },
65
+ [i]
66
+ ), b = T((s) => {
67
+ const m = s ? `${O}/${s}` : Q;
68
+ n(m);
69
+ }, []);
70
+ return N(() => {
71
+ document.title = V;
72
+ }, []), N(() => {
73
+ p();
74
+ }, [i]), {
75
+ emailTemplateList: u,
76
+ totalItems: d,
77
+ filters: i,
78
+ changeFilters: h,
79
+ getData: p,
80
+ removeData: a,
81
+ goToDetail: b,
82
+ mailCategoryList: r
83
+ };
84
+ }, X = "email_template", ae = () => {
85
+ const {
86
+ emailTemplateList: n,
87
+ totalItems: o,
88
+ filters: u,
89
+ changeFilters: d,
90
+ removeData: r,
91
+ goToDetail: i,
92
+ mailCategoryList: h
93
+ } = W(), { t } = E(), p = (a) => {
94
+ r(a);
95
+ };
96
+ return /* @__PURE__ */ l("div", { className: "fadeIn animated", children: [
97
+ /* @__PURE__ */ e("h5", { className: "mb-2", children: t(X) }),
98
+ /* @__PURE__ */ l(f, { className: "my-2", children: [
99
+ /* @__PURE__ */ e(c, { md: 4, children: /* @__PURE__ */ e(
100
+ w,
101
+ {
102
+ text: t("create_template"),
103
+ onClick: () => i()
104
+ }
105
+ ) }),
106
+ /* @__PURE__ */ l(
107
+ c,
108
+ {
109
+ md: 4,
110
+ className: "d-flex align-items-center justify-content-end",
111
+ children: [
112
+ t("total_of_templates"),
113
+ ": ",
114
+ o
115
+ ]
116
+ }
117
+ )
118
+ ] }),
119
+ /* @__PURE__ */ l(f, { className: "mb-2", children: [
120
+ /* @__PURE__ */ l(c, { md: 8, children: [
121
+ n && n.length > 0 ? /* @__PURE__ */ l(L, { bordered: !0, hover: !0, striped: !0, responsive: !0, size: "sm", children: [
122
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ l("tr", { children: [
123
+ /* @__PURE__ */ e("th", { className: "align-top", children: t("template_name") }),
124
+ /* @__PURE__ */ e("th", { className: "align-top", children: t("category_name") }),
125
+ /* @__PURE__ */ e("th", { className: "align-top", children: t("created_date") }),
126
+ /* @__PURE__ */ e("th", { className: "align-top", children: t("status") }),
127
+ /* @__PURE__ */ e("th", { className: "text-center", children: t("action") })
128
+ ] }) }),
129
+ /* @__PURE__ */ e("tbody", { children: n.map((a) => /* @__PURE__ */ l("tr", { children: [
130
+ /* @__PURE__ */ e("td", { className: "align-middle", children: /* @__PURE__ */ e(
131
+ x,
132
+ {
133
+ label: a.subject,
134
+ onClick: () => i(a.id)
135
+ }
136
+ ) }),
137
+ /* @__PURE__ */ e("td", { className: "align-middle", children: a.category.name }),
138
+ /* @__PURE__ */ e("td", { className: "align-middle", children: S(
139
+ new Date(a.createdAt),
140
+ P
141
+ ) }),
142
+ /* @__PURE__ */ e("td", { className: "align-middle", children: a.isDisabled ? t("disabled") : t("enabled") }),
143
+ /* @__PURE__ */ e("td", { className: "text-center align-middle", children: /* @__PURE__ */ e(
144
+ k,
145
+ {
146
+ onClick: () => p(a.id)
147
+ }
148
+ ) })
149
+ ] }, a.id)) })
150
+ ] }) : /* @__PURE__ */ e(M, { label: t("template") }),
151
+ /* @__PURE__ */ e(f, { className: "mt-2", children: /* @__PURE__ */ e(c, { md: 12, children: /* @__PURE__ */ e(
152
+ j,
153
+ {
154
+ filters: u,
155
+ totalRecordCount: o,
156
+ changePageSize: (a) => d({ pageSize: a }),
157
+ changePage: (a) => d({ currentPage: a })
158
+ }
159
+ ) }) })
160
+ ] }),
161
+ /* @__PURE__ */ e(c, { md: 4, children: /* @__PURE__ */ l(L, { bordered: !0, hover: !0, striped: !0, responsive: !0, size: "sm", children: [
162
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("th", { className: "align-top", children: t("category_name") }) }) }),
163
+ /* @__PURE__ */ e("tbody", { children: h.map((a) => /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { className: "align-middle", children: a.name }) }, a.id)) })
164
+ ] }) })
165
+ ] })
166
+ ] });
167
+ };
168
+ export {
169
+ ae as default
170
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("reactstrap"),a=require("./index-CD8bO3wO.js"),_=require("date-fns"),m=require("react"),x=require("react-redux"),b=require("react-router-dom"),j=require("./mailCategoryService-C9FSK6lv.js"),y=require("react-i18next"),N="/admin/email-template",f="/admin/create-email-template",E="Email template list",v=()=>{const c=b.useNavigate(),{t:d}=y.useTranslation(),p=x.useSelector(l=>l.emailTemplate.emailTemplateList),u=x.useSelector(l=>l.emailTemplate.totalItems),o=x.useSelector(l=>l.mailCategory.mailCategoryList),{filters:n,changeFilters:h}=a.useFilters(),t=x.useDispatch(),g=m.useCallback(async()=>{t(a.setLoading(!0));try{const l=await j.get(n),{items:r,totalItems:L}=l.data;if(t(a.setEmailTemplateList({emailTemplateList:r,totalItems:L})),o&&o.length==0){const C=await j.get$1();t(a.setMailCategory(C.data.items))}}catch(l){t(a.setAlert({type:"danger",message:l.response?.data?.title||l.message}))}t(a.setLoading(!1))},[t,n]),s=m.useCallback(l=>{t(a.setLoading(!0));try{t(a.setModal({isOpen:!0,type:"warning",message:d("do_you_want_to_remove_this_email_template"),onConfirm:async()=>{await j.remove(l),t(a.setAlert({type:"success",message:"Remove template successfully"})),h({currentPage:1})}}))}catch(r){t(a.setAlert({type:"danger",message:r.response?.data?.title||r.message}))}t(a.setLoading(!1))},[n]),T=m.useCallback(l=>{const r=l?`${N}/${l}`:f;c(r)},[]);return m.useEffect(()=>{document.title=E},[]),m.useEffect(()=>{g()},[n]),{emailTemplateList:p,totalItems:u,filters:n,changeFilters:h,getData:g,removeData:s,goToDetail:T,mailCategoryList:o}},R="email_template",D=()=>{const{emailTemplateList:c,totalItems:d,filters:p,changeFilters:u,removeData:o,goToDetail:n,mailCategoryList:h}=v(),{t}=y.useTranslation(),g=s=>{o(s)};return e.jsxs("div",{className:"fadeIn animated",children:[e.jsx("h5",{className:"mb-2",children:t(R)}),e.jsxs(i.Row,{className:"my-2",children:[e.jsx(i.Col,{md:4,children:e.jsx(a.AddButton,{text:t("create_template"),onClick:()=>n()})}),e.jsxs(i.Col,{md:4,className:"d-flex align-items-center justify-content-end",children:[t("total_of_templates"),": ",d]})]}),e.jsxs(i.Row,{className:"mb-2",children:[e.jsxs(i.Col,{md:8,children:[c&&c.length>0?e.jsxs(i.Table,{bordered:!0,hover:!0,striped:!0,responsive:!0,size:"sm",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"align-top",children:t("template_name")}),e.jsx("th",{className:"align-top",children:t("category_name")}),e.jsx("th",{className:"align-top",children:t("created_date")}),e.jsx("th",{className:"align-top",children:t("status")}),e.jsx("th",{className:"text-center",children:t("action")})]})}),e.jsx("tbody",{children:c.map(s=>e.jsxs("tr",{children:[e.jsx("td",{className:"align-middle",children:e.jsx(a.LinkEditButton,{label:s.subject,onClick:()=>n(s.id)})}),e.jsx("td",{className:"align-middle",children:s.category.name}),e.jsx("td",{className:"align-middle",children:_.format(new Date(s.createdAt),a.DATE_RESULT)}),e.jsx("td",{className:"align-middle",children:s.isDisabled?t("disabled"):t("enabled")}),e.jsx("td",{className:"text-center align-middle",children:e.jsx(a.DeleteButtonIcon,{onClick:()=>g(s.id)})})]},s.id))})]}):e.jsx(a.EmptyDataAlert,{label:t("template")}),e.jsx(i.Row,{className:"mt-2",children:e.jsx(i.Col,{md:12,children:e.jsx(a.CustomPagination,{filters:p,totalRecordCount:d,changePageSize:s=>u({pageSize:s}),changePage:s=>u({currentPage:s})})})})]}),e.jsx(i.Col,{md:4,children:e.jsxs(i.Table,{bordered:!0,hover:!0,striped:!0,responsive:!0,size:"sm",children:[e.jsx("thead",{children:e.jsx("tr",{children:e.jsx("th",{className:"align-top",children:t("category_name")})})}),e.jsx("tbody",{children:h.map(s=>e.jsx("tr",{children:e.jsx("td",{className:"align-middle",children:s.name})},s.id))})]})})]})]})};exports.default=D;
@@ -0,0 +1,329 @@
1
+ import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
+ import { Row as F, Col as u, Input as $, Button as y, Label as g, Card as x, CardImg as S, CardBody as w, CardTitle as M, CardHeader as B, CardText as j } from "reactstrap";
3
+ import { useSelector as H } from "react-redux";
4
+ import { forwardRef as K, memo as v, useRef as U, useState as q } from "react";
5
+ import { a3 as L, E as W, aE as z, aF as P, aG as T, aH as J, aI as Q, aJ as X, aK as C, h as Y, a5 as Z, a2 as ee, aL as le, m as ae } from "./index-CfBp3NrB.mjs";
6
+ import { Formik as ne } from "formik";
7
+ import * as b from "yup";
8
+ import { useTranslation as A } from "react-i18next";
9
+ const re = b.object({
10
+ name: b.string().required("Name is required")
11
+ }), se = (l, n) => {
12
+ const { targetMedia: r, onConfirm: t } = l, a = r?.key ? "Update" : "Create", d = r?.key ? "Rename" : "Folder";
13
+ return /* @__PURE__ */ e(
14
+ ne,
15
+ {
16
+ initialValues: { name: r?.name },
17
+ enableReinitialize: !0,
18
+ validationSchema: re,
19
+ onSubmit: (o, m) => {
20
+ t && t(o), m.resetForm();
21
+ },
22
+ children: (o) => {
23
+ const {
24
+ values: m,
25
+ touched: I,
26
+ errors: p,
27
+ handleChange: D,
28
+ handleBlur: O,
29
+ handleSubmit: f
30
+ } = o;
31
+ return /* @__PURE__ */ e(
32
+ L,
33
+ {
34
+ header: d,
35
+ confirmText: a,
36
+ onConfirm: f,
37
+ ref: n,
38
+ children: /* @__PURE__ */ e(F, { children: /* @__PURE__ */ s(u, { md: 12, children: [
39
+ /* @__PURE__ */ e(
40
+ $,
41
+ {
42
+ name: "name",
43
+ placeholder: `Enter your ${r?.key ? "file" : "folder"} name`,
44
+ value: m.name,
45
+ onChange: D,
46
+ onBlur: O("question")
47
+ }
48
+ ),
49
+ I.name && p.name && /* @__PURE__ */ e(
50
+ W,
51
+ {
52
+ text: p.name
53
+ }
54
+ )
55
+ ] }) })
56
+ }
57
+ );
58
+ }
59
+ }
60
+ );
61
+ }, ie = K(se), te = ({
62
+ isLibrary: l,
63
+ step: n,
64
+ breadcumb: r,
65
+ currentPrefix: t,
66
+ targetMedia: a,
67
+ handleSelectFile: d,
68
+ handleCreateFolder: o,
69
+ handleRenameFile: m,
70
+ handleGoBack: I,
71
+ handleDownloadMedia: p,
72
+ handleDeleteMediaOrFolder: D,
73
+ showErrorAlert: O
74
+ }) => {
75
+ const f = U(null), k = U(null), { t: E } = A(), N = () => f?.current?.toggle();
76
+ return /* @__PURE__ */ s("div", { children: [
77
+ /* @__PURE__ */ s(F, { className: "p-2 pl-3", style: { gap: "8px" }, children: [
78
+ !!n && /* @__PURE__ */ s(
79
+ y,
80
+ {
81
+ className: "mr-2",
82
+ color: "secondary",
83
+ onClick: I,
84
+ style: { width: "auto", display: "flex", gap: "4px" },
85
+ children: [
86
+ /* @__PURE__ */ e(z, {}),
87
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Go up" })
88
+ ]
89
+ }
90
+ ),
91
+ a && !a.isFolder && /* @__PURE__ */ s(
92
+ y,
93
+ {
94
+ className: "mr-2",
95
+ color: "success",
96
+ onClick: p,
97
+ style: { width: "auto", display: "flex", gap: "4px" },
98
+ children: [
99
+ /* @__PURE__ */ e(P, {}),
100
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Download" })
101
+ ]
102
+ }
103
+ ),
104
+ a && !l && /* @__PURE__ */ s(
105
+ y,
106
+ {
107
+ className: "mr-2",
108
+ color: "danger",
109
+ onClick: D,
110
+ style: { width: "auto", display: "flex", gap: "4px" },
111
+ children: [
112
+ /* @__PURE__ */ e(T, {}),
113
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Delete" })
114
+ ]
115
+ }
116
+ ),
117
+ a && !l && !a.isFolder && /* @__PURE__ */ s(y, { className: "mr-2", color: "primary", onClick: N, style: { width: "auto", display: "flex", gap: "4px" }, children: [
118
+ /* @__PURE__ */ e(J, {}),
119
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: "Rename" })
120
+ ] }),
121
+ !a && !l && /* @__PURE__ */ s(y, { className: "mr-2", color: "success", onClick: N, style: { width: "auto", display: "flex", gap: "4px" }, children: [
122
+ /* @__PURE__ */ e(Q, {}),
123
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: E("new_folder") })
124
+ ] }),
125
+ !a && !l && /* @__PURE__ */ s(
126
+ y,
127
+ {
128
+ className: "mr-2",
129
+ color: "info",
130
+ onClick: () => k?.current?.click(),
131
+ style: { width: "auto", display: "flex", gap: "4px" },
132
+ children: [
133
+ /* @__PURE__ */ e(X, {}),
134
+ /* @__PURE__ */ e(g, { className: "ml-1 h6 m-0", children: E("upload") })
135
+ ]
136
+ }
137
+ ),
138
+ r && /* @__PURE__ */ e(u, { className: "h-100 d-flex align-items-center", children: r })
139
+ ] }),
140
+ /* @__PURE__ */ e(
141
+ ie,
142
+ {
143
+ ref: f,
144
+ targetMedia: a,
145
+ onConfirm: async (h) => {
146
+ h.name != "" ? a && !a.isFolder ? (N(), await m(h.name)) : (N(), await o(t, h.name)) : O("Name can't be empty");
147
+ }
148
+ }
149
+ ),
150
+ /* @__PURE__ */ e(
151
+ "input",
152
+ {
153
+ type: "file",
154
+ id: "customMediaUpload",
155
+ ref: k,
156
+ style: { display: "none" },
157
+ onChange: async (h) => {
158
+ const c = h?.target?.files[0];
159
+ c && await d({ key: t, file: c });
160
+ }
161
+ }
162
+ )
163
+ ] });
164
+ }, oe = v(te), _ = {
165
+ "media-wrapper": "_media-wrapper_1nc2k_6",
166
+ "media-image": "_media-image_1nc2k_11",
167
+ "media-image-selected": "_media-image-selected_1nc2k_17",
168
+ "media-title": "_media-title_1nc2k_21",
169
+ "filter-media-file": "_filter-media-file_1nc2k_30"
170
+ };
171
+ var i = /* @__PURE__ */ ((l) => (l[l.IMAGE = 0] = "IMAGE", l[l.VIDEO = 1] = "VIDEO", l[l.AUDIO = 2] = "AUDIO", l[l.DOC = 3] = "DOC", l[l.UNKNOW = 4] = "UNKNOW", l))(i || {});
172
+ const ce = ["png", "jpg", "jpeg", "gif"], de = ["mp4", "mp4v"], me = ["txt", "pdf", "doc", "docx", "xls", "csv"], he = ["wav", "mp3"], V = (l) => {
173
+ if (l) {
174
+ if (ce.includes(l)) return i.IMAGE;
175
+ if (de.includes(l)) return i.VIDEO;
176
+ if (me.includes(l)) return i.DOC;
177
+ if (he.includes(l)) return i.AUDIO;
178
+ }
179
+ return i.UNKNOW;
180
+ }, ue = (l) => {
181
+ if (l.isFolder) return C.FOLDER_IMAGE;
182
+ const n = V(l.extension);
183
+ return n === i.IMAGE ? C.PHOTO_IMAGE : n === i.VIDEO ? C.VIDEO_IMAGE : n === i.AUDIO ? C.AUDIO_IMAGE : n === i.DOC ? C.DOCS_IMAGE : C.UNKNOW_IMAGE;
184
+ }, pe = ({ media: l, isTarget: n }) => {
185
+ const r = ue(l);
186
+ return /* @__PURE__ */ s(x, { className: `${n ? _["media-image-selected"] : ""} border-0 `, children: [
187
+ /* @__PURE__ */ e(
188
+ S,
189
+ {
190
+ className: `${_["media-image"]} p-1`,
191
+ top: !0,
192
+ width: "90%",
193
+ src: Y(r),
194
+ alt: l.name
195
+ }
196
+ ),
197
+ /* @__PURE__ */ e(w, { className: "p-1", style: { height: 45 }, children: /* @__PURE__ */ e(M, { tag: "h6", className: _["media-title"], children: l.name }) })
198
+ ] });
199
+ }, fe = v(pe), Ne = [
200
+ { value: i.IMAGE, label: "images" },
201
+ { value: i.AUDIO, label: "audios" },
202
+ { value: i.DOC, label: "docs" },
203
+ { value: i.VIDEO, label: "videos" }
204
+ ], ye = ({
205
+ changeFilters: l
206
+ // filters
207
+ }) => {
208
+ const [n, r] = q(), { t } = A();
209
+ return /* @__PURE__ */ s(F, { className: `${_["filter-media-file"]}`, children: [
210
+ /* @__PURE__ */ e(u, { sm: 8, children: /* @__PURE__ */ e(
211
+ Z,
212
+ {
213
+ initValue: "",
214
+ onSearch: (a) => l({
215
+ searchString: a
216
+ }),
217
+ placeholder: t("type_something_to_search_by_file_name")
218
+ }
219
+ ) }),
220
+ /* @__PURE__ */ e(u, { sm: 4, children: /* @__PURE__ */ e(
221
+ ee,
222
+ {
223
+ value: n,
224
+ isMulti: !0,
225
+ options: Ne.map((a) => ({ ...a, label: t(a.label) })),
226
+ onChange: (a) => {
227
+ r(a);
228
+ const d = a.map((o) => o.value);
229
+ l({ types: d });
230
+ }
231
+ }
232
+ ) })
233
+ ] });
234
+ }, ge = ({ height: l, isLibrary: n }) => {
235
+ const {
236
+ filters: r,
237
+ mediaList: t,
238
+ targetMedia: a,
239
+ router: d,
240
+ breadcrumb: o,
241
+ changeFilters: m,
242
+ handleOpenFolder: I,
243
+ handleSelectMedia: p,
244
+ handleSelectFile: D,
245
+ handleCreateFolder: O,
246
+ handleRenameFile: f,
247
+ handleDownloadMedia: k,
248
+ handleDeleteMediaOrFolder: E,
249
+ handleGoBack: N,
250
+ showErrorAlert: G
251
+ } = le(n), h = () => t.map((c) => {
252
+ const R = a?.key === c.key;
253
+ return /* @__PURE__ */ e(u, { className: "p-2", xs: "auto", children: /* @__PURE__ */ e(
254
+ "div",
255
+ {
256
+ onDoubleClick: () => I(c),
257
+ onClick: () => p(c),
258
+ className: _["media-wrapper"],
259
+ children: /* @__PURE__ */ e(fe, { media: c, isTarget: R })
260
+ }
261
+ ) }, c.key);
262
+ });
263
+ return /* @__PURE__ */ s(x, { children: [
264
+ /* @__PURE__ */ s(B, { children: [
265
+ /* @__PURE__ */ e(ye, { changeFilters: m, filters: r }),
266
+ /* @__PURE__ */ e(
267
+ oe,
268
+ {
269
+ isLibrary: n,
270
+ step: d.step,
271
+ breadcumb: o,
272
+ currentPrefix: r.prefix || "",
273
+ targetMedia: a,
274
+ handleSelectFile: D,
275
+ handleCreateFolder: O,
276
+ handleRenameFile: f,
277
+ handleDownloadMedia: k,
278
+ handleDeleteMediaOrFolder: E,
279
+ handleGoBack: N,
280
+ showErrorAlert: G
281
+ }
282
+ )
283
+ ] }),
284
+ /* @__PURE__ */ e(w, { style: { minHeight: l }, children: /* @__PURE__ */ e(F, { className: "p-1", children: h() }) })
285
+ ] });
286
+ }, Ce = ({ targetMedia: l }) => {
287
+ if (!l || l?.isFolder) return /* @__PURE__ */ e("div", {});
288
+ const n = V(l.extension), r = ae(l.key || "");
289
+ return /* @__PURE__ */ s(x, { className: "position-sticky", children: [
290
+ /* @__PURE__ */ e(B, { children: l?.name || "Media name" }),
291
+ n === i.IMAGE && /* @__PURE__ */ e(S, { className: "p-2", src: r, loading: "lazy" }),
292
+ n === i.VIDEO && /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e(
293
+ "video",
294
+ {
295
+ id: l.key,
296
+ width: "100%",
297
+ height: "100%",
298
+ controls: !0,
299
+ children: /* @__PURE__ */ e("source", { src: r })
300
+ }
301
+ ) }),
302
+ n === i.AUDIO && /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("audio", { controls: !0, className: "w-100", children: /* @__PURE__ */ e("source", { src: r }) }) }),
303
+ /* @__PURE__ */ s(w, { children: [
304
+ /* @__PURE__ */ e(M, { tag: "h6", children: "General Info" }),
305
+ /* @__PURE__ */ s(j, { children: [
306
+ "File extension: ",
307
+ l.extension?.toUpperCase()
308
+ ] })
309
+ ] })
310
+ ] });
311
+ }, Ie = v(Ce), De = "media_gallery", ve = ({ isLibrary: l }) => {
312
+ const n = H((t) => t.gallery.targetMedia), { t: r } = A();
313
+ return /* @__PURE__ */ s("div", { className: "fadeIn animated", children: [
314
+ !l && /* @__PURE__ */ e("h5", { className: "mb-2", children: r(De) }),
315
+ /* @__PURE__ */ s(F, { className: "mb-2", children: [
316
+ /* @__PURE__ */ e(u, { md: 8, children: /* @__PURE__ */ e(ge, { height: "100vh", isLibrary: l }) }),
317
+ /* @__PURE__ */ e(u, { md: 4, children: /* @__PURE__ */ e(
318
+ Ie,
319
+ {
320
+ targetMedia: n
321
+ },
322
+ n?.key
323
+ ) })
324
+ ] })
325
+ ] });
326
+ };
327
+ export {
328
+ ve as default
329
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("reactstrap"),F=require("react-redux"),x=require("react"),t=require("./index-CD8bO3wO.js"),v=require("formik"),E=require("yup"),D=require("react-i18next");function A(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const a in s)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(n,a,i.get?i:{enumerable:!0,get:()=>s[a]})}}return n.default=s,Object.freeze(n)}const b=A(E),G=b.object({name:b.string().required("Name is required")}),U=(s,n)=>{const{targetMedia:a,onConfirm:i}=s,r=a?.key?"Update":"Create",m=a?.key?"Rename":"Folder";return e.jsx(v.Formik,{initialValues:{name:a?.name},enableReinitialize:!0,validationSchema:G,onSubmit:(c,u)=>{i&&i(c),u.resetForm()},children:c=>{const{values:u,touched:g,errors:p,handleChange:y,handleBlur:C,handleSubmit:j}=c;return e.jsx(t.CommonModal,{header:m,confirmText:r,onConfirm:j,ref:n,children:e.jsx(l.Row,{children:e.jsxs(l.Col,{md:12,children:[e.jsx(l.Input,{name:"name",placeholder:`Enter your ${a?.key?"file":"folder"} name`,value:u.name,onChange:y,onBlur:C("question")}),g.name&&p.name&&e.jsx(t.ErrorHandler,{text:p.name})]})})})}})},R=x.forwardRef(U),S=({isLibrary:s,step:n,breadcumb:a,currentPrefix:i,targetMedia:r,handleSelectFile:m,handleCreateFolder:c,handleRenameFile:u,handleGoBack:g,handleDownloadMedia:p,handleDeleteMediaOrFolder:y,showErrorAlert:C})=>{const j=x.useRef(null),I=x.useRef(null),{t:O}=D.useTranslation(),f=()=>j?.current?.toggle(),_=()=>e.jsxs(l.Row,{className:"p-2 pl-3",style:{gap:"8px"},children:[!!n&&e.jsxs(l.Button,{className:"mr-2",color:"secondary",onClick:g,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaArrowLeft,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Go up"})]}),r&&!r.isFolder&&e.jsxs(l.Button,{className:"mr-2",color:"success",onClick:p,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaDownload,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Download"})]}),r&&!s&&e.jsxs(l.Button,{className:"mr-2",color:"danger",onClick:y,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaTrash,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Delete"})]}),r&&!s&&!r.isFolder&&e.jsxs(l.Button,{className:"mr-2",color:"primary",onClick:f,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaEdit,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:"Rename"})]}),!r&&!s&&e.jsxs(l.Button,{className:"mr-2",color:"success",onClick:f,style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaFolderPlus,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:O("new_folder")})]}),!r&&!s&&e.jsxs(l.Button,{className:"mr-2",color:"info",onClick:()=>I?.current?.click(),style:{width:"auto",display:"flex",gap:"4px"},children:[e.jsx(t.FaFileUpload,{}),e.jsx(l.Label,{className:"ml-1 h6 m-0",children:O("upload")})]}),a&&e.jsx(l.Col,{className:"h-100 d-flex align-items-center",children:a})]});return e.jsxs("div",{children:[_(),e.jsx(R,{ref:j,targetMedia:r,onConfirm:async h=>{h.name!=""?r&&!r.isFolder?(f(),await u(h.name)):(f(),await c(i,h.name)):C("Name can't be empty")}}),e.jsx("input",{type:"file",id:"customMediaUpload",ref:I,style:{display:"none"},onChange:async h=>{const d=h?.target?.files[0];d&&await m({key:i,file:d})}})]})},B=x.memo(S),N={"media-wrapper":"_media-wrapper_1nc2k_6","media-image":"_media-image_1nc2k_11","media-image-selected":"_media-image-selected_1nc2k_17","media-title":"_media-title_1nc2k_21","filter-media-file":"_filter-media-file_1nc2k_30"};var o=(s=>(s[s.IMAGE=0]="IMAGE",s[s.VIDEO=1]="VIDEO",s[s.AUDIO=2]="AUDIO",s[s.DOC=3]="DOC",s[s.UNKNOW=4]="UNKNOW",s))(o||{});const q=["png","jpg","jpeg","gif"],M=["mp4","mp4v"],V=["txt","pdf","doc","docx","xls","csv"],L=["wav","mp3"],k=s=>{if(s){if(q.includes(s))return o.IMAGE;if(M.includes(s))return o.VIDEO;if(V.includes(s))return o.DOC;if(L.includes(s))return o.AUDIO}return o.UNKNOW},$=s=>{if(s.isFolder)return t.Images.FOLDER_IMAGE;const n=k(s.extension);return n===o.IMAGE?t.Images.PHOTO_IMAGE:n===o.VIDEO?t.Images.VIDEO_IMAGE:n===o.AUDIO?t.Images.AUDIO_IMAGE:n===o.DOC?t.Images.DOCS_IMAGE:t.Images.UNKNOW_IMAGE},T=({media:s,isTarget:n})=>{const a=$(s);return e.jsxs(l.Card,{className:`${n?N["media-image-selected"]:""} border-0 `,children:[e.jsx(l.CardImg,{className:`${N["media-image"]} p-1`,top:!0,width:"90%",src:t.getStaticFileUrl(a),alt:s.name}),e.jsx(l.CardBody,{className:"p-1",style:{height:45},children:e.jsx(l.CardTitle,{tag:"h6",className:N["media-title"],children:s.name})})]})},H=x.memo(T),P=[{value:o.IMAGE,label:"images"},{value:o.AUDIO,label:"audios"},{value:o.DOC,label:"docs"},{value:o.VIDEO,label:"videos"}],K=({changeFilters:s})=>{const[n,a]=x.useState(),{t:i}=D.useTranslation();return e.jsxs(l.Row,{className:`${N["filter-media-file"]}`,children:[e.jsx(l.Col,{sm:8,children:e.jsx(t.SearchBox,{initValue:"",onSearch:r=>s({searchString:r}),placeholder:i("type_something_to_search_by_file_name")})}),e.jsx(l.Col,{sm:4,children:e.jsx(t.CustomSelector,{value:n,isMulti:!0,options:P.map(r=>({...r,label:i(r.label)})),onChange:r=>{a(r);const m=r.map(c=>c.value);s({types:m})}})})]})},W=({height:s,isLibrary:n})=>{const{filters:a,mediaList:i,targetMedia:r,router:m,breadcrumb:c,changeFilters:u,handleOpenFolder:g,handleSelectMedia:p,handleSelectFile:y,handleCreateFolder:C,handleRenameFile:j,handleDownloadMedia:I,handleDeleteMediaOrFolder:O,handleGoBack:f,showErrorAlert:_}=t.useGalleryList(n),h=()=>i.map(d=>{const w=r?.key===d.key;return e.jsx(l.Col,{className:"p-2",xs:"auto",children:e.jsx("div",{onDoubleClick:()=>g(d),onClick:()=>p(d),className:N["media-wrapper"],children:e.jsx(H,{media:d,isTarget:w})})},d.key)});return e.jsxs(l.Card,{children:[e.jsxs(l.CardHeader,{children:[e.jsx(K,{changeFilters:u,filters:a}),e.jsx(B,{isLibrary:n,step:m.step,breadcumb:c,currentPrefix:a.prefix||"",targetMedia:r,handleSelectFile:y,handleCreateFolder:C,handleRenameFile:j,handleDownloadMedia:I,handleDeleteMediaOrFolder:O,handleGoBack:f,showErrorAlert:_})]}),e.jsx(l.CardBody,{style:{minHeight:s},children:e.jsx(l.Row,{className:"p-1",children:h()})})]})},z=({targetMedia:s})=>{if(!s||s?.isFolder)return e.jsx("div",{});const n=k(s.extension),a=t.getFileUrl(s.key||"");return e.jsxs(l.Card,{className:"position-sticky",children:[e.jsx(l.CardHeader,{children:s?.name||"Media name"}),n===o.IMAGE&&e.jsx(l.CardImg,{className:"p-2",src:a,loading:"lazy"}),n===o.VIDEO&&e.jsx("div",{className:"p-2",children:e.jsx("video",{id:s.key,width:"100%",height:"100%",controls:!0,children:e.jsx("source",{src:a})})}),n===o.AUDIO&&e.jsx("div",{className:"p-2",children:e.jsx("audio",{controls:!0,className:"w-100",children:e.jsx("source",{src:a})})}),e.jsxs(l.CardBody,{children:[e.jsx(l.CardTitle,{tag:"h6",children:"General Info"}),e.jsxs(l.CardText,{children:["File extension: ",s.extension?.toUpperCase()]})]})]})},Q=x.memo(z),J="media_gallery",X=({isLibrary:s})=>{const n=F.useSelector(i=>i.gallery.targetMedia),{t:a}=D.useTranslation();return e.jsxs("div",{className:"fadeIn animated",children:[!s&&e.jsx("h5",{className:"mb-2",children:a(J)}),e.jsxs(l.Row,{className:"mb-2",children:[e.jsx(l.Col,{md:8,children:e.jsx(W,{height:"100vh",isLibrary:s})}),e.jsx(l.Col,{md:4,children:e.jsx(Q,{targetMedia:n},n?.key)})]})]})};exports.default=X;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("react"),g=require("reactstrap"),te=require("react-router-dom"),e=require("./index-CD8bO3wO.js"),Q=require("react-redux"),ue=require("formik"),He=require("yup"),le=require("react-google-recaptcha-v3"),Ie=require("@react-oauth/google"),se=require("./types-CTFcZUFS.js"),ve=require("./constants-DSNqVx4Y.js");require("papaparse");const ne=require("@azure/msal-browser"),Ve=require("@amplitude/analytics-browser");function Te(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,l.get?l:{enumerable:!0,get:()=>t[n]})}}return r.default=t,Object.freeze(r)}const M=Te(He),re=Te(Ve),We={backgroundColor:"#f7f9fc",borderRadius:"4px",marginBottom:"5px",position:"relative"},Ke={backgroundColor:"#ffffff",paddingRight:"50px",color:"#333333",caretColor:"#333333"},Ye={fontSize:"20px",position:"absolute",right:"10px",color:"#316CD9"},Je=t=>t.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(r,n)=>n.toUpperCase()),ie=({isShowPassword:t,togglePasswordVisible:r,onChange:n,placeholder:l})=>s.jsxs("div",{className:"d-flex align-items-center w-100",style:We,children:[s.jsx(g.Input,{className:"border password-input",style:Ke,type:t?"text":"password",name:"password",onChange:n,placeholder:l||"Password",autocomplete:l?Je(l):"password",required:!0}),s.jsx("i",{className:`far ${t?"fa-eye-slash":"fa-eye"} mx-2 cursor-pointer`,style:Ye,onClick:()=>r(),title:t?"Hide":"Show"})]}),Ze=({open:t,onConfirm:r,onClose:n,clickHandler:l})=>{const{getLabel:m,system:h}=e.useGradeLabel(),[p,y]=o.useState(ve.GRADE_DEFAULT[0].value);return s.jsxs(g.Modal,{isOpen:t,className:`${e.styles["teacher-code"]}`,style:{zIndex:1201},centered:!0,autoFocus:!1,returnFocusAfterClose:!1,children:[s.jsxs("div",{className:`${e.styles["header-teacher-code"]}`,children:[s.jsx("div",{style:{padding:"16px 24px",margin:0,fontWeight:500,fontSize:"1.25rem"},children:h==="UK"?"Select Year":"Select Grade"}),s.jsx("div",{hidden:!n,children:s.jsx(e.MdClose,{onClick:()=>n?.(),className:`${e.styles["close-icon"]}`,size:24,style:{color:"rgba(0, 0, 0, 0.54)"}})})]}),s.jsxs(g.ModalBody,{style:{padding:"20px 24px"},children:[s.jsx("p",{className:`${e.styles["teacher-code-label"]}`,style:{margin:0,marginBottom:"16px",color:"rgba(0, 0, 0, 0.6)"},children:h==="UK"?"You are logging in as a student, please select your year":"You are logging in as a student, please select your grade"}),s.jsxs("div",{className:"form-floating",style:{marginTop:"16px",marginBottom:"8px"},children:[s.jsx(g.Input,{type:"select",id:"floatingSelectGrade",value:p,onChange:x=>y(x.target.value),children:ve.GRADE_DEFAULT.map(x=>s.jsx("option",{value:x.value,children:m(x.value)||x.label},x.value))}),s.jsx("label",{htmlFor:"floatingSelectGrade",children:h==="UK"?"Select year":"Select grade"})]})]}),s.jsx(g.ModalFooter,{style:{borderTop:"none",padding:"8px 24px"},children:s.jsx(g.Button,{disabled:!p,style:{borderRadius:20,background:"#316cd9",border:"none",opacity:p?1:.65},color:"primary",onClick:()=>r(p,l),children:"Confirm"})})]})};function Qe(t,r){return JSON.stringify(t)===JSON.stringify(r)}const Xe=o.memo(Ze,Qe),es=M.object({email:M.string().email("Email is invalid").required("Email is required"),password:M.string().required("Password is required"),rememberMe:M.boolean()}),ss=({onSuccess:t,onError:r})=>{const n=Ie.useGoogleLogin({onSuccess:async l=>{try{const m=await fetch("https://www.googleapis.com/oauth2/v3/userinfo",{headers:{Authorization:`Bearer ${l.access_token}`}}).then(p=>p.json()),h={accessToken:l.access_token,googleId:m.sub,profileObj:{email:m.email,familyName:m.family_name,givenName:m.given_name,imageUrl:m.picture,name:m.name}};t(h)}catch(m){r(m)}},onError:l=>r(l)});return s.jsxs("div",{className:e.styles["btn-login-with-sso"],onClick:()=>n(),children:[s.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",width:"24px",height:"24px",style:{marginRight:"8px"},children:[s.jsx("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"}),s.jsx("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"}),s.jsx("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"}),s.jsx("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"}),s.jsx("path",{fill:"none",d:"M0 0h48v48H0z"})]}),s.jsx("p",{children:"GOOGLE"})]})},ts=({defaultInfo:t,userLogin:r,school:n,isShowPassword:l,setIsShowPassword:m,fnIsCheckLogin:h,googleClientId:p,fnLoginSSO:y,extensionEmail:x,onLoginWidthClever:C,openModalSelectGrade:b,handleRegisterUser:S,onToggleModelGrade:k})=>{const N=()=>m(!l),D=Q.useDispatch(),{executeRecaptcha:P}=le.useGoogleReCaptcha(),v=o.useCallback(async()=>{if(!P){console.log("execute recaptcha undefined");return}return await P("login")},[P]),A=async E=>{try{await e.AccountSSOLogApi(E)}catch(L){console.error(L)}},q=async E=>{if(E?.accessToken){let{email:L,familyName:H,givenName:j,imageUrl:I,name:_}=E.profileObj,F=E.accessToken,Y=E.googleId;const J=window.location.hostname.split(".marioforme.com")?.[0],W=L.split("@")?.[1],he=x?.split(",")?.map(U=>U.trim())?.filter(U=>U).some(U=>W.includes(U));if(!W.includes(J)&&!he){alert("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"),await A([`${W} is incorrect`]);return}const ce={firstName:j,lastName:H,imageUrl:I,fullName:_,email:L,accessToken:F,googleId:Y};D(e.setInforUserGoogle(ce)),h(se.TypeLogin.Google,ce,F,v)}};return s.jsxs(o.Fragment,{children:[s.jsx(ue.Formik,{initialValues:t,validationSchema:es,onSubmit:async E=>{try{const L=await v();if(!L)return;E.captcha=L,E.loginType=se.LoginType.Default,r(E)}catch(L){console.error(L)}},children:E=>{const{handleBlur:L,handleSubmit:H,values:j,touched:I,errors:_,setFieldValue:F}=E,Y=I.email&&_.email,ae=I.password&&_.password;return s.jsx("div",{className:`${e.styles["box-login"]} w-100`,children:s.jsx(g.Form,{className:`${e.styles["block-login"]}`,onSubmit:H,children:s.jsxs("div",{className:`${e.styles["block-form"]}`,children:[s.jsxs("div",{className:"d-flex align-items-center mb-4",children:[s.jsx("img",{hidden:!n?.schoolLogo,src:n?.schoolLogo,className:`${e.styles["school-icon"]} mr-3`}),s.jsx("p",{className:`${e.styles["school-name"]} mb-0`,children:n.schoolName})]}),s.jsx("p",{className:`${e.styles["title-login"]}`,children:"Welcome Back!"}),s.jsx("p",{className:`${e.styles["login-description"]} mb-5`,children:"Please enter your MARIO Education account details"}),s.jsxs(g.FormGroup,{className:`${e.styles["form-user-name"]}`,children:[s.jsx(g.Input,{type:"text",name:"email",placeholder:"Email",value:j.email,onChange:J=>F("email",J.target?.value?.trim()||""),autocomplete:"email",onBlur:L("email"),required:!0}),Y&&s.jsx(e.ErrorHandler,{text:_.email})]}),s.jsxs(g.FormGroup,{children:[s.jsx(ie,{isShowPassword:l,togglePasswordVisible:N,onChange:J=>F("password",J.target?.value?.trim()||"")}),ae&&s.jsx(e.ErrorHandler,{text:_.password})]}),s.jsx(g.FormGroup,{}),s.jsxs("div",{className:"d-flex justify-content-between",children:[s.jsxs("div",{className:"d-flex align-items-center",style:{gap:"8px"},children:[s.jsx("input",{type:"checkbox",checked:!j.isSessionUserBrowser,className:`${e.styles["checkbox-keep-login"]}`,onChange:()=>F("isSessionUserBrowser",!j.isSessionUserBrowser)}),s.jsx("p",{className:`${e.styles["label-keep-login"]} mb-0 ml-2`,children:"Keep me logged in"})]}),s.jsx(te.Link,{to:"/forgot-password",className:`${e.styles["link-to-login"]}`,children:"Forgot password?"})]}),s.jsx("button",{className:`${e.styles["btn-login"]} mt-5`,type:"submit",children:"LOG IN"}),s.jsx("p",{className:`${e.styles["option-text"]} my-3 text-center`,children:"OR"}),s.jsxs(g.Row,{className:"mb-4",children:[s.jsx(g.Col,{lg:6,md:6,xs:12,className:"pr-md-3",children:!!p&&s.jsx(Ie.GoogleOAuthProvider,{clientId:p,children:s.jsx(ss,{onSuccess:q,onError:()=>console.log("Google login failed")})})}),n.schoolId&&s.jsx(g.Col,{lg:6,md:6,xs:12,className:`${e.styles["btn-login-sso"]} pl-md-2`,hidden:!n?.schoolId,children:s.jsxs("div",{className:e.styles["btn-login-with-sso"],onClick:()=>y(v),children:[s.jsx("img",{src:"images/microsoft-logo.png"}),s.jsx("p",{children:"MICROSOFT"})]})})]}),s.jsx("div",{className:`${e.styles["btn-login-sso"]}`,children:s.jsxs("div",{className:e.styles["btn-login-with-sso"],onClick:()=>window.open("https://launchpad.classlink.com/login"),children:[s.jsx("img",{src:"images/class-link-icon.png"}),s.jsx("p",{children:"SIGN IN WITH CLASSLINK"})]})}),s.jsx("div",{className:`${e.styles["btn-login-sso"]} mt-4`,children:s.jsxs("div",{className:e.styles["btn-login-with-sso"],onClick:()=>C(),children:[s.jsx("img",{src:"images/clever-icon.png"}),s.jsx("p",{children:"SIGN IN WITH CLEVER"})]})})]})})})}}),s.jsx(Xe,{open:b,onConfirm:S,clickHandler:v,onClose:k})]})},as={email:"",captcha:""},os="/",Ee="/login",rs="Log in",Ae=()=>{const t=new URLSearchParams(te.useLocation().search),r=t.get("token"),n=t.get("key")??"",l=Q.useDispatch(),m=te.useNavigate(),[h,p]=o.useState(!1),y=o.useCallback(()=>{p(!h)},[h]),[x,C]=o.useState(!1),[b,S]=o.useState(!1),[k,N]=o.useState({token:"",password:"",reEnterPassword:"",email:"",userId:""}),[D,P]=o.useState(!0),{executeRecaptcha:v}=le.useGoogleReCaptcha();o.useEffect(()=>{document.title=rs,e.getAccessToken()&&m(os)},[]);const A=o.useCallback(async j=>{l(e.setLoading(!0));try{await e.forgotPassword(j),m(Ee),l(e.setAlert({type:"success",message:"A mail to reset password was sent"}))}catch(I){l(e.setAlert({type:"danger",message:I.response?.data?.title||I.message||"Error occured"})),localStorage.removeItem(e.ACCESS_TOKEN),sessionStorage.removeItem(e.ACCESS_TOKEN)}l(e.setLoading(!1))},[]),q=o.useCallback(async(j,I)=>{l(e.setLoading(!0));try{const _=await e.checkResetToken(j,I);_.data?N({...k,token:j,email:_.data}):P(!1)}catch{P(!1)}l(e.setLoading(!1))},[]),E=o.useCallback(async j=>{l(e.setLoading(!0));try{await e.resetPassword({...j,key:n}),m(Ee),l(e.setAlert({type:"success",message:"Reset password sucessfully"}))}catch(I){l(e.setAlert({type:"danger",message:I.response?.data?.title||I.message||"Error occured"})),localStorage.removeItem(e.ACCESS_TOKEN),sessionStorage.removeItem(e.ACCESS_TOKEN)}l(e.setLoading(!1))},[]),L=o.useCallback(async()=>{if(!v){console.log("execute recaptcha undefined");return}return await v("forgetPass")},[v]),H=o.useCallback(()=>{},[]);return o.useEffect(()=>{r&&n&&q(r,n)},[r,n]),{defaultInfo:as,forgotPasswordRequest:A,checkResetTokenRequest:q,validLink:D,resetPasswordRequest:E,openLogin:h,toggle:y,isShowNewPassword:x,setIsShowNewPassword:C,isShowReTypePassword:b,setIsShowReTypePassword:S,clickHandler:L,handleVerify:H,initialValues:k}},ns={email:"",captcha:""},is=M.object({email:M.string().email("Email is invalid").required("Email is required")}),ls=({school:t})=>{const{forgotPasswordRequest:r,clickHandler:n,handleVerify:l}=Ae();return s.jsx(ue.Formik,{initialValues:ns,enableReinitialize:!0,validationSchema:is,onSubmit:async m=>{const h=await n();h&&(m.captcha=h,r(m))},children:m=>{const{handleChange:h,handleSubmit:p,values:y,touched:x,errors:C}=m;return s.jsx("div",{className:`${e.styles["box-login"]}`,children:s.jsx("div",{className:`${e.styles["block-login"]}`,children:s.jsxs("div",{className:`${e.styles["block-form"]}`,children:[s.jsxs("div",{className:"d-flex align-items-center mb-4",children:[s.jsx("img",{src:t.schoolLogo,className:`${e.styles["school-icon"]} mr-3`}),s.jsx("p",{className:`${e.styles["school-name"]} mb-0`,children:t.schoolName})]}),s.jsx("p",{className:`${e.styles["title-login"]} `,children:"Forgot password"}),s.jsx("p",{className:`${e.styles["recover-account"]} mb-5`,children:"Enter email to recover your account"}),s.jsxs("div",{className:"w-100",children:[s.jsx(g.Input,{type:"text",name:"email",id:"email",placeholder:"Input email",onChange:h,value:y.email}),x.email&&C.email&&s.jsx(e.ErrorHandler,{text:C.email})]}),s.jsx(te.Link,{to:"/login",className:`${e.styles["link-to-login"]} mt-2`,children:"Return to login"}),s.jsx(le.GoogleReCaptcha,{action:"forgetPass",onVerify:l}),s.jsx(g.Col,{className:"p-0",children:s.jsx("button",{className:`${e.styles["btn-login"]} mt-5`,onClick:()=>p(),children:"Continue"})})]})})})}})},cs=M.object({password:M.string().required("New password is required"),reEnterPassword:M.string().required("Please re-enter new password").test("matching","Passwords do not match",function(){return this.parent.password===this.parent.reEnterPassword})}),ds=()=>{const{validLink:t,resetPasswordRequest:r,isShowNewPassword:n,setIsShowNewPassword:l,isShowReTypePassword:m,setIsShowReTypePassword:h,initialValues:p}=Ae();return s.jsx(ue.Formik,{initialValues:p,enableReinitialize:!0,validationSchema:cs,onSubmit:y=>{r(y)},children:y=>{const{setFieldValue:x,handleSubmit:C,touched:b,errors:S,values:k}=y;return s.jsx(g.Row,{className:`${e.styles["box-login"]}`,children:s.jsx(g.Col,{className:"p-0",children:s.jsx("div",{className:`${e.styles["block-login"]}`,children:s.jsxs("div",{className:`${e.styles["block-form"]}`,children:[s.jsx("img",{src:`${e.getStaticFileUrl("/images/horizontal-logo-blue.svg")}`,className:`${e.styles["img-login-rectangle"]}`}),s.jsx("p",{className:`${e.styles["title-login"]}`,children:"Reset Password"}),s.jsx("div",{className:"w-100",children:t?s.jsxs(o.Fragment,{children:[s.jsx(g.FormGroup,{className:`${e.styles["form-user-name"]}`,children:s.jsx(g.Input,{disabled:!0,type:"text",name:"email",placeholder:"Email",value:k.email,autocomplete:"email",required:!0,className:`${e.styles.input}`})}),s.jsxs("div",{className:`${e.styles["form-user-name"]}`,children:[s.jsx(ie,{isShowPassword:n,togglePasswordVisible:()=>l(!n),onChange:N=>x("password",N.target.value)}),b.password&&S.password&&s.jsx(e.ErrorHandler,{text:S.password})]}),s.jsxs("div",{className:`${e.styles["form-user-name"]}`,children:[s.jsx(ie,{placeholder:"Confirm Password",isShowPassword:m,togglePasswordVisible:()=>h(!m),onChange:N=>x("reEnterPassword",N.target.value)}),b.reEnterPassword&&S.reEnterPassword&&s.jsx(e.ErrorHandler,{text:S.reEnterPassword})]})]}):s.jsxs(o.Fragment,{children:[s.jsx("p",{className:`${e.styles["recover-account"]} mb-5`,children:"Invalid reset password link"}),s.jsx("p",{className:"w-100",children:"It may have been accessed before or expired or you have just tried to reset another account's password"})]})}),t&&s.jsx(g.Col,{className:"p-0",children:s.jsx("button",{className:`${e.styles["btn-login"]} ${e.styles["btn-rounder"]} mt-4`,onClick:()=>C(),children:"SET A NEW PASSWORD"})})]})})})})}})},Pe=`${e.BASE_URL}/api/school`,ms=()=>e.api.get(`${Pe}/settings`),gs=()=>e.api.get(`${Pe}/info`),us={auth:{clientId:e.isLocalhost?"a27f8ac9-e039-4bbd-a9e1-3096e52a77bb":"90c6897c-f17b-475e-a7a8-9a19651e0060",authority:"https://login.microsoftonline.com/common",redirectUri:"https://sso.marioforme.com/microsoft-login.html"},cache:{cacheLocation:"sessionStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(t,r,n)=>{if(!n)switch(t){case ne.LogLevel.Error:console.error(r);return;case ne.LogLevel.Info:console.info(r);return;case ne.LogLevel.Verbose:console.debug(r);return;case ne.LogLevel.Warning:console.warn(r);return;default:return}}}}},hs={email:"",password:"",captcha:"",rememberMe:!1,isSessionUserBrowser:!!sessionStorage.getItem(e.IS_USER_SESSION_BROWSER)},ps="/home",Le="/home",fs="/admin/home",xs="/parent",Ss="/admin/schools",ws="/list-student",ys="Log in",Ns=()=>{const t=Q.useDispatch(),r=te.useNavigate(),[n,l]=o.useState(!1),m=Q.useSelector(a=>a.common.isLoginGoogle),[h,p]=o.useState(""),[y,x]=o.useState(""),[C,b]=o.useState(""),[S,k]=o.useState(!1),N=Q.useSelector(a=>a.common.inforUserGoogle),D=Q.useSelector(a=>a.common.environment),P=new URLSearchParams(location.search),v=P.get("type")==="classlink",A=P.get("token"),q=P.get("isAdminUser"),[E]=o.useState(!1),[L,H]=o.useState({schoolName:"",schoolLogo:"",schoolId:0}),[j,I]=o.useState(null),_=o.useCallback(()=>{l(!n)},[n]),[F,Y]=o.useState(!1),[ae,J]=o.useState(!1),[W,he]=o.useState({firstName:"",lastName:"",fullName:"",imageUrl:"",email:"",accessToken:"",googleId:""});o.useEffect(()=>{document.title=ys;const a=e.getCookieValue("auth-token");if(a){const c=window.location.hostname;if(localStorage.setItem(e.ACCESS_TOKEN,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=/",q)return r("/admin/home");Se(a);return}e.getAccessToken()&&r("/"),Me()},[q,Se,r]);const ce=()=>{localStorage.removeItem(e.ACCESS_TOKEN),sessionStorage.removeItem(e.ACCESS_TOKEN),localStorage.removeItem("USER_EMAIL")};o.useEffect(()=>{v&&A!=""&&Re()},[]);const U=()=>{J(!ae)},_e=()=>{if(e.isLocalhost){const a="https://clever.com/oauth/instant-login?client_id=44f4bbf55cd873d3f7e5&district_id=6620cba31f1ddde7bd689dc5";window.location.href=a}else{const a=`https://clever.com/oauth/authorize?response_type=code&redirect_uri=${encodeURIComponent("https://classlink.marioforme.com/api/clever/clever-login")}&client_id=c3da6c669d239c70d48e`;window.location.href=a}},Re=async()=>{t(e.setLoading(!0));try{const a={tokenClassLink:A},i=await e.apiInforUserClassLink(a),{email:c,token:f}=i.data;await Z({email:c,rememberMe:!1,password:"default",accessToken:f})}catch(a){t(e.setAlert({type:"danger",message:a.response?.data?.title||a.message}))}t(e.setLoading(!1))},pe=window.location.host.includes("-district"),$e=o.useCallback(async()=>{t(e.setLoading(!0));try{const a=await gs(),i=a.data.schoolLogo??"";a.data&&H({schoolName:a.data.schoolName,schoolLogo:i?e.getFileUrl(i):e.getStaticFileUrl("/images/logo_header_blue.png"),schoolId:a.data.schoolId})}catch(a){t(e.setAlert({type:"danger",message:a.response?.data?.title||a.message}))}t(e.setLoading(!1))},[]),[Oe,de]=o.useState(!1),[X,fe]=o.useState(null),oe=o.useCallback((a,i,c,f,d,B,$,z,V,T)=>{const O=T?.isSessionUserBrowser??!1;O?(sessionStorage.setItem(e.ACCESS_TOKEN,a),sessionStorage.setItem(e.IS_USER_SESSION_BROWSER,String(O))):(sessionStorage.removeItem(e.IS_USER_SESSION_BROWSER),localStorage.setItem(e.ACCESS_TOKEN,a)),localStorage.removeItem(e.NOTIFICATION_ALERT_KEY),sessionStorage.removeItem("ACTIVE_ROLE"),t(e.setUser({id:i,firstName:c,lastName:f,roles:d,email:B,profileImageFileName:$}));let w=localStorage.getItem("ROLES")||"";if(!w){if(d.includes("Admin"))w="Admin";else{const R=((i?localStorage.getItem(`PREFERRED_ROLE_${i}`):null)||"").split(",").map(ge=>ge.trim()).filter(Boolean);R.length>0&&R.every(ge=>d.includes(ge))?R.length>1?w=R.every(Ce=>Ce==="Teacher"||Ce==="Assistant")?"Teacher,Assistant":R[0]:w=R[0]:d.includes("Teacher")?w=d.includes("Assistant")?"Teacher,Assistant":"Teacher":d.includes("Assistant")?w="Assistant":d.includes("Counselor")?w="Counselor":d.includes("SecondaryTeacher")?w="SecondaryTeacher":d.includes("EduTeacher")?w="EduTeacher":d.includes("Student")?w="Student":d.includes("Parent")?w="Parent":d.length>0&&(w=d[0])}w&&(localStorage.setItem("ROLES",w),sessionStorage.setItem("ACTIVE_ROLE",w))}if(T?.email&&!d.includes("Admin")){re.init(e.isLocalhost?e.INIT_AMPLITUDE_KEY_STAGE:e.INIT_AMPLITUDE_KEY_PROD,T.email,{defaultTracking:!1});const K=window.location.hostname,R=new re.Identify;R.set("domain",K),re.identify(R),re.track("general: session start",{user_id:T.email,domain:K,roles:d?.toString()}),localStorage.setItem("USER_EMAIL",T.email),z&&re.track("general: first login",{user_id:T.email,domain:K,roles:d?.toString()})}const De=(String(T?.preferredAppType||"").split(",").map(K=>K.trim().toUpperCase()).filter(Boolean)[0]||"")==="HS"?"HS":"MS";e.isCombineMsHs()||localStorage.setItem("ACTIVE_TIER",De);const ee=K=>{const R=e.navigateBySchoolLevel(K,V);window.location.pathname.startsWith("/es")?V==="es"?r(R):window.location.href=R:V==="es"?window.location.href=R:r(R)},G=w.split(",")[0]||"";pe?ee(Ss):d.includes("Admin")||G==="Admin"?ee(fs):G==="Teacher"||G==="Assistant"||G==="Counselor"||G==="SecondaryTeacher"||!G&&(d.includes("Teacher")||d.includes("Assistant")||d.includes("Counselor")||d.includes("SecondaryTeacher"))?ee(ps):G==="Student"||!G&&d.includes("Student")?ee(Le):G==="Parent"||!G&&d.includes("Parent")?ee(xs):(G==="EduTeacher"||!G&&d.includes("EduTeacher"))&&ee(ws),t(e.setLoading(!1))},[t,r,pe]),me=o.useCallback((a,i,c)=>S&&a?.includes("Student")&&(i==="es"||c==="ES")?(t(e.setAlert({type:"danger",message:"Unable to sign in with SSO. Please contact your admin or teacher."})),localStorage.removeItem(e.ACCESS_TOKEN),sessionStorage.removeItem(e.ACCESS_TOKEN),t(e.setLoading(!1)),!0):!1,[S,t]),xe=o.useCallback(a=>S&&a&&e.ES_GRADES.includes(a.trim())?(t(e.setAlert({type:"danger",message:"Unable to sign in with SSO. Please contact your admin or teacher."})),t(e.setLoading(!1)),!0):!1,[S,t]);async function Se(a){t(e.setLoading(!0));try{const i=await e.getInfo();let{id:c,firstName:f,lastName:d,roles:B,email:$,profileImageFileName:z,isLoginFirst:V,schoolLevel:T,appType:O,preferredAppType:w,needsAppTypeChoice:je}=i.data;if(je){fe({email:$}),de(!0),t(e.setLoading(!1));return}T||(O==="ES"||O==="ES, MS"&&w==="ES")&&(T="es"),oe(a,c,f,d,B,$,z,V,T,{email:$,...i.data})}catch(i){t(e.setAlert({type:"danger",message:i.response?.data?.title||i.message||"Login failed"})),t(e.setLoading(!1))}}const Ge=o.useCallback(async a=>{if(de(!1),!X)return;t(e.setLoading(!0));const i=a==="es"?"ES":a==="ms"?"MS":"ES, MS";try{const c=await e.logIn({...X,email:X?.email?.trim(),password:X?.password?.trim(),preferredAppType:i});let{token:f,id:d,firstName:B,lastName:$,roles:z,email:V,profileImageFileName:T,isLoginFirst:O,schoolLevel:w}=c.data;if(!w&&a==="es"&&(w="es"),me(z,w,c.data.appType))return;oe(f,d,B,$,z,V,T,O,w,{...X,...c.data})}catch(c){t(e.setAlert({type:"danger",message:c.response?.data?.title||c.message||"Login failed"})),t(e.setLoading(!1))}},[X,oe,me,t]),Z=o.useCallback(async a=>{t(e.setLoading(!0));try{const i=await e.logIn({...a,email:a?.email?.trim(),password:a?.password?.trim()});let{token:c,id:f,firstName:d,lastName:B,roles:$,email:z,profileImageFileName:V,isLoginFirst:T,schoolLevel:O}=i.data;if(i.data.needsAppTypeChoice){fe(a),de(!0),t(e.setLoading(!1));return}if(O||(i.data.appType==="ES"||i.data.appType==="ES, MS"&&i.data.preferredAppType==="ES")&&(O="es"),me($,O,i.data.appType))return;oe(c,f,d,B,$,z,V,T,O,{...a,...i.data})}catch(i){t(e.setAlert({type:"danger",message:i.response?.data?.title||i.message||"Login failed"})),localStorage.removeItem(e.ACCESS_TOKEN),sessionStorage.removeItem(e.ACCESS_TOKEN),t(e.setLoading(!1))}},[oe,me,t]),Me=async()=>{try{const a=await e.getGoogleClientId();p(a.data.googleClientId),x(a.data.googleCaptchaId),b(a.data.extensionEmail),k(a.data.isRestrictedLogin)}catch(a){t(e.setAlert({type:"danger",message:a.response?.data?.title||a.message||"Login failed"}))}},we=o.useCallback(async(a,i,c,f)=>{t(e.setLoading(!0));try{if((await e.checkUserGoogle(a,i)).data){const $={email:i.email,isLoginGoogle:!0,rememberMe:!1,password:"default",accessToken:c,captcha:"",loginType:se.LoginType.Google};if(f!=null){const z=await f();$.captcha=z}await Z($),t(e.setIsLoginGoogle(!1))}else he({...i,token:c}),U()}catch(d){t(e.setAlert({type:"danger",message:d.response?.data?.title||d.message||"Login failed"}))}t(e.setLoading(!1))},[Z,t,U]),Ue=o.useCallback(async(a,i)=>{t(e.setLoading(!0));try{if(xe(a))return;if((await e.registerUserStudent({...W,gradeLevel:a}))?.data){const f={email:W.email,isLoginGoogle:!0,rememberMe:!1,password:"default",accessToken:W.accessToken,captcha:"",loginType:se.LoginType.Google};if(i!=null){const d=await i();f.captcha=d}await Z(f),U()}}catch(c){t(e.setAlert({type:"danger",message:c.response?.data?.title||c.message||"Login failed"}))}t(e.setLoading(!1))},[xe,W,Z,U,t]),Fe=async(a,i)=>{t(e.setLoading(!0));try{const c={firstName:N.firstName,lastName:N.lastName,imageUrl:N.imageUrl,fullName:N.fullName,email:N.email,accessToken:N.accessToken,teacherId:a};if((await e.registerUserStudent(c)).data){const d=await i(),B={email:N.email,captcha:d,isLoginGoogle:!0,rememberMe:!1,password:"default",accessToken:N.accessToken,loginType:se.LoginType.Google};t(e.setIsLoginGoogle(!1)),await Z(B),r(Le)}}catch(c){t(e.setAlert({type:"danger",message:c.response?.data?.title||c.message||"Login failed"}))}t(e.setIsLoginGoogle(!1)),t(e.setLoading(!1))},Be=async()=>{try{const a=await ms();t(e.setSandboxMode(a.data.isSandboxMode)),e.applyCombineFlag(!!a.data.isCombineMsHs)}catch(a){console.error(a)}},ye=async a=>{j.handleRedirectPromise().then(async i=>{if(L?.schoolId)if(i){let c=i.account;await Ne(c,a)}else{const c=j.getAllAccounts();if(c.length===0){const f=D==="PreProduction"?"https://mario1.marioforme.com":e.isLocalhost?"https://brightsoft.marioforme.com":"https://sso.marioforme.com";window.location.href=(window.location.hostname==="localhost"?window.location.origin:f)+`/microsoft-login.html?redirect-uri=${window.location.origin}&schoolId=${L.schoolId}`}else{let f=c[0];await Ne(f,a)}}}).catch(i=>{console.error(i)})},Ne=async(a,i)=>{let c=a.name,f={firstName:c.split(" ").slice(0,-1).join(" "),lastName:c.split(" ").slice(-1).join(" "),fullName:c,imageUrl:"",email:a.username,accessToken:a.idTokenClaims.aio,googleId:a.tenantId};t(e.setInforUserGoogle(f)),await we(se.TypeLogin.MicrosoftSSO,f,a.idTokenClaims.aio,i)},ze=async()=>{const a=new ne.PublicClientApplication(us);await a.initialize(),I(a)};return o.useEffect(()=>{let a=window.location.href;j&&a.includes("code")&&a.includes("client_info")&&ye()},[JSON.stringify(j)]),o.useEffect(()=>{Be(),ze(),$e()},[]),{defaultInfo:hs,userLogin:Z,openLogin:n,toggle:_,isShowPassword:F,setIsShowPassword:Y,fnIsCheckLogin:we,isLoginGoogle:m,infoUser:N,submitLogin:Fe,googleClientId:h,googleRecaptchaId:y,handleCancelModelAssign:ce,openModelAssign:E,fnLoginSSO:ye,school:L,extensionEmail:C,handleLoginWidthClever:_e,openModalSelectGrade:ae,handleRegisterUser:Ue,handleToggleModelGrade:U,openModalSelectTier:Oe,handleSelectTier:Ge,setOpenModalSelectTier:de}},be="/",js="/login",ke="Log in",Cs=()=>{const t=Q.useDispatch(),r=te.useNavigate(),n=location.search,m=new URLSearchParams(n).get("userId"),[h,p]=o.useState(!1),[y,x]=o.useState(!1),[C,b]=o.useState({password:"",reEnterPassword:"",email:"",userId:m??"",token:""}),{executeRecaptcha:S}=le.useGoogleReCaptcha(),k=o.useCallback(async v=>{t(e.setLoading(!0));try{const A=await e.getUserNewPassword(v);b({...C,email:A.data})}catch(A){t(e.setAlert({type:"danger",message:A.message}))}t(e.setLoading(!1))},[]),N=o.useCallback(async v=>{t(e.setLoading(!0));try{await e.createPassword(v),r(js),t(e.setAlert({type:"success",message:"Create password sucessfully"}))}catch(A){t(e.setAlert({type:"danger",message:A.response?.data?.title||A.message||"Error occured"})),localStorage.removeItem(e.ACCESS_TOKEN),sessionStorage.removeItem(e.ACCESS_TOKEN)}t(e.setLoading(!1))},[]),D=o.useCallback(async()=>{if(!S){console.log("execute recaptcha undefined");return}return await S("forgetPass")},[S]),P=o.useCallback(()=>{},[]);return o.useEffect(()=>{document.title=ke,e.getAccessToken()&&r(be),m&&k(m)},[m]),o.useEffect(()=>{document.title=ke,e.getAccessToken()&&r(be)},[]),{createPasswordRequest:N,isShowNewPassword:h,setIsShowNewPassword:p,isShowReTypePassword:y,setIsShowReTypePassword:x,clickHandler:D,handleVerify:P,initialValues:C}},vs=M.object({password:M.string().required("Password is required"),reEnterPassword:M.string().required("Please re-enter Password").test("matching","Passwords do not match",function(){return this.parent.password===this.parent.reEnterPassword})}),Es=()=>{const{createPasswordRequest:t,isShowNewPassword:r,setIsShowNewPassword:n,isShowReTypePassword:l,setIsShowReTypePassword:m,initialValues:h}=Cs();return s.jsx(ue.Formik,{initialValues:h,enableReinitialize:!0,validationSchema:vs,onSubmit:p=>{t(p)},children:p=>{const{setFieldValue:y,handleSubmit:x,touched:C,errors:b,values:S}=p;return s.jsx(g.Row,{className:`${e.styles["box-login"]}`,children:s.jsxs(g.Col,{className:"p-0",children:[s.jsx("div",{hidden:!S.email,className:`${e.styles["block-login"]}`,children:s.jsxs("div",{className:`${e.styles["block-form"]}`,children:[s.jsx("img",{src:`${e.getStaticFileUrl("/images/horizontal-logo-blue.svg")}`,className:`${e.styles["img-login-rectangle"]}`}),s.jsx("p",{className:`${e.styles["title-login"]}`,children:"Create Your Password"}),s.jsx("div",{className:"w-100",children:s.jsxs(o.Fragment,{children:[s.jsx(g.FormGroup,{className:`${e.styles["form-user-name"]}`,children:s.jsx(g.Input,{disabled:!0,type:"text",name:"email",placeholder:"Email",value:S.email,autocomplete:"email",required:!0,className:`${e.styles.input}`})}),s.jsxs("div",{className:`${e.styles["form-user-name"]}`,children:[s.jsx(ie,{isShowPassword:r,togglePasswordVisible:()=>n(!r),onChange:k=>y("password",k.target.value)}),C.password&&b.password&&s.jsx(e.ErrorHandler,{text:b.password})]}),s.jsxs("div",{className:`${e.styles["form-user-name"]}`,children:[s.jsx(ie,{placeholder:"Confirm Password",isShowPassword:l,togglePasswordVisible:()=>m(!l),onChange:k=>y("reEnterPassword",k.target.value)}),C.reEnterPassword&&b.reEnterPassword&&s.jsx(e.ErrorHandler,{text:b.reEnterPassword})]})]})}),s.jsx("button",{className:`${e.styles["btn-login"]} ${e.styles["btn-rounder"]} mt-4`,onClick:()=>x(),children:"CREATE YOUR PASSWORD"})]})}),s.jsx("div",{hidden:!!S.email,className:`${e.styles["block-login"]}`,children:s.jsxs("div",{className:`${e.styles["block-form"]}`,children:[s.jsx("img",{src:`${e.getStaticFileUrl("/images/horizontal-logo-blue.svg")}`,className:`${e.styles["img-login-rectangle"]}`}),s.jsx("p",{className:`${e.styles["title-login"]}`,children:"You cannot regenerate the password"})]})})]})})}})},Ls="_modalContent_1pxxz_1",bs="_closeButton_1pxxz_6",ks="_modalBody_1pxxz_17",Is="_iconWrapper_1pxxz_22",Ts="_title_1pxxz_38",As="_subtitle_1pxxz_45",Ps="_tierCard_1pxxz_51",_s="_es_1pxxz_60",Rs="_tierTitle_1pxxz_71",$s="_tierDesc_1pxxz_76",Os="_arrow_1pxxz_81",Gs="_ms_1pxxz_85",Ms="_both_1pxxz_110",Us="_cardLeft_1pxxz_134",Fs="_cardText_1pxxz_138",u={modalContent:Ls,closeButton:bs,modalBody:ks,iconWrapper:Is,title:Ts,subtitle:As,tierCard:Ps,es:_s,tierTitle:Rs,tierDesc:$s,arrow:Os,ms:Gs,both:Ms,cardLeft:Us,cardText:Fs},Bs=({open:t,onSelectTier:r,onClose:n})=>s.jsxs(g.Modal,{isOpen:t,style:{zIndex:1201,maxWidth:450},centered:!0,autoFocus:!1,returnFocusAfterClose:!1,contentClassName:u.modalContent,children:[s.jsx("div",{className:u.closeButton,children:n&&s.jsx(e.MdClose,{onClick:()=>n(),size:24})}),s.jsxs(g.ModalBody,{className:u.modalBody,children:[s.jsx("div",{className:u.iconWrapper,children:s.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("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"})})}),s.jsx("h4",{className:u.title,children:"Select Grade Level"}),s.jsx("p",{className:u.subtitle,children:"Select the grade levels you support"}),s.jsxs("div",{onClick:()=>r("es"),className:`${u.tierCard} ${u.es}`,children:[s.jsxs("div",{className:u.cardLeft,children:[s.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("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"})}),s.jsxs("div",{className:u.cardText,children:[s.jsx("div",{className:u.tierTitle,children:"Elementary / Primary"}),s.jsx("div",{className:u.tierDesc,children:"Grades 2-5 / Years 3-6"})]})]}),s.jsx("div",{className:u.arrow,children:">"})]}),s.jsxs("div",{onClick:()=>r("ms"),className:`${u.tierCard} ${u.ms}`,children:[s.jsxs("div",{className:u.cardLeft,children:[s.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("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"})}),s.jsxs("div",{className:u.cardText,children:[s.jsx("div",{className:u.tierTitle,children:"Middle & High / Secondary"}),s.jsx("div",{className:u.tierDesc,children:"Grades 6-12 / Years 7-13"})]})]}),s.jsx("div",{className:u.arrow,children:">"})]}),s.jsxs("div",{onClick:()=>r("both"),className:`${u.tierCard} ${u.both}`,children:[s.jsxs("div",{className:u.cardLeft,children:[s.jsx("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("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"})}),s.jsxs("div",{className:u.cardText,children:[s.jsx("div",{className:u.tierTitle,children:"Both Tiers"}),s.jsx("div",{className:u.tierDesc,children:"Access all grade levels"})]})]}),s.jsx("div",{className:u.arrow,children:">"})]})]})]}),zs=o.memo(Bs),Ds="Log in",qs="Forgot password",Hs="Reset password",Vs=t=>{const{isLogin:r,isForgotPassword:n,isResetPassword:l,isCreatePassword:m}=t,{defaultInfo:h,userLogin:p,googleRecaptchaId:y,handleCancelModelAssign:x,school:C,openModelAssign:b,setIsShowPassword:S,fnIsCheckLogin:k,isLoginGoogle:N,submitLogin:D,infoUser:P,googleClientId:v,isShowPassword:A,fnLoginSSO:q,extensionEmail:E,handleLoginWidthClever:L,openModalSelectGrade:H,handleRegisterUser:j,handleToggleModelGrade:I,openModalSelectTier:_,handleSelectTier:F,setOpenModalSelectTier:Y}=Ns();return o.useEffect(()=>{r&&(document.title=Ds),n&&(document.title=qs),l&&(document.title=Hs)},[r,n,l]),s.jsxs("div",{className:`${e.styles.login} container-fluid font-family-lato`,children:[s.jsxs(g.Row,{className:"h-100",children:[s.jsxs(g.Col,{lg:8,md:12,xs:12,className:"d-flex justify-content-center h-100 align-items-center p-3 flex-column",children:[!!y&&s.jsxs(le.GoogleReCaptchaProvider,{useRecaptchaNet:!0,reCaptchaKey:y,scriptProps:{async:!0,defer:!0,appendTo:"body"},children:[r&&s.jsx(ts,{userLogin:p,defaultInfo:h,onCancelModelAssign:x,openModelAssign:b,school:C,fnIsCheckLogin:k,googleClientId:v,infoUser:P,isLoginGoogle:N,isShowPassword:A,setIsShowPassword:S,submitLogin:D,fnLoginSSO:q,extensionEmail:E,onLoginWidthClever:L,openModalSelectGrade:H,handleRegisterUser:j,onToggleModelGrade:I}),n&&s.jsx(ls,{school:C})]}),l&&s.jsx(ds,{}),m&&s.jsx(Es,{}),s.jsx("a",{href:"/privacy-policy/",target:"blank",className:`${e.styles["privacy-policy"]}`,children:"Privacy Policy"})]}),s.jsx(g.Col,{className:"p-3 mh-100 d-flex justify-content-end",lg:4,md:12,xs:12,children:s.jsx("img",{src:`${e.getStaticFileUrl(window.innerWidth>992?"/images/img-login.png":"/images/img-login-tablet.png")}`,className:`${e.styles["img-login"]}`})})]}),s.jsx(zs,{open:_,onSelectTier:F,onClose:()=>Y(!1)})]})};exports.default=Vs;