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 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("reactstrap"),i=require("./index-CD8bO3wO.js"),u=require("react"),p=require("react-redux"),A=require("react-router-dom"),R=require("react-i18next");function L(a){return i.GenIcon({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M103.77,185.94C103.38,187.49,93.63,224,40,224a8,8,0,0,1-8-8c0-53.63,36.51-63.38,38.06-63.77a8,8,0,0,1,3.88,15.53c-.9.25-22.42,6.54-25.56,39.86C81.7,204.48,88,183,88.26,182a8,8,0,0,1,15.51,4Zm93-67.4L192,123.31v58.33A15.91,15.91,0,0,1,187.32,193L153,227.3A15.91,15.91,0,0,1,141.7,232a16.11,16.11,0,0,1-5.1-.83,15.94,15.94,0,0,1-10.78-12.92l-5.37-38.49L76.24,135.55l-38.47-5.37A16,16,0,0,1,28.7,103L63,68.68A15.91,15.91,0,0,1,74.36,64h58.33l4.77-4.77c26.68-26.67,58.83-27.82,71.41-27.07a16,16,0,0,1,15,15C224.6,59.71,223.45,91.86,196.78,118.54ZM40,114.34l37.15,5.18L116.69,80H74.36ZM91.32,128,128,164.68l57.45-57.45a76.46,76.46,0,0,0,22.42-59.16,76.65,76.65,0,0,0-59.11,22.47ZM176,139.31l-39.53,39.53L141.67,216,176,181.64Z"}}]})(a)}const O=[{value:!0,label:"Read"},{value:!1,label:"Unread"}],P=({value:a,onChange:r})=>{const c={menu:l=>({...l,zIndex:10}),control:(l,h)=>({...l,borderRadius:"24px",borderColor:(h.isFocused,"#e5e7eb"),boxShadow:"none",minHeight:"42px","&:hover":{borderColor:"#e5e7eb"}}),valueContainer:l=>({...l,padding:"0 16px"}),indicatorSeparator:()=>({display:"none"}),dropdownIndicator:l=>({...l,padding:"0 12px 0 0",color:"#9ca3af"})};return e.jsx(i.CustomSelector,{defaultValue:a,options:O,onChange:r,styles:c})},F=u.memo(P),k=`${i.BASE_URL}/api/notification`,E=a=>i.api.get(k,{params:{...a}}),J=a=>i.api.put(`${k}/${a}`),q=()=>i.api.put(`${k}/updateAllStatus`),B={currentPage:1,pageSize:30,searchString:"",isRead:!1},M="Notification list",T="NOTIFICATION_CHANNEL",H="NEW_NOTIFICATION",D=()=>{const a=p.useDispatch(),{roles:r}=A.useParams(),c=p.useSelector(s=>s.common.user),l=c?.id,h=c?.studentId,x=p.useSelector(s=>s.notification.notificationList),g=p.useSelector(s=>s.common.user?.pusherKey),N=p.useSelector(s=>s.common.user?.pusherCluster),S=p.useSelector(s=>s.notification.totalItems),C=p.useSelector(s=>s.notification.unReadNotification),[n,b]=u.useState(B),[_,d]=u.useState(!1),I=s=>b({...n,...s}),j=s=>{const{source:f,extraData:o}=s;switch(f){case"AssessmentAssignment":window.open(`/player/diagnosticsurvey/${Number(o)}`);break;case"NewConferenceCreated":window.open(`/start-conference/${JSON.parse(o)?.[0]}/${JSON.parse(o)?.[1]}/conferenceRubric`);break;case"Class Reflection":window.open(`/start-reflection/${o?.replace(/[\[\]]/g,"")?.split(",")?.[1]}`);break;case"Class Reflection Completed":window.open(`/result-reflection/${o?.replace(/[\[\]]/g,"")?.split(",")?.[1]}`);break;case"External Reflection Completed":window.open(`/result-reflection/${JSON.parse(o)?.[0]}/external`);break;case"NewSessionCreated":window.open(`/start-question/${JSON.parse(o)?.[0]}/${JSON.parse(o)?.[1]}`);break;case"NewSessionComplete":window.open(`/start-question/${JSON.parse(o)?.[0]}/${JSON.parse(o)?.[1]}`);break;case"ActionPointReminder":window.open("/action-point/to-do");break;case"SendNotiPLP":window.open("/personal-learning-plan");break;case"SendNotiGOAL":window.open(`/my-goals/${JSON.parse(o)}`);break;case"CertificateApproved":window.open("/dashboard/certification/2");break;case"RequestCheckIn":window.open(`/start-question/${JSON.parse(o)?.[0]}/${JSON.parse(o)?.[1]}`);case"NewSurveyCreated":h&&window.open(`/start-survey/${JSON.parse(o)?.[0]}/${h}`);break;case"StudentCompletedSurvey":window.open(`/start-survey/${JSON.parse(o)?.[0]}/${JSON.parse(o)?.[1]}`);break}},w=u.useCallback(async()=>{a(i.setLoading(!0));try{const s=await E({...n,roles:r?.trim()?[r]:c?.roles}),{items:f,totalItems:o}=s.data;a(i.setNotification({notificationList:f,totalItems:o}))}catch(s){a(i.setAlert({type:"danger",message:s.response?.data?.title||s.message}))}a(i.setLoading(!1))},[n]);u.useEffect(()=>{document.title=M},[]),u.useEffect(()=>{w();let s;const f=i.getRealtimeProvider({});if(!!l&&(f==="signalr"||!!g&&!!N))try{s=new i.RealtimeService(g||"signalr",{cluster:N}),s.subscribe(`${T}-${l}`).bind(H,w)}catch($){console.error("Failed to initialize RealtimeService:",$)}return()=>{if(s&&l)try{s.unsubscribe(`${T}-${l}`),s.disconnect()}catch($){console.error("Failed to disconnect RealtimeService:",$)}}},[w,l,g,N]);const y=u.useCallback((s,f)=>{try{a(i.setModal({isOpen:!0,type:"warning",message:`Do you want to mark this notification ${f?"read":"unread"}?`,onConfirm:async()=>{await J(s),w()}}))}catch(o){a(i.setAlert({type:"danger",message:o.response?.data?.title||o.message}))}},[x,C]),v=u.useCallback(async()=>{try{if(x.length===0)throw new Error("There are no unread messages");a(i.setModal({isOpen:!0,type:"warning",message:"Do you want to mark all notification ?",onConfirm:async()=>{d(!0),await q(),w(),d(!1)}}))}catch(s){a(i.setAlert({type:"danger",message:s.response?.data?.title||s.message}))}},[x]);return{notificationList:x,totalItems:S,unReadNotification:C,filters:n,changeFilters:I,updateNotification:y,viewNotification:j,updateAll:v,toggleUpdateAllStatus:_}},G="_container_1bf04_1",Y="_header_1bf04_7",z="_markAllBtn_1bf04_14",U="_markAllText_1bf04_21",W="_markAllCheckbox_1bf04_27",Z="_filterContainer_1bf04_35",K="_filterLabel_1bf04_40",V="_tableWrapper_1bf04_52",Q="_tableHead_1bf04_60",X="_thText_1bf04_69",ee="_td_1bf04_73",te="_rowText_1bf04_77",ne="_rowTime_1bf04_82",se="_checkboxInput_1bf04_87",ae="_actionBtn_1bf04_95",oe="_iconContainer_1bf04_104",ie="_iconGreen_1bf04_114",le="_iconOrange_1bf04_118",ce="_iconRed_1bf04_122",re="_iconYellow_1bf04_126",de="_flagIcon_1bf04_140",me="_flagIconRed_1bf04_145",ue="_flagIconYellow_1bf04_149",fe="_tooltipContainer_1bf04_153",pe="_tooltipText_1bf04_157",he="_whiteTooltip_1bf04_163",xe="_redText_1bf04_173",t={container:G,header:Y,markAllBtn:z,markAllText:U,markAllCheckbox:W,filterContainer:Z,filterLabel:K,tableWrapper:V,tableHead:Q,thText:X,td:ee,rowText:te,rowTime:ne,checkboxInput:se,actionBtn:ae,iconContainer:oe,iconGreen:ie,iconOrange:le,iconRed:ce,iconYellow:re,"explain-icon":"_explain-icon_1bf04_134",flagIcon:de,flagIconRed:me,flagIconYellow:ue,tooltipContainer:fe,tooltipText:pe,whiteTooltip:he,redText:xe},ge="Notifications",be="/images/info-icon.png",Ne=a=>{const r=(a.text||"").toLowerCase(),c=a.informaions?.[0]?.toLowerCase();return r.includes("red flag")||c?.includes("red")?e.jsx("div",{className:`${t.iconContainer} ${t.iconRed}`,children:e.jsx("img",{src:"/images/flag-icon.svg",alt:"Red flag",className:`${t.flagIcon} ${t.flagIconRed}`})}):r.includes("yellow flag")||c?.includes("yellow")?e.jsx("div",{className:`${t.iconContainer} ${t.iconYellow}`,children:e.jsx("img",{src:"/images/flag-icon.svg",alt:"Yellow flag",className:`${t.flagIcon} ${t.flagIconYellow}`})}):r.includes("completed a check-in")||r.includes("completed a survey")||a.source==="NewSessionComplete"||a.source==="Class Reflection Completed"||a.source==="External Reflection Completed"?e.jsx("div",{className:`${t.iconContainer} ${t.iconGreen}`,children:e.jsx(i.FaCheck,{color:"white",size:18})}):e.jsx("div",{className:`${t.iconContainer} ${t.iconOrange}`,children:e.jsx(L,{color:"white",size:18})})},_e=()=>{const{notificationList:a,totalItems:r,filters:c,changeFilters:l,updateNotification:h,viewNotification:x,updateAll:g,toggleUpdateAllStatus:N}=D(),{t:S}=R.useTranslation(),C=(n,b,_)=>{if(typeof n!="string")return null;const d=n.indexOf(" "),I=d!==-1?n.substring(0,d):n,j=d!==-1?n.substring(d+1):"";return e.jsxs("div",{className:b!==_-1?"mb-1":"",children:[e.jsx("span",{className:`fw-bold ${t.redText}`,children:I})," ",j]},b)};return e.jsxs("div",{className:`animated fadeIn ${t.container}`,children:[e.jsxs("div",{className:"d-flex justify-content-between align-items-center mb-4",children:[e.jsx("h4",{className:t.header,children:ge}),e.jsxs("div",{className:"d-flex align-items-center",children:[c.isRead===!1&&e.jsxs("div",{className:`d-flex align-items-center px-4 me-3 cursor-pointer ${t.markAllBtn}`,onClick:()=>g(),children:[e.jsx("span",{className:`me-3 ${t.markAllText}`,children:"Mark all as read"}),e.jsx(m.Input,{checked:N,type:"checkbox",className:`m-0 position-relative cursor-pointer ${t.markAllCheckbox}`,onChange:()=>g(),onClick:n=>n.stopPropagation()})]}),e.jsxs("div",{className:t.filterContainer,children:[e.jsx("span",{className:t.filterLabel,children:"Filter"}),e.jsx(F,{value:c.isRead,onChange:n=>l({isRead:n.value})})]})]})]}),e.jsxs(m.Row,{className:"mb-2",children:[e.jsx(m.Col,{md:12,children:a&&a.length>0?e.jsx("div",{className:t.tableWrapper,children:e.jsxs(m.Table,{borderless:!0,hover:!0,style:{margin:0},children:[e.jsx("thead",{className:t.tableHead,children:e.jsxs("tr",{children:[e.jsx("th",{className:`align-middle ${t.th} ${t.thText}`,children:"Text"}),e.jsx("th",{className:`align-middle ${t.th}`,children:"Time"}),e.jsx("th",{className:`text-center align-middle ${t.th}`,children:"Is read"}),e.jsx("th",{className:`text-center align-middle ${t.th}`,children:"Go to session"})]})}),e.jsx("tbody",{children:a.map((n,b)=>e.jsxs("tr",{style:{borderBottom:b===a.length-1?"none":"1px solid #f3f4f6"},children:[e.jsx("td",{className:`align-middle ${t.td}`,children:e.jsxs("div",{className:"d-flex align-items-center",children:[Ne(n),e.jsxs("span",{className:`ms-3 ${t.rowText}`,children:[n.text,n.text?.toLowerCase().includes("flag")&&e.jsx("img",{id:`info-icon-${n.id}`,src:be,alt:"",className:`ms-2 ${t["explain-icon"]}`})]}),n.text?.toLowerCase().includes("flag")&&e.jsx(m.UncontrolledTooltip,{placement:"bottom",target:`info-icon-${n.id}`,innerClassName:t.whiteTooltip,offset:[0,10],children:e.jsx("div",{className:`text-left p-1 ${t.tooltipContainer}`,children:e.jsx("div",{className:t.tooltipText,children:n.informaions&&n.informaions.length>0?n.informaions.map((_,d)=>C(_,d,n.informaions.length)):"View session details to see metrics"})})})]})}),e.jsx("td",{className:`align-middle ${t.td} ${t.rowTime}`,children:i.formatLocalTime(n.time,"yyyy-MM-DD HH:mm")}),e.jsx("td",{className:`text-center align-middle ${t.td}`,children:e.jsx(m.Input,{type:"checkbox",className:`position-relative m-0 shadow-none ${t.checkboxInput}`,checked:n.isRead,onChange:()=>h(n.id,!n.isRead)})}),e.jsx("td",{className:`text-center align-middle ${t.td}`,children:["AssessmentAssignment","NewConferenceCreated","NewSessionCreated","CertificateApproved","Class Reflection","NewSessionComplete","ActionPointReminder","SendNotiPLP","SendNotiGOAL","Class Reflection Completed","External Reflection Completed","RequestCheckIn","NewSurveyCreated","StudentCompletedSurvey"].includes(n.source)&&e.jsx(m.Button,{outline:!0,color:"secondary",size:"sm",className:t.actionBtn,onClick:()=>x(n),children:"Go"})})]},n.id))})]})}):e.jsx(i.EmptyDataAlert,{label:S("notification")})}),e.jsx(m.Col,{md:12,className:"mt-4",children:e.jsx(i.CustomPagination,{filters:c,totalRecordCount:r,changePageSize:n=>l({pageSize:n}),changePage:n=>l({currentPage:n})})})]})]})};exports.default=_e;
@@ -0,0 +1,419 @@
1
+ import { jsx as n, jsxs as l } from "react/jsx-runtime";
2
+ import { Input as v, Row as E, Col as A, Table as H, UncontrolledTooltip as D, Button as G } from "reactstrap";
3
+ import { K as M, a2 as Y, i as T, B as z, b as R, aA as U, c as S, aB as W, aC as q, R as L, ak as Z, W as j, X as K, aD as V } from "./index-CfBp3NrB.mjs";
4
+ import { memo as X, useState as O, useCallback as k, useEffect as P } from "react";
5
+ import { useDispatch as Q, useSelector as g } from "react-redux";
6
+ import { useParams as ee } from "react-router-dom";
7
+ import { useTranslation as te } from "react-i18next";
8
+ function ne(o) {
9
+ return M({ attr: { viewBox: "0 0 256 256", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M103.77,185.94C103.38,187.49,93.63,224,40,224a8,8,0,0,1-8-8c0-53.63,36.51-63.38,38.06-63.77a8,8,0,0,1,3.88,15.53c-.9.25-22.42,6.54-25.56,39.86C81.7,204.48,88,183,88.26,182a8,8,0,0,1,15.51,4Zm93-67.4L192,123.31v58.33A15.91,15.91,0,0,1,187.32,193L153,227.3A15.91,15.91,0,0,1,141.7,232a16.11,16.11,0,0,1-5.1-.83,15.94,15.94,0,0,1-10.78-12.92l-5.37-38.49L76.24,135.55l-38.47-5.37A16,16,0,0,1,28.7,103L63,68.68A15.91,15.91,0,0,1,74.36,64h58.33l4.77-4.77c26.68-26.67,58.83-27.82,71.41-27.07a16,16,0,0,1,15,15C224.6,59.71,223.45,91.86,196.78,118.54ZM40,114.34l37.15,5.18L116.69,80H74.36ZM91.32,128,128,164.68l57.45-57.45a76.46,76.46,0,0,0,22.42-59.16,76.65,76.65,0,0,0-59.11,22.47ZM176,139.31l-39.53,39.53L141.67,216,176,181.64Z" } }] })(o);
10
+ }
11
+ const ae = [
12
+ { value: !0, label: "Read" },
13
+ { value: !1, label: "Unread" }
14
+ ], oe = ({ value: o, onChange: c }) => /* @__PURE__ */ n(
15
+ Y,
16
+ {
17
+ defaultValue: o,
18
+ options: ae,
19
+ onChange: c,
20
+ styles: {
21
+ menu: (s) => ({ ...s, zIndex: 10 }),
22
+ control: (s, f) => ({
23
+ ...s,
24
+ borderRadius: "24px",
25
+ borderColor: (f.isFocused, "#e5e7eb"),
26
+ boxShadow: "none",
27
+ minHeight: "42px",
28
+ "&:hover": {
29
+ borderColor: "#e5e7eb"
30
+ }
31
+ }),
32
+ valueContainer: (s) => ({
33
+ ...s,
34
+ padding: "0 16px"
35
+ }),
36
+ indicatorSeparator: () => ({
37
+ display: "none"
38
+ }),
39
+ dropdownIndicator: (s) => ({
40
+ ...s,
41
+ padding: "0 12px 0 0",
42
+ color: "#9ca3af"
43
+ })
44
+ }
45
+ }
46
+ ), ie = X(oe), y = `${z}/api/notification`, se = (o) => T.get(y, { params: { ...o } }), le = (o) => T.put(`${y}/${o}`), ce = () => T.put(`${y}/updateAllStatus`), re = {
47
+ currentPage: 1,
48
+ pageSize: 30,
49
+ searchString: "",
50
+ isRead: !1
51
+ }, de = "Notification list", B = "NOTIFICATION_CHANNEL", me = "NEW_NOTIFICATION", fe = () => {
52
+ const o = Q(), { roles: c } = ee(), r = g((a) => a.common.user), s = r?.id, f = r?.studentId, p = g(
53
+ (a) => a.notification.notificationList
54
+ ), u = g((a) => a.common.user?.pusherKey), b = g(
55
+ (a) => a.common.user?.pusherCluster
56
+ ), x = g(
57
+ (a) => a.notification.totalItems
58
+ ), w = g(
59
+ (a) => a.notification.unReadNotification
60
+ ), [t, h] = O(re), [N, d] = O(!1), $ = (a) => h({
61
+ ...t,
62
+ ...a
63
+ }), I = (a) => {
64
+ const { source: m, extraData: i } = a;
65
+ switch (m) {
66
+ case "AssessmentAssignment":
67
+ window.open(`/player/diagnosticsurvey/${Number(i)}`);
68
+ break;
69
+ case "NewConferenceCreated":
70
+ window.open(
71
+ `/start-conference/${JSON.parse(i)?.[0]}/${JSON.parse(i)?.[1]}/conferenceRubric`
72
+ );
73
+ break;
74
+ case "Class Reflection":
75
+ window.open(
76
+ `/start-reflection/${i?.replace(/[\[\]]/g, "")?.split(",")?.[1]}`
77
+ );
78
+ break;
79
+ case "Class Reflection Completed":
80
+ window.open(
81
+ `/result-reflection/${i?.replace(/[\[\]]/g, "")?.split(",")?.[1]}`
82
+ );
83
+ break;
84
+ case "External Reflection Completed":
85
+ window.open(
86
+ `/result-reflection/${JSON.parse(i)?.[0]}/external`
87
+ );
88
+ break;
89
+ case "NewSessionCreated":
90
+ window.open(
91
+ `/start-question/${JSON.parse(i)?.[0]}/${JSON.parse(i)?.[1]}`
92
+ );
93
+ break;
94
+ case "NewSessionComplete":
95
+ window.open(
96
+ `/start-question/${JSON.parse(i)?.[0]}/${JSON.parse(i)?.[1]}`
97
+ );
98
+ break;
99
+ case "ActionPointReminder":
100
+ window.open(
101
+ "/action-point/to-do"
102
+ );
103
+ break;
104
+ case "SendNotiPLP":
105
+ window.open(
106
+ "/personal-learning-plan"
107
+ );
108
+ break;
109
+ case "SendNotiGOAL":
110
+ window.open(
111
+ `/my-goals/${JSON.parse(i)}`
112
+ );
113
+ break;
114
+ case "CertificateApproved":
115
+ window.open("/dashboard/certification/2");
116
+ break;
117
+ case "RequestCheckIn":
118
+ window.open(
119
+ `/start-question/${JSON.parse(i)?.[0]}/${JSON.parse(i)?.[1]}`
120
+ );
121
+ case "NewSurveyCreated":
122
+ f && window.open(
123
+ `/start-survey/${JSON.parse(i)?.[0]}/${f}`
124
+ );
125
+ break;
126
+ case "StudentCompletedSurvey":
127
+ window.open(
128
+ `/start-survey/${JSON.parse(i)?.[0]}/${JSON.parse(i)?.[1]}`
129
+ );
130
+ break;
131
+ }
132
+ }, _ = k(async () => {
133
+ o(R(!0));
134
+ try {
135
+ const a = await se({ ...t, roles: c?.trim() ? [c] : r?.roles }), { items: m, totalItems: i } = a.data;
136
+ o(
137
+ U({
138
+ notificationList: m,
139
+ totalItems: i
140
+ })
141
+ );
142
+ } catch (a) {
143
+ o(
144
+ S({
145
+ type: "danger",
146
+ message: a.response?.data?.title || a.message
147
+ })
148
+ );
149
+ }
150
+ o(R(!1));
151
+ }, [t]);
152
+ P(() => {
153
+ document.title = de;
154
+ }, []), P(() => {
155
+ _();
156
+ let a;
157
+ const m = W({});
158
+ if (!!s && (m === "signalr" || !!u && !!b))
159
+ try {
160
+ a = new q(u || "signalr", { cluster: b }), a.subscribe(`${B}-${s}`).bind(me, _);
161
+ } catch (C) {
162
+ console.error("Failed to initialize RealtimeService:", C);
163
+ }
164
+ return () => {
165
+ if (a && s)
166
+ try {
167
+ a.unsubscribe(`${B}-${s}`), a.disconnect();
168
+ } catch (C) {
169
+ console.error("Failed to disconnect RealtimeService:", C);
170
+ }
171
+ };
172
+ }, [_, s, u, b]);
173
+ const F = k(
174
+ (a, m) => {
175
+ try {
176
+ o(
177
+ L({
178
+ isOpen: !0,
179
+ type: "warning",
180
+ message: `Do you want to mark this notification ${m ? "read" : "unread"}?`,
181
+ onConfirm: async () => {
182
+ await le(a), _();
183
+ }
184
+ })
185
+ );
186
+ } catch (i) {
187
+ o(
188
+ S({
189
+ type: "danger",
190
+ message: i.response?.data?.title || i.message
191
+ })
192
+ );
193
+ }
194
+ },
195
+ [p, w]
196
+ ), J = k(async () => {
197
+ try {
198
+ if (p.length === 0) throw new Error("There are no unread messages");
199
+ o(
200
+ L({
201
+ isOpen: !0,
202
+ type: "warning",
203
+ message: "Do you want to mark all notification ?",
204
+ onConfirm: async () => {
205
+ d(!0), await ce(), _(), d(!1);
206
+ }
207
+ })
208
+ );
209
+ } catch (a) {
210
+ o(
211
+ S({
212
+ type: "danger",
213
+ message: a.response?.data?.title || a.message
214
+ })
215
+ );
216
+ }
217
+ }, [p]);
218
+ return {
219
+ notificationList: p,
220
+ totalItems: x,
221
+ unReadNotification: w,
222
+ filters: t,
223
+ changeFilters: $,
224
+ updateNotification: F,
225
+ viewNotification: I,
226
+ updateAll: J,
227
+ toggleUpdateAllStatus: N
228
+ };
229
+ }, pe = "_container_1bf04_1", ue = "_header_1bf04_7", he = "_markAllBtn_1bf04_14", ge = "_markAllText_1bf04_21", be = "_markAllCheckbox_1bf04_27", Ne = "_filterContainer_1bf04_35", _e = "_filterLabel_1bf04_40", we = "_tableWrapper_1bf04_52", Ce = "_tableHead_1bf04_60", xe = "_thText_1bf04_69", $e = "_td_1bf04_73", Ie = "_rowText_1bf04_77", Se = "_rowTime_1bf04_82", ke = "_checkboxInput_1bf04_87", Te = "_actionBtn_1bf04_95", ye = "_iconContainer_1bf04_104", ve = "_iconGreen_1bf04_114", Ae = "_iconOrange_1bf04_118", Re = "_iconRed_1bf04_122", Le = "_iconYellow_1bf04_126", Oe = "_flagIcon_1bf04_140", Pe = "_flagIconRed_1bf04_145", Be = "_flagIconYellow_1bf04_149", Fe = "_tooltipContainer_1bf04_153", Je = "_tooltipText_1bf04_157", Ee = "_whiteTooltip_1bf04_163", He = "_redText_1bf04_173", e = {
230
+ container: pe,
231
+ header: ue,
232
+ markAllBtn: he,
233
+ markAllText: ge,
234
+ markAllCheckbox: be,
235
+ filterContainer: Ne,
236
+ filterLabel: _e,
237
+ tableWrapper: we,
238
+ tableHead: Ce,
239
+ thText: xe,
240
+ td: $e,
241
+ rowText: Ie,
242
+ rowTime: Se,
243
+ checkboxInput: ke,
244
+ actionBtn: Te,
245
+ iconContainer: ye,
246
+ iconGreen: ve,
247
+ iconOrange: Ae,
248
+ iconRed: Re,
249
+ iconYellow: Le,
250
+ "explain-icon": "_explain-icon_1bf04_134",
251
+ flagIcon: Oe,
252
+ flagIconRed: Pe,
253
+ flagIconYellow: Be,
254
+ tooltipContainer: Fe,
255
+ tooltipText: Je,
256
+ whiteTooltip: Ee,
257
+ redText: He
258
+ }, De = "Notifications", Ge = "/images/info-icon.png", Me = (o) => {
259
+ const c = (o.text || "").toLowerCase(), r = o.informaions?.[0]?.toLowerCase();
260
+ return c.includes("red flag") || r?.includes("red") ? /* @__PURE__ */ n("div", { className: `${e.iconContainer} ${e.iconRed}`, children: /* @__PURE__ */ n(
261
+ "img",
262
+ {
263
+ src: "/images/flag-icon.svg",
264
+ alt: "Red flag",
265
+ className: `${e.flagIcon} ${e.flagIconRed}`
266
+ }
267
+ ) }) : c.includes("yellow flag") || r?.includes("yellow") ? /* @__PURE__ */ n("div", { className: `${e.iconContainer} ${e.iconYellow}`, children: /* @__PURE__ */ n(
268
+ "img",
269
+ {
270
+ src: "/images/flag-icon.svg",
271
+ alt: "Yellow flag",
272
+ className: `${e.flagIcon} ${e.flagIconYellow}`
273
+ }
274
+ ) }) : c.includes("completed a check-in") || c.includes("completed a survey") || o.source === "NewSessionComplete" || o.source === "Class Reflection Completed" || o.source === "External Reflection Completed" ? /* @__PURE__ */ n("div", { className: `${e.iconContainer} ${e.iconGreen}`, children: /* @__PURE__ */ n(V, { color: "white", size: 18 }) }) : /* @__PURE__ */ n("div", { className: `${e.iconContainer} ${e.iconOrange}`, children: /* @__PURE__ */ n(ne, { color: "white", size: 18 }) });
275
+ }, Ke = () => {
276
+ const {
277
+ notificationList: o,
278
+ totalItems: c,
279
+ filters: r,
280
+ changeFilters: s,
281
+ updateNotification: f,
282
+ viewNotification: p,
283
+ updateAll: u,
284
+ toggleUpdateAllStatus: b
285
+ } = fe(), { t: x } = te(), w = (t, h, N) => {
286
+ if (typeof t != "string") return null;
287
+ const d = t.indexOf(" "), $ = d !== -1 ? t.substring(0, d) : t, I = d !== -1 ? t.substring(d + 1) : "";
288
+ return /* @__PURE__ */ l("div", { className: h !== N - 1 ? "mb-1" : "", children: [
289
+ /* @__PURE__ */ n("span", { className: `fw-bold ${e.redText}`, children: $ }),
290
+ " ",
291
+ I
292
+ ] }, h);
293
+ };
294
+ return /* @__PURE__ */ l("div", { className: `animated fadeIn ${e.container}`, children: [
295
+ /* @__PURE__ */ l("div", { className: "d-flex justify-content-between align-items-center mb-4", children: [
296
+ /* @__PURE__ */ n("h4", { className: e.header, children: De }),
297
+ /* @__PURE__ */ l("div", { className: "d-flex align-items-center", children: [
298
+ r.isRead === !1 && /* @__PURE__ */ l(
299
+ "div",
300
+ {
301
+ className: `d-flex align-items-center px-4 me-3 cursor-pointer ${e.markAllBtn}`,
302
+ onClick: () => u(),
303
+ children: [
304
+ /* @__PURE__ */ n("span", { className: `me-3 ${e.markAllText}`, children: "Mark all as read" }),
305
+ /* @__PURE__ */ n(
306
+ v,
307
+ {
308
+ checked: b,
309
+ type: "checkbox",
310
+ className: `m-0 position-relative cursor-pointer ${e.markAllCheckbox}`,
311
+ onChange: () => u(),
312
+ onClick: (t) => t.stopPropagation()
313
+ }
314
+ )
315
+ ]
316
+ }
317
+ ),
318
+ /* @__PURE__ */ l("div", { className: e.filterContainer, children: [
319
+ /* @__PURE__ */ n("span", { className: e.filterLabel, children: "Filter" }),
320
+ /* @__PURE__ */ n(
321
+ ie,
322
+ {
323
+ value: r.isRead,
324
+ onChange: (t) => s({ isRead: t.value })
325
+ }
326
+ )
327
+ ] })
328
+ ] })
329
+ ] }),
330
+ /* @__PURE__ */ l(E, { className: "mb-2", children: [
331
+ /* @__PURE__ */ n(A, { md: 12, children: o && o.length > 0 ? /* @__PURE__ */ n("div", { className: e.tableWrapper, children: /* @__PURE__ */ l(H, { borderless: !0, hover: !0, style: { margin: 0 }, children: [
332
+ /* @__PURE__ */ n("thead", { className: e.tableHead, children: /* @__PURE__ */ l("tr", { children: [
333
+ /* @__PURE__ */ n("th", { className: `align-middle ${e.th} ${e.thText}`, children: "Text" }),
334
+ /* @__PURE__ */ n("th", { className: `align-middle ${e.th}`, children: "Time" }),
335
+ /* @__PURE__ */ n("th", { className: `text-center align-middle ${e.th}`, children: "Is read" }),
336
+ /* @__PURE__ */ n("th", { className: `text-center align-middle ${e.th}`, children: "Go to session" })
337
+ ] }) }),
338
+ /* @__PURE__ */ n("tbody", { children: o.map((t, h) => /* @__PURE__ */ l("tr", { style: { borderBottom: h === o.length - 1 ? "none" : "1px solid #f3f4f6" }, children: [
339
+ /* @__PURE__ */ n("td", { className: `align-middle ${e.td}`, children: /* @__PURE__ */ l("div", { className: "d-flex align-items-center", children: [
340
+ Me(t),
341
+ /* @__PURE__ */ l("span", { className: `ms-3 ${e.rowText}`, children: [
342
+ t.text,
343
+ t.text?.toLowerCase().includes("flag") && /* @__PURE__ */ n(
344
+ "img",
345
+ {
346
+ id: `info-icon-${t.id}`,
347
+ src: Ge,
348
+ alt: "",
349
+ className: `ms-2 ${e["explain-icon"]}`
350
+ }
351
+ )
352
+ ] }),
353
+ t.text?.toLowerCase().includes("flag") && /* @__PURE__ */ n(
354
+ D,
355
+ {
356
+ placement: "bottom",
357
+ target: `info-icon-${t.id}`,
358
+ innerClassName: e.whiteTooltip,
359
+ offset: [0, 10],
360
+ children: /* @__PURE__ */ n("div", { className: `text-left p-1 ${e.tooltipContainer}`, children: /* @__PURE__ */ n("div", { className: e.tooltipText, children: t.informaions && t.informaions.length > 0 ? t.informaions.map((N, d) => w(N, d, t.informaions.length)) : "View session details to see metrics" }) })
361
+ }
362
+ )
363
+ ] }) }),
364
+ /* @__PURE__ */ n("td", { className: `align-middle ${e.td} ${e.rowTime}`, children: Z(t.time, "yyyy-MM-DD HH:mm") }),
365
+ /* @__PURE__ */ n("td", { className: `text-center align-middle ${e.td}`, children: /* @__PURE__ */ n(
366
+ v,
367
+ {
368
+ type: "checkbox",
369
+ className: `position-relative m-0 shadow-none ${e.checkboxInput}`,
370
+ checked: t.isRead,
371
+ onChange: () => f(
372
+ t.id,
373
+ !t.isRead
374
+ )
375
+ }
376
+ ) }),
377
+ /* @__PURE__ */ n("td", { className: `text-center align-middle ${e.td}`, children: [
378
+ "AssessmentAssignment",
379
+ "NewConferenceCreated",
380
+ "NewSessionCreated",
381
+ "CertificateApproved",
382
+ "Class Reflection",
383
+ "NewSessionComplete",
384
+ "ActionPointReminder",
385
+ "SendNotiPLP",
386
+ "SendNotiGOAL",
387
+ "Class Reflection Completed",
388
+ "External Reflection Completed",
389
+ "RequestCheckIn",
390
+ "NewSurveyCreated",
391
+ "StudentCompletedSurvey"
392
+ ].includes(t.source) && /* @__PURE__ */ n(
393
+ G,
394
+ {
395
+ outline: !0,
396
+ color: "secondary",
397
+ size: "sm",
398
+ className: e.actionBtn,
399
+ onClick: () => p(t),
400
+ children: "Go"
401
+ }
402
+ ) })
403
+ ] }, t.id)) })
404
+ ] }) }) : /* @__PURE__ */ n(j, { label: x("notification") }) }),
405
+ /* @__PURE__ */ n(A, { md: 12, className: "mt-4", children: /* @__PURE__ */ n(
406
+ K,
407
+ {
408
+ filters: r,
409
+ totalRecordCount: c,
410
+ changePageSize: (t) => s({ pageSize: t }),
411
+ changePage: (t) => s({ currentPage: t })
412
+ }
413
+ ) })
414
+ ] })
415
+ ] });
416
+ };
417
+ export {
418
+ Ke as default
419
+ };