mario-education 2.0.294-staging โ†’ 2.0.295-staging

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.
@@ -0,0 +1,436 @@
1
+ import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
+ import { F as R, u as M } from "./FlagTriggersEscalationView-zF-X_dpM.js";
3
+ import { Modal as $, ModalHeader as E, ModalBody as q, Row as w, Col as p, Input as b, ModalFooter as L, Button as T } from "reactstrap";
4
+ import { useTranslation as I, RequiredLabel as N, ErrorHandler as v } from "mario-core";
5
+ import { Formik as F } from "formik";
6
+ import { u as V, S as k } from "./useStateManager-7e1e8489.esm-C893Mq1u.js";
7
+ import { _ } from "./extends-hS2Bh-Yp.js";
8
+ import * as B from "react";
9
+ import { forwardRef as j } from "react";
10
+ import "@emotion/react";
11
+ import "react-dom";
12
+ import { i as K, a as x, A as P, s as t } from "./styles.module-DnvH4rBk.js";
13
+ import * as y from "yup";
14
+ import { B as W } from "./index-BaqPgnKF.js";
15
+ import { useNavigate as D } from "react-router-dom";
16
+ import { C as Q } from "./index-Ch2tU51H.js";
17
+ var Y = /* @__PURE__ */ j(function(n, a) {
18
+ var s = V(n);
19
+ return /* @__PURE__ */ B.createElement(k, _({
20
+ ref: a
21
+ }, s));
22
+ }), z = Y;
23
+ const O = y.object({
24
+ questionText: y.string().required("Question is required"),
25
+ text: y.string().required("Text is required"),
26
+ flag: y.string().required("Flag is required")
27
+ }), H = ({
28
+ header: n,
29
+ onConfirm: a,
30
+ questionAlertDetail: s,
31
+ onCancel: c
32
+ }) => {
33
+ const { t: o } = I();
34
+ return /* @__PURE__ */ e(
35
+ F,
36
+ {
37
+ initialValues: s ?? K,
38
+ enableReinitialize: !0,
39
+ validationSchema: O,
40
+ onSubmit: async (u, l) => {
41
+ await a(u), l.resetForm(), c();
42
+ },
43
+ children: (u) => {
44
+ const {
45
+ values: l,
46
+ touched: m,
47
+ errors: r,
48
+ handleSubmit: h,
49
+ setFieldValue: g
50
+ // handleChange
51
+ } = u;
52
+ return /* @__PURE__ */ i(
53
+ $,
54
+ {
55
+ isOpen: !!s,
56
+ toggle: () => c(null),
57
+ zIndex: 1201,
58
+ style: { marginTop: "8rem" },
59
+ children: [
60
+ /* @__PURE__ */ e(E, { children: n }),
61
+ /* @__PURE__ */ e(q, { children: /* @__PURE__ */ i(w, { className: "mb-2", children: [
62
+ /* @__PURE__ */ i(p, { md: 12, className: "mb-2", children: [
63
+ /* @__PURE__ */ e(N, { text: o("description") }),
64
+ /* @__PURE__ */ e(
65
+ b,
66
+ {
67
+ defaultValue: l.text,
68
+ onChange: (d) => {
69
+ g(
70
+ "text",
71
+ d.target?.value ?? ""
72
+ );
73
+ }
74
+ }
75
+ ),
76
+ m.text && r.text && /* @__PURE__ */ e(
77
+ v,
78
+ {
79
+ text: r.text
80
+ }
81
+ )
82
+ ] }),
83
+ /* @__PURE__ */ i(p, { md: 12, className: "mb-2", children: [
84
+ /* @__PURE__ */ e(N, { text: o("question") }),
85
+ /* @__PURE__ */ e(
86
+ b,
87
+ {
88
+ defaultValue: l.questionText,
89
+ onChange: (d) => {
90
+ g(
91
+ "questionText",
92
+ d.target?.value ?? ""
93
+ );
94
+ }
95
+ }
96
+ ),
97
+ m.questionText && r.questionText && /* @__PURE__ */ e(
98
+ v,
99
+ {
100
+ text: r.questionText
101
+ }
102
+ )
103
+ ] }),
104
+ /* @__PURE__ */ e(p, { md: 12, className: "mb-2", children: /* @__PURE__ */ i(w, { children: [
105
+ /* @__PURE__ */ i(p, { md: 6, className: "mb-2", children: [
106
+ /* @__PURE__ */ e(N, { text: o("from") }),
107
+ /* @__PURE__ */ e(
108
+ b,
109
+ {
110
+ type: "number",
111
+ defaultValue: l.from,
112
+ min: 0,
113
+ max: 100,
114
+ onChange: (d) => {
115
+ const f = parseInt(d.target.value, 10);
116
+ !isNaN(f) && f >= 0 && f <= 100 && g("from", f);
117
+ }
118
+ }
119
+ ),
120
+ m.from && r.from && /* @__PURE__ */ e(
121
+ v,
122
+ {
123
+ text: r.from
124
+ }
125
+ )
126
+ ] }),
127
+ /* @__PURE__ */ i(p, { md: 6, className: "mb-2", children: [
128
+ /* @__PURE__ */ e(N, { text: o("to") }),
129
+ /* @__PURE__ */ e(
130
+ b,
131
+ {
132
+ type: "number",
133
+ min: 0,
134
+ max: 100,
135
+ defaultValue: l.to,
136
+ onChange: (d) => {
137
+ const f = parseInt(d.target.value, 10);
138
+ !isNaN(f) && f >= 0 && f <= 100 && g("to", f);
139
+ }
140
+ }
141
+ ),
142
+ m.to && r.to && /* @__PURE__ */ e(
143
+ v,
144
+ {
145
+ text: r.to
146
+ }
147
+ )
148
+ ] })
149
+ ] }) }),
150
+ /* @__PURE__ */ e(p, { md: 12, className: "mb-2", children: /* @__PURE__ */ i(w, { children: [
151
+ /* @__PURE__ */ i(p, { md: 6, className: "mb-2", children: [
152
+ /* @__PURE__ */ e(N, { text: o("flag") }),
153
+ /* @__PURE__ */ e(
154
+ b,
155
+ {
156
+ defaultValue: l.flag,
157
+ onChange: (d) => {
158
+ g(
159
+ "flag",
160
+ d.target?.value
161
+ );
162
+ }
163
+ }
164
+ ),
165
+ m.flag && r.flag && /* @__PURE__ */ e(
166
+ v,
167
+ {
168
+ text: r.flag
169
+ }
170
+ )
171
+ ] }),
172
+ /* @__PURE__ */ i(p, { md: 6, className: "mb-2", children: [
173
+ /* @__PURE__ */ e(N, { text: o("type") }),
174
+ /* @__PURE__ */ e(
175
+ z,
176
+ {
177
+ options: x,
178
+ value: l.type == "Conference" || l.type == P.Conference ? x[1] : x[0],
179
+ onChange: (d) => g(
180
+ "type",
181
+ d?.value ?? x[0].value
182
+ ),
183
+ placeholder: "Select type"
184
+ }
185
+ ),
186
+ m.to && r.to && /* @__PURE__ */ e(
187
+ v,
188
+ {
189
+ text: r.to
190
+ }
191
+ )
192
+ ] })
193
+ ] }) })
194
+ ] }) }),
195
+ /* @__PURE__ */ i(L, { className: "text-right", children: [
196
+ a && /* @__PURE__ */ e(
197
+ T,
198
+ {
199
+ color: "primary",
200
+ onClick: () => h(),
201
+ children: o("confirm")
202
+ }
203
+ ),
204
+ /* @__PURE__ */ e(T, { onClick: () => c(null), children: o("cancel") })
205
+ ] })
206
+ ]
207
+ }
208
+ );
209
+ }
210
+ }
211
+ );
212
+ }, A = {
213
+ danger: t.badgeDanger,
214
+ warning: t.badgeWarning,
215
+ concern: t.badgeConcern,
216
+ safe: t.badgeSafe,
217
+ great: t.badgeGreat
218
+ }, G = [
219
+ "danger",
220
+ "warning",
221
+ "concern",
222
+ "safe",
223
+ "great"
224
+ ], U = [
225
+ "great",
226
+ "safe",
227
+ "concern",
228
+ "warning",
229
+ "danger"
230
+ ], S = (n, a, s) => Math.min(Math.max(n, a), s), J = (n) => {
231
+ if (n == null) return -1;
232
+ const a = S(n, 0, 100);
233
+ return Math.min(Math.floor(a / 20), 4);
234
+ }, X = (n) => {
235
+ if (n == null) return -1;
236
+ const a = S(n, -100, 100), s = (a + 100) / 40, c = a >= 20 ? Math.floor(s) : Math.ceil(s) - 1;
237
+ return S(c, 0, 4);
238
+ }, C = (n, a, s) => s < 0 || !n?.length ? null : {
239
+ label: n[s] ?? "",
240
+ variant: a[s] ?? "concern"
241
+ }, Z = ({
242
+ notifications: n,
243
+ flag: a
244
+ }) => {
245
+ const { t: s } = I(), c = a?.flag?.toLowerCase()?.includes("red"), o = D(), u = C(
246
+ a.safetyAnswers,
247
+ G,
248
+ J(a.safetyThreshold)
249
+ ), l = C(
250
+ a.stressAnswers,
251
+ U,
252
+ X(a.stressThreshold)
253
+ ), m = (h) => {
254
+ o(`/admin/custom-alert/edit/${h}`);
255
+ }, r = Array.isArray(a.activeKpis) ? a.activeKpis.map((h) => String(h).trim()).filter(Boolean) : typeof a.activeKpis == "string" ? a.activeKpis.split(",").map((h) => h.trim()).filter(Boolean) : [];
256
+ return /* @__PURE__ */ i(
257
+ "div",
258
+ {
259
+ className: `${t.card} ${c ? t.cardRed : t.cardYellow}`,
260
+ children: [
261
+ /* @__PURE__ */ i("div", { className: "d-flex justify-content-between align-items-start mb-3", children: [
262
+ /* @__PURE__ */ i("div", { className: "d-flex", children: [
263
+ /* @__PURE__ */ e(
264
+ "img",
265
+ {
266
+ src: "/images/flag-icon.svg",
267
+ alt: "flag",
268
+ className: `${t.icon} ${c ? t.iconRed : t.iconYellow}`
269
+ }
270
+ ),
271
+ /* @__PURE__ */ i("div", { children: [
272
+ /* @__PURE__ */ e(
273
+ "div",
274
+ {
275
+ className: `${t.cardTitle} ${c ? t.cardTitleRed : t.cardTitleYellow}`,
276
+ children: a.flag
277
+ }
278
+ ),
279
+ /* @__PURE__ */ e("div", { className: t.cardSubtitle, children: a.text })
280
+ ] })
281
+ ] }),
282
+ /* @__PURE__ */ i(
283
+ T,
284
+ {
285
+ size: "sm",
286
+ outline: !0,
287
+ color: "secondary",
288
+ onClick: () => a.id && m(a.id),
289
+ className: t.editBtn,
290
+ children: [
291
+ /* @__PURE__ */ e(W, { className: t.editBtnIcon }),
292
+ s("edit")
293
+ ]
294
+ }
295
+ )
296
+ ] }),
297
+ /* @__PURE__ */ i("div", { className: "mb-5", children: [
298
+ /* @__PURE__ */ e("div", { className: t.sectionLabel, children: s("metrics") }),
299
+ /* @__PURE__ */ i("div", { className: t.metricList, children: [
300
+ /* @__PURE__ */ i(
301
+ "div",
302
+ {
303
+ className: `d-flex justify-content-between align-items-start ${t.metricRow}`,
304
+ children: [
305
+ /* @__PURE__ */ i("div", { className: t.metricLeft, children: [
306
+ /* @__PURE__ */ e("span", { className: t.metricName, children: "Safety Threshold" }),
307
+ u && /* @__PURE__ */ e(
308
+ "span",
309
+ {
310
+ className: `${t.badge} ${A[u.variant]}`,
311
+ children: u.label
312
+ }
313
+ )
314
+ ] }),
315
+ /* @__PURE__ */ e("span", { className: t.threshold, children: `< ${a.safetyThreshold}` })
316
+ ]
317
+ }
318
+ ),
319
+ /* @__PURE__ */ i(
320
+ "div",
321
+ {
322
+ className: `d-flex justify-content-between align-items-start ${t.metricRow}`,
323
+ children: [
324
+ /* @__PURE__ */ i("div", { className: t.metricLeft, children: [
325
+ /* @__PURE__ */ e("span", { className: t.metricName, children: "Stress Threshold" }),
326
+ l && /* @__PURE__ */ e(
327
+ "span",
328
+ {
329
+ className: `${t.badge} ${A[l.variant]}`,
330
+ children: l.label
331
+ }
332
+ )
333
+ ] }),
334
+ /* @__PURE__ */ e("span", { className: t.threshold, children: `> ${a.stressThreshold}` })
335
+ ]
336
+ }
337
+ ),
338
+ /* @__PURE__ */ i(
339
+ "div",
340
+ {
341
+ className: `d-flex justify-content-between align-items-start ${t.metricRow}`,
342
+ children: [
343
+ /* @__PURE__ */ e("div", { className: t.metricLeft, children: /* @__PURE__ */ e("span", { className: t.metricName, children: "Percentage Decrease of any metric" }) }),
344
+ /* @__PURE__ */ e("span", { className: t.threshold, children: a.decreaseInAnyMetric })
345
+ ]
346
+ }
347
+ )
348
+ ] })
349
+ ] }),
350
+ r.length > 0 && /* @__PURE__ */ i("div", { className: "mb-3", children: [
351
+ /* @__PURE__ */ e(
352
+ "div",
353
+ {
354
+ className: `${t.sectionLabel} ${t.sectionLabelKpi}`,
355
+ children: "Monitored KPIs"
356
+ }
357
+ ),
358
+ /* @__PURE__ */ e("div", { className: "d-flex flex-wrap", children: r.map((h) => /* @__PURE__ */ e("span", { className: t.kpiPill, children: h }, h)) })
359
+ ] }),
360
+ n && /* @__PURE__ */ i("div", { className: t.sectionNotification, children: [
361
+ /* @__PURE__ */ e("div", { className: `${t.sectionLabel} mb-1`, children: "Notifications" }),
362
+ /* @__PURE__ */ i("div", { className: t.notificationRow, children: [
363
+ /* @__PURE__ */ e("span", { children: "Recipients:" }),
364
+ " ",
365
+ a.recipientRoles
366
+ ] }),
367
+ /* @__PURE__ */ i("div", { className: t.notificationRow, children: [
368
+ /* @__PURE__ */ e("span", { children: "Methods:" }),
369
+ " ",
370
+ a.isInAppNotification ? "In-App" : "",
371
+ a.isInAppNotification && a.isEmailNotification ? ", " : "",
372
+ a.isEmailNotification ? "Email" : ""
373
+ ] })
374
+ ] })
375
+ ]
376
+ }
377
+ );
378
+ }, ee = {
379
+ recipients: ["Educator", "Counselor", "Admin"],
380
+ methods: ["In-App", "Email"]
381
+ }, pe = () => {
382
+ if (!(new URLSearchParams(window.location.search).get("legacy") === "true"))
383
+ return /* @__PURE__ */ e(R, {});
384
+ const { t: s } = I(), {
385
+ model: c,
386
+ setModel: o,
387
+ createAlert: u,
388
+ updateAlert: l,
389
+ flags: m
390
+ } = M();
391
+ return /* @__PURE__ */ i("div", { className: "fadeIn animated", children: [
392
+ /* @__PURE__ */ e(
393
+ H,
394
+ {
395
+ header: c?.id ? s("edit_custom_alert") : s("create_custom_alert"),
396
+ confirmText: c?.id ? s("update") : s("create"),
397
+ onConfirm: c?.id ? l : u,
398
+ onCancel: () => o(null),
399
+ questionAlertDetail: c,
400
+ edited: !0,
401
+ setEdited: () => {
402
+ }
403
+ }
404
+ ),
405
+ /* @__PURE__ */ e("h5", { className: t.title, children: "Flag System Configuration" }),
406
+ /* @__PURE__ */ e("p", { className: t.pageSubtitle, children: "Manage your red and yellow flag settings, including trigger conditions, metrics, and notification preferences." }),
407
+ /* @__PURE__ */ i("div", { className: t.howItWorks, children: [
408
+ /* @__PURE__ */ i("div", { className: t.howItWorksTitle, children: [
409
+ /* @__PURE__ */ e(Q, { className: t.howItWorksInfoIcon }),
410
+ " How It Works"
411
+ ] }),
412
+ /* @__PURE__ */ i("ul", { className: t.howItWorksList, children: [
413
+ /* @__PURE__ */ i("li", { children: [
414
+ /* @__PURE__ */ e("strong", { children: "Red Flags" }),
415
+ " indicate critical issues requiring immediate attention"
416
+ ] }),
417
+ /* @__PURE__ */ i("li", { children: [
418
+ /* @__PURE__ */ e("strong", { children: "Yellow Flags" }),
419
+ " serve as an early warning signs for potential concerns"
420
+ ] }),
421
+ /* @__PURE__ */ e("li", { children: "Click the Edit button on any flag to configure its settings" }),
422
+ /* @__PURE__ */ e("li", { children: "Notifications will be sent based on your selected recipients and methods" })
423
+ ] })
424
+ ] }),
425
+ /* @__PURE__ */ e(w, { children: m.map((r) => /* @__PURE__ */ e(p, { md: 6, className: "mb-3", children: /* @__PURE__ */ e(
426
+ Z,
427
+ {
428
+ flag: r,
429
+ notifications: ee
430
+ }
431
+ ) })) })
432
+ ] });
433
+ };
434
+ export {
435
+ pe as default
436
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("./FlagTriggersEscalationView-7N3myKf3.cjs"),n=require("reactstrap"),o=require("mario-core"),q=require("formik"),N=require("./useStateManager-7e1e8489.esm-CT_lBj6S.cjs"),C=require("./extends-GhUDsoav.cjs"),T=require("react");require("@emotion/react");require("react-dom");const s=require("./styles.module-ClTu2C4O.cjs"),S=require("yup"),R=require("./index-C2Pc6kJF.cjs"),I=require("react-router-dom"),A=require("./index-Ct5zFKu6.cjs");function w(i){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const a in i)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(i,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:()=>i[a]})}}return t.default=i,Object.freeze(t)}const E=w(T),g=w(S);var M=T.forwardRef(function(i,t){var a=N.useStateManager(i);return E.createElement(N.Select,C._extends({ref:t},a))}),$=M;const L=g.object({questionText:g.string().required("Question is required"),text:g.string().required("Text is required"),flag:g.string().required("Flag is required")}),_=({header:i,onConfirm:t,questionAlertDetail:a,onCancel:r})=>{const{t:d}=o.useTranslation();return e.jsx(q.Formik,{initialValues:a??s.initQuestionAlert,enableReinitialize:!0,validationSchema:L,onSubmit:async(h,c)=>{await t(h),c.resetForm(),r()},children:h=>{const{values:c,touched:u,errors:l,handleSubmit:x,setFieldValue:y}=h;return e.jsxs(n.Modal,{isOpen:!!a,toggle:()=>r(null),zIndex:1201,style:{marginTop:"8rem"},children:[e.jsx(n.ModalHeader,{children:i}),e.jsx(n.ModalBody,{children:e.jsxs(n.Row,{className:"mb-2",children:[e.jsxs(n.Col,{md:12,className:"mb-2",children:[e.jsx(o.RequiredLabel,{text:d("description")}),e.jsx(n.Input,{defaultValue:c.text,onChange:m=>{y("text",m.target?.value??"")}}),u.text&&l.text&&e.jsx(o.ErrorHandler,{text:l.text})]}),e.jsxs(n.Col,{md:12,className:"mb-2",children:[e.jsx(o.RequiredLabel,{text:d("question")}),e.jsx(n.Input,{defaultValue:c.questionText,onChange:m=>{y("questionText",m.target?.value??"")}}),u.questionText&&l.questionText&&e.jsx(o.ErrorHandler,{text:l.questionText})]}),e.jsx(n.Col,{md:12,className:"mb-2",children:e.jsxs(n.Row,{children:[e.jsxs(n.Col,{md:6,className:"mb-2",children:[e.jsx(o.RequiredLabel,{text:d("from")}),e.jsx(n.Input,{type:"number",defaultValue:c.from,min:0,max:100,onChange:m=>{const j=parseInt(m.target.value,10);!isNaN(j)&&j>=0&&j<=100&&y("from",j)}}),u.from&&l.from&&e.jsx(o.ErrorHandler,{text:l.from})]}),e.jsxs(n.Col,{md:6,className:"mb-2",children:[e.jsx(o.RequiredLabel,{text:d("to")}),e.jsx(n.Input,{type:"number",min:0,max:100,defaultValue:c.to,onChange:m=>{const j=parseInt(m.target.value,10);!isNaN(j)&&j>=0&&j<=100&&y("to",j)}}),u.to&&l.to&&e.jsx(o.ErrorHandler,{text:l.to})]})]})}),e.jsx(n.Col,{md:12,className:"mb-2",children:e.jsxs(n.Row,{children:[e.jsxs(n.Col,{md:6,className:"mb-2",children:[e.jsx(o.RequiredLabel,{text:d("flag")}),e.jsx(n.Input,{defaultValue:c.flag,onChange:m=>{y("flag",m.target?.value)}}),u.flag&&l.flag&&e.jsx(o.ErrorHandler,{text:l.flag})]}),e.jsxs(n.Col,{md:6,className:"mb-2",children:[e.jsx(o.RequiredLabel,{text:d("type")}),e.jsx($,{options:s.alertTypeOptions,value:c.type=="Conference"||c.type==s.AlertType.Conference?s.alertTypeOptions[1]:s.alertTypeOptions[0],onChange:m=>y("type",m?.value??s.alertTypeOptions[0].value),placeholder:"Select type"}),u.to&&l.to&&e.jsx(o.ErrorHandler,{text:l.to})]})]})})]})}),e.jsxs(n.ModalFooter,{className:"text-right",children:[t&&e.jsx(n.Button,{color:"primary",onClick:()=>x(),children:d("confirm")}),e.jsx(n.Button,{onClick:()=>r(null),children:d("cancel")})]})]})}})},b={danger:s.styles.badgeDanger,warning:s.styles.badgeWarning,concern:s.styles.badgeConcern,safe:s.styles.badgeSafe,great:s.styles.badgeGreat},F=["danger","warning","concern","safe","great"],k=["great","safe","concern","warning","danger"],p=(i,t,a)=>Math.min(Math.max(i,t),a),O=i=>{if(i==null)return-1;const t=p(i,0,100);return Math.min(Math.floor(t/20),4)},V=i=>{if(i==null)return-1;const t=p(i,-100,100),a=(t+100)/40,r=t>=20?Math.floor(a):Math.ceil(a)-1;return p(r,0,4)},v=(i,t,a)=>a<0||!i?.length?null:{label:i[a]??"",variant:t[a]??"concern"},B=({notifications:i,flag:t})=>{const{t:a}=o.useTranslation(),r=t?.flag?.toLowerCase()?.includes("red"),d=I.useNavigate(),h=v(t.safetyAnswers,F,O(t.safetyThreshold)),c=v(t.stressAnswers,k,V(t.stressThreshold)),u=x=>{d(`/admin/custom-alert/edit/${x}`)},l=Array.isArray(t.activeKpis)?t.activeKpis.map(x=>String(x).trim()).filter(Boolean):typeof t.activeKpis=="string"?t.activeKpis.split(",").map(x=>x.trim()).filter(Boolean):[];return e.jsxs("div",{className:`${s.styles.card} ${r?s.styles.cardRed:s.styles.cardYellow}`,children:[e.jsxs("div",{className:"d-flex justify-content-between align-items-start mb-3",children:[e.jsxs("div",{className:"d-flex",children:[e.jsx("img",{src:"/images/flag-icon.svg",alt:"flag",className:`${s.styles.icon} ${r?s.styles.iconRed:s.styles.iconYellow}`}),e.jsxs("div",{children:[e.jsx("div",{className:`${s.styles.cardTitle} ${r?s.styles.cardTitleRed:s.styles.cardTitleYellow}`,children:t.flag}),e.jsx("div",{className:s.styles.cardSubtitle,children:t.text})]})]}),e.jsxs(n.Button,{size:"sm",outline:!0,color:"secondary",onClick:()=>t.id&&u(t.id),className:s.styles.editBtn,children:[e.jsx(R.BiEdit,{className:s.styles.editBtnIcon}),a("edit")]})]}),e.jsxs("div",{className:"mb-5",children:[e.jsx("div",{className:s.styles.sectionLabel,children:a("metrics")}),e.jsxs("div",{className:s.styles.metricList,children:[e.jsxs("div",{className:`d-flex justify-content-between align-items-start ${s.styles.metricRow}`,children:[e.jsxs("div",{className:s.styles.metricLeft,children:[e.jsx("span",{className:s.styles.metricName,children:"Safety Threshold"}),h&&e.jsx("span",{className:`${s.styles.badge} ${b[h.variant]}`,children:h.label})]}),e.jsx("span",{className:s.styles.threshold,children:`< ${t.safetyThreshold}`})]}),e.jsxs("div",{className:`d-flex justify-content-between align-items-start ${s.styles.metricRow}`,children:[e.jsxs("div",{className:s.styles.metricLeft,children:[e.jsx("span",{className:s.styles.metricName,children:"Stress Threshold"}),c&&e.jsx("span",{className:`${s.styles.badge} ${b[c.variant]}`,children:c.label})]}),e.jsx("span",{className:s.styles.threshold,children:`> ${t.stressThreshold}`})]}),e.jsxs("div",{className:`d-flex justify-content-between align-items-start ${s.styles.metricRow}`,children:[e.jsx("div",{className:s.styles.metricLeft,children:e.jsx("span",{className:s.styles.metricName,children:"Percentage Decrease of any metric"})}),e.jsx("span",{className:s.styles.threshold,children:t.decreaseInAnyMetric})]})]})]}),l.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:`${s.styles.sectionLabel} ${s.styles.sectionLabelKpi}`,children:"Monitored KPIs"}),e.jsx("div",{className:"d-flex flex-wrap",children:l.map(x=>e.jsx("span",{className:s.styles.kpiPill,children:x},x))})]}),i&&e.jsxs("div",{className:s.styles.sectionNotification,children:[e.jsx("div",{className:`${s.styles.sectionLabel} mb-1`,children:"Notifications"}),e.jsxs("div",{className:s.styles.notificationRow,children:[e.jsx("span",{children:"Recipients:"})," ",t.recipientRoles]}),e.jsxs("div",{className:s.styles.notificationRow,children:[e.jsx("span",{children:"Methods:"})," ",t.isInAppNotification?"In-App":"",t.isInAppNotification&&t.isEmailNotification?", ":"",t.isEmailNotification?"Email":""]})]})]})},P={recipients:["Educator","Counselor","Admin"],methods:["In-App","Email"]},D=()=>{if(!(new URLSearchParams(window.location.search).get("legacy")==="true"))return e.jsx(f.FlagTriggersEscalationView,{});const{t:a}=o.useTranslation(),{model:r,setModel:d,createAlert:h,updateAlert:c,flags:u}=f.useQuestionAlert();return e.jsxs("div",{className:"fadeIn animated",children:[e.jsx(_,{header:r?.id?a("edit_custom_alert"):a("create_custom_alert"),confirmText:r?.id?a("update"):a("create"),onConfirm:r?.id?c:h,onCancel:()=>d(null),questionAlertDetail:r,edited:!0,setEdited:()=>{}}),e.jsx("h5",{className:s.styles.title,children:"Flag System Configuration"}),e.jsx("p",{className:s.styles.pageSubtitle,children:"Manage your red and yellow flag settings, including trigger conditions, metrics, and notification preferences."}),e.jsxs("div",{className:s.styles.howItWorks,children:[e.jsxs("div",{className:s.styles.howItWorksTitle,children:[e.jsx(A.CiCircleInfo,{className:s.styles.howItWorksInfoIcon})," How It Works"]}),e.jsxs("ul",{className:s.styles.howItWorksList,children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Red Flags"})," indicate critical issues requiring immediate attention"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Yellow Flags"})," serve as an early warning signs for potential concerns"]}),e.jsx("li",{children:"Click the Edit button on any flag to configure its settings"}),e.jsx("li",{children:"Notifications will be sent based on your selected recipients and methods"})]})]}),e.jsx(n.Row,{children:u.map(l=>e.jsx(n.Col,{md:6,className:"mb-3",children:e.jsx(B,{flag:l,notifications:P})}))})]})};exports.default=D;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),P=require("./WrapperWorkspace-By45k19Q.cjs"),l=require("react"),h=require("react-router-dom"),j=require("react-redux"),C=require("./constants-Y_C_gYKV.cjs"),y=require("./FlagTriggersEscalationView-7N3myKf3.cjs"),q=()=>{const s=h.useNavigate(),u=h.useLocation(),r=new URLSearchParams(u.search).get("type")==="elementary",i=l.useRef(null),e=j.useSelector(t=>t.common?.user),n=e?.hasEsSchool!==!1,{msRoles:w,esRoles:A}=l.useMemo(()=>C.getAccessibleRoles(e?.appType,e?.msRoles,e?.esRoles),[e?.appType,e?.msRoles,e?.esRoles]),p=e?.appTypeRaw??e?.appType??"",E=p.toUpperCase().includes("MS"),R=p.toUpperCase().includes("ES"),m=e?.roles?.includes("Admin"),c=w.includes("Admin")||m&&E,o=n&&(A.includes("Admin")||m&&R),S=n&&o&&c,f=n&&o&&!c,g=!n||c&&!o;l.useEffect(()=>{if(r&&(!n||!o)){s("/admin/custom-alert",{replace:!0});return}r||(g?s("/admin/custom-alert",{replace:!0}):f&&s("?type=elementary",{replace:!0}))},[r,n,o,g,f,s]),l.useEffect(()=>{if(r&&i.current){const t=i.current.closest('div[class*="container-fluid"]')||i.current.parentElement;if(t){const T=t.style.padding;return t.style.setProperty("padding","0","important"),()=>{t.style.padding=T}}}return()=>{}},[r]);const b=r&&n&&o,x=l.useMemo(()=>{const t=[];return n&&o&&t.push({title:"Elementary / Primary",description:"Ages 7-11 ยท Grades 2-5 / Years 3-6",icon:"๐Ÿ“˜",items:["Educator Email Notification","Alerts Thresholds"],buttonLabel:"Configure Alerts โ†’",buttonColor:"#316CD9",onAction:()=>s("?type=elementary")}),c&&t.push({title:"Middle & High / Secondary",description:"Ages 11-18 ยท Grades 6-12 / Years 7-13",icon:"๐Ÿ”ฎ",items:["Educator Email Notification","Alerts Thresholds"],buttonLabel:"Configure Alerts โ†’",buttonColor:"#9333ea",onAction:()=>{s("/admin/custom-alert"),window.location.pathname.includes("custom-alert-wrapper")&&s("/admin/custom-alert-wrapper?type=secondary")}}),t},[n,o,c,s]);return{showIframe:b,iframeRef:i,isBothAdmin:S,workspaces:x,iframeSrc:`${window.location.origin}/es/admin/custom-alert?fullsize=true`}},v=()=>{const{showIframe:s,iframeRef:u,iframeSrc:d,workspaces:r}=q();return s?a.jsx("iframe",{ref:u,src:d,style:{width:"100%",height:"100%",border:"none",display:"block"},title:"Elementary Custom Alert"}):new URLSearchParams(window.location.search).get("type")==="secondary"?a.jsx(y.FlagTriggersEscalationView,{}):r.length===0?a.jsx(y.FlagTriggersEscalationView,{}):a.jsx(P.WrapperWorkspace,{title:"Alert & Notification Settings",description:"Select the school level to configure thresholds and workflows.",workspaces:r,warningIcon:a.jsx("span",{style:{fontSize:"16px"},children:"๐Ÿ”"}),warningBg:"#eff6ff",warningBorder:"#dbeafe",warningColor:"#1e40af",warning:a.jsxs("span",{children:[a.jsx("strong",{children:"Student-driven alerts only."})," Every notification is triggered exclusively by real student check-in responses โ€” no assumptions, no automation. Alerts surface genuine signals so your team can respond with confidence and care."]})})};exports.default=v;
@@ -0,0 +1,90 @@
1
+ import { jsx as a, jsxs as T } from "react/jsx-runtime";
2
+ import { W as v } from "./WrapperWorkspace-DwmBBmJ5.js";
3
+ import { useRef as k, useMemo as h, useEffect as g } from "react";
4
+ import { useNavigate as M, useLocation as x } from "react-router-dom";
5
+ import { useSelector as L } from "react-redux";
6
+ import { g as U } from "./constants-CFtuTn5q.js";
7
+ import { F as y } from "./FlagTriggersEscalationView-zF-X_dpM.js";
8
+ const W = () => {
9
+ const s = M(), l = x(), r = new URLSearchParams(l.search).get("type") === "elementary", i = k(null), e = L((t) => t.common?.user), n = e?.hasEsSchool !== !1, { msRoles: w, esRoles: A } = h(
10
+ () => U(e?.appType, e?.msRoles, e?.esRoles),
11
+ [e?.appType, e?.msRoles, e?.esRoles]
12
+ ), m = e?.appTypeRaw ?? e?.appType ?? "", E = m.toUpperCase().includes("MS"), S = m.toUpperCase().includes("ES"), d = e?.roles?.includes("Admin"), c = w.includes("Admin") || d && E, o = n && (A.includes("Admin") || d && S), R = n && o && c, u = n && o && !c, f = !n || c && !o;
13
+ g(() => {
14
+ if (r && (!n || !o)) {
15
+ s("/admin/custom-alert", { replace: !0 });
16
+ return;
17
+ }
18
+ r || (f ? s("/admin/custom-alert", { replace: !0 }) : u && s("?type=elementary", { replace: !0 }));
19
+ }, [r, n, o, f, u, s]), g(() => {
20
+ if (r && i.current) {
21
+ const t = i.current.closest('div[class*="container-fluid"]') || i.current.parentElement;
22
+ if (t) {
23
+ const P = t.style.padding;
24
+ return t.style.setProperty("padding", "0", "important"), () => {
25
+ t.style.padding = P;
26
+ };
27
+ }
28
+ }
29
+ return () => {
30
+ };
31
+ }, [r]);
32
+ const b = r && n && o, C = h(() => {
33
+ const t = [];
34
+ return n && o && t.push({
35
+ title: "Elementary / Primary",
36
+ description: "Ages 7-11 ยท Grades 2-5 / Years 3-6",
37
+ icon: "๐Ÿ“˜",
38
+ items: ["Educator Email Notification", "Alerts Thresholds"],
39
+ buttonLabel: "Configure Alerts โ†’",
40
+ buttonColor: "#316CD9",
41
+ onAction: () => s("?type=elementary")
42
+ }), c && t.push({
43
+ title: "Middle & High / Secondary",
44
+ description: "Ages 11-18 ยท Grades 6-12 / Years 7-13",
45
+ icon: "๐Ÿ”ฎ",
46
+ items: ["Educator Email Notification", "Alerts Thresholds"],
47
+ buttonLabel: "Configure Alerts โ†’",
48
+ buttonColor: "#9333ea",
49
+ onAction: () => {
50
+ s("/admin/custom-alert"), window.location.pathname.includes("custom-alert-wrapper") && s("/admin/custom-alert-wrapper?type=secondary");
51
+ }
52
+ }), t;
53
+ }, [n, o, c, s]);
54
+ return {
55
+ showIframe: b,
56
+ iframeRef: i,
57
+ isBothAdmin: R,
58
+ workspaces: C,
59
+ iframeSrc: `${window.location.origin}/es/admin/custom-alert?fullsize=true`
60
+ };
61
+ }, O = () => {
62
+ const { showIframe: s, iframeRef: l, iframeSrc: p, workspaces: r } = W();
63
+ return s ? /* @__PURE__ */ a(
64
+ "iframe",
65
+ {
66
+ ref: l,
67
+ src: p,
68
+ style: { width: "100%", height: "100%", border: "none", display: "block" },
69
+ title: "Elementary Custom Alert"
70
+ }
71
+ ) : new URLSearchParams(window.location.search).get("type") === "secondary" ? /* @__PURE__ */ a(y, {}) : r.length === 0 ? /* @__PURE__ */ a(y, {}) : /* @__PURE__ */ a(
72
+ v,
73
+ {
74
+ title: "Alert & Notification Settings",
75
+ description: "Select the school level to configure thresholds and workflows.",
76
+ workspaces: r,
77
+ warningIcon: /* @__PURE__ */ a("span", { style: { fontSize: "16px" }, children: "๐Ÿ”" }),
78
+ warningBg: "#eff6ff",
79
+ warningBorder: "#dbeafe",
80
+ warningColor: "#1e40af",
81
+ warning: /* @__PURE__ */ T("span", { children: [
82
+ /* @__PURE__ */ a("strong", { children: "Student-driven alerts only." }),
83
+ " Every notification is triggered exclusively by real student check-in responses โ€” no assumptions, no automation. Alerts surface genuine signals so your team can respond with confidence and care."
84
+ ] })
85
+ }
86
+ );
87
+ };
88
+ export {
89
+ O as default
90
+ };