@ssgc/alert-console 2.3.3 → 2.3.4
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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +888 -881
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { useContext as Ms, useMemo as
|
|
4
|
-
import { Select as ve, Table as Nt, Row as Ae, Col as G, Input as Us, Tag as
|
|
5
|
-
import { MessageOutlined as Qs, MailOutlined as Hs, MoreOutlined as Gs,
|
|
6
|
-
import { toast as
|
|
7
|
-
const
|
|
8
|
-
critical:
|
|
9
|
-
high:
|
|
10
|
-
medium:
|
|
11
|
-
low:
|
|
1
|
+
import { jsx as i, jsxs as d, Fragment as Ps } from "react/jsx-runtime";
|
|
2
|
+
import * as fe from "react";
|
|
3
|
+
import { useContext as Ms, useMemo as de, createContext as Ds, useState as w, useEffect as ue, forwardRef as ls, createElement as mt, useRef as Fs } from "react";
|
|
4
|
+
import { Select as ve, Table as Nt, Row as Ae, Col as G, Input as Us, Tag as We, Space as Ie, Tooltip as Ls, Button as Se, Progress as $s, Dropdown as Bs, Typography as Ye, Spin as xt, Checkbox as qe, Divider as Ge, TimePicker as $t, Tabs as Ct, Card as dt, Steps as js, Modal as _s, Carousel as qs } from "antd";
|
|
5
|
+
import { MessageOutlined as Qs, MailOutlined as Hs, MoreOutlined as Gs, PlusOutlined as Ws, EditOutlined as Ks, LeftOutlined as Ys, RightOutlined as zs } from "@ant-design/icons";
|
|
6
|
+
import { toast as ge } from "react-toastify";
|
|
7
|
+
const Vs = "#FF3B30", Js = "#FF9500", Zs = "#FFCC00", Xs = "#34C759", Ve = {
|
|
8
|
+
critical: Vs,
|
|
9
|
+
high: Js,
|
|
10
|
+
medium: Zs,
|
|
11
|
+
low: Xs
|
|
12
12
|
}, Bt = {
|
|
13
|
-
Critical:
|
|
14
|
-
High:
|
|
15
|
-
Medium:
|
|
16
|
-
Low:
|
|
13
|
+
Critical: Ve.critical,
|
|
14
|
+
High: Ve.high,
|
|
15
|
+
Medium: Ve.medium,
|
|
16
|
+
Low: Ve.low
|
|
17
17
|
};
|
|
18
|
-
function
|
|
18
|
+
function er(e) {
|
|
19
19
|
return Bt[e] || Bt.Low;
|
|
20
20
|
}
|
|
21
21
|
function jt(e) {
|
|
22
22
|
if (!e || typeof e != "string") return 0;
|
|
23
23
|
const t = e.trim().split(":");
|
|
24
24
|
if (t.length !== 3) return 0;
|
|
25
|
-
const [s, r, n] = t, a = Number.parseInt(s, 10), o = Number.parseInt(r, 10), l = Number.parseFloat(n || "0"),
|
|
26
|
-
return
|
|
25
|
+
const [s, r, n] = t, a = Number.parseInt(s, 10), o = Number.parseInt(r, 10), l = Number.parseFloat(n || "0"), h = Number.isFinite(a) ? a : 0, u = Number.isFinite(o) ? o : 0, c = Number.isFinite(l) ? l : 0;
|
|
26
|
+
return h * 3600 + u * 60 + c;
|
|
27
27
|
}
|
|
28
28
|
function ht(e) {
|
|
29
29
|
const t = e.thirdPartyIds ?? e.ThirdPartyIds ?? e.thirdPartyId ?? e.ThirdPartyId ?? "", s = Array.isArray(t) ? t.join(",") : String(t ?? "");
|
|
@@ -33,21 +33,21 @@ function ht(e) {
|
|
|
33
33
|
n.has(o) || (n.add(o), a.push(o));
|
|
34
34
|
}), a;
|
|
35
35
|
}
|
|
36
|
-
const cs = "",
|
|
36
|
+
const cs = "", tr = cs, sr = "", rr = "", _t = {
|
|
37
37
|
snl: {
|
|
38
38
|
alerts: cs,
|
|
39
|
-
rules:
|
|
39
|
+
rules: tr
|
|
40
40
|
},
|
|
41
41
|
schools: {
|
|
42
|
-
alerts:
|
|
43
|
-
rules:
|
|
42
|
+
alerts: sr,
|
|
43
|
+
rules: rr
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
function xe(e, t) {
|
|
47
47
|
const s = (e || "").replace(/\/+$/, ""), r = t.startsWith("/") ? t : `/${t}`;
|
|
48
48
|
return `${s}${r}`;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function nr() {
|
|
51
51
|
try {
|
|
52
52
|
const e = localStorage.getItem("authToken");
|
|
53
53
|
return e ? { Authorization: `Bearer ${e}` } : {};
|
|
@@ -55,7 +55,7 @@ function rr() {
|
|
|
55
55
|
return {};
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Je(e, t) {
|
|
59
59
|
if (!t) return e;
|
|
60
60
|
const s = new URL(e);
|
|
61
61
|
return Object.entries(t).forEach(([r, n]) => {
|
|
@@ -65,7 +65,7 @@ function Ve(e, t) {
|
|
|
65
65
|
async function Ce(e, t) {
|
|
66
66
|
const s = {
|
|
67
67
|
...t.headers,
|
|
68
|
-
...
|
|
68
|
+
...nr()
|
|
69
69
|
}, r = await fetch(e, { ...t, headers: s });
|
|
70
70
|
if (r.status === 401)
|
|
71
71
|
throw window.location.href = "/login", new Error("Unauthorized");
|
|
@@ -84,7 +84,7 @@ async function Ce(e, t) {
|
|
|
84
84
|
}
|
|
85
85
|
return a;
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function ir(e) {
|
|
88
88
|
const t = {
|
|
89
89
|
"Content-Type": "application/json",
|
|
90
90
|
...e.headers || {}
|
|
@@ -105,7 +105,7 @@ function nr(e) {
|
|
|
105
105
|
return Array.isArray(r) ? r : r && typeof r == "object" && Array.isArray(r.data) ? r.data : [];
|
|
106
106
|
},
|
|
107
107
|
async getAlertsReport(s) {
|
|
108
|
-
const r = xe(e.baseUrl, "/Alerts/GetAlertsReport"), n =
|
|
108
|
+
const r = xe(e.baseUrl, "/Alerts/GetAlertsReport"), n = Je(r, s), a = await Ce(n, {
|
|
109
109
|
method: "GET",
|
|
110
110
|
headers: t
|
|
111
111
|
});
|
|
@@ -168,21 +168,21 @@ function nr(e) {
|
|
|
168
168
|
};
|
|
169
169
|
},
|
|
170
170
|
async getAlertNotifications(s) {
|
|
171
|
-
const r = xe(e.baseUrl, "/api/Alert/GetNotifications"), n =
|
|
171
|
+
const r = xe(e.baseUrl, "/api/Alert/GetNotifications"), n = Je(r, { alertId: s }), a = await Ce(n, {
|
|
172
172
|
method: "GET",
|
|
173
173
|
headers: t
|
|
174
174
|
});
|
|
175
175
|
return Array.isArray(a) ? a : a && typeof a == "object" && Array.isArray(a.data) ? a.data : [];
|
|
176
176
|
},
|
|
177
177
|
async notifyFamilyMembers(s) {
|
|
178
|
-
const r = xe(e.baseUrl, "/api/Alert/NotificationToFamilyMembers"), n =
|
|
178
|
+
const r = xe(e.baseUrl, "/api/Alert/NotificationToFamilyMembers"), n = Je(r, { alertId: s });
|
|
179
179
|
return Ce(n, {
|
|
180
180
|
method: "POST",
|
|
181
181
|
headers: t
|
|
182
182
|
});
|
|
183
183
|
},
|
|
184
184
|
async sendSMSorEmailNotifications(s, r, n) {
|
|
185
|
-
const a = xe(e.baseUrl, "/api/Alert/SendSMSorEmailNotifications"), o =
|
|
185
|
+
const a = xe(e.baseUrl, "/api/Alert/SendSMSorEmailNotifications"), o = Je(a, { alertId: s, isEmail: r, isSMS: n });
|
|
186
186
|
return Ce(o, {
|
|
187
187
|
method: "POST",
|
|
188
188
|
headers: t
|
|
@@ -194,7 +194,7 @@ function qt(e, t) {
|
|
|
194
194
|
const s = (e || "").replace(/\/+$/, ""), r = t.startsWith("/") ? t : `/${t}`;
|
|
195
195
|
return `${s}${r}`;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function ar() {
|
|
198
198
|
try {
|
|
199
199
|
const e = localStorage.getItem("authToken");
|
|
200
200
|
return e ? { Authorization: `Bearer ${e}` } : {};
|
|
@@ -202,10 +202,10 @@ function ir() {
|
|
|
202
202
|
return {};
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
async function
|
|
205
|
+
async function Ze(e, t) {
|
|
206
206
|
const s = {
|
|
207
207
|
...t.headers,
|
|
208
|
-
...
|
|
208
|
+
...ar()
|
|
209
209
|
}, r = await fetch(e, { ...t, headers: s });
|
|
210
210
|
if (r.status === 401)
|
|
211
211
|
throw window.location.href = "/login", new Error("Unauthorized");
|
|
@@ -224,29 +224,29 @@ async function Je(e, t) {
|
|
|
224
224
|
}
|
|
225
225
|
return a;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function or(e) {
|
|
228
228
|
const t = {
|
|
229
229
|
"Content-Type": "application/json",
|
|
230
230
|
...e.headers || {}
|
|
231
231
|
}, s = qt(e.baseUrl, "/api/Rules"), r = qt(e.baseUrl, "/api/Rules/lookups");
|
|
232
232
|
return {
|
|
233
233
|
async getRules() {
|
|
234
|
-
const n = await
|
|
234
|
+
const n = await Ze(s, { method: "GET", headers: t });
|
|
235
235
|
return Array.isArray(n) ? n : [];
|
|
236
236
|
},
|
|
237
237
|
async setEscalationSettings(n) {
|
|
238
|
-
return
|
|
238
|
+
return Ze(s, {
|
|
239
239
|
method: "POST",
|
|
240
240
|
headers: t,
|
|
241
241
|
body: JSON.stringify(n ?? {})
|
|
242
242
|
});
|
|
243
243
|
},
|
|
244
244
|
async getLookups() {
|
|
245
|
-
return
|
|
245
|
+
return Ze(r, { method: "GET", headers: t });
|
|
246
246
|
},
|
|
247
247
|
async updateRule(n, a) {
|
|
248
248
|
const o = `${s}/${n}`;
|
|
249
|
-
return
|
|
249
|
+
return Ze(o, {
|
|
250
250
|
method: "PUT",
|
|
251
251
|
headers: t,
|
|
252
252
|
body: JSON.stringify(a ?? {})
|
|
@@ -254,75 +254,75 @@ function ar(e) {
|
|
|
254
254
|
}
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function lr(e) {
|
|
258
258
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
259
259
|
}
|
|
260
|
-
var
|
|
261
|
-
function
|
|
260
|
+
var tt = { exports: {} }, cr = tt.exports, Qt;
|
|
261
|
+
function ur() {
|
|
262
262
|
return Qt || (Qt = 1, (function(e, t) {
|
|
263
263
|
(function(s, r) {
|
|
264
264
|
e.exports = r();
|
|
265
|
-
})(
|
|
266
|
-
var s = 1e3, r = 6e4, n = 36e5, a = "millisecond", o = "second", l = "minute",
|
|
267
|
-
var v = ["th", "st", "nd", "rd"], p =
|
|
268
|
-
return "[" +
|
|
269
|
-
} },
|
|
270
|
-
var x = String(
|
|
271
|
-
return !x || x.length >= v ?
|
|
272
|
-
}, L = { s:
|
|
273
|
-
var v = -
|
|
274
|
-
return (v <= 0 ? "+" : "-") +
|
|
275
|
-
}, m: function
|
|
276
|
-
if (v.date() < p.date()) return -
|
|
265
|
+
})(cr, (function() {
|
|
266
|
+
var s = 1e3, r = 6e4, n = 36e5, a = "millisecond", o = "second", l = "minute", h = "hour", u = "day", c = "week", S = "month", f = "quarter", R = "year", N = "date", m = "Invalid Date", A = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, B = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, U = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(E) {
|
|
267
|
+
var v = ["th", "st", "nd", "rd"], p = E % 100;
|
|
268
|
+
return "[" + E + (v[(p - 20) % 10] || v[p] || v[0]) + "]";
|
|
269
|
+
} }, _ = function(E, v, p) {
|
|
270
|
+
var x = String(E);
|
|
271
|
+
return !x || x.length >= v ? E : "" + Array(v + 1 - x.length).join(p) + E;
|
|
272
|
+
}, L = { s: _, z: function(E) {
|
|
273
|
+
var v = -E.utcOffset(), p = Math.abs(v), x = Math.floor(p / 60), y = p % 60;
|
|
274
|
+
return (v <= 0 ? "+" : "-") + _(x, 2, "0") + ":" + _(y, 2, "0");
|
|
275
|
+
}, m: function E(v, p) {
|
|
276
|
+
if (v.date() < p.date()) return -E(p, v);
|
|
277
277
|
var x = 12 * (p.year() - v.year()) + (p.month() - v.month()), y = v.clone().add(x, S), b = p - y < 0, g = v.clone().add(x + (b ? -1 : 1), S);
|
|
278
278
|
return +(-(x + (p - y) / (b ? y - g : g - y)) || 0);
|
|
279
|
-
}, a: function(
|
|
280
|
-
return
|
|
281
|
-
}, p: function(
|
|
282
|
-
return { M: S, y:
|
|
283
|
-
}, u: function(
|
|
284
|
-
return
|
|
279
|
+
}, a: function(E) {
|
|
280
|
+
return E < 0 ? Math.ceil(E) || 0 : Math.floor(E);
|
|
281
|
+
}, p: function(E) {
|
|
282
|
+
return { M: S, y: R, w: c, d: u, D: N, h, m: l, s: o, ms: a, Q: f }[E] || String(E || "").toLowerCase().replace(/s$/, "");
|
|
283
|
+
}, u: function(E) {
|
|
284
|
+
return E === void 0;
|
|
285
285
|
} }, J = "en", V = {};
|
|
286
|
-
V[J] =
|
|
287
|
-
var Y = "$isDayjsObject", K = function(
|
|
288
|
-
return
|
|
289
|
-
}, T = function
|
|
286
|
+
V[J] = U;
|
|
287
|
+
var Y = "$isDayjsObject", K = function(E) {
|
|
288
|
+
return E instanceof W || !(!E || !E[Y]);
|
|
289
|
+
}, T = function E(v, p, x) {
|
|
290
290
|
var y;
|
|
291
291
|
if (!v) return J;
|
|
292
292
|
if (typeof v == "string") {
|
|
293
293
|
var b = v.toLowerCase();
|
|
294
294
|
V[b] && (y = b), p && (V[b] = p, y = b);
|
|
295
295
|
var g = v.split("-");
|
|
296
|
-
if (!y && g.length > 1) return
|
|
296
|
+
if (!y && g.length > 1) return E(g[0]);
|
|
297
297
|
} else {
|
|
298
|
-
var
|
|
299
|
-
V[
|
|
298
|
+
var O = v.name;
|
|
299
|
+
V[O] = v, y = O;
|
|
300
300
|
}
|
|
301
301
|
return !x && y && (J = y), y || !x && J;
|
|
302
|
-
}, I = function(
|
|
303
|
-
if (K(
|
|
302
|
+
}, I = function(E, v) {
|
|
303
|
+
if (K(E)) return E.clone();
|
|
304
304
|
var p = typeof v == "object" ? v : {};
|
|
305
|
-
return p.date =
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
return I(
|
|
305
|
+
return p.date = E, p.args = arguments, new W(p);
|
|
306
|
+
}, k = L;
|
|
307
|
+
k.l = T, k.i = K, k.w = function(E, v) {
|
|
308
|
+
return I(E, { locale: v.$L, utc: v.$u, x: v.$x, $offset: v.$offset });
|
|
309
309
|
};
|
|
310
310
|
var W = (function() {
|
|
311
|
-
function
|
|
311
|
+
function E(p) {
|
|
312
312
|
this.$L = T(p.locale, null, !0), this.parse(p), this.$x = this.$x || p.x || {}, this[Y] = !0;
|
|
313
313
|
}
|
|
314
|
-
var v =
|
|
314
|
+
var v = E.prototype;
|
|
315
315
|
return v.parse = function(p) {
|
|
316
316
|
this.$d = (function(x) {
|
|
317
317
|
var y = x.date, b = x.utc;
|
|
318
318
|
if (y === null) return /* @__PURE__ */ new Date(NaN);
|
|
319
|
-
if (
|
|
319
|
+
if (k.u(y)) return /* @__PURE__ */ new Date();
|
|
320
320
|
if (y instanceof Date) return new Date(y);
|
|
321
321
|
if (typeof y == "string" && !/Z$/i.test(y)) {
|
|
322
322
|
var g = y.match(A);
|
|
323
323
|
if (g) {
|
|
324
|
-
var
|
|
325
|
-
return b ? new Date(Date.UTC(g[1],
|
|
324
|
+
var O = g[2] - 1 || 0, $ = (g[7] || "0").substring(0, 3);
|
|
325
|
+
return b ? new Date(Date.UTC(g[1], O, g[3] || 1, g[4] || 0, g[5] || 0, g[6] || 0, $)) : new Date(g[1], O, g[3] || 1, g[4] || 0, g[5] || 0, g[6] || 0, $);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
return new Date(y);
|
|
@@ -331,7 +331,7 @@ function cr() {
|
|
|
331
331
|
var p = this.$d;
|
|
332
332
|
this.$y = p.getFullYear(), this.$M = p.getMonth(), this.$D = p.getDate(), this.$W = p.getDay(), this.$H = p.getHours(), this.$m = p.getMinutes(), this.$s = p.getSeconds(), this.$ms = p.getMilliseconds();
|
|
333
333
|
}, v.$utils = function() {
|
|
334
|
-
return
|
|
334
|
+
return k;
|
|
335
335
|
}, v.isValid = function() {
|
|
336
336
|
return this.$d.toString() !== m;
|
|
337
337
|
}, v.isSame = function(p, x) {
|
|
@@ -342,167 +342,167 @@ function cr() {
|
|
|
342
342
|
}, v.isBefore = function(p, x) {
|
|
343
343
|
return this.endOf(x) < I(p);
|
|
344
344
|
}, v.$g = function(p, x, y) {
|
|
345
|
-
return
|
|
345
|
+
return k.u(p) ? this[x] : this.set(y, p);
|
|
346
346
|
}, v.unix = function() {
|
|
347
347
|
return Math.floor(this.valueOf() / 1e3);
|
|
348
348
|
}, v.valueOf = function() {
|
|
349
349
|
return this.$d.getTime();
|
|
350
350
|
}, v.startOf = function(p, x) {
|
|
351
|
-
var y = this, b = !!
|
|
352
|
-
var
|
|
353
|
-
return b ?
|
|
354
|
-
},
|
|
355
|
-
return
|
|
356
|
-
},
|
|
351
|
+
var y = this, b = !!k.u(x) || x, g = k.p(p), O = function(me, re) {
|
|
352
|
+
var oe = k.w(y.$u ? Date.UTC(y.$y, re, me) : new Date(y.$y, re, me), y);
|
|
353
|
+
return b ? oe : oe.endOf(u);
|
|
354
|
+
}, $ = function(me, re) {
|
|
355
|
+
return k.w(y.toDate()[me].apply(y.toDate("s"), (b ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(re)), y);
|
|
356
|
+
}, P = this.$W, F = this.$M, j = this.$D, z = "set" + (this.$u ? "UTC" : "");
|
|
357
357
|
switch (g) {
|
|
358
|
-
case
|
|
359
|
-
return b ?
|
|
358
|
+
case R:
|
|
359
|
+
return b ? O(1, 0) : O(31, 11);
|
|
360
360
|
case S:
|
|
361
|
-
return b ?
|
|
361
|
+
return b ? O(1, F) : O(0, F + 1);
|
|
362
362
|
case c:
|
|
363
|
-
var
|
|
364
|
-
return
|
|
363
|
+
var ne = this.$locale().weekStart || 0, ae = (P < ne ? P + 7 : P) - ne;
|
|
364
|
+
return O(b ? j - ae : j + (6 - ae), F);
|
|
365
365
|
case u:
|
|
366
366
|
case N:
|
|
367
|
-
return
|
|
368
|
-
case
|
|
369
|
-
return
|
|
367
|
+
return $(z + "Hours", 0);
|
|
368
|
+
case h:
|
|
369
|
+
return $(z + "Minutes", 1);
|
|
370
370
|
case l:
|
|
371
|
-
return
|
|
371
|
+
return $(z + "Seconds", 2);
|
|
372
372
|
case o:
|
|
373
|
-
return
|
|
373
|
+
return $(z + "Milliseconds", 3);
|
|
374
374
|
default:
|
|
375
375
|
return this.clone();
|
|
376
376
|
}
|
|
377
377
|
}, v.endOf = function(p) {
|
|
378
378
|
return this.startOf(p, !1);
|
|
379
379
|
}, v.$set = function(p, x) {
|
|
380
|
-
var y, b =
|
|
381
|
-
if (b === S || b ===
|
|
382
|
-
var
|
|
383
|
-
|
|
384
|
-
} else
|
|
380
|
+
var y, b = k.p(p), g = "set" + (this.$u ? "UTC" : ""), O = (y = {}, y[u] = g + "Date", y[N] = g + "Date", y[S] = g + "Month", y[R] = g + "FullYear", y[h] = g + "Hours", y[l] = g + "Minutes", y[o] = g + "Seconds", y[a] = g + "Milliseconds", y)[b], $ = b === u ? this.$D + (x - this.$W) : x;
|
|
381
|
+
if (b === S || b === R) {
|
|
382
|
+
var P = this.clone().set(N, 1);
|
|
383
|
+
P.$d[O]($), P.init(), this.$d = P.set(N, Math.min(this.$D, P.daysInMonth())).$d;
|
|
384
|
+
} else O && this.$d[O]($);
|
|
385
385
|
return this.init(), this;
|
|
386
386
|
}, v.set = function(p, x) {
|
|
387
387
|
return this.clone().$set(p, x);
|
|
388
388
|
}, v.get = function(p) {
|
|
389
|
-
return this[
|
|
389
|
+
return this[k.p(p)]();
|
|
390
390
|
}, v.add = function(p, x) {
|
|
391
391
|
var y, b = this;
|
|
392
392
|
p = Number(p);
|
|
393
|
-
var g =
|
|
394
|
-
var
|
|
395
|
-
return
|
|
393
|
+
var g = k.p(x), O = function(F) {
|
|
394
|
+
var j = I(b);
|
|
395
|
+
return k.w(j.date(j.date() + Math.round(F * p)), b);
|
|
396
396
|
};
|
|
397
397
|
if (g === S) return this.set(S, this.$M + p);
|
|
398
|
-
if (g ===
|
|
399
|
-
if (g === u) return
|
|
400
|
-
if (g === c) return
|
|
401
|
-
var
|
|
402
|
-
return
|
|
398
|
+
if (g === R) return this.set(R, this.$y + p);
|
|
399
|
+
if (g === u) return O(1);
|
|
400
|
+
if (g === c) return O(7);
|
|
401
|
+
var $ = (y = {}, y[l] = r, y[h] = n, y[o] = s, y)[g] || 1, P = this.$d.getTime() + p * $;
|
|
402
|
+
return k.w(P, this);
|
|
403
403
|
}, v.subtract = function(p, x) {
|
|
404
404
|
return this.add(-1 * p, x);
|
|
405
405
|
}, v.format = function(p) {
|
|
406
406
|
var x = this, y = this.$locale();
|
|
407
407
|
if (!this.isValid()) return y.invalidDate || m;
|
|
408
|
-
var b = p || "YYYY-MM-DDTHH:mm:ssZ", g =
|
|
409
|
-
return
|
|
410
|
-
},
|
|
411
|
-
return
|
|
412
|
-
},
|
|
413
|
-
var we =
|
|
408
|
+
var b = p || "YYYY-MM-DDTHH:mm:ssZ", g = k.z(this), O = this.$H, $ = this.$m, P = this.$M, F = y.weekdays, j = y.months, z = y.meridiem, ne = function(re, oe, Re, we) {
|
|
409
|
+
return re && (re[oe] || re(x, b)) || Re[oe].slice(0, we);
|
|
410
|
+
}, ae = function(re) {
|
|
411
|
+
return k.s(O % 12 || 12, re, "0");
|
|
412
|
+
}, me = z || function(re, oe, Re) {
|
|
413
|
+
var we = re < 12 ? "AM" : "PM";
|
|
414
414
|
return Re ? we.toLowerCase() : we;
|
|
415
415
|
};
|
|
416
|
-
return b.replace(
|
|
417
|
-
return
|
|
416
|
+
return b.replace(B, (function(re, oe) {
|
|
417
|
+
return oe || (function(Re) {
|
|
418
418
|
switch (Re) {
|
|
419
419
|
case "YY":
|
|
420
420
|
return String(x.$y).slice(-2);
|
|
421
421
|
case "YYYY":
|
|
422
|
-
return
|
|
422
|
+
return k.s(x.$y, 4, "0");
|
|
423
423
|
case "M":
|
|
424
|
-
return
|
|
424
|
+
return P + 1;
|
|
425
425
|
case "MM":
|
|
426
|
-
return
|
|
426
|
+
return k.s(P + 1, 2, "0");
|
|
427
427
|
case "MMM":
|
|
428
|
-
return
|
|
428
|
+
return ne(y.monthsShort, P, j, 3);
|
|
429
429
|
case "MMMM":
|
|
430
|
-
return
|
|
430
|
+
return ne(j, P);
|
|
431
431
|
case "D":
|
|
432
432
|
return x.$D;
|
|
433
433
|
case "DD":
|
|
434
|
-
return
|
|
434
|
+
return k.s(x.$D, 2, "0");
|
|
435
435
|
case "d":
|
|
436
436
|
return String(x.$W);
|
|
437
437
|
case "dd":
|
|
438
|
-
return
|
|
438
|
+
return ne(y.weekdaysMin, x.$W, F, 2);
|
|
439
439
|
case "ddd":
|
|
440
|
-
return
|
|
440
|
+
return ne(y.weekdaysShort, x.$W, F, 3);
|
|
441
441
|
case "dddd":
|
|
442
|
-
return
|
|
442
|
+
return F[x.$W];
|
|
443
443
|
case "H":
|
|
444
|
-
return String(
|
|
444
|
+
return String(O);
|
|
445
445
|
case "HH":
|
|
446
|
-
return
|
|
446
|
+
return k.s(O, 2, "0");
|
|
447
447
|
case "h":
|
|
448
|
-
return
|
|
448
|
+
return ae(1);
|
|
449
449
|
case "hh":
|
|
450
|
-
return
|
|
450
|
+
return ae(2);
|
|
451
451
|
case "a":
|
|
452
|
-
return
|
|
452
|
+
return me(O, $, !0);
|
|
453
453
|
case "A":
|
|
454
|
-
return
|
|
454
|
+
return me(O, $, !1);
|
|
455
455
|
case "m":
|
|
456
|
-
return String(
|
|
456
|
+
return String($);
|
|
457
457
|
case "mm":
|
|
458
|
-
return
|
|
458
|
+
return k.s($, 2, "0");
|
|
459
459
|
case "s":
|
|
460
460
|
return String(x.$s);
|
|
461
461
|
case "ss":
|
|
462
|
-
return
|
|
462
|
+
return k.s(x.$s, 2, "0");
|
|
463
463
|
case "SSS":
|
|
464
|
-
return
|
|
464
|
+
return k.s(x.$ms, 3, "0");
|
|
465
465
|
case "Z":
|
|
466
466
|
return g;
|
|
467
467
|
}
|
|
468
468
|
return null;
|
|
469
|
-
})(
|
|
469
|
+
})(re) || g.replace(":", "");
|
|
470
470
|
}));
|
|
471
471
|
}, v.utcOffset = function() {
|
|
472
472
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
473
473
|
}, v.diff = function(p, x, y) {
|
|
474
|
-
var b, g = this,
|
|
475
|
-
return
|
|
474
|
+
var b, g = this, O = k.p(x), $ = I(p), P = ($.utcOffset() - this.utcOffset()) * r, F = this - $, j = function() {
|
|
475
|
+
return k.m(g, $);
|
|
476
476
|
};
|
|
477
|
-
switch (
|
|
478
|
-
case
|
|
479
|
-
b =
|
|
477
|
+
switch (O) {
|
|
478
|
+
case R:
|
|
479
|
+
b = j() / 12;
|
|
480
480
|
break;
|
|
481
481
|
case S:
|
|
482
|
-
b =
|
|
482
|
+
b = j();
|
|
483
483
|
break;
|
|
484
484
|
case f:
|
|
485
|
-
b =
|
|
485
|
+
b = j() / 3;
|
|
486
486
|
break;
|
|
487
487
|
case c:
|
|
488
|
-
b = (
|
|
488
|
+
b = (F - P) / 6048e5;
|
|
489
489
|
break;
|
|
490
490
|
case u:
|
|
491
|
-
b = (
|
|
491
|
+
b = (F - P) / 864e5;
|
|
492
492
|
break;
|
|
493
|
-
case
|
|
494
|
-
b =
|
|
493
|
+
case h:
|
|
494
|
+
b = F / n;
|
|
495
495
|
break;
|
|
496
496
|
case l:
|
|
497
|
-
b =
|
|
497
|
+
b = F / r;
|
|
498
498
|
break;
|
|
499
499
|
case o:
|
|
500
|
-
b =
|
|
500
|
+
b = F / s;
|
|
501
501
|
break;
|
|
502
502
|
default:
|
|
503
|
-
b =
|
|
503
|
+
b = F;
|
|
504
504
|
}
|
|
505
|
-
return y ? b :
|
|
505
|
+
return y ? b : k.a(b);
|
|
506
506
|
}, v.daysInMonth = function() {
|
|
507
507
|
return this.endOf(S).$D;
|
|
508
508
|
}, v.$locale = function() {
|
|
@@ -512,7 +512,7 @@ function cr() {
|
|
|
512
512
|
var y = this.clone(), b = T(p, x, !0);
|
|
513
513
|
return b && (y.$L = b), y;
|
|
514
514
|
}, v.clone = function() {
|
|
515
|
-
return
|
|
515
|
+
return k.w(this.$d, this);
|
|
516
516
|
}, v.toDate = function() {
|
|
517
517
|
return new Date(this.valueOf());
|
|
518
518
|
}, v.toJSON = function() {
|
|
@@ -521,22 +521,22 @@ function cr() {
|
|
|
521
521
|
return this.$d.toISOString();
|
|
522
522
|
}, v.toString = function() {
|
|
523
523
|
return this.$d.toUTCString();
|
|
524
|
-
},
|
|
524
|
+
}, E;
|
|
525
525
|
})(), te = W.prototype;
|
|
526
|
-
return I.prototype = te, [["$ms", a], ["$s", o], ["$m", l], ["$H",
|
|
527
|
-
te[
|
|
528
|
-
return this.$g(v,
|
|
526
|
+
return I.prototype = te, [["$ms", a], ["$s", o], ["$m", l], ["$H", h], ["$W", u], ["$M", S], ["$y", R], ["$D", N]].forEach((function(E) {
|
|
527
|
+
te[E[1]] = function(v) {
|
|
528
|
+
return this.$g(v, E[0], E[1]);
|
|
529
529
|
};
|
|
530
|
-
})), I.extend = function(
|
|
531
|
-
return
|
|
532
|
-
}, I.locale = T, I.isDayjs = K, I.unix = function(
|
|
533
|
-
return I(1e3 *
|
|
530
|
+
})), I.extend = function(E, v) {
|
|
531
|
+
return E.$i || (E(v, W, I), E.$i = !0), I;
|
|
532
|
+
}, I.locale = T, I.isDayjs = K, I.unix = function(E) {
|
|
533
|
+
return I(1e3 * E);
|
|
534
534
|
}, I.en = V[J], I.Ls = V, I.p = {}, I;
|
|
535
535
|
}));
|
|
536
|
-
})(
|
|
536
|
+
})(tt)), tt.exports;
|
|
537
537
|
}
|
|
538
|
-
var
|
|
539
|
-
const us = /* @__PURE__ */
|
|
538
|
+
var dr = ur();
|
|
539
|
+
const us = /* @__PURE__ */ lr(dr);
|
|
540
540
|
function ds(e) {
|
|
541
541
|
if (!e) return "By Severity";
|
|
542
542
|
const t = e.trim().toLowerCase();
|
|
@@ -555,7 +555,7 @@ function Oe(e, t) {
|
|
|
555
555
|
const s = (e || "").replace(/\/+$/, ""), r = t.startsWith("/") ? t : `/${t}`;
|
|
556
556
|
return `${s}${r}`;
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function hr() {
|
|
559
559
|
try {
|
|
560
560
|
const e = localStorage.getItem("authToken");
|
|
561
561
|
return e ? { Authorization: `Bearer ${e}` } : {};
|
|
@@ -573,7 +573,7 @@ function Gt(e, t) {
|
|
|
573
573
|
async function Pe(e, t) {
|
|
574
574
|
const s = {
|
|
575
575
|
...t.headers,
|
|
576
|
-
...
|
|
576
|
+
...hr()
|
|
577
577
|
}, r = await fetch(e, { ...t, headers: s });
|
|
578
578
|
if (r.status === 401)
|
|
579
579
|
throw window.location.href = "/login", new Error("Unauthorized");
|
|
@@ -592,31 +592,31 @@ async function Pe(e, t) {
|
|
|
592
592
|
}
|
|
593
593
|
return a;
|
|
594
594
|
}
|
|
595
|
-
const
|
|
596
|
-
function
|
|
595
|
+
const ce = (...e) => e.find((t) => t != null);
|
|
596
|
+
function fr(e) {
|
|
597
597
|
return {
|
|
598
598
|
// important: do not fall back to `id` here; only AlertId/alertId are considered the Alert ID
|
|
599
|
-
id: String(
|
|
600
|
-
priority:
|
|
601
|
-
timestamp:
|
|
602
|
-
statusType:
|
|
603
|
-
description:
|
|
604
|
-
eventName:
|
|
605
|
-
ruleName:
|
|
606
|
-
spaceName:
|
|
607
|
-
assignTeam:
|
|
608
|
-
cameraName:
|
|
609
|
-
type:
|
|
610
|
-
mediaDetails:
|
|
611
|
-
additionalMedia:
|
|
612
|
-
timeElapsed:
|
|
613
|
-
timeRemaining:
|
|
614
|
-
anomalyName:
|
|
615
|
-
alertDetails:
|
|
616
|
-
statusHistory:
|
|
599
|
+
id: String(ce(e?.AlertId, e?.alertId) ?? ""),
|
|
600
|
+
priority: ce(e?.Priority, e?.priority, "Low"),
|
|
601
|
+
timestamp: ce(e?.Timestamp, e?.timestamp, ""),
|
|
602
|
+
statusType: ce(e?.Status, e?.statusType, ""),
|
|
603
|
+
description: ce(e?.Description, e?.description, ""),
|
|
604
|
+
eventName: ce(e?.EventName, e?.eventName),
|
|
605
|
+
ruleName: ce(e?.RuleName, e?.ruleName),
|
|
606
|
+
spaceName: ce(e?.SpaceName, e?.spaceName),
|
|
607
|
+
assignTeam: ce(e?.AssignTeam, e?.assignTeam),
|
|
608
|
+
cameraName: ce(e?.CameraName, e?.cameraName),
|
|
609
|
+
type: ce(e?.Type, e?.type),
|
|
610
|
+
mediaDetails: ce(e?.MediaDetails, e?.mediaDetails),
|
|
611
|
+
additionalMedia: ce(e?.AdditionalMedia, e?.additionalMedia),
|
|
612
|
+
timeElapsed: ce(e?.TimeElapsed, e?.timeElapsed),
|
|
613
|
+
timeRemaining: ce(e?.TimeRemaining, e?.timeRemaining),
|
|
614
|
+
anomalyName: ce(e?.AnomalyName, e?.anomalyName),
|
|
615
|
+
alertDetails: ce(e?.AlertDetails, e?.alertDetails),
|
|
616
|
+
statusHistory: ce(e?.StatusHistory, e?.statusHistory)
|
|
617
617
|
};
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function mr(e) {
|
|
620
620
|
const t = {
|
|
621
621
|
"Content-Type": "application/json",
|
|
622
622
|
...e.headers || {}
|
|
@@ -627,7 +627,7 @@ function fr(e) {
|
|
|
627
627
|
method: "GET",
|
|
628
628
|
headers: t
|
|
629
629
|
});
|
|
630
|
-
return Array.isArray(r?.Items) ? (r?.Items).map(
|
|
630
|
+
return Array.isArray(r?.Items) ? (r?.Items).map(fr) : [];
|
|
631
631
|
},
|
|
632
632
|
async getAlertStatusList() {
|
|
633
633
|
const s = Oe(e.baseUrl, "/api/detectionpolicy/alerts/StatusList"), r = await Pe(s, {
|
|
@@ -708,12 +708,12 @@ function fr(e) {
|
|
|
708
708
|
method: "POST",
|
|
709
709
|
headers: t,
|
|
710
710
|
body: JSON.stringify(a)
|
|
711
|
-
}), l = o?.responseStatus ?? !0,
|
|
711
|
+
}), l = o?.responseStatus ?? !0, h = o?.data ?? o?.message ?? "Preferences updated successfully.";
|
|
712
712
|
return {
|
|
713
713
|
responseStatus: l,
|
|
714
714
|
errorMessage: l ? "" : o?.errorMessage ?? o?.Message ?? o?.message ?? "",
|
|
715
715
|
statusCode: 200,
|
|
716
|
-
data:
|
|
716
|
+
data: h
|
|
717
717
|
};
|
|
718
718
|
},
|
|
719
719
|
async getAlertNotifications(s) {
|
|
@@ -725,7 +725,7 @@ function fr(e) {
|
|
|
725
725
|
}
|
|
726
726
|
};
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function pr() {
|
|
729
729
|
try {
|
|
730
730
|
const e = localStorage.getItem("authToken");
|
|
731
731
|
return e ? { Authorization: `Bearer ${e}` } : {};
|
|
@@ -736,7 +736,7 @@ function mr() {
|
|
|
736
736
|
async function De(e, t) {
|
|
737
737
|
const s = {
|
|
738
738
|
...t.headers,
|
|
739
|
-
...
|
|
739
|
+
...pr()
|
|
740
740
|
}, r = await fetch(e, { ...t, headers: s });
|
|
741
741
|
if (r.status === 401)
|
|
742
742
|
throw window.location.href = "/login", new Error("Unauthorized");
|
|
@@ -755,7 +755,7 @@ async function De(e, t) {
|
|
|
755
755
|
}
|
|
756
756
|
return a;
|
|
757
757
|
}
|
|
758
|
-
function
|
|
758
|
+
function yr(e) {
|
|
759
759
|
const t = {
|
|
760
760
|
"Content-Type": "application/json",
|
|
761
761
|
...e.headers || {}
|
|
@@ -783,23 +783,23 @@ function pr(e) {
|
|
|
783
783
|
a,
|
|
784
784
|
o,
|
|
785
785
|
l,
|
|
786
|
-
|
|
786
|
+
h,
|
|
787
787
|
u
|
|
788
|
-
] = await Promise.allSettled(n), c = (L) => L.status === "fulfilled" && Array.isArray(L.value) ? L.value : [], S = c(a), f = c(o),
|
|
788
|
+
] = await Promise.allSettled(n), c = (L) => L.status === "fulfilled" && Array.isArray(L.value) ? L.value : [], S = c(a), f = c(o), R = c(l), N = c(h), m = c(u), A = S.map((L) => ({
|
|
789
789
|
actionTypeId: Number(L?.ActionTypeId),
|
|
790
790
|
name: L?.DisplayName ?? L?.Name ?? ""
|
|
791
|
-
})),
|
|
791
|
+
})), B = f.map((L) => ({
|
|
792
792
|
recordId: L?.AnomalyId,
|
|
793
793
|
anomalyName: L?.DisplayName ?? L?.Name ?? ""
|
|
794
|
-
})),
|
|
794
|
+
})), U = R.map((L) => ({
|
|
795
795
|
thirdPartyId: Number(L?.ThirdPartyId),
|
|
796
796
|
thirdPartyName: L?.ThirdPartyName ?? L?.Name ?? ""
|
|
797
|
-
})),
|
|
797
|
+
})), _ = {
|
|
798
798
|
actionTypes: A,
|
|
799
|
-
anomalies:
|
|
800
|
-
thirdParties:
|
|
799
|
+
anomalies: B,
|
|
800
|
+
thirdParties: U
|
|
801
801
|
};
|
|
802
|
-
return N.length && (
|
|
802
|
+
return N.length && (_.severities = N), m.length && (_.scheduleTypes = m), _;
|
|
803
803
|
},
|
|
804
804
|
async updateRule(r, n) {
|
|
805
805
|
const a = `${s}/${r}`;
|
|
@@ -812,12 +812,12 @@ function pr(e) {
|
|
|
812
812
|
};
|
|
813
813
|
}
|
|
814
814
|
const fs = Ds(null);
|
|
815
|
-
function
|
|
815
|
+
function gr({
|
|
816
816
|
tenant: e = "snl",
|
|
817
817
|
override: t,
|
|
818
818
|
children: s
|
|
819
819
|
}) {
|
|
820
|
-
const r =
|
|
820
|
+
const r = de(() => {
|
|
821
821
|
const a = t?.alertsBaseUrl?.trim() || _t[e]?.alerts || "";
|
|
822
822
|
let o = t?.rulesBaseUrl?.trim() || _t[e]?.rules || "";
|
|
823
823
|
e === "snl" && (o = a);
|
|
@@ -828,8 +828,8 @@ function yr({
|
|
|
828
828
|
t?.alertsBaseUrl,
|
|
829
829
|
t?.rulesBaseUrl,
|
|
830
830
|
JSON.stringify(t?.headers || {})
|
|
831
|
-
]), n =
|
|
832
|
-
const a = r.tenant === "schools" ?
|
|
831
|
+
]), n = de(() => {
|
|
832
|
+
const a = r.tenant === "schools" ? mr({ baseUrl: r.alertsBaseUrl, headers: r.headers }) : ir({ baseUrl: r.alertsBaseUrl, headers: r.headers }), o = r.tenant === "schools" ? yr({ baseUrl: r.rulesBaseUrl, headers: r.headers }) : or({ baseUrl: r.alertsBaseUrl, headers: r.headers });
|
|
833
833
|
return { config: r, alerts: a, rules: o };
|
|
834
834
|
}, [r]);
|
|
835
835
|
return /* @__PURE__ */ i(fs.Provider, { value: n, children: s });
|
|
@@ -839,22 +839,22 @@ function Te() {
|
|
|
839
839
|
if (!e) throw new Error("useApi must be used inside ApiProvider");
|
|
840
840
|
return e;
|
|
841
841
|
}
|
|
842
|
-
const
|
|
842
|
+
const vr = {
|
|
843
843
|
Critical: "#FFE2E2",
|
|
844
844
|
High: "#FF95004D",
|
|
845
845
|
Medium: "#FEF9C2",
|
|
846
846
|
Low: "#E0EDFF"
|
|
847
|
-
},
|
|
847
|
+
}, br = {
|
|
848
848
|
Critical: "#FF3B30",
|
|
849
849
|
High: "#FFB86A",
|
|
850
850
|
Medium: "#FFCC00",
|
|
851
851
|
Low: "#007AFF"
|
|
852
852
|
}, It = 6, Tt = 7;
|
|
853
|
-
function
|
|
854
|
-
const r = e === It, n = e === Tt, a = t.isEmailSent, o = t.isSMSSent, l = r && a || n && o,
|
|
853
|
+
function Ar(e, t, s) {
|
|
854
|
+
const r = e === It, n = e === Tt, a = t.isEmailSent, o = t.isSMSSent, l = r && a || n && o, h = r ? "Send Email" : n ? "Send SMS" : s, u = r && a ? "Email sent" : n && o ? "SMS sent" : h, c = r && a ? "Email sent" : n && o ? "SMS sent" : `Click to ${h}`;
|
|
855
855
|
return { isDisabled: l, buttonText: u, tooltipTitle: c };
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function Sr(e) {
|
|
858
858
|
const t = /* @__PURE__ */ new Set();
|
|
859
859
|
(e || []).forEach((r) => {
|
|
860
860
|
const n = r.anomalyName;
|
|
@@ -863,7 +863,7 @@ function Ar(e) {
|
|
|
863
863
|
const s = Array.from(t).map((r) => ({ label: r, value: r }));
|
|
864
864
|
return [{ label: "All Types", value: "All" }, ...s];
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function wr(e) {
|
|
867
867
|
const t = /* @__PURE__ */ new Set();
|
|
868
868
|
(e || []).forEach((r) => {
|
|
869
869
|
const n = r.spaceName;
|
|
@@ -890,29 +890,29 @@ function it({ value: e, onChange: t, options: s, className: r, dropdownWidth: n
|
|
|
890
890
|
}
|
|
891
891
|
);
|
|
892
892
|
}
|
|
893
|
-
const
|
|
893
|
+
const Nr = [
|
|
894
894
|
{ label: "All levels", value: "All" },
|
|
895
895
|
{ label: "Critical", value: "Critical" },
|
|
896
896
|
{ label: "High", value: "High" },
|
|
897
897
|
{ label: "Medium", value: "Medium" },
|
|
898
898
|
{ label: "Low", value: "Low" }
|
|
899
899
|
];
|
|
900
|
-
function
|
|
901
|
-
return /* @__PURE__ */ i(it, { className: "w-[140px]", value: e, onChange: t, options: s ||
|
|
900
|
+
function xr({ value: e, onChange: t, options: s }) {
|
|
901
|
+
return /* @__PURE__ */ i(it, { className: "w-[140px]", value: e, onChange: t, options: s || Nr });
|
|
902
902
|
}
|
|
903
|
-
const
|
|
903
|
+
const Cr = [
|
|
904
904
|
{ label: "All Types", value: "All" },
|
|
905
905
|
{ label: "Weapon Detection", value: "Weapon" },
|
|
906
906
|
{ label: "Unauthorized Access", value: "Unauthorized" },
|
|
907
907
|
{ label: "Aggressive Behavior", value: "Aggressive" }
|
|
908
908
|
];
|
|
909
|
-
function Cr({ value: e, onChange: t, options: s }) {
|
|
910
|
-
return /* @__PURE__ */ i(it, { className: "w-[220px]", dropdownWidth: 280, value: e, onChange: t, options: s || xr });
|
|
911
|
-
}
|
|
912
909
|
function Ir({ value: e, onChange: t, options: s }) {
|
|
910
|
+
return /* @__PURE__ */ i(it, { className: "w-[220px]", dropdownWidth: 280, value: e, onChange: t, options: s || Cr });
|
|
911
|
+
}
|
|
912
|
+
function Tr({ value: e, onChange: t, options: s }) {
|
|
913
913
|
return /* @__PURE__ */ i(it, { className: "w-[100px]", value: e, onChange: t, options: s || [] });
|
|
914
914
|
}
|
|
915
|
-
const
|
|
915
|
+
const Rr = [
|
|
916
916
|
{ label: "All", value: "All" },
|
|
917
917
|
{ label: "SOS", value: "SOS" },
|
|
918
918
|
{ label: "911", value: "911" },
|
|
@@ -920,10 +920,10 @@ const Tr = [
|
|
|
920
920
|
{ label: "Eli", value: "Eli" },
|
|
921
921
|
{ label: "Skydio", value: "Skydio" }
|
|
922
922
|
];
|
|
923
|
-
function
|
|
924
|
-
return /* @__PURE__ */ i(it, { className: "w-[130px]", value: e, onChange: t, options: s ||
|
|
923
|
+
function kr({ value: e, onChange: t, options: s }) {
|
|
924
|
+
return /* @__PURE__ */ i(it, { className: "w-[130px]", value: e, onChange: t, options: s || Rr });
|
|
925
925
|
}
|
|
926
|
-
function
|
|
926
|
+
function Er({
|
|
927
927
|
columns: e,
|
|
928
928
|
data: t,
|
|
929
929
|
loading: s = !1,
|
|
@@ -932,7 +932,7 @@ function kr({
|
|
|
932
932
|
toolbar: a,
|
|
933
933
|
tableProps: o
|
|
934
934
|
}) {
|
|
935
|
-
return /* @__PURE__ */
|
|
935
|
+
return /* @__PURE__ */ d("div", { children: [
|
|
936
936
|
a,
|
|
937
937
|
/* @__PURE__ */ i(
|
|
938
938
|
Nt,
|
|
@@ -952,20 +952,20 @@ function kr({
|
|
|
952
952
|
)
|
|
953
953
|
] });
|
|
954
954
|
}
|
|
955
|
-
function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOptions: n, spaceOptions: a, renderActions: o, onAlertIdClick: l, onRefetch:
|
|
956
|
-
const [c, S] = w("All"), [f,
|
|
955
|
+
function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOptions: n, spaceOptions: a, renderActions: o, onAlertIdClick: l, onRefetch: h, excludeCompleted: u = !0 }) {
|
|
956
|
+
const [c, S] = w("All"), [f, R] = w("All"), [N, m] = w("All"), [A, B] = w("All"), [U, _] = w(""), [L, J] = w([{ label: "All", value: "All" }]), [V, Y] = w(/* @__PURE__ */ new Set()), { rules: K, alerts: T } = Te(), I = {
|
|
957
957
|
6: { title: "Email", kind: "icon", icon: /* @__PURE__ */ i(Hs, {}) },
|
|
958
958
|
7: { title: "SMS", kind: "icon", icon: /* @__PURE__ */ i(Qs, {}) }
|
|
959
|
-
},
|
|
960
|
-
|
|
959
|
+
}, k = de(() => Sr(e), [e]), W = de(() => wr(e), [e]);
|
|
960
|
+
ue(() => {
|
|
961
961
|
let b = !0;
|
|
962
962
|
return (async () => {
|
|
963
963
|
try {
|
|
964
|
-
const g = await K.getLookups(),
|
|
965
|
-
label:
|
|
966
|
-
value: String(
|
|
964
|
+
const g = await K.getLookups(), $ = (Array.isArray(g.thirdParties) ? g.thirdParties : []).map((P) => ({
|
|
965
|
+
label: P.thirdPartyName,
|
|
966
|
+
value: String(P.thirdPartyId)
|
|
967
967
|
}));
|
|
968
|
-
b && J([{ label: "All", value: "All" },
|
|
968
|
+
b && J([{ label: "All", value: "All" }, ...$]);
|
|
969
969
|
} catch (g) {
|
|
970
970
|
console.error("Error loading third party options", g);
|
|
971
971
|
}
|
|
@@ -973,19 +973,19 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
973
973
|
b = !1;
|
|
974
974
|
};
|
|
975
975
|
}, [K]);
|
|
976
|
-
const te =
|
|
976
|
+
const te = de(
|
|
977
977
|
() => (e || []).some((b) => ht(b).length > 0),
|
|
978
978
|
[e]
|
|
979
|
-
),
|
|
980
|
-
const g = c === "All" || b.priority === c,
|
|
981
|
-
return g &&
|
|
982
|
-
}), [e, c,
|
|
979
|
+
), E = de(() => (e || []).filter((b) => {
|
|
980
|
+
const g = c === "All" || b.priority === c, O = `${b.id} ${b.description} ${b.statusType}`.toLowerCase(), $ = !U || O.includes(U.toLowerCase()), P = f === "All" || (b.anomalyName || "").toLowerCase() === f.toLowerCase(), F = N === "All" || (b.spaceName || "").toLowerCase() === N.toLowerCase(), j = !te || A === "All" || ht(b).includes(Number(A)), z = !u || !["completed", "false positive"].includes(String(b.statusType || "").toLowerCase());
|
|
981
|
+
return g && $ && P && F && j && z;
|
|
982
|
+
}), [e, c, U, f, N, A, te, u]), v = k, p = a && a.length ? a : W, x = [
|
|
983
983
|
{
|
|
984
984
|
title: "Severity",
|
|
985
985
|
dataIndex: "priority",
|
|
986
986
|
key: "priority",
|
|
987
987
|
width: 120,
|
|
988
|
-
render: (b) => /* @__PURE__ */ i(
|
|
988
|
+
render: (b) => /* @__PURE__ */ i(We, { className: "px-[10px] py-[2px]", style: { border: `2px solid ${br[b]}`, backgroundColor: vr[b] }, children: b })
|
|
989
989
|
},
|
|
990
990
|
{
|
|
991
991
|
title: "Tracker",
|
|
@@ -994,8 +994,8 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
994
994
|
render: (b, g) => /* @__PURE__ */ i(
|
|
995
995
|
"a",
|
|
996
996
|
{
|
|
997
|
-
onClick: (
|
|
998
|
-
|
|
997
|
+
onClick: (O) => {
|
|
998
|
+
O.preventDefault(), l?.(g, { tab: "track", sourceTab: "active" });
|
|
999
999
|
},
|
|
1000
1000
|
className: "text-blue-600 hover:underline",
|
|
1001
1001
|
children: "Tracker"
|
|
@@ -1008,42 +1008,42 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1008
1008
|
width: 320,
|
|
1009
1009
|
render: (b, g) => {
|
|
1010
1010
|
if (o) return /* @__PURE__ */ i(Ps, { children: o(g) });
|
|
1011
|
-
const
|
|
1012
|
-
if (!
|
|
1013
|
-
const
|
|
1014
|
-
const
|
|
1015
|
-
Y((z) => new Set(z).add(
|
|
1011
|
+
const O = ht(g);
|
|
1012
|
+
if (!O.length) return null;
|
|
1013
|
+
const $ = async (P, F) => {
|
|
1014
|
+
const j = Wt(g.id, P);
|
|
1015
|
+
Y((z) => new Set(z).add(j));
|
|
1016
1016
|
try {
|
|
1017
|
-
const z = await T.sendSMSorEmailNotifications?.(g.id,
|
|
1018
|
-
z?.responseStatus ? (
|
|
1017
|
+
const z = await T.sendSMSorEmailNotifications?.(g.id, P, F);
|
|
1018
|
+
z?.responseStatus ? (ge.success(z.data || (P ? "Email sent successfully" : "SMS sent successfully")), h?.()) : ge.error(z?.data || z?.errorMessage || "Failed to send notification");
|
|
1019
1019
|
} catch (z) {
|
|
1020
|
-
|
|
1020
|
+
ge.error(z?.message || "Failed to send notification");
|
|
1021
1021
|
} finally {
|
|
1022
1022
|
Y((z) => {
|
|
1023
|
-
const
|
|
1024
|
-
return
|
|
1023
|
+
const ne = new Set(z);
|
|
1024
|
+
return ne.delete(j), ne;
|
|
1025
1025
|
});
|
|
1026
1026
|
}
|
|
1027
1027
|
};
|
|
1028
|
-
return /* @__PURE__ */ i(Ie, { size: "middle", children:
|
|
1029
|
-
const
|
|
1030
|
-
if (!
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1028
|
+
return /* @__PURE__ */ i(Ie, { size: "middle", children: O.map((P) => {
|
|
1029
|
+
const F = I[P];
|
|
1030
|
+
if (!F) return null;
|
|
1031
|
+
const j = P === It, z = P === Tt, { isDisabled: ne, buttonText: ae, tooltipTitle: me } = Ar(P, g, F.title), re = Wt(g.id, j), oe = Kt(P) && V.has(re), Re = () => {
|
|
1032
|
+
$(j, z);
|
|
1033
1033
|
};
|
|
1034
|
-
return /* @__PURE__ */ i(Ls, { title:
|
|
1034
|
+
return /* @__PURE__ */ i(Ls, { title: me, children: /* @__PURE__ */ i(
|
|
1035
1035
|
Se,
|
|
1036
1036
|
{
|
|
1037
1037
|
size: "small",
|
|
1038
|
-
disabled:
|
|
1039
|
-
loading:
|
|
1040
|
-
onClick: Kt(
|
|
1041
|
-
icon: !
|
|
1038
|
+
disabled: ne,
|
|
1039
|
+
loading: oe,
|
|
1040
|
+
onClick: Kt(P) ? Re : void 0,
|
|
1041
|
+
icon: !oe && (F.kind === "img" && F.src ? /* @__PURE__ */ i("img", { src: F.src, alt: F.alt || F.title }) : F.icon),
|
|
1042
1042
|
className: "flex flex-col items-center justify-center gap-1",
|
|
1043
1043
|
style: { height: "fit-content" },
|
|
1044
|
-
children:
|
|
1044
|
+
children: ae
|
|
1045
1045
|
}
|
|
1046
|
-
) },
|
|
1046
|
+
) }, P);
|
|
1047
1047
|
}) });
|
|
1048
1048
|
}
|
|
1049
1049
|
},
|
|
@@ -1053,16 +1053,16 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1053
1053
|
key: "timestamp",
|
|
1054
1054
|
width: 220,
|
|
1055
1055
|
render: (b, g) => {
|
|
1056
|
-
const
|
|
1057
|
-
return /* @__PURE__ */
|
|
1058
|
-
/* @__PURE__ */
|
|
1056
|
+
const O = g?.timeElapsed, $ = g?.timeRemaining, P = O ? jt(O) : 0, F = $ ? jt($) : 0, j = Math.round(P / (P + F) * 100);
|
|
1057
|
+
return /* @__PURE__ */ d("div", { children: [
|
|
1058
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1059
1059
|
/* @__PURE__ */ i("span", { className: "w-[70px]", children: "Elapsed:" }),
|
|
1060
|
-
/* @__PURE__ */ i("span", { className: "font-medium", children:
|
|
1060
|
+
/* @__PURE__ */ i("span", { className: "font-medium", children: O ?? "-" })
|
|
1061
1061
|
] }),
|
|
1062
|
-
/* @__PURE__ */ i($s, { percent:
|
|
1063
|
-
/* @__PURE__ */
|
|
1062
|
+
/* @__PURE__ */ i($s, { percent: j, showInfo: !1, size: "small", strokeColor: er(g.priority) }),
|
|
1063
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1064
1064
|
/* @__PURE__ */ i("span", { className: "w-[70px]", children: "Remaining" }),
|
|
1065
|
-
/* @__PURE__ */ i("span", { className: "font-medium", children:
|
|
1065
|
+
/* @__PURE__ */ i("span", { className: "font-medium", children: $ ?? "-" })
|
|
1066
1066
|
] })
|
|
1067
1067
|
] });
|
|
1068
1068
|
}
|
|
@@ -1077,12 +1077,12 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1077
1077
|
title: "Description",
|
|
1078
1078
|
dataIndex: "description",
|
|
1079
1079
|
key: "description",
|
|
1080
|
-
render: (b, g) => /* @__PURE__ */
|
|
1080
|
+
render: (b, g) => /* @__PURE__ */ d("div", { children: [
|
|
1081
1081
|
/* @__PURE__ */ i(
|
|
1082
1082
|
"a",
|
|
1083
1083
|
{
|
|
1084
|
-
onClick: (
|
|
1085
|
-
|
|
1084
|
+
onClick: (O) => {
|
|
1085
|
+
O.preventDefault(), l?.(g, { sourceTab: "active" });
|
|
1086
1086
|
},
|
|
1087
1087
|
className: "inline-block mb-1 text-blue-600",
|
|
1088
1088
|
children: g.alertNumber
|
|
@@ -1093,29 +1093,29 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1093
1093
|
}
|
|
1094
1094
|
], y = r && r.length ? r : x;
|
|
1095
1095
|
return /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(
|
|
1096
|
-
|
|
1096
|
+
Er,
|
|
1097
1097
|
{
|
|
1098
1098
|
rowKey: "id",
|
|
1099
|
-
data:
|
|
1099
|
+
data: E,
|
|
1100
1100
|
columns: y,
|
|
1101
1101
|
loading: t,
|
|
1102
1102
|
pageSize: s,
|
|
1103
|
-
toolbar: /* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */
|
|
1103
|
+
toolbar: /* @__PURE__ */ d(Ae, { gutter: [12, 12], className: "mb-3", align: "middle", children: [
|
|
1104
|
+
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1105
1105
|
/* @__PURE__ */ i("span", { children: "Severity" }),
|
|
1106
|
-
/* @__PURE__ */ i(
|
|
1106
|
+
/* @__PURE__ */ i(xr, { value: c, onChange: S, options: n })
|
|
1107
1107
|
] }) }),
|
|
1108
|
-
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */
|
|
1108
|
+
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1109
1109
|
/* @__PURE__ */ i("span", { children: "Anomaly type" }),
|
|
1110
|
-
/* @__PURE__ */ i(
|
|
1110
|
+
/* @__PURE__ */ i(Ir, { value: f, onChange: R, options: v })
|
|
1111
1111
|
] }) }),
|
|
1112
|
-
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */
|
|
1112
|
+
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1113
1113
|
/* @__PURE__ */ i("span", { children: "Space" }),
|
|
1114
|
-
/* @__PURE__ */ i(
|
|
1114
|
+
/* @__PURE__ */ i(Tr, { value: N, onChange: m, options: p })
|
|
1115
1115
|
] }) }),
|
|
1116
|
-
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */
|
|
1116
|
+
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1117
1117
|
/* @__PURE__ */ i("span", { children: "Action Taken" }),
|
|
1118
|
-
/* @__PURE__ */ i(
|
|
1118
|
+
/* @__PURE__ */ i(kr, { value: A, onChange: B, options: L })
|
|
1119
1119
|
] }) }),
|
|
1120
1120
|
/* @__PURE__ */ i(G, { flex: "auto" }),
|
|
1121
1121
|
/* @__PURE__ */ i(G, { flex: "none", children: /* @__PURE__ */ i(
|
|
@@ -1123,8 +1123,8 @@ function ms({ data: e, loading: t = !1, pageSize: s = 10, columns: r, severityOp
|
|
|
1123
1123
|
{
|
|
1124
1124
|
allowClear: !0,
|
|
1125
1125
|
placeholder: "Search",
|
|
1126
|
-
onSearch:
|
|
1127
|
-
onChange: (b) =>
|
|
1126
|
+
onSearch: _,
|
|
1127
|
+
onChange: (b) => _(b.target.value),
|
|
1128
1128
|
className: "w-[260px] ",
|
|
1129
1129
|
enterButton: !0
|
|
1130
1130
|
}
|
|
@@ -1149,7 +1149,7 @@ var Qe = class {
|
|
|
1149
1149
|
}
|
|
1150
1150
|
onUnsubscribe() {
|
|
1151
1151
|
}
|
|
1152
|
-
},
|
|
1152
|
+
}, Or = {
|
|
1153
1153
|
// We need the wrapper function syntax below instead of direct references to
|
|
1154
1154
|
// global setTimeout etc.
|
|
1155
1155
|
//
|
|
@@ -1164,14 +1164,14 @@ var Qe = class {
|
|
|
1164
1164
|
clearTimeout: (e) => clearTimeout(e),
|
|
1165
1165
|
setInterval: (e, t) => setInterval(e, t),
|
|
1166
1166
|
clearInterval: (e) => clearInterval(e)
|
|
1167
|
-
},
|
|
1167
|
+
}, Pr = class {
|
|
1168
1168
|
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
1169
1169
|
// type at app boot; and if we leave that type, then any new timer provider
|
|
1170
1170
|
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
1171
1171
|
//
|
|
1172
1172
|
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
1173
1173
|
// this class is unsafe internally to allow for extension.
|
|
1174
|
-
#e =
|
|
1174
|
+
#e = Or;
|
|
1175
1175
|
#t = !1;
|
|
1176
1176
|
setTimeoutProvider(e) {
|
|
1177
1177
|
process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error(
|
|
@@ -1191,14 +1191,14 @@ var Qe = class {
|
|
|
1191
1191
|
clearInterval(e) {
|
|
1192
1192
|
this.#e.clearInterval(e);
|
|
1193
1193
|
}
|
|
1194
|
-
}, Le = new
|
|
1195
|
-
function
|
|
1194
|
+
}, Le = new Pr();
|
|
1195
|
+
function Mr(e) {
|
|
1196
1196
|
setTimeout(e, 0);
|
|
1197
1197
|
}
|
|
1198
1198
|
var $e = typeof window > "u" || "Deno" in globalThis;
|
|
1199
|
-
function
|
|
1199
|
+
function ye() {
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function Dr(e, t) {
|
|
1202
1202
|
return typeof e == "function" ? e(t) : e;
|
|
1203
1203
|
}
|
|
1204
1204
|
function pt(e) {
|
|
@@ -1226,12 +1226,12 @@ function Yt(e, t) {
|
|
|
1226
1226
|
if (r) {
|
|
1227
1227
|
if (t.queryHash !== Rt(o, t.options))
|
|
1228
1228
|
return !1;
|
|
1229
|
-
} else if (!
|
|
1229
|
+
} else if (!Ke(t.queryKey, o))
|
|
1230
1230
|
return !1;
|
|
1231
1231
|
}
|
|
1232
1232
|
if (s !== "all") {
|
|
1233
|
-
const
|
|
1234
|
-
if (s === "active" && !
|
|
1233
|
+
const h = t.isActive();
|
|
1234
|
+
if (s === "active" && !h || s === "inactive" && h)
|
|
1235
1235
|
return !1;
|
|
1236
1236
|
}
|
|
1237
1237
|
return !(typeof l == "boolean" && t.isStale() !== l || n && n !== t.state.fetchStatus || a && !a(t));
|
|
@@ -1244,7 +1244,7 @@ function zt(e, t) {
|
|
|
1244
1244
|
if (s) {
|
|
1245
1245
|
if (Be(t.options.mutationKey) !== Be(a))
|
|
1246
1246
|
return !1;
|
|
1247
|
-
} else if (!
|
|
1247
|
+
} else if (!Ke(t.options.mutationKey, a))
|
|
1248
1248
|
return !1;
|
|
1249
1249
|
}
|
|
1250
1250
|
return !(r && t.state.status !== r || n && !n(t));
|
|
@@ -1258,32 +1258,32 @@ function Be(e) {
|
|
|
1258
1258
|
(t, s) => gt(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
|
|
1259
1259
|
);
|
|
1260
1260
|
}
|
|
1261
|
-
function
|
|
1262
|
-
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) =>
|
|
1261
|
+
function Ke(e, t) {
|
|
1262
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((s) => Ke(e[s], t[s])) : !1;
|
|
1263
1263
|
}
|
|
1264
|
-
var
|
|
1264
|
+
var Fr = Object.prototype.hasOwnProperty;
|
|
1265
1265
|
function yt(e, t, s = 0) {
|
|
1266
1266
|
if (e === t)
|
|
1267
1267
|
return e;
|
|
1268
1268
|
if (s > 500) return t;
|
|
1269
1269
|
const r = Vt(e) && Vt(t);
|
|
1270
1270
|
if (!r && !(gt(e) && gt(t))) return t;
|
|
1271
|
-
const a = (r ? e : Object.keys(e)).length, o = r ? t : Object.keys(t), l = o.length,
|
|
1271
|
+
const a = (r ? e : Object.keys(e)).length, o = r ? t : Object.keys(t), l = o.length, h = r ? new Array(l) : {};
|
|
1272
1272
|
let u = 0;
|
|
1273
1273
|
for (let c = 0; c < l; c++) {
|
|
1274
|
-
const S = r ? c : o[c], f = e[S],
|
|
1275
|
-
if (f ===
|
|
1276
|
-
|
|
1274
|
+
const S = r ? c : o[c], f = e[S], R = t[S];
|
|
1275
|
+
if (f === R) {
|
|
1276
|
+
h[S] = f, (r ? c < a : Fr.call(e, S)) && u++;
|
|
1277
1277
|
continue;
|
|
1278
1278
|
}
|
|
1279
|
-
if (f === null ||
|
|
1280
|
-
|
|
1279
|
+
if (f === null || R === null || typeof f != "object" || typeof R != "object") {
|
|
1280
|
+
h[S] = R;
|
|
1281
1281
|
continue;
|
|
1282
1282
|
}
|
|
1283
|
-
const N = yt(f,
|
|
1284
|
-
|
|
1283
|
+
const N = yt(f, R, s + 1);
|
|
1284
|
+
h[S] = N, N === f && u++;
|
|
1285
1285
|
}
|
|
1286
|
-
return a === l && u === a ? e :
|
|
1286
|
+
return a === l && u === a ? e : h;
|
|
1287
1287
|
}
|
|
1288
1288
|
function st(e, t) {
|
|
1289
1289
|
if (!t || Object.keys(e).length !== Object.keys(t).length)
|
|
@@ -1308,7 +1308,7 @@ function gt(e) {
|
|
|
1308
1308
|
function Jt(e) {
|
|
1309
1309
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1311
|
+
function Ur(e) {
|
|
1312
1312
|
return new Promise((t) => {
|
|
1313
1313
|
Le.setTimeout(t, e);
|
|
1314
1314
|
});
|
|
@@ -1329,11 +1329,11 @@ function vt(e, t, s) {
|
|
|
1329
1329
|
}
|
|
1330
1330
|
return t;
|
|
1331
1331
|
}
|
|
1332
|
-
function
|
|
1332
|
+
function Lr(e, t, s = 0) {
|
|
1333
1333
|
const r = [...e, t];
|
|
1334
1334
|
return s && r.length > s ? r.slice(1) : r;
|
|
1335
1335
|
}
|
|
1336
|
-
function
|
|
1336
|
+
function $r(e, t, s = 0) {
|
|
1337
1337
|
const r = [t, ...e];
|
|
1338
1338
|
return s && r.length > s ? r.slice(0, -1) : r;
|
|
1339
1339
|
}
|
|
@@ -1346,14 +1346,14 @@ function ys(e, t) {
|
|
|
1346
1346
|
function kt(e, t) {
|
|
1347
1347
|
return typeof e == "function" ? e(...t) : !!e;
|
|
1348
1348
|
}
|
|
1349
|
-
function
|
|
1349
|
+
function Br(e, t, s) {
|
|
1350
1350
|
let r = !1, n;
|
|
1351
1351
|
return Object.defineProperty(e, "signal", {
|
|
1352
1352
|
enumerable: !0,
|
|
1353
1353
|
get: () => (n ??= t(), r || (r = !0, n.aborted ? s() : n.addEventListener("abort", s, { once: !0 })), n)
|
|
1354
1354
|
}), e;
|
|
1355
1355
|
}
|
|
1356
|
-
var
|
|
1356
|
+
var jr = class extends Qe {
|
|
1357
1357
|
#e;
|
|
1358
1358
|
#t;
|
|
1359
1359
|
#s;
|
|
@@ -1390,7 +1390,7 @@ var Br = class extends Qe {
|
|
|
1390
1390
|
isFocused() {
|
|
1391
1391
|
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
1392
1392
|
}
|
|
1393
|
-
}, Et = new
|
|
1393
|
+
}, Et = new jr();
|
|
1394
1394
|
function bt() {
|
|
1395
1395
|
let e, t;
|
|
1396
1396
|
const s = new Promise((n, a) => {
|
|
@@ -1413,13 +1413,13 @@ function bt() {
|
|
|
1413
1413
|
}), t(n);
|
|
1414
1414
|
}, s;
|
|
1415
1415
|
}
|
|
1416
|
-
var
|
|
1417
|
-
function
|
|
1416
|
+
var _r = Mr;
|
|
1417
|
+
function qr() {
|
|
1418
1418
|
let e = [], t = 0, s = (l) => {
|
|
1419
1419
|
l();
|
|
1420
1420
|
}, r = (l) => {
|
|
1421
1421
|
l();
|
|
1422
|
-
}, n =
|
|
1422
|
+
}, n = _r;
|
|
1423
1423
|
const a = (l) => {
|
|
1424
1424
|
t ? e.push(l) : n(() => {
|
|
1425
1425
|
s(l);
|
|
@@ -1428,29 +1428,29 @@ function _r() {
|
|
|
1428
1428
|
const l = e;
|
|
1429
1429
|
e = [], l.length && n(() => {
|
|
1430
1430
|
r(() => {
|
|
1431
|
-
l.forEach((
|
|
1432
|
-
s(
|
|
1431
|
+
l.forEach((h) => {
|
|
1432
|
+
s(h);
|
|
1433
1433
|
});
|
|
1434
1434
|
});
|
|
1435
1435
|
});
|
|
1436
1436
|
};
|
|
1437
1437
|
return {
|
|
1438
1438
|
batch: (l) => {
|
|
1439
|
-
let
|
|
1439
|
+
let h;
|
|
1440
1440
|
t++;
|
|
1441
1441
|
try {
|
|
1442
|
-
|
|
1442
|
+
h = l();
|
|
1443
1443
|
} finally {
|
|
1444
1444
|
t--, t || o();
|
|
1445
1445
|
}
|
|
1446
|
-
return
|
|
1446
|
+
return h;
|
|
1447
1447
|
},
|
|
1448
1448
|
/**
|
|
1449
1449
|
* All calls to the wrapped function will be batched.
|
|
1450
1450
|
*/
|
|
1451
|
-
batchCalls: (l) => (...
|
|
1451
|
+
batchCalls: (l) => (...h) => {
|
|
1452
1452
|
a(() => {
|
|
1453
|
-
l(...
|
|
1453
|
+
l(...h);
|
|
1454
1454
|
});
|
|
1455
1455
|
},
|
|
1456
1456
|
schedule: a,
|
|
@@ -1473,7 +1473,7 @@ function _r() {
|
|
|
1473
1473
|
}
|
|
1474
1474
|
};
|
|
1475
1475
|
}
|
|
1476
|
-
var
|
|
1476
|
+
var le = qr(), Qr = class extends Qe {
|
|
1477
1477
|
#e = !0;
|
|
1478
1478
|
#t;
|
|
1479
1479
|
#s;
|
|
@@ -1504,8 +1504,8 @@ var oe = _r(), qr = class extends Qe {
|
|
|
1504
1504
|
isOnline() {
|
|
1505
1505
|
return this.#e;
|
|
1506
1506
|
}
|
|
1507
|
-
}, nt = new
|
|
1508
|
-
function
|
|
1507
|
+
}, nt = new Qr();
|
|
1508
|
+
function Hr(e) {
|
|
1509
1509
|
return Math.min(1e3 * 2 ** e, 3e4);
|
|
1510
1510
|
}
|
|
1511
1511
|
function gs(e) {
|
|
@@ -1525,13 +1525,13 @@ function vs(e) {
|
|
|
1525
1525
|
}
|
|
1526
1526
|
}, l = () => {
|
|
1527
1527
|
t = !0;
|
|
1528
|
-
},
|
|
1528
|
+
}, h = () => {
|
|
1529
1529
|
t = !1;
|
|
1530
1530
|
}, u = () => Et.isFocused() && (e.networkMode === "always" || nt.isOnline()) && e.canRun(), c = () => gs(e.networkMode) && e.canRun(), S = (m) => {
|
|
1531
1531
|
a() || (r?.(), n.resolve(m));
|
|
1532
1532
|
}, f = (m) => {
|
|
1533
1533
|
a() || (r?.(), n.reject(m));
|
|
1534
|
-
},
|
|
1534
|
+
}, R = () => new Promise((m) => {
|
|
1535
1535
|
r = (A) => {
|
|
1536
1536
|
(a() || u()) && m(A);
|
|
1537
1537
|
}, e.onPause?.();
|
|
@@ -1544,19 +1544,19 @@ function vs(e) {
|
|
|
1544
1544
|
const A = s === 0 ? e.initialPromise : void 0;
|
|
1545
1545
|
try {
|
|
1546
1546
|
m = A ?? e.fn();
|
|
1547
|
-
} catch (
|
|
1548
|
-
m = Promise.reject(
|
|
1547
|
+
} catch (B) {
|
|
1548
|
+
m = Promise.reject(B);
|
|
1549
1549
|
}
|
|
1550
|
-
Promise.resolve(m).then(S).catch((
|
|
1550
|
+
Promise.resolve(m).then(S).catch((B) => {
|
|
1551
1551
|
if (a())
|
|
1552
1552
|
return;
|
|
1553
|
-
const
|
|
1553
|
+
const U = e.retry ?? ($e ? 0 : 3), _ = e.retryDelay ?? Hr, L = typeof _ == "function" ? _(s, B) : _, J = U === !0 || typeof U == "number" && s < U || typeof U == "function" && U(s, B);
|
|
1554
1554
|
if (t || !J) {
|
|
1555
|
-
f(
|
|
1555
|
+
f(B);
|
|
1556
1556
|
return;
|
|
1557
1557
|
}
|
|
1558
|
-
s++, e.onFail?.(s,
|
|
1559
|
-
t ? f(
|
|
1558
|
+
s++, e.onFail?.(s, B), Ur(L).then(() => u() ? void 0 : R()).then(() => {
|
|
1559
|
+
t ? f(B) : N();
|
|
1560
1560
|
});
|
|
1561
1561
|
});
|
|
1562
1562
|
};
|
|
@@ -1566,9 +1566,9 @@ function vs(e) {
|
|
|
1566
1566
|
cancel: o,
|
|
1567
1567
|
continue: () => (r?.(), n),
|
|
1568
1568
|
cancelRetry: l,
|
|
1569
|
-
continueRetry:
|
|
1569
|
+
continueRetry: h,
|
|
1570
1570
|
canStart: c,
|
|
1571
|
-
start: () => (c() ? N() :
|
|
1571
|
+
start: () => (c() ? N() : R().then(N), n)
|
|
1572
1572
|
};
|
|
1573
1573
|
}
|
|
1574
1574
|
var bs = class {
|
|
@@ -1590,7 +1590,7 @@ var bs = class {
|
|
|
1590
1590
|
clearGcTimeout() {
|
|
1591
1591
|
this.#e && (Le.clearTimeout(this.#e), this.#e = void 0);
|
|
1592
1592
|
}
|
|
1593
|
-
},
|
|
1593
|
+
}, Gr = class extends bs {
|
|
1594
1594
|
#e;
|
|
1595
1595
|
#t;
|
|
1596
1596
|
#s;
|
|
@@ -1632,7 +1632,7 @@ var bs = class {
|
|
|
1632
1632
|
}
|
|
1633
1633
|
cancel(e) {
|
|
1634
1634
|
const t = this.#r?.promise;
|
|
1635
|
-
return this.#r?.cancel(e), t ? t.then(
|
|
1635
|
+
return this.#r?.cancel(e), t ? t.then(ye).catch(ye) : Promise.resolve();
|
|
1636
1636
|
}
|
|
1637
1637
|
destroy() {
|
|
1638
1638
|
super.destroy(), this.cancel({ silent: !0 });
|
|
@@ -1690,7 +1690,7 @@ var bs = class {
|
|
|
1690
1690
|
return this.#r.continueRetry(), this.#r.promise;
|
|
1691
1691
|
}
|
|
1692
1692
|
if (e && this.setOptions(e), !this.options.queryFn) {
|
|
1693
|
-
const l = this.observers.find((
|
|
1693
|
+
const l = this.observers.find((h) => h.options.queryFn);
|
|
1694
1694
|
l && this.setOptions(l.options);
|
|
1695
1695
|
}
|
|
1696
1696
|
process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
|
|
@@ -1735,8 +1735,8 @@ var bs = class {
|
|
|
1735
1735
|
fetchStatus: "idle"
|
|
1736
1736
|
}), s.abort();
|
|
1737
1737
|
},
|
|
1738
|
-
onFail: (l,
|
|
1739
|
-
this.#i({ type: "failed", failureCount: l, error:
|
|
1738
|
+
onFail: (l, h) => {
|
|
1739
|
+
this.#i({ type: "failed", failureCount: l, error: h });
|
|
1740
1740
|
},
|
|
1741
1741
|
onPause: () => {
|
|
1742
1742
|
this.#i({ type: "pause" });
|
|
@@ -1849,7 +1849,7 @@ var bs = class {
|
|
|
1849
1849
|
};
|
|
1850
1850
|
}
|
|
1851
1851
|
};
|
|
1852
|
-
this.state = t(this.state),
|
|
1852
|
+
this.state = t(this.state), le.batch(() => {
|
|
1853
1853
|
this.observers.forEach((s) => {
|
|
1854
1854
|
s.onQueryUpdate();
|
|
1855
1855
|
}), this.#s.notify({ query: this, type: "updated", action: e });
|
|
@@ -1893,7 +1893,7 @@ function Xt(e) {
|
|
|
1893
1893
|
fetchStatus: "idle"
|
|
1894
1894
|
};
|
|
1895
1895
|
}
|
|
1896
|
-
var
|
|
1896
|
+
var Wr = class extends Qe {
|
|
1897
1897
|
constructor(e, t) {
|
|
1898
1898
|
super(), this.options = t, this.#e = e, this.#i = null, this.#o = bt(), this.bindMethods(), this.setOptions(t);
|
|
1899
1899
|
}
|
|
@@ -1963,7 +1963,7 @@ var Gr = class extends Qe {
|
|
|
1963
1963
|
}
|
|
1964
1964
|
getOptimisticResult(e) {
|
|
1965
1965
|
const t = this.#e.getQueryCache().build(this.#e, e), s = this.createResult(t, e);
|
|
1966
|
-
return
|
|
1966
|
+
return Yr(this, s) && (this.#n = s, this.#a = this.options, this.#r = this.#t.state), s;
|
|
1967
1967
|
}
|
|
1968
1968
|
getCurrentResult() {
|
|
1969
1969
|
return this.#n;
|
|
@@ -2004,7 +2004,7 @@ var Gr = class extends Qe {
|
|
|
2004
2004
|
this.options,
|
|
2005
2005
|
e
|
|
2006
2006
|
);
|
|
2007
|
-
return e?.throwOnError || (t = t.catch(
|
|
2007
|
+
return e?.throwOnError || (t = t.catch(ye)), t;
|
|
2008
2008
|
}
|
|
2009
2009
|
#y() {
|
|
2010
2010
|
this.#A();
|
|
@@ -2037,7 +2037,7 @@ var Gr = class extends Qe {
|
|
|
2037
2037
|
this.#u && (Le.clearInterval(this.#u), this.#u = void 0);
|
|
2038
2038
|
}
|
|
2039
2039
|
createResult(e, t) {
|
|
2040
|
-
const s = this.#t, r = this.options, n = this.#n, a = this.#r, o = this.#a,
|
|
2040
|
+
const s = this.#t, r = this.options, n = this.#n, a = this.#r, o = this.#a, h = e !== s ? e.state : this.#s, { state: u } = e;
|
|
2041
2041
|
let c = { ...u }, S = !1, f;
|
|
2042
2042
|
if (t._optimisticResults) {
|
|
2043
2043
|
const K = this.hasListeners(), T = !K && es(e, t), I = K && ts(e, s, t, r);
|
|
@@ -2046,7 +2046,7 @@ var Gr = class extends Qe {
|
|
|
2046
2046
|
...As(u.data, e.options)
|
|
2047
2047
|
}), t._optimisticResults === "isRestoring" && (c.fetchStatus = "idle");
|
|
2048
2048
|
}
|
|
2049
|
-
let { error:
|
|
2049
|
+
let { error: R, errorUpdatedAt: N, status: m } = c;
|
|
2050
2050
|
f = c.data;
|
|
2051
2051
|
let A = !1;
|
|
2052
2052
|
if (t.placeholderData !== void 0 && f === void 0 && m === "pending") {
|
|
@@ -2069,30 +2069,30 @@ var Gr = class extends Qe {
|
|
|
2069
2069
|
} catch (K) {
|
|
2070
2070
|
this.#i = K;
|
|
2071
2071
|
}
|
|
2072
|
-
this.#i && (
|
|
2073
|
-
const
|
|
2072
|
+
this.#i && (R = this.#i, f = this.#h, N = Date.now(), m = "error");
|
|
2073
|
+
const B = c.fetchStatus === "fetching", U = m === "pending", _ = m === "error", L = U && B, J = f !== void 0, Y = {
|
|
2074
2074
|
status: m,
|
|
2075
2075
|
fetchStatus: c.fetchStatus,
|
|
2076
|
-
isPending:
|
|
2076
|
+
isPending: U,
|
|
2077
2077
|
isSuccess: m === "success",
|
|
2078
|
-
isError:
|
|
2078
|
+
isError: _,
|
|
2079
2079
|
isInitialLoading: L,
|
|
2080
2080
|
isLoading: L,
|
|
2081
2081
|
data: f,
|
|
2082
2082
|
dataUpdatedAt: c.dataUpdatedAt,
|
|
2083
|
-
error:
|
|
2083
|
+
error: R,
|
|
2084
2084
|
errorUpdatedAt: N,
|
|
2085
2085
|
failureCount: c.fetchFailureCount,
|
|
2086
2086
|
failureReason: c.fetchFailureReason,
|
|
2087
2087
|
errorUpdateCount: c.errorUpdateCount,
|
|
2088
2088
|
isFetched: c.dataUpdateCount > 0 || c.errorUpdateCount > 0,
|
|
2089
|
-
isFetchedAfterMount: c.dataUpdateCount >
|
|
2090
|
-
isFetching:
|
|
2091
|
-
isRefetching:
|
|
2092
|
-
isLoadingError:
|
|
2089
|
+
isFetchedAfterMount: c.dataUpdateCount > h.dataUpdateCount || c.errorUpdateCount > h.errorUpdateCount,
|
|
2090
|
+
isFetching: B,
|
|
2091
|
+
isRefetching: B && !U,
|
|
2092
|
+
isLoadingError: _ && !J,
|
|
2093
2093
|
isPaused: c.fetchStatus === "paused",
|
|
2094
2094
|
isPlaceholderData: S,
|
|
2095
|
-
isRefetchError:
|
|
2095
|
+
isRefetchError: _ && J,
|
|
2096
2096
|
isStale: Ot(e, t),
|
|
2097
2097
|
refetch: this.refetch,
|
|
2098
2098
|
promise: this.#o,
|
|
@@ -2101,7 +2101,7 @@ var Gr = class extends Qe {
|
|
|
2101
2101
|
if (this.options.experimental_prefetchInRender) {
|
|
2102
2102
|
const K = Y.data !== void 0, T = Y.status === "error" && !K, I = (te) => {
|
|
2103
2103
|
T ? te.reject(Y.error) : K && te.resolve(Y.data);
|
|
2104
|
-
},
|
|
2104
|
+
}, k = () => {
|
|
2105
2105
|
const te = this.#o = Y.promise = bt();
|
|
2106
2106
|
I(te);
|
|
2107
2107
|
}, W = this.#o;
|
|
@@ -2110,10 +2110,10 @@ var Gr = class extends Qe {
|
|
|
2110
2110
|
e.queryHash === s.queryHash && I(W);
|
|
2111
2111
|
break;
|
|
2112
2112
|
case "fulfilled":
|
|
2113
|
-
(T || Y.data !== W.value) &&
|
|
2113
|
+
(T || Y.data !== W.value) && k();
|
|
2114
2114
|
break;
|
|
2115
2115
|
case "rejected":
|
|
2116
|
-
(!T || Y.error !== W.reason) &&
|
|
2116
|
+
(!T || Y.error !== W.reason) && k();
|
|
2117
2117
|
break;
|
|
2118
2118
|
}
|
|
2119
2119
|
}
|
|
@@ -2151,7 +2151,7 @@ var Gr = class extends Qe {
|
|
|
2151
2151
|
this.updateResult(), this.hasListeners() && this.#b();
|
|
2152
2152
|
}
|
|
2153
2153
|
#N(e) {
|
|
2154
|
-
|
|
2154
|
+
le.batch(() => {
|
|
2155
2155
|
e.listeners && this.listeners.forEach((t) => {
|
|
2156
2156
|
t(this.#n);
|
|
2157
2157
|
}), this.#e.getQueryCache().notify({
|
|
@@ -2161,11 +2161,11 @@ var Gr = class extends Qe {
|
|
|
2161
2161
|
});
|
|
2162
2162
|
}
|
|
2163
2163
|
};
|
|
2164
|
-
function
|
|
2164
|
+
function Kr(e, t) {
|
|
2165
2165
|
return Ne(t.enabled, e) !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
2166
2166
|
}
|
|
2167
2167
|
function es(e, t) {
|
|
2168
|
-
return
|
|
2168
|
+
return Kr(e, t) || e.state.data !== void 0 && St(e, t, t.refetchOnMount);
|
|
2169
2169
|
}
|
|
2170
2170
|
function St(e, t, s) {
|
|
2171
2171
|
if (Ne(t.enabled, e) !== !1 && Fe(t.staleTime, e) !== "static") {
|
|
@@ -2180,28 +2180,28 @@ function ts(e, t, s, r) {
|
|
|
2180
2180
|
function Ot(e, t) {
|
|
2181
2181
|
return Ne(t.enabled, e) !== !1 && e.isStaleByTime(Fe(t.staleTime, e));
|
|
2182
2182
|
}
|
|
2183
|
-
function
|
|
2183
|
+
function Yr(e, t) {
|
|
2184
2184
|
return !st(e.getCurrentResult(), t);
|
|
2185
2185
|
}
|
|
2186
2186
|
function ss(e) {
|
|
2187
2187
|
return {
|
|
2188
2188
|
onFetch: (t, s) => {
|
|
2189
2189
|
const r = t.options, n = t.fetchOptions?.meta?.fetchMore?.direction, a = t.state.data?.pages || [], o = t.state.data?.pageParams || [];
|
|
2190
|
-
let l = { pages: [], pageParams: [] },
|
|
2190
|
+
let l = { pages: [], pageParams: [] }, h = 0;
|
|
2191
2191
|
const u = async () => {
|
|
2192
2192
|
let c = !1;
|
|
2193
2193
|
const S = (N) => {
|
|
2194
|
-
|
|
2194
|
+
Br(
|
|
2195
2195
|
N,
|
|
2196
2196
|
() => t.signal,
|
|
2197
2197
|
() => c = !0
|
|
2198
2198
|
);
|
|
2199
|
-
}, f = ys(t.options, t.fetchOptions),
|
|
2199
|
+
}, f = ys(t.options, t.fetchOptions), R = async (N, m, A) => {
|
|
2200
2200
|
if (c)
|
|
2201
2201
|
return Promise.reject();
|
|
2202
2202
|
if (m == null && N.pages.length)
|
|
2203
2203
|
return Promise.resolve(N);
|
|
2204
|
-
const
|
|
2204
|
+
const U = (() => {
|
|
2205
2205
|
const V = {
|
|
2206
2206
|
client: t.client,
|
|
2207
2207
|
queryKey: t.queryKey,
|
|
@@ -2210,26 +2210,26 @@ function ss(e) {
|
|
|
2210
2210
|
meta: t.options.meta
|
|
2211
2211
|
};
|
|
2212
2212
|
return S(V), V;
|
|
2213
|
-
})(),
|
|
2213
|
+
})(), _ = await f(U), { maxPages: L } = t.options, J = A ? $r : Lr;
|
|
2214
2214
|
return {
|
|
2215
|
-
pages: J(N.pages,
|
|
2215
|
+
pages: J(N.pages, _, L),
|
|
2216
2216
|
pageParams: J(N.pageParams, m, L)
|
|
2217
2217
|
};
|
|
2218
2218
|
};
|
|
2219
2219
|
if (n && a.length) {
|
|
2220
|
-
const N = n === "backward", m = N ?
|
|
2220
|
+
const N = n === "backward", m = N ? zr : rs, A = {
|
|
2221
2221
|
pages: a,
|
|
2222
2222
|
pageParams: o
|
|
2223
|
-
},
|
|
2224
|
-
l = await
|
|
2223
|
+
}, B = m(r, A);
|
|
2224
|
+
l = await R(A, B, N);
|
|
2225
2225
|
} else {
|
|
2226
2226
|
const N = e ?? a.length;
|
|
2227
2227
|
do {
|
|
2228
|
-
const m =
|
|
2229
|
-
if (
|
|
2228
|
+
const m = h === 0 ? o[0] ?? r.initialPageParam : rs(r, l);
|
|
2229
|
+
if (h > 0 && m == null)
|
|
2230
2230
|
break;
|
|
2231
|
-
l = await
|
|
2232
|
-
} while (
|
|
2231
|
+
l = await R(l, m), h++;
|
|
2232
|
+
} while (h < N);
|
|
2233
2233
|
}
|
|
2234
2234
|
return l;
|
|
2235
2235
|
};
|
|
@@ -2255,10 +2255,10 @@ function rs(e, { pages: t, pageParams: s }) {
|
|
|
2255
2255
|
s
|
|
2256
2256
|
) : void 0;
|
|
2257
2257
|
}
|
|
2258
|
-
function
|
|
2258
|
+
function zr(e, { pages: t, pageParams: s }) {
|
|
2259
2259
|
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, s[0], s) : void 0;
|
|
2260
2260
|
}
|
|
2261
|
-
var
|
|
2261
|
+
var Vr = class extends bs {
|
|
2262
2262
|
#e;
|
|
2263
2263
|
#t;
|
|
2264
2264
|
#s;
|
|
@@ -2466,7 +2466,7 @@ var zr = class extends bs {
|
|
|
2466
2466
|
};
|
|
2467
2467
|
}
|
|
2468
2468
|
};
|
|
2469
|
-
this.state = t(this.state),
|
|
2469
|
+
this.state = t(this.state), le.batch(() => {
|
|
2470
2470
|
this.#t.forEach((s) => {
|
|
2471
2471
|
s.onMutationUpdate(e);
|
|
2472
2472
|
}), this.#s.notify({
|
|
@@ -2490,7 +2490,7 @@ function Ss() {
|
|
|
2490
2490
|
submittedAt: 0
|
|
2491
2491
|
};
|
|
2492
2492
|
}
|
|
2493
|
-
var
|
|
2493
|
+
var Jr = class extends Qe {
|
|
2494
2494
|
constructor(e = {}) {
|
|
2495
2495
|
super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#s = 0;
|
|
2496
2496
|
}
|
|
@@ -2498,7 +2498,7 @@ var Vr = class extends Qe {
|
|
|
2498
2498
|
#t;
|
|
2499
2499
|
#s;
|
|
2500
2500
|
build(e, t, s) {
|
|
2501
|
-
const r = new
|
|
2501
|
+
const r = new Vr({
|
|
2502
2502
|
client: e,
|
|
2503
2503
|
mutationCache: this,
|
|
2504
2504
|
mutationId: ++this.#s,
|
|
@@ -2509,7 +2509,7 @@ var Vr = class extends Qe {
|
|
|
2509
2509
|
}
|
|
2510
2510
|
add(e) {
|
|
2511
2511
|
this.#e.add(e);
|
|
2512
|
-
const t =
|
|
2512
|
+
const t = Xe(e);
|
|
2513
2513
|
if (typeof t == "string") {
|
|
2514
2514
|
const s = this.#t.get(t);
|
|
2515
2515
|
s ? s.push(e) : this.#t.set(t, [e]);
|
|
@@ -2518,7 +2518,7 @@ var Vr = class extends Qe {
|
|
|
2518
2518
|
}
|
|
2519
2519
|
remove(e) {
|
|
2520
2520
|
if (this.#e.delete(e)) {
|
|
2521
|
-
const t =
|
|
2521
|
+
const t = Xe(e);
|
|
2522
2522
|
if (typeof t == "string") {
|
|
2523
2523
|
const s = this.#t.get(t);
|
|
2524
2524
|
if (s)
|
|
@@ -2531,7 +2531,7 @@ var Vr = class extends Qe {
|
|
|
2531
2531
|
this.notify({ type: "removed", mutation: e });
|
|
2532
2532
|
}
|
|
2533
2533
|
canRun(e) {
|
|
2534
|
-
const t =
|
|
2534
|
+
const t = Xe(e);
|
|
2535
2535
|
if (typeof t == "string") {
|
|
2536
2536
|
const r = this.#t.get(t)?.find(
|
|
2537
2537
|
(n) => n.state.status === "pending"
|
|
@@ -2541,11 +2541,11 @@ var Vr = class extends Qe {
|
|
|
2541
2541
|
return !0;
|
|
2542
2542
|
}
|
|
2543
2543
|
runNext(e) {
|
|
2544
|
-
const t =
|
|
2544
|
+
const t = Xe(e);
|
|
2545
2545
|
return typeof t == "string" ? this.#t.get(t)?.find((r) => r !== e && r.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
|
|
2546
2546
|
}
|
|
2547
2547
|
clear() {
|
|
2548
|
-
|
|
2548
|
+
le.batch(() => {
|
|
2549
2549
|
this.#e.forEach((e) => {
|
|
2550
2550
|
this.notify({ type: "removed", mutation: e });
|
|
2551
2551
|
}), this.#e.clear(), this.#t.clear();
|
|
@@ -2564,7 +2564,7 @@ var Vr = class extends Qe {
|
|
|
2564
2564
|
return this.getAll().filter((t) => zt(e, t));
|
|
2565
2565
|
}
|
|
2566
2566
|
notify(e) {
|
|
2567
|
-
|
|
2567
|
+
le.batch(() => {
|
|
2568
2568
|
this.listeners.forEach((t) => {
|
|
2569
2569
|
t(e);
|
|
2570
2570
|
});
|
|
@@ -2572,17 +2572,17 @@ var Vr = class extends Qe {
|
|
|
2572
2572
|
}
|
|
2573
2573
|
resumePausedMutations() {
|
|
2574
2574
|
const e = this.getAll().filter((t) => t.state.isPaused);
|
|
2575
|
-
return
|
|
2575
|
+
return le.batch(
|
|
2576
2576
|
() => Promise.all(
|
|
2577
|
-
e.map((t) => t.continue().catch(
|
|
2577
|
+
e.map((t) => t.continue().catch(ye))
|
|
2578
2578
|
)
|
|
2579
2579
|
);
|
|
2580
2580
|
}
|
|
2581
2581
|
};
|
|
2582
|
-
function
|
|
2582
|
+
function Xe(e) {
|
|
2583
2583
|
return e.options.scope?.id;
|
|
2584
2584
|
}
|
|
2585
|
-
var
|
|
2585
|
+
var Zr = class extends Qe {
|
|
2586
2586
|
#e;
|
|
2587
2587
|
#t = void 0;
|
|
2588
2588
|
#s;
|
|
@@ -2629,7 +2629,7 @@ var Jr = class extends Qe {
|
|
|
2629
2629
|
};
|
|
2630
2630
|
}
|
|
2631
2631
|
#a(e) {
|
|
2632
|
-
|
|
2632
|
+
le.batch(() => {
|
|
2633
2633
|
if (this.#n && this.hasListeners()) {
|
|
2634
2634
|
const t = this.#t.variables, s = this.#t.context, r = {
|
|
2635
2635
|
client: this.#e,
|
|
@@ -2687,7 +2687,7 @@ var Jr = class extends Qe {
|
|
|
2687
2687
|
});
|
|
2688
2688
|
});
|
|
2689
2689
|
}
|
|
2690
|
-
},
|
|
2690
|
+
}, Xr = class extends Qe {
|
|
2691
2691
|
constructor(e = {}) {
|
|
2692
2692
|
super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
|
|
2693
2693
|
}
|
|
@@ -2695,7 +2695,7 @@ var Jr = class extends Qe {
|
|
|
2695
2695
|
build(e, t, s) {
|
|
2696
2696
|
const r = t.queryKey, n = t.queryHash ?? Rt(r, t);
|
|
2697
2697
|
let a = this.get(n);
|
|
2698
|
-
return a || (a = new
|
|
2698
|
+
return a || (a = new Gr({
|
|
2699
2699
|
client: e,
|
|
2700
2700
|
queryKey: r,
|
|
2701
2701
|
queryHash: n,
|
|
@@ -2715,7 +2715,7 @@ var Jr = class extends Qe {
|
|
|
2715
2715
|
t && (e.destroy(), t === e && this.#e.delete(e.queryHash), this.notify({ type: "removed", query: e }));
|
|
2716
2716
|
}
|
|
2717
2717
|
clear() {
|
|
2718
|
-
|
|
2718
|
+
le.batch(() => {
|
|
2719
2719
|
this.getAll().forEach((e) => {
|
|
2720
2720
|
this.remove(e);
|
|
2721
2721
|
});
|
|
@@ -2738,27 +2738,27 @@ var Jr = class extends Qe {
|
|
|
2738
2738
|
return Object.keys(e).length > 0 ? t.filter((s) => Yt(e, s)) : t;
|
|
2739
2739
|
}
|
|
2740
2740
|
notify(e) {
|
|
2741
|
-
|
|
2741
|
+
le.batch(() => {
|
|
2742
2742
|
this.listeners.forEach((t) => {
|
|
2743
2743
|
t(e);
|
|
2744
2744
|
});
|
|
2745
2745
|
});
|
|
2746
2746
|
}
|
|
2747
2747
|
onFocus() {
|
|
2748
|
-
|
|
2748
|
+
le.batch(() => {
|
|
2749
2749
|
this.getAll().forEach((e) => {
|
|
2750
2750
|
e.onFocus();
|
|
2751
2751
|
});
|
|
2752
2752
|
});
|
|
2753
2753
|
}
|
|
2754
2754
|
onOnline() {
|
|
2755
|
-
|
|
2755
|
+
le.batch(() => {
|
|
2756
2756
|
this.getAll().forEach((e) => {
|
|
2757
2757
|
e.onOnline();
|
|
2758
2758
|
});
|
|
2759
2759
|
});
|
|
2760
2760
|
}
|
|
2761
|
-
},
|
|
2761
|
+
}, en = class {
|
|
2762
2762
|
#e;
|
|
2763
2763
|
#t;
|
|
2764
2764
|
#s;
|
|
@@ -2768,7 +2768,7 @@ var Jr = class extends Qe {
|
|
|
2768
2768
|
#o;
|
|
2769
2769
|
#i;
|
|
2770
2770
|
constructor(e = {}) {
|
|
2771
|
-
this.#e = e.queryCache || new
|
|
2771
|
+
this.#e = e.queryCache || new Xr(), this.#t = e.mutationCache || new Jr(), this.#s = e.defaultOptions || {}, this.#n = /* @__PURE__ */ new Map(), this.#r = /* @__PURE__ */ new Map(), this.#a = 0;
|
|
2772
2772
|
}
|
|
2773
2773
|
mount() {
|
|
2774
2774
|
this.#a++, this.#a === 1 && (this.#o = Et.subscribe(async (e) => {
|
|
@@ -2810,12 +2810,12 @@ var Jr = class extends Qe {
|
|
|
2810
2810
|
setQueryData(e, t, s) {
|
|
2811
2811
|
const r = this.defaultQueryOptions({ queryKey: e }), a = this.#e.get(
|
|
2812
2812
|
r.queryHash
|
|
2813
|
-
)?.state.data, o =
|
|
2813
|
+
)?.state.data, o = Dr(t, a);
|
|
2814
2814
|
if (o !== void 0)
|
|
2815
2815
|
return this.#e.build(this, r).setData(o, { ...s, manual: !0 });
|
|
2816
2816
|
}
|
|
2817
2817
|
setQueriesData(e, t, s) {
|
|
2818
|
-
return
|
|
2818
|
+
return le.batch(
|
|
2819
2819
|
() => this.#e.findAll(e).map(({ queryKey: r }) => [
|
|
2820
2820
|
r,
|
|
2821
2821
|
this.setQueryData(r, t, s)
|
|
@@ -2830,7 +2830,7 @@ var Jr = class extends Qe {
|
|
|
2830
2830
|
}
|
|
2831
2831
|
removeQueries(e) {
|
|
2832
2832
|
const t = this.#e;
|
|
2833
|
-
|
|
2833
|
+
le.batch(() => {
|
|
2834
2834
|
t.findAll(e).forEach((s) => {
|
|
2835
2835
|
t.remove(s);
|
|
2836
2836
|
});
|
|
@@ -2838,7 +2838,7 @@ var Jr = class extends Qe {
|
|
|
2838
2838
|
}
|
|
2839
2839
|
resetQueries(e, t) {
|
|
2840
2840
|
const s = this.#e;
|
|
2841
|
-
return
|
|
2841
|
+
return le.batch(() => (s.findAll(e).forEach((r) => {
|
|
2842
2842
|
r.reset();
|
|
2843
2843
|
}), this.refetchQueries(
|
|
2844
2844
|
{
|
|
@@ -2849,13 +2849,13 @@ var Jr = class extends Qe {
|
|
|
2849
2849
|
)));
|
|
2850
2850
|
}
|
|
2851
2851
|
cancelQueries(e, t = {}) {
|
|
2852
|
-
const s = { revert: !0, ...t }, r =
|
|
2852
|
+
const s = { revert: !0, ...t }, r = le.batch(
|
|
2853
2853
|
() => this.#e.findAll(e).map((n) => n.cancel(s))
|
|
2854
2854
|
);
|
|
2855
|
-
return Promise.all(r).then(
|
|
2855
|
+
return Promise.all(r).then(ye).catch(ye);
|
|
2856
2856
|
}
|
|
2857
2857
|
invalidateQueries(e, t = {}) {
|
|
2858
|
-
return
|
|
2858
|
+
return le.batch(() => (this.#e.findAll(e).forEach((s) => {
|
|
2859
2859
|
s.invalidate();
|
|
2860
2860
|
}), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries(
|
|
2861
2861
|
{
|
|
@@ -2869,13 +2869,13 @@ var Jr = class extends Qe {
|
|
|
2869
2869
|
const s = {
|
|
2870
2870
|
...t,
|
|
2871
2871
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
2872
|
-
}, r =
|
|
2872
|
+
}, r = le.batch(
|
|
2873
2873
|
() => this.#e.findAll(e).filter((n) => !n.isDisabled() && !n.isStatic()).map((n) => {
|
|
2874
2874
|
let a = n.fetch(void 0, s);
|
|
2875
|
-
return s.throwOnError || (a = a.catch(
|
|
2875
|
+
return s.throwOnError || (a = a.catch(ye)), n.state.fetchStatus === "paused" ? Promise.resolve() : a;
|
|
2876
2876
|
})
|
|
2877
2877
|
);
|
|
2878
|
-
return Promise.all(r).then(
|
|
2878
|
+
return Promise.all(r).then(ye);
|
|
2879
2879
|
}
|
|
2880
2880
|
fetchQuery(e) {
|
|
2881
2881
|
const t = this.defaultQueryOptions(e);
|
|
@@ -2886,13 +2886,13 @@ var Jr = class extends Qe {
|
|
|
2886
2886
|
) ? s.fetch(t) : Promise.resolve(s.state.data);
|
|
2887
2887
|
}
|
|
2888
2888
|
prefetchQuery(e) {
|
|
2889
|
-
return this.fetchQuery(e).then(
|
|
2889
|
+
return this.fetchQuery(e).then(ye).catch(ye);
|
|
2890
2890
|
}
|
|
2891
2891
|
fetchInfiniteQuery(e) {
|
|
2892
2892
|
return e.behavior = ss(e.pages), this.fetchQuery(e);
|
|
2893
2893
|
}
|
|
2894
2894
|
prefetchInfiniteQuery(e) {
|
|
2895
|
-
return this.fetchInfiniteQuery(e).then(
|
|
2895
|
+
return this.fetchInfiniteQuery(e).then(ye).catch(ye);
|
|
2896
2896
|
}
|
|
2897
2897
|
ensureInfiniteQueryData(e) {
|
|
2898
2898
|
return e.behavior = ss(e.pages), this.ensureQueryData(e);
|
|
@@ -2921,7 +2921,7 @@ var Jr = class extends Qe {
|
|
|
2921
2921
|
getQueryDefaults(e) {
|
|
2922
2922
|
const t = [...this.#n.values()], s = {};
|
|
2923
2923
|
return t.forEach((r) => {
|
|
2924
|
-
|
|
2924
|
+
Ke(e, r.queryKey) && Object.assign(s, r.defaultOptions);
|
|
2925
2925
|
}), s;
|
|
2926
2926
|
}
|
|
2927
2927
|
setMutationDefaults(e, t) {
|
|
@@ -2933,7 +2933,7 @@ var Jr = class extends Qe {
|
|
|
2933
2933
|
getMutationDefaults(e) {
|
|
2934
2934
|
const t = [...this.#r.values()], s = {};
|
|
2935
2935
|
return t.forEach((r) => {
|
|
2936
|
-
|
|
2936
|
+
Ke(e, r.mutationKey) && Object.assign(s, r.defaultOptions);
|
|
2937
2937
|
}), s;
|
|
2938
2938
|
}
|
|
2939
2939
|
defaultQueryOptions(e) {
|
|
@@ -2961,21 +2961,21 @@ var Jr = class extends Qe {
|
|
|
2961
2961
|
clear() {
|
|
2962
2962
|
this.#e.clear(), this.#t.clear();
|
|
2963
2963
|
}
|
|
2964
|
-
}, ws =
|
|
2964
|
+
}, ws = fe.createContext(
|
|
2965
2965
|
void 0
|
|
2966
2966
|
), Pt = (e) => {
|
|
2967
|
-
const t =
|
|
2967
|
+
const t = fe.useContext(ws);
|
|
2968
2968
|
if (!t)
|
|
2969
2969
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
2970
2970
|
return t;
|
|
2971
|
-
},
|
|
2971
|
+
}, tn = ({
|
|
2972
2972
|
client: e,
|
|
2973
2973
|
children: t
|
|
2974
|
-
}) => (
|
|
2974
|
+
}) => (fe.useEffect(() => (e.mount(), () => {
|
|
2975
2975
|
e.unmount();
|
|
2976
|
-
}), [e]), /* @__PURE__ */ i(ws.Provider, { value: e, children: t })), Ns =
|
|
2976
|
+
}), [e]), /* @__PURE__ */ i(ws.Provider, { value: e, children: t })), Ns = fe.createContext(!1), sn = () => fe.useContext(Ns);
|
|
2977
2977
|
Ns.Provider;
|
|
2978
|
-
function
|
|
2978
|
+
function rn() {
|
|
2979
2979
|
let e = !1;
|
|
2980
2980
|
return {
|
|
2981
2981
|
clearReset: () => {
|
|
@@ -2987,20 +2987,20 @@ function sn() {
|
|
|
2987
2987
|
isReset: () => e
|
|
2988
2988
|
};
|
|
2989
2989
|
}
|
|
2990
|
-
var
|
|
2990
|
+
var nn = fe.createContext(rn()), an = () => fe.useContext(nn), on = (e, t, s) => {
|
|
2991
2991
|
const r = s?.state.error && typeof e.throwOnError == "function" ? kt(e.throwOnError, [s.state.error, s]) : e.throwOnError;
|
|
2992
2992
|
(e.suspense || e.experimental_prefetchInRender || r) && (t.isReset() || (e.retryOnMount = !1));
|
|
2993
|
-
},
|
|
2994
|
-
|
|
2993
|
+
}, ln = (e) => {
|
|
2994
|
+
fe.useEffect(() => {
|
|
2995
2995
|
e.clearReset();
|
|
2996
2996
|
}, [e]);
|
|
2997
|
-
},
|
|
2997
|
+
}, cn = ({
|
|
2998
2998
|
result: e,
|
|
2999
2999
|
errorResetBoundary: t,
|
|
3000
3000
|
throwOnError: s,
|
|
3001
3001
|
query: r,
|
|
3002
3002
|
suspense: n
|
|
3003
|
-
}) => e.isError && !t.isReset() && !e.isFetching && r && (n && e.data === void 0 || kt(s, [e.error, r])),
|
|
3003
|
+
}) => e.isError && !t.isReset() && !e.isFetching && r && (n && e.data === void 0 || kt(s, [e.error, r])), un = (e) => {
|
|
3004
3004
|
if (e.suspense) {
|
|
3005
3005
|
const s = (n) => n === "static" ? n : Math.max(n ?? 1e3, 1e3), r = e.staleTime;
|
|
3006
3006
|
e.staleTime = typeof r == "function" ? (...n) => s(r(...n)) : s(r), typeof e.gcTime == "number" && (e.gcTime = Math.max(
|
|
@@ -3008,43 +3008,43 @@ var rn = he.createContext(sn()), nn = () => he.useContext(rn), an = (e, t, s) =>
|
|
|
3008
3008
|
1e3
|
|
3009
3009
|
));
|
|
3010
3010
|
}
|
|
3011
|
-
},
|
|
3011
|
+
}, dn = (e, t) => e.isLoading && e.isFetching && !t, hn = (e, t) => e?.suspense && t.isPending, ns = (e, t, s) => t.fetchOptimistic(e).catch(() => {
|
|
3012
3012
|
s.clearReset();
|
|
3013
3013
|
});
|
|
3014
|
-
function
|
|
3014
|
+
function fn(e, t, s) {
|
|
3015
3015
|
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
3016
3016
|
throw new Error(
|
|
3017
3017
|
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
3018
3018
|
);
|
|
3019
|
-
const r =
|
|
3019
|
+
const r = sn(), n = an(), a = Pt(), o = a.defaultQueryOptions(e);
|
|
3020
3020
|
a.getDefaultOptions().queries?._experimental_beforeQuery?.(
|
|
3021
3021
|
o
|
|
3022
3022
|
);
|
|
3023
3023
|
const l = a.getQueryCache().get(o.queryHash);
|
|
3024
3024
|
process.env.NODE_ENV !== "production" && (o.queryFn || console.error(
|
|
3025
3025
|
`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
|
|
3026
|
-
)), o._optimisticResults = r ? "isRestoring" : "optimistic",
|
|
3027
|
-
const
|
|
3026
|
+
)), o._optimisticResults = r ? "isRestoring" : "optimistic", un(o), on(o, n, l), ln(n);
|
|
3027
|
+
const h = !a.getQueryCache().get(o.queryHash), [u] = fe.useState(
|
|
3028
3028
|
() => new t(
|
|
3029
3029
|
a,
|
|
3030
3030
|
o
|
|
3031
3031
|
)
|
|
3032
3032
|
), c = u.getOptimisticResult(o), S = !r && e.subscribed !== !1;
|
|
3033
|
-
if (
|
|
3034
|
-
|
|
3033
|
+
if (fe.useSyncExternalStore(
|
|
3034
|
+
fe.useCallback(
|
|
3035
3035
|
(f) => {
|
|
3036
|
-
const
|
|
3037
|
-
return u.updateResult(),
|
|
3036
|
+
const R = S ? u.subscribe(le.batchCalls(f)) : ye;
|
|
3037
|
+
return u.updateResult(), R;
|
|
3038
3038
|
},
|
|
3039
3039
|
[u, S]
|
|
3040
3040
|
),
|
|
3041
3041
|
() => u.getCurrentResult(),
|
|
3042
3042
|
() => u.getCurrentResult()
|
|
3043
|
-
),
|
|
3043
|
+
), fe.useEffect(() => {
|
|
3044
3044
|
u.setOptions(o);
|
|
3045
|
-
}, [o, u]),
|
|
3045
|
+
}, [o, u]), hn(o, c))
|
|
3046
3046
|
throw ns(o, u, n);
|
|
3047
|
-
if (
|
|
3047
|
+
if (cn({
|
|
3048
3048
|
result: c,
|
|
3049
3049
|
errorResetBoundary: n,
|
|
3050
3050
|
throwOnError: o.throwOnError,
|
|
@@ -3055,39 +3055,39 @@ function hn(e, t, s) {
|
|
|
3055
3055
|
return a.getDefaultOptions().queries?._experimental_afterQuery?.(
|
|
3056
3056
|
o,
|
|
3057
3057
|
c
|
|
3058
|
-
), o.experimental_prefetchInRender && !$e &&
|
|
3058
|
+
), o.experimental_prefetchInRender && !$e && dn(c, r) && (h ? (
|
|
3059
3059
|
// Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
|
|
3060
3060
|
ns(o, u, n)
|
|
3061
3061
|
) : (
|
|
3062
3062
|
// subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
|
|
3063
3063
|
l?.promise
|
|
3064
|
-
))?.catch(
|
|
3064
|
+
))?.catch(ye).finally(() => {
|
|
3065
3065
|
u.updateResult();
|
|
3066
3066
|
}), o.notifyOnChangeProps ? c : u.trackResult(c);
|
|
3067
3067
|
}
|
|
3068
3068
|
function Mt(e, t) {
|
|
3069
|
-
return
|
|
3069
|
+
return fn(e, Wr);
|
|
3070
3070
|
}
|
|
3071
|
-
function
|
|
3072
|
-
const s = Pt(), [r] =
|
|
3073
|
-
() => new
|
|
3071
|
+
function mn(e, t) {
|
|
3072
|
+
const s = Pt(), [r] = fe.useState(
|
|
3073
|
+
() => new Zr(
|
|
3074
3074
|
s,
|
|
3075
3075
|
e
|
|
3076
3076
|
)
|
|
3077
3077
|
);
|
|
3078
|
-
|
|
3078
|
+
fe.useEffect(() => {
|
|
3079
3079
|
r.setOptions(e);
|
|
3080
3080
|
}, [r, e]);
|
|
3081
|
-
const n =
|
|
3082
|
-
|
|
3083
|
-
(o) => r.subscribe(
|
|
3081
|
+
const n = fe.useSyncExternalStore(
|
|
3082
|
+
fe.useCallback(
|
|
3083
|
+
(o) => r.subscribe(le.batchCalls(o)),
|
|
3084
3084
|
[r]
|
|
3085
3085
|
),
|
|
3086
3086
|
() => r.getCurrentResult(),
|
|
3087
3087
|
() => r.getCurrentResult()
|
|
3088
|
-
), a =
|
|
3088
|
+
), a = fe.useCallback(
|
|
3089
3089
|
(o, l) => {
|
|
3090
|
-
r.mutate(o, l).catch(
|
|
3090
|
+
r.mutate(o, l).catch(ye);
|
|
3091
3091
|
},
|
|
3092
3092
|
[r]
|
|
3093
3093
|
);
|
|
@@ -3097,14 +3097,14 @@ function fn(e, t) {
|
|
|
3097
3097
|
}
|
|
3098
3098
|
function xs() {
|
|
3099
3099
|
const { alerts: e } = Te(), t = Pt();
|
|
3100
|
-
return
|
|
3100
|
+
return mn({
|
|
3101
3101
|
mutationFn: (s) => e.updateAlertStatus(s),
|
|
3102
3102
|
onSuccess: () => {
|
|
3103
3103
|
t.invalidateQueries({ queryKey: ["alerts", "list"] }), t.invalidateQueries({ queryKey: ["alerts", "report"] });
|
|
3104
3104
|
}
|
|
3105
3105
|
});
|
|
3106
3106
|
}
|
|
3107
|
-
function
|
|
3107
|
+
function pn(e, t) {
|
|
3108
3108
|
return e.toLocaleTimeString([], {
|
|
3109
3109
|
hour: "2-digit",
|
|
3110
3110
|
minute: "2-digit",
|
|
@@ -3113,12 +3113,12 @@ function mn(e, t) {
|
|
|
3113
3113
|
timeZone: t
|
|
3114
3114
|
});
|
|
3115
3115
|
}
|
|
3116
|
-
function
|
|
3116
|
+
function yn(e, t) {
|
|
3117
3117
|
try {
|
|
3118
3118
|
const n = new Intl.DateTimeFormat("en-US", { timeZone: t, timeZoneName: "short" }).formatToParts(e).find((o) => o.type === "timeZoneName")?.value;
|
|
3119
3119
|
let a;
|
|
3120
3120
|
try {
|
|
3121
|
-
const l = new Intl.DateTimeFormat("en-US", { timeZone: t, timeZoneName: "shortOffset" }).formatToParts(e).find((
|
|
3121
|
+
const l = new Intl.DateTimeFormat("en-US", { timeZone: t, timeZoneName: "shortOffset" }).formatToParts(e).find((h) => h.type === "timeZoneName");
|
|
3122
3122
|
l?.value && l.value.startsWith("GMT") && (a = l.value.replace("GMT", ""));
|
|
3123
3123
|
} catch {
|
|
3124
3124
|
}
|
|
@@ -3127,11 +3127,11 @@ function pn(e, t) {
|
|
|
3127
3127
|
return {};
|
|
3128
3128
|
}
|
|
3129
3129
|
}
|
|
3130
|
-
function
|
|
3130
|
+
function gn(e) {
|
|
3131
3131
|
if (!e) return "-";
|
|
3132
3132
|
try {
|
|
3133
|
-
const t = new Date(e), s = (u) => String(u).padStart(2, "0"), r = s(t.getMonth() + 1), n = s(t.getDate()), a = t.getFullYear(), o = s(t.getHours()), l = s(t.getMinutes()),
|
|
3134
|
-
return `${r}/${n}/${a} ${o}:${l}:${
|
|
3133
|
+
const t = new Date(e), s = (u) => String(u).padStart(2, "0"), r = s(t.getMonth() + 1), n = s(t.getDate()), a = t.getFullYear(), o = s(t.getHours()), l = s(t.getMinutes()), h = s(t.getSeconds());
|
|
3134
|
+
return `${r}/${n}/${a} ${o}:${l}:${h}`;
|
|
3135
3135
|
} catch {
|
|
3136
3136
|
return "-";
|
|
3137
3137
|
}
|
|
@@ -3151,18 +3151,18 @@ function wt(e) {
|
|
|
3151
3151
|
return "-";
|
|
3152
3152
|
}
|
|
3153
3153
|
}
|
|
3154
|
-
const
|
|
3154
|
+
const vn = {
|
|
3155
3155
|
Critical: "#FF3B30",
|
|
3156
3156
|
High: "#FFB86A",
|
|
3157
3157
|
Medium: "#FFCC00",
|
|
3158
3158
|
Low: "#007AFF"
|
|
3159
|
-
},
|
|
3159
|
+
}, bn = {
|
|
3160
3160
|
Critical: "#FFE2E2",
|
|
3161
3161
|
High: "#FF95004D",
|
|
3162
3162
|
Medium: "#FEF9C2",
|
|
3163
3163
|
Low: "#E0EDFF"
|
|
3164
3164
|
};
|
|
3165
|
-
function
|
|
3165
|
+
function An({
|
|
3166
3166
|
alerts: e,
|
|
3167
3167
|
loading: t = !1,
|
|
3168
3168
|
pageSize: s = 10,
|
|
@@ -3171,24 +3171,24 @@ function bn({
|
|
|
3171
3171
|
spaceOptions: a,
|
|
3172
3172
|
onAlertIdClick: o
|
|
3173
3173
|
}) {
|
|
3174
|
-
const l = xs(),
|
|
3174
|
+
const l = xs(), h = ["completed", "false positive"], u = async (f) => {
|
|
3175
3175
|
try {
|
|
3176
|
-
const
|
|
3176
|
+
const R = await l.mutateAsync({
|
|
3177
3177
|
alertUniqueId: f.alertId ?? f.id,
|
|
3178
3178
|
alertId: f.id,
|
|
3179
3179
|
status: "Reopen",
|
|
3180
3180
|
notes: "Reopened",
|
|
3181
3181
|
modifiedBy: 0
|
|
3182
3182
|
});
|
|
3183
|
-
if (
|
|
3184
|
-
const N =
|
|
3185
|
-
|
|
3183
|
+
if (R?.responseStatus) {
|
|
3184
|
+
const N = R?.data || "Alert reopened successfully.";
|
|
3185
|
+
ge.success(N);
|
|
3186
3186
|
} else {
|
|
3187
|
-
const N =
|
|
3188
|
-
|
|
3187
|
+
const N = R?.errorMessage || "Failed to reopen alert";
|
|
3188
|
+
ge.error(N);
|
|
3189
3189
|
}
|
|
3190
3190
|
} catch {
|
|
3191
|
-
|
|
3191
|
+
ge.error("Failed to reopen alert. Please try again.");
|
|
3192
3192
|
}
|
|
3193
3193
|
}, c = [
|
|
3194
3194
|
{
|
|
@@ -3197,12 +3197,12 @@ function bn({
|
|
|
3197
3197
|
key: "priority",
|
|
3198
3198
|
width: 120,
|
|
3199
3199
|
render: (f) => /* @__PURE__ */ i(
|
|
3200
|
-
|
|
3200
|
+
We,
|
|
3201
3201
|
{
|
|
3202
3202
|
className: "px-[10px] py-[2px]",
|
|
3203
3203
|
style: {
|
|
3204
|
-
border: `2px solid ${
|
|
3205
|
-
backgroundColor:
|
|
3204
|
+
border: `2px solid ${vn[f]}`,
|
|
3205
|
+
backgroundColor: bn[String(f)]
|
|
3206
3206
|
},
|
|
3207
3207
|
children: f
|
|
3208
3208
|
}
|
|
@@ -3213,7 +3213,7 @@ function bn({
|
|
|
3213
3213
|
dataIndex: "timestamp",
|
|
3214
3214
|
key: "timestamp",
|
|
3215
3215
|
width: 200,
|
|
3216
|
-
render: (f) =>
|
|
3216
|
+
render: (f) => gn(f)
|
|
3217
3217
|
},
|
|
3218
3218
|
{
|
|
3219
3219
|
title: "Status",
|
|
@@ -3225,15 +3225,15 @@ function bn({
|
|
|
3225
3225
|
title: "Description",
|
|
3226
3226
|
dataIndex: "description",
|
|
3227
3227
|
key: "description",
|
|
3228
|
-
render: (f,
|
|
3228
|
+
render: (f, R) => /* @__PURE__ */ d("div", { children: [
|
|
3229
3229
|
/* @__PURE__ */ i(
|
|
3230
3230
|
"a",
|
|
3231
3231
|
{
|
|
3232
3232
|
onClick: (N) => {
|
|
3233
|
-
N.preventDefault(), o?.(
|
|
3233
|
+
N.preventDefault(), o?.(R, { sourceTab: "archived" });
|
|
3234
3234
|
},
|
|
3235
3235
|
className: "inline-block mb-1 text-blue-600",
|
|
3236
|
-
children:
|
|
3236
|
+
children: R.alertNumber
|
|
3237
3237
|
}
|
|
3238
3238
|
),
|
|
3239
3239
|
/* @__PURE__ */ i("div", { className: "text-black/65", children: f })
|
|
@@ -3244,7 +3244,7 @@ function bn({
|
|
|
3244
3244
|
key: "menu",
|
|
3245
3245
|
width: 60,
|
|
3246
3246
|
align: "right",
|
|
3247
|
-
render: (f,
|
|
3247
|
+
render: (f, R) => /* @__PURE__ */ i(
|
|
3248
3248
|
Bs,
|
|
3249
3249
|
{
|
|
3250
3250
|
trigger: ["click"],
|
|
@@ -3253,7 +3253,7 @@ function bn({
|
|
|
3253
3253
|
{ key: "reopen", label: "Reopen" }
|
|
3254
3254
|
],
|
|
3255
3255
|
onClick: ({ key: N }) => {
|
|
3256
|
-
N === "reopen" && u(
|
|
3256
|
+
N === "reopen" && u(R);
|
|
3257
3257
|
}
|
|
3258
3258
|
},
|
|
3259
3259
|
children: /* @__PURE__ */ i(Se, { type: "text", icon: /* @__PURE__ */ i(Gs, {}) })
|
|
@@ -3261,7 +3261,7 @@ function bn({
|
|
|
3261
3261
|
)
|
|
3262
3262
|
}
|
|
3263
3263
|
], S = (e || []).filter(
|
|
3264
|
-
(f) =>
|
|
3264
|
+
(f) => h.includes((f.statusType || "").toLowerCase())
|
|
3265
3265
|
);
|
|
3266
3266
|
return /* @__PURE__ */ i(
|
|
3267
3267
|
ms,
|
|
@@ -3279,12 +3279,12 @@ function bn({
|
|
|
3279
3279
|
}
|
|
3280
3280
|
);
|
|
3281
3281
|
}
|
|
3282
|
-
function
|
|
3282
|
+
function Sn({
|
|
3283
3283
|
size: e = 120,
|
|
3284
3284
|
time: t,
|
|
3285
3285
|
timeZone: s = "America/New_York"
|
|
3286
3286
|
}) {
|
|
3287
|
-
const { hours: r, minutes: n, seconds: a } =
|
|
3287
|
+
const { hours: r, minutes: n, seconds: a } = de(() => {
|
|
3288
3288
|
const S = new Intl.DateTimeFormat("en-US", {
|
|
3289
3289
|
timeZone: s,
|
|
3290
3290
|
hour: "numeric",
|
|
@@ -3297,8 +3297,8 @@ function An({
|
|
|
3297
3297
|
minutes: parseInt(S.find((f) => f.type === "minute")?.value || "0", 10),
|
|
3298
3298
|
seconds: parseInt(S.find((f) => f.type === "second")?.value || "0", 10)
|
|
3299
3299
|
};
|
|
3300
|
-
}, [t, s]), o = a * 6, l = n * 6 + a * 0.1,
|
|
3301
|
-
return /* @__PURE__ */
|
|
3300
|
+
}, [t, s]), o = a * 6, l = n * 6 + a * 0.1, h = r % 12 * 30 + n * 0.5, u = e / 2;
|
|
3301
|
+
return /* @__PURE__ */ d(
|
|
3302
3302
|
"div",
|
|
3303
3303
|
{
|
|
3304
3304
|
className: "relative rounded-full border border-gray-300 bg-white",
|
|
@@ -3307,7 +3307,7 @@ function An({
|
|
|
3307
3307
|
"aria-label": "Analog Clock",
|
|
3308
3308
|
children: [
|
|
3309
3309
|
[...Array(12)].map((c, S) => {
|
|
3310
|
-
const f = S * 30,
|
|
3310
|
+
const f = S * 30, R = 6, N = u - 4, m = N - R, A = (f - 90) * (Math.PI / 180), B = u + m * Math.cos(A), U = u + m * Math.sin(A), _ = u + N * Math.cos(A), L = u + N * Math.sin(A);
|
|
3311
3311
|
return /* @__PURE__ */ i(
|
|
3312
3312
|
"svg",
|
|
3313
3313
|
{
|
|
@@ -3317,9 +3317,9 @@ function An({
|
|
|
3317
3317
|
children: /* @__PURE__ */ i(
|
|
3318
3318
|
"line",
|
|
3319
3319
|
{
|
|
3320
|
-
x1:
|
|
3321
|
-
y1:
|
|
3322
|
-
x2:
|
|
3320
|
+
x1: B,
|
|
3321
|
+
y1: U,
|
|
3322
|
+
x2: _,
|
|
3323
3323
|
y2: L,
|
|
3324
3324
|
stroke: "#9CA3AF",
|
|
3325
3325
|
strokeWidth: S % 3 === 0 ? 2 : 1,
|
|
@@ -3336,7 +3336,7 @@ function An({
|
|
|
3336
3336
|
className: "absolute inset-0",
|
|
3337
3337
|
width: e,
|
|
3338
3338
|
height: e,
|
|
3339
|
-
style: { transform: `rotate(${
|
|
3339
|
+
style: { transform: `rotate(${h}deg)` },
|
|
3340
3340
|
children: /* @__PURE__ */ i(
|
|
3341
3341
|
"line",
|
|
3342
3342
|
{
|
|
@@ -3409,34 +3409,34 @@ function An({
|
|
|
3409
3409
|
}
|
|
3410
3410
|
);
|
|
3411
3411
|
}
|
|
3412
|
-
function
|
|
3412
|
+
function wn({ label: e = "USA", timeZone: t = "America/New_York", updateIntervalMs: s = 1e3, className: r }) {
|
|
3413
3413
|
const [n, a] = w(/* @__PURE__ */ new Date());
|
|
3414
|
-
|
|
3414
|
+
ue(() => {
|
|
3415
3415
|
const u = setInterval(() => a(/* @__PURE__ */ new Date()), s);
|
|
3416
3416
|
return () => clearInterval(u);
|
|
3417
3417
|
}, [s]);
|
|
3418
|
-
const o =
|
|
3419
|
-
return /* @__PURE__ */
|
|
3420
|
-
/* @__PURE__ */ i(
|
|
3421
|
-
/* @__PURE__ */
|
|
3422
|
-
/* @__PURE__ */
|
|
3418
|
+
const o = de(() => pn(n, t), [n, t]), { abbr: l, offset: h } = de(() => yn(n, t), [n, t]);
|
|
3419
|
+
return /* @__PURE__ */ d("div", { className: `flex items-center gap-3 ${r || ""}`, children: [
|
|
3420
|
+
/* @__PURE__ */ i(Sn, { time: n, timeZone: t, size: 80 }),
|
|
3421
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col items-baseline gap-1", children: [
|
|
3422
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2 text-sm text-gray-600", children: [
|
|
3423
3423
|
/* @__PURE__ */ i("span", { className: "uppercase", children: e }),
|
|
3424
3424
|
l && /* @__PURE__ */ i("span", { className: "px-1.5 py-0.5 rounded-md border text-[10px] leading-none text-gray-600 bg-gray-50", children: l }),
|
|
3425
|
-
|
|
3425
|
+
h && /* @__PURE__ */ i("span", { className: "text-xs text-gray-500", children: h })
|
|
3426
3426
|
] }),
|
|
3427
3427
|
/* @__PURE__ */ i("div", { className: "text-2xl font-semibold text-gray-700 tracking-wide", children: o })
|
|
3428
3428
|
] })
|
|
3429
3429
|
] });
|
|
3430
3430
|
}
|
|
3431
|
-
const
|
|
3432
|
-
severities:
|
|
3433
|
-
rules:
|
|
3434
|
-
userRoles:
|
|
3435
|
-
}, { Text:
|
|
3436
|
-
function
|
|
3437
|
-
return /* @__PURE__ */
|
|
3438
|
-
/* @__PURE__ */ i(G, { xs: 24, md: 8, lg: 5, children: /* @__PURE__ */
|
|
3439
|
-
/* @__PURE__ */ i(
|
|
3431
|
+
const Nn = [{ SeverityId: 1, Code: "LOW", DisplayName: "Low", SortOrder: 10, IsActive: !0 }, { SeverityId: 2, Code: "MEDIUM", DisplayName: "Medium", SortOrder: 20, IsActive: !0 }, { SeverityId: 3, Code: "HIGH", DisplayName: "High", SortOrder: 30, IsActive: !0 }, { SeverityId: 4, Code: "CRITICAL", DisplayName: "Critical", SortOrder: 40, IsActive: !0 }], xn = [{ RuleId: "0938aa00-dfa7-4258-805a-67396366c776", RuleVersionId: "36d2d581-57c3-45c3-8705-8235935fdf96", Name: "License Plate Recognition", Description: "License Plate Recognition", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 3, AnomalyId: "915976ef-4eb6-4f7b-bbe6-e53862517fc9", Level: "global" }, { RuleId: "2437286a-db6a-4d35-814e-9ac49f158dde", RuleVersionId: "00000000-0000-0000-0000-000000000000", Name: "Monitor And Track Onsite Vehicle timelog", Description: "Monitor And Track Onsite Vehicle timelog", VersionCount: 0, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 3, AnomalyId: "9fd651ab-4312-4826-84b6-94d735894477", Level: "global" }, { RuleId: "b99120ba-7a83-4ade-b5d9-a420550fe351", RuleVersionId: "d7b14dae-a7b1-474e-a357-199182c02ac3", Name: "Watchlist person detected", Description: "Watchlist person detected", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 4, AnomalyId: "bb3a3d3a-73a3-4f5a-8804-1baadbd0d412", Level: "global" }, { RuleId: "ffc2c24f-adb7-4aba-ace7-f19c54e21530", RuleVersionId: "6ab3178f-bf77-4a1e-898d-1d5dbef749c5", Name: "Weapon Detection", Description: "Weapon Detection", VersionCount: 1, ActionCount: 0, ApplicabilityPeriodCount: 0, SuppressionCount: 0, AssignmentCount: 0, ExclusionCount: 0, IsDeleted: !1, SeverityId: 4, AnomalyId: "ac82c3a2-72e6-4f9c-88fb-851a3ca3c4de", Level: "global" }], Cn = [{ userRoleId: 1, userRoleName: "Super Admin" }, { userRoleId: 2, userRoleName: "Security Officer" }, { userRoleId: 3, userRoleName: "Security Admin" }, { userRoleId: 4, userRoleName: "Regulatory Officer/First Responder" }, { userRoleId: 5, userRoleName: "User" }], _e = {
|
|
3432
|
+
severities: Nn,
|
|
3433
|
+
rules: xn,
|
|
3434
|
+
userRoles: Cn
|
|
3435
|
+
}, { Text: In } = Ye;
|
|
3436
|
+
function Tn({ sortBy: e, onChange: t, showActions: s, onSave: r, onClear: n, saving: a }) {
|
|
3437
|
+
return /* @__PURE__ */ d(Ae, { gutter: [16, 16], align: "middle", children: [
|
|
3438
|
+
/* @__PURE__ */ i(G, { xs: 24, md: 8, lg: 5, children: /* @__PURE__ */ d(Ie, { className: "w-full items-center", direction: "horizontal", size: 12, children: [
|
|
3439
|
+
/* @__PURE__ */ i(In, { className: "text-gray-600 whitespace-nowrap", children: "Sort By:" }),
|
|
3440
3440
|
/* @__PURE__ */ i(
|
|
3441
3441
|
ve,
|
|
3442
3442
|
{
|
|
@@ -3452,14 +3452,14 @@ function In({ sortBy: e, onChange: t, showActions: s, onSave: r, onClear: n, sav
|
|
|
3452
3452
|
}
|
|
3453
3453
|
)
|
|
3454
3454
|
] }) }),
|
|
3455
|
-
/* @__PURE__ */ i(G, { xs: 24, md: 8, style: { alignSelf: "end" }, children: s ? /* @__PURE__ */
|
|
3455
|
+
/* @__PURE__ */ i(G, { xs: 24, md: 8, style: { alignSelf: "end" }, children: s ? /* @__PURE__ */ d(Ie, { className: "w-full", direction: "horizontal", size: 8, children: [
|
|
3456
3456
|
/* @__PURE__ */ i(Se, { onClick: n, disabled: a, children: "Clear" }),
|
|
3457
3457
|
/* @__PURE__ */ i(Se, { type: "primary", onClick: r, loading: a, children: "Save" })
|
|
3458
3458
|
] }) : null })
|
|
3459
3459
|
] });
|
|
3460
3460
|
}
|
|
3461
|
-
const { Text: Me } =
|
|
3462
|
-
function
|
|
3461
|
+
const { Text: Me } = Ye;
|
|
3462
|
+
function Rn(e) {
|
|
3463
3463
|
const {
|
|
3464
3464
|
// escBasis, setEscBasis,
|
|
3465
3465
|
// selectedSeverity, setSelectedSeverity,
|
|
@@ -3470,18 +3470,18 @@ function Tn(e) {
|
|
|
3470
3470
|
roleOptions: a,
|
|
3471
3471
|
l1mins: o,
|
|
3472
3472
|
setL1mins: l,
|
|
3473
|
-
l1role:
|
|
3473
|
+
l1role: h,
|
|
3474
3474
|
setL1role: u,
|
|
3475
3475
|
l2mins: c,
|
|
3476
3476
|
setL2mins: S,
|
|
3477
3477
|
l2role: f,
|
|
3478
|
-
setL2role:
|
|
3478
|
+
setL2role: R,
|
|
3479
3479
|
l3mins: N,
|
|
3480
3480
|
setL3mins: m,
|
|
3481
3481
|
l3role: A,
|
|
3482
|
-
setL3role:
|
|
3483
|
-
actions:
|
|
3484
|
-
setActions:
|
|
3482
|
+
setL3role: B,
|
|
3483
|
+
actions: U,
|
|
3484
|
+
setActions: _,
|
|
3485
3485
|
thirdPartyIds: L,
|
|
3486
3486
|
setThirdPartyIds: J,
|
|
3487
3487
|
humanLoop: V,
|
|
@@ -3489,34 +3489,39 @@ function Tn(e) {
|
|
|
3489
3489
|
isAutoExpire: K,
|
|
3490
3490
|
setAutoExpire: T,
|
|
3491
3491
|
onClear: I,
|
|
3492
|
-
onSave:
|
|
3492
|
+
onSave: k,
|
|
3493
3493
|
saving: W,
|
|
3494
3494
|
onActionTypesLoaded: te
|
|
3495
|
-
} = e, { rules:
|
|
3496
|
-
|
|
3497
|
-
let
|
|
3495
|
+
} = e, { rules: E } = Te(), [v, p] = w([]), [x, y] = w([]), [b, g] = w(!1);
|
|
3496
|
+
ue(() => {
|
|
3497
|
+
let F = !1;
|
|
3498
3498
|
return (async () => {
|
|
3499
3499
|
try {
|
|
3500
3500
|
g(!0);
|
|
3501
|
-
const
|
|
3502
|
-
if (
|
|
3503
|
-
const
|
|
3504
|
-
p(
|
|
3505
|
-
const
|
|
3506
|
-
y(
|
|
3507
|
-
} catch (
|
|
3508
|
-
console.error("Error loading lookups",
|
|
3501
|
+
const j = await E.getLookups();
|
|
3502
|
+
if (F || !j || !Array.isArray(j.actionTypes)) return;
|
|
3503
|
+
const z = j.actionTypes.map((ae) => ({ label: ae.name, value: String(ae.actionTypeId) }));
|
|
3504
|
+
p(z), te && te(j.actionTypes);
|
|
3505
|
+
const ne = Array.isArray(j.thirdParties) ? j.thirdParties.map((ae) => ({ label: ae.thirdPartyName, value: ae.thirdPartyId })) : [];
|
|
3506
|
+
y(ne);
|
|
3507
|
+
} catch (j) {
|
|
3508
|
+
console.error("Error loading lookups", j);
|
|
3509
3509
|
} finally {
|
|
3510
|
-
|
|
3510
|
+
F || g(!1);
|
|
3511
3511
|
}
|
|
3512
3512
|
})(), () => {
|
|
3513
|
-
|
|
3513
|
+
F = !0;
|
|
3514
3514
|
};
|
|
3515
3515
|
}, []);
|
|
3516
|
-
const
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3516
|
+
const O = (F) => /* @__PURE__ */ d(We, { children: [
|
|
3517
|
+
/* @__PURE__ */ i(Ws, {}),
|
|
3518
|
+
" ",
|
|
3519
|
+
F.length,
|
|
3520
|
+
" more"
|
|
3521
|
+
] }), $ = typeof o == "number" || typeof h == "number" || typeof c == "number" || typeof f == "number" || typeof N == "number" || typeof A == "number" || Array.isArray(U) && U.length > 0 || Array.isArray(L) && L.length > 0 || !!V || !!K;
|
|
3522
|
+
return /* @__PURE__ */ d(xt, { spinning: !!W || b, children: [
|
|
3523
|
+
/* @__PURE__ */ d(Ae, { gutter: [16, 16], align: "bottom", children: [
|
|
3524
|
+
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ d("div", { children: [
|
|
3520
3525
|
/* @__PURE__ */ i(Me, { className: "text-gray-700 font-medium block mb-1", children: "Rules" }),
|
|
3521
3526
|
/* @__PURE__ */ i(
|
|
3522
3527
|
ve,
|
|
@@ -3529,12 +3534,12 @@ function Tn(e) {
|
|
|
3529
3534
|
}
|
|
3530
3535
|
)
|
|
3531
3536
|
] }) }),
|
|
3532
|
-
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3537
|
+
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ d("div", { children: [
|
|
3538
|
+
/* @__PURE__ */ d(Ae, { gutter: 8, children: [
|
|
3534
3539
|
/* @__PURE__ */ i(G, { span: 10, children: /* @__PURE__ */ i(Me, { className: "text-gray-700 font-medium block mb-1", children: "Level 1 (mins)" }) }),
|
|
3535
3540
|
/* @__PURE__ */ i(G, { span: 14, children: /* @__PURE__ */ i(Me, { className: "text-gray-700 font-medium block mb-1", children: "Escalate to" }) })
|
|
3536
3541
|
] }),
|
|
3537
|
-
/* @__PURE__ */
|
|
3542
|
+
/* @__PURE__ */ d(Ae, { gutter: 8, children: [
|
|
3538
3543
|
/* @__PURE__ */ i(G, { span: 10, children: /* @__PURE__ */ i(
|
|
3539
3544
|
ve,
|
|
3540
3545
|
{
|
|
@@ -3550,19 +3555,19 @@ function Tn(e) {
|
|
|
3550
3555
|
{
|
|
3551
3556
|
placeholder: "Escalate to",
|
|
3552
3557
|
className: "w-full",
|
|
3553
|
-
value:
|
|
3558
|
+
value: h,
|
|
3554
3559
|
onChange: u,
|
|
3555
3560
|
options: a
|
|
3556
3561
|
}
|
|
3557
3562
|
) })
|
|
3558
3563
|
] })
|
|
3559
3564
|
] }) }),
|
|
3560
|
-
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */
|
|
3561
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ d("div", { children: [
|
|
3566
|
+
/* @__PURE__ */ d(Ae, { gutter: 8, children: [
|
|
3562
3567
|
/* @__PURE__ */ i(G, { span: 10, children: /* @__PURE__ */ i(Me, { className: "text-gray-700 font-medium block mb-1", children: "Level 2 (mins)" }) }),
|
|
3563
3568
|
/* @__PURE__ */ i(G, { span: 14, children: /* @__PURE__ */ i(Me, { className: "text-gray-700 font-medium block mb-1", children: "Escalate to" }) })
|
|
3564
3569
|
] }),
|
|
3565
|
-
/* @__PURE__ */
|
|
3570
|
+
/* @__PURE__ */ d(Ae, { gutter: 8, children: [
|
|
3566
3571
|
/* @__PURE__ */ i(G, { span: 10, children: /* @__PURE__ */ i(
|
|
3567
3572
|
ve,
|
|
3568
3573
|
{
|
|
@@ -3579,18 +3584,18 @@ function Tn(e) {
|
|
|
3579
3584
|
placeholder: "Escalate to",
|
|
3580
3585
|
className: "w-full",
|
|
3581
3586
|
value: f,
|
|
3582
|
-
onChange:
|
|
3587
|
+
onChange: R,
|
|
3583
3588
|
options: a
|
|
3584
3589
|
}
|
|
3585
3590
|
) })
|
|
3586
3591
|
] })
|
|
3587
3592
|
] }) }),
|
|
3588
|
-
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */
|
|
3589
|
-
/* @__PURE__ */
|
|
3593
|
+
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ d("div", { children: [
|
|
3594
|
+
/* @__PURE__ */ d(Ae, { gutter: 8, children: [
|
|
3590
3595
|
/* @__PURE__ */ i(G, { span: 10, children: /* @__PURE__ */ i(Me, { className: "text-gray-700 font-medium block mb-1", children: "Level 3 (mins)" }) }),
|
|
3591
3596
|
/* @__PURE__ */ i(G, { span: 14, children: /* @__PURE__ */ i(Me, { className: "text-gray-700 font-medium block mb-1", children: "Escalate to" }) })
|
|
3592
3597
|
] }),
|
|
3593
|
-
/* @__PURE__ */
|
|
3598
|
+
/* @__PURE__ */ d(Ae, { gutter: 8, children: [
|
|
3594
3599
|
/* @__PURE__ */ i(G, { span: 10, children: /* @__PURE__ */ i(
|
|
3595
3600
|
ve,
|
|
3596
3601
|
{
|
|
@@ -3607,13 +3612,13 @@ function Tn(e) {
|
|
|
3607
3612
|
placeholder: "Escalate to",
|
|
3608
3613
|
className: "w-full",
|
|
3609
3614
|
value: A,
|
|
3610
|
-
onChange:
|
|
3615
|
+
onChange: B,
|
|
3611
3616
|
options: a
|
|
3612
3617
|
}
|
|
3613
3618
|
) })
|
|
3614
3619
|
] })
|
|
3615
3620
|
] }) }),
|
|
3616
|
-
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */
|
|
3621
|
+
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ d("div", { children: [
|
|
3617
3622
|
/* @__PURE__ */ i(Me, { className: "text-gray-700 font-medium block mb-1", children: "Pick Actions" }),
|
|
3618
3623
|
/* @__PURE__ */ i(
|
|
3619
3624
|
ve,
|
|
@@ -3621,13 +3626,15 @@ function Tn(e) {
|
|
|
3621
3626
|
mode: "multiple",
|
|
3622
3627
|
placeholder: "Select response actions",
|
|
3623
3628
|
className: "w-full",
|
|
3624
|
-
value:
|
|
3625
|
-
onChange:
|
|
3626
|
-
options: v
|
|
3629
|
+
value: U,
|
|
3630
|
+
onChange: _,
|
|
3631
|
+
options: v,
|
|
3632
|
+
maxTagCount: 1,
|
|
3633
|
+
maxTagPlaceholder: O
|
|
3627
3634
|
}
|
|
3628
3635
|
)
|
|
3629
3636
|
] }) }),
|
|
3630
|
-
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */
|
|
3637
|
+
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 4, children: /* @__PURE__ */ d("div", { children: [
|
|
3631
3638
|
/* @__PURE__ */ i(Me, { className: "text-gray-700 font-medium block mb-1", children: "Third Party App" }),
|
|
3632
3639
|
/* @__PURE__ */ i(
|
|
3633
3640
|
ve,
|
|
@@ -3642,19 +3649,19 @@ function Tn(e) {
|
|
|
3642
3649
|
)
|
|
3643
3650
|
] }) })
|
|
3644
3651
|
] }),
|
|
3645
|
-
/* @__PURE__ */
|
|
3646
|
-
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 7, children: /* @__PURE__ */
|
|
3647
|
-
/* @__PURE__ */ i(qe, { checked: V, onChange: (
|
|
3648
|
-
/* @__PURE__ */ i(qe, { checked: K, onChange: (
|
|
3652
|
+
/* @__PURE__ */ d(Ae, { gutter: [16, 16], align: "bottom", className: "mt-4 items-center", children: [
|
|
3653
|
+
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, lg: 7, children: /* @__PURE__ */ d("div", { className: "flex items-center h-full gap-8", children: [
|
|
3654
|
+
/* @__PURE__ */ i(qe, { checked: V, onChange: (F) => Y(F.target.checked), className: "w-full", children: "Human-In-The-Loop" }),
|
|
3655
|
+
/* @__PURE__ */ i(qe, { checked: K, onChange: (F) => T(F.target.checked), className: "w-full", children: "Auto-expire in 5 minutes" })
|
|
3649
3656
|
] }) }),
|
|
3650
|
-
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, children: /* @__PURE__ */
|
|
3657
|
+
/* @__PURE__ */ i(G, { xs: 24, sm: 12, md: 8, children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
3651
3658
|
/* @__PURE__ */ i(Se, { onClick: I, children: "Clear" }),
|
|
3652
|
-
/* @__PURE__ */ i(Se, { type: "primary", onClick:
|
|
3659
|
+
/* @__PURE__ */ i(Se, { type: "primary", onClick: k, loading: !!W, disabled: !(!!t && $ && !W), children: "Save" })
|
|
3653
3660
|
] }) })
|
|
3654
3661
|
] })
|
|
3655
3662
|
] });
|
|
3656
3663
|
}
|
|
3657
|
-
function
|
|
3664
|
+
function kn({ entries: e, userRoles: t, onEdit: s, loading: r }) {
|
|
3658
3665
|
const n = new Map(t.map((o) => [o.userRoleId, o.userRoleName])), a = (o) => o.map((l) => n.get(l) || String(l)).join(", ");
|
|
3659
3666
|
return /* @__PURE__ */ i(
|
|
3660
3667
|
Nt,
|
|
@@ -3668,7 +3675,7 @@ function Rn({ entries: e, userRoles: t, onEdit: s, loading: r }) {
|
|
|
3668
3675
|
{
|
|
3669
3676
|
title: "Level 1",
|
|
3670
3677
|
key: "l1",
|
|
3671
|
-
render: (o, l) => /* @__PURE__ */
|
|
3678
|
+
render: (o, l) => /* @__PURE__ */ d("span", { children: [
|
|
3672
3679
|
l.l1.minutes ? `Action taken in (${l.l1.minutes} Mins)` : "No Action taken in 0 Min",
|
|
3673
3680
|
l.l1.roles?.length ? `, Escalate to (${a(l.l1.roles)})` : ""
|
|
3674
3681
|
] })
|
|
@@ -3676,7 +3683,7 @@ function Rn({ entries: e, userRoles: t, onEdit: s, loading: r }) {
|
|
|
3676
3683
|
{
|
|
3677
3684
|
title: "Level 2",
|
|
3678
3685
|
key: "l2",
|
|
3679
|
-
render: (o, l) => /* @__PURE__ */
|
|
3686
|
+
render: (o, l) => /* @__PURE__ */ d("span", { children: [
|
|
3680
3687
|
l.l2.minutes ? `Action taken in (${l.l2.minutes} Mins)` : "No Action taken in 0 Min",
|
|
3681
3688
|
l.l2.roles?.length ? `, Escalate to (${a(l.l2.roles)})` : ""
|
|
3682
3689
|
] })
|
|
@@ -3684,7 +3691,7 @@ function Rn({ entries: e, userRoles: t, onEdit: s, loading: r }) {
|
|
|
3684
3691
|
{
|
|
3685
3692
|
title: "Level 3",
|
|
3686
3693
|
key: "l3",
|
|
3687
|
-
render: (o, l) => /* @__PURE__ */
|
|
3694
|
+
render: (o, l) => /* @__PURE__ */ d("span", { children: [
|
|
3688
3695
|
l.l3.minutes ? `Action taken in (${l.l3.minutes} Mins)` : "No Action taken in 0 Min",
|
|
3689
3696
|
l.l3.roles?.length ? `, Escalate to (${a(l.l3.roles)})` : ""
|
|
3690
3697
|
] })
|
|
@@ -3712,15 +3719,15 @@ function Rn({ entries: e, userRoles: t, onEdit: s, loading: r }) {
|
|
|
3712
3719
|
{
|
|
3713
3720
|
title: "Actions",
|
|
3714
3721
|
key: "ops",
|
|
3715
|
-
render: (o, l) => /* @__PURE__ */ i(Se, { type: "text", onClick: () => s(l.id), children: /* @__PURE__ */ i(
|
|
3722
|
+
render: (o, l) => /* @__PURE__ */ i(Se, { type: "text", onClick: () => s(l.id), children: /* @__PURE__ */ i(Ks, {}) })
|
|
3716
3723
|
}
|
|
3717
3724
|
]
|
|
3718
3725
|
}
|
|
3719
3726
|
);
|
|
3720
3727
|
}
|
|
3721
|
-
const { Title:
|
|
3722
|
-
function
|
|
3723
|
-
const { rules: r } = Te(), [n, a] = w(!1), [o, l] = w(s), [
|
|
3728
|
+
const { Title: En } = Ye;
|
|
3729
|
+
function On({ userRoles: e, rules: t, rawRules: s }) {
|
|
3730
|
+
const { rules: r } = Te(), [n, a] = w(!1), [o, l] = w(s), [h, u] = w({}), c = de(() => e.map((m) => ({ label: m.userRoleName, value: m.userRoleId })), [e]), S = de(
|
|
3724
3731
|
() => (t || []).map((m, A) => ({
|
|
3725
3732
|
key: m.RuleId || m.Name || String(A),
|
|
3726
3733
|
ruleName: m.Name || "-",
|
|
@@ -3728,7 +3735,7 @@ function En({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3728
3735
|
})),
|
|
3729
3736
|
[t]
|
|
3730
3737
|
);
|
|
3731
|
-
|
|
3738
|
+
ue(() => {
|
|
3732
3739
|
let m = !1;
|
|
3733
3740
|
return (async () => {
|
|
3734
3741
|
try {
|
|
@@ -3743,23 +3750,23 @@ function En({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3743
3750
|
})(), () => {
|
|
3744
3751
|
m = !0;
|
|
3745
3752
|
};
|
|
3746
|
-
}, []),
|
|
3753
|
+
}, []), ue(() => {
|
|
3747
3754
|
!o && Array.isArray(s) && l(s);
|
|
3748
3755
|
}, [s]);
|
|
3749
|
-
const f =
|
|
3756
|
+
const f = de(() => {
|
|
3750
3757
|
if (!Array.isArray(o) || !o.length) return {};
|
|
3751
3758
|
const m = {};
|
|
3752
3759
|
for (const A of S) {
|
|
3753
|
-
const
|
|
3754
|
-
(
|
|
3755
|
-
|
|
3756
|
-
),
|
|
3757
|
-
|
|
3760
|
+
const B = o.find(
|
|
3761
|
+
(_) => _?.ruleId === A.key || _?.ruleName === A.key || _?.RuleId === A.key || _?.ruleName === A.ruleName || // fallback by name
|
|
3762
|
+
_?.Name === A.ruleName
|
|
3763
|
+
), U = Array.isArray(B?.userRoleIds) ? B.userRoleIds : [];
|
|
3764
|
+
U.length && (m[A.key] = U);
|
|
3758
3765
|
}
|
|
3759
3766
|
return m;
|
|
3760
3767
|
}, [o, S]);
|
|
3761
|
-
return /* @__PURE__ */
|
|
3762
|
-
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ i(
|
|
3768
|
+
return /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
3769
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ i(En, { level: 4, className: "!mb-4", children: "Alert Assignment" }) }),
|
|
3763
3770
|
/* @__PURE__ */ i(
|
|
3764
3771
|
Nt,
|
|
3765
3772
|
{
|
|
@@ -3779,8 +3786,8 @@ function En({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3779
3786
|
mode: "multiple",
|
|
3780
3787
|
placeholder: "Dropdown with Multi select",
|
|
3781
3788
|
className: "w-full",
|
|
3782
|
-
value:
|
|
3783
|
-
onChange: (
|
|
3789
|
+
value: h[A.key] ?? f[A.key] ?? [],
|
|
3790
|
+
onChange: (B) => u((U) => ({ ...U, [A.key]: B })),
|
|
3784
3791
|
options: c
|
|
3785
3792
|
}
|
|
3786
3793
|
)
|
|
@@ -3788,7 +3795,7 @@ function En({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3788
3795
|
]
|
|
3789
3796
|
}
|
|
3790
3797
|
),
|
|
3791
|
-
/* @__PURE__ */
|
|
3798
|
+
/* @__PURE__ */ d(Ie, { className: "mt-4", children: [
|
|
3792
3799
|
/* @__PURE__ */ i(Se, { onClick: () => {
|
|
3793
3800
|
u({});
|
|
3794
3801
|
}, disabled: n, children: "Clear" }),
|
|
@@ -3798,25 +3805,25 @@ function En({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3798
3805
|
type: "primary",
|
|
3799
3806
|
onClick: async () => {
|
|
3800
3807
|
try {
|
|
3801
|
-
if (!o || !Array.isArray(o) || Object.keys(
|
|
3802
|
-
|
|
3808
|
+
if (!o || !Array.isArray(o) || Object.keys(h).length === 0) {
|
|
3809
|
+
ge.info("No changes to save");
|
|
3803
3810
|
return;
|
|
3804
3811
|
}
|
|
3805
3812
|
a(!0);
|
|
3806
|
-
const m = Object.entries(
|
|
3807
|
-
const
|
|
3813
|
+
const m = Object.entries(h).map(async ([A, B]) => {
|
|
3814
|
+
const U = o.find(
|
|
3808
3815
|
(Y) => Y?.ruleId === A || Y?.ruleName === A || Y?.RuleId === A
|
|
3809
|
-
),
|
|
3810
|
-
if (!
|
|
3816
|
+
), _ = typeof U?.recordId == "number" ? U.recordId : void 0;
|
|
3817
|
+
if (!U || typeof _ != "number")
|
|
3811
3818
|
throw new Error(`Unable to find recordId for rule ${A}`);
|
|
3812
|
-
const L = Array.isArray(
|
|
3819
|
+
const L = Array.isArray(B) ? B : [], J = L.map((Y) => {
|
|
3813
3820
|
const K = e.find((T) => T.userRoleId === Y);
|
|
3814
3821
|
return {
|
|
3815
3822
|
id: Y,
|
|
3816
3823
|
name: K?.userRoleName ?? String(Y)
|
|
3817
3824
|
};
|
|
3818
3825
|
}), V = {
|
|
3819
|
-
...
|
|
3826
|
+
...U,
|
|
3820
3827
|
ruleId: A,
|
|
3821
3828
|
// ensure ruleId matches the selected rule
|
|
3822
3829
|
userRoleIds: L,
|
|
@@ -3835,9 +3842,9 @@ function En({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3835
3842
|
}
|
|
3836
3843
|
]
|
|
3837
3844
|
};
|
|
3838
|
-
return r.updateRule(
|
|
3845
|
+
return r.updateRule(_, V);
|
|
3839
3846
|
});
|
|
3840
|
-
await Promise.all(m),
|
|
3847
|
+
await Promise.all(m), ge.success("Alert assignment saved");
|
|
3841
3848
|
try {
|
|
3842
3849
|
const A = await r.getRules();
|
|
3843
3850
|
l(Array.isArray(A) ? A : []), u({});
|
|
@@ -3851,28 +3858,28 @@ function En({ userRoles: e, rules: t, rawRules: s }) {
|
|
|
3851
3858
|
}
|
|
3852
3859
|
},
|
|
3853
3860
|
loading: n,
|
|
3854
|
-
disabled: n || Object.keys(
|
|
3861
|
+
disabled: n || Object.keys(h).length === 0,
|
|
3855
3862
|
children: "Save"
|
|
3856
3863
|
}
|
|
3857
3864
|
)
|
|
3858
3865
|
] })
|
|
3859
3866
|
] });
|
|
3860
3867
|
}
|
|
3861
|
-
const { Title: is } =
|
|
3862
|
-
function
|
|
3863
|
-
const { rules: a, alerts: o } = Te(), [l,
|
|
3864
|
-
|
|
3868
|
+
const { Title: is } = Ye;
|
|
3869
|
+
function Pn({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
3870
|
+
const { rules: a, alerts: o } = Te(), [l, h] = w("By Severity"), [u, c] = w("By severity"), [S, f] = w("By Severity"), [R, N] = w(!1), [m, A] = w(!1), [B, U] = w(!1), [_, L] = w(null), [J, V] = w("rules"), [Y, K] = w(), [T, I] = w(), [k, W] = w(), [te, E] = w(), [v, p] = w(), [x, y] = w(), [b, g] = w(), [O, $] = w(), [P, F] = w([]), [j, z] = w([]), [ne, ae] = w(!1), [me, re] = w(!1), [oe, Re] = w({}), [we, at] = w({}), [je, Ue] = w(s || []), [ze, C] = w([]), [H, ie] = w(!1), [ke, X] = w(!1), [he, He] = w(r || []);
|
|
3871
|
+
ue(() => {
|
|
3865
3872
|
r && r.length && He(r);
|
|
3866
|
-
}, [r]),
|
|
3867
|
-
if (!
|
|
3868
|
-
const M = Object.keys(
|
|
3869
|
-
if (
|
|
3870
|
-
const ee =
|
|
3871
|
-
const Z = t.find((
|
|
3873
|
+
}, [r]), ue(() => {
|
|
3874
|
+
if (!he || !he.length) return;
|
|
3875
|
+
const M = Object.keys(oe).length > 0 || Object.keys(we).length > 0;
|
|
3876
|
+
if (ze.length && !M) return;
|
|
3877
|
+
const ee = he.map((q, D) => {
|
|
3878
|
+
const Z = t.find((pe) => pe.RuleId === (q.ruleId || q.ruleName))?.Name || q.ruleName || q.Name || "-", Q = q.escalationSettings || {}, se = typeof Q.level1UserRoleId == "number" && Q.level1UserRoleId > 0 ? [Q.level1UserRoleId] : [], Ee = typeof Q.level2UserRoleId == "number" && Q.level2UserRoleId > 0 ? [Q.level2UserRoleId] : [], lt = typeof Q.level3UserRoleId == "number" && Q.level3UserRoleId > 0 ? [Q.level3UserRoleId] : [], Ft = (Array.isArray(Q.escalationSettingsActionTypeIds) ? Q.escalationSettingsActionTypeIds : []).map((pe) => oe[pe] || String(pe)), Lt = (Array.isArray(Q.thirdPartyId) ? Q.thirdPartyId : []).map((pe) => we[pe] || String(pe)), ct = typeof Q.humanLoop == "boolean" ? Q.humanLoop : null, ut = typeof Q.isAutoExpire == "boolean" ? Q.isAutoExpire : null;
|
|
3872
3879
|
return {
|
|
3873
3880
|
id: String(q.ruleId || q.ruleName || D),
|
|
3874
3881
|
ruleOrSeverityLabel: Z,
|
|
3875
|
-
l1: { minutes: Q.level1PostAssistTime ?? void 0, roles:
|
|
3882
|
+
l1: { minutes: Q.level1PostAssistTime ?? void 0, roles: se },
|
|
3876
3883
|
l2: { minutes: Q.level2PostAssistTime ?? void 0, roles: Ee },
|
|
3877
3884
|
l3: { minutes: Q.level3PostAssistTime ?? void 0, roles: lt },
|
|
3878
3885
|
actions: Ft,
|
|
@@ -3882,26 +3889,26 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
3882
3889
|
};
|
|
3883
3890
|
});
|
|
3884
3891
|
C(ee);
|
|
3885
|
-
}, [
|
|
3886
|
-
const be =
|
|
3892
|
+
}, [he, t, oe, we]);
|
|
3893
|
+
const be = de(
|
|
3887
3894
|
() => e.map((M) => ({ label: M.DisplayName, value: M.SeverityId })),
|
|
3888
3895
|
[e]
|
|
3889
|
-
), ot =
|
|
3896
|
+
), ot = de(
|
|
3890
3897
|
() => t.map((M) => ({ label: M.Name, value: M.RuleId })),
|
|
3891
3898
|
[t]
|
|
3892
|
-
), ks =
|
|
3899
|
+
), ks = de(
|
|
3893
3900
|
() => je.map((M) => ({ label: M.userRoleName, value: M.userRoleId })),
|
|
3894
3901
|
[je]
|
|
3895
|
-
), Es =
|
|
3896
|
-
|
|
3902
|
+
), Es = de(() => [1, 3, 5, 10, 15, 20, 30, 45, 60].map((M) => ({ label: `${M}`, value: M })), []);
|
|
3903
|
+
ue(() => {
|
|
3897
3904
|
let M = !1;
|
|
3898
3905
|
async function ee() {
|
|
3899
3906
|
try {
|
|
3900
|
-
|
|
3907
|
+
U(!0), L(null);
|
|
3901
3908
|
const q = await o.getAdminSettings();
|
|
3902
3909
|
if (!M && q) {
|
|
3903
3910
|
const D = ds(q.sortBy);
|
|
3904
|
-
|
|
3911
|
+
h(D), f(D), N(!1);
|
|
3905
3912
|
}
|
|
3906
3913
|
} catch (q) {
|
|
3907
3914
|
if (!M) {
|
|
@@ -3909,13 +3916,13 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
3909
3916
|
L(D);
|
|
3910
3917
|
}
|
|
3911
3918
|
} finally {
|
|
3912
|
-
M ||
|
|
3919
|
+
M || U(!1);
|
|
3913
3920
|
}
|
|
3914
3921
|
}
|
|
3915
3922
|
return ee(), () => {
|
|
3916
3923
|
M = !0;
|
|
3917
3924
|
};
|
|
3918
|
-
}, []),
|
|
3925
|
+
}, []), ue(() => {
|
|
3919
3926
|
if (!T) return;
|
|
3920
3927
|
const M = (Z) => {
|
|
3921
3928
|
const Q = Number(Z);
|
|
@@ -3923,28 +3930,28 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
3923
3930
|
}, ee = (Z) => {
|
|
3924
3931
|
const Q = Number(Z);
|
|
3925
3932
|
return !isNaN(Q) && Q > 0 ? Q : void 0;
|
|
3926
|
-
}, D = (
|
|
3933
|
+
}, D = (he || []).find(
|
|
3927
3934
|
(Z) => Z?.ruleId === T || Z?.ruleName === T || Z?.RuleId === T
|
|
3928
3935
|
)?.escalationSettings;
|
|
3929
3936
|
if (D && typeof D == "object") {
|
|
3930
|
-
W(ee(D.level1PostAssistTime)),
|
|
3937
|
+
W(ee(D.level1PostAssistTime)), E(M(D.level1UserRoleId)), p(ee(D.level2PostAssistTime)), y(M(D.level2UserRoleId)), g(ee(D.level3PostAssistTime)), $(M(D.level3UserRoleId));
|
|
3931
3938
|
const Z = Array.isArray(D.escalationSettingsActionTypeIds) ? D.escalationSettingsActionTypeIds : [];
|
|
3932
|
-
|
|
3939
|
+
F(Z.map((Q) => String(Q))), z(Array.isArray(D.thirdPartyId) ? D.thirdPartyId : []), ae(!!D.humanLoop), re(!!D.isAutoExpire);
|
|
3933
3940
|
}
|
|
3934
|
-
}, [J, T,
|
|
3941
|
+
}, [J, T, he]);
|
|
3935
3942
|
const Os = async () => {
|
|
3936
3943
|
try {
|
|
3937
3944
|
X(!0);
|
|
3938
3945
|
const M = await a.getRules(), ee = Array.isArray(M) ? M : Array.isArray(M?.data) ? M.data : [];
|
|
3939
3946
|
He(ee);
|
|
3940
3947
|
const q = ee.map((D, Z) => {
|
|
3941
|
-
const Q = t.find((
|
|
3948
|
+
const Q = t.find((pe) => pe.RuleId === (D.ruleId || D.ruleName))?.Name || D.ruleName || D.Name || "-", se = D.escalationSettings || {}, Ee = typeof se.level1UserRoleId == "number" && se.level1UserRoleId > 0 ? [se.level1UserRoleId] : [], lt = typeof se.level2UserRoleId == "number" && se.level2UserRoleId > 0 ? [se.level2UserRoleId] : [], Dt = typeof se.level3UserRoleId == "number" && se.level3UserRoleId > 0 ? [se.level3UserRoleId] : [], Ut = (Array.isArray(se.escalationSettingsActionTypeIds) ? se.escalationSettingsActionTypeIds : []).map((pe) => oe[pe] || String(pe)), ct = (Array.isArray(se.thirdPartyId) ? se.thirdPartyId : []).map((pe) => we[pe] || String(pe)), ut = typeof se.humanLoop == "boolean" ? se.humanLoop : null;
|
|
3942
3949
|
return {
|
|
3943
3950
|
id: String(D.ruleId || D.ruleName || Z),
|
|
3944
3951
|
ruleOrSeverityLabel: Q,
|
|
3945
|
-
l1: { minutes:
|
|
3946
|
-
l2: { minutes:
|
|
3947
|
-
l3: { minutes:
|
|
3952
|
+
l1: { minutes: se.level1PostAssistTime ?? void 0, roles: Ee },
|
|
3953
|
+
l2: { minutes: se.level2PostAssistTime ?? void 0, roles: lt },
|
|
3954
|
+
l3: { minutes: se.level3PostAssistTime ?? void 0, roles: Dt },
|
|
3948
3955
|
actions: Ut,
|
|
3949
3956
|
notify: ct,
|
|
3950
3957
|
humanLoop: ut
|
|
@@ -3957,7 +3964,7 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
3957
3964
|
X(!1);
|
|
3958
3965
|
}
|
|
3959
3966
|
};
|
|
3960
|
-
return
|
|
3967
|
+
return ue(() => {
|
|
3961
3968
|
let M = !1;
|
|
3962
3969
|
return (async () => {
|
|
3963
3970
|
try {
|
|
@@ -3979,28 +3986,28 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
3979
3986
|
})(), () => {
|
|
3980
3987
|
M = !0;
|
|
3981
3988
|
};
|
|
3982
|
-
}, []), /* @__PURE__ */
|
|
3983
|
-
/* @__PURE__ */
|
|
3989
|
+
}, []), /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
3990
|
+
/* @__PURE__ */ d("div", { className: "mb-6", children: [
|
|
3984
3991
|
/* @__PURE__ */ i(is, { level: 4, className: "!mb-2", children: "Admin Settings" }),
|
|
3985
|
-
/* @__PURE__ */
|
|
3986
|
-
|
|
3992
|
+
/* @__PURE__ */ d(xt, { spinning: B, children: [
|
|
3993
|
+
_ ? /* @__PURE__ */ d("div", { className: "text-sm text-red-600 mb-2", children: [
|
|
3987
3994
|
"Failed to load settings: ",
|
|
3988
|
-
|
|
3995
|
+
_
|
|
3989
3996
|
] }) : null,
|
|
3990
3997
|
/* @__PURE__ */ i(
|
|
3991
|
-
|
|
3998
|
+
Tn,
|
|
3992
3999
|
{
|
|
3993
4000
|
sortBy: l,
|
|
3994
4001
|
groupBy: u,
|
|
3995
4002
|
onChange: (M) => {
|
|
3996
|
-
M.sortBy && (
|
|
4003
|
+
M.sortBy && (h(M.sortBy), N(!0)), M.groupBy && (c(M.groupBy), N(!0));
|
|
3997
4004
|
},
|
|
3998
|
-
showActions:
|
|
4005
|
+
showActions: R,
|
|
3999
4006
|
onSave: async () => {
|
|
4000
4007
|
A(!0);
|
|
4001
4008
|
try {
|
|
4002
4009
|
const M = await o.setAdminSettings({ sortBy: l, groupBy: "string" });
|
|
4003
|
-
M?.responseStatus && M?.data &&
|
|
4010
|
+
M?.responseStatus && M?.data && ge.success(M.data), f(l), N(!1);
|
|
4004
4011
|
} catch (M) {
|
|
4005
4012
|
console.error("Error saving admin settings", M);
|
|
4006
4013
|
} finally {
|
|
@@ -4008,7 +4015,7 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4008
4015
|
}
|
|
4009
4016
|
},
|
|
4010
4017
|
onClear: () => {
|
|
4011
|
-
|
|
4018
|
+
h(S), N(!1);
|
|
4012
4019
|
},
|
|
4013
4020
|
saving: m
|
|
4014
4021
|
}
|
|
@@ -4016,10 +4023,10 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4016
4023
|
] })
|
|
4017
4024
|
] }),
|
|
4018
4025
|
/* @__PURE__ */ i(Ge, { className: "my-6" }),
|
|
4019
|
-
/* @__PURE__ */
|
|
4026
|
+
/* @__PURE__ */ d("div", { children: [
|
|
4020
4027
|
/* @__PURE__ */ i(is, { level: 4, className: "!mb-4", children: "Escalation Settings" }),
|
|
4021
4028
|
/* @__PURE__ */ i(
|
|
4022
|
-
|
|
4029
|
+
Rn,
|
|
4023
4030
|
{
|
|
4024
4031
|
escBasis: J,
|
|
4025
4032
|
setEscBasis: V,
|
|
@@ -4031,47 +4038,47 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4031
4038
|
ruleOptions: ot,
|
|
4032
4039
|
minsOptions: Es,
|
|
4033
4040
|
roleOptions: ks,
|
|
4034
|
-
l1mins:
|
|
4041
|
+
l1mins: k,
|
|
4035
4042
|
setL1mins: W,
|
|
4036
4043
|
l1role: te,
|
|
4037
|
-
setL1role:
|
|
4044
|
+
setL1role: E,
|
|
4038
4045
|
l2mins: v,
|
|
4039
4046
|
setL2mins: p,
|
|
4040
4047
|
l2role: x,
|
|
4041
4048
|
setL2role: y,
|
|
4042
4049
|
l3mins: b,
|
|
4043
4050
|
setL3mins: g,
|
|
4044
|
-
l3role:
|
|
4045
|
-
setL3role:
|
|
4046
|
-
actions:
|
|
4047
|
-
setActions:
|
|
4048
|
-
thirdPartyIds:
|
|
4051
|
+
l3role: O,
|
|
4052
|
+
setL3role: $,
|
|
4053
|
+
actions: P,
|
|
4054
|
+
setActions: F,
|
|
4055
|
+
thirdPartyIds: j,
|
|
4049
4056
|
setThirdPartyIds: z,
|
|
4050
|
-
humanLoop:
|
|
4051
|
-
setHumanLoop:
|
|
4057
|
+
humanLoop: ne,
|
|
4058
|
+
setHumanLoop: ae,
|
|
4052
4059
|
onClear: () => {
|
|
4053
|
-
|
|
4060
|
+
h("By Severity"), c("By severity"), V("rules"), K(void 0), I(void 0), W(void 0), E(void 0), p(void 0), y(void 0), g(void 0), $(void 0), F([]), z([]), ae(!1), re(!1);
|
|
4054
4061
|
},
|
|
4055
4062
|
onSave: async () => {
|
|
4056
4063
|
ie(!0), n?.({
|
|
4057
4064
|
ruleId: T,
|
|
4058
4065
|
levels: [
|
|
4059
|
-
{ minutes:
|
|
4066
|
+
{ minutes: k, role: te },
|
|
4060
4067
|
{ minutes: v, role: x },
|
|
4061
|
-
{ minutes: b, role:
|
|
4068
|
+
{ minutes: b, role: O }
|
|
4062
4069
|
],
|
|
4063
|
-
actions:
|
|
4064
|
-
thirdPartyIds:
|
|
4065
|
-
humanLoop:
|
|
4066
|
-
isAutoExpire:
|
|
4070
|
+
actions: P,
|
|
4071
|
+
thirdPartyIds: j,
|
|
4072
|
+
humanLoop: ne,
|
|
4073
|
+
isAutoExpire: me
|
|
4067
4074
|
});
|
|
4068
4075
|
try {
|
|
4069
4076
|
if (T) {
|
|
4070
|
-
const q = Array.isArray(
|
|
4077
|
+
const q = Array.isArray(P) ? P.map((Ee) => Number(Ee)) : [], D = (he || []).find(
|
|
4071
4078
|
(Ee) => Ee?.ruleId === T || Ee?.ruleName === T || Ee?.RuleId === T
|
|
4072
4079
|
), Z = typeof D?.recordId == "number" ? D.recordId : void 0;
|
|
4073
4080
|
if (!D || typeof Z != "number") {
|
|
4074
|
-
|
|
4081
|
+
ge.error("Unable to find rule recordId for update");
|
|
4075
4082
|
return;
|
|
4076
4083
|
}
|
|
4077
4084
|
const Q = {
|
|
@@ -4092,19 +4099,19 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4092
4099
|
],
|
|
4093
4100
|
escalationSettings: {
|
|
4094
4101
|
level1UserRoleId: te ?? 0,
|
|
4095
|
-
level1PostAssistTime:
|
|
4102
|
+
level1PostAssistTime: k ?? 0,
|
|
4096
4103
|
level2UserRoleId: x ?? 0,
|
|
4097
4104
|
level2PostAssistTime: v ?? 0,
|
|
4098
|
-
level3UserRoleId:
|
|
4105
|
+
level3UserRoleId: O ?? 0,
|
|
4099
4106
|
level3PostAssistTime: b ?? 0,
|
|
4100
4107
|
escalationSettingsActionTypeIds: q,
|
|
4101
|
-
thirdPartyId: Array.isArray(
|
|
4102
|
-
humanLoop:
|
|
4103
|
-
isAutoExpire:
|
|
4108
|
+
thirdPartyId: Array.isArray(j) ? j : [],
|
|
4109
|
+
humanLoop: ne,
|
|
4110
|
+
isAutoExpire: me
|
|
4104
4111
|
}
|
|
4105
|
-
},
|
|
4106
|
-
if (
|
|
4107
|
-
|
|
4112
|
+
}, se = await a.updateRule(Z, Q);
|
|
4113
|
+
if (se?.responseStatus || se?.ok || se) {
|
|
4114
|
+
ge.success("Escalation settings saved"), await Os(), I(void 0), W(void 0), E(void 0), p(void 0), y(void 0), g(void 0), $(void 0), F([]), z([]), ae(!1), re(!1);
|
|
4108
4115
|
return;
|
|
4109
4116
|
}
|
|
4110
4117
|
}
|
|
@@ -4119,16 +4126,16 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4119
4126
|
{
|
|
4120
4127
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
4121
4128
|
ruleOrSeverityLabel: ee,
|
|
4122
|
-
l1: { minutes:
|
|
4129
|
+
l1: { minutes: k, roles: te ? [te] : [] },
|
|
4123
4130
|
l2: { minutes: v, roles: x ? [x] : [] },
|
|
4124
|
-
l3: { minutes: b, roles:
|
|
4125
|
-
actions: (Array.isArray(
|
|
4131
|
+
l3: { minutes: b, roles: O ? [O] : [] },
|
|
4132
|
+
actions: (Array.isArray(P) ? P : []).map((D) => {
|
|
4126
4133
|
const Z = Number(D);
|
|
4127
|
-
return
|
|
4134
|
+
return oe[Z] || String(D);
|
|
4128
4135
|
}),
|
|
4129
|
-
notify: (Array.isArray(
|
|
4130
|
-
humanLoop: !!
|
|
4131
|
-
isAutoExpire: !!
|
|
4136
|
+
notify: (Array.isArray(j) ? j : []).map((D) => we[D] || String(D)),
|
|
4137
|
+
humanLoop: !!ne,
|
|
4138
|
+
isAutoExpire: !!me
|
|
4132
4139
|
}
|
|
4133
4140
|
]);
|
|
4134
4141
|
},
|
|
@@ -4139,37 +4146,37 @@ function On({ severities: e, rules: t, userRoles: s, rawRules: r, onSave: n }) {
|
|
|
4139
4146
|
typeof q.actionTypeId == "number" && (ee[q.actionTypeId] = q.name);
|
|
4140
4147
|
Re(ee);
|
|
4141
4148
|
},
|
|
4142
|
-
isAutoExpire:
|
|
4143
|
-
setAutoExpire:
|
|
4149
|
+
isAutoExpire: me,
|
|
4150
|
+
setAutoExpire: re
|
|
4144
4151
|
}
|
|
4145
4152
|
)
|
|
4146
4153
|
] }),
|
|
4147
4154
|
/* @__PURE__ */ i(Ge, { className: "my-6" }),
|
|
4148
4155
|
/* @__PURE__ */ i(
|
|
4149
|
-
|
|
4156
|
+
kn,
|
|
4150
4157
|
{
|
|
4151
|
-
entries:
|
|
4158
|
+
entries: ze,
|
|
4152
4159
|
userRoles: je,
|
|
4153
4160
|
loading: ke,
|
|
4154
4161
|
onEdit: (M) => {
|
|
4155
4162
|
V("rules");
|
|
4156
|
-
const ee =
|
|
4163
|
+
const ee = ze.find((D) => D.id === M), q = t.find((D) => D.RuleId === M) || (ee ? t.find((D) => D.Name === ee.ruleOrSeverityLabel) : void 0);
|
|
4157
4164
|
I(q ? q.RuleId : M);
|
|
4158
4165
|
}
|
|
4159
4166
|
}
|
|
4160
4167
|
),
|
|
4161
4168
|
/* @__PURE__ */ i(Ge, { className: "my-6" }),
|
|
4162
|
-
/* @__PURE__ */ i(
|
|
4169
|
+
/* @__PURE__ */ i(On, { userRoles: je, rules: t, rawRules: r }),
|
|
4163
4170
|
/* @__PURE__ */ i(Ge, {})
|
|
4164
4171
|
] });
|
|
4165
4172
|
}
|
|
4166
|
-
const { Title: as, Text:
|
|
4167
|
-
function
|
|
4173
|
+
const { Title: as, Text: et } = Ye;
|
|
4174
|
+
function Mn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
4168
4175
|
const { rules: n, alerts: a } = Te(), o = [
|
|
4169
4176
|
{ label: "By Severity", value: "By Severity" },
|
|
4170
4177
|
{ label: "By Created Date", value: "By Created Date" }
|
|
4171
|
-
], [l,
|
|
4172
|
-
|
|
4178
|
+
], [l, h] = w("By Severity"), [u, c] = w(/* @__PURE__ */ new Set()), [S, f] = w(null), [R, N] = w(null), [m, A] = w({ inApp: !1, sms: !1, email: !1 }), [B, U] = w([]), [_, L] = w(!0), [J, V] = w(!1);
|
|
4179
|
+
ue(() => {
|
|
4173
4180
|
let T = !1;
|
|
4174
4181
|
return (async () => {
|
|
4175
4182
|
try {
|
|
@@ -4181,23 +4188,23 @@ function Pn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
|
4181
4188
|
sms: !!I.sms,
|
|
4182
4189
|
email: !!I.email
|
|
4183
4190
|
});
|
|
4184
|
-
const
|
|
4185
|
-
|
|
4191
|
+
const k = ds(I.sortBy);
|
|
4192
|
+
h(k === "By Created Date" ? "By Created Date" : "By Severity"), f(Ht(I.doNotDisturbStart)), N(Ht(I.doNotDisturbEnd)), Array.isArray(I.anomalyIds) && c(new Set(I.anomalyIds.map((W) => String(W))));
|
|
4186
4193
|
} catch (I) {
|
|
4187
4194
|
console.error("Error in loading my preferences: ", I);
|
|
4188
4195
|
}
|
|
4189
4196
|
})(), () => {
|
|
4190
4197
|
T = !0;
|
|
4191
4198
|
};
|
|
4192
|
-
}, []),
|
|
4199
|
+
}, []), ue(() => {
|
|
4193
4200
|
let T = !1;
|
|
4194
4201
|
return (async () => {
|
|
4195
4202
|
try {
|
|
4196
4203
|
L(!0);
|
|
4197
4204
|
const I = await n.getLookups();
|
|
4198
4205
|
if (T || !I) return;
|
|
4199
|
-
const
|
|
4200
|
-
|
|
4206
|
+
const k = Array.isArray(I.anomalies) ? I.anomalies : [];
|
|
4207
|
+
U(k);
|
|
4201
4208
|
} catch (I) {
|
|
4202
4209
|
console.error("Failed to load anomalies lookups", I);
|
|
4203
4210
|
} finally {
|
|
@@ -4209,8 +4216,8 @@ function Pn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
|
4209
4216
|
}, []);
|
|
4210
4217
|
const Y = (T) => {
|
|
4211
4218
|
c((I) => {
|
|
4212
|
-
const
|
|
4213
|
-
return
|
|
4219
|
+
const k = new Set(I);
|
|
4220
|
+
return k.has(T) ? k.delete(T) : k.add(T), k;
|
|
4214
4221
|
});
|
|
4215
4222
|
}, K = async () => {
|
|
4216
4223
|
s?.({
|
|
@@ -4218,14 +4225,14 @@ function Pn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
|
4218
4225
|
subscribedRuleIds: Array.from(u),
|
|
4219
4226
|
dnd: {
|
|
4220
4227
|
from: S,
|
|
4221
|
-
to:
|
|
4228
|
+
to: R
|
|
4222
4229
|
},
|
|
4223
4230
|
channels: m
|
|
4224
4231
|
});
|
|
4225
4232
|
try {
|
|
4226
4233
|
V(!0);
|
|
4227
|
-
const T = S ? S.format?.("HH:mm:ss") ?? "00:00:00" : "00:00:00", I =
|
|
4228
|
-
anomalyIds:
|
|
4234
|
+
const T = S ? S.format?.("HH:mm:ss") ?? "00:00:00" : "00:00:00", I = R ? R.format?.("HH:mm:ss") ?? "00:00:00" : "00:00:00", k = Array.from(u).map((te) => Number(te)).filter((te) => Number.isFinite(te)), W = await a.setPreferenceSettings({
|
|
4235
|
+
anomalyIds: k,
|
|
4229
4236
|
doNotDisturbStart: T,
|
|
4230
4237
|
doNotDisturbEnd: I,
|
|
4231
4238
|
inApp: !!m.inApp,
|
|
@@ -4233,57 +4240,57 @@ function Pn({ severities: e, rules: t, onSave: s, onCancel: r }) {
|
|
|
4233
4240
|
email: !!m.email,
|
|
4234
4241
|
sortBy: l
|
|
4235
4242
|
});
|
|
4236
|
-
W?.responseStatus &&
|
|
4243
|
+
W?.responseStatus && ge.success(W?.data || "Preferences updated successfully.");
|
|
4237
4244
|
} catch (T) {
|
|
4238
4245
|
console.error("Error in saving my preferences: ", T);
|
|
4239
4246
|
} finally {
|
|
4240
4247
|
V(!1);
|
|
4241
4248
|
}
|
|
4242
4249
|
};
|
|
4243
|
-
return /* @__PURE__ */
|
|
4244
|
-
/* @__PURE__ */ i(Ae, { gutter: [16, 16], align: "middle", className: "mb-4", children: /* @__PURE__ */ i(G, { xs: 24, md: 8, children: /* @__PURE__ */
|
|
4245
|
-
/* @__PURE__ */ i(
|
|
4246
|
-
/* @__PURE__ */ i(ve, { className: "w-[240px]", value: l, options: o, onChange:
|
|
4250
|
+
return /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
4251
|
+
/* @__PURE__ */ i(Ae, { gutter: [16, 16], align: "middle", className: "mb-4", children: /* @__PURE__ */ i(G, { xs: 24, md: 8, children: /* @__PURE__ */ d(Ie, { direction: "horizontal", size: 12, className: "w-full items-center", children: [
|
|
4252
|
+
/* @__PURE__ */ i(et, { className: "text-gray-600", children: "Sort By:" }),
|
|
4253
|
+
/* @__PURE__ */ i(ve, { className: "w-[240px]", value: l, options: o, onChange: h })
|
|
4247
4254
|
] }) }) }),
|
|
4248
|
-
/* @__PURE__ */
|
|
4255
|
+
/* @__PURE__ */ d("div", { className: "mb-4", children: [
|
|
4249
4256
|
/* @__PURE__ */ i(as, { level: 5, className: "!mb-2", children: "Anomalies" }),
|
|
4250
|
-
|
|
4251
|
-
const I = String(T.recordId),
|
|
4252
|
-
return /* @__PURE__ */ i(qe, { checked: u.has(I), onChange: () => Y(I), children:
|
|
4257
|
+
_ ? /* @__PURE__ */ i("div", { className: "py-4", children: /* @__PURE__ */ i(xt, {}) }) : /* @__PURE__ */ i(Ie, { direction: "vertical", size: 10, className: "w-full", children: (Array.isArray(B) ? B : []).map((T) => {
|
|
4258
|
+
const I = String(T.recordId), k = T.anomalyName;
|
|
4259
|
+
return /* @__PURE__ */ i(qe, { checked: u.has(I), onChange: () => Y(I), children: k }, I);
|
|
4253
4260
|
}) })
|
|
4254
4261
|
] }),
|
|
4255
|
-
/* @__PURE__ */
|
|
4262
|
+
/* @__PURE__ */ d("div", { className: "mb-4", children: [
|
|
4256
4263
|
/* @__PURE__ */ i(as, { level: 5, className: "!mb-2", children: "Notification Timing & Channels" }),
|
|
4257
|
-
/* @__PURE__ */ i(Ae, { gutter: [16, 16], align: "middle", className: "mb-3", children: /* @__PURE__ */ i(G, { xs: 24, md: 12, children: /* @__PURE__ */
|
|
4258
|
-
/* @__PURE__ */ i(
|
|
4259
|
-
/* @__PURE__ */
|
|
4260
|
-
/* @__PURE__ */
|
|
4261
|
-
/* @__PURE__ */ i(
|
|
4264
|
+
/* @__PURE__ */ i(Ae, { gutter: [16, 16], align: "middle", className: "mb-3", children: /* @__PURE__ */ i(G, { xs: 24, md: 12, children: /* @__PURE__ */ d(Ie, { direction: "horizontal", size: 12, className: "w-full items-center", children: [
|
|
4265
|
+
/* @__PURE__ */ i(et, { children: "Do Not Disturb mode:" }),
|
|
4266
|
+
/* @__PURE__ */ d(Ie, { size: 12, className: "w-full", children: [
|
|
4267
|
+
/* @__PURE__ */ d(Ie, { direction: "horizontal", size: 8, className: "items-center", children: [
|
|
4268
|
+
/* @__PURE__ */ i(et, { children: "From" }),
|
|
4262
4269
|
/* @__PURE__ */ i($t, { value: S, onChange: (T) => f(T), format: "HH:mm" })
|
|
4263
4270
|
] }),
|
|
4264
|
-
/* @__PURE__ */
|
|
4265
|
-
/* @__PURE__ */ i(
|
|
4266
|
-
/* @__PURE__ */ i($t, { value:
|
|
4271
|
+
/* @__PURE__ */ d(Ie, { direction: "horizontal", size: 8, className: "items-center", children: [
|
|
4272
|
+
/* @__PURE__ */ i(et, { children: "To" }),
|
|
4273
|
+
/* @__PURE__ */ i($t, { value: R, onChange: (T) => N(T), format: "HH:mm" })
|
|
4267
4274
|
] })
|
|
4268
4275
|
] })
|
|
4269
4276
|
] }) }) }),
|
|
4270
|
-
/* @__PURE__ */
|
|
4277
|
+
/* @__PURE__ */ d(Ae, { gutter: [24, 12], children: [
|
|
4271
4278
|
/* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(qe, { checked: m.inApp, onChange: (T) => A({ ...m, inApp: T.target.checked }), children: "In-app" }) }),
|
|
4272
4279
|
/* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(qe, { checked: m.sms, onChange: (T) => A({ ...m, sms: T.target.checked }), children: "SMS" }) }),
|
|
4273
4280
|
/* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(qe, { checked: m.email, onChange: (T) => A({ ...m, email: T.target.checked }), children: "Email" }) })
|
|
4274
4281
|
] })
|
|
4275
4282
|
] }),
|
|
4276
4283
|
/* @__PURE__ */ i(Ge, {}),
|
|
4277
|
-
/* @__PURE__ */
|
|
4284
|
+
/* @__PURE__ */ d(Ie, { className: "gap-3", children: [
|
|
4278
4285
|
/* @__PURE__ */ i(Se, { onClick: r, disabled: J, children: "Cancel" }),
|
|
4279
4286
|
/* @__PURE__ */ i(Se, { type: "primary", onClick: K, loading: J, children: "Save" })
|
|
4280
4287
|
] })
|
|
4281
4288
|
] });
|
|
4282
4289
|
}
|
|
4283
|
-
function
|
|
4290
|
+
function Dn({ severities: e, rules: t, userRoles: s, rawRules: r }) {
|
|
4284
4291
|
const [n, a] = w("global");
|
|
4285
|
-
return /* @__PURE__ */
|
|
4286
|
-
/* @__PURE__ */
|
|
4292
|
+
return /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
4293
|
+
/* @__PURE__ */ d("div", { className: "inline-flex rounded-xl overflow-hidden border border-gray-200 mb-4", children: [
|
|
4287
4294
|
/* @__PURE__ */ i(
|
|
4288
4295
|
"button",
|
|
4289
4296
|
{
|
|
@@ -4302,15 +4309,15 @@ function Mn({ severities: e, rules: t, userRoles: s, rawRules: r }) {
|
|
|
4302
4309
|
}
|
|
4303
4310
|
)
|
|
4304
4311
|
] }),
|
|
4305
|
-
n === "global" ? /* @__PURE__ */ i(
|
|
4312
|
+
n === "global" ? /* @__PURE__ */ i(Pn, { severities: e, rules: t, userRoles: s, rawRules: r }) : /* @__PURE__ */ i(Mn, { severities: e, rules: t })
|
|
4306
4313
|
] });
|
|
4307
4314
|
}
|
|
4308
|
-
const
|
|
4309
|
-
function
|
|
4310
|
-
const t = (e.status || "").toLowerCase() === "completed" ? /* @__PURE__ */ i("img", { src:
|
|
4315
|
+
const Fn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIZSURBVHgBnZW/b9NAFMe/z3H6i1ZNJUBFQsL/QQkLCFBtRhhKF1ibhBmpXbtgFlYqsTG0gRGWwgAjMb8EYmjYGN0pCCrVVaX+SBxf37PiqHWcOu5Xsux79+6j77vz3RH66IbdsDTQPCFngmBwqMCPBwVXoe204Fd/2ZfrSWMpHrDshtGCvsY9FlKkFNYD+Es/7EtuX+itp1sLnLrScTWoPMYsfnty/lUPtAOs4syiUgQOoWHJpG9kdBiX11Z+UaZCk1YT+vOzACuzYxgf7hZbyBGvhTi9af+7SkQbyKi7M8N4ZJ5D+eU2dg9UN07KvyNOS8io6UkNFXMMj1/vnACKAuTmNXZpIqME+LF+iIbX7ukjkClODWTQw+ujuGYMYfXzXnICbxSBDrxAUvYDhkrZp6ggUC8+sDI7mpj9YmESb3/uJ5Z9TJ5A3eORvzsBpgs6lufGT2TKPNY3fbxh6Knis0FTSjnx+LP3u5DJicDi/t7MCFadPaRJQTl02/5vKcKnpITluYkwrWjksebs48Pvg3SoUkXtq32hxt+1pITI8Zc/zcGACN59ty/WdWnklV5ukZ+49wU8MUJIF3mBGlqUr3Dv1+wpl20v9UuP75pElyrgc3XK7UJFbLvK4DJiv9ggDmWcjO9G4imWvW00yV/hjvtpOFnpQOVLkcO+0EhyevGrROG1ol1hREFc8ZGxyddIje+v9c4i9+gI5z7MozLxclgAAAAASUVORK5CYII=", Un = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAACpF6WWAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKeSURBVHgBjVVdbtpAEJ5ZmygPfTBSaVWpUt0bwFuURgJOUG5QeoLACbw+QeAEwA3SGxgJokh9CDeI+xSpTRU/Imw8nbFZx6QQGAl5d2fm229+dkDYI2f6oaUAOwhWExBcPnL4FwFBSLCexpCMf+qPi12++PKgpR/cGOwRa1pwQIjgOoWkf6s/hOVzVd588R+/xWjf5YAY8Y0+ErQrZFfnXg3lK3uGm7A+RISOxfbit5NprqBxxgBoeEIVHehqtI9lSz+5McaaITaA2J17bycFaBayMOS8IaT+zHuv4Ui58P9oAvB4Ga0paUgqbFGswL5idIcIx3P9DCiXrQB7iJawcTiCkMMIUlj7Jo8zr6Yv/EfRXXIqRnzUxnP9u46Id8Q5Sslq3+pqWErHAPKqvxROC/ZMuJwKJ8bkPouUkrYUqgt5IgMDKAxfAYT8nAZnmR2A5J47YSjrFKyOYpZN2SiIJ8YjRqVfASyAFVg9s2F2gXwRsClMXdnYcFpq5PyiQ8KEilaywc79+aEow2i7fdCF46SIpuTvCGi2kWSXjCM4QqS4Zl3yjwQ0UySwrBfGRJNjQKW4ZrmEpL45CxUDTGWdgmoZgxOoDA6zxYgr7ZudhWk3x6Sp4kl0nZmgujQhcH5Cvqy/Hxi5hdL+dgsWxR2rma4FkLeDw+PMM243+t2YB0jDDI9nMBquyWqI3tjmLYguQfqDzxebty/DIcnePr9jfePVfDhSzv2/Hs8LAY3kMmFfTCl+rl3uu1GWF6Jx+X3vkpa+58jeeNyXvY3Pd8N+a0hvgK9ge3hMTmG5CPTnSICWcFpXaDfZUcAck99yOnZM/id3hcmAFV/hgEilU6p0TcH2gpZYS98xc/kXUJ8YImPFzfeLh0cgXbMp8n/yD3ySPZSK0MWKAAAAAElFTkSuQmCC";
|
|
4316
|
+
function Ln(e) {
|
|
4317
|
+
const t = (e.status || "").toLowerCase() === "completed" ? /* @__PURE__ */ i("img", { src: Fn, alt: "completed", style: { width: 20, height: 20 } }) : /* @__PURE__ */ i("img", { src: Un, alt: "pending", style: { width: 20, height: 20 } });
|
|
4311
4318
|
return {
|
|
4312
|
-
title: /* @__PURE__ */
|
|
4313
|
-
/* @__PURE__ */
|
|
4319
|
+
title: /* @__PURE__ */ d("div", { className: "flex flex-col gap-0 min-w-0", children: [
|
|
4320
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col", children: [
|
|
4314
4321
|
/* @__PURE__ */ i("span", { className: "block text-sm break-words mb-1 overflow-visible whitespace-normal", children: /* @__PURE__ */ i("b", { children: e.title }) }),
|
|
4315
4322
|
e.description ? /* @__PURE__ */ i("span", { className: "text-gray-500 text-xs", children: e.description }) : null
|
|
4316
4323
|
] }),
|
|
@@ -4320,7 +4327,7 @@ function Un(e) {
|
|
|
4320
4327
|
description: null
|
|
4321
4328
|
};
|
|
4322
4329
|
}
|
|
4323
|
-
function
|
|
4330
|
+
function $n({ data: e }) {
|
|
4324
4331
|
return /* @__PURE__ */ i("div", { className: "w-full", children: /* @__PURE__ */ i(
|
|
4325
4332
|
Ct,
|
|
4326
4333
|
{
|
|
@@ -4329,22 +4336,22 @@ function Ln({ data: e }) {
|
|
|
4329
4336
|
{
|
|
4330
4337
|
key: "action",
|
|
4331
4338
|
label: "Action Taken",
|
|
4332
|
-
children: /* @__PURE__ */
|
|
4333
|
-
/* @__PURE__ */ i(dt, { className: "mb-4 rounded-md p-4", bordered: !0, children: /* @__PURE__ */
|
|
4334
|
-
/* @__PURE__ */
|
|
4339
|
+
children: /* @__PURE__ */ d("div", { className: "w-full", children: [
|
|
4340
|
+
/* @__PURE__ */ i(dt, { className: "mb-4 rounded-md p-4", bordered: !0, children: /* @__PURE__ */ d("div", { className: "grid grid-cols-4 gap-6 text-xs", children: [
|
|
4341
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1", children: [
|
|
4335
4342
|
/* @__PURE__ */ i("span", { className: "text-gray-500", children: "Alert ID" }),
|
|
4336
4343
|
/* @__PURE__ */ i("span", { className: "text-black", children: e.summary.alertNumber })
|
|
4337
4344
|
] }),
|
|
4338
|
-
/* @__PURE__ */
|
|
4345
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1", children: [
|
|
4339
4346
|
/* @__PURE__ */ i("span", { className: "text-gray-500", children: "Severity" }),
|
|
4340
4347
|
/* @__PURE__ */ i("span", { className: "text-black", children: e.summary.severity })
|
|
4341
4348
|
] }),
|
|
4342
|
-
/* @__PURE__ */
|
|
4349
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col gap-1", children: [
|
|
4343
4350
|
/* @__PURE__ */ i("span", { className: "text-gray-500", children: "Location" }),
|
|
4344
4351
|
/* @__PURE__ */ i("span", { className: "text-black", children: e.summary.location })
|
|
4345
4352
|
] })
|
|
4346
4353
|
] }) }),
|
|
4347
|
-
/* @__PURE__ */
|
|
4354
|
+
/* @__PURE__ */ d(dt, { className: "rounded-md p-4", bordered: !0, children: [
|
|
4348
4355
|
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ i("h4", { className: "text-sm text-black font-medium", children: "Response Timeline/ Audit trail/log" }) }),
|
|
4349
4356
|
/* @__PURE__ */ i("div", { className: "mt-2", children: /* @__PURE__ */ i(
|
|
4350
4357
|
js,
|
|
@@ -4352,7 +4359,7 @@ function Ln({ data: e }) {
|
|
|
4352
4359
|
direction: "vertical",
|
|
4353
4360
|
size: "small",
|
|
4354
4361
|
current: 1,
|
|
4355
|
-
items: (e.timeline || []).map(
|
|
4362
|
+
items: (e.timeline || []).map(Ln)
|
|
4356
4363
|
}
|
|
4357
4364
|
) })
|
|
4358
4365
|
] })
|
|
@@ -4361,43 +4368,43 @@ function Ln({ data: e }) {
|
|
|
4361
4368
|
{
|
|
4362
4369
|
key: "notification",
|
|
4363
4370
|
label: "Notification Sent",
|
|
4364
|
-
children: /* @__PURE__ */
|
|
4365
|
-
(e.notifications || []).map((t, s) => /* @__PURE__ */
|
|
4366
|
-
/* @__PURE__ */
|
|
4367
|
-
/* @__PURE__ */
|
|
4371
|
+
children: /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
4372
|
+
(e.notifications || []).map((t, s) => /* @__PURE__ */ d(dt, { className: "rounded-md p-4", bordered: !0, children: [
|
|
4373
|
+
/* @__PURE__ */ d("div", { className: "flex items-start justify-between", children: [
|
|
4374
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col", children: [
|
|
4368
4375
|
/* @__PURE__ */ i("h4", { className: "text-sm text-black font-medium", children: t.channelLabel }),
|
|
4369
4376
|
/* @__PURE__ */ i("span", { className: "text-xs text-gray-500 mt-1", children: us(t.sentAt)?.format("MM/DD/YYYY HH:mm:ss") })
|
|
4370
4377
|
] }),
|
|
4371
|
-
/* @__PURE__ */
|
|
4378
|
+
/* @__PURE__ */ d("span", { className: "text-[11px] px-2 py-1 rounded-full bg-green-50 text-green-700 border border-green-200", children: [
|
|
4372
4379
|
t.delivered,
|
|
4373
4380
|
"/",
|
|
4374
4381
|
t.total,
|
|
4375
4382
|
" Delivered"
|
|
4376
4383
|
] })
|
|
4377
4384
|
] }),
|
|
4378
|
-
/* @__PURE__ */
|
|
4379
|
-
/* @__PURE__ */
|
|
4385
|
+
/* @__PURE__ */ d("div", { className: "mt-4 text-xs", children: [
|
|
4386
|
+
/* @__PURE__ */ d("div", { className: "text-black", children: [
|
|
4380
4387
|
" ",
|
|
4381
4388
|
t.messageTitle
|
|
4382
4389
|
] }),
|
|
4383
4390
|
t.messageBody ? /* @__PURE__ */ i("div", { className: "text-gray-600", children: t.messageBody }) : null
|
|
4384
4391
|
] }),
|
|
4385
|
-
/* @__PURE__ */
|
|
4386
|
-
/* @__PURE__ */
|
|
4392
|
+
/* @__PURE__ */ d("div", { className: "mt-4", children: [
|
|
4393
|
+
/* @__PURE__ */ d("div", { className: "text-xs text-black font-medium", children: [
|
|
4387
4394
|
"Recipients (",
|
|
4388
4395
|
t.total,
|
|
4389
4396
|
")"
|
|
4390
4397
|
] }),
|
|
4391
4398
|
/* @__PURE__ */ i("div", { className: "mt-2 flex flex-col gap-3 text-xs", children: (t.recipients || []).map((r, n) => {
|
|
4392
4399
|
const a = String(r?.notificationReceipientType || "").toLowerCase() === "EscalationNotification".toLowerCase();
|
|
4393
|
-
return /* @__PURE__ */
|
|
4394
|
-
/* @__PURE__ */
|
|
4395
|
-
/* @__PURE__ */
|
|
4400
|
+
return /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
|
|
4401
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col", children: [
|
|
4402
|
+
/* @__PURE__ */ d("span", { className: "text-black", children: [
|
|
4396
4403
|
r.name,
|
|
4397
4404
|
" - ",
|
|
4398
4405
|
/* @__PURE__ */ i("span", { style: { color: a ? "#FF3B30" : "#FFB86A" }, children: a ? "Escalation Notification" : "Alert Notification" })
|
|
4399
4406
|
] }),
|
|
4400
|
-
/* @__PURE__ */
|
|
4407
|
+
/* @__PURE__ */ d("span", { className: "text-gray-500", children: [
|
|
4401
4408
|
r.role,
|
|
4402
4409
|
" . ",
|
|
4403
4410
|
r.phone
|
|
@@ -4433,7 +4440,7 @@ function Ln({ data: e }) {
|
|
|
4433
4440
|
}
|
|
4434
4441
|
) });
|
|
4435
4442
|
}
|
|
4436
|
-
const
|
|
4443
|
+
const Bn = ({
|
|
4437
4444
|
alertId: e,
|
|
4438
4445
|
id: t,
|
|
4439
4446
|
priority: s,
|
|
@@ -4448,7 +4455,7 @@ const $n = ({
|
|
|
4448
4455
|
severity: s || "",
|
|
4449
4456
|
location: r || "",
|
|
4450
4457
|
alertNumber: n ?? ""
|
|
4451
|
-
},
|
|
4458
|
+
}, h = a?.length ? a.map((c) => {
|
|
4452
4459
|
const S = (c?.status || c?.eventStatus || "").toLowerCase() === "completed" ? "Completed" : "Inprogress", f = c?.createdDate ? wt(c.createdDate) : c?.timestamp ? wt(c.timestamp) : "";
|
|
4453
4460
|
return {
|
|
4454
4461
|
status: S,
|
|
@@ -4457,24 +4464,24 @@ const $n = ({
|
|
|
4457
4464
|
timestamp: f
|
|
4458
4465
|
};
|
|
4459
4466
|
}) : [];
|
|
4460
|
-
return /* @__PURE__ */ i(
|
|
4467
|
+
return /* @__PURE__ */ i($n, { data: {
|
|
4461
4468
|
summary: l,
|
|
4462
|
-
timeline:
|
|
4469
|
+
timeline: h,
|
|
4463
4470
|
notifications: o ?? []
|
|
4464
4471
|
} });
|
|
4465
4472
|
};
|
|
4466
|
-
const
|
|
4473
|
+
const jn = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), _n = (e) => e.replace(
|
|
4467
4474
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
4468
4475
|
(t, s, r) => r ? r.toUpperCase() : s.toLowerCase()
|
|
4469
4476
|
), os = (e) => {
|
|
4470
|
-
const t =
|
|
4477
|
+
const t = _n(e);
|
|
4471
4478
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
4472
|
-
}, Cs = (...e) => e.filter((t, s, r) => !!t && t.trim() !== "" && r.indexOf(t) === s).join(" ").trim(),
|
|
4479
|
+
}, Cs = (...e) => e.filter((t, s, r) => !!t && t.trim() !== "" && r.indexOf(t) === s).join(" ").trim(), qn = (e) => {
|
|
4473
4480
|
for (const t in e)
|
|
4474
4481
|
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
4475
4482
|
return !0;
|
|
4476
4483
|
};
|
|
4477
|
-
var
|
|
4484
|
+
var Qn = {
|
|
4478
4485
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4479
4486
|
width: 24,
|
|
4480
4487
|
height: 24,
|
|
@@ -4485,7 +4492,7 @@ var qn = {
|
|
|
4485
4492
|
strokeLinecap: "round",
|
|
4486
4493
|
strokeLinejoin: "round"
|
|
4487
4494
|
};
|
|
4488
|
-
const
|
|
4495
|
+
const Hn = ls(
|
|
4489
4496
|
({
|
|
4490
4497
|
color: e = "currentColor",
|
|
4491
4498
|
size: t = 24,
|
|
@@ -4495,17 +4502,17 @@ const Qn = ls(
|
|
|
4495
4502
|
children: a,
|
|
4496
4503
|
iconNode: o,
|
|
4497
4504
|
...l
|
|
4498
|
-
},
|
|
4505
|
+
}, h) => mt(
|
|
4499
4506
|
"svg",
|
|
4500
4507
|
{
|
|
4501
|
-
ref:
|
|
4502
|
-
...
|
|
4508
|
+
ref: h,
|
|
4509
|
+
...Qn,
|
|
4503
4510
|
width: t,
|
|
4504
4511
|
height: t,
|
|
4505
4512
|
stroke: e,
|
|
4506
4513
|
strokeWidth: r ? Number(s) * 24 / Number(t) : s,
|
|
4507
4514
|
className: Cs("lucide", n),
|
|
4508
|
-
...!a && !
|
|
4515
|
+
...!a && !qn(l) && { "aria-hidden": "true" },
|
|
4509
4516
|
...l
|
|
4510
4517
|
},
|
|
4511
4518
|
[
|
|
@@ -4516,11 +4523,11 @@ const Qn = ls(
|
|
|
4516
4523
|
);
|
|
4517
4524
|
const Is = (e, t) => {
|
|
4518
4525
|
const s = ls(
|
|
4519
|
-
({ className: r, ...n }, a) => mt(
|
|
4526
|
+
({ className: r, ...n }, a) => mt(Hn, {
|
|
4520
4527
|
ref: a,
|
|
4521
4528
|
iconNode: t,
|
|
4522
4529
|
className: Cs(
|
|
4523
|
-
`lucide-${
|
|
4530
|
+
`lucide-${jn(os(e))}`,
|
|
4524
4531
|
`lucide-${e}`,
|
|
4525
4532
|
r
|
|
4526
4533
|
),
|
|
@@ -4529,22 +4536,22 @@ const Is = (e, t) => {
|
|
|
4529
4536
|
);
|
|
4530
4537
|
return s.displayName = os(e), s;
|
|
4531
4538
|
};
|
|
4532
|
-
const
|
|
4539
|
+
const Gn = [
|
|
4533
4540
|
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
4534
4541
|
["path", { d: "m21 3-7 7", key: "1l2asr" }],
|
|
4535
4542
|
["path", { d: "m3 21 7-7", key: "tjx5ai" }],
|
|
4536
4543
|
["path", { d: "M9 21H3v-6", key: "wtvkvv" }]
|
|
4537
|
-
], Ts = Is("maximize-2",
|
|
4538
|
-
const
|
|
4544
|
+
], Ts = Is("maximize-2", Gn);
|
|
4545
|
+
const Wn = [
|
|
4539
4546
|
["path", { d: "m14 10 7-7", key: "oa77jy" }],
|
|
4540
4547
|
["path", { d: "M20 10h-6V4", key: "mjg0md" }],
|
|
4541
4548
|
["path", { d: "m3 21 7-7", key: "tjx5ai" }],
|
|
4542
4549
|
["path", { d: "M4 14h6v6", key: "rmj7iw" }]
|
|
4543
|
-
],
|
|
4550
|
+
], Kn = Is("minimize-2", Wn), Yn = ({ isOpen: e, onClose: t, src: s, type: r = "image" }) => {
|
|
4544
4551
|
const [n, a] = w(!1), [o, l] = w(!1);
|
|
4545
|
-
return
|
|
4552
|
+
return ue(() => {
|
|
4546
4553
|
e && l(!1);
|
|
4547
|
-
}, [e, s]),
|
|
4554
|
+
}, [e, s]), ue(() => {
|
|
4548
4555
|
e && (!s || o) && t();
|
|
4549
4556
|
}, [e, s, o, t]), e ? /* @__PURE__ */ i(
|
|
4550
4557
|
"div",
|
|
@@ -4554,15 +4561,15 @@ const Gn = [
|
|
|
4554
4561
|
tabIndex: 0,
|
|
4555
4562
|
"aria-label": "Close media preview",
|
|
4556
4563
|
onClick: t,
|
|
4557
|
-
onKeyDown: (
|
|
4558
|
-
(
|
|
4564
|
+
onKeyDown: (h) => {
|
|
4565
|
+
(h.key === "Enter" || h.key === " ") && (h.preventDefault(), t());
|
|
4559
4566
|
},
|
|
4560
4567
|
onTouchStart: t,
|
|
4561
|
-
children: /* @__PURE__ */
|
|
4568
|
+
children: /* @__PURE__ */ d(
|
|
4562
4569
|
"div",
|
|
4563
4570
|
{
|
|
4564
4571
|
className: `relative ${n ? "w-full h-full" : "max-w-5xl max-h-[90vh] w-full"} flex items-center justify-center`,
|
|
4565
|
-
onClick: (
|
|
4572
|
+
onClick: (h) => h.stopPropagation(),
|
|
4566
4573
|
children: [
|
|
4567
4574
|
r === "image" ? /* @__PURE__ */ i(
|
|
4568
4575
|
"img",
|
|
@@ -4594,7 +4601,7 @@ const Gn = [
|
|
|
4594
4601
|
{
|
|
4595
4602
|
onClick: () => a(!n),
|
|
4596
4603
|
className: "absolute bottom-3 right-3 text-white bg-black/50 rounded-full p-2 hover:bg-black/70",
|
|
4597
|
-
children: n ? /* @__PURE__ */ i(
|
|
4604
|
+
children: n ? /* @__PURE__ */ i(Kn, { size: 20 }) : /* @__PURE__ */ i(Ts, { size: 20 })
|
|
4598
4605
|
}
|
|
4599
4606
|
)
|
|
4600
4607
|
]
|
|
@@ -4603,55 +4610,55 @@ const Gn = [
|
|
|
4603
4610
|
}
|
|
4604
4611
|
) : null;
|
|
4605
4612
|
};
|
|
4606
|
-
function
|
|
4613
|
+
function zn(e) {
|
|
4607
4614
|
if (!e || typeof e != "string") return !1;
|
|
4608
4615
|
const t = e.split("?")[0].toLowerCase();
|
|
4609
4616
|
return t.endsWith(".mp4") || t.endsWith(".webm") || t.endsWith(".ogg") || t.endsWith(".m3u8");
|
|
4610
4617
|
}
|
|
4611
4618
|
function ft(e) {
|
|
4612
4619
|
const t = (e?.mediaType || e?.type || "").toString().toLowerCase();
|
|
4613
|
-
return t === "video" || t === "mp4" ? !0 :
|
|
4620
|
+
return t === "video" || t === "mp4" ? !0 : zn(e?.mediaUrl || e);
|
|
4614
4621
|
}
|
|
4615
|
-
function
|
|
4622
|
+
function Vn(e) {
|
|
4616
4623
|
const t = e;
|
|
4617
4624
|
return t ? Array.isArray(t) ? t : [t] : [];
|
|
4618
4625
|
}
|
|
4619
|
-
const
|
|
4626
|
+
const Jn = {
|
|
4620
4627
|
Critical: "#FF3B30",
|
|
4621
4628
|
High: "#FFB86A",
|
|
4622
4629
|
Medium: "#FFCC00",
|
|
4623
4630
|
Low: "#007AFF"
|
|
4624
|
-
},
|
|
4631
|
+
}, Zn = {
|
|
4625
4632
|
Critical: "#FFE2E2",
|
|
4626
4633
|
High: "#FF95004D",
|
|
4627
4634
|
Medium: "#FEF9C2",
|
|
4628
4635
|
Low: "#E0EDFF"
|
|
4629
|
-
},
|
|
4630
|
-
const [
|
|
4631
|
-
eventName:
|
|
4636
|
+
}, Xn = ({ isModalOpen: e, handleModalClose: t, selectedRow: s, fetchAlertLogs: r, alertStatusList: n = [], alertStatusLoading: a = !1, initialTab: o = "details", sourceTab: l }) => {
|
|
4637
|
+
const [h, u] = w(), [c, S] = w(""), [f, R] = w(!1), N = Fs(null), [m, A] = w("details"), [B, U] = w(void 0), _ = xs(), { alerts: L } = Te(), [J, V] = w(!1), [Y, K] = w(void 0), [T, I] = w(void 0), [k, W] = w({}), te = s?.originalData || {}, {
|
|
4638
|
+
eventName: E,
|
|
4632
4639
|
alertId: v,
|
|
4633
4640
|
timestamp: p,
|
|
4634
4641
|
description: x,
|
|
4635
4642
|
spaceName: y,
|
|
4636
4643
|
assignTeam: b,
|
|
4637
4644
|
priority: g,
|
|
4638
|
-
statusType:
|
|
4639
|
-
id:
|
|
4640
|
-
alertDetails:
|
|
4641
|
-
statusHistory:
|
|
4642
|
-
mediaDetails:
|
|
4645
|
+
statusType: O,
|
|
4646
|
+
id: $,
|
|
4647
|
+
alertDetails: P,
|
|
4648
|
+
statusHistory: F,
|
|
4649
|
+
mediaDetails: j,
|
|
4643
4650
|
alertNumber: z
|
|
4644
|
-
} = te,
|
|
4651
|
+
} = te, ne = (C) => {
|
|
4645
4652
|
const H = String(C || "").toLowerCase();
|
|
4646
4653
|
return H === "delivered" || H === "sent" ? "Delivered" : H === "failed" ? "Failed" : "Queued";
|
|
4647
|
-
},
|
|
4654
|
+
}, ae = (C) => ({
|
|
4648
4655
|
name: C?.receipientName || C?.recipientName || "-",
|
|
4649
4656
|
role: C?.receipientRoleName || "",
|
|
4650
4657
|
phone: C?.receipentPhoneNumber || C?.recipientPhoneNumber || C?.receipientEmail || C?.recipientEmail || "",
|
|
4651
|
-
status:
|
|
4658
|
+
status: ne(C?.messageStatus),
|
|
4652
4659
|
notificationReceipientType: C?.notificationReceipientType || ""
|
|
4653
|
-
}),
|
|
4654
|
-
const ie = H.map(
|
|
4660
|
+
}), me = (C, H) => {
|
|
4661
|
+
const ie = H.map(ae), ke = ie.filter((be) => be.status === "Delivered").length, X = H.map((be) => be?.sentAt).filter(Boolean).sort((be, ot) => new Date(ot).getTime() - new Date(be).getTime())[0], he = H[0] || {}, He = [he?.severityName, he?.anomalyName].filter(Boolean).join(" - ") || `${C} Notification`;
|
|
4655
4662
|
return {
|
|
4656
4663
|
channelLabel: `${C} Notification`,
|
|
4657
4664
|
sentAt: X || "",
|
|
@@ -4661,57 +4668,57 @@ const Vn = {
|
|
|
4661
4668
|
delivered: ke,
|
|
4662
4669
|
recipients: ie
|
|
4663
4670
|
};
|
|
4664
|
-
},
|
|
4671
|
+
}, re = (C) => {
|
|
4665
4672
|
const H = /* @__PURE__ */ new Map();
|
|
4666
4673
|
return (C || []).forEach((ie) => {
|
|
4667
4674
|
const ke = String(ie?.notificationType || "Unknown"), X = H.get(ke) || [];
|
|
4668
4675
|
X.push(ie), H.set(ke, X);
|
|
4669
|
-
}), Array.from(H.entries()).map(([ie, ke]) =>
|
|
4670
|
-
},
|
|
4676
|
+
}), Array.from(H.entries()).map(([ie, ke]) => me(ie, ke));
|
|
4677
|
+
}, oe = async (C) => {
|
|
4671
4678
|
try {
|
|
4672
|
-
const H = await L.getAlertNotifications(C), ie =
|
|
4673
|
-
|
|
4679
|
+
const H = await L.getAlertNotifications(C), ie = re(H);
|
|
4680
|
+
U(ie);
|
|
4674
4681
|
} catch {
|
|
4675
|
-
|
|
4682
|
+
U(void 0);
|
|
4676
4683
|
}
|
|
4677
4684
|
};
|
|
4678
|
-
|
|
4679
|
-
if (m !== "track" ||
|
|
4685
|
+
ue(() => {
|
|
4686
|
+
if (m !== "track" || !$) return;
|
|
4680
4687
|
let C = !1;
|
|
4681
|
-
return
|
|
4682
|
-
C &&
|
|
4688
|
+
return oe($).then(() => {
|
|
4689
|
+
C && U(void 0);
|
|
4683
4690
|
}), () => {
|
|
4684
4691
|
C = !0;
|
|
4685
4692
|
};
|
|
4686
|
-
}, [m,
|
|
4693
|
+
}, [m, $]), ue(() => {
|
|
4687
4694
|
e && A(o);
|
|
4688
4695
|
}, [e, o]);
|
|
4689
|
-
const we = l === "archived" || ["completed", "false positive"].includes(String(
|
|
4696
|
+
const we = l === "archived" || ["completed", "false positive"].includes(String(O || "").toLowerCase()), at = (C) => {
|
|
4690
4697
|
const H = String(C?.value || "").toLowerCase(), ie = String(C?.statusName || "").toLowerCase();
|
|
4691
4698
|
return H.includes("reopen") || ie.includes("reopen");
|
|
4692
4699
|
}, je = (n || []).filter((C) => {
|
|
4693
4700
|
const H = at(C);
|
|
4694
4701
|
return typeof l < "u" ? l === "archived" ? H : !H : we ? H : !H;
|
|
4695
|
-
}).map((C) => ({ value: C.value, label: C.statusName })), Ue =
|
|
4696
|
-
return
|
|
4702
|
+
}).map((C) => ({ value: C.value, label: C.statusName })), Ue = de(() => Vn(j), [j]);
|
|
4703
|
+
return ue(() => {
|
|
4697
4704
|
let C = !1;
|
|
4698
4705
|
const H = new AbortController(), ie = async (X) => {
|
|
4699
4706
|
if (X) {
|
|
4700
|
-
C || W((
|
|
4707
|
+
C || W((he) => ({ ...he, [X]: !1 }));
|
|
4701
4708
|
try {
|
|
4702
|
-
const
|
|
4703
|
-
if (
|
|
4709
|
+
const he = await fetch(X, { method: "HEAD", signal: H.signal });
|
|
4710
|
+
if (he.ok) {
|
|
4704
4711
|
C || W((be) => ({ ...be, [X]: !0 }));
|
|
4705
4712
|
return;
|
|
4706
4713
|
}
|
|
4707
|
-
if (
|
|
4714
|
+
if (he.status === 404) {
|
|
4708
4715
|
C || W((be) => ({ ...be, [X]: !1 }));
|
|
4709
4716
|
return;
|
|
4710
4717
|
}
|
|
4711
4718
|
if (!(await fetch(X, { method: "GET", signal: H.signal })).ok) throw new Error("Media not available");
|
|
4712
4719
|
C || W((be) => ({ ...be, [X]: !0 }));
|
|
4713
4720
|
} catch {
|
|
4714
|
-
C || W((
|
|
4721
|
+
C || W((he) => ({ ...he, [X]: !1 }));
|
|
4715
4722
|
}
|
|
4716
4723
|
}
|
|
4717
4724
|
};
|
|
@@ -4730,7 +4737,7 @@ const Vn = {
|
|
|
4730
4737
|
overflowY: "auto"
|
|
4731
4738
|
}
|
|
4732
4739
|
},
|
|
4733
|
-
footer: m === "details" ? /* @__PURE__ */
|
|
4740
|
+
footer: m === "details" ? /* @__PURE__ */ d("div", { className: "flex flex-row gap-2 justify-start", children: [
|
|
4734
4741
|
/* @__PURE__ */ i(Se, { onClick: t, className: "bg-[#6C757D] text-white", children: "Cancel" }),
|
|
4735
4742
|
/* @__PURE__ */ i(
|
|
4736
4743
|
Se,
|
|
@@ -4738,17 +4745,17 @@ const Vn = {
|
|
|
4738
4745
|
type: "primary",
|
|
4739
4746
|
onClick: async () => {
|
|
4740
4747
|
try {
|
|
4741
|
-
|
|
4748
|
+
R(!0);
|
|
4742
4749
|
const C = {
|
|
4743
4750
|
alertUniqueId: v,
|
|
4744
|
-
alertId:
|
|
4745
|
-
status:
|
|
4751
|
+
alertId: $,
|
|
4752
|
+
status: h ? String(h) : void 0,
|
|
4746
4753
|
notes: c.trim(),
|
|
4747
4754
|
modifiedBy: 0
|
|
4748
|
-
}, H = await
|
|
4755
|
+
}, H = await _.mutateAsync(C);
|
|
4749
4756
|
if (H?.responseStatus) {
|
|
4750
4757
|
const ie = H?.data || "Alert updated successfully.";
|
|
4751
|
-
|
|
4758
|
+
ge.success(ie, {
|
|
4752
4759
|
autoClose: 1500,
|
|
4753
4760
|
onClose: () => {
|
|
4754
4761
|
r(), t();
|
|
@@ -4756,12 +4763,12 @@ const Vn = {
|
|
|
4756
4763
|
}), u(void 0), S("");
|
|
4757
4764
|
} else {
|
|
4758
4765
|
const ie = H?.errorMessage || "Failed to update alert status";
|
|
4759
|
-
|
|
4766
|
+
ge.error(ie);
|
|
4760
4767
|
}
|
|
4761
4768
|
} catch (C) {
|
|
4762
|
-
console.error("Error updating alert status:", C),
|
|
4769
|
+
console.error("Error updating alert status:", C), ge.error("Failed to update alert status. Please try again.");
|
|
4763
4770
|
} finally {
|
|
4764
|
-
|
|
4771
|
+
R(!1);
|
|
4765
4772
|
}
|
|
4766
4773
|
},
|
|
4767
4774
|
loading: f,
|
|
@@ -4778,42 +4785,42 @@ const Vn = {
|
|
|
4778
4785
|
{
|
|
4779
4786
|
key: "details",
|
|
4780
4787
|
label: "Alert Detail",
|
|
4781
|
-
children: /* @__PURE__ */
|
|
4782
|
-
/* @__PURE__ */
|
|
4783
|
-
/* @__PURE__ */ i("div", { className: "text-sm font-bold", children:
|
|
4784
|
-
|
|
4788
|
+
children: /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4789
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col gap-2", children: [
|
|
4790
|
+
/* @__PURE__ */ i("div", { className: "text-sm font-bold", children: E || "Alert Event" }),
|
|
4791
|
+
P?.firstName ? /* @__PURE__ */ d("div", { className: "text-sm text-gray-500", children: [
|
|
4785
4792
|
"Resident ID/Name: ",
|
|
4786
|
-
|
|
4793
|
+
P?.firstName,
|
|
4787
4794
|
" ",
|
|
4788
|
-
|
|
4795
|
+
P?.lastName || "",
|
|
4789
4796
|
" ",
|
|
4790
|
-
|
|
4797
|
+
P?.residentId || ""
|
|
4791
4798
|
] }) : null,
|
|
4792
|
-
/* @__PURE__ */
|
|
4799
|
+
/* @__PURE__ */ d("div", { className: "text-sm text-gray-500", children: [
|
|
4793
4800
|
"Timestamp: ",
|
|
4794
4801
|
wt(p)
|
|
4795
4802
|
] }),
|
|
4796
|
-
/* @__PURE__ */
|
|
4803
|
+
/* @__PURE__ */ d("div", { className: "font-sm text-gray-500", children: [
|
|
4797
4804
|
/* @__PURE__ */ i("b", { className: "text-black text-sm/6", children: "Description:" }),
|
|
4798
4805
|
" ",
|
|
4799
4806
|
x || "No description available"
|
|
4800
4807
|
] }),
|
|
4801
|
-
y && /* @__PURE__ */
|
|
4808
|
+
y && /* @__PURE__ */ d("div", { className: "font-sm text-gray-500", children: [
|
|
4802
4809
|
"Space: ",
|
|
4803
4810
|
y
|
|
4804
4811
|
] }),
|
|
4805
|
-
b && /* @__PURE__ */
|
|
4812
|
+
b && /* @__PURE__ */ d("div", { className: "font-sm text-gray-500", children: [
|
|
4806
4813
|
"Assigned to: ",
|
|
4807
4814
|
b
|
|
4808
4815
|
] }),
|
|
4809
|
-
/* @__PURE__ */
|
|
4810
|
-
/* @__PURE__ */
|
|
4811
|
-
|
|
4816
|
+
/* @__PURE__ */ d("div", { className: "flex gap-2 justify-start mt-3", children: [
|
|
4817
|
+
/* @__PURE__ */ d(
|
|
4818
|
+
We,
|
|
4812
4819
|
{
|
|
4813
4820
|
className: "font-sm text-gray-500 rounded-[8px] py-2 px-3",
|
|
4814
4821
|
style: {
|
|
4815
|
-
border: `2px solid ${
|
|
4816
|
-
backgroundColor:
|
|
4822
|
+
border: `2px solid ${Jn[String(g)] || "#DFE4EA"}`,
|
|
4823
|
+
backgroundColor: Zn[String(g)]
|
|
4817
4824
|
},
|
|
4818
4825
|
children: [
|
|
4819
4826
|
"Severity: ",
|
|
@@ -4821,31 +4828,31 @@ const Vn = {
|
|
|
4821
4828
|
]
|
|
4822
4829
|
}
|
|
4823
4830
|
),
|
|
4824
|
-
/* @__PURE__ */
|
|
4825
|
-
|
|
4831
|
+
/* @__PURE__ */ d(
|
|
4832
|
+
We,
|
|
4826
4833
|
{
|
|
4827
4834
|
className: "font-sm text-gray-500 rounded-[8px] py-2 px-3",
|
|
4828
|
-
style: String(
|
|
4835
|
+
style: String(O || "").toLowerCase() === "completed" ? { background: "#E7F6EC", border: "0.68px solid var(--Green, #34C759)" } : { background: "#E0EDFF", border: "1px solid var(--Grays-Gray-4, #D1D1D6)" },
|
|
4829
4836
|
children: [
|
|
4830
4837
|
"Status: ",
|
|
4831
|
-
|
|
4838
|
+
O || "N/A"
|
|
4832
4839
|
]
|
|
4833
4840
|
}
|
|
4834
4841
|
)
|
|
4835
4842
|
] }),
|
|
4836
|
-
/* @__PURE__ */ i("div", { className: "w-full flex flex-col justify-start items-start mt-2 font-bold", children: /* @__PURE__ */
|
|
4843
|
+
/* @__PURE__ */ i("div", { className: "w-full flex flex-col justify-start items-start mt-2 font-bold", children: /* @__PURE__ */ d("div", { className: "w-full mt-4", children: [
|
|
4837
4844
|
/* @__PURE__ */ i("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ i(
|
|
4838
4845
|
ve,
|
|
4839
4846
|
{
|
|
4840
4847
|
placeholder: "Change Status",
|
|
4841
4848
|
className: "w-full text-gray-500",
|
|
4842
4849
|
onChange: (C) => u(C),
|
|
4843
|
-
value:
|
|
4850
|
+
value: h,
|
|
4844
4851
|
options: je,
|
|
4845
4852
|
loading: a
|
|
4846
4853
|
}
|
|
4847
4854
|
) }),
|
|
4848
|
-
/* @__PURE__ */
|
|
4855
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col gap-2 mt-3", children: [
|
|
4849
4856
|
/* @__PURE__ */ i("label", { htmlFor: "action-details-input", className: "text-xs text-gray-500 font-medium", children: "Action Taken (Comments)" }),
|
|
4850
4857
|
/* @__PURE__ */ i(
|
|
4851
4858
|
"textarea",
|
|
@@ -4860,10 +4867,10 @@ const Vn = {
|
|
|
4860
4867
|
] })
|
|
4861
4868
|
] }) })
|
|
4862
4869
|
] }),
|
|
4863
|
-
/* @__PURE__ */ i("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */
|
|
4864
|
-
/* @__PURE__ */
|
|
4870
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ d("div", { className: "w-full mt-1", children: [
|
|
4871
|
+
/* @__PURE__ */ d("div", { className: "w-full flex items-center justify-between", children: [
|
|
4865
4872
|
/* @__PURE__ */ i("h3", { className: "text-black font-bold text-sm", children: "Camera Footage" }),
|
|
4866
|
-
Ue.length > 1 ? /* @__PURE__ */
|
|
4873
|
+
Ue.length > 1 ? /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
4867
4874
|
/* @__PURE__ */ i(
|
|
4868
4875
|
"button",
|
|
4869
4876
|
{
|
|
@@ -4871,7 +4878,7 @@ const Vn = {
|
|
|
4871
4878
|
onClick: () => N.current?.prev?.(),
|
|
4872
4879
|
className: "w-6 h-6 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 text-gray-600",
|
|
4873
4880
|
"aria-label": "Previous media",
|
|
4874
|
-
children: /* @__PURE__ */ i(
|
|
4881
|
+
children: /* @__PURE__ */ i(Ys, { style: { fontSize: 12 } })
|
|
4875
4882
|
}
|
|
4876
4883
|
),
|
|
4877
4884
|
/* @__PURE__ */ i(
|
|
@@ -4881,13 +4888,13 @@ const Vn = {
|
|
|
4881
4888
|
onClick: () => N.current?.next?.(),
|
|
4882
4889
|
className: "w-6 h-6 flex items-center justify-center rounded-full bg-gray-200 hover:bg-gray-300 text-gray-600",
|
|
4883
4890
|
"aria-label": "Next media",
|
|
4884
|
-
children: /* @__PURE__ */ i(
|
|
4891
|
+
children: /* @__PURE__ */ i(zs, { style: { fontSize: 12 } })
|
|
4885
4892
|
}
|
|
4886
4893
|
)
|
|
4887
4894
|
] }) : null
|
|
4888
4895
|
] }),
|
|
4889
|
-
Ue.length ? /* @__PURE__ */ i("div", { className: "w-full", children: /* @__PURE__ */ i(qs, { ref: N, dots: !0, className: "w-full", children: Ue.map((C, H) => /* @__PURE__ */
|
|
4890
|
-
ft(C) ? /* @__PURE__ */
|
|
4896
|
+
Ue.length ? /* @__PURE__ */ i("div", { className: "w-full", children: /* @__PURE__ */ i(qs, { ref: N, dots: !0, className: "w-full", children: Ue.map((C, H) => /* @__PURE__ */ d("div", { className: "flex justify-center items-center", children: [
|
|
4897
|
+
ft(C) ? /* @__PURE__ */ d(
|
|
4891
4898
|
"video",
|
|
4892
4899
|
{
|
|
4893
4900
|
width: "240",
|
|
@@ -4908,7 +4915,7 @@ const Vn = {
|
|
|
4908
4915
|
}
|
|
4909
4916
|
),
|
|
4910
4917
|
C.caption && /* @__PURE__ */ i("p", { className: "text-xs text-gray-500 mt-1", children: C.caption }),
|
|
4911
|
-
!ft(C) &&
|
|
4918
|
+
!ft(C) && k[String(C.mediaUrl || C)] ? /* @__PURE__ */ i(
|
|
4912
4919
|
"button",
|
|
4913
4920
|
{
|
|
4914
4921
|
onClick: () => {
|
|
@@ -4921,7 +4928,7 @@ const Vn = {
|
|
|
4921
4928
|
] }, H)) }) }) : null
|
|
4922
4929
|
] }) }),
|
|
4923
4930
|
/* @__PURE__ */ i(
|
|
4924
|
-
|
|
4931
|
+
Yn,
|
|
4925
4932
|
{
|
|
4926
4933
|
isOpen: J,
|
|
4927
4934
|
onClose: () => V(!1),
|
|
@@ -4935,15 +4942,15 @@ const Vn = {
|
|
|
4935
4942
|
key: "track",
|
|
4936
4943
|
label: "Track Incident",
|
|
4937
4944
|
children: /* @__PURE__ */ i(
|
|
4938
|
-
|
|
4945
|
+
Bn,
|
|
4939
4946
|
{
|
|
4940
4947
|
alertId: v,
|
|
4941
|
-
id:
|
|
4948
|
+
id: $,
|
|
4942
4949
|
priority: g,
|
|
4943
4950
|
spaceName: y,
|
|
4944
4951
|
alertNumber: z,
|
|
4945
|
-
statusHistory:
|
|
4946
|
-
notifGroups:
|
|
4952
|
+
statusHistory: F,
|
|
4953
|
+
notifGroups: B
|
|
4947
4954
|
}
|
|
4948
4955
|
)
|
|
4949
4956
|
}
|
|
@@ -4953,7 +4960,7 @@ const Vn = {
|
|
|
4953
4960
|
}
|
|
4954
4961
|
);
|
|
4955
4962
|
};
|
|
4956
|
-
function
|
|
4963
|
+
function ei() {
|
|
4957
4964
|
const { alerts: e } = Te(), t = Mt({
|
|
4958
4965
|
queryKey: ["alerts", "statusList"],
|
|
4959
4966
|
queryFn: () => e.getAlertStatusList(),
|
|
@@ -4967,11 +4974,11 @@ function Xn() {
|
|
|
4967
4974
|
};
|
|
4968
4975
|
}
|
|
4969
4976
|
function Rs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
4970
|
-
const [n, a] = w(!1), [o, l] = w(null), [
|
|
4971
|
-
function f(
|
|
4972
|
-
l(
|
|
4977
|
+
const [n, a] = w(!1), [o, l] = w(null), [h, u] = w("details"), { list: c, loading: S } = ei();
|
|
4978
|
+
function f(B, U) {
|
|
4979
|
+
l(B), u(U?.tab ?? "details"), m(U?.sourceTab ?? "active"), a(!0);
|
|
4973
4980
|
}
|
|
4974
|
-
function
|
|
4981
|
+
function R() {
|
|
4975
4982
|
a(!1);
|
|
4976
4983
|
}
|
|
4977
4984
|
const [N, m] = w("active"), A = o ? {
|
|
@@ -4983,10 +4990,10 @@ function Rs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
|
4983
4990
|
mediaDetails: o.mediaDetails
|
|
4984
4991
|
}
|
|
4985
4992
|
} : null;
|
|
4986
|
-
return /* @__PURE__ */
|
|
4987
|
-
/* @__PURE__ */
|
|
4993
|
+
return /* @__PURE__ */ d("div", { className: "p-6 flex flex-col items-start justify-start min-h-screen w-full overflow-auto", children: [
|
|
4994
|
+
/* @__PURE__ */ d("div", { className: "w-1/2 flex items-center justify-between mb-4", children: [
|
|
4988
4995
|
/* @__PURE__ */ i("h1", { className: "text-xl font-bold text-black", children: "Alert Console" }),
|
|
4989
|
-
/* @__PURE__ */ i(
|
|
4996
|
+
/* @__PURE__ */ i(wn, { label: "USA", timeZone: "America/New_York" })
|
|
4990
4997
|
] }),
|
|
4991
4998
|
/* @__PURE__ */ i(
|
|
4992
4999
|
Ct,
|
|
@@ -4994,8 +5001,8 @@ function Rs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
|
4994
5001
|
defaultActiveKey: "active",
|
|
4995
5002
|
className: "w-full",
|
|
4996
5003
|
tabBarStyle: { fontSize: "medium" },
|
|
4997
|
-
onChange: (
|
|
4998
|
-
|
|
5004
|
+
onChange: (B) => {
|
|
5005
|
+
B === "active" && r?.();
|
|
4999
5006
|
},
|
|
5000
5007
|
items: [
|
|
5001
5008
|
{
|
|
@@ -5006,12 +5013,12 @@ function Rs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
|
5006
5013
|
{
|
|
5007
5014
|
key: "archived",
|
|
5008
5015
|
label: "Archived",
|
|
5009
|
-
children: /* @__PURE__ */ i(
|
|
5016
|
+
children: /* @__PURE__ */ i(An, { alerts: e, loading: t, columns: s || [], onAlertIdClick: f })
|
|
5010
5017
|
},
|
|
5011
5018
|
{
|
|
5012
5019
|
key: "settings",
|
|
5013
5020
|
label: "Settings",
|
|
5014
|
-
children: /* @__PURE__ */ i(
|
|
5021
|
+
children: /* @__PURE__ */ i(ti, {})
|
|
5015
5022
|
}
|
|
5016
5023
|
// {
|
|
5017
5024
|
// key: "reports",
|
|
@@ -5022,31 +5029,31 @@ function Rs({ alerts: e, loading: t = !1, columns: s, onRefetch: r }) {
|
|
|
5022
5029
|
}
|
|
5023
5030
|
),
|
|
5024
5031
|
/* @__PURE__ */ i(
|
|
5025
|
-
|
|
5032
|
+
Xn,
|
|
5026
5033
|
{
|
|
5027
5034
|
isModalOpen: n,
|
|
5028
|
-
handleModalClose:
|
|
5035
|
+
handleModalClose: R,
|
|
5029
5036
|
selectedRow: A,
|
|
5030
5037
|
fetchAlertLogs: () => {
|
|
5031
5038
|
},
|
|
5032
5039
|
alertStatusList: c,
|
|
5033
5040
|
alertStatusLoading: S,
|
|
5034
|
-
initialTab:
|
|
5041
|
+
initialTab: h,
|
|
5035
5042
|
sourceTab: N
|
|
5036
5043
|
}
|
|
5037
5044
|
)
|
|
5038
5045
|
] });
|
|
5039
5046
|
}
|
|
5040
|
-
function
|
|
5047
|
+
function ti() {
|
|
5041
5048
|
const [e, t] = w([]), [s, r] = w([]), [n, a] = w([]), { rules: o } = Te();
|
|
5042
|
-
return
|
|
5049
|
+
return ue(() => {
|
|
5043
5050
|
let l = !0;
|
|
5044
5051
|
return (async () => {
|
|
5045
5052
|
try {
|
|
5046
|
-
const
|
|
5053
|
+
const h = await o.getRules();
|
|
5047
5054
|
if (!l) return;
|
|
5048
|
-
a(Array.isArray(
|
|
5049
|
-
const u = (
|
|
5055
|
+
a(Array.isArray(h) ? h : []);
|
|
5056
|
+
const u = (h || []).map((c, S) => ({
|
|
5050
5057
|
RuleId: c.ruleId || c.ruleName || String(S),
|
|
5051
5058
|
Name: c.ruleName || c.Name || "-",
|
|
5052
5059
|
Description: c.ruleDesc || c.Description || "",
|
|
@@ -5069,7 +5076,7 @@ function ei() {
|
|
|
5069
5076
|
l = !1;
|
|
5070
5077
|
};
|
|
5071
5078
|
}, []), /* @__PURE__ */ i(
|
|
5072
|
-
|
|
5079
|
+
Dn,
|
|
5073
5080
|
{
|
|
5074
5081
|
severities: _e.severities,
|
|
5075
5082
|
rules: e,
|
|
@@ -5078,7 +5085,7 @@ function ei() {
|
|
|
5078
5085
|
}
|
|
5079
5086
|
);
|
|
5080
5087
|
}
|
|
5081
|
-
function
|
|
5088
|
+
function si() {
|
|
5082
5089
|
const { alerts: e } = Te(), t = Mt({
|
|
5083
5090
|
queryKey: ["alerts", "list"],
|
|
5084
5091
|
queryFn: () => e.listAlerts(),
|
|
@@ -5091,11 +5098,11 @@ function ti() {
|
|
|
5091
5098
|
refetch: t.refetch
|
|
5092
5099
|
};
|
|
5093
5100
|
}
|
|
5094
|
-
function
|
|
5095
|
-
const { alerts: t, loading: s, refetch: r } =
|
|
5101
|
+
function ri(e) {
|
|
5102
|
+
const { alerts: t, loading: s, refetch: r } = si();
|
|
5096
5103
|
return /* @__PURE__ */ i(Rs, { alerts: t, loading: s, columns: e.columns, onRefetch: r });
|
|
5097
5104
|
}
|
|
5098
|
-
function
|
|
5105
|
+
function fi({
|
|
5099
5106
|
tenant: e,
|
|
5100
5107
|
apiDomain: t,
|
|
5101
5108
|
rulesDomain: s,
|
|
@@ -5104,7 +5111,7 @@ function hi({
|
|
|
5104
5111
|
loading: a,
|
|
5105
5112
|
columns: o
|
|
5106
5113
|
}) {
|
|
5107
|
-
const [l] = w(() => new
|
|
5114
|
+
const [l] = w(() => new en()), h = de(
|
|
5108
5115
|
() => ({
|
|
5109
5116
|
alertsBaseUrl: t,
|
|
5110
5117
|
rulesBaseUrl: s || t,
|
|
@@ -5112,9 +5119,9 @@ function hi({
|
|
|
5112
5119
|
}),
|
|
5113
5120
|
[t, s, r]
|
|
5114
5121
|
);
|
|
5115
|
-
return /* @__PURE__ */ i(
|
|
5122
|
+
return /* @__PURE__ */ i(tn, { client: l, children: /* @__PURE__ */ i(gr, { tenant: e, override: h, children: Array.isArray(n) ? /* @__PURE__ */ i(Rs, { alerts: n, loading: !!a, columns: o }) : /* @__PURE__ */ i(ri, { columns: o }) }) });
|
|
5116
5123
|
}
|
|
5117
|
-
function
|
|
5124
|
+
function mi(e) {
|
|
5118
5125
|
const { alerts: t } = Te(), s = Mt({
|
|
5119
5126
|
queryKey: ["alerts", "report", e],
|
|
5120
5127
|
queryFn: () => t.getAlertsReport(e),
|
|
@@ -5127,7 +5134,7 @@ function fi(e) {
|
|
|
5127
5134
|
refetch: s.refetch
|
|
5128
5135
|
};
|
|
5129
5136
|
}
|
|
5130
|
-
const
|
|
5137
|
+
const pi = [
|
|
5131
5138
|
{ title: "ID", dataIndex: "id", key: "id", width: 120 },
|
|
5132
5139
|
{ title: "Priority", dataIndex: "priority", key: "priority", width: 120 },
|
|
5133
5140
|
{ title: "Timestamp", dataIndex: "timestamp", key: "timestamp", width: 220 },
|
|
@@ -5135,21 +5142,21 @@ const mi = [
|
|
|
5135
5142
|
{ title: "Description", dataIndex: "description", key: "description" }
|
|
5136
5143
|
];
|
|
5137
5144
|
export {
|
|
5138
|
-
|
|
5145
|
+
On as AlertAssignment,
|
|
5139
5146
|
Rs as AlertConsole,
|
|
5140
|
-
|
|
5147
|
+
fi as AlertConsoleWidget,
|
|
5141
5148
|
ms as AlertsTable,
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5149
|
+
gr as ApiProvider,
|
|
5150
|
+
An as ArchivedTable,
|
|
5151
|
+
wn as Clock,
|
|
5152
|
+
Er as DataTable,
|
|
5153
|
+
Mn as MyPreferencesPanel,
|
|
5154
|
+
Pn as SettingsPanel,
|
|
5155
|
+
Dn as SettingsTabs,
|
|
5156
|
+
pi as exampleAlertColumns,
|
|
5157
|
+
ei as useAlertStatusList,
|
|
5158
|
+
si as useAlerts,
|
|
5159
|
+
mi as useAlertsReport,
|
|
5153
5160
|
Te as useApi,
|
|
5154
5161
|
xs as useUpdateAlertStatus
|
|
5155
5162
|
};
|